fuli-context 0.20.0-beta.9 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/assets/{AboutPage-Dy3drTbS.css → AboutPage-Bxm7RJZg.css} +1 -1
- package/dist/web/assets/{AboutPage-BybzKsx-.js → AboutPage-CjDenGS_.js} +1 -1
- package/dist/web/assets/{AgentName-CXf8heW-.js → AgentName-DdlJlpT3.js} +1 -1
- package/dist/web/assets/{AgentProfilePage-D0YyiAA6.js → AgentProfilePage-Cx_Uf5Vf.js} +1 -1
- package/dist/web/assets/{AgentProfilePage-B2yMnmQP.css → AgentProfilePage-DXvLQu-C.css} +1 -1
- package/dist/web/assets/{AgentsDirectoryPage-DvPJNJm-.css → AgentsDirectoryPage-BwF-0nFO.css} +1 -1
- package/dist/web/assets/{AgentsDirectoryPage-LU-bRYPw.js → AgentsDirectoryPage-DylT-GSW.js} +1 -1
- package/dist/web/assets/{BackLink-Dgc1V1EN.js → BackLink-D7oAvDG5.js} +1 -1
- package/dist/web/assets/{BoardMoveMenu-XrAiFzGj.js → BoardMoveMenu-B0pA7LLx.js} +1 -1
- package/dist/web/assets/CaptureChangePage-Cch3mT4b.css +1 -0
- package/dist/web/assets/{CaptureChangePage-DcJKvaGf.js → CaptureChangePage-DEuqPb14.js} +1 -1
- package/dist/web/assets/{Card-96u8qomm.js → Card-BZFLZ_2I.js} +1 -1
- package/dist/web/assets/{CardHeader-4je7E12I.js → CardHeader-C_c0keQn.js} +1 -1
- package/dist/web/assets/{CardTitle-bjMusOR6.js → CardTitle-yXOhV577.js} +1 -1
- package/dist/web/assets/ConnectionsPage-DlnHdtwn.js +1 -0
- package/dist/web/assets/{CreateProjectDialog-BDwT_wZd.js → CreateProjectDialog-BVJqWdlT.js} +1 -1
- package/dist/web/assets/{DataFormatPage-PxwqDWeZ.js → DataFormatPage-BdcjcyhZ.js} +1 -1
- package/dist/web/assets/DataFormatPage-Dp7mePUw.css +1 -0
- package/dist/web/assets/{DialogFooter-DwgFgHdH.js → DialogFooter-DYawfDCD.js} +1 -1
- package/dist/web/assets/{EmployeeRecruitDialog-DjX_wOWx.js → EmployeeRecruitDialog-CB4ARFkM.js} +1 -1
- package/dist/web/assets/{EmployeeWorkbenchPage-DWhBevwY.js → EmployeeWorkbenchPage-BUMfMBc8.js} +2 -2
- package/dist/web/assets/{EmployeeWorkbenchPage-l_LYqBnr.css → EmployeeWorkbenchPage-BenZP7De.css} +1 -1
- package/dist/web/assets/{GrowthLoading-DssogOkP.js → GrowthLoading-smW3-Gfp.js} +1 -1
- package/dist/web/assets/{InboxPage-fFg4gETv.css → InboxPage-CbbiHgTr.css} +1 -1
- package/dist/web/assets/{InboxPage-BF38gnSV.js → InboxPage-Crn1UU7s.js} +2 -2
- package/dist/web/assets/{Input-DHF3Ivr3.js → Input-F1oftPWh.js} +1 -1
- package/dist/web/assets/{KnowledgeEditDialog-uAzeQbMB.js → KnowledgeEditDialog-VdQwbX4E.js} +1 -1
- package/dist/web/assets/{KnowledgeHardDeleteSection-qGeE1YrK.js → KnowledgeHardDeleteSection-CXRmNnZF.js} +1 -1
- package/dist/web/assets/{KnowledgeItemEditPage-Cj5uNVo6.js → KnowledgeItemEditPage-CQo3TbCJ.js} +1 -1
- package/dist/web/assets/{KnowledgeItemSummaryCard-CeOSN36n.js → KnowledgeItemSummaryCard-Dd2McM-d.js} +1 -1
- package/dist/web/assets/{KnowledgeOrganizerPage-7VC_JAWQ.css → KnowledgeOrganizerPage-BIOaMzgQ.css} +1 -1
- package/dist/web/assets/{KnowledgeOrganizerPage-BVLMc2jL.js → KnowledgeOrganizerPage-BVgAyu6U.js} +1 -1
- package/dist/web/assets/KnowledgePage-Bfbfz_Z8.js +1 -0
- package/dist/web/assets/{KnowledgePeek-BD2zoQqA.js → KnowledgePeek-BNBkh1ey.js} +1 -1
- package/dist/web/assets/KnowledgeTurnReceiptPage-Ckw_olrt.js +1 -0
- package/dist/web/assets/{KnowledgeWorkspace-CgFI31jK.js → KnowledgeWorkspace-pH2tAFld.js} +1 -1
- package/dist/web/assets/{Label-DM1yZ2CL.js → Label-yDCtlpkb.js} +1 -1
- package/dist/web/assets/ModelSettingsPage-C3eBDWRL.js +1 -0
- package/dist/web/assets/ModelSettingsPage-DZkrJw7R.css +1 -0
- package/dist/web/assets/NotFoundPage-8gVVukRR.js +1 -0
- package/dist/web/assets/OccupationsPage-BTormZIO.css +1 -0
- package/dist/web/assets/{OccupationsPage-CHgGGvDu.js → OccupationsPage-PNoqE21Y.js} +1 -1
- package/dist/web/assets/{OverviewPage-E0tfzQRr.js → OverviewPage-DiwYSnhh.js} +2 -2
- package/dist/web/assets/{OverviewPage-CpHmwB7u.css → OverviewPage-YBQHyU7s.css} +1 -1
- package/dist/web/assets/{PersonalProfilePage-CfqsnB1K.css → PersonalProfilePage-CGW50MHm.css} +1 -1
- package/dist/web/assets/{PersonalProfilePage-o5Gpo9nJ.js → PersonalProfilePage-C_v2BFee.js} +1 -1
- package/dist/web/assets/PersonalProjectsPage-Cf5mrQmy.css +1 -0
- package/dist/web/assets/{PersonalProjectsPage-Boj9kG6I.js → PersonalProjectsPage-DGRV8cM5.js} +1 -1
- package/dist/web/assets/{PopperContent-BDOio_9z.js → PopperContent-5zqbtnYr.js} +1 -1
- package/dist/web/assets/{Presence-Bk6m9rvx.js → Presence-BYfYJNMD.js} +1 -1
- package/dist/web/assets/{ProjectAgentDetailPage-Cyl3ZPBO.js → ProjectAgentDetailPage-BQ9ffaCX.js} +2 -2
- package/dist/web/assets/{ProjectAgentDetailPage-Ns2ATys8.css → ProjectAgentDetailPage-CRFE6n-s.css} +1 -1
- package/dist/web/assets/{ProjectAgentDialog-C1_KluEx.js → ProjectAgentDialog-BGckQDTq.js} +1 -1
- package/dist/web/assets/{ProjectAgentFirstTask-CXKvWwhZ.js → ProjectAgentFirstTask-DrSd3nR-.js} +1 -1
- package/dist/web/assets/{ProjectAgentsPage-DKNDXWow.css → ProjectAgentsPage-BBzKAhZx.css} +1 -1
- package/dist/web/assets/{ProjectAgentsPage-DHTo0uNy.js → ProjectAgentsPage-U4Om3EPu.js} +1 -1
- package/dist/web/assets/{ProjectScopePicker-GjK7Hm4N.js → ProjectScopePicker-D0oxbwOd.js} +1 -1
- package/dist/web/assets/{PublicProjectsPage-BuJo0ReR.js → PublicProjectsPage-CvkQ3E8I.js} +1 -1
- package/dist/web/assets/{PublicProjectsPage-yA6Md4oM.css → PublicProjectsPage-Ditr0SY-.css} +1 -1
- package/dist/web/assets/{RadioGroupItem-DxktHt0c.js → RadioGroupItem-CBpbQlHx.js} +1 -1
- package/dist/web/assets/{RoundtablesPage-Bd3XCn7B.js → RoundtablesPage-BEUaKOjI.js} +1 -1
- package/dist/web/assets/RoundtablesPage-BMYSDYH8.css +1 -0
- package/dist/web/assets/{RovingFocusGroup-DyZDm-Bn.js → RovingFocusGroup-X9U-ufYr.js} +1 -1
- package/dist/web/assets/{RovingFocusItem-BKyXKG9n.js → RovingFocusItem-_uA_OCLT.js} +1 -1
- package/dist/web/assets/SessionMigrationPage-WVFSDcUO.js +1 -0
- package/dist/web/assets/{SessionRecordsPage-CvGaB3h3.js → SessionRecordsPage-Bs2eLXEi.js} +1 -1
- package/dist/web/assets/{SettingsPage-DG3ialW3.css → SettingsPage-BbX9ysTX.css} +1 -1
- package/dist/web/assets/{SettingsPage-OasIZiIz.js → SettingsPage-DlIwICIz.js} +1 -1
- package/dist/web/assets/{SharedJefaReportPage-_f2bnFY-.js → SharedJefaReportPage-B_rreEep.js} +1 -1
- package/dist/web/assets/{TabsContent-CTM6GBGk.js → TabsContent-8pXwYJPz.js} +1 -1
- package/dist/web/assets/{TabsTrigger-BFj6S2XJ.js → TabsTrigger-Cd6SI2yI.js} +1 -1
- package/dist/web/assets/{TagVocabularyPage-Cp1UVDoe.js → TagVocabularyPage-BQiuKG-4.js} +1 -1
- package/dist/web/assets/{TaskExecutionPlan-D_MbMVvj.js → TaskExecutionPlan-CupxJeyo.js} +1 -1
- package/dist/web/assets/TaskSchedulesPage-DcmDdY10.css +1 -0
- package/dist/web/assets/{TaskSchedulesPage-Dd38ntqQ.js → TaskSchedulesPage-zYQs7s6T.js} +1 -1
- package/dist/web/assets/{Teleport-D5d1fEVm.js → Teleport-BZX1Eb7R.js} +1 -1
- package/dist/web/assets/{TextField-DUZTbKVz.js → TextField-CielK4l3.js} +1 -1
- package/dist/web/assets/{UiDialog-CU8nqGKC.js → UiDialog-BSDblUpR.js} +1 -1
- package/dist/web/assets/{UiDisclosure-DbxNZe0B.js → UiDisclosure-DLmVwmy1.js} +1 -1
- package/dist/web/assets/{UiIcon-DSkB5Juh.js → UiIcon-B8eZeuGI.js} +1 -1
- package/dist/web/assets/{UiIconButton-Bgy8Hoy4.js → UiIconButton-e754Tmnq.js} +1 -1
- package/dist/web/assets/{UiSegmented-BwkPHeLK.js → UiSegmented-D1HD-qin.js} +1 -1
- package/dist/web/assets/{UiSelect-CW3HNsRZ.js → UiSelect-CbkTsi2e.js} +1 -1
- package/dist/web/assets/{UiToggle--Z_LpW41.js → UiToggle-Dz93aXFK.js} +1 -1
- package/dist/web/assets/{UiWeight-D8U0orbz.js → UiWeight-CUvyApSB.js} +1 -1
- package/dist/web/assets/{UnassignedConversationsPanel-BeWzhuBr.js → UnassignedConversationsPanel-xY7gsFot.js} +1 -1
- package/dist/web/assets/{VirtualDirectoryList-BT099Zuk.js → VirtualDirectoryList-Dv6PwLjU.js} +1 -1
- package/dist/web/assets/{Workbench3D-BAb5m-Qk.js → Workbench3D--4N_uKzp.js} +1 -1
- package/dist/web/assets/WritingTastePage-B7KojA4r.js +1 -0
- package/dist/web/assets/{WritingTastePage-Dh1qW6bK.css → WritingTastePage-asIa-2U5.css} +1 -1
- package/dist/web/assets/{_plugin-vue_export-helper-Crd8aFkh.js → _plugin-vue_export-helper-BmfQlfI8.js} +1 -1
- package/dist/web/assets/{accordion-C-pFa1cg.js → accordion-gXElbGP_.js} +1 -1
- package/dist/web/assets/{agent-occupation-BooDHzf0.js → agent-occupation-ChN-1QjC.js} +1 -1
- package/dist/web/assets/{agent-pins-CFO-xYmz.js → agent-pins-Chh_rdBi.js} +1 -1
- package/dist/web/assets/{agent-profile-Bi--2zRQ.css → agent-profile-LzhgJINr.css} +1 -1
- package/dist/web/assets/{agent-profile.css_vue_type_style_index_0_src_true_lang-BKk2RVxy.js → agent-profile.css_vue_type_style_index_0_src_true_lang-DWlz7UoN.js} +1 -1
- package/dist/web/assets/{agent-work-summary-BIZoVGaT.js → agent-work-summary-C9yMf019.js} +1 -1
- package/dist/web/assets/{attention-store-dDH6VA6Z.js → attention-store-CG9cF6DX.js} +1 -1
- package/dist/web/assets/{badge-BnU2j9Nh.js → badge-DvvDq2Wb.js} +1 -1
- package/dist/web/assets/{button-B4gCj85U.js → button-CFEnxtio.js} +1 -1
- package/dist/web/assets/{checkbox-CzVOT2cF.js → checkbox-DovdRz8u.js} +1 -1
- package/dist/web/assets/{client-Cg0bLxrO.js → client-lh80ewvs.js} +1 -1
- package/dist/web/assets/{console-k05BnLkZ.js → console-CQMgYkk9.js} +1 -1
- package/dist/web/assets/{conversation-launcher-settings-C745vZJa.js → conversation-launcher-settings-B1QM-wZB.js} +1 -1
- package/dist/web/assets/{design-lab-CJiqHzsm.js → design-lab-BDKwIbI8.js} +1 -1
- package/dist/web/assets/{dialog-DQaUWk4W.js → dialog-D2mO6m3B.js} +1 -1
- package/dist/web/assets/{dist-2CLFk118.js → dist-PmK0PfVA.js} +1 -1
- package/dist/web/assets/{dropdown-menu-CN5wjWUD.js → dropdown-menu-YzCnvjAb.js} +1 -1
- package/dist/web/assets/{field-6gOLsuT_.js → field-BMEFEyVC.js} +1 -1
- package/dist/web/assets/{identity-NbL1GGSB.js → identity-bK-fJdnj.js} +1 -1
- package/dist/web/assets/index-BhekqRSJ.js +2 -0
- package/dist/web/assets/index-DedvhyS3.css +1 -0
- package/dist/web/assets/{judgment-types-DfSuVLnV.js → judgment-types-DJnAr9c0.js} +1 -1
- package/dist/web/assets/{model-BjNAHvfb.js → model-BwNZZZNP.js} +1 -1
- package/dist/web/assets/{model-DrZFCNN6.js → model-CPMYnu3S.js} +1 -1
- package/dist/web/assets/{model-DPykou4S.js → model-Cengn9fg.js} +1 -1
- package/dist/web/assets/{model-YYqd0CSe.js → model-CuY1vtEy.js} +1 -1
- package/dist/web/assets/{model-2BvryZbU.js → model-DpVrfbnj.js} +1 -1
- package/dist/web/assets/{model-BsfqK9w_.js → model-rumuELTi.js} +1 -1
- package/dist/web/assets/{motion-preference-CxKthhLy.js → motion-preference-A1AMssSH.js} +1 -1
- package/dist/web/assets/{occupation-catalog-JHFMVvBn.js → occupation-catalog-DxwlYD1L.js} +1 -1
- package/dist/web/assets/{orchestration-filters-B7ZbjZKo.js → orchestration-filters-DZpJ0FN3.js} +1 -1
- package/dist/web/assets/{page-title-BawJ25Bw.js → page-title-Bg-mVyrS.js} +1 -1
- package/dist/web/assets/{personal-profile-graph-BEjSAQMe.js → personal-profile-graph-tMneNj_m.js} +1 -1
- package/dist/web/assets/{project-capture-BUtkhbr1.js → project-capture-QgMw6qvo.js} +1 -1
- package/dist/web/assets/{project-origin-DI7ft7I8.js → project-origin-ppsYHpYL.js} +1 -1
- package/dist/web/assets/project-team-api-DwP0O3rn.js +1 -0
- package/dist/web/assets/{quick-edit-api-CTMfc9uz.js → quick-edit-api-BiyK3ih-.js} +1 -1
- package/dist/web/assets/{shared-report-o1Tvfyn-.js → shared-report-D3Hem1t5.js} +3 -3
- package/dist/web/assets/{task-labels-dW28Ybet.js → task-labels-7KyNw9id.js} +1 -1
- package/dist/web/assets/{ui-BkbPVq3y.js → ui-Ck58paqr.js} +1 -1
- package/dist/web/assets/{useAgentRecords-D6BTApmV.js → useAgentRecords-C6RrZwwv.js} +1 -1
- package/dist/web/assets/{useApi-CROJJdhE-BMswzZdS.js → useApi-CROJJdhE-BujjnKN_.js} +1 -1
- package/dist/web/assets/{useFocusReturn-DQOtrYO8.js → useFocusReturn-D9IOIg17.js} +1 -1
- package/dist/web/assets/{useKnowledgeItemPeek-CGzVMWJz.js → useKnowledgeItemPeek-C6nAzvDL.js} +1 -1
- package/dist/web/assets/{useMinimumLoadingDisplay-DEBBYuGI.js → useMinimumLoadingDisplay-HnxkDut6.js} +1 -1
- package/dist/web/assets/{useRoutePeek-R9W605pr.js → useRoutePeek-BvYFc1BA.js} +1 -1
- package/dist/web/assets/{vue-router-BUjBh_Iw.js → vue-router-Bl55c88B.js} +1 -1
- package/dist/web/index.html +33 -33
- package/docs/agent-apps.md +5 -0
- package/graph-provider/fuli_graph/app.py +16 -11
- package/graph-provider/fuli_graph/graph_query.py +30 -2
- package/graph-provider/fuli_graph/knowledge_audit.py +9 -1
- package/graph-provider/fuli_graph/knowledge_item_routes.py +10 -6
- package/graph-provider/fuli_graph/knowledge_item_view.py +41 -12
- package/graph-provider/fuli_graph/knowledge_item_view_models.py +3 -3
- package/graph-provider/fuli_graph/knowledge_review.py +47 -10
- package/graph-provider/fuli_graph/knowledge_search.py +18 -22
- package/graph-provider/fuli_graph/knowledge_session_migration.py +14 -4
- package/graph-provider/fuli_graph/knowledge_session_migration_models.py +2 -2
- package/graph-provider/fuli_graph/knowledge_tag_routes.py +7 -5
- package/graph-provider/fuli_graph/knowledge_tags.py +8 -4
- package/graph-provider/fuli_graph/knowledge_visibility.py +195 -0
- package/graph-provider/fuli_graph/models.py +12 -2
- package/graph-provider/fuli_graph/preference_conflicts.py +50 -4
- package/graph-provider/fuli_graph/publication_source_copies.py +36 -0
- package/graph-provider/fuli_graph/session_records.py +33 -13
- package/graph-provider/fuli_graph/session_records_models.py +4 -2
- package/graph-provider/fuli_graph/store_knowledge.py +5 -1
- package/graph-provider/fuli_graph/store_publication.py +70 -12
- package/graph-provider/fuli_graph/task_context_models.py +2 -0
- package/graph-provider/fuli_graph/task_session_hints.py +7 -3
- 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/skills/capturing-session-knowledge/references/retrieval.md +6 -0
- package/src/agent-apps/instances.js +85 -26
- package/src/agent-apps/service.js +5 -4
- package/src/agent-tools/graph-definitions.js +4 -4
- package/src/agent-tools/interface-definitions.js +2 -1
- package/src/agent-tools/session-fuli-gate.js +55 -26
- package/src/agent-tools.js +2 -4
- package/src/agents/claude-code/lifecycle-hook.js +29 -12
- package/src/agents/codex/lifecycle-hook.js +25 -10
- package/src/agents/lifecycle-message.js +18 -0
- package/src/agents/turn-receipt.js +15 -8
- package/src/app/agent-request-context.js +18 -0
- package/src/cli/remote-mcp-command.js +6 -2
- package/src/cli/setup-command.js +6 -0
- package/src/cli/update-command.js +14 -1
- package/src/cli/update-installation.js +46 -2
- package/src/conversations/entry-budget.js +116 -0
- package/src/conversations/preference-evidence.js +6 -2
- package/src/conversations/task-context-view.js +13 -8
- package/src/data-format/local-stores.js +2 -0
- package/src/graphiti/agent-conversations.js +24 -3
- package/src/graphiti/assistant-project-candidate.js +5 -2
- package/src/graphiti/capture-notice.js +4 -1
- package/src/graphiti/entry-hint-claim.js +13 -0
- package/src/graphiti/federated-application.js +54 -61
- package/src/graphiti/human-review-channel.js +9 -5
- package/src/graphiti/jefa-board-match.js +4 -1
- package/src/graphiti/knowledge-item-edit.js +7 -4
- package/src/graphiti/knowledge-reader.js +46 -0
- package/src/graphiti/knowledge-result-budget.js +63 -12
- package/src/graphiti/knowledge-tags.js +12 -1
- package/src/graphiti/provider-client.js +18 -25
- package/src/graphiti/publication-draft-capture.js +28 -0
- package/src/graphiti/session-knowledge-migration.js +7 -3
- package/src/graphiti/session-layer-decision.js +28 -6
- package/src/graphiti/session-records.js +26 -15
- package/src/graphiti/shared-project-list.js +36 -0
- package/src/graphiti/task-entry-preferences.js +87 -46
- package/src/graphiti/turn-receipt-delivery.js +5 -2
- package/src/graphiti/writing-taste-profile-workflow.js +13 -7
- package/src/http/api-router.js +2 -1
- package/src/http/graph-api-router.js +13 -10
- package/src/http/knowledge-item-api-router.js +17 -4
- package/src/http/knowledge-tags-api-router.js +21 -9
- package/src/http/request-policy.js +18 -2
- package/src/http/session-records-api-router.js +7 -3
- package/src/judgment/review-prompt.js +21 -1
- package/src/knowledge-owner-reads/console-port.js +51 -0
- package/src/knowledge-tags/console-port.js +3 -2
- package/src/mcp/preference-delivery.js +7 -4
- package/src/mcp/provider-task-context-registry.js +23 -0
- package/src/mcp/tool-result.js +3 -3
- package/src/presence/windows-helper-pin.js +1 -1
- package/src/server.js +14 -2
- package/src/standing-assignments/port.js +146 -0
- package/src/standing-assignments/store.js +151 -0
- package/src/standing-assignments/term-match.js +28 -0
- package/src/text/name-identity.js +33 -0
- package/dist/web/assets/CaptureChangePage-C833Eiqu.css +0 -1
- package/dist/web/assets/ConnectionsPage-EFMP-UeV.js +0 -1
- package/dist/web/assets/DataFormatPage-DERqhmng.css +0 -1
- package/dist/web/assets/KnowledgePage-8ct5iO0F.js +0 -1
- package/dist/web/assets/KnowledgeTurnReceiptPage-Yn3jhDyx.js +0 -1
- package/dist/web/assets/ModelSettingsPage-5RkvgNYN.js +0 -1
- package/dist/web/assets/ModelSettingsPage-BqtWIKEA.css +0 -1
- package/dist/web/assets/NotFoundPage-BUUf2-MZ.js +0 -1
- package/dist/web/assets/OccupationsPage-B55DftFp.css +0 -1
- package/dist/web/assets/PersonalProjectsPage-aU1rApzX.css +0 -1
- package/dist/web/assets/RoundtablesPage-BmmsB1mW.css +0 -1
- package/dist/web/assets/SessionMigrationPage-CQhrJ1OQ.js +0 -1
- package/dist/web/assets/TaskSchedulesPage-CDalUfNj.css +0 -1
- package/dist/web/assets/WritingTastePage-BsekLhC3.js +0 -1
- package/dist/web/assets/index-C2rHjaT6.css +0 -1
- package/dist/web/assets/index-DYEE8nDj.js +0 -2
- package/dist/web/assets/project-team-api-BZMMPuUd.js +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Who reads personal knowledge from the Provider (graph-provider
|
|
2
|
+
// knowledge_visibility.py). Knowledge an FLA wrote, and a preference given to
|
|
3
|
+
// one FLA, is that FLA's: an Agent reads it only as that FLA, in its project.
|
|
4
|
+
// An Agent read names the FLA of its task, or nothing for a plain session;
|
|
5
|
+
// the Provider authorizes the FLA it names. The person's full read is the
|
|
6
|
+
// console's alone and takes its human-review port (src/knowledge-owner-reads).
|
|
7
|
+
|
|
8
|
+
// The reader of a task: its FLA in its project, or null for a plain session.
|
|
9
|
+
export function taskKnowledgeReader(task) {
|
|
10
|
+
return task?.projectAgentId
|
|
11
|
+
? { personalProjectId: task.personalProjectId ?? null, projectAgentId: task.projectAgentId }
|
|
12
|
+
: null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// The reader as the Provider's request fields; a plain session names none.
|
|
16
|
+
export function providerReaderFields(reader) {
|
|
17
|
+
return reader?.projectAgentId
|
|
18
|
+
? { reader_project_id: reader.personalProjectId, reader_agent_id: reader.projectAgentId }
|
|
19
|
+
: {};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// The Provider's graph read, for an Agent's reader or (none) the console's port.
|
|
23
|
+
export function graphReadPath(spaceId, { limit, personalProjectId = null, offset = null, reader = null }) {
|
|
24
|
+
const query = new URLSearchParams({ limit: String(limit) });
|
|
25
|
+
if (personalProjectId) query.set('personal_project_id', personalProjectId);
|
|
26
|
+
if (offset !== null) query.set('offset', String(offset));
|
|
27
|
+
for (const [key, value] of Object.entries(providerReaderFields(reader))) query.set(key, value);
|
|
28
|
+
return `/v1/spaces/${encodeURIComponent(spaceId)}/graph?${query}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// The Provider's preference conflicts. An Agent's read is a plain session's and
|
|
32
|
+
// leaves out every conflict naming an FLA's own item; the console's port reads all.
|
|
33
|
+
export function preferenceConflictsPath(personalSpaceId, { status = null, limit = 500, offset = 0 }) {
|
|
34
|
+
const query = new URLSearchParams({ personal_space_id: personalSpaceId, limit: String(limit) });
|
|
35
|
+
if (status) query.set('status', status);
|
|
36
|
+
if (offset) query.set('offset', String(offset));
|
|
37
|
+
return `/v1/preference-conflicts?${query}`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// The Provider's publication drafts. An Agent's read leaves out a draft of an
|
|
41
|
+
// FLA's work, made before the Provider refused them; the console's port reads all.
|
|
42
|
+
export function publicationDraftsPath(personalSpaceId, { status = 'pending', metadataOnly = false } = {}) {
|
|
43
|
+
const query = new URLSearchParams({ personal_space_id: personalSpaceId, status });
|
|
44
|
+
if (metadataOnly) query.set('metadata_only', 'true');
|
|
45
|
+
return `/v1/publication-drafts?${query}`;
|
|
46
|
+
}
|
|
@@ -5,19 +5,30 @@ import { utf8Preview } from '../text/utf8-preview.js';
|
|
|
5
5
|
|
|
6
6
|
export const AUTOMATIC_RECALL_BYTES = 4 * 1024;
|
|
7
7
|
export const SEARCH_PAGE_BYTES = 8 * 1024;
|
|
8
|
+
const QUERY_PREVIEW_BYTES = 160;
|
|
9
|
+
const PROJECT_ID_LIST_BYTES = 512;
|
|
10
|
+
const PROJECT_ID_LISTS = ['searchedPersonalProjectIds', 'requestedProjectIds', 'searchedProjectIds', 'failedProjectIds'];
|
|
11
|
+
// What a search call derives from its scope rather than from one query's
|
|
12
|
+
// results. A compound search states each once when every query shares it.
|
|
13
|
+
const CALL_SCOPE_FIELDS = ['retrievalGuidance', 'noMatchSourceMarker', 'personalGlobalIncluded',
|
|
14
|
+
'personalProjectScope', 'projectAgentId', ...PROJECT_ID_LISTS, 'project_ids_omitted', 'partial',
|
|
15
|
+
'subscriptions_omitted'];
|
|
8
16
|
const jsonBytes = value => Buffer.byteLength(JSON.stringify(value));
|
|
17
|
+
// Bounded by the bytes a page sends: JSON escaping turns a control character
|
|
18
|
+
// into six bytes and a quote or backslash into two.
|
|
19
|
+
const jsonPreview = (text, limit) => utf8Preview(text, limit, jsonBytes);
|
|
9
20
|
|
|
10
21
|
function itemPreview(item, textBytes) {
|
|
11
22
|
const result = { ...item };
|
|
12
23
|
delete result.attributes;
|
|
13
24
|
for (const key of ['name', 'type', 'source_entity', 'target_entity', 'relationship', 'fact', 'summary']) {
|
|
14
25
|
if (typeof result[key] !== 'string') continue;
|
|
15
|
-
const limited =
|
|
26
|
+
const limited = jsonPreview(result[key], ['fact', 'summary'].includes(key) ? textBytes : 160);
|
|
16
27
|
if (limited !== result[key]) result.text_truncated = true;
|
|
17
28
|
result[key] = limited;
|
|
18
29
|
}
|
|
19
30
|
const sources = Array.isArray(item.source_uris) ? item.source_uris : [];
|
|
20
|
-
result.source_uris = sources.filter(uri => typeof uri === 'string' &&
|
|
31
|
+
result.source_uris = sources.filter(uri => typeof uri === 'string' && jsonBytes(uri) <= 768).slice(0, 2);
|
|
21
32
|
if (sources.length > result.source_uris.length) result.source_uris_omitted = sources.length - result.source_uris.length;
|
|
22
33
|
return result;
|
|
23
34
|
}
|
|
@@ -85,21 +96,28 @@ export function budgetKnowledgeSearch(value, { cursor, context, consoleUrl,
|
|
|
85
96
|
if (!Number.isSafeInteger(index) || !Number.isSafeInteger(offset) || index >= entries.length
|
|
86
97
|
|| offset >= Array.from(entries[index].serialized).length) throw staleCursor();
|
|
87
98
|
}
|
|
88
|
-
const whole = { ...value,
|
|
99
|
+
const whole = { ...(compound ? sharedScope(value, value.results) : value),
|
|
100
|
+
retrieval_budget: { limit_bytes: SEARCH_PAGE_BYTES, complete: true } };
|
|
89
101
|
if (!cursor && jsonBytes(whole) <= SEARCH_PAGE_BYTES) return whole;
|
|
90
|
-
const
|
|
102
|
+
const top = compound ? sharedScope(searchMetadata(value), groups.map(searchMetadata)) : null;
|
|
103
|
+
const bases = compound ? top.results : [searchMetadata(value)];
|
|
91
104
|
const selected = [];
|
|
92
105
|
const render = (nextIndex, nextOffset = 0) => {
|
|
93
106
|
const rendered = bases.map((base, group) => {
|
|
94
107
|
const local = selected.filter(entry => entry.group === group);
|
|
108
|
+
const total_items = lists[group].length;
|
|
109
|
+
// A query with nothing on this page names itself and its count only;
|
|
110
|
+
// its details come with the page that carries its records.
|
|
111
|
+
if (compound && !local.length) return compactGroup(base, total_items);
|
|
95
112
|
const facts = local.filter(entry => entry.kind === 'facts').map(entry => entry.view);
|
|
96
113
|
const entities = local.filter(entry => entry.kind === 'entities').map(entry => entry.view);
|
|
97
|
-
|
|
98
|
-
|
|
114
|
+
const view = { ...base, facts, entities, sourceMarker: marker({ facts, entities }, consoleUrl) };
|
|
115
|
+
return compound ? { ...view, total_items } : { ...view, noMatchSourceMarker: marker({}, consoleUrl) };
|
|
99
116
|
});
|
|
100
117
|
const next = nextIndex < entries.length ? encode(nextIndex, nextOffset) : null;
|
|
101
|
-
return { ...(compound ? { ...
|
|
102
|
-
retrieval_budget: { limit_bytes: SEARCH_PAGE_BYTES, complete: !next, returned_items: selected.length
|
|
118
|
+
return { ...(compound ? { ...top, noMatchSourceMarker: marker({}, consoleUrl), results: rendered } : rendered[0]),
|
|
119
|
+
retrieval_budget: { limit_bytes: SEARCH_PAGE_BYTES, complete: !next, returned_items: selected.length,
|
|
120
|
+
total_items: entries.length },
|
|
103
121
|
...(next ? { next_cursor: next, continuation_tool: 'fuli_call', continuation_tool_name: toolName,
|
|
104
122
|
continuation_guidance: 'Repeat the same search and scope with next_cursor as cursor through fuli_call; do not widen scope.' } : {}) };
|
|
105
123
|
};
|
|
@@ -142,24 +160,57 @@ function identityPreview(item) {
|
|
|
142
160
|
.filter(key => item[key] !== undefined).map(key => [key, item[key]]));
|
|
143
161
|
}
|
|
144
162
|
|
|
163
|
+
// Fields every query group shares move to the top level once; a field that
|
|
164
|
+
// differs between queries stays on each group.
|
|
165
|
+
function sharedScope(top, groups) {
|
|
166
|
+
const shared = CALL_SCOPE_FIELDS.filter(key => groups.length && !(key in top) && key in groups[0]
|
|
167
|
+
&& groups.every(group => key in group && JSON.stringify(group[key]) === JSON.stringify(groups[0][key])));
|
|
168
|
+
return { ...top, ...Object.fromEntries(shared.map(key => [key, groups[0][key]])),
|
|
169
|
+
results: groups.map(group => Object.fromEntries(Object.entries(group).filter(([key]) => !shared.includes(key)))) };
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function compactGroup(base, total_items) {
|
|
173
|
+
return { query: base.query, total_items,
|
|
174
|
+
...Object.fromEntries(CALL_SCOPE_FIELDS.filter(key => key in base).map(key => [key, base[key]])) };
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Scope lists are informational: a continuation re-runs the search from its
|
|
178
|
+
// own input, so a page may name a prefix and count the rest.
|
|
179
|
+
function boundedIds(ids) {
|
|
180
|
+
const kept = [];
|
|
181
|
+
for (const id of ids) {
|
|
182
|
+
if (jsonBytes([...kept, id]) > PROJECT_ID_LIST_BYTES) break;
|
|
183
|
+
kept.push(id);
|
|
184
|
+
}
|
|
185
|
+
return kept;
|
|
186
|
+
}
|
|
187
|
+
|
|
145
188
|
function searchMetadata(value) {
|
|
146
189
|
const { facts, entities, results, sourceMarker, noMatchSourceMarker, subscriptions,
|
|
147
190
|
relatedProjectSuggestions, related_project_suggestions, ...rest } = value;
|
|
148
191
|
const result = { ...rest };
|
|
149
|
-
if (typeof result.query === 'string') result.query =
|
|
192
|
+
if (typeof result.query === 'string') result.query = jsonPreview(result.query, QUERY_PREVIEW_BYTES);
|
|
150
193
|
if (subscriptions?.length) result.subscriptions_omitted = subscriptions.length;
|
|
194
|
+
for (const key of PROJECT_ID_LISTS) {
|
|
195
|
+
if (!Array.isArray(result[key])) continue;
|
|
196
|
+
const kept = boundedIds(result[key]);
|
|
197
|
+
if (kept.length < result[key].length) {
|
|
198
|
+
result.project_ids_omitted = { ...result.project_ids_omitted, [key]: result[key].length - kept.length };
|
|
199
|
+
}
|
|
200
|
+
result[key] = kept;
|
|
201
|
+
}
|
|
151
202
|
for (const [key, items] of [['relatedProjectSuggestions', relatedProjectSuggestions],
|
|
152
203
|
['related_project_suggestions', related_project_suggestions]]) {
|
|
153
204
|
if (!Array.isArray(items)) continue;
|
|
154
205
|
result[key] = items.slice(0, 3).map(item => ({ ...item,
|
|
155
|
-
project_name: typeof item.project_name === 'string' ?
|
|
156
|
-
reason: typeof item.reason === 'string' ?
|
|
206
|
+
project_name: typeof item.project_name === 'string' ? jsonPreview(item.project_name, 160) : item.project_name,
|
|
207
|
+
reason: typeof item.reason === 'string' ? jsonPreview(item.reason, 256) : item.reason }));
|
|
157
208
|
if (items.length > 3) result.related_suggestions_omitted = items.length - 3;
|
|
158
209
|
}
|
|
159
210
|
// Detailed suggestions remain available on focused queries. Permission flags
|
|
160
211
|
// and exact confirmed_search targets above are retained, never inferred.
|
|
161
212
|
for (const key of ['relatedProjectGuidance', 'related_project_guidance']) {
|
|
162
|
-
if (typeof result[key] === 'string') result[key] =
|
|
213
|
+
if (typeof result[key] === 'string') result[key] = jsonPreview(result[key], 512);
|
|
163
214
|
}
|
|
164
215
|
return result;
|
|
165
216
|
}
|
|
@@ -15,6 +15,7 @@ const ROUTES = Object.freeze({
|
|
|
15
15
|
create: 'create', add_alias: 'aliases', attach: 'attach', detach: 'detach'
|
|
16
16
|
});
|
|
17
17
|
const CHANGES = new Set(['create', 'add_alias', 'attach', 'detach']);
|
|
18
|
+
const ACROSS_PROJECTS = new Set(['metrics', 'vocabulary', 'detail', 'governance_preview']);
|
|
18
19
|
// What an Agent may ask the person for; the person also removes aliases and relates tags.
|
|
19
20
|
const PROPOSALS = new Set(['approve', 'merge', 'split', 'retire', 'undo']);
|
|
20
21
|
// revive: the person's create of a retired word that would drop something comes back as a preview.
|
|
@@ -84,6 +85,16 @@ export async function personKnowledgeTagChange(application, tagsConsole, input)
|
|
|
84
85
|
: result;
|
|
85
86
|
}
|
|
86
87
|
|
|
88
|
+
// The owner's console view across every project: vocabulary, detail, metrics
|
|
89
|
+
// and a governance preview. It lists and counts the links of every FLA's own
|
|
90
|
+
// knowledge, so the Provider answers it only on the human-review channel
|
|
91
|
+
// tagsConsole sends on; an Agent reads its own scope (allProjects false).
|
|
92
|
+
export function readTagsAcrossProjects(application, tagsConsole, operation, input) {
|
|
93
|
+
if (!ACROSS_PROJECTS.has(operation)) throw new TypeError(`Unknown knowledge tag read: ${operation}`);
|
|
94
|
+
activeSpace(application, input.personalSpaceId);
|
|
95
|
+
return tagsConsole.send(ROUTES[operation], { ...scope(input), ...BODIES[operation]({ ...input, allProjects: true }) });
|
|
96
|
+
}
|
|
97
|
+
|
|
87
98
|
// The person's governance, applied naming the digest of the preview they saw.
|
|
88
99
|
export function applyTagGovernance(application, tagsConsole, input) {
|
|
89
100
|
if (!GOVERNANCE.has(input.change)) invalid('change must be a tag governance change');
|
|
@@ -129,7 +140,7 @@ function changedBy(input) {
|
|
|
129
140
|
|
|
130
141
|
function activeSpace(application, personalSpaceId) {
|
|
131
142
|
if (personalSpaceId !== application.config.personal.spaceId) {
|
|
132
|
-
invalid('Tags are changed in the active personal space');
|
|
143
|
+
invalid('Tags are read and changed in the active personal space');
|
|
133
144
|
}
|
|
134
145
|
}
|
|
135
146
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ApplicationError } from '../app/application-error.js';
|
|
2
2
|
import { activeAgentRequestSignal } from '../app/agent-request-context.js';
|
|
3
|
+
import { graphReadPath, preferenceConflictsPath, publicationDraftsPath } from './knowledge-reader.js';
|
|
3
4
|
import { preferenceTaskSession } from './preference-task-scope.js';
|
|
5
|
+
import { afterProjectWrite, sharedProjectList } from './shared-project-list.js';
|
|
4
6
|
|
|
5
7
|
const DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
|
|
6
8
|
const MAX_REQUEST_TIMEOUT_MS = 2_147_483_647;
|
|
@@ -173,17 +175,17 @@ export class GraphitiProviderClient {
|
|
|
173
175
|
return this.#request(`/v1/projects/${encodeURIComponent(projectId)}/releases`);
|
|
174
176
|
}
|
|
175
177
|
deleteProject(projectId) {
|
|
176
|
-
return this.#request(`/v1/projects/${encodeURIComponent(projectId)}`, { method: 'DELETE' });
|
|
178
|
+
return afterProjectWrite(this, () => this.#request(`/v1/projects/${encodeURIComponent(projectId)}`, { method: 'DELETE' }));
|
|
177
179
|
}
|
|
178
180
|
upsertPersonalProject(input) {
|
|
179
|
-
return this.#request('/v1/personal-projects', { method: 'PUT', body: input });
|
|
181
|
+
return afterProjectWrite(this, () => this.#request('/v1/personal-projects', { method: 'PUT', body: input }));
|
|
180
182
|
}
|
|
181
183
|
ensureTemporaryProject(input) {
|
|
182
|
-
return this.#request('/v1/temporary-projects/ensure', { method: 'POST', body: input });
|
|
184
|
+
return afterProjectWrite(this, () => this.#request('/v1/temporary-projects/ensure', { method: 'POST', body: input }));
|
|
183
185
|
}
|
|
184
186
|
listPersonalProjects(personalSpaceId) {
|
|
185
187
|
const query = new URLSearchParams({ personal_space_id: personalSpaceId });
|
|
186
|
-
return this.#request(`/v1/personal-projects?${query}`);
|
|
188
|
+
return sharedProjectList(this, personalSpaceId, () => this.#request(`/v1/personal-projects?${query}`));
|
|
187
189
|
}
|
|
188
190
|
getPersonalProject(personalSpaceId, projectId) {
|
|
189
191
|
const query = new URLSearchParams({ personal_space_id: personalSpaceId });
|
|
@@ -636,10 +638,8 @@ export class GraphitiProviderClient {
|
|
|
636
638
|
method: 'POST', body: { personal_space_id: personalSpaceId }
|
|
637
639
|
});
|
|
638
640
|
}
|
|
639
|
-
// rec#20:
|
|
640
|
-
|
|
641
|
-
return this.#request('/v1/knowledge/item-views', { method: 'POST', body: input });
|
|
642
|
-
}
|
|
641
|
+
// rec#20: a turn's receipt as an Agent reads it (knowledge-reader.js). The
|
|
642
|
+
// console's item views and full reads use its own port (src/knowledge-owner-reads).
|
|
643
643
|
readTurnReceipt(input) {
|
|
644
644
|
return this.#request('/v1/knowledge/turn-receipts', { method: 'POST', body: input });
|
|
645
645
|
}
|
|
@@ -647,8 +647,10 @@ export class GraphitiProviderClient {
|
|
|
647
647
|
readSessionRecords(input) {
|
|
648
648
|
return this.#request('/v1/session-records', { method: 'POST', body: input });
|
|
649
649
|
}
|
|
650
|
-
// rec#20 part 2: what a session's temporary project holds
|
|
651
|
-
//
|
|
650
|
+
// rec#20 part 2: what a session's temporary project holds, as an Agent's
|
|
651
|
+
// offer reads it (knowledge-reader.js). The console's page reads it through
|
|
652
|
+
// its own port (src/knowledge-owner-reads); scope writes go through the
|
|
653
|
+
// console's human-review channel (src/knowledge-scope).
|
|
652
654
|
previewSessionMigration(input) {
|
|
653
655
|
return this.#request('/v1/knowledge/session-migrations/preview', { method: 'POST', body: input });
|
|
654
656
|
}
|
|
@@ -668,9 +670,7 @@ export class GraphitiProviderClient {
|
|
|
668
670
|
return this.#request('/v1/publication-drafts', { method: 'POST', body: input });
|
|
669
671
|
}
|
|
670
672
|
listPublicationDrafts(personalSpaceId, status = 'pending', { metadataOnly = false, ...options } = {}) {
|
|
671
|
-
|
|
672
|
-
if (metadataOnly) query.set('metadata_only', 'true');
|
|
673
|
-
return this.#request(`/v1/publication-drafts?${query}`, options);
|
|
673
|
+
return this.#request(publicationDraftsPath(personalSpaceId, { status, metadataOnly }), options);
|
|
674
674
|
}
|
|
675
675
|
getPublicationDraft(personalSpaceId, draftId) {
|
|
676
676
|
const query = new URLSearchParams({ personal_space_id: personalSpaceId });
|
|
@@ -863,14 +863,9 @@ export class GraphitiProviderClient {
|
|
|
863
863
|
method: 'POST', body: input
|
|
864
864
|
});
|
|
865
865
|
}
|
|
866
|
+
// An Agent's read, as a plain session; the console's full list uses its own port (src/knowledge-owner-reads).
|
|
866
867
|
listPreferenceConflicts(personalSpaceId, status = null, limit = 500, offset = 0) {
|
|
867
|
-
|
|
868
|
-
personal_space_id: personalSpaceId,
|
|
869
|
-
limit: String(limit)
|
|
870
|
-
});
|
|
871
|
-
if (status) query.set('status', status);
|
|
872
|
-
if (offset) query.set('offset', String(offset));
|
|
873
|
-
return this.#request(`/v1/preference-conflicts?${query}`);
|
|
868
|
+
return this.#request(preferenceConflictsPath(personalSpaceId, { status, limit, offset }));
|
|
874
869
|
}
|
|
875
870
|
resolvePreferenceConflict(conflictId, input) {
|
|
876
871
|
return this.#request(
|
|
@@ -938,11 +933,9 @@ export class GraphitiProviderClient {
|
|
|
938
933
|
}
|
|
939
934
|
return this.#request(`/v1/collaboration-preferences?${query}`);
|
|
940
935
|
}
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
if (offset !== null) query.set('offset', String(offset));
|
|
945
|
-
return this.#request(`/v1/spaces/${encodeURIComponent(spaceId)}/graph?${query}`);
|
|
936
|
+
// An Agent's read (knowledge-reader.js): reader names its FLA, or null for a plain session.
|
|
937
|
+
graph(spaceId, limit = 500, personalProjectId = null, offset = null, reader = null) {
|
|
938
|
+
return this.#request(graphReadPath(spaceId, { limit, personalProjectId, offset, reader }));
|
|
946
939
|
}
|
|
947
940
|
|
|
948
941
|
// A long-running client (an MCP server) outlives a token rotation, for
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { receiptConsoleUrl } from '../agents/identity-receipt.js';
|
|
2
|
+
import { ProviderRequestError } from './provider-client.js';
|
|
3
|
+
|
|
4
|
+
// A capture for a team project waits as a local pre-review draft until the
|
|
5
|
+
// person submits it from the console's publish queue. The Provider answers a
|
|
6
|
+
// create that meets an existing draft this caller may not read exactly as a
|
|
7
|
+
// missing draft (0.20.1): a team-only draft is the person's alone, and a
|
|
8
|
+
// self-reported source is no proof that it is the same create. A 404 here
|
|
9
|
+
// proves nothing either way (a retry after a lost reply, or any other miss),
|
|
10
|
+
// so the capture is reported unconfirmed: neither saved nor lost, no cause guessed.
|
|
11
|
+
const UNCONFIRMED = 'Cannot confirm whether this capture was saved; check the publish queue in the FULI console.';
|
|
12
|
+
|
|
13
|
+
export async function queuePublicationDraft(application, { input, workspace, episode }) {
|
|
14
|
+
const queued = { route: 'personal_review', projectId: input.spaceId, providerUrl: workspace.providerUrl };
|
|
15
|
+
try {
|
|
16
|
+
const draft = await application.personal.createPublicationDraft({
|
|
17
|
+
personal_space_id: application.config.personal.spaceId,
|
|
18
|
+
target_project_id: input.spaceId,
|
|
19
|
+
provider_url: workspace.providerUrl,
|
|
20
|
+
episode
|
|
21
|
+
});
|
|
22
|
+
return { ...queued, status: draft.status, draftId: draft.id };
|
|
23
|
+
} catch (error) {
|
|
24
|
+
if (!(error instanceof ProviderRequestError && error.status === 404)) throw error;
|
|
25
|
+
return { ...queued, status: 'unconfirmed', message: UNCONFIRMED,
|
|
26
|
+
reviewUrl: `${receiptConsoleUrl(application)}/public-projects` };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ApplicationError, ApplicationErrorCode } from '../app/application-error.js';
|
|
2
2
|
import { receiptConsoleUrl } from '../agents/identity-receipt.js';
|
|
3
3
|
import { requiredString } from '../validation/values.js';
|
|
4
|
+
import { providerReaderFields, taskKnowledgeReader } from './knowledge-reader.js';
|
|
4
5
|
import { isTemporaryProjectId } from './temporary-project-scope.js';
|
|
5
6
|
|
|
6
7
|
// rec#20 part 2: what a host session saved while nobody chose where it applies
|
|
@@ -20,10 +21,12 @@ const MAX_PROJECT_ID = 128;
|
|
|
20
21
|
const MAX_ITEMS = 100;
|
|
21
22
|
|
|
22
23
|
// One page of the held items, oldest first; offset is where the page starts.
|
|
23
|
-
|
|
24
|
+
// ownerReads: the console's port (src/knowledge-owner-reads), so the person's
|
|
25
|
+
// page lists and counts every FLA's held items.
|
|
26
|
+
export function readSessionMigration(application, ownerReads, input) {
|
|
24
27
|
const offset = input.offset === null || input.offset === undefined || input.offset === '' ? 0 : Number(input.offset);
|
|
25
28
|
if (!Number.isInteger(offset) || offset < 0) invalid('offset must be where a page of held items starts');
|
|
26
|
-
return
|
|
29
|
+
return ownerReads.sessionMigration({ ...target(application, input), include_items: true, offset });
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
// scopeConsole: the console port that sends it on the human-review channel (src/knowledge-scope).
|
|
@@ -56,11 +59,12 @@ export function sessionMigrationLine(application, task, { heldCount = null } = {
|
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
// The entry's offer once a session links to a formal project; never blocks the entry.
|
|
62
|
+
// It reads as the task's FLA or plain session, so another FLA's held items are not counted.
|
|
59
63
|
export async function sessionMigrationOffer(application, task) {
|
|
60
64
|
if (!formalTask(task)) return null;
|
|
61
65
|
try {
|
|
62
66
|
const pending = await application.personal.previewSessionMigration({ ...providerTarget(application, task),
|
|
63
|
-
include_items: false });
|
|
67
|
+
include_items: false, ...providerReaderFields(taskKnowledgeReader(task)) });
|
|
64
68
|
if (!(pending?.held_count > 0) || pending.linked_task_count > 1) return null;
|
|
65
69
|
return sessionMigrationLine(application, task, { heldCount: pending.held_count });
|
|
66
70
|
} catch {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { debuglog } from 'node:util';
|
|
2
|
-
import { activeAgentHostClient, activeAgentHostSession } from '../app/agent-request-context.js';
|
|
2
|
+
import { activeAgentHostClient, activeAgentHostSession, activeTaskBoundSession } from '../app/agent-request-context.js';
|
|
3
3
|
import { isFuliProcessSession } from '../mcp/session-id.js';
|
|
4
4
|
|
|
5
5
|
// The session layer of what FULI does for a caller (rec#5 C3 and C3b): whether
|
|
@@ -9,7 +9,9 @@ import { isFuliProcessSession } from '../mcp/session-id.js';
|
|
|
9
9
|
// would trigger). Both answers rest on the same identities.
|
|
10
10
|
//
|
|
11
11
|
// Only two identities can authorize a call: the session bound to its task (the
|
|
12
|
-
// hook issued the task's token for the session it ran in
|
|
12
|
+
// hook issued the task's token for the session it ran in; a tool whose schema
|
|
13
|
+
// names no task is bound by the current token it carries, which the session
|
|
14
|
+
// gate resolved through the task registry) and, for an Agent's
|
|
13
15
|
// own MCP or CLI call, the host session its client process runs in
|
|
14
16
|
// (agentHostRequestContext()). A session the call merely names can only refuse
|
|
15
17
|
// it, never allow it. Calls outside an Agent call (hooks, the console) are
|
|
@@ -18,7 +20,10 @@ import { isFuliProcessSession } from '../mcp/session-id.js';
|
|
|
18
20
|
// window's port carry the session layer; a port composed without one (a test
|
|
19
21
|
// double) has no paused or stopped sessions.
|
|
20
22
|
//
|
|
21
|
-
// scope: { sourceApplication, boundSessionId, sessionId }
|
|
23
|
+
// scope: { sourceApplication, boundSessionId, sessionId, tokenUnresolved }
|
|
24
|
+
// tokenUnresolved: why a task token the call carried bound it to no session
|
|
25
|
+
// ('task_token_not_current' or 'policy_unavailable'). It changes no decision,
|
|
26
|
+
// only the reason a call refused for want of a task says.
|
|
22
27
|
|
|
23
28
|
const ALLOWED = Object.freeze({ allowed: true, reason: null, layer: null });
|
|
24
29
|
// NODE_DEBUG=fuli-capture shows decisions made without a session layer.
|
|
@@ -47,11 +52,12 @@ export function sessionCaptureDecision(application, scope) {
|
|
|
47
52
|
// FULI could not record, so a call without a task token is refused then too.
|
|
48
53
|
// Calls with a task token keep one window's stop out of another (C3b-5); a
|
|
49
54
|
// token's session with no durable record follows the default, so it is off.
|
|
55
|
+
// A call whose token did not resolve is refused the same way, saying why.
|
|
50
56
|
export function sessionUseDecision(application, scope) {
|
|
51
57
|
if (!sessionsMayBeOff(application)) return ALLOWED;
|
|
52
58
|
return decideSessions(application, scope, { refusal: offRefusal,
|
|
53
59
|
unattributed: sourceApplication => application.hasStoppedSession(sourceApplication)
|
|
54
|
-
|| !application.sessionFuliDefault().enabled ? denied('session_unattributed') : null });
|
|
60
|
+
|| !application.sessionFuliDefault().enabled ? denied(scope.tokenUnresolved ?? 'session_unattributed') : null });
|
|
55
61
|
}
|
|
56
62
|
|
|
57
63
|
// False when FULI is on for every session, the usual case, so a caller can
|
|
@@ -66,6 +72,18 @@ export function sessionsMayBeOff(application) {
|
|
|
66
72
|
}
|
|
67
73
|
}
|
|
68
74
|
|
|
75
|
+
// Whether a session of the client may record nothing (paused, stopped or
|
|
76
|
+
// started off), so a call's writes need to know which session they are for.
|
|
77
|
+
// True when the state cannot be read.
|
|
78
|
+
export function sessionsMayBeWithoutCapture(application, sourceApplication) {
|
|
79
|
+
if (!application.getSessionCapturePause) return false;
|
|
80
|
+
try {
|
|
81
|
+
return application.hasSessionWithoutCapture(sourceApplication);
|
|
82
|
+
} catch {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
69
87
|
// Whether FULI is on for one host session and why, and the default for new
|
|
70
88
|
// sessions, for the session switch and its status (rec#5 C3b). Throws when
|
|
71
89
|
// the state cannot be read.
|
|
@@ -80,8 +98,12 @@ export function newSessionsFuli(application) {
|
|
|
80
98
|
return application.sessionFuliDefault().enabled ? 'on' : 'off';
|
|
81
99
|
}
|
|
82
100
|
|
|
83
|
-
function decideSessions(application, { boundSessionId = null, sessionId = null, sourceApplication: named = 'other' }, policy) {
|
|
101
|
+
function decideSessions(application, { boundSessionId: scopeTask = null, sessionId = null, sourceApplication: named = 'other' }, policy) {
|
|
84
102
|
const host = activeAgentHostSession();
|
|
103
|
+
// A tool whose schema names no task, called with a current task token: the
|
|
104
|
+
// session the registry resolved for it is the call's task session too.
|
|
105
|
+
const callTask = activeTaskBoundSession();
|
|
106
|
+
const boundSessionId = scopeTask ?? callTask;
|
|
85
107
|
// An Agent call's client is the one its process was started for, never the payload's.
|
|
86
108
|
const sourceApplication = activeAgentHostClient() ?? named;
|
|
87
109
|
const agentCall = host !== undefined;
|
|
@@ -100,7 +122,7 @@ function decideSessions(application, { boundSessionId = null, sessionId = null,
|
|
|
100
122
|
// The call's own sessions: its task's, any it names and, without a task,
|
|
101
123
|
// the host session of the call. With a task, the host session is checked
|
|
102
124
|
// below even when the MCP layer filled it in as the named session.
|
|
103
|
-
const own = boundSessionId ? [boundSessionId, sessionId === host ? null : sessionId] : [sessionId, host];
|
|
125
|
+
const own = boundSessionId ? [boundSessionId, callTask, sessionId === host ? null : sessionId] : [sessionId, host];
|
|
104
126
|
for (const id of new Set(own.filter(Boolean))) {
|
|
105
127
|
const refusal = policy.refusal(stateOf(id));
|
|
106
128
|
if (refusal) return refusal;
|
|
@@ -3,6 +3,7 @@ import { receiptSummary, receiptText, sessionRecordsUrl } from '../agents/identi
|
|
|
3
3
|
import { CATEGORY, CONFIRMATION } from '../agents/turn-receipt.js';
|
|
4
4
|
import { notRecordedReason } from '../conversations/transcript-capture-gap.js';
|
|
5
5
|
import { localClockTime } from '../text/clock-time.js';
|
|
6
|
+
import { providerReaderFields, taskKnowledgeReader } from './knowledge-reader.js';
|
|
6
7
|
import { requiredString } from '../validation/values.js';
|
|
7
8
|
|
|
8
9
|
// "本会话记了什么" (rec#5 C6): one host session's records in three groups,
|
|
@@ -13,10 +14,12 @@ import { requiredString } from '../validation/values.js';
|
|
|
13
14
|
// nothing was recorded (paused, stopped or otherwise off) are shown as
|
|
14
15
|
// "HH:mm~HH:mm 暂停记录" / "未记录" and hold no record.
|
|
15
16
|
//
|
|
16
|
-
// The console is the person's own view and lists everything
|
|
17
|
-
//
|
|
18
|
-
// Agent's own project (C6-5)
|
|
19
|
-
//
|
|
17
|
+
// The console is the person's own view and lists everything, read through
|
|
18
|
+
// its human-review port (ownerReads). An Agent reads only its own session,
|
|
19
|
+
// only what that session wrote while in the Agent's own project (C6-5), and
|
|
20
|
+
// as its task's FLA or plain session, so the Provider leaves out every other
|
|
21
|
+
// FLA's knowledge: records a turn wrote in another project never enter this
|
|
22
|
+
// project's context, not even as a count.
|
|
20
23
|
|
|
21
24
|
const GROUPS = Object.freeze(['transcript', 'knowledge', 'preference_evidence']);
|
|
22
25
|
const MAX_SESSION_ID = 256;
|
|
@@ -24,13 +27,13 @@ const MAX_CLIENT = 32;
|
|
|
24
27
|
|
|
25
28
|
// sourceApplication may be left out: a receipt's short link names only the
|
|
26
29
|
// session, and the Provider finds its client (or says two clients share it).
|
|
27
|
-
export async function readSessionRecords(application, { personalSpaceId, sourceApplication = null, sessionId }) {
|
|
30
|
+
export async function readSessionRecords(application, ownerReads, { personalSpaceId, sourceApplication = null, sessionId }) {
|
|
28
31
|
if (personalSpaceId !== application.config.personal.spaceId) {
|
|
29
32
|
invalid('Session records are read in the active personal space');
|
|
30
33
|
}
|
|
31
34
|
const sessionIdValue = requiredString(sessionId, 'sessionId', MAX_SESSION_ID);
|
|
32
35
|
const read = await providerRead(application, { sessionId: sessionIdValue,
|
|
33
|
-
sourceApplication: sourceApplication ? client(sourceApplication) : null });
|
|
36
|
+
sourceApplication: sourceApplication ? client(sourceApplication) : null }, ownerReads.sessionRecords);
|
|
34
37
|
return sessionRecordsView(application, { sourceApplication: read.source_application ?? null, sessionId: sessionIdValue }, read);
|
|
35
38
|
}
|
|
36
39
|
|
|
@@ -41,15 +44,17 @@ export async function readOwnSessionRecords(application, { taskContextToken, sou
|
|
|
41
44
|
const task = await application.taskContextRegistry.context(requiredString(taskContextToken, 'taskContextToken', 160),
|
|
42
45
|
client(sourceApplication));
|
|
43
46
|
const session = { sourceApplication: task.sourceApplication, sessionId: task.sessionId };
|
|
44
|
-
const
|
|
45
|
-
const
|
|
47
|
+
const reader = providerReaderFields(taskKnowledgeReader(task));
|
|
48
|
+
const read = await providerRead(application, session,
|
|
49
|
+
body => application.personal.readSessionRecords({ ...body, ...reader }));
|
|
50
|
+
const view = sessionRecordsView(application, session, withinReader(read, task));
|
|
46
51
|
// The numbered lines carry every entry once; the same entries again as
|
|
47
52
|
// data would only double what the answer costs.
|
|
48
53
|
return { total: view.total, truncated: view.truncated, url: view.session.url, markdown: sessionRecordsMarkdown(view) };
|
|
49
54
|
}
|
|
50
55
|
|
|
51
|
-
async function providerRead(application, session) {
|
|
52
|
-
const read = await
|
|
56
|
+
async function providerRead(application, session, readRecords) {
|
|
57
|
+
const read = await readRecords({ personal_space_id: application.config.personal.spaceId,
|
|
53
58
|
source_application: session.sourceApplication, session_id: session.sessionId });
|
|
54
59
|
if (!Array.isArray(read?.turns) || !Array.isArray(read?.items)) {
|
|
55
60
|
throw new TypeError('Provider did not return the session records');
|
|
@@ -62,12 +67,18 @@ async function providerRead(application, session) {
|
|
|
62
67
|
// turns hold is left out too: even its times are that project's.
|
|
63
68
|
// An item is kept when one of its sources is this project's, shown through
|
|
64
69
|
// the first such source, so another project's earlier citation never hides
|
|
65
|
-
// this project's own evidence.
|
|
66
|
-
|
|
70
|
+
// this project's own evidence. A turn is also the reader's only when it worked
|
|
71
|
+
// under the task's own FLA (or, for a plain session, under none): the Provider
|
|
72
|
+
// already leaves out every other FLA's turns, and this checks it again.
|
|
73
|
+
function withinReader(read, task) {
|
|
74
|
+
const projectId = task.personalProjectId ?? null;
|
|
75
|
+
const agentId = task.projectAgentId ?? null;
|
|
67
76
|
const visible = id => (id ?? null) === projectId;
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
const
|
|
77
|
+
const own = turn => visible(turn.personal_project_id) && (turn.project_agent_id ?? null) === agentId;
|
|
78
|
+
const turns = read.turns.map(turn => own(turn) ? turn : { ...turn, hidden: true, messages: [] });
|
|
79
|
+
const hiddenTasks = new Set(turns.filter(turn => turn.hidden).map(turn => turn.task_id));
|
|
80
|
+
const items = read.items.map(item => ({ ...item, sources: itemSources(item)
|
|
81
|
+
.filter(source => visible(source.origin_project_id) && !hiddenTasks.has(source.task_id)) }))
|
|
71
82
|
.filter(item => item.sources.length).map(item => ({ ...item, ...item.sources[0] }));
|
|
72
83
|
return { ...read, turns, items, projects: (read.projects ?? []).filter(project => project.id === projectId) };
|
|
73
84
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
|
|
3
|
+
// One read of the personal project list per task entry (rec#39 D-40): the
|
|
4
|
+
// entry resolves its directory, and authorizes its managers, against the same
|
|
5
|
+
// list. A project write through the same Provider drops it, so a project the
|
|
6
|
+
// entry registers or creates is found afterwards. Outside an entry every read
|
|
7
|
+
// goes to the Provider, as before.
|
|
8
|
+
const entries = new AsyncLocalStorage();
|
|
9
|
+
|
|
10
|
+
export function withSharedProjectList(operation) {
|
|
11
|
+
return entries.getStore() ? operation() : entries.run(new Map(), operation);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function sharedProjectList(provider, personalSpaceId, read) {
|
|
15
|
+
const lists = entries.getStore();
|
|
16
|
+
if (!lists) return read();
|
|
17
|
+
if (!lists.has(provider)) lists.set(provider, new Map());
|
|
18
|
+
const own = lists.get(provider);
|
|
19
|
+
if (!own.has(personalSpaceId)) {
|
|
20
|
+
const pending = read();
|
|
21
|
+
own.set(personalSpaceId, pending);
|
|
22
|
+
// A failed read is not shared: the next caller asks again.
|
|
23
|
+
pending.catch(() => { if (own.get(personalSpaceId) === pending) own.delete(personalSpaceId); });
|
|
24
|
+
}
|
|
25
|
+
return own.get(personalSpaceId);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Before and after the write: a read that started while it ran is not kept.
|
|
29
|
+
export async function afterProjectWrite(provider, write) {
|
|
30
|
+
entries.getStore()?.delete(provider);
|
|
31
|
+
try {
|
|
32
|
+
return await write();
|
|
33
|
+
} finally {
|
|
34
|
+
entries.getStore()?.delete(provider);
|
|
35
|
+
}
|
|
36
|
+
}
|