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.
Files changed (241) hide show
  1. package/dist/web/assets/{AboutPage-Dy3drTbS.css → AboutPage-Bxm7RJZg.css} +1 -1
  2. package/dist/web/assets/{AboutPage-BybzKsx-.js → AboutPage-CjDenGS_.js} +1 -1
  3. package/dist/web/assets/{AgentName-CXf8heW-.js → AgentName-DdlJlpT3.js} +1 -1
  4. package/dist/web/assets/{AgentProfilePage-D0YyiAA6.js → AgentProfilePage-Cx_Uf5Vf.js} +1 -1
  5. package/dist/web/assets/{AgentProfilePage-B2yMnmQP.css → AgentProfilePage-DXvLQu-C.css} +1 -1
  6. package/dist/web/assets/{AgentsDirectoryPage-DvPJNJm-.css → AgentsDirectoryPage-BwF-0nFO.css} +1 -1
  7. package/dist/web/assets/{AgentsDirectoryPage-LU-bRYPw.js → AgentsDirectoryPage-DylT-GSW.js} +1 -1
  8. package/dist/web/assets/{BackLink-Dgc1V1EN.js → BackLink-D7oAvDG5.js} +1 -1
  9. package/dist/web/assets/{BoardMoveMenu-XrAiFzGj.js → BoardMoveMenu-B0pA7LLx.js} +1 -1
  10. package/dist/web/assets/CaptureChangePage-Cch3mT4b.css +1 -0
  11. package/dist/web/assets/{CaptureChangePage-DcJKvaGf.js → CaptureChangePage-DEuqPb14.js} +1 -1
  12. package/dist/web/assets/{Card-96u8qomm.js → Card-BZFLZ_2I.js} +1 -1
  13. package/dist/web/assets/{CardHeader-4je7E12I.js → CardHeader-C_c0keQn.js} +1 -1
  14. package/dist/web/assets/{CardTitle-bjMusOR6.js → CardTitle-yXOhV577.js} +1 -1
  15. package/dist/web/assets/ConnectionsPage-DlnHdtwn.js +1 -0
  16. package/dist/web/assets/{CreateProjectDialog-BDwT_wZd.js → CreateProjectDialog-BVJqWdlT.js} +1 -1
  17. package/dist/web/assets/{DataFormatPage-PxwqDWeZ.js → DataFormatPage-BdcjcyhZ.js} +1 -1
  18. package/dist/web/assets/DataFormatPage-Dp7mePUw.css +1 -0
  19. package/dist/web/assets/{DialogFooter-DwgFgHdH.js → DialogFooter-DYawfDCD.js} +1 -1
  20. package/dist/web/assets/{EmployeeRecruitDialog-DjX_wOWx.js → EmployeeRecruitDialog-CB4ARFkM.js} +1 -1
  21. package/dist/web/assets/{EmployeeWorkbenchPage-DWhBevwY.js → EmployeeWorkbenchPage-BUMfMBc8.js} +2 -2
  22. package/dist/web/assets/{EmployeeWorkbenchPage-l_LYqBnr.css → EmployeeWorkbenchPage-BenZP7De.css} +1 -1
  23. package/dist/web/assets/{GrowthLoading-DssogOkP.js → GrowthLoading-smW3-Gfp.js} +1 -1
  24. package/dist/web/assets/{InboxPage-fFg4gETv.css → InboxPage-CbbiHgTr.css} +1 -1
  25. package/dist/web/assets/{InboxPage-BF38gnSV.js → InboxPage-Crn1UU7s.js} +2 -2
  26. package/dist/web/assets/{Input-DHF3Ivr3.js → Input-F1oftPWh.js} +1 -1
  27. package/dist/web/assets/{KnowledgeEditDialog-uAzeQbMB.js → KnowledgeEditDialog-VdQwbX4E.js} +1 -1
  28. package/dist/web/assets/{KnowledgeHardDeleteSection-qGeE1YrK.js → KnowledgeHardDeleteSection-CXRmNnZF.js} +1 -1
  29. package/dist/web/assets/{KnowledgeItemEditPage-Cj5uNVo6.js → KnowledgeItemEditPage-CQo3TbCJ.js} +1 -1
  30. package/dist/web/assets/{KnowledgeItemSummaryCard-CeOSN36n.js → KnowledgeItemSummaryCard-Dd2McM-d.js} +1 -1
  31. package/dist/web/assets/{KnowledgeOrganizerPage-7VC_JAWQ.css → KnowledgeOrganizerPage-BIOaMzgQ.css} +1 -1
  32. package/dist/web/assets/{KnowledgeOrganizerPage-BVLMc2jL.js → KnowledgeOrganizerPage-BVgAyu6U.js} +1 -1
  33. package/dist/web/assets/KnowledgePage-Bfbfz_Z8.js +1 -0
  34. package/dist/web/assets/{KnowledgePeek-BD2zoQqA.js → KnowledgePeek-BNBkh1ey.js} +1 -1
  35. package/dist/web/assets/KnowledgeTurnReceiptPage-Ckw_olrt.js +1 -0
  36. package/dist/web/assets/{KnowledgeWorkspace-CgFI31jK.js → KnowledgeWorkspace-pH2tAFld.js} +1 -1
  37. package/dist/web/assets/{Label-DM1yZ2CL.js → Label-yDCtlpkb.js} +1 -1
  38. package/dist/web/assets/ModelSettingsPage-C3eBDWRL.js +1 -0
  39. package/dist/web/assets/ModelSettingsPage-DZkrJw7R.css +1 -0
  40. package/dist/web/assets/NotFoundPage-8gVVukRR.js +1 -0
  41. package/dist/web/assets/OccupationsPage-BTormZIO.css +1 -0
  42. package/dist/web/assets/{OccupationsPage-CHgGGvDu.js → OccupationsPage-PNoqE21Y.js} +1 -1
  43. package/dist/web/assets/{OverviewPage-E0tfzQRr.js → OverviewPage-DiwYSnhh.js} +2 -2
  44. package/dist/web/assets/{OverviewPage-CpHmwB7u.css → OverviewPage-YBQHyU7s.css} +1 -1
  45. package/dist/web/assets/{PersonalProfilePage-CfqsnB1K.css → PersonalProfilePage-CGW50MHm.css} +1 -1
  46. package/dist/web/assets/{PersonalProfilePage-o5Gpo9nJ.js → PersonalProfilePage-C_v2BFee.js} +1 -1
  47. package/dist/web/assets/PersonalProjectsPage-Cf5mrQmy.css +1 -0
  48. package/dist/web/assets/{PersonalProjectsPage-Boj9kG6I.js → PersonalProjectsPage-DGRV8cM5.js} +1 -1
  49. package/dist/web/assets/{PopperContent-BDOio_9z.js → PopperContent-5zqbtnYr.js} +1 -1
  50. package/dist/web/assets/{Presence-Bk6m9rvx.js → Presence-BYfYJNMD.js} +1 -1
  51. package/dist/web/assets/{ProjectAgentDetailPage-Cyl3ZPBO.js → ProjectAgentDetailPage-BQ9ffaCX.js} +2 -2
  52. package/dist/web/assets/{ProjectAgentDetailPage-Ns2ATys8.css → ProjectAgentDetailPage-CRFE6n-s.css} +1 -1
  53. package/dist/web/assets/{ProjectAgentDialog-C1_KluEx.js → ProjectAgentDialog-BGckQDTq.js} +1 -1
  54. package/dist/web/assets/{ProjectAgentFirstTask-CXKvWwhZ.js → ProjectAgentFirstTask-DrSd3nR-.js} +1 -1
  55. package/dist/web/assets/{ProjectAgentsPage-DKNDXWow.css → ProjectAgentsPage-BBzKAhZx.css} +1 -1
  56. package/dist/web/assets/{ProjectAgentsPage-DHTo0uNy.js → ProjectAgentsPage-U4Om3EPu.js} +1 -1
  57. package/dist/web/assets/{ProjectScopePicker-GjK7Hm4N.js → ProjectScopePicker-D0oxbwOd.js} +1 -1
  58. package/dist/web/assets/{PublicProjectsPage-BuJo0ReR.js → PublicProjectsPage-CvkQ3E8I.js} +1 -1
  59. package/dist/web/assets/{PublicProjectsPage-yA6Md4oM.css → PublicProjectsPage-Ditr0SY-.css} +1 -1
  60. package/dist/web/assets/{RadioGroupItem-DxktHt0c.js → RadioGroupItem-CBpbQlHx.js} +1 -1
  61. package/dist/web/assets/{RoundtablesPage-Bd3XCn7B.js → RoundtablesPage-BEUaKOjI.js} +1 -1
  62. package/dist/web/assets/RoundtablesPage-BMYSDYH8.css +1 -0
  63. package/dist/web/assets/{RovingFocusGroup-DyZDm-Bn.js → RovingFocusGroup-X9U-ufYr.js} +1 -1
  64. package/dist/web/assets/{RovingFocusItem-BKyXKG9n.js → RovingFocusItem-_uA_OCLT.js} +1 -1
  65. package/dist/web/assets/SessionMigrationPage-WVFSDcUO.js +1 -0
  66. package/dist/web/assets/{SessionRecordsPage-CvGaB3h3.js → SessionRecordsPage-Bs2eLXEi.js} +1 -1
  67. package/dist/web/assets/{SettingsPage-DG3ialW3.css → SettingsPage-BbX9ysTX.css} +1 -1
  68. package/dist/web/assets/{SettingsPage-OasIZiIz.js → SettingsPage-DlIwICIz.js} +1 -1
  69. package/dist/web/assets/{SharedJefaReportPage-_f2bnFY-.js → SharedJefaReportPage-B_rreEep.js} +1 -1
  70. package/dist/web/assets/{TabsContent-CTM6GBGk.js → TabsContent-8pXwYJPz.js} +1 -1
  71. package/dist/web/assets/{TabsTrigger-BFj6S2XJ.js → TabsTrigger-Cd6SI2yI.js} +1 -1
  72. package/dist/web/assets/{TagVocabularyPage-Cp1UVDoe.js → TagVocabularyPage-BQiuKG-4.js} +1 -1
  73. package/dist/web/assets/{TaskExecutionPlan-D_MbMVvj.js → TaskExecutionPlan-CupxJeyo.js} +1 -1
  74. package/dist/web/assets/TaskSchedulesPage-DcmDdY10.css +1 -0
  75. package/dist/web/assets/{TaskSchedulesPage-Dd38ntqQ.js → TaskSchedulesPage-zYQs7s6T.js} +1 -1
  76. package/dist/web/assets/{Teleport-D5d1fEVm.js → Teleport-BZX1Eb7R.js} +1 -1
  77. package/dist/web/assets/{TextField-DUZTbKVz.js → TextField-CielK4l3.js} +1 -1
  78. package/dist/web/assets/{UiDialog-CU8nqGKC.js → UiDialog-BSDblUpR.js} +1 -1
  79. package/dist/web/assets/{UiDisclosure-DbxNZe0B.js → UiDisclosure-DLmVwmy1.js} +1 -1
  80. package/dist/web/assets/{UiIcon-DSkB5Juh.js → UiIcon-B8eZeuGI.js} +1 -1
  81. package/dist/web/assets/{UiIconButton-Bgy8Hoy4.js → UiIconButton-e754Tmnq.js} +1 -1
  82. package/dist/web/assets/{UiSegmented-BwkPHeLK.js → UiSegmented-D1HD-qin.js} +1 -1
  83. package/dist/web/assets/{UiSelect-CW3HNsRZ.js → UiSelect-CbkTsi2e.js} +1 -1
  84. package/dist/web/assets/{UiToggle--Z_LpW41.js → UiToggle-Dz93aXFK.js} +1 -1
  85. package/dist/web/assets/{UiWeight-D8U0orbz.js → UiWeight-CUvyApSB.js} +1 -1
  86. package/dist/web/assets/{UnassignedConversationsPanel-BeWzhuBr.js → UnassignedConversationsPanel-xY7gsFot.js} +1 -1
  87. package/dist/web/assets/{VirtualDirectoryList-BT099Zuk.js → VirtualDirectoryList-Dv6PwLjU.js} +1 -1
  88. package/dist/web/assets/{Workbench3D-BAb5m-Qk.js → Workbench3D--4N_uKzp.js} +1 -1
  89. package/dist/web/assets/WritingTastePage-B7KojA4r.js +1 -0
  90. package/dist/web/assets/{WritingTastePage-Dh1qW6bK.css → WritingTastePage-asIa-2U5.css} +1 -1
  91. package/dist/web/assets/{_plugin-vue_export-helper-Crd8aFkh.js → _plugin-vue_export-helper-BmfQlfI8.js} +1 -1
  92. package/dist/web/assets/{accordion-C-pFa1cg.js → accordion-gXElbGP_.js} +1 -1
  93. package/dist/web/assets/{agent-occupation-BooDHzf0.js → agent-occupation-ChN-1QjC.js} +1 -1
  94. package/dist/web/assets/{agent-pins-CFO-xYmz.js → agent-pins-Chh_rdBi.js} +1 -1
  95. package/dist/web/assets/{agent-profile-Bi--2zRQ.css → agent-profile-LzhgJINr.css} +1 -1
  96. 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
  97. package/dist/web/assets/{agent-work-summary-BIZoVGaT.js → agent-work-summary-C9yMf019.js} +1 -1
  98. package/dist/web/assets/{attention-store-dDH6VA6Z.js → attention-store-CG9cF6DX.js} +1 -1
  99. package/dist/web/assets/{badge-BnU2j9Nh.js → badge-DvvDq2Wb.js} +1 -1
  100. package/dist/web/assets/{button-B4gCj85U.js → button-CFEnxtio.js} +1 -1
  101. package/dist/web/assets/{checkbox-CzVOT2cF.js → checkbox-DovdRz8u.js} +1 -1
  102. package/dist/web/assets/{client-Cg0bLxrO.js → client-lh80ewvs.js} +1 -1
  103. package/dist/web/assets/{console-k05BnLkZ.js → console-CQMgYkk9.js} +1 -1
  104. package/dist/web/assets/{conversation-launcher-settings-C745vZJa.js → conversation-launcher-settings-B1QM-wZB.js} +1 -1
  105. package/dist/web/assets/{design-lab-CJiqHzsm.js → design-lab-BDKwIbI8.js} +1 -1
  106. package/dist/web/assets/{dialog-DQaUWk4W.js → dialog-D2mO6m3B.js} +1 -1
  107. package/dist/web/assets/{dist-2CLFk118.js → dist-PmK0PfVA.js} +1 -1
  108. package/dist/web/assets/{dropdown-menu-CN5wjWUD.js → dropdown-menu-YzCnvjAb.js} +1 -1
  109. package/dist/web/assets/{field-6gOLsuT_.js → field-BMEFEyVC.js} +1 -1
  110. package/dist/web/assets/{identity-NbL1GGSB.js → identity-bK-fJdnj.js} +1 -1
  111. package/dist/web/assets/index-BhekqRSJ.js +2 -0
  112. package/dist/web/assets/index-DedvhyS3.css +1 -0
  113. package/dist/web/assets/{judgment-types-DfSuVLnV.js → judgment-types-DJnAr9c0.js} +1 -1
  114. package/dist/web/assets/{model-BjNAHvfb.js → model-BwNZZZNP.js} +1 -1
  115. package/dist/web/assets/{model-DrZFCNN6.js → model-CPMYnu3S.js} +1 -1
  116. package/dist/web/assets/{model-DPykou4S.js → model-Cengn9fg.js} +1 -1
  117. package/dist/web/assets/{model-YYqd0CSe.js → model-CuY1vtEy.js} +1 -1
  118. package/dist/web/assets/{model-2BvryZbU.js → model-DpVrfbnj.js} +1 -1
  119. package/dist/web/assets/{model-BsfqK9w_.js → model-rumuELTi.js} +1 -1
  120. package/dist/web/assets/{motion-preference-CxKthhLy.js → motion-preference-A1AMssSH.js} +1 -1
  121. package/dist/web/assets/{occupation-catalog-JHFMVvBn.js → occupation-catalog-DxwlYD1L.js} +1 -1
  122. package/dist/web/assets/{orchestration-filters-B7ZbjZKo.js → orchestration-filters-DZpJ0FN3.js} +1 -1
  123. package/dist/web/assets/{page-title-BawJ25Bw.js → page-title-Bg-mVyrS.js} +1 -1
  124. package/dist/web/assets/{personal-profile-graph-BEjSAQMe.js → personal-profile-graph-tMneNj_m.js} +1 -1
  125. package/dist/web/assets/{project-capture-BUtkhbr1.js → project-capture-QgMw6qvo.js} +1 -1
  126. package/dist/web/assets/{project-origin-DI7ft7I8.js → project-origin-ppsYHpYL.js} +1 -1
  127. package/dist/web/assets/project-team-api-DwP0O3rn.js +1 -0
  128. package/dist/web/assets/{quick-edit-api-CTMfc9uz.js → quick-edit-api-BiyK3ih-.js} +1 -1
  129. package/dist/web/assets/{shared-report-o1Tvfyn-.js → shared-report-D3Hem1t5.js} +3 -3
  130. package/dist/web/assets/{task-labels-dW28Ybet.js → task-labels-7KyNw9id.js} +1 -1
  131. package/dist/web/assets/{ui-BkbPVq3y.js → ui-Ck58paqr.js} +1 -1
  132. package/dist/web/assets/{useAgentRecords-D6BTApmV.js → useAgentRecords-C6RrZwwv.js} +1 -1
  133. package/dist/web/assets/{useApi-CROJJdhE-BMswzZdS.js → useApi-CROJJdhE-BujjnKN_.js} +1 -1
  134. package/dist/web/assets/{useFocusReturn-DQOtrYO8.js → useFocusReturn-D9IOIg17.js} +1 -1
  135. package/dist/web/assets/{useKnowledgeItemPeek-CGzVMWJz.js → useKnowledgeItemPeek-C6nAzvDL.js} +1 -1
  136. package/dist/web/assets/{useMinimumLoadingDisplay-DEBBYuGI.js → useMinimumLoadingDisplay-HnxkDut6.js} +1 -1
  137. package/dist/web/assets/{useRoutePeek-R9W605pr.js → useRoutePeek-BvYFc1BA.js} +1 -1
  138. package/dist/web/assets/{vue-router-BUjBh_Iw.js → vue-router-Bl55c88B.js} +1 -1
  139. package/dist/web/index.html +33 -33
  140. package/docs/agent-apps.md +5 -0
  141. package/graph-provider/fuli_graph/app.py +16 -11
  142. package/graph-provider/fuli_graph/graph_query.py +30 -2
  143. package/graph-provider/fuli_graph/knowledge_audit.py +9 -1
  144. package/graph-provider/fuli_graph/knowledge_item_routes.py +10 -6
  145. package/graph-provider/fuli_graph/knowledge_item_view.py +41 -12
  146. package/graph-provider/fuli_graph/knowledge_item_view_models.py +3 -3
  147. package/graph-provider/fuli_graph/knowledge_review.py +47 -10
  148. package/graph-provider/fuli_graph/knowledge_search.py +18 -22
  149. package/graph-provider/fuli_graph/knowledge_session_migration.py +14 -4
  150. package/graph-provider/fuli_graph/knowledge_session_migration_models.py +2 -2
  151. package/graph-provider/fuli_graph/knowledge_tag_routes.py +7 -5
  152. package/graph-provider/fuli_graph/knowledge_tags.py +8 -4
  153. package/graph-provider/fuli_graph/knowledge_visibility.py +195 -0
  154. package/graph-provider/fuli_graph/models.py +12 -2
  155. package/graph-provider/fuli_graph/preference_conflicts.py +50 -4
  156. package/graph-provider/fuli_graph/publication_source_copies.py +36 -0
  157. package/graph-provider/fuli_graph/session_records.py +33 -13
  158. package/graph-provider/fuli_graph/session_records_models.py +4 -2
  159. package/graph-provider/fuli_graph/store_knowledge.py +5 -1
  160. package/graph-provider/fuli_graph/store_publication.py +70 -12
  161. package/graph-provider/fuli_graph/task_context_models.py +2 -0
  162. package/graph-provider/fuli_graph/task_session_hints.py +7 -3
  163. package/graph-provider/pyproject.toml +1 -1
  164. package/native/win32/fuli-win-helper.exe +0 -0
  165. package/npm-shrinkwrap.json +2 -2
  166. package/package.json +1 -1
  167. package/skills/capturing-session-knowledge/references/retrieval.md +6 -0
  168. package/src/agent-apps/instances.js +85 -26
  169. package/src/agent-apps/service.js +5 -4
  170. package/src/agent-tools/graph-definitions.js +4 -4
  171. package/src/agent-tools/interface-definitions.js +2 -1
  172. package/src/agent-tools/session-fuli-gate.js +55 -26
  173. package/src/agent-tools.js +2 -4
  174. package/src/agents/claude-code/lifecycle-hook.js +29 -12
  175. package/src/agents/codex/lifecycle-hook.js +25 -10
  176. package/src/agents/lifecycle-message.js +18 -0
  177. package/src/agents/turn-receipt.js +15 -8
  178. package/src/app/agent-request-context.js +18 -0
  179. package/src/cli/remote-mcp-command.js +6 -2
  180. package/src/cli/setup-command.js +6 -0
  181. package/src/cli/update-command.js +14 -1
  182. package/src/cli/update-installation.js +46 -2
  183. package/src/conversations/entry-budget.js +116 -0
  184. package/src/conversations/preference-evidence.js +6 -2
  185. package/src/conversations/task-context-view.js +13 -8
  186. package/src/data-format/local-stores.js +2 -0
  187. package/src/graphiti/agent-conversations.js +24 -3
  188. package/src/graphiti/assistant-project-candidate.js +5 -2
  189. package/src/graphiti/capture-notice.js +4 -1
  190. package/src/graphiti/entry-hint-claim.js +13 -0
  191. package/src/graphiti/federated-application.js +54 -61
  192. package/src/graphiti/human-review-channel.js +9 -5
  193. package/src/graphiti/jefa-board-match.js +4 -1
  194. package/src/graphiti/knowledge-item-edit.js +7 -4
  195. package/src/graphiti/knowledge-reader.js +46 -0
  196. package/src/graphiti/knowledge-result-budget.js +63 -12
  197. package/src/graphiti/knowledge-tags.js +12 -1
  198. package/src/graphiti/provider-client.js +18 -25
  199. package/src/graphiti/publication-draft-capture.js +28 -0
  200. package/src/graphiti/session-knowledge-migration.js +7 -3
  201. package/src/graphiti/session-layer-decision.js +28 -6
  202. package/src/graphiti/session-records.js +26 -15
  203. package/src/graphiti/shared-project-list.js +36 -0
  204. package/src/graphiti/task-entry-preferences.js +87 -46
  205. package/src/graphiti/turn-receipt-delivery.js +5 -2
  206. package/src/graphiti/writing-taste-profile-workflow.js +13 -7
  207. package/src/http/api-router.js +2 -1
  208. package/src/http/graph-api-router.js +13 -10
  209. package/src/http/knowledge-item-api-router.js +17 -4
  210. package/src/http/knowledge-tags-api-router.js +21 -9
  211. package/src/http/request-policy.js +18 -2
  212. package/src/http/session-records-api-router.js +7 -3
  213. package/src/judgment/review-prompt.js +21 -1
  214. package/src/knowledge-owner-reads/console-port.js +51 -0
  215. package/src/knowledge-tags/console-port.js +3 -2
  216. package/src/mcp/preference-delivery.js +7 -4
  217. package/src/mcp/provider-task-context-registry.js +23 -0
  218. package/src/mcp/tool-result.js +3 -3
  219. package/src/presence/windows-helper-pin.js +1 -1
  220. package/src/server.js +14 -2
  221. package/src/standing-assignments/port.js +146 -0
  222. package/src/standing-assignments/store.js +151 -0
  223. package/src/standing-assignments/term-match.js +28 -0
  224. package/src/text/name-identity.js +33 -0
  225. package/dist/web/assets/CaptureChangePage-C833Eiqu.css +0 -1
  226. package/dist/web/assets/ConnectionsPage-EFMP-UeV.js +0 -1
  227. package/dist/web/assets/DataFormatPage-DERqhmng.css +0 -1
  228. package/dist/web/assets/KnowledgePage-8ct5iO0F.js +0 -1
  229. package/dist/web/assets/KnowledgeTurnReceiptPage-Yn3jhDyx.js +0 -1
  230. package/dist/web/assets/ModelSettingsPage-5RkvgNYN.js +0 -1
  231. package/dist/web/assets/ModelSettingsPage-BqtWIKEA.css +0 -1
  232. package/dist/web/assets/NotFoundPage-BUUf2-MZ.js +0 -1
  233. package/dist/web/assets/OccupationsPage-B55DftFp.css +0 -1
  234. package/dist/web/assets/PersonalProjectsPage-aU1rApzX.css +0 -1
  235. package/dist/web/assets/RoundtablesPage-BmmsB1mW.css +0 -1
  236. package/dist/web/assets/SessionMigrationPage-CQhrJ1OQ.js +0 -1
  237. package/dist/web/assets/TaskSchedulesPage-CDalUfNj.css +0 -1
  238. package/dist/web/assets/WritingTastePage-BsekLhC3.js +0 -1
  239. package/dist/web/assets/index-C2rHjaT6.css +0 -1
  240. package/dist/web/assets/index-DYEE8nDj.js +0 -2
  241. package/dist/web/assets/project-team-api-BZMMPuUd.js +0 -1
@@ -22,6 +22,13 @@ from .knowledge_item_view import (
22
22
  scope_projects,
23
23
  )
24
24
  from .knowledge_management import _read_item
25
+ from .knowledge_visibility import (
26
+ fla_episode_visible_cypher,
27
+ fla_own_work_cypher,
28
+ hidden_refs,
29
+ reader_parameter,
30
+ request_reader,
31
+ )
25
32
  from .models import SourceApplication
26
33
  from .provider_values import native_datetime
27
34
  from .session_records_models import (
@@ -55,15 +62,19 @@ NOT_RECORDED_EVENT = re.compile(r':not_recorded$')
55
62
 
56
63
  async def read_session_records(store, actor: dict, request: SessionRecordsRead) -> SessionRecords:
57
64
  space = await personal_reader_space(store, actor, request.personal_space_id)
65
+ # An Agent reads only the turns of its own FLA (a plain session: turns
66
+ # under no FLA), and none of another FLA's episodes or items. Each is cut
67
+ # before its page, so neither a count nor a gap shows what was left out.
68
+ reader = await request_reader(store, actor, space, request)
58
69
  if request.source_application is None:
59
70
  clients = await _session_clients(store, space, request.session_id)
60
71
  if len(clients) != 1:
61
72
  return SessionRecords(session_id=request.session_id, clients=clients)
62
73
  request = request.model_copy(update={'source_application': clients[0]})
63
- tasks, more_turns = await _session_tasks(store, space, request)
74
+ tasks, more_turns = await _session_tasks(store, space, request, reader)
64
75
  turns, more_events = await _turns(store, space, tasks)
65
- episodes, more_episodes = await _session_episodes(store, space, request, tasks)
66
- items, more_items = await _items(store, space, episodes)
76
+ episodes, more_episodes = await _session_episodes(store, space, request, tasks, reader)
77
+ items, more_items = await _items(store, space, episodes, reader)
67
78
  project_ids = {turn.personal_project_id for turn in turns} | {item.origin_project_id for item in items}
68
79
  return SessionRecords(
69
80
  session_id=request.session_id, source_application=request.source_application,
@@ -89,16 +100,17 @@ async def _session_clients(store, space, session_id):
89
100
  return sorted(nodes[record['id']] for record in records)
90
101
 
91
102
 
92
- async def _session_tasks(store, space, request):
103
+ async def _session_tasks(store, space, request, reader):
93
104
  records, _, _ = await store.runtime.driver.execute_query(
94
105
  '''
95
106
  MATCH (:FuliSpace {id: $space_id, kind: 'personal'})-[:HAS_TASK_CONTEXT_SESSION]->
96
107
  (:FuliTaskContextSession {id: $session_node})-[:HAS_CONTEXT]->(task:FuliTaskContext)
108
+ WHERE ''' + fla_own_work_cypher('task.project_agent_id', 'task.personal_project_id') + '''
97
109
  WITH task ORDER BY task.created_at DESC, task.id LIMIT $limit
98
110
  RETURN task.id AS id, task.token AS token, task.turn_id AS turn_id, task.created_at AS created_at,
99
111
  task.personal_project_id AS project_id, task.project_agent_id AS agent_id,
100
112
  task.record_json AS record_json
101
- ''', space_id=space['id'], limit=MAX_TURNS + 1,
113
+ ''', space_id=space['id'], limit=MAX_TURNS + 1, reader=reader_parameter(reader),
102
114
  session_node=store._task_session_id(space['id'], request.source_application, request.session_id),
103
115
  routing_='r')
104
116
  tasks = []
@@ -136,7 +148,7 @@ async def _turns(store, space, tasks):
136
148
  events = events_by_token.get(task['token'], [])
137
149
  turns.append(SessionTurn(
138
150
  task_id=task['id'], turn_id=task['turn_id'], created_at=task['created_at'],
139
- personal_project_id=task['project_id'],
151
+ personal_project_id=task['project_id'], project_agent_id=task['agent_id'],
140
152
  conversation_id=events[0]['conversation_id'] if events else None,
141
153
  capture_off=task['capture_off'], **_turn_events(events)))
142
154
  return turns, truncated
@@ -186,21 +198,25 @@ def _bounded(text, limit):
186
198
  return text if len(text) <= limit else f'{text[:limit]}…'
187
199
 
188
200
 
189
- async def _session_episodes(store, space, request, tasks):
201
+ async def _session_episodes(store, space, request, tasks, reader):
190
202
  """The episodes the session's checkpoints committed and those that name the
191
203
  session as their source, newest last, each with the turn it belongs to."""
192
204
  task_by_episode = {episode_id: task for task in tasks for episode_id in task['episode_ids']}
193
205
  records, _, _ = await store.runtime.driver.execute_query(
194
206
  '''
195
207
  MATCH (episode:Episodic {group_id: $group_id})
196
- WHERE episode.uuid IN $episode_ids
197
- OR (episode.fuli_session_id = $session_id AND episode.fuli_source_application = $source_application)
208
+ WHERE (episode.uuid IN $episode_ids
209
+ OR (episode.fuli_session_id = $session_id AND episode.fuli_source_application = $source_application
210
+ AND ''' + fla_own_work_cypher('episode.fuli_project_agent_id',
211
+ 'episode.fuli_personal_project_id') + '''))
212
+ AND ''' + fla_episode_visible_cypher('episode') + '''
198
213
  WITH episode ORDER BY episode.created_at DESC, episode.uuid LIMIT $limit
199
214
  RETURN episode.uuid AS id, episode.created_at AS created_at,
200
215
  episode.fuli_personal_project_id AS project_id, episode.fuli_conversation_id AS conversation_id,
201
216
  episode.fuli_source_excerpt AS excerpt
202
217
  ''', group_id=space['group_id'], episode_ids=list(task_by_episode), session_id=request.session_id,
203
- source_application=request.source_application, limit=MAX_EPISODES + 1, routing_='r')
218
+ source_application=request.source_application, limit=MAX_EPISODES + 1, reader=reader_parameter(reader),
219
+ routing_='r')
204
220
  episodes = []
205
221
  for record in reversed(records[:MAX_EPISODES]):
206
222
  created_at = native_datetime(record['created_at'])
@@ -221,7 +237,7 @@ def _task_at(tasks, moment):
221
237
  return started[-1] if started else None
222
238
 
223
239
 
224
- async def _items(store, space, episodes):
240
+ async def _items(store, space, episodes, reader):
225
241
  """What each episode created or updated, and the preferences it only cited
226
242
  again (its words became their evidence). Other items mentioned again
227
243
  changed nothing and are left out. An item is listed once with every
@@ -229,7 +245,11 @@ async def _items(store, space, episodes):
229
245
  turn and project, so a reader allowed fewer projects still finds its own."""
230
246
  items = {}
231
247
  for episode in episodes:
232
- for item_kind, item_id, change in await episode_changes(store, space, [episode['id']]):
248
+ changes = await episode_changes(store, space, [episode['id']])
249
+ hidden = await hidden_refs(store, space, reader, [(item_kind, item_id) for item_kind, item_id, _ in changes])
250
+ for item_kind, item_id, change in changes:
251
+ if (item_kind, item_id) in hidden:
252
+ continue
233
253
  item = items.get((item_kind, item_id))
234
254
  if item is None:
235
255
  if len(items) == MAX_ITEMS:
@@ -237,7 +257,7 @@ async def _items(store, space, episodes):
237
257
  current = await _read_item(store, space, item_id, item_kind)
238
258
  if current is None or (change is None and not current.get('profile_aspect')):
239
259
  continue
240
- _, source_ids = await item_evidence(store, space, item_kind, item_id, limit=0)
260
+ _, source_ids = await item_evidence(store, space, item_kind, item_id, limit=0, reader=reader)
241
261
  summary = await item_summary(store, space, item_kind, item_id, current, source_ids=source_ids)
242
262
  item = items[(item_kind, item_id)] = {'summary': summary, 'sources': []}
243
263
  elif change is None and not item['summary'].profile_aspect:
@@ -12,14 +12,14 @@ from pydantic import Field
12
12
 
13
13
  from .knowledge_item_view_models import KnowledgeItemSummary, KnowledgeScopeProject
14
14
  from .model_base import StrictModel
15
- from .models import SourceApplication
15
+ from .models import AgentReaderRef, SourceApplication
16
16
 
17
17
  # 'evidence': the episode only cited an existing preference again, so its words
18
18
  # became evidence for it without changing it.
19
19
  SessionRecordChange = Literal['created', 'updated', 'evidence']
20
20
 
21
21
 
22
- class SessionRecordsRead(StrictModel):
22
+ class SessionRecordsRead(AgentReaderRef):
23
23
  personal_space_id: str = Field(min_length=1, max_length=128)
24
24
  # None: the link named only the session; its one client is found.
25
25
  source_application: SourceApplication | None = None
@@ -54,6 +54,8 @@ class SessionTurn(StrictModel):
54
54
  turn_id: str | None = None
55
55
  created_at: datetime | None = None
56
56
  personal_project_id: str | None = None
57
+ # The FLA the turn worked under, if any: an Agent reader re-checks it.
58
+ project_agent_id: str | None = None
57
59
  conversation_id: str | None = None
58
60
  # Set when capture was off for this turn's checkpoint.
59
61
  capture_off: SessionCaptureOff | None = None
@@ -118,9 +118,13 @@ class StoreKnowledge:
118
118
  limit: int | None = None,
119
119
  personal_project_id: str | None = None,
120
120
  offset: int | None = None,
121
+ *,
122
+ reader_project_id: str | None = None,
123
+ reader_agent_id: str | None = None,
121
124
  ) -> GraphResult:
122
125
  return await read_graph(
123
- self, actor, space_id, limit, personal_project_id, offset
126
+ self, actor, space_id, limit, personal_project_id, offset,
127
+ reader_project_id=reader_project_id, reader_agent_id=reader_agent_id,
124
128
  )
125
129
 
126
130
  async def collaboration_context(
@@ -15,19 +15,43 @@ from .models import (
15
15
  SubscriptionRecord,
16
16
  )
17
17
  from .provider_values import json_object, native_datetime, now_utc, stable_uuid
18
- from .publication_source_copies import publication_source_identity
18
+ from .publication_source_copies import PLAIN, PROJECT_AGENT, draft_sources, publication_source_identity
19
19
  from .knowledge_source_fence import require_source_available
20
20
  from .knowledge_versions import lock_knowledge
21
21
  from .store_transactions import query_store_transaction
22
22
  from .publication_submission import decide_submission
23
23
  from .publication_submission_models import PublicationSubmissionDecision
24
24
 
25
+ # An FLA's own knowledge stays in the personal graph; Node refuses to queue it
26
+ # for a team project and so does the Provider (0.20.1).
27
+ _PROJECT_AGENT_KNOWLEDGE = {'code': 'project_agent_knowledge_personal_only',
28
+ 'message': 'Project Agent knowledge can only be captured in the personal graph'}
29
+
30
+
31
+ def _draft_identity(space, draft) -> dict:
32
+ """A stored draft's source identity; older drafts derive it from the payload."""
33
+ return {**publication_source_identity(space['group_id'], json_object(draft.get('payload'))),
34
+ **json_object(draft.get('source_identity'))}
35
+
25
36
 
26
37
  class StorePublication:
38
+ async def _project_agent_drafts(self, actor, space, drafts) -> set[int]:
39
+ """The positions among these drafts a reader without the human-review
40
+ proof may not see: every one whose source is not positively plain
41
+ work. A draft of an FLA's work (made before the Provider refused them),
42
+ and one whose source is erased or was never recorded here, is the
43
+ person's alone, its body, source and submission metadata alike; the
44
+ console's port lists, reads, submits and settles it."""
45
+ if actor.get('_human_review_verified') is True:
46
+ return set()
47
+ owners = await draft_sources(self, space, [_draft_identity(space, draft) for draft in drafts])
48
+ return {index for index, owner in enumerate(owners) if owner != PLAIN}
49
+
27
50
  async def decide_publication_submission(self, actor, personal_space_id, draft_id, decision):
28
51
  """Internal submission protocol; every transition serializes with erasure."""
29
52
  self._require_personal()
30
53
  space = await self.authorize(actor, personal_space_id, 'maintainer')
54
+ await self._refuse_project_agent_draft(actor, space, draft_id, decision.decision)
31
55
  refusal = None
32
56
  async with query_store_transaction(self) as scoped:
33
57
  await lock_knowledge(scoped, space)
@@ -62,9 +86,13 @@ class StorePublication:
62
86
  await require_source_available(scoped, space, episode_id=identity.get('episode_id'),
63
87
  source_application=identity.get('source_application'), session_id=identity.get('session_id'),
64
88
  source_turn_id=identity.get('source_turn_id'))
89
+ if (await draft_sources(scoped, space, [identity])) == [PROJECT_AGENT]:
90
+ raise HTTPException(status_code=422, detail=_PROJECT_AGENT_KNOWLEDGE)
65
91
  records, _, _ = await scoped.runtime.driver.execute_query(
66
92
  '''
67
93
  MATCH (space:FuliSpace {id: $personal_space_id, kind: 'personal'})
94
+ OPTIONAL MATCH (stored:FuliPublicationDraft {id: $id})
95
+ WITH space, stored IS NOT NULL AS existed
68
96
  MERGE (draft:FuliPublicationDraft {id: $id})
69
97
  ON CREATE SET draft.personal_space_id = $personal_space_id,
70
98
  draft.target_project_id = $target_project_id,
@@ -74,7 +102,7 @@ class StorePublication:
74
102
  draft.source_identity = $source_identity,
75
103
  draft.created_at = $created_at
76
104
  MERGE (space)-[:HAS_PUBLICATION_DRAFT]->(draft)
77
- RETURN draft
105
+ RETURN draft, existed
78
106
  ''',
79
107
  personal_space_id=request.personal_space_id,
80
108
  id=draft_id,
@@ -84,7 +112,14 @@ class StorePublication:
84
112
  source_identity=json.dumps(identity, sort_keys=True, separators=(',', ':')),
85
113
  created_at=created_at,
86
114
  )
87
- return self._publication_draft(records[0]['draft'])
115
+ draft = dict(records[0]['draft'])
116
+ # A retry of a key already drafted gets the stored draft back unchanged, so it is judged by
117
+ # the STORED row's provenance, not the request's. One this caller may not read is answered
118
+ # exactly as a draft that does not exist, whatever the request claims about its source: a
119
+ # self-reported identity is no proof that it is the same create (0.20.1).
120
+ if records[0]['existed'] and await self._project_agent_drafts(actor, space, [draft]):
121
+ raise HTTPException(status_code=404, detail='publication draft not found')
122
+ return self._publication_draft(draft)
88
123
 
89
124
  async def list_publication_drafts(
90
125
  self,
@@ -107,10 +142,11 @@ class StorePublication:
107
142
  status=draft_status,
108
143
  routing_='r',
109
144
  )
110
- return [self._publication_draft({**dict(record['draft']), 'source_identity': json.dumps({
111
- **publication_source_identity(space['group_id'], json_object(record['draft'].get('payload'))),
112
- **json_object(record['draft'].get('source_identity'))})}, metadata_only=metadata_only)
113
- for record in records]
145
+ drafts = [dict(record['draft']) for record in records]
146
+ hidden = await self._project_agent_drafts(actor, space, drafts)
147
+ return [self._publication_draft({**draft, 'source_identity': json.dumps(_draft_identity(space, draft))},
148
+ metadata_only=metadata_only)
149
+ for index, draft in enumerate(drafts) if index not in hidden]
114
150
 
115
151
  async def get_publication_draft(
116
152
  self,
@@ -119,7 +155,30 @@ class StorePublication:
119
155
  draft_id: str,
120
156
  ) -> PublicationDraftRecord:
121
157
  self._require_personal()
122
- await self.authorize(actor, personal_space_id, 'reader')
158
+ space = await self.authorize(actor, personal_space_id, 'reader')
159
+ draft = await self._stored_draft(space, draft_id)
160
+ if draft is None or await self._project_agent_drafts(actor, space, [draft]):
161
+ raise HTTPException(status_code=404, detail='publication draft not found')
162
+ return self._publication_draft(draft)
163
+
164
+ async def _refuse_project_agent_draft(self, actor, space, draft_id, decision: str) -> None:
165
+ """A decision on a draft whose source is not positively plain work: to
166
+ a caller without the human-review proof it does not exist, so no reply
167
+ carries its body, source or attempt. The person's console decides it;
168
+ a draft of an FLA's work it settles, keeps or ignores, but never starts
169
+ publishing. A missing draft is left to the decision's own answer."""
170
+ draft = await self._stored_draft(space, draft_id)
171
+ if draft is None:
172
+ return
173
+ [owner] = await draft_sources(self, space, [_draft_identity(space, draft)])
174
+ if owner == PLAIN:
175
+ return
176
+ if actor.get('_human_review_verified') is not True:
177
+ raise HTTPException(status_code=404, detail='publication draft not found')
178
+ if owner == PROJECT_AGENT and decision == 'begin_submit_public':
179
+ raise HTTPException(status_code=422, detail=_PROJECT_AGENT_KNOWLEDGE)
180
+
181
+ async def _stored_draft(self, space, draft_id) -> dict | None:
123
182
  records, _, _ = await self.runtime.driver.execute_query(
124
183
  '''
125
184
  MATCH (:FuliSpace {id: $personal_space_id, kind: 'personal'})-
@@ -127,13 +186,11 @@ class StorePublication:
127
186
  (draft:FuliPublicationDraft {id: $draft_id})
128
187
  RETURN draft
129
188
  ''',
130
- personal_space_id=personal_space_id,
189
+ personal_space_id=space['id'],
131
190
  draft_id=draft_id,
132
191
  routing_='r',
133
192
  )
134
- if not records:
135
- raise HTTPException(status_code=404, detail='publication draft not found')
136
- return self._publication_draft(records[0]['draft'])
193
+ return dict(records[0]['draft']) if records else None
137
194
 
138
195
  async def decide_publication_draft(
139
196
  self,
@@ -146,6 +203,7 @@ class StorePublication:
146
203
  return await self.decide_publication_submission(actor, personal_space_id, draft_id, decision)
147
204
  self._require_personal()
148
205
  space = await self.authorize(actor, personal_space_id, 'maintainer')
206
+ await self._refuse_project_agent_draft(actor, space, draft_id, decision.decision)
149
207
  records, _, _ = await self.runtime.driver.execute_query(
150
208
  '''
151
209
  MATCH (:FuliSpace {id: $personal_space_id, kind: 'personal'})-
@@ -157,3 +157,5 @@ class SessionTurnReceiptClaim(TurnReceiptClaim):
157
157
  class SessionHintClaim(TurnReceiptClaim):
158
158
  """A hint a built-in Agent shows once per host session (rec#10 D-26.4)."""
159
159
  operation: Literal['project_candidate', 'board_match']
160
+ # Whether the claim is still open, without taking it.
161
+ peek: bool = False
@@ -19,7 +19,8 @@ HINTS_KEY = 'session_hints'
19
19
 
20
20
  async def claim_session_hint(store, actor: dict, token: str, request) -> dict:
21
21
  """claimed is True for exactly one current entry of the session; a
22
- superseded task (404) or an earlier claim of the operation gets nothing."""
22
+ superseded task (404) or an earlier claim of the operation gets nothing.
23
+ A peek takes nothing and says whether a claim would still win."""
23
24
  store._require_personal()
24
25
  await store.authorize(actor, request.personal_space_id, 'maintainer')
25
26
  async with query_store_transaction(store) as scoped:
@@ -34,8 +35,11 @@ async def claim_session_hint(store, actor: dict, token: str, request) -> dict:
34
35
  WHERE task.record_json CONTAINS $key
35
36
  RETURN task.record_json AS record_json
36
37
  ''', space_id=request.personal_space_id, token=token, key=f'"{HINTS_KEY}"')
37
- if any(hint.get('operation') == request.operation
38
- for row in rows for hint in json.loads(row['record_json']).get(HINTS_KEY) or []):
38
+ used = any(hint.get('operation') == request.operation
39
+ for row in rows for hint in json.loads(row['record_json']).get(HINTS_KEY) or [])
40
+ if request.peek:
41
+ return {'claimed': False, 'available': not used}
42
+ if used:
39
43
  return {'claimed': False}
40
44
  record[HINTS_KEY] = [*(record.get(HINTS_KEY) or []),
41
45
  {'operation': request.operation, 'at': now_utc().isoformat()}]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fuli-graph-provider"
3
- version = "0.20.0b9"
3
+ version = "0.20.0"
4
4
  description = "Graphiti-backed personal and shared project provider for Fuli."
5
5
  requires-python = ">=3.12"
6
6
  dependencies = [
Binary file
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "fuli-context",
3
- "version": "0.20.0-beta.9",
3
+ "version": "0.20.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "fuli-context",
9
- "version": "0.20.0-beta.9",
9
+ "version": "0.20.0",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@a2a-js/sdk": "1.3.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuli-context",
3
- "version": "0.20.0-beta.9",
3
+ "version": "0.20.0",
4
4
  "description": "Local-first collaboration relationship graph for AI agents.",
5
5
  "type": "module",
6
6
  "files": [
@@ -33,6 +33,12 @@ identifier, and likely runbook category. Never pass the full conversational requ
33
33
  query. For example, a version-release request should search release/publish and push/commit
34
34
  runbook concepts separately instead of searching the entire sentence.
35
35
 
36
+ Its response states `retrievalGuidance`, `noMatchSourceMarker` and the shared scope fields once
37
+ at the top level; each entry in `results` keeps its own `query`, records and `sourceMarker`. On a
38
+ bounded page (`next_cursor` present), a query with nothing on that page shows only `query` and
39
+ `total_items`; its records arrive on a later page. Long project ID lists name a prefix and count
40
+ the rest in `project_ids_omitted`.
41
+
36
42
  Pending knowledge is eligible for on-demand retrieval and must remain visibly marked.
37
43
  `agent_confirmed` knowledge is usable but ranks below user or authoritative-source
38
44
  confirmation.
@@ -48,15 +48,16 @@ const waitFor = (ms, signal) => delay(ms, undefined, { signal }).catch(() => {})
48
48
  // its host left; an interrupted data deletion is settled.
49
49
  // - exit: an app process that ends by itself (its entry failed to load, it
50
50
  // crashed or it finished) is wrapped up in the app's lifecycle, bound to
51
- // its instance id and generation: recorded with a short redacted summary
52
- // and sealed like a stop. An exit of an earlier instance touches nothing.
51
+ // its instance id and generation: recorded with its exit code, signal and a
52
+ // fixed category message (never anything the app wrote) and sealed like a stop. An exit of an earlier instance touches nothing.
53
53
  // - close: no new start, stop, decision or call is admitted; work in flight
54
54
  // finishes, every instance this process holds is sealed and its process
55
55
  // stopped, and only then do the lease and the registry close. Every handle
56
56
  // the runner returned is held in memory until its stop succeeded, so a
57
57
  // start that returns after close began, a registration that throws or a
58
58
  // stop that failed never leaves a process nobody holds; close reports what
59
- // it could not stop instead of a clean close.
59
+ // it could not stop instead of a clean close, and records a stop it could
60
+ // confirm only on its retry while this process still owns the app.
60
61
  export function createAppInstances(context) {
61
62
  const { store, leases, gates, lifecycles, runner, now } = context;
62
63
  const wait = context.wait ?? waitFor;
@@ -186,7 +187,14 @@ export function createAppInstances(context) {
186
187
  exePath: handle.exePath ?? null, socket: handle.socket ?? null });
187
188
  });
188
189
  } catch (error) {
190
+ // The process is stopped first; only then does the instance end, so no
191
+ // running row of this owner outlives it and blocks the next start.
189
192
  await stopHandle(handle);
193
+ try {
194
+ endInstance(appId, lease, instance, 'start_failed', { sealedAt: now() });
195
+ } catch {
196
+ // The registry still fails: the record stays for the next owner's reconcile.
197
+ }
190
198
  throw error;
191
199
  }
192
200
  if (!recorded) {
@@ -253,6 +261,8 @@ export function createAppInstances(context) {
253
261
  store.recordEvent({ appId, at: now(), action: 'sealed', detail: { instanceId: local.instanceId, reason } });
254
262
  });
255
263
  local.sealed = true;
264
+ // Why it was sealed: a later seal (close's host_closing) retries the stop but keeps this.
265
+ local.sealReason = reason;
256
266
  }
257
267
  try {
258
268
  await stopHandle(local.handle);
@@ -265,7 +275,8 @@ export function createAppInstances(context) {
265
275
  });
266
276
  throw error;
267
277
  }
268
- endInstance(appId, local.lease, local, reason);
278
+ // A retried seal (close's host_closing) records why the instance was first sealed.
279
+ endInstance(appId, local.lease, local, local.sealReason);
269
280
  if (hosted.get(appId) === local) hosted.delete(appId);
270
281
  leases.release(local.lease);
271
282
  } finally {
@@ -330,33 +341,82 @@ export function createAppInstances(context) {
330
341
  // (for CLOSE_WAIT_MS at most), seals and stops every instance it holds, then
331
342
  // stops every handle still held. A seal still waiting after CLOSE_WAIT_MS (a
332
343
  // write tool that never returns) has its process stopped all the same; its
333
- // records stay for the next owner's reconcile, as after a crash. Resolves
334
- // { complete, startsInFlight, notStopped }: complete only when nothing is in
335
- // flight and every process FULI started is confirmed stopped. Asked again,
336
- // it retries the stops that failed and keeps their handles meanwhile.
344
+ // records stay for the next owner's reconcile, as after a crash; so do the
345
+ // records of a seal whose registry write threw. Never rejects: resolves
346
+ // { complete, startsInFlight, notStopped }, complete only when nothing is in
347
+ // flight and nothing is still held, so every process FULI started is
348
+ // confirmed stopped; notStopped names every handle still held, a late
349
+ // start's among them. Asked again, it retries the stops that failed and
350
+ // keeps their handles meanwhile.
337
351
  async function close() {
338
352
  const first = !closing;
339
353
  closing = true;
340
354
  if (first) await settledWithin(Promise.allSettled([...inFlight]), closeWaitMs);
341
355
  await Promise.all([...hosted.entries()].map(async ([appId, local]) => {
342
- // A host whose lease another process took over records nothing more; its process still ends here.
343
- const owned = first && leases.owns(local.lease);
344
- if (owned) {
345
- local.sealing ??= sealHosted(appId, local, 'host_closing');
346
- local.sealing.catch(() => {});
347
- }
348
- if (!owned || !await settledWithin(local.done, closeWaitMs)) hosted.delete(appId);
349
- }));
350
- const notStopped = [];
351
- await Promise.all([...held.entries()].map(async ([handle, started]) => {
352
- try {
353
- await stopHandle(handle);
354
- } catch (error) {
355
- notStopped.push({ ...started, pid: handle.pid ?? null, code: error?.code ?? null });
356
- }
356
+ if (!await sealForClose(appId, local, first)) hosted.delete(appId);
357
357
  }));
358
+ const failures = await stopHeld();
358
359
  for (const [appId, local] of hosted) if (!held.has(local.handle)) hosted.delete(appId);
359
- return { complete: inFlight.size === 0 && notStopped.length === 0, startsInFlight: inFlight.size, notStopped };
360
+ const notStopped = [...held].map(([handle, started]) => ({ ...started, pid: handle.pid ?? null,
361
+ code: failures.get(handle) ?? null }));
362
+ return { complete: idle(), startsInFlight: inFlight.size, notStopped };
363
+ }
364
+
365
+ // Tries each held handle's stop once, passing again while a late start
366
+ // returned a handle during the last pass. Resolves each failed stop's error code.
367
+ async function stopHeld() {
368
+ const failures = new Map();
369
+ for (;;) {
370
+ const pending = [...held].filter(([handle]) => !failures.has(handle));
371
+ if (pending.length === 0) return failures;
372
+ await Promise.all(pending.map(async ([handle, started]) => {
373
+ try {
374
+ await stopHandle(handle);
375
+ } catch (error) {
376
+ failures.set(handle, error?.code ?? null);
377
+ return;
378
+ }
379
+ recordLateStop(started.appId, handle);
380
+ }));
381
+ }
382
+ }
383
+
384
+ // Nothing hosted, held or in flight: closing has nothing to wait for.
385
+ function idle() {
386
+ return hosted.size === 0 && held.size === 0 && inFlight.size === 0;
387
+ }
388
+
389
+ // Whether this instance's seal settled within the close wait; never throws,
390
+ // so close always reaches its stops. A host whose lease another process
391
+ // took over records nothing more, and a seal that cannot even begin (its
392
+ // registry write throws) leaves the records to the next owner; either way
393
+ // the process still ends through its held handle.
394
+ async function sealForClose(appId, local, first) {
395
+ try {
396
+ if (!first || !leases.owns(local.lease)) return false;
397
+ local.sealing ??= sealHosted(appId, local, 'host_closing');
398
+ local.sealing.catch(() => {});
399
+ return await settledWithin(local.done, closeWaitMs);
400
+ } catch {
401
+ return false;
402
+ }
403
+ }
404
+
405
+ // A stop close confirmed after the seal's own stop failed: the sealed
406
+ // instance ends and its lease is released while this process still owns
407
+ // it (endInstance asserts that inside its transaction). Otherwise, or once
408
+ // the registry is closed (a retried close), it stays for the next owner's
409
+ // reconcile.
410
+ function recordLateStop(appId, handle) {
411
+ const local = hosted.get(appId);
412
+ if (local?.handle !== handle || !local.sealed) return;
413
+ try {
414
+ if (!leases.owns(local.lease)) return;
415
+ endInstance(appId, local.lease, local, local.sealReason);
416
+ leases.release(local.lease);
417
+ } catch {
418
+ // Left for the next owner, as after a crash.
419
+ }
360
420
  }
361
421
 
362
422
  // Inside the app's write gate, holding its lease.
@@ -387,8 +447,7 @@ export function createAppInstances(context) {
387
447
  return {
388
448
  start, stop, seal, end, reconcile, assertNoInstance, admit, close, verifyToken: tokens.verifyToken,
389
449
  hosted: (appId) => hosted.get(appId) ?? null,
390
- // Nothing hosted, held or in flight: closing has nothing to wait for.
391
- idle: () => hosted.size === 0 && held.size === 0 && inFlight.size === 0,
450
+ idle,
392
451
  assertOpen
393
452
  };
394
453
  }
@@ -49,10 +49,11 @@ export function agentAppServiceOver(context) {
49
49
  // Closes once, however often it is asked: the instances this process holds
50
50
  // are sealed and their processes stopped (instances.js) before the leases and
51
51
  // the registry close. With nothing hosted or in flight the registry closes
52
- // before this returns. A close that could not confirm every app process
53
- // stopped (a stop that failed, a start still in flight) rejects with
54
- // close_incomplete and names them; their handles stay held, the records stay
55
- // for the next owner's reconcile, and asking again retries those stops.
52
+ // before this returns. Only a close that left nothing held or in flight is
53
+ // kept as done. One that could not confirm every app process stopped (a stop
54
+ // that failed, a late start's handle among them, or a start still in flight)
55
+ // rejects with close_incomplete and names them; their handles stay held, the
56
+ // records stay for the next owner's reconcile, and asking again retries those stops.
56
57
  function closeContext(context) {
57
58
  const finish = () => {
58
59
  context.leases.close();
@@ -383,9 +383,9 @@ export const GRAPH_TOOL_DEFINITIONS = [
383
383
  },
384
384
  {
385
385
  name: 'resolve_deferred_preference_conflict',
386
- description: 'Resolve one AI-deferred conflict from get_collaboration_preferences only when the current task needs that preference. Compare both confirmed sides with their evidence and current context before choosing. Updates effective knowledge, preserves revision history, and permanently marks prior conflict as resolved by AI. Use merge with canonical item and merged instruction, keep_left/keep_right to retain one side, or split_scope to move one side to an exact personal project.',
386
+ description: 'Resolve one AI-deferred conflict from get_collaboration_preferences only when the current task needs that preference. Compare both confirmed sides with their evidence and current context before choosing. Updates effective knowledge, preserves revision history, and permanently marks prior conflict as resolved by AI. Use merge with canonical item and merged instruction, keep_left/keep_right to retain one side, or split_scope to move one side to an exact personal project. An FLA names projectAgentId and personalProjectId.',
387
387
  inputSchema: objectSchema({
388
- personalSpaceId: id,
388
+ personalSpaceId: id, personalProjectId: nullableStringSchema(), projectAgentId: nullableStringSchema(),
389
389
  conflictId: boundedString(1024),
390
390
  resolution: enumSchema([
391
391
  'merge', 'keep_left', 'keep_right', 'split_scope'
@@ -621,11 +621,11 @@ export const GRAPH_TOOL_DEFINITIONS = [
621
621
  },
622
622
  {
623
623
  name: 'get_knowledge_graph',
624
- description: 'Return a bounded node-edge graph for a personal space, one exact local personal project, or a team-shared project.',
624
+ description: 'Return a bounded node-edge graph for a personal space, one exact local personal project, or a team-shared project. An FLA sees its own knowledge only with projectAgentId and personalProjectId.',
625
625
  inputSchema: objectSchema({
626
626
  spaceId: id,
627
627
  providerUrl: nullableStringSchema(),
628
- personalProjectId: nullableStringSchema(),
628
+ personalProjectId: nullableStringSchema(), projectAgentId: nullableStringSchema(),
629
629
  limit: integerSchema({ minimum: 1, maximum: 2000 })
630
630
  }, ['spaceId'])
631
631
  },
@@ -184,9 +184,10 @@ export const AGENT_INTERFACE_DEFINITIONS = [
184
184
  {
185
185
  name: 'defer_preference_conflict',
186
186
  title: 'WRITE · Defer preference conflict',
187
- description: 'Defer one exact preference conflict without resolving either side. The conflict remains visible for later review.',
187
+ description: 'Defer one exact preference conflict without resolving either side. The conflict remains visible for later review. An FLA names projectAgentId and personalProjectId.',
188
188
  inputSchema: objectSchema({
189
189
  personalSpaceId: id,
190
+ personalProjectId: nullableStringSchema(), projectAgentId: nullableStringSchema(),
190
191
  conflictId: { ...stringSchema(), minLength: 1, maxLength: 1024 },
191
192
  preferenceKey: label,
192
193
  preferenceScope: enumSchema(['global', 'project']),