fuli-context 0.20.0-beta.8 → 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/README.md +2 -0
- package/README.zh-CN.md +1 -0
- 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 +110 -0
- package/docs/employee-agents.md +1 -1
- 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 +8 -8
- package/package.json +3 -2
- package/skills/capturing-session-knowledge/references/retrieval.md +6 -0
- package/src/agent-apps/activation.js +3 -3
- package/src/agent-apps/app-host.js +2 -0
- package/src/agent-apps/app-launcher.js +25 -0
- package/src/agent-apps/authorization.js +6 -4
- package/src/agent-apps/bounded-wait.js +13 -0
- package/src/agent-apps/{verified-decisions.js → confirmed-decisions.js} +100 -55
- package/src/agent-apps/decision-source.js +17 -17
- package/src/agent-apps/host-identity.js +8 -2
- package/src/agent-apps/instances.js +218 -29
- package/src/agent-apps/operations.js +4 -3
- package/src/agent-apps/run-gate.js +25 -20
- package/src/agent-apps/service.js +40 -16
- package/src/agent-apps/store.js +28 -14
- package/src/agent-apps/trust-terms.js +23 -0
- package/src/agent-apps/trusted-runner.js +136 -0
- package/src/agent-apps/versions.js +5 -4
- package/src/agent-apps/views.js +11 -6
- package/src/agent-tools/agent-app-definitions.js +1 -1
- package/src/agent-tools/graph-definitions.js +4 -4
- package/src/agent-tools/interface-catalog.js +2 -2
- 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/app-command.js +46 -61
- package/src/cli/remote-mcp-command.js +6 -2
- package/src/cli/setup-command.js +6 -0
- package/src/cli/terminal-io.js +22 -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 +55 -62
- 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/platforms.js +3 -2
- package/src/presence/port.js +2 -1
- 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-BczJo3GN.js +0 -2
- package/dist/web/assets/index-C2rHjaT6.css +0 -1
- package/dist/web/assets/project-team-api-BZMMPuUd.js +0 -1
- package/src/agent-apps/isolation.js +0 -23
|
@@ -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,
|
|
@@ -22,6 +22,7 @@ from .search_projection import (
|
|
|
22
22
|
)
|
|
23
23
|
from .knowledge_weight import knowledge_weight
|
|
24
24
|
from .knowledge_tag_ranking import TagRanking
|
|
25
|
+
from .knowledge_visibility import AgentReader, fla_endpoints_visible_cypher, fla_visible, reader_parameter
|
|
25
26
|
|
|
26
27
|
MIN_TERM_COVERAGE = 0.25
|
|
27
28
|
LATIN_QUERY_FILLERS = {
|
|
@@ -182,23 +183,24 @@ async def personal_edge_scopes(
|
|
|
182
183
|
return {}
|
|
183
184
|
records, _, _ = await store.runtime.driver.execute_query(
|
|
184
185
|
'''
|
|
185
|
-
MATCH ()-[edge:RELATES_TO {group_id: $group_id}]->()
|
|
186
|
+
MATCH (source)-[edge:RELATES_TO {group_id: $group_id}]->(target)
|
|
186
187
|
WHERE edge.uuid IN $edge_ids
|
|
187
188
|
AND size(coalesce(edge.fuli_unresolved_bases, [])) = 0
|
|
189
|
+
WITH edge, ''' + fla_endpoints_visible_cypher('source', 'target') + ''' AS endpoints_visible
|
|
188
190
|
OPTIONAL MATCH (assignment:FuliKnowledgeAssignment {
|
|
189
191
|
space_id: $space_id,
|
|
190
192
|
item_kind: 'relationship',
|
|
191
193
|
item_id: edge.uuid
|
|
192
194
|
})
|
|
193
|
-
WITH edge, assignment
|
|
195
|
+
WITH edge, endpoints_visible, assignment
|
|
194
196
|
OPTIONAL MATCH (episode:Episodic {group_id: $group_id})
|
|
195
197
|
WHERE episode.uuid IN coalesce(edge.episodes, [])
|
|
196
|
-
WITH edge, assignment, collect(DISTINCT episode) AS episodes
|
|
198
|
+
WITH edge, endpoints_visible, assignment, collect(DISTINCT episode) AS episodes
|
|
197
199
|
OPTIONAL MATCH (:FuliSpace {id: $space_id})-[:HAS_KNOWLEDGE_REFERENCE]->
|
|
198
200
|
(reference:FuliKnowledgeProjectReference {
|
|
199
201
|
item_kind: 'relationship', item_id: edge.uuid, status: 'active'
|
|
200
202
|
})
|
|
201
|
-
RETURN edge.uuid AS id,
|
|
203
|
+
RETURN edge.uuid AS id, endpoints_visible,
|
|
202
204
|
edge.fuli_profile_aspect AS profile_aspect,
|
|
203
205
|
coalesce(edge.fuli_preference_scope, 'global')
|
|
204
206
|
AS preference_scope,
|
|
@@ -226,6 +228,7 @@ async def personal_edge_scopes(
|
|
|
226
228
|
project_ids=list(project_scopes),
|
|
227
229
|
include_personal_global=include_personal_global,
|
|
228
230
|
edge_ids=edge_ids,
|
|
231
|
+
reader=reader_parameter(_search_reader(request)),
|
|
229
232
|
routing_='r',
|
|
230
233
|
)
|
|
231
234
|
return {
|
|
@@ -513,6 +516,8 @@ def _item_scope_metadata(
|
|
|
513
516
|
project_scopes: dict[str, dict],
|
|
514
517
|
include_personal_global: bool,
|
|
515
518
|
) -> dict | None:
|
|
519
|
+
if not fla_visible(record, _search_reader(request)):
|
|
520
|
+
return None
|
|
516
521
|
profile_aspect = record.get('profile_aspect')
|
|
517
522
|
if profile_aspect:
|
|
518
523
|
preference_scope = record.get('preference_scope') or 'global'
|
|
@@ -522,18 +527,12 @@ def _item_scope_metadata(
|
|
|
522
527
|
return _global_scope_metadata()
|
|
523
528
|
project_id = record.get('preference_project_id')
|
|
524
529
|
if preference_scope == 'agent':
|
|
525
|
-
|
|
526
|
-
if (
|
|
527
|
-
project_id not in request.personal_project_ids
|
|
528
|
-
or not request.project_agent_id
|
|
529
|
-
or agent_id != request.project_agent_id
|
|
530
|
-
or project_id != request.active_personal_project_id
|
|
531
|
-
):
|
|
530
|
+
if project_id not in request.personal_project_ids:
|
|
532
531
|
return None
|
|
533
532
|
return _agent_scope_metadata(
|
|
534
533
|
project_id,
|
|
535
534
|
project_scopes[project_id],
|
|
536
|
-
|
|
535
|
+
record.get('preference_agent_id'),
|
|
537
536
|
)
|
|
538
537
|
project_ids = record.get('preference_project_ids') or [project_id]
|
|
539
538
|
candidates = [pid for pid in project_ids if pid in request.personal_project_ids and pid in project_scopes]
|
|
@@ -544,16 +543,7 @@ def _item_scope_metadata(
|
|
|
544
543
|
|
|
545
544
|
assignment_project_id = record.get('assignment_project_id')
|
|
546
545
|
episode_project_ids = list(record.get('episode_project_ids') or [])
|
|
547
|
-
|
|
548
|
-
record.get('episode_project_agent_ids') or []
|
|
549
|
-
)
|
|
550
|
-
if episode_project_agent_ids:
|
|
551
|
-
if (
|
|
552
|
-
not request.project_agent_id
|
|
553
|
-
or request.project_agent_id not in episode_project_agent_ids
|
|
554
|
-
or request.active_personal_project_id not in episode_project_ids
|
|
555
|
-
):
|
|
556
|
-
return None
|
|
546
|
+
if record.get('episode_project_agent_ids'):
|
|
557
547
|
return _agent_scope_metadata(
|
|
558
548
|
request.active_personal_project_id,
|
|
559
549
|
project_scopes[request.active_personal_project_id],
|
|
@@ -610,6 +600,12 @@ def _item_scope_metadata(
|
|
|
610
600
|
return None
|
|
611
601
|
|
|
612
602
|
|
|
603
|
+
def _search_reader(request: SearchRequest) -> AgentReader:
|
|
604
|
+
# The FLA was authorized in _personal_search_space; search shows no
|
|
605
|
+
# FLA-scoped item to the person's console either unless it names the FLA.
|
|
606
|
+
return AgentReader(request.active_personal_project_id, request.project_agent_id)
|
|
607
|
+
|
|
608
|
+
|
|
613
609
|
def _global_scope_metadata() -> dict:
|
|
614
610
|
return {
|
|
615
611
|
'defined_project_id': None,
|
|
@@ -22,6 +22,7 @@ from .knowledge_item_view_models import KnowledgeScopeChange
|
|
|
22
22
|
from .knowledge_management import _read_item
|
|
23
23
|
from .knowledge_scope_edit import apply_scope_change, scope_editor_space
|
|
24
24
|
from .knowledge_versions import lock_knowledge
|
|
25
|
+
from .knowledge_visibility import fla_own_work_cypher, hidden_refs, reader_parameter, request_reader
|
|
25
26
|
from .knowledge_session_migration_models import (
|
|
26
27
|
SessionMigrationApply,
|
|
27
28
|
SessionMigrationMoved,
|
|
@@ -39,15 +40,20 @@ async def preview_session_migration(store, actor: dict, request: SessionMigratio
|
|
|
39
40
|
target = await _target_project(store, actor, space, request.target_project_id)
|
|
40
41
|
temporary_id = session_temporary_project_id(space['id'], request.source_application, request.session_id)
|
|
41
42
|
held = await held_items(store, space, temporary_id)
|
|
43
|
+
# An Agent's offer neither counts nor lists another FLA's held items, nor
|
|
44
|
+
# counts another FLA's words among a listed item's sources.
|
|
45
|
+
reader = await request_reader(store, actor, space, request)
|
|
46
|
+
hidden = await hidden_refs(store, space, reader, [(item_kind, item_id) for item_kind, item_id, _ in held])
|
|
47
|
+
held = [row for row in held if (row[0], row[1]) not in hidden]
|
|
42
48
|
items = []
|
|
43
49
|
end = request.offset + request.limit
|
|
44
50
|
if request.include_items:
|
|
45
51
|
for item_kind, item_id, current in held[request.offset:end]:
|
|
46
|
-
_, source_ids = await item_evidence(store, space, item_kind, item_id, limit=0)
|
|
52
|
+
_, source_ids = await item_evidence(store, space, item_kind, item_id, limit=0, reader=reader)
|
|
47
53
|
items.append(await item_summary(store, space, item_kind, item_id, current, source_ids=source_ids))
|
|
48
54
|
return SessionMigrationPreview(
|
|
49
55
|
temporary_project_id=temporary_id, target_project=target, held_count=len(held),
|
|
50
|
-
linked_task_count=await _linked_task_count(store, space, request), items=items,
|
|
56
|
+
linked_task_count=await _linked_task_count(store, space, request, reader), items=items,
|
|
51
57
|
next_offset=end if request.include_items and end < len(held) else None)
|
|
52
58
|
|
|
53
59
|
|
|
@@ -125,13 +131,17 @@ async def _target_project(store, actor, space, project_id):
|
|
|
125
131
|
return (await scope_projects(store, space, [project_id]))[0]
|
|
126
132
|
|
|
127
133
|
|
|
128
|
-
async def _linked_task_count(store, space, request) -> int:
|
|
134
|
+
async def _linked_task_count(store, space, request, reader) -> int:
|
|
135
|
+
"""This session's tasks in the project that the reader's own work holds:
|
|
136
|
+
an FLA counts its own, a plain session those under no FLA, the person all."""
|
|
129
137
|
records, _, _ = await store.runtime.driver.execute_query(
|
|
130
138
|
'''
|
|
131
139
|
MATCH (:FuliSpace {id: $space_id, kind: 'personal'})-[:HAS_TASK_CONTEXT_SESSION]->
|
|
132
140
|
(:FuliTaskContextSession {id: $session_node})-[:HAS_CONTEXT]->
|
|
133
141
|
(task:FuliTaskContext {personal_project_id: $project_id})
|
|
142
|
+
WHERE ''' + fla_own_work_cypher('task.project_agent_id', 'task.personal_project_id') + '''
|
|
134
143
|
RETURN count(task) AS linked
|
|
135
|
-
''', space_id=space['id'], project_id=request.target_project_id,
|
|
144
|
+
''', space_id=space['id'], project_id=request.target_project_id, reader=reader_parameter(reader),
|
|
145
|
+
routing_='r',
|
|
136
146
|
session_node=store._task_session_id(space['id'], request.source_application, request.session_id))
|
|
137
147
|
return int(records[0]['linked']) if records else 0
|
|
@@ -10,7 +10,7 @@ from pydantic import Field, model_validator
|
|
|
10
10
|
from .knowledge_audit_models import KnowledgeItemKind
|
|
11
11
|
from .knowledge_item_view_models import KnowledgeItemSummary, KnowledgeScopeProject
|
|
12
12
|
from .model_base import StrictModel
|
|
13
|
-
from .models import SourceApplication
|
|
13
|
+
from .models import AgentReaderRef, SourceApplication
|
|
14
14
|
|
|
15
15
|
# One page of the prompt lists at most this many held items, and one move
|
|
16
16
|
# takes at most this many; what can be chosen is not limited (dot P2-3).
|
|
@@ -24,7 +24,7 @@ class SessionMigrationTarget(StrictModel):
|
|
|
24
24
|
target_project_id: str = Field(min_length=1, max_length=128)
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
class SessionMigrationRead(SessionMigrationTarget):
|
|
27
|
+
class SessionMigrationRead(SessionMigrationTarget, AgentReaderRef):
|
|
28
28
|
# False: only how many are held and how often this session already worked
|
|
29
29
|
# in the project, for a task entry deciding whether to show its link.
|
|
30
30
|
include_items: bool = True
|
|
@@ -3,7 +3,9 @@ Provider queries; every write names its actor and reason. A write claimed as
|
|
|
3
3
|
the person's own needs the human-review proof (ReviewAwareActor), and the
|
|
4
4
|
person's governance (approve, merge, split, retire, relations, undo) is applied
|
|
5
5
|
only on the human-review channel (HumanReviewer): an Agent can preview it,
|
|
6
|
-
never apply it (rec#11 D-07 part 2, D-22).
|
|
6
|
+
never apply it (rec#11 D-07 part 2, D-22). The owner's view across every
|
|
7
|
+
project (include_all_projects) lists and counts other FLAs' links, so it too
|
|
8
|
+
needs that proof; without it a read is scoped, and a claimed one is refused."""
|
|
7
9
|
|
|
8
10
|
from typing import Any
|
|
9
11
|
|
|
@@ -57,19 +59,19 @@ def register_knowledge_tag_routes(application, store, Actor: Any, ReviewAwareAct
|
|
|
57
59
|
return await detach_tag(store, actor, request)
|
|
58
60
|
|
|
59
61
|
@application.post('/v1/knowledge-tags/metrics', response_model=KnowledgeTagMetrics)
|
|
60
|
-
async def metrics(request: KnowledgeTagMetricsQuery, actor:
|
|
62
|
+
async def metrics(request: KnowledgeTagMetricsQuery, actor: ReviewAwareActor):
|
|
61
63
|
return await tag_metrics(store, actor, request)
|
|
62
64
|
|
|
63
65
|
@application.post('/v1/knowledge-tags/vocabulary', response_model=KnowledgeTagVocabulary)
|
|
64
|
-
async def vocabulary(request: KnowledgeTagVocabularyQuery, actor:
|
|
66
|
+
async def vocabulary(request: KnowledgeTagVocabularyQuery, actor: ReviewAwareActor):
|
|
65
67
|
return await list_vocabulary(store, actor, request)
|
|
66
68
|
|
|
67
69
|
@application.post('/v1/knowledge-tags/detail', response_model=KnowledgeTagDetail)
|
|
68
|
-
async def detail(request: KnowledgeTagDetailQuery, actor:
|
|
70
|
+
async def detail(request: KnowledgeTagDetailQuery, actor: ReviewAwareActor):
|
|
69
71
|
return await read_tag_detail(store, actor, request)
|
|
70
72
|
|
|
71
73
|
@application.post('/v1/knowledge-tags/governance/preview', response_model=KnowledgeTagGovernancePreview)
|
|
72
|
-
async def governance_preview(request: KnowledgeTagGovernanceRequest, actor:
|
|
74
|
+
async def governance_preview(request: KnowledgeTagGovernanceRequest, actor: ReviewAwareActor):
|
|
73
75
|
return await preview_governance(store, actor, request)
|
|
74
76
|
|
|
75
77
|
@application.post('/v1/knowledge-tags/governance/apply', response_model=KnowledgeTagGovernanceResult)
|
|
@@ -242,10 +242,10 @@ def new_link(space_id: str, tag_id: str, item_kind: str, item_id: str, at, actor
|
|
|
242
242
|
|
|
243
243
|
|
|
244
244
|
async def tag_metrics(store, actor: dict, request: KnowledgeTagMetricsQuery) -> KnowledgeTagMetrics:
|
|
245
|
-
space, namespaces = await visible_tag_scope(store, actor, request, 'reader'
|
|
245
|
+
space, namespaces = await visible_tag_scope(store, actor, request, 'reader',
|
|
246
|
+
all_projects=request.include_all_projects)
|
|
246
247
|
since = datetime.now(timezone.utc) - timedelta(days=request.days)
|
|
247
|
-
counts, created = await store.knowledge_tag_vocabulary().metrics(
|
|
248
|
-
space['id'], None if request.include_all_projects else namespaces, since)
|
|
248
|
+
counts, created = await store.knowledge_tag_vocabulary().metrics(space['id'], namespaces, since)
|
|
249
249
|
return KnowledgeTagMetrics(scope='all' if request.include_all_projects else 'visible',
|
|
250
250
|
days=request.days, counts=counts, created_by_day=created)
|
|
251
251
|
|
|
@@ -327,8 +327,12 @@ def _held(tag: dict, key: str):
|
|
|
327
327
|
async def visible_tag_scope(store, actor: dict, request: KnowledgeTagScope, role: str, *,
|
|
328
328
|
all_projects: bool = False):
|
|
329
329
|
"""The caller's space and the namespaces it sees; None means every namespace
|
|
330
|
-
(the owner's console view across projects).
|
|
330
|
+
(the owner's console view across projects). That view lists and counts the
|
|
331
|
+
links of every FLA's own knowledge, so it is read only on the human-review
|
|
332
|
+
channel; an Agent asking for it is refused."""
|
|
331
333
|
store._require_personal()
|
|
334
|
+
if all_projects and actor.get('_human_review_verified') is not True:
|
|
335
|
+
raise HTTPException(status_code=403, detail='the all-project tag view is read on the human-review channel')
|
|
332
336
|
space = await store.authorize(actor, request.personal_space_id, role)
|
|
333
337
|
namespaces = [PERSONAL_NAMESPACE]
|
|
334
338
|
if request.personal_project_id:
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"""Who may read FLA-scoped knowledge.
|
|
2
|
+
|
|
3
|
+
Knowledge an FLA's own episodes wrote, and a preference the person gave one
|
|
4
|
+
FLA, belong to that FLA in its project, and to the person. Search, the graph
|
|
5
|
+
read, item views, turn receipts, session records, the human-change search,
|
|
6
|
+
the AI review and its decisions, preference conflicts and a session's
|
|
7
|
+
migration preview all decide it here.
|
|
8
|
+
|
|
9
|
+
The person's console proves itself with the human-review channel and reads
|
|
10
|
+
everything. Any other reader is an Agent: one FLA in one project, or a plain
|
|
11
|
+
session that is no FLA. No proof means an Agent reader, never a full read; a
|
|
12
|
+
wrong proof is refused before any read (app.current_review_aware_actor), and
|
|
13
|
+
a reader naming an FLA that is not assigned to that project is refused here.
|
|
14
|
+
"""
|
|
15
|
+
from dataclasses import dataclass
|
|
16
|
+
|
|
17
|
+
from .project_agent_access import authorize_project_agent
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@dataclass(frozen=True)
|
|
21
|
+
class AgentReader:
|
|
22
|
+
personal_project_id: str | None = None
|
|
23
|
+
project_agent_id: str | None = None
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
PLAIN_SESSION = AgentReader()
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
async def knowledge_reader(store, actor: dict, space: dict, *, personal_project_id: str | None,
|
|
30
|
+
project_agent_id: str | None) -> AgentReader | None:
|
|
31
|
+
"""None for the person's console (full read), else the Agent reading."""
|
|
32
|
+
if actor.get('_human_review_verified') is True:
|
|
33
|
+
return None
|
|
34
|
+
if not project_agent_id:
|
|
35
|
+
return PLAIN_SESSION
|
|
36
|
+
agent = await authorize_project_agent(store, actor, space, personal_project_id, project_agent_id)
|
|
37
|
+
return AgentReader(personal_project_id, agent['agent_id'])
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
async def request_reader(store, actor: dict, space: dict, request) -> AgentReader | None:
|
|
41
|
+
"""knowledge_reader for a request with reader_project_id and reader_agent_id."""
|
|
42
|
+
return await knowledge_reader(store, actor, space, personal_project_id=request.reader_project_id,
|
|
43
|
+
project_agent_id=request.reader_agent_id)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def fla_visible(record: dict, reader: AgentReader) -> bool:
|
|
47
|
+
"""Whether this reader may see the item. record carries profile_aspect,
|
|
48
|
+
preference_scope, preference_project_id, preference_agent_id and, from
|
|
49
|
+
the item's own episodes, episode_project_ids and episode_project_agent_ids.
|
|
50
|
+
A preference follows its own scope only; other knowledge any FLA's
|
|
51
|
+
episode wrote belongs to that FLA in that project. A relationship's
|
|
52
|
+
record also carries endpoints_visible (fla_endpoints_visible_cypher): one
|
|
53
|
+
linking to an entity this reader may not see is hidden with it."""
|
|
54
|
+
if record.get('endpoints_visible') is False:
|
|
55
|
+
return False
|
|
56
|
+
if record.get('profile_aspect'):
|
|
57
|
+
if (record.get('preference_scope') or 'global') != 'agent':
|
|
58
|
+
return True
|
|
59
|
+
return (
|
|
60
|
+
bool(reader.project_agent_id)
|
|
61
|
+
and record.get('preference_agent_id') == reader.project_agent_id
|
|
62
|
+
and record.get('preference_project_id') == reader.personal_project_id
|
|
63
|
+
)
|
|
64
|
+
agent_ids = record.get('episode_project_agent_ids') or []
|
|
65
|
+
if not agent_ids:
|
|
66
|
+
return True
|
|
67
|
+
return (
|
|
68
|
+
bool(reader.project_agent_id)
|
|
69
|
+
and reader.project_agent_id in agent_ids
|
|
70
|
+
and reader.personal_project_id in (record.get('episode_project_ids') or [])
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def fla_visible_cypher(item: str, item_kind: str) -> str:
|
|
75
|
+
"""fla_visible as a Cypher predicate on the bound `item` (an Entity, or a
|
|
76
|
+
RELATES_TO edge), so a page is cut after hiding and shows no gap. Needs
|
|
77
|
+
$group_id and $reader (reader_parameter: null for the person)."""
|
|
78
|
+
def episodes(condition: str) -> str:
|
|
79
|
+
if item_kind == 'entity':
|
|
80
|
+
return (f'EXISTS {{ MATCH (fla_episode:Episodic {{group_id: $group_id}})-[:MENTIONS]->({item}) '
|
|
81
|
+
f'WHERE {condition} }}')
|
|
82
|
+
return (f'EXISTS {{ MATCH (fla_episode:Episodic {{group_id: $group_id}}) '
|
|
83
|
+
f'WHERE fla_episode.uuid IN coalesce({item}.episodes, []) AND {condition} }}')
|
|
84
|
+
|
|
85
|
+
return f'''($reader IS NULL OR coalesce(
|
|
86
|
+
CASE WHEN {item}.fuli_profile_aspect IS NOT NULL
|
|
87
|
+
THEN coalesce({item}.fuli_preference_scope, 'global') <> 'agent'
|
|
88
|
+
OR ({item}.fuli_preference_agent_id = $reader.project_agent_id
|
|
89
|
+
AND {item}.fuli_preference_project_id = $reader.personal_project_id)
|
|
90
|
+
ELSE NOT {episodes('fla_episode.fuli_project_agent_id IS NOT NULL')}
|
|
91
|
+
OR ({episodes('fla_episode.fuli_project_agent_id = $reader.project_agent_id')}
|
|
92
|
+
AND {episodes('fla_episode.fuli_personal_project_id = $reader.personal_project_id')})
|
|
93
|
+
END, false))'''
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def fla_relationship_visible_cypher(edge: str, source: str, target: str) -> str:
|
|
97
|
+
"""A relationship is visible only with both its endpoints: one that links
|
|
98
|
+
to another FLA's entity is hidden with it, wherever it is read (graph,
|
|
99
|
+
item view, receipt, session records; search and the AI review through
|
|
100
|
+
fla_endpoints_visible_cypher and fla_visible)."""
|
|
101
|
+
return f"({fla_visible_cypher(edge, 'relationship')} AND {fla_endpoints_visible_cypher(source, target)})"
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def fla_endpoints_visible_cypher(source: str, target: str) -> str:
|
|
105
|
+
"""Whether this reader may see both endpoints of a relationship. Needs
|
|
106
|
+
$group_id and $reader."""
|
|
107
|
+
return f"({fla_visible_cypher(source, 'entity')} AND {fla_visible_cypher(target, 'entity')})"
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def fla_own_work_cypher(agent: str, project: str) -> str:
|
|
111
|
+
"""Work done under an FLA (a session's turn, or an episode it wrote) is
|
|
112
|
+
that FLA's conversation: an FLA reads its own in its project, a plain
|
|
113
|
+
session only work under no FLA, and only the person all of it. agent and
|
|
114
|
+
project are the Cypher expressions of that work's FLA and project. Needs
|
|
115
|
+
$reader."""
|
|
116
|
+
return f'''($reader IS NULL OR CASE WHEN $reader.project_agent_id IS NULL
|
|
117
|
+
THEN {agent} IS NULL
|
|
118
|
+
ELSE coalesce({agent} = $reader.project_agent_id
|
|
119
|
+
AND {project} = $reader.personal_project_id, false) END)'''
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def fla_visible_ids_cypher(item_ids: str) -> str:
|
|
123
|
+
"""True when no entity or relationship among item_ids (a Cypher list
|
|
124
|
+
expression) is hidden from $reader: a record naming another FLA's item
|
|
125
|
+
is left out with it. Needs $group_id and $reader."""
|
|
126
|
+
return (f'''($reader IS NULL OR (
|
|
127
|
+
NOT EXISTS {{ MATCH (fla_item:Entity {{group_id: $group_id}}) WHERE fla_item.uuid IN {item_ids}
|
|
128
|
+
AND NOT {fla_visible_cypher('fla_item', 'entity')} }}
|
|
129
|
+
AND NOT EXISTS {{ MATCH (fla_source:Entity)-[fla_item:RELATES_TO {{group_id: $group_id}}]->(fla_target:Entity)
|
|
130
|
+
WHERE fla_item.uuid IN {item_ids}
|
|
131
|
+
AND NOT {fla_relationship_visible_cypher('fla_item', 'fla_source', 'fla_target')} }}))''')
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def fla_episode_visible_cypher(episode: str) -> str:
|
|
135
|
+
"""An episode an FLA wrote, as evidence or as a session's source: only
|
|
136
|
+
that FLA in its project reads it. Needs $reader."""
|
|
137
|
+
return f'''($reader IS NULL OR {episode}.fuli_project_agent_id IS NULL
|
|
138
|
+
OR coalesce({episode}.fuli_project_agent_id = $reader.project_agent_id
|
|
139
|
+
AND {episode}.fuli_personal_project_id = $reader.personal_project_id, false))'''
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def reader_parameter(reader: AgentReader | None) -> dict | None:
|
|
143
|
+
if reader is None:
|
|
144
|
+
return None
|
|
145
|
+
return {'personal_project_id': reader.personal_project_id, 'project_agent_id': reader.project_agent_id}
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
_HIDDEN_QUERIES = {
|
|
149
|
+
'entity': '''
|
|
150
|
+
MATCH (item:Entity {group_id: $group_id}) WHERE item.uuid IN $item_ids
|
|
151
|
+
AND NOT ''' + fla_visible_cypher('item', 'entity') + '''
|
|
152
|
+
RETURN item.uuid AS id''',
|
|
153
|
+
'relationship': '''
|
|
154
|
+
MATCH (source)-[item:RELATES_TO {group_id: $group_id}]->(target)
|
|
155
|
+
WHERE item.uuid IN $item_ids
|
|
156
|
+
AND NOT ''' + fla_relationship_visible_cypher('item', 'source', 'target') + '''
|
|
157
|
+
RETURN item.uuid AS id''',
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
async def _hidden_items(store, space: dict, reader: AgentReader | None, item_kind: str,
|
|
162
|
+
item_ids) -> set[str]:
|
|
163
|
+
"""The ids among these that this reader may not see."""
|
|
164
|
+
item_ids = list(dict.fromkeys(item_ids))
|
|
165
|
+
if reader is None or not item_ids:
|
|
166
|
+
return set()
|
|
167
|
+
records, _, _ = await store.runtime.driver.execute_query(
|
|
168
|
+
_HIDDEN_QUERIES[item_kind], group_id=space['group_id'], item_ids=item_ids,
|
|
169
|
+
reader=reader_parameter(reader), routing_='r')
|
|
170
|
+
return {record['id'] for record in records}
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
async def hidden_refs(store, space: dict, reader: AgentReader | None, refs) -> set[tuple[str, str]]:
|
|
174
|
+
"""The (item_kind, item_id) pairs among these that this reader may not see."""
|
|
175
|
+
refs = list(refs)
|
|
176
|
+
hidden = set()
|
|
177
|
+
for item_kind in _HIDDEN_QUERIES:
|
|
178
|
+
ids = [item_id for kind, item_id in refs if kind == item_kind]
|
|
179
|
+
hidden |= {(item_kind, item_id) for item_id in await _hidden_items(store, space, reader, item_kind, ids)}
|
|
180
|
+
return hidden
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
async def visible_episode_ids(store, space: dict, reader: AgentReader | None, episode_ids) -> list[str]:
|
|
184
|
+
"""These episodes in order, without the ones another FLA wrote."""
|
|
185
|
+
episode_ids = list(episode_ids)
|
|
186
|
+
if reader is None or not episode_ids:
|
|
187
|
+
return episode_ids
|
|
188
|
+
records, _, _ = await store.runtime.driver.execute_query(
|
|
189
|
+
'''
|
|
190
|
+
MATCH (episode:Episodic {group_id: $group_id}) WHERE episode.uuid IN $episode_ids
|
|
191
|
+
AND NOT ''' + fla_episode_visible_cypher('episode') + '''
|
|
192
|
+
RETURN episode.uuid AS id
|
|
193
|
+
''', group_id=space['group_id'], episode_ids=episode_ids, reader=reader_parameter(reader), routing_='r')
|
|
194
|
+
hidden = {record['id'] for record in records}
|
|
195
|
+
return [episode_id for episode_id in episode_ids if episode_id not in hidden]
|