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
|
@@ -366,20 +366,20 @@ def create_app(settings: Settings | None = None) -> FastAPI:
|
|
|
366
366
|
register_graph_format_routes(application, runtime, resolved_settings, Actor, HumanReviewer)
|
|
367
367
|
register_project_agent_routes(application, store, Actor)
|
|
368
368
|
register_knowledge_tag_routes(application, store, Actor, ReviewAwareActor, HumanReviewer)
|
|
369
|
-
register_knowledge_item_routes(application, store, Actor, HumanReviewer)
|
|
369
|
+
register_knowledge_item_routes(application, store, Actor, ReviewAwareActor, HumanReviewer)
|
|
370
370
|
register_knowledge_hard_delete_routes(application, store, HumanReviewer)
|
|
371
371
|
register_knowledge_deletion_watermark_route(application, store, Actor)
|
|
372
372
|
|
|
373
373
|
@application.post('/v1/publication-drafts', response_model=PublicationDraftRecord)
|
|
374
374
|
async def create_publication_draft(
|
|
375
375
|
request: PublicationDraftCreate,
|
|
376
|
-
actor:
|
|
376
|
+
actor: ReviewAwareActor,
|
|
377
377
|
) -> PublicationDraftRecord:
|
|
378
378
|
return await store.create_publication_draft(actor, request)
|
|
379
379
|
|
|
380
380
|
@application.get('/v1/publication-drafts', response_model=list[PublicationDraftRecord])
|
|
381
381
|
async def list_publication_drafts(
|
|
382
|
-
actor:
|
|
382
|
+
actor: ReviewAwareActor,
|
|
383
383
|
personal_space_id: Annotated[str, Query(min_length=1, max_length=128)],
|
|
384
384
|
draft_status: Annotated[str, Query(alias='status')] = 'pending',
|
|
385
385
|
metadata_only: bool = False,
|
|
@@ -392,7 +392,7 @@ def create_app(settings: Settings | None = None) -> FastAPI:
|
|
|
392
392
|
)
|
|
393
393
|
async def get_publication_draft(
|
|
394
394
|
draft_id: str,
|
|
395
|
-
actor:
|
|
395
|
+
actor: ReviewAwareActor,
|
|
396
396
|
personal_space_id: Annotated[str, Query(min_length=1, max_length=128)],
|
|
397
397
|
) -> PublicationDraftRecord:
|
|
398
398
|
return await store.get_publication_draft(actor, personal_space_id, draft_id)
|
|
@@ -404,7 +404,7 @@ def create_app(settings: Settings | None = None) -> FastAPI:
|
|
|
404
404
|
async def decide_publication_draft(
|
|
405
405
|
draft_id: str,
|
|
406
406
|
request: PublicationSubmissionDecision,
|
|
407
|
-
actor:
|
|
407
|
+
actor: ReviewAwareActor,
|
|
408
408
|
personal_space_id: Annotated[str, Query(min_length=1, max_length=128)],
|
|
409
409
|
) -> PublicationDraftRecord:
|
|
410
410
|
return await store.decide_publication_draft(
|
|
@@ -659,7 +659,7 @@ def create_app(settings: Settings | None = None) -> FastAPI:
|
|
|
659
659
|
)
|
|
660
660
|
async def review_decision(
|
|
661
661
|
request: KnowledgeReviewDecisionLookup,
|
|
662
|
-
actor:
|
|
662
|
+
actor: ReviewAwareActor,
|
|
663
663
|
) -> KnowledgeReviewDecisionLookupResult:
|
|
664
664
|
return await read_knowledge_review_decision(store, actor, request)
|
|
665
665
|
|
|
@@ -809,7 +809,7 @@ def create_app(settings: Settings | None = None) -> FastAPI:
|
|
|
809
809
|
)
|
|
810
810
|
async def defer_conflict(
|
|
811
811
|
request: PreferenceConflictDeferCreate,
|
|
812
|
-
actor:
|
|
812
|
+
actor: ReviewAwareActor,
|
|
813
813
|
) -> PreferenceConflictRecord:
|
|
814
814
|
return await defer_preference_conflict(store, actor, request)
|
|
815
815
|
|
|
@@ -818,7 +818,7 @@ def create_app(settings: Settings | None = None) -> FastAPI:
|
|
|
818
818
|
response_model=list[PreferenceConflictRecord],
|
|
819
819
|
)
|
|
820
820
|
async def preference_conflicts(
|
|
821
|
-
actor:
|
|
821
|
+
actor: ReviewAwareActor,
|
|
822
822
|
personal_space_id: Annotated[str, Query(min_length=1, max_length=128)],
|
|
823
823
|
status: Annotated[str | None, Query(pattern='^(ai_pending|resolved)$')] = None,
|
|
824
824
|
limit: Annotated[int, Query(ge=1, le=1000)] = 500,
|
|
@@ -856,7 +856,7 @@ def create_app(settings: Settings | None = None) -> FastAPI:
|
|
|
856
856
|
async def complete_conflict(
|
|
857
857
|
conflict_id: str,
|
|
858
858
|
request: PreferenceConflictCompleteCreate,
|
|
859
|
-
actor:
|
|
859
|
+
actor: ReviewAwareActor,
|
|
860
860
|
) -> PreferenceConflictRecord:
|
|
861
861
|
return await complete_preference_conflict(
|
|
862
862
|
store,
|
|
@@ -985,12 +985,17 @@ def create_app(settings: Settings | None = None) -> FastAPI:
|
|
|
985
985
|
@application.get('/v1/spaces/{space_id}/graph', response_model=GraphResult)
|
|
986
986
|
async def graph(
|
|
987
987
|
space_id: str,
|
|
988
|
-
|
|
988
|
+
# The console's full read carries the human-review proof; any other
|
|
989
|
+
# read is an Agent's: a plain session, or the FLA it names.
|
|
990
|
+
actor: ReviewAwareActor,
|
|
989
991
|
limit: Annotated[int | None, Query(ge=1, le=2000)] = None,
|
|
990
992
|
personal_project_id: Annotated[str | None, Query(min_length=1, max_length=128)] = None,
|
|
991
993
|
offset: Annotated[int | None, Query(ge=0)] = None,
|
|
994
|
+
reader_project_id: Annotated[str | None, Query(min_length=1, max_length=128)] = None,
|
|
995
|
+
reader_agent_id: Annotated[str | None, Query(min_length=1, max_length=128)] = None,
|
|
992
996
|
) -> GraphResult:
|
|
993
|
-
return await store.graph(actor, space_id, limit, personal_project_id, offset
|
|
997
|
+
return await store.graph(actor, space_id, limit, personal_project_id, offset,
|
|
998
|
+
reader_project_id=reader_project_id, reader_agent_id=reader_agent_id)
|
|
994
999
|
|
|
995
1000
|
return application
|
|
996
1001
|
|
|
@@ -28,6 +28,13 @@ from .project_knowledge import (
|
|
|
28
28
|
read_personal_project_relations,
|
|
29
29
|
read_project_references,
|
|
30
30
|
)
|
|
31
|
+
from .knowledge_visibility import (
|
|
32
|
+
fla_episode_visible_cypher,
|
|
33
|
+
fla_relationship_visible_cypher,
|
|
34
|
+
fla_visible_cypher,
|
|
35
|
+
knowledge_reader,
|
|
36
|
+
reader_parameter,
|
|
37
|
+
)
|
|
31
38
|
from .knowledge_weight import effective_confirmation_status, knowledge_weight
|
|
32
39
|
from .negative_feedback_block import agent_authority_suspension
|
|
33
40
|
|
|
@@ -39,11 +46,18 @@ async def read_graph(
|
|
|
39
46
|
limit: int | None = None,
|
|
40
47
|
personal_project_id: str | None = None,
|
|
41
48
|
offset: int | None = None,
|
|
49
|
+
*,
|
|
50
|
+
reader_project_id: str | None = None,
|
|
51
|
+
reader_agent_id: str | None = None,
|
|
42
52
|
) -> GraphResult:
|
|
43
53
|
space = await store.authorize(actor, space_id, 'reader')
|
|
44
54
|
project = None
|
|
45
55
|
if personal_project_id:
|
|
46
56
|
project = await authorize_personal_project(store, actor, space, personal_project_id)
|
|
57
|
+
# An Agent sees no other FLA's knowledge; hidden items are cut in the
|
|
58
|
+
# queries, so a page, its edges and its evidence never reveal them.
|
|
59
|
+
reader = reader_parameter(await knowledge_reader(
|
|
60
|
+
store, actor, space, personal_project_id=reader_project_id, project_agent_id=reader_agent_id))
|
|
47
61
|
bounded_limit = min(limit or store.settings.graph_limit, store.settings.graph_limit)
|
|
48
62
|
paginated = offset is not None
|
|
49
63
|
page_offset = offset or 0
|
|
@@ -52,6 +66,7 @@ async def read_graph(
|
|
|
52
66
|
space_id=space_id,
|
|
53
67
|
group_id=space['group_id'],
|
|
54
68
|
project_id=personal_project_id,
|
|
69
|
+
reader=reader,
|
|
55
70
|
limit=bounded_limit + 1,
|
|
56
71
|
offset=page_offset,
|
|
57
72
|
routing_='r',
|
|
@@ -71,6 +86,7 @@ async def read_graph(
|
|
|
71
86
|
project_id=personal_project_id,
|
|
72
87
|
node_ids=node_ids,
|
|
73
88
|
episode_ids=episode_ids,
|
|
89
|
+
reader=reader,
|
|
74
90
|
limit=bounded_limit + 1 if paginated else bounded_limit,
|
|
75
91
|
offset=page_offset,
|
|
76
92
|
routing_='r',
|
|
@@ -83,7 +99,14 @@ async def read_graph(
|
|
|
83
99
|
*episode_ids,
|
|
84
100
|
*(episode_id for record in edge_records for episode_id in (record.get('episodes') or [])),
|
|
85
101
|
})
|
|
86
|
-
evidence = await _read_evidence(store, all_episode_ids, space['group_id'])
|
|
102
|
+
evidence = await _read_evidence(store, all_episode_ids, space['group_id'], reader)
|
|
103
|
+
if reader is not None:
|
|
104
|
+
# A visible item keeps no other FLA's episode, as evidence or as an id.
|
|
105
|
+
node_records, edge_records = (
|
|
106
|
+
[dict(record) | {'episodes': [item for item in record.get('episodes') or [] if item in evidence]}
|
|
107
|
+
for record in records]
|
|
108
|
+
for records in (node_records, edge_records)
|
|
109
|
+
)
|
|
87
110
|
item_ids = node_ids + [record['id'] for record in edge_records]
|
|
88
111
|
revisions = await _read_revisions(store, space_id, item_ids)
|
|
89
112
|
assignments = await _read_assignments(store, space_id, item_ids)
|
|
@@ -218,6 +241,7 @@ def _node_query(project_scoped: bool, paginated: bool = False) -> str:
|
|
|
218
241
|
'''
|
|
219
242
|
pagination = 'SKIP $offset LIMIT $limit' if paginated else 'LIMIT $limit'
|
|
220
243
|
return match + '''
|
|
244
|
+
WITH node, episodes WHERE ''' + fla_visible_cypher('node', 'entity') + '''
|
|
221
245
|
RETURN node.uuid AS id, node.name AS name, node.group_id AS group_id,
|
|
222
246
|
coalesce(node.fuli_type, 'Entity') AS type,
|
|
223
247
|
coalesce(node.summary, '') AS summary,
|
|
@@ -348,6 +372,8 @@ def _edge_query(project_scoped: bool, paginated: bool = False) -> str:
|
|
|
348
372
|
''' if project_scoped else ''
|
|
349
373
|
pagination = 'SKIP $offset LIMIT $limit' if paginated else 'LIMIT $limit'
|
|
350
374
|
return match + project_filter + '''
|
|
375
|
+
WITH source, edge, target
|
|
376
|
+
WHERE ''' + fla_relationship_visible_cypher('edge', 'source', 'target') + '''
|
|
351
377
|
RETURN edge.uuid AS id, source.uuid AS source, target.uuid AS target,
|
|
352
378
|
source.name AS source_name, target.name AS target_name,
|
|
353
379
|
edge.name AS type, edge.fact AS fact,
|
|
@@ -433,12 +459,13 @@ async def _personal_projects(store, space: dict) -> list[dict]:
|
|
|
433
459
|
return [dict(record['project']) for record in records]
|
|
434
460
|
|
|
435
461
|
|
|
436
|
-
async def _read_evidence(store, episode_ids: list[str], group_id: str) -> dict[str, GraphEvidence]:
|
|
462
|
+
async def _read_evidence(store, episode_ids: list[str], group_id: str, reader=None) -> dict[str, GraphEvidence]:
|
|
437
463
|
if not episode_ids:
|
|
438
464
|
return {}
|
|
439
465
|
records, _, _ = await store.runtime.driver.execute_query(
|
|
440
466
|
'''
|
|
441
467
|
MATCH (episode:Episodic {group_id: $group_id}) WHERE episode.uuid IN $episode_ids
|
|
468
|
+
AND ''' + fla_episode_visible_cypher('episode') + '''
|
|
442
469
|
RETURN episode.uuid AS id, episode.name AS name,
|
|
443
470
|
episode.source_description AS source_description,
|
|
444
471
|
coalesce(episode.fuli_source_kind, 'unknown') AS source_kind,
|
|
@@ -454,6 +481,7 @@ async def _read_evidence(store, episode_ids: list[str], group_id: str) -> dict[s
|
|
|
454
481
|
''',
|
|
455
482
|
episode_ids=episode_ids,
|
|
456
483
|
group_id=group_id,
|
|
484
|
+
reader=reader,
|
|
457
485
|
routing_='r',
|
|
458
486
|
)
|
|
459
487
|
return {
|
|
@@ -28,6 +28,9 @@ from .negative_feedback_block import (
|
|
|
28
28
|
agent_authority_suspension,
|
|
29
29
|
negative_feedback_block_json,
|
|
30
30
|
)
|
|
31
|
+
from .knowledge_visibility import (
|
|
32
|
+
PLAIN_SESSION, fla_relationship_visible_cypher, fla_visible_cypher, reader_parameter,
|
|
33
|
+
)
|
|
31
34
|
from .provider_values import json_object, native_datetime, stable_uuid
|
|
32
35
|
from .store_transactions import query_store_transaction
|
|
33
36
|
|
|
@@ -553,6 +556,9 @@ async def search_human_changes(
|
|
|
553
556
|
'status': request.status,
|
|
554
557
|
'search_query': needle,
|
|
555
558
|
'limit': request.limit,
|
|
559
|
+
# Only an Agent searches human changes, and as no FLA: every FLA's own
|
|
560
|
+
# knowledge stays out of it (knowledge_visibility).
|
|
561
|
+
'reader': reader_parameter(PLAIN_SESSION),
|
|
556
562
|
'routing_': 'r',
|
|
557
563
|
}
|
|
558
564
|
entity_records, _, _ = await store.runtime.driver.execute_query(
|
|
@@ -996,6 +1002,7 @@ WHERE item.fuli_human_edited = true
|
|
|
996
1002
|
WHERE toLower(coalesce(audit.reason, '')) CONTAINS $search_query
|
|
997
1003
|
}
|
|
998
1004
|
)
|
|
1005
|
+
AND ''' + fla_visible_cypher('item', 'entity') + '''
|
|
999
1006
|
RETURN item.uuid AS item_id,
|
|
1000
1007
|
item.name AS title,
|
|
1001
1008
|
coalesce(item.summary, '') AS body,
|
|
@@ -1011,7 +1018,7 @@ LIMIT $limit
|
|
|
1011
1018
|
|
|
1012
1019
|
|
|
1013
1020
|
_HUMAN_RELATIONSHIP_SEARCH = '''
|
|
1014
|
-
MATCH ()-[item:RELATES_TO {group_id: $group_id}]->()
|
|
1021
|
+
MATCH (item_source)-[item:RELATES_TO {group_id: $group_id}]->(item_target)
|
|
1015
1022
|
WHERE item.fuli_human_edited = true
|
|
1016
1023
|
AND (
|
|
1017
1024
|
$status IN ['all', 'human_changed']
|
|
@@ -1029,6 +1036,7 @@ WHERE item.fuli_human_edited = true
|
|
|
1029
1036
|
WHERE toLower(coalesce(audit.reason, '')) CONTAINS $search_query
|
|
1030
1037
|
}
|
|
1031
1038
|
)
|
|
1039
|
+
AND ''' + fla_relationship_visible_cypher('item', 'item_source', 'item_target') + '''
|
|
1032
1040
|
RETURN item.uuid AS item_id,
|
|
1033
1041
|
item.name AS title,
|
|
1034
1042
|
coalesce(item.fact, '') AS body,
|
|
@@ -4,7 +4,10 @@ the scope quick edit and a session's batch migration into a formal project
|
|
|
4
4
|
queries like the other Provider queries; every scope write names its expected
|
|
5
5
|
version and reason. A scope write is audited as the person's own change, so
|
|
6
6
|
it takes the human-review channel the local console holds (as a hard delete
|
|
7
|
-
does); an Agent's access token alone is refused (rec#11 D-22, dot P1-1).
|
|
7
|
+
does); an Agent's access token alone is refused (rec#11 D-22, dot P1-1).
|
|
8
|
+
An item view, a receipt, a session's records and its migration preview are
|
|
9
|
+
read in full only with that proof; without it the reader is an Agent and sees
|
|
10
|
+
no other FLA's knowledge, and a wrong proof is refused (knowledge_visibility)."""
|
|
8
11
|
|
|
9
12
|
from typing import Any
|
|
10
13
|
|
|
@@ -28,13 +31,14 @@ from .session_records import read_session_records
|
|
|
28
31
|
from .session_records_models import SessionRecords, SessionRecordsRead
|
|
29
32
|
|
|
30
33
|
|
|
31
|
-
def register_knowledge_item_routes(application, store, Actor: Any,
|
|
34
|
+
def register_knowledge_item_routes(application, store, Actor: Any, ReviewAwareActor: Any,
|
|
35
|
+
HumanReviewer: Any) -> None:
|
|
32
36
|
@application.post('/v1/knowledge/item-views', response_model=KnowledgeItemView)
|
|
33
|
-
async def item_view(request: KnowledgeItemRef, actor:
|
|
37
|
+
async def item_view(request: KnowledgeItemRef, actor: ReviewAwareActor):
|
|
34
38
|
return await read_knowledge_item_view(store, actor, request)
|
|
35
39
|
|
|
36
40
|
@application.post('/v1/knowledge/turn-receipts', response_model=KnowledgeTurnReceipt)
|
|
37
|
-
async def turn_receipt(request: KnowledgeTurnReceiptRead, actor:
|
|
41
|
+
async def turn_receipt(request: KnowledgeTurnReceiptRead, actor: ReviewAwareActor):
|
|
38
42
|
return await read_turn_receipt(store, actor, request)
|
|
39
43
|
|
|
40
44
|
@application.post('/v1/knowledge/items/{item_id}/scope')
|
|
@@ -42,7 +46,7 @@ def register_knowledge_item_routes(application, store, Actor: Any, HumanReviewer
|
|
|
42
46
|
return await change_knowledge_scope(store, actor, item_id, request)
|
|
43
47
|
|
|
44
48
|
@application.post('/v1/knowledge/session-migrations/preview', response_model=SessionMigrationPreview)
|
|
45
|
-
async def session_migration_preview(request: SessionMigrationRead, actor:
|
|
49
|
+
async def session_migration_preview(request: SessionMigrationRead, actor: ReviewAwareActor):
|
|
46
50
|
return await preview_session_migration(store, actor, request)
|
|
47
51
|
|
|
48
52
|
@application.post('/v1/knowledge/session-migrations/apply', response_model=SessionMigrationResult)
|
|
@@ -50,5 +54,5 @@ def register_knowledge_item_routes(application, store, Actor: Any, HumanReviewer
|
|
|
50
54
|
return await apply_session_migration(store, actor, request)
|
|
51
55
|
|
|
52
56
|
@application.post('/v1/session-records', response_model=SessionRecords)
|
|
53
|
-
async def session_records(request: SessionRecordsRead, actor:
|
|
57
|
+
async def session_records(request: SessionRecordsRead, actor: ReviewAwareActor):
|
|
54
58
|
return await read_session_records(store, actor, request)
|
|
@@ -32,6 +32,13 @@ from .knowledge_project_scope import knowledge_project_ids
|
|
|
32
32
|
from .knowledge_search import search_knowledge
|
|
33
33
|
from .knowledge_tags import PERSONAL_NAMESPACE, project_namespace
|
|
34
34
|
from .knowledge_versions import item_revisions, version_chain, version_status
|
|
35
|
+
from .knowledge_visibility import (
|
|
36
|
+
fla_episode_visible_cypher,
|
|
37
|
+
hidden_refs,
|
|
38
|
+
reader_parameter,
|
|
39
|
+
request_reader,
|
|
40
|
+
visible_episode_ids,
|
|
41
|
+
)
|
|
35
42
|
from .knowledge_weight import effective_confirmation_status, knowledge_weight
|
|
36
43
|
from .provider_values import json_object, native_datetime
|
|
37
44
|
|
|
@@ -44,26 +51,37 @@ _RULE_TYPE = re.compile(r'rule|policy|convention|constraint|guideline|standard',
|
|
|
44
51
|
|
|
45
52
|
async def read_knowledge_item_view(store, actor: dict, request: KnowledgeItemRef) -> KnowledgeItemView:
|
|
46
53
|
space = await personal_reader_space(store, actor, request.personal_space_id)
|
|
54
|
+
# An Agent sees another FLA's item as missing, and nothing of it in this
|
|
55
|
+
# view's evidence, versions, dependents or bases (knowledge_visibility).
|
|
56
|
+
reader = await request_reader(store, actor, space, request)
|
|
57
|
+
if reader is not None and request.query_tags is not None:
|
|
58
|
+
raise HTTPException(status_code=403, detail='a ranking explanation is read on the human-review channel')
|
|
47
59
|
# The deletion trace is authoritative: a deleted ID answers 410 whatever
|
|
48
60
|
# else is stored now (rec#5 C9).
|
|
49
61
|
await require_not_hard_deleted(store, space, request.item_id)
|
|
50
62
|
current = await _read_item(store, space, request.item_id, request.item_kind)
|
|
51
|
-
if current is None:
|
|
63
|
+
if current is None or await hidden_refs(store, space, reader, [(request.item_kind, request.item_id)]):
|
|
52
64
|
raise HTTPException(status_code=404, detail='knowledge item not found')
|
|
53
|
-
evidence, source_ids = await item_evidence(store, space, request.item_kind, request.item_id)
|
|
65
|
+
evidence, source_ids = await item_evidence(store, space, request.item_kind, request.item_id, reader=reader)
|
|
54
66
|
revisions = (await item_revisions(store, space, request.item_kind, [request.item_id])).get(request.item_id, [])
|
|
55
67
|
summary = await item_summary(store, space, request.item_kind, request.item_id, current,
|
|
56
68
|
source_ids=source_ids, revisions=revisions)
|
|
57
69
|
versions = await version_chain(store, space, request.item_kind, request.item_id)
|
|
58
70
|
head = next((version['item_id'] for version in versions if version['status'] == 'current'), None)
|
|
71
|
+
dependents = await dependents_of(store, space, request.item_kind, head or request.item_id)
|
|
72
|
+
bases = await item_bases(store, space, request.item_kind, request.item_id, current)
|
|
73
|
+
hidden = await hidden_refs(store, space, reader, [
|
|
74
|
+
*((request.item_kind, version['item_id']) for version in versions), *dependents,
|
|
75
|
+
*((basis['item_kind'], basis['item_id']) for basis in bases if basis['status'] != 'deleted')])
|
|
59
76
|
view = KnowledgeItemView(
|
|
60
77
|
basis_review=basis_review(current, revisions),
|
|
61
|
-
dependent_count=len(
|
|
78
|
+
dependent_count=len([dependent for dependent in dependents if dependent not in hidden]),
|
|
62
79
|
**summary.model_dump(), evidence=evidence, evidence_count=len(source_ids),
|
|
63
80
|
unavailable_sources=await unavailable_source_bases(store, space, current.get('unresolved_bases') or []),
|
|
64
|
-
revisions=revisions[:REVISION_LIMIT],
|
|
65
|
-
|
|
66
|
-
|
|
81
|
+
revisions=revisions[:REVISION_LIMIT],
|
|
82
|
+
versions=[version for version in versions if (request.item_kind, version['item_id']) not in hidden],
|
|
83
|
+
current_item_id=None if (request.item_kind, head) in hidden else head,
|
|
84
|
+
bases=[basis for basis in bases if (basis['item_kind'], basis['item_id']) not in hidden])
|
|
67
85
|
if request.query_tags is not None:
|
|
68
86
|
# Run the normal visibility pipeline again. These ranks describe the
|
|
69
87
|
# current query and graph, never a replay of an earlier search result.
|
|
@@ -79,18 +97,25 @@ async def read_knowledge_item_view(store, actor: dict, request: KnowledgeItemRef
|
|
|
79
97
|
|
|
80
98
|
async def read_turn_receipt(store, actor: dict, request: KnowledgeTurnReceiptRead) -> KnowledgeTurnReceipt:
|
|
81
99
|
space = await personal_reader_space(store, actor, request.personal_space_id)
|
|
100
|
+
# For an Agent, another FLA's episodes and items are neither listed nor counted.
|
|
101
|
+
reader = await request_reader(store, actor, space, request)
|
|
102
|
+
episode_ids = await visible_episode_ids(store, space, reader, request.episode_ids)
|
|
103
|
+
changes = await episode_changes(store, space, episode_ids)
|
|
104
|
+
hidden = await hidden_refs(store, space, reader, [(item_kind, item_id) for item_kind, item_id, _ in changes])
|
|
82
105
|
entries, unchanged = [], 0
|
|
83
|
-
for item_kind, item_id, change in
|
|
106
|
+
for item_kind, item_id, change in changes:
|
|
107
|
+
if (item_kind, item_id) in hidden:
|
|
108
|
+
continue
|
|
84
109
|
if change is None:
|
|
85
110
|
unchanged += 1
|
|
86
111
|
continue
|
|
87
112
|
current = await _read_item(store, space, item_id, item_kind)
|
|
88
113
|
if current is None:
|
|
89
114
|
continue
|
|
90
|
-
_, source_ids = await item_evidence(store, space, item_kind, item_id, limit=0)
|
|
115
|
+
_, source_ids = await item_evidence(store, space, item_kind, item_id, limit=0, reader=reader)
|
|
91
116
|
summary = await item_summary(store, space, item_kind, item_id, current, source_ids=source_ids)
|
|
92
117
|
entries.append(KnowledgeReceiptEntry(**summary.model_dump(), change=change))
|
|
93
|
-
deletions = await hard_deletions_in_episodes(store, space,
|
|
118
|
+
deletions = await hard_deletions_in_episodes(store, space, episode_ids)
|
|
94
119
|
return KnowledgeTurnReceipt(entries=entries, unchanged_count=unchanged, deleted_count=len(deletions),
|
|
95
120
|
deletion_ids=deletions)
|
|
96
121
|
|
|
@@ -236,7 +261,9 @@ async def episode_changes(store, space, episode_ids):
|
|
|
236
261
|
]
|
|
237
262
|
|
|
238
263
|
|
|
239
|
-
async def item_evidence(store, space, item_kind, item_id, *, limit=EVIDENCE_LIMIT):
|
|
264
|
+
async def item_evidence(store, space, item_kind, item_id, *, limit=EVIDENCE_LIMIT, reader=None):
|
|
265
|
+
"""The item's source episodes, newest first. An Agent reader gets none
|
|
266
|
+
that another FLA wrote, in the list or in the ids it counts."""
|
|
240
267
|
match = (
|
|
241
268
|
'MATCH (episode:Episodic {group_id: $group_id})-[:MENTIONS]->(:Entity {uuid: $item_id, group_id: $group_id})'
|
|
242
269
|
if item_kind == 'entity' else
|
|
@@ -246,13 +273,15 @@ async def item_evidence(store, space, item_kind, item_id, *, limit=EVIDENCE_LIMI
|
|
|
246
273
|
'OR item.uuid IN coalesce(episode.entity_edges, [])')
|
|
247
274
|
records, _, _ = await store.runtime.driver.execute_query(
|
|
248
275
|
match + '''
|
|
249
|
-
WITH DISTINCT episode
|
|
276
|
+
WITH DISTINCT episode WHERE ''' + fla_episode_visible_cypher('episode') + '''
|
|
277
|
+
WITH episode ORDER BY episode.created_at DESC
|
|
250
278
|
WITH collect(episode) AS episodes
|
|
251
279
|
RETURN [episode IN episodes | episode.uuid] AS ids, [episode IN episodes[..$limit] | episode {
|
|
252
280
|
.uuid, .created_at, .fuli_source_kind, .fuli_source_application, .fuli_session_id,
|
|
253
281
|
.fuli_conversation_id, .fuli_source_turn_id, .fuli_source_excerpt, .fuli_personal_project_id
|
|
254
282
|
}] AS episodes
|
|
255
|
-
''', group_id=space['group_id'], item_id=item_id, limit=limit,
|
|
283
|
+
''', group_id=space['group_id'], item_id=item_id, limit=limit, reader=reader_parameter(reader),
|
|
284
|
+
routing_='r')
|
|
256
285
|
if not records:
|
|
257
286
|
return [], []
|
|
258
287
|
return [KnowledgeEvidenceSource(
|
|
@@ -12,7 +12,7 @@ from pydantic import Field, model_serializer, model_validator
|
|
|
12
12
|
from .knowledge_audit_models import KnowledgeChangeActor, KnowledgeItemKind, KnowledgeRevisionRecord
|
|
13
13
|
from .knowledge_tag_models import KnowledgeTagReference
|
|
14
14
|
from .model_base import StrictModel
|
|
15
|
-
from .models import ConfirmationStatus, ContentSource, SearchRequest
|
|
15
|
+
from .models import AgentReaderRef, ConfirmationStatus, ContentSource, SearchRequest
|
|
16
16
|
|
|
17
17
|
# What kind of content an item holds, for its label. Derived from the item's
|
|
18
18
|
# stored profile aspect or type; not a separate Rule model.
|
|
@@ -29,7 +29,7 @@ MAX_SCOPE_PROJECTS = 16
|
|
|
29
29
|
MAX_RECEIPT_EPISODES = 3
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
class KnowledgeItemRef(
|
|
32
|
+
class KnowledgeItemRef(AgentReaderRef):
|
|
33
33
|
personal_space_id: str = Field(min_length=1, max_length=128)
|
|
34
34
|
item_kind: KnowledgeItemKind
|
|
35
35
|
item_id: str = Field(min_length=1, max_length=256)
|
|
@@ -174,7 +174,7 @@ class KnowledgeItemView(KnowledgeItemSummary):
|
|
|
174
174
|
dependent_count: int = 0
|
|
175
175
|
|
|
176
176
|
|
|
177
|
-
class KnowledgeTurnReceiptRead(
|
|
177
|
+
class KnowledgeTurnReceiptRead(AgentReaderRef):
|
|
178
178
|
personal_space_id: str = Field(min_length=1, max_length=128)
|
|
179
179
|
episode_ids: list[str] = Field(min_length=1, max_length=MAX_RECEIPT_EPISODES)
|
|
180
180
|
|
|
@@ -19,6 +19,14 @@ from .knowledge_review_models import (
|
|
|
19
19
|
KnowledgeReviewStart,
|
|
20
20
|
)
|
|
21
21
|
from .ai_review import ai_review_evidence_token
|
|
22
|
+
from .knowledge_visibility import (
|
|
23
|
+
PLAIN_SESSION,
|
|
24
|
+
fla_endpoints_visible_cypher,
|
|
25
|
+
fla_visible,
|
|
26
|
+
fla_visible_ids_cypher,
|
|
27
|
+
knowledge_reader,
|
|
28
|
+
reader_parameter,
|
|
29
|
+
)
|
|
22
30
|
from .personal_project_access import authorize_personal_project
|
|
23
31
|
from .provider_values import native_datetime, stable_uuid
|
|
24
32
|
from .store_transactions import query_store_transaction
|
|
@@ -158,6 +166,7 @@ async def list_knowledge_review_candidates(
|
|
|
158
166
|
_RELATIONSHIP_CANDIDATE_QUERY,
|
|
159
167
|
space_id=space['id'],
|
|
160
168
|
group_id=space['group_id'],
|
|
169
|
+
reader=reader_parameter(PLAIN_SESSION),
|
|
161
170
|
routing_='r',
|
|
162
171
|
)
|
|
163
172
|
conflict_rows, _, _ = await store.runtime.driver.execute_query(
|
|
@@ -275,10 +284,13 @@ async def read_knowledge_review_decision(
|
|
|
275
284
|
|
|
276
285
|
A caller whose write reply was lost settles it against this record: the
|
|
277
286
|
decision is keyed by run and candidate, so it is the write's own receipt.
|
|
287
|
+
A decision on another FLA's item (one an older review made) reads as none
|
|
288
|
+
to an Agent, as if it did not exist; the console reads it with its proof.
|
|
278
289
|
"""
|
|
279
290
|
|
|
280
291
|
store._require_personal()
|
|
281
292
|
space = await _personal_space(store, actor, request.personal_space_id, 'maintainer')
|
|
293
|
+
reader = await knowledge_reader(store, actor, space, personal_project_id=None, project_agent_id=None)
|
|
282
294
|
records, _, _ = await store.runtime.driver.execute_query(
|
|
283
295
|
'''
|
|
284
296
|
MATCH (:FuliSpace {id: $space_id, kind: 'personal'})-
|
|
@@ -286,11 +298,15 @@ async def read_knowledge_review_decision(
|
|
|
286
298
|
[:HAS_REVIEW_DECISION]->(decision:FuliKnowledgeReviewDecision {
|
|
287
299
|
candidate_key: $candidate_key
|
|
288
300
|
})
|
|
301
|
+
WHERE ''' + fla_visible_ids_cypher('[$item_id]') + '''
|
|
289
302
|
RETURN decision LIMIT 1
|
|
290
303
|
''',
|
|
291
304
|
space_id=space['id'],
|
|
305
|
+
group_id=space['group_id'],
|
|
292
306
|
review_id=request.review_id,
|
|
293
307
|
candidate_key=request.candidate_key,
|
|
308
|
+
item_id=request.candidate_key.partition(':')[2],
|
|
309
|
+
reader=reader_parameter(reader),
|
|
294
310
|
routing_='r',
|
|
295
311
|
)
|
|
296
312
|
return KnowledgeReviewDecisionLookupResult(
|
|
@@ -338,11 +354,15 @@ async def _record_ai_review_progress(
|
|
|
338
354
|
group_id=space['group_id'],
|
|
339
355
|
item_id=item_id,
|
|
340
356
|
project_id=run.get('personal_project_id'),
|
|
357
|
+
reader=reader_parameter(PLAIN_SESSION),
|
|
341
358
|
)
|
|
342
359
|
if not current_records:
|
|
343
360
|
raise HTTPException(status_code=404, detail='review candidate not found')
|
|
344
361
|
current = dict(current_records[0])
|
|
345
362
|
normalized = _normalize_item_row(current)
|
|
363
|
+
# Never a candidate, so answered like one that does not exist.
|
|
364
|
+
if not fla_visible(normalized, PLAIN_SESSION):
|
|
365
|
+
raise HTTPException(status_code=404, detail='review candidate not found')
|
|
346
366
|
if not _item_in_scope(
|
|
347
367
|
normalized,
|
|
348
368
|
run['scope'],
|
|
@@ -667,6 +687,8 @@ def _normalize_item_row(row: dict[str, Any]) -> dict[str, Any]:
|
|
|
667
687
|
'preference_agent_id': row.get('preference_agent_id'),
|
|
668
688
|
'inheritance_mode': row.get('inheritance_mode') or 'local_only',
|
|
669
689
|
'project_ids': project_ids,
|
|
690
|
+
'episode_project_agent_ids': sorted({value for value in row.get('episode_project_agent_ids') or [] if value}),
|
|
691
|
+
'endpoints_visible': row.get('endpoints_visible'),
|
|
670
692
|
'confirmation_status': row.get('confirmation_status') or 'pending',
|
|
671
693
|
'confirmation_basis_json': row.get('confirmation_basis_json'),
|
|
672
694
|
'current_quadrant': row.get('current_quadrant') or 'known_known',
|
|
@@ -693,6 +715,10 @@ def _pattern_signature(item: dict) -> tuple:
|
|
|
693
715
|
|
|
694
716
|
|
|
695
717
|
def _item_in_scope(item: dict, scope: str, project_id: str | None) -> bool:
|
|
718
|
+
# The reviewer is no FLA: an FLA's own knowledge and a preference the
|
|
719
|
+
# person gave one FLA stay out of every review scope.
|
|
720
|
+
if not fla_visible(item, PLAIN_SESSION):
|
|
721
|
+
return False
|
|
696
722
|
is_preference = item['profile_aspect'] is not None
|
|
697
723
|
preference_scope = item['preference_scope'] or 'global'
|
|
698
724
|
is_global_preference = is_preference and preference_scope == 'global'
|
|
@@ -811,6 +837,7 @@ RETURN item.uuid AS item_id,
|
|
|
811
837
|
collect(DISTINCT assignment.project_id) AS assigned_project_ids,
|
|
812
838
|
collect(DISTINCT reference.project_id) AS reference_project_ids,
|
|
813
839
|
collect(DISTINCT episode.fuli_personal_project_id) AS evidence_project_ids,
|
|
840
|
+
collect(DISTINCT episode.fuli_project_agent_id) AS episode_project_agent_ids,
|
|
814
841
|
collect(DISTINCT episode.fuli_session_id) AS session_ids,
|
|
815
842
|
coalesce(item.fuli_confirmation_status, 'pending') AS confirmation_status,
|
|
816
843
|
coalesce(item.fuli_utility_score, 0.0) AS utility_score,
|
|
@@ -828,9 +855,10 @@ RETURN item.uuid AS item_id,
|
|
|
828
855
|
|
|
829
856
|
|
|
830
857
|
_RELATIONSHIP_CANDIDATE_QUERY = '''
|
|
831
|
-
MATCH ()-[item:RELATES_TO {group_id: $group_id}]->()
|
|
858
|
+
MATCH (source)-[item:RELATES_TO {group_id: $group_id}]->(target)
|
|
832
859
|
WHERE item.invalid_at IS NULL
|
|
833
860
|
AND size(coalesce(item.fuli_unresolved_bases, [])) = 0
|
|
861
|
+
WITH item, ''' + fla_endpoints_visible_cypher('source', 'target') + ''' AS endpoints_visible
|
|
834
862
|
OPTIONAL MATCH (episode:Episodic {group_id: $group_id})
|
|
835
863
|
WHERE episode.uuid IN coalesce(item.episodes, [])
|
|
836
864
|
OPTIONAL MATCH (assignment:FuliKnowledgeAssignment {
|
|
@@ -846,6 +874,7 @@ OPTIONAL MATCH (:FuliSpace {id: $space_id})-[:HAS_KNOWLEDGE_REVISION]->
|
|
|
846
874
|
})
|
|
847
875
|
RETURN item.uuid AS item_id,
|
|
848
876
|
'relationship' AS item_kind,
|
|
877
|
+
endpoints_visible,
|
|
849
878
|
coalesce(item.name, 'RELATES_TO') AS title,
|
|
850
879
|
coalesce(item.fact, '') AS content,
|
|
851
880
|
item.fuli_profile_aspect AS profile_aspect,
|
|
@@ -866,6 +895,7 @@ RETURN item.uuid AS item_id,
|
|
|
866
895
|
collect(DISTINCT assignment.project_id) AS assigned_project_ids,
|
|
867
896
|
collect(DISTINCT reference.project_id) AS reference_project_ids,
|
|
868
897
|
collect(DISTINCT episode.fuli_personal_project_id) AS evidence_project_ids,
|
|
898
|
+
collect(DISTINCT episode.fuli_project_agent_id) AS episode_project_agent_ids,
|
|
869
899
|
collect(DISTINCT episode.fuli_session_id) AS session_ids,
|
|
870
900
|
coalesce(item.fuli_confirmation_status, 'pending') AS confirmation_status,
|
|
871
901
|
coalesce(item.fuli_utility_score, 0.0) AS utility_score,
|
|
@@ -939,7 +969,8 @@ OPTIONAL MATCH (:FuliSpace {id: $space_id})-[:HAS_KNOWLEDGE_REFERENCE]->
|
|
|
939
969
|
WITH item,
|
|
940
970
|
collect(DISTINCT assignment.project_id) +
|
|
941
971
|
collect(DISTINCT reference.project_id) +
|
|
942
|
-
collect(DISTINCT episode.fuli_personal_project_id) AS project_ids
|
|
972
|
+
collect(DISTINCT episode.fuli_personal_project_id) AS project_ids,
|
|
973
|
+
collect(DISTINCT episode.fuli_project_agent_id) AS episode_project_agent_ids
|
|
943
974
|
OPTIONAL MATCH (space:FuliSpace {id: $space_id, kind: 'personal'})-
|
|
944
975
|
[:HAS_KNOWLEDGE_CONFLICT]->
|
|
945
976
|
(knowledge:FuliKnowledgeConflict {status: 'pending'})
|
|
@@ -947,13 +978,14 @@ WHERE (knowledge.item_id = item.uuid OR knowledge.target_item_id = item.uuid)
|
|
|
947
978
|
AND ($project_id IS NULL
|
|
948
979
|
OR knowledge.target_project_id = $project_id
|
|
949
980
|
OR knowledge.source_project_id = $project_id)
|
|
950
|
-
WITH item, project_ids,
|
|
981
|
+
WITH item, project_ids, episode_project_agent_ids,
|
|
982
|
+
collect(DISTINCT knowledge.id) AS knowledge_conflicts
|
|
951
983
|
OPTIONAL MATCH (space:FuliSpace {id: $space_id, kind: 'personal'})-
|
|
952
984
|
[:HAS_PREFERENCE_CONFLICT]->
|
|
953
985
|
(preference:FuliPreferenceConflict {status: 'ai_pending'})
|
|
954
986
|
WHERE (preference.left_item_id = item.uuid OR preference.right_item_id = item.uuid)
|
|
955
987
|
AND ($project_id IS NULL OR preference.preference_project_id = $project_id)
|
|
956
|
-
WITH item, project_ids, knowledge_conflicts,
|
|
988
|
+
WITH item, project_ids, episode_project_agent_ids, knowledge_conflicts,
|
|
957
989
|
collect(DISTINCT preference.id) AS preference_conflicts
|
|
958
990
|
RETURN item.uuid AS item_id,
|
|
959
991
|
'entity' AS item_kind,
|
|
@@ -979,6 +1011,7 @@ RETURN item.uuid AS item_id,
|
|
|
979
1011
|
coalesce(item.fuli_human_change_version, 0) AS human_change_version,
|
|
980
1012
|
coalesce(item.fuli_attributes_json, '{}') AS attributes_json,
|
|
981
1013
|
project_ids,
|
|
1014
|
+
episode_project_agent_ids,
|
|
982
1015
|
CASE WHEN size(knowledge_conflicts) + size(preference_conflicts) > 0
|
|
983
1016
|
THEN true ELSE false END AS has_conflict,
|
|
984
1017
|
item.created_at AS created_at,
|
|
@@ -990,10 +1023,10 @@ RETURN item.uuid AS item_id,
|
|
|
990
1023
|
|
|
991
1024
|
|
|
992
1025
|
_AI_REVIEW_CURRENT_RELATIONSHIP_QUERY = '''
|
|
993
|
-
MATCH ()-[item:RELATES_TO {uuid: $item_id, group_id: $group_id}]->()
|
|
1026
|
+
MATCH (source)-[item:RELATES_TO {uuid: $item_id, group_id: $group_id}]->(target)
|
|
994
1027
|
SET item.fuli_ai_review_lock_version =
|
|
995
1028
|
coalesce(item.fuli_ai_review_lock_version, 0) + 1
|
|
996
|
-
WITH item
|
|
1029
|
+
WITH item, ''' + fla_endpoints_visible_cypher('source', 'target') + ''' AS endpoints_visible
|
|
997
1030
|
OPTIONAL MATCH (episode:Episodic {group_id: $group_id})
|
|
998
1031
|
WHERE episode.uuid IN coalesce(item.episodes, [])
|
|
999
1032
|
OPTIONAL MATCH (assignment:FuliKnowledgeAssignment {
|
|
@@ -1003,10 +1036,11 @@ OPTIONAL MATCH (:FuliSpace {id: $space_id})-[:HAS_KNOWLEDGE_REFERENCE]->
|
|
|
1003
1036
|
(reference:FuliKnowledgeProjectReference {
|
|
1004
1037
|
item_kind: 'relationship', item_id: item.uuid, status: 'active'
|
|
1005
1038
|
})
|
|
1006
|
-
WITH item,
|
|
1039
|
+
WITH item, endpoints_visible,
|
|
1007
1040
|
collect(DISTINCT assignment.project_id) +
|
|
1008
1041
|
collect(DISTINCT reference.project_id) +
|
|
1009
|
-
collect(DISTINCT episode.fuli_personal_project_id) AS project_ids
|
|
1042
|
+
collect(DISTINCT episode.fuli_personal_project_id) AS project_ids,
|
|
1043
|
+
collect(DISTINCT episode.fuli_project_agent_id) AS episode_project_agent_ids
|
|
1010
1044
|
OPTIONAL MATCH (space:FuliSpace {id: $space_id, kind: 'personal'})-
|
|
1011
1045
|
[:HAS_KNOWLEDGE_CONFLICT]->
|
|
1012
1046
|
(knowledge:FuliKnowledgeConflict {status: 'pending'})
|
|
@@ -1014,16 +1048,18 @@ WHERE (knowledge.item_id = item.uuid OR knowledge.target_item_id = item.uuid)
|
|
|
1014
1048
|
AND ($project_id IS NULL
|
|
1015
1049
|
OR knowledge.target_project_id = $project_id
|
|
1016
1050
|
OR knowledge.source_project_id = $project_id)
|
|
1017
|
-
WITH item, project_ids,
|
|
1051
|
+
WITH item, endpoints_visible, project_ids, episode_project_agent_ids,
|
|
1052
|
+
collect(DISTINCT knowledge.id) AS knowledge_conflicts
|
|
1018
1053
|
OPTIONAL MATCH (space:FuliSpace {id: $space_id, kind: 'personal'})-
|
|
1019
1054
|
[:HAS_PREFERENCE_CONFLICT]->
|
|
1020
1055
|
(preference:FuliPreferenceConflict {status: 'ai_pending'})
|
|
1021
1056
|
WHERE (preference.left_item_id = item.uuid OR preference.right_item_id = item.uuid)
|
|
1022
1057
|
AND ($project_id IS NULL OR preference.preference_project_id = $project_id)
|
|
1023
|
-
WITH item, project_ids, knowledge_conflicts,
|
|
1058
|
+
WITH item, endpoints_visible, project_ids, episode_project_agent_ids, knowledge_conflicts,
|
|
1024
1059
|
collect(DISTINCT preference.id) AS preference_conflicts
|
|
1025
1060
|
RETURN item.uuid AS item_id,
|
|
1026
1061
|
'relationship' AS item_kind,
|
|
1062
|
+
endpoints_visible,
|
|
1027
1063
|
coalesce(item.name, 'RELATES_TO') AS title,
|
|
1028
1064
|
coalesce(item.fact, '') AS content,
|
|
1029
1065
|
item.fuli_profile_aspect AS profile_aspect,
|
|
@@ -1046,6 +1082,7 @@ RETURN item.uuid AS item_id,
|
|
|
1046
1082
|
coalesce(item.fuli_human_change_version, 0) AS human_change_version,
|
|
1047
1083
|
coalesce(item.fuli_attributes_json, '{}') AS attributes_json,
|
|
1048
1084
|
project_ids,
|
|
1085
|
+
episode_project_agent_ids,
|
|
1049
1086
|
CASE WHEN size(knowledge_conflicts) + size(preference_conflicts) > 0
|
|
1050
1087
|
THEN true ELSE false END AS has_conflict,
|
|
1051
1088
|
item.created_at AS created_at,
|