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
@@ -1,6 +1,6 @@
1
- import { sessionsMayBeOff, sessionUseDecision } from '../graphiti/session-layer-decision.js';
1
+ import { sessionsMayBeOff, sessionsMayBeWithoutCapture, sessionUseDecision } from '../graphiti/session-layer-decision.js';
2
2
  import { captureNotice } from '../graphiti/capture-notice.js';
3
- import { activeAgentHostClient } from '../app/agent-request-context.js';
3
+ import { activeAgentHostClient, runWithTaskBoundSession } from '../app/agent-request-context.js';
4
4
 
5
5
  // What an Agent may still call for a session FULI is off for (rec#5 C3b).
6
6
  // Every other tool returns stored memory or preferences to the model (entry,
@@ -19,18 +19,22 @@ const OPEN_TOOLS = new Set([
19
19
  'acquire_runtime_lease', 'refresh_runtime_lease', 'release_runtime_lease'
20
20
  ]);
21
21
  export const SESSION_FULI_OFF = 'fuli_off';
22
- // Tools an Agent calls without a task of their own (entry, recall, team and
23
- // judgment reads). They take the current taskContextToken only to say which
24
- // session they are for: without it, a call is refused while any session of
25
- // its client is off, since no host session shows the current one (option Y,
26
- // #251). The token is used here and never reaches the tool.
22
+ // Tools whose own schema names no task: those an Agent calls without a task of
23
+ // their own (entry, recall, team and judgment reads) and the records a task
24
+ // writes as it goes or closes. They take the current taskContextToken only to
25
+ // say which session they are for: without it, a call is refused while any
26
+ // session of its client is off, since no host session shows the current one
27
+ // (option Y, #251). The token is used here and never reaches the tool.
27
28
  const ATTRIBUTED_TOOLS = new Set([
28
29
  'get_collaboration_preferences', 'get_user_taste_skill', 'search_current_project_knowledge', 'search_knowledge_graph',
29
30
  'search_connected_knowledge', 'list_project_agents', 'get_project_agent_context', 'get_project_agent_memory',
30
31
  'list_preference_conflicts', 'resolve_deferred_preference_conflict', 'request_agent_attention', 'assess_agent_action',
31
- 'review_with_tonborg', 'get_agent_quality_gate', 'get_project_team', 'recommend_next_workflow_steps', 'find_agents'
32
+ 'review_with_tonborg', 'get_agent_quality_gate', 'get_project_team', 'recommend_next_workflow_steps', 'find_agents',
33
+ 'capture_session_knowledge', 'record_decision_trace', 'record_workflow_transition_observation',
34
+ 'checkpoint_project_agent_memory', 'record_project_agent_task_activity', 'record_project_agent_executor_actual',
35
+ 'record_project_agent_task_outcome'
32
36
  ]);
33
- // Bare: a value the registry does not know only leaves the call unattributed.
37
+ // Bare: a value that is not a current task token only leaves the call without a session.
34
38
  const TOKEN_FIELD = Object.freeze({ type: 'string' });
35
39
 
36
40
  // A tool definition as Agents see it: an attributed tool lists the token.
@@ -46,36 +50,61 @@ export function withoutSessionAttribution(name, input) {
46
50
  return rest;
47
51
  }
48
52
  const GUIDANCE = 'FULI is off for this session, so nothing was read, injected, recorded or started. Do not call FULI tools for this session or add an agent_receipt; only the person can turn it on (/fuli start).';
49
- const UNATTRIBUTED_GUIDANCE = 'FULI could not tell which session this call comes from while a session of this client has FULI off, so nothing was read or started. Calls that carry the current taskContextToken of this session are served; do not describe this as the person stopping FULI here.';
53
+ // The refusals that are not the person turning FULI off here.
54
+ const REASON_GUIDANCE = Object.freeze({
55
+ session_unattributed: 'FULI could not tell which session this call comes from while a session of this client has FULI off, so nothing was read or started. Calls that carry the current taskContextToken of this session are served; do not describe this as the person stopping FULI here.',
56
+ // Every prompt, a "continue" included, begins a new task; only a session's
57
+ // current task can be checkpointed (store_task_contexts.py).
58
+ task_token_not_current: 'This call\'s taskContextToken is not the current task of its session (each new prompt, a "continue" included, begins a new task with a new token; a token of another client or one FULI never issued looks the same), and a session of this client has FULI off, so nothing was read, recorded or started. Retry with the taskContextToken from this turn\'s FULI context. Do not try to checkpoint or record the earlier task: a task that is no longer current cannot be checkpointed. Do not describe this as the person stopping FULI here.',
59
+ policy_unavailable: 'FULI could not read what it needs to decide whether this session may be served (its session state or this call\'s task), so nothing was read, recorded or started. This is not the person stopping FULI; a later call may be served.'
60
+ });
50
61
 
51
- // Whether a call must first ask which sessions it speaks for: a tool that is
52
- // not open while FULI may be off for some session. Otherwise it runs as before.
53
- export function needsSessionFuliCheck(app, name) {
54
- return !OPEN_TOOLS.has(name) && sessionsMayBeOff(app);
62
+ // Runs an Agent's tool call (inside its request context) through the session
63
+ // layer. A tool that is not open is refused while FULI may be off for some
64
+ // session; otherwise it runs as before. A current task token an attributed
65
+ // tool carries binds the rest of the call to the token's session, so the
66
+ // capture decisions of its writes count that session as their task's, with
67
+ // its pause and stop, while another session of the client records nothing.
68
+ // A call that needs neither runs as before, synchronously.
69
+ export function runSessionGated(app, name, input, dispatch) {
70
+ const checked = !OPEN_TOOLS.has(name) && sessionsMayBeOff(app);
71
+ if (!checked && !ATTRIBUTED_TOOLS.has(name)) return dispatch();
72
+ // The client the call's process was started for decides, whatever the payload names or omits.
73
+ const sourceApplication = activeAgentHostClient() ?? input?.sourceApplication ?? 'other';
74
+ if (!checked && !sessionsMayBeWithoutCapture(app, sourceApplication)) return dispatch();
75
+ return gatedCall(app, name, input, dispatch, { checked, sourceApplication });
76
+ }
77
+
78
+ async function gatedCall(app, name, input, dispatch, { checked, sourceApplication }) {
79
+ const binding = await tokenBinding(app, input, sourceApplication);
80
+ const refusal = checked ? sessionFuliRefusal(app, input, sourceApplication, binding) : null;
81
+ if (refusal) return refusal;
82
+ return ATTRIBUTED_TOOLS.has(name) && binding.boundSessionId
83
+ ? runWithTaskBoundSession(binding.boundSessionId, dispatch) : dispatch();
55
84
  }
56
85
 
57
86
  // The refusal a tool returns instead of running, or null. The session is the
58
87
  // one the call's task token was bound to, the host session of the call or a
59
88
  // session it names (session-layer-decision.js), never one a model can choose
60
89
  // to allow it.
61
- export async function sessionFuliRefusal(app, input = {}) {
62
- // The client the call's process was started for decides, whatever the payload names or omits.
63
- const sourceApplication = activeAgentHostClient() ?? input?.sourceApplication ?? 'other';
90
+ function sessionFuliRefusal(app, input, sourceApplication, binding) {
64
91
  const decision = sessionUseDecision(app, { sourceApplication,
65
- sessionId: input?.sessionId ?? input?.sourceSessionId ?? null, boundSessionId: await boundSession(app, input, sourceApplication) });
92
+ sessionId: input?.sessionId ?? input?.sourceSessionId ?? null, ...binding });
66
93
  return decision.allowed ? null : { status: SESSION_FULI_OFF, reason: decision.reason,
67
- notice: captureNotice(decision.reason, decision.since),
68
- guidance: decision.reason === 'session_unattributed' ? UNATTRIBUTED_GUIDANCE : GUIDANCE };
94
+ notice: captureNotice(decision.reason, decision.since), guidance: REASON_GUIDANCE[decision.reason] ?? GUIDANCE };
69
95
  }
70
96
 
71
- // A token that does not resolve leaves the decision to the other identities;
72
- // the tool itself then refuses the token.
73
- async function boundSession(app, input, sourceApplication) {
97
+ // The session the call's task token is bound to or, for a token that binds it
98
+ // to none, why: it is not its session's current task, or the registry could
99
+ // not answer. That leaves the decision to the other identities; the tool
100
+ // itself then refuses the token. A value that cannot be a token says nothing.
101
+ async function tokenBinding(app, input, sourceApplication) {
74
102
  const token = input?.taskContextToken;
75
- if (typeof token !== 'string' || !token || token.length > 256 || !app.taskContextRegistry) return null;
103
+ if (typeof token !== 'string' || !token || token.length > 256 || !app.taskContextRegistry) return {};
76
104
  try {
77
- return (await app.taskContextRegistry.context(token, sourceApplication)).sessionId ?? null;
105
+ const boundSessionId = await app.taskContextRegistry.currentTaskSession(token, sourceApplication);
106
+ return boundSessionId ? { boundSessionId } : { tokenUnresolved: 'task_token_not_current' };
78
107
  } catch {
79
- return null;
108
+ return { tokenUnresolved: 'policy_unavailable' };
80
109
  }
81
110
  }
@@ -4,8 +4,7 @@ import { runWithAgentRequestContext } from './app/agent-request-context.js';
4
4
  import { ROUNDTABLE_TOOL_DEFINITIONS, ROUNDTABLE_TOOL_NAMES, callRoundtableTool } from './agent-roundtable/tools.js';
5
5
  import { ApplicationError } from './app/application-error.js';
6
6
  import { withCaptureLookups } from './graphiti/capture-decision.js';
7
- import { needsSessionFuliCheck, sessionFuliRefusal, withoutSessionAttribution, withSessionAttribution }
8
- from './agent-tools/session-fuli-gate.js';
7
+ import { runSessionGated, withoutSessionAttribution, withSessionAttribution } from './agent-tools/session-fuli-gate.js';
9
8
 
10
9
  const TOOL_DEFINITIONS = [...GRAPH_TOOL_DEFINITIONS, ...ROUNDTABLE_TOOL_DEFINITIONS].map(withSessionAttribution);
11
10
 
@@ -22,8 +21,7 @@ export function callAgentTool(app, name, input = {}, requestContext = null) {
22
21
  ? callRoundtableTool(app.roundtable, name, toolInput)
23
22
  : withCaptureLookups(() => dispatchGraphTool(app, name, toolInput));
24
23
  // A session FULI is off for gets no memory and starts no collaboration (rec#5 C3b).
25
- return runWithAgentRequestContext(requestContext, needsSessionFuliCheck(app, name)
26
- ? async () => await sessionFuliRefusal(app, input) ?? dispatch() : dispatch);
24
+ return runWithAgentRequestContext(requestContext, () => runSessionGated(app, name, input, dispatch));
27
25
  }
28
26
 
29
27
  function clone(value) {
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { randomUUID } from 'node:crypto';
3
- import { PASS_TASK_TOKEN, TASK_RULES_ON_DEMAND } from '../lifecycle-message.js';
3
+ import { PASS_TASK_TOKEN, TASK_RULES_ON_DEMAND, taskClosingInstruction } from '../lifecycle-message.js';
4
4
  import { transcriptLifecycle } from '../../conversations/transcript-lifecycle.js';
5
5
  import { transcriptCaptureScope } from '../../conversations/sync-transcript.js';
6
6
  import { captureDecision, withCaptureLookups } from '../../graphiti/capture-decision.js';
@@ -27,6 +27,7 @@ import { stopHookOutcome } from '../../conversations/stop-auto-close.js';
27
27
  import { outdatedMcpNotice, withOutdatedMcpNotice } from '../../mcp/process-registry.js';
28
28
  import { FULI_VERSION } from '../../package-metadata.js';
29
29
  import { taskSceneInput } from '../../graphiti/task-scene.js';
30
+ import { entryBudget, entryNotice, noteEntryNotice, NO_TASK_AT_DEADLINE, partialEntryText, runWithEntryBudget } from '../../conversations/entry-budget.js';
30
31
 
31
32
  export async function claudeLifecycleOutput(event, input, invoke, { delivery, currentTask, entryRefusal, onCurrentTask } = {}) {
32
33
  if (!['UserPromptSubmit', 'Stop', ...PREFERENCE_RESET_EVENTS].includes(event)) throw new TypeError('Unsupported Claude lifecycle event');
@@ -49,8 +50,9 @@ export async function claudeLifecycleOutput(event, input, invoke, { delivery, cu
49
50
  const context = await invoke('begin_task_context', {
50
51
  sessionId, projectPath: input.cwd, taskPrompt: input.prompt.slice(0, 8192), ...source, ...taskSceneInput(input.prompt)
51
52
  });
52
- return preferenceHookOutput(compactTaskContext(context), event, input, delivery, 'claude_code',
53
- 'Fuli task context. Read full context; apply effective_preferences. Follow checkpoint_guidance: checkpoint_task_knowledge only when there is something to record; the Stop hook closes the rest. ' + PASS_TASK_TOKEN + TASK_RULES_ON_DEMAND);
53
+ const entry = compactTaskContext(context);
54
+ return preferenceHookOutput(entry, event, input, delivery, 'claude_code',
55
+ 'Fuli task context. Apply effective_preferences. ' + taskClosingInstruction(entry) + PASS_TASK_TOKEN + TASK_RULES_ON_DEMAND);
54
56
  }
55
57
  const check = await invoke('verify_task_checkpoint', { sessionId, ...source });
56
58
  return stopHookOutcome(check, invoke, source);
@@ -75,19 +77,29 @@ const UNCONFIRMED_TURN = Object.freeze({
75
77
  + 'FULI: this turn is a host system delivery, but its task ownership is not confirmed; no task was created or switched.'
76
78
  });
77
79
 
78
- export function claudeLifecycleUnavailable(event, input = null, reason = null) {
80
+ export function claudeLifecycleUnavailable(event, input = null, reason = null, incomplete = '') {
79
81
  const warning = reason ?? 'Fuli context is unavailable; memory recovery and task checkpoint are not verified. '
80
82
  + 'Continue with the user request and use Fuli MCP when it becomes available.';
81
83
  const sessionId = input?.session_id;
82
84
  const fallback = event === 'UserPromptSubmit' && inPlaceRefreshBasis(input) ? ` ${START_NEW_WORK}`
83
85
  : typeof sessionId === 'string' && sessionId.trim() && sessionId.length <= 256
84
- ? ` No valid Hook task context was supplied. First call get_collaboration_preferences with sessionId=${JSON.stringify(sessionId)}, projectPath=current working directory and taskPrompt=current user request. Follow checkpoint_required and checkpoint_guidance; use its fresh taskContextToken for checkpoint_task_knowledge with a truthful workLog when there is something to record. Native transcript capture remains unverified; do not reuse an old token or claim this Hook delivered task context.`
86
+ ? ` No valid Hook task context was supplied. First call get_collaboration_preferences with sessionId=${JSON.stringify(sessionId)}, projectPath=current working directory and taskPrompt=current user request. Follow checkpoint_required and checkpoint_guidance; use its fresh taskContextToken for checkpoint_task_knowledge with a truthful workLog when there is something to record. Native transcript capture remains unverified; do not reuse an old token or claim this Hook delivered task context.${incomplete}`
85
87
  : '';
86
88
  return event === 'UserPromptSubmit'
87
89
  ? { systemMessage: warning, hookSpecificOutput: { hookEventName: event, additionalContext: warning + fallback } }
88
90
  : { systemMessage: warning };
89
91
  }
90
92
 
93
+ // At the deadline an entry that already wrote its task delivers its token and
94
+ // what is missing (entry-budget.js); otherwise the fallback says what to fetch.
95
+ export function claudeEntryDeadlineOutput(event, input, budget) {
96
+ const partial = event === 'UserPromptSubmit' ? partialEntryText(budget) : null;
97
+ const output = partial ? { systemMessage: 'Fuli task context is partial: the hook deadline came before it was complete.',
98
+ hookSpecificOutput: { hookEventName: event, additionalContext: partial } }
99
+ : claudeLifecycleUnavailable(event, input, null, NO_TASK_AT_DEADLINE);
100
+ return event === 'UserPromptSubmit' ? withOutdatedMcpNotice(output, entryNotice(budget)) : output;
101
+ }
102
+
91
103
  export async function runClaudeLifecycleHook(args, dependencies = {}) {
92
104
  const event = args[args.indexOf('--event') + 1];
93
105
  const input = await (dependencies.readInput ?? readHookInput)();
@@ -97,6 +109,9 @@ export async function runClaudeLifecycleHook(args, dependencies = {}) {
97
109
  );
98
110
  const ledger = runtimeConfigPath && typeof input?.session_id === 'string' && input.session_id.trim()
99
111
  ? transcriptCaptureLedger(runtimeConfigPath, input, 'claude_code') : null;
112
+ // Noted before the entry runs, so an answer at the deadline carries it too.
113
+ const notice = noteEntryNotice(() => outdatedMcpNotice(runtimeConfigPath,
114
+ { sourceApplication: 'claude_code', version: FULI_VERSION, sessionId: input?.session_id }));
100
115
  // A turn whose ownership cannot be proven is held as unresolved before
101
116
  // anything else can fail or return: whatever the read below finds, its
102
117
  // Stop neither settles the session's task nor records the turn under it.
@@ -149,8 +164,7 @@ export async function runClaudeLifecycleHook(args, dependencies = {}) {
149
164
  if (entered) await endTurnsObservedAtEntry(ledger, held, input, CLAUDE_UNRESOLVED_TURNS);
150
165
  return lifecycle;
151
166
  }), request);
152
- return event === 'UserPromptSubmit' ? withOutdatedMcpNotice(output, outdatedMcpNotice(runtimeConfigPath,
153
- { sourceApplication: 'claude_code', version: FULI_VERSION, sessionId: input.session_id })) : output;
167
+ return event === 'UserPromptSubmit' ? withOutdatedMcpNotice(output, notice()) : output;
154
168
  } finally {
155
169
  await Promise.allSettled([close(leases), close(app)]);
156
170
  }
@@ -201,18 +215,21 @@ async function main() {
201
215
  };
202
216
  // Finish before the host timeout, even if a dependency ignores cancellation.
203
217
  // No prompt, transcript, path or raw exception is written to diagnostics.
218
+ // The entry's own time ends where its requests are cancelled.
219
+ const abortAfterMs = Math.max(1, timeoutMs - 1500);
220
+ const budget = entryBudget(abortAfterMs);
204
221
  const deadline = setTimeout(() => {
205
222
  controller.abort();
206
- emit(claudeLifecycleUnavailable(event, input), () => process.exit(0));
223
+ emit(claudeEntryDeadlineOutput(event, input, budget), () => process.exit(0));
207
224
  }, timeoutMs);
208
- const abort = setTimeout(() => controller.abort(), Math.max(1, timeoutMs - 1500));
225
+ const abort = setTimeout(() => controller.abort(), abortAfterMs);
209
226
  try {
210
- const output = await runClaudeLifecycleHook(args, { signal: controller.signal,
227
+ const output = await runWithEntryBudget(budget, () => runClaudeLifecycleHook(args, { signal: controller.signal,
211
228
  captureTimeoutMs: Math.max(1, Math.min(750, Math.floor(timeoutMs / 4))),
212
- readInput: async () => { input = await readHookInput(); return input; } });
229
+ readInput: async () => { input = await readHookInput(); return input; } }));
213
230
  emit(output);
214
231
  } catch {
215
- emit(claudeLifecycleUnavailable(event, input));
232
+ emit(controller.signal.aborted ? claudeEntryDeadlineOutput(event, input, budget) : claudeLifecycleUnavailable(event, input));
216
233
  } finally {
217
234
  clearTimeout(abort);
218
235
  clearTimeout(deadline);
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { randomUUID } from 'node:crypto';
3
- import { PASS_TASK_TOKEN, TASK_RULES_ON_DEMAND } from '../lifecycle-message.js';
3
+ import { PASS_TASK_TOKEN, TASK_RULES_ON_DEMAND, taskClosingInstruction } from '../lifecycle-message.js';
4
4
  import { outdatedMcpNotice, withOutdatedMcpNotice } from '../../mcp/process-registry.js';
5
5
  import { FULI_VERSION } from '../../package-metadata.js';
6
6
  import { transcriptLifecycle } from '../../conversations/transcript-lifecycle.js';
@@ -24,6 +24,7 @@ import { isMainModule } from '../../system/main-module.js';
24
24
  import { readHookInput } from '../lifecycle-input.js';
25
25
  import { stopHookOutcome } from '../../conversations/stop-auto-close.js';
26
26
  import { taskSceneInput } from '../../graphiti/task-scene.js';
27
+ import { entryBudget, entryNotice, noteEntryNotice, NO_TASK_AT_DEADLINE, partialEntryText, runWithEntryBudget } from '../../conversations/entry-budget.js';
27
28
 
28
29
  // Task entry gets longer: a warm entry already takes 2–4 s on a Mac and a cold
29
30
  // first one ran past 5 s, which costs the model two fallback requests. Both
@@ -71,8 +72,9 @@ export async function codexLifecycleOutput(event, input, invoke, { delivery, cur
71
72
  const context = await invoke('begin_task_context', { sessionId: input.session_id,
72
73
  turnId: input.turn_id ?? null, projectPath: input.cwd, taskPrompt: input.prompt.slice(0, 8192),
73
74
  sourceApplication: 'codex', sourceSessionId: input.session_id, ...taskSceneInput(input.prompt) });
74
- const output = await preferenceHookOutput(compactTaskContext(context), event, input, delivery, 'codex',
75
- 'Fuli task context. Apply effective_preferences. Follow checkpoint_guidance: checkpoint with taskContextToken only when there is something to record; the Stop hook closes the rest. ' + PASS_TASK_TOKEN + TASK_RULES_ON_DEMAND);
75
+ const entry = compactTaskContext(context);
76
+ const output = await preferenceHookOutput(entry, event, input, delivery, 'codex',
77
+ 'Fuli task context. Apply effective_preferences. ' + taskClosingInstruction(entry) + PASS_TASK_TOKEN + TASK_RULES_ON_DEMAND);
76
78
  return review ? withCodexReviewGuidance(output) : output;
77
79
  }
78
80
 
@@ -94,6 +96,9 @@ export async function runCodexLifecycleHook(args, dependencies = {}) {
94
96
  );
95
97
  const ledger = runtimeConfigPath && typeof input?.session_id === 'string' && input.session_id.trim()
96
98
  ? transcriptCaptureLedger(runtimeConfigPath, input, 'codex') : null;
99
+ // Noted before the entry runs, so an answer at the deadline carries it too.
100
+ const notice = noteEntryNotice(() => outdatedMcpNotice(runtimeConfigPath,
101
+ { sourceApplication: 'codex', version: FULI_VERSION, sessionId: input?.session_id }));
97
102
  // A turn whose ownership cannot be proven is held as unresolved before
98
103
  // anything else can fail or return: whatever the read below finds, its
99
104
  // Stop neither settles the session's task nor records the turn under it.
@@ -148,8 +153,7 @@ export async function runCodexLifecycleHook(args, dependencies = {}) {
148
153
  if (entered) await endTurnsObservedAtEntry(ledger, held, input, CODEX_UNRESOLVED_TURNS);
149
154
  return lifecycle;
150
155
  }, { signal: dependencies.signal });
151
- const delivered = event === 'UserPromptSubmit' ? withOutdatedMcpNotice(output, outdatedMcpNotice(runtimeConfigPath,
152
- { sourceApplication: 'codex', version: FULI_VERSION, sessionId: input?.session_id })) : output;
156
+ const delivered = event === 'UserPromptSubmit' ? withOutdatedMcpNotice(output, notice()) : output;
153
157
  write(`${JSON.stringify(delivered)}\n`);
154
158
  return delivered;
155
159
  } finally {
@@ -228,7 +232,7 @@ async function closeQuietly(resource) {
228
232
 
229
233
  // The cause says whether the hook ran out of time or failed, so a report can
230
234
  // tell a slow first start from a broken install without exposing details.
231
- function codexLifecycleUnavailable(event, input, cause) {
235
+ function codexLifecycleUnavailable(event, input, cause, incomplete = '') {
232
236
  // The person's review line never reaches the model unverified (rec#22).
233
237
  if (event === 'UserPromptSubmit' && isCodexReviewCommand(input?.prompt)) {
234
238
  return { decision: 'block', reason: CODEX_REVIEW_UNVERIFIED_REASON };
@@ -245,10 +249,20 @@ function codexLifecycleUnavailable(event, input, cause) {
245
249
  // session cannot replace it when the Agent falls back to the preferences tool.
246
250
  const fallback = ` No valid Hook task context was supplied. First call get_collaboration_preferences with sessionId=${JSON.stringify(sessionId)}, projectPath=current working directory and taskPrompt=current user request. Follow checkpoint_required and checkpoint_guidance; use its fresh taskContextToken for checkpoint_task_knowledge with a truthful workLog when there is something to record. Native transcript capture remains unverified; do not reuse an old token or claim this Hook delivered task context.`;
247
251
  return { systemMessage: warning, hookSpecificOutput: {
248
- hookEventName: event, additionalContext: warning + fallback
252
+ hookEventName: event, additionalContext: warning + fallback + incomplete
249
253
  } };
250
254
  }
251
255
 
256
+ // At the deadline an entry that already wrote its task delivers its token and
257
+ // what is missing (entry-budget.js); otherwise the fallback says what to fetch.
258
+ function codexEntryDeadlineOutput(event, input, budget, cause) {
259
+ const partial = event === 'UserPromptSubmit' && !isCodexReviewCommand(input?.prompt) ? partialEntryText(budget) : null;
260
+ const output = partial ? { systemMessage: `Fuli task context is partial (${cause}).`,
261
+ hookSpecificOutput: { hookEventName: event, additionalContext: partial } }
262
+ : codexLifecycleUnavailable(event, input, cause, NO_TASK_AT_DEADLINE);
263
+ return event === 'UserPromptSubmit' ? withOutdatedMcpNotice(output, entryNotice(budget)) : output;
264
+ }
265
+
252
266
  export async function runCodexLifecycleCommand(args, dependencies = {}) {
253
267
  const event = args[args.indexOf('--event') + 1];
254
268
  const timeoutMs = codexHookTimeoutMs(args);
@@ -262,12 +276,13 @@ export async function runCodexLifecycleCommand(args, dependencies = {}) {
262
276
  let input = null;
263
277
  const readInput = dependencies.readInput ?? readHookInput;
264
278
  const unavailable = cause => `${JSON.stringify(codexLifecycleUnavailable(event, input, cause))}\n`;
279
+ const budget = entryBudget(timeoutMs);
265
280
  let cleanup = async () => {};
266
281
  let deadline;
267
282
  const expired = new Promise(resolve => {
268
283
  deadline = setTimeout(async () => {
269
284
  controller.abort();
270
- write(unavailable(`no answer within ${timeoutMs} ms`));
285
+ write(`${JSON.stringify(codexEntryDeadlineOutput(event, input, budget, `no answer within ${timeoutMs} ms`))}\n`);
271
286
  // A broken dependency must not hold the host open. Give opened leases
272
287
  // and connections a bounded chance to close before the process exits.
273
288
  let grace;
@@ -277,10 +292,10 @@ export async function runCodexLifecycleCommand(args, dependencies = {}) {
277
292
  }, timeoutMs);
278
293
  });
279
294
  try {
280
- const running = runCodexLifecycleHook(args, { ...dependencies, signal: controller.signal, write,
295
+ const running = runWithEntryBudget(budget, () => runCodexLifecycleHook(args, { ...dependencies, signal: controller.signal, write,
281
296
  captureTimeoutMs: Math.max(1, Math.min(750, Math.floor(timeoutMs / 4))),
282
297
  readInput: async () => { input = await readInput(); return input; },
283
- onCleanup: close => { cleanup = close; } }).then(() => ({ timedOut: false }), () => {
298
+ onCleanup: close => { cleanup = close; } })).then(() => ({ timedOut: false }), () => {
284
299
  // Never print prompts, transcripts, paths or credentials.
285
300
  write(unavailable('the hook failed'));
286
301
  return { timedOut: false };
@@ -5,6 +5,24 @@
5
5
  export const PASS_TASK_TOKEN = 'Pass taskContextToken to every FULI call. ';
6
6
  export const TASK_RULES_ON_DEMAND = 'Shared rules are referenced by version. Do not read fuli://rules/task-entry for an ordinary task; read one referenced section only when you must act on it (workers, memory merge, conflicts).';
7
7
 
8
+ // How a hook-delivered task ends, in the entry's own label (rec#47 F1). The
9
+ // entry only references the checkpoint and receipt rules, and a host may keep
10
+ // just a preview of a long entry, so the label carries the token and receipt.
11
+ // The Stop hook closes a task whose entry has checkpoint_guidance
12
+ // (stop-auto-close.js); a required checkpoint is left to the model.
13
+ export function taskClosingInstruction(entry) {
14
+ const token = entry?.taskContextToken;
15
+ if (typeof token !== 'string') return '';
16
+ const call = `checkpoint_task_knowledge with taskContextToken ${JSON.stringify(token)}`;
17
+ const checkpoint = entry.checkpoint_required === true ? `Before your final reply, call ${call}. `
18
+ : entry.checkpoint_guidance ? `The Stop hook closes this task. Call ${call} only when something is worth recording `
19
+ + '(knowledge, experience, memory changes, collaborators, a meaningful workLog). ' : '';
20
+ const receipt = entry.agent_receipt?.required === true && typeof entry.agent_receipt.markdown === 'string'
21
+ ? `End your final reply with this agent_receipt markdown, unchanged and once: ${JSON.stringify(entry.agent_receipt.markdown)} `
22
+ + '(a receipt returned by checkpoint_task_knowledge replaces it). ' : '';
23
+ return checkpoint + receipt;
24
+ }
25
+
8
26
  const DEFAULT_MAX_BYTES = 8_000;
9
27
  const TRUNCATION_SUFFIX = '… [truncated]';
10
28
 
@@ -1,4 +1,5 @@
1
1
  import { receiptConsoleUrl, receiptSummary, receiptText, sessionRecordsUrl } from './identity-receipt.js';
2
+ import { providerReaderFields } from '../graphiti/knowledge-reader.js';
2
3
 
3
4
  // The per-turn receipt (rec#20): after a turn's checkpoint saved knowledge, the
4
5
  // reply tail lists every item that turn actually created or replaced, read back
@@ -34,10 +35,12 @@ function turnReceiptListUrl(application, episodeIds) {
34
35
  // The receipt of saved capture results: null when nothing substantive changed.
35
36
  // memory is the Agent working-memory write this checkpoint made, if any.
36
37
  // session: { sourceApplication, sessionId } of the turn, for the session link.
38
+ // reader: the turn's FLA (knowledge-reader.js), or null for a plain session.
37
39
  export async function readTurnReceipt(application, captureResults, { memory = null, agentName = null,
38
- heading = '本轮沉淀', session = null } = {}) {
40
+ heading = '本轮沉淀', session = null, reader = null } = {}) {
39
41
  const episodeIds = savedEpisodeIds(captureResults);
40
- const { entries } = episodeIds.length ? await readEpisodeReceipts(application, episodeIds) : { entries: [] };
42
+ const { entries } = episodeIds.length ? await readEpisodeReceipts(application, episodeIds, { reader })
43
+ : { entries: [] };
41
44
  return renderTurnReceipt(application, entries, { episodeIds, memory, agentName, heading, session });
42
45
  }
43
46
 
@@ -52,19 +55,23 @@ export function renderTurnReceipt(application, entries, { episodeIds, memory = n
52
55
 
53
56
  // What the episodes created or replaced, read in the Provider's batches and
54
57
  // merged, so a late receipt of several turns and its full list read the same.
55
- export async function readEpisodeReceipts(application, episodeIds) {
58
+ // An Agent's receipt reads as its reader and leaves out every other FLA's
59
+ // items; the console's full list passes read, its human-review port.
60
+ export async function readEpisodeReceipts(application, episodeIds, {
61
+ reader = null, read = body => application.personal.readTurnReceipt({ ...body, ...providerReaderFields(reader) })
62
+ } = {}) {
56
63
  const entries = new Map();
57
64
  let unchanged = 0;
58
65
  const deletions = new Set();
59
66
  for (let start = 0; start < episodeIds.length; start += EPISODES_PER_READ) {
60
- const read = await application.personal.readTurnReceipt({ personal_space_id: application.config.personal.spaceId,
67
+ const batch = await read({ personal_space_id: application.config.personal.spaceId,
61
68
  episode_ids: episodeIds.slice(start, start + EPISODES_PER_READ) });
62
- if (!Array.isArray(read?.entries)) throw new TypeError('Provider did not return the turn receipt');
63
- for (const entry of read.entries) entries.set(`${entry.item_kind}:${entry.item_id}`, entry);
64
- unchanged += read.unchanged_count ?? 0;
69
+ if (!Array.isArray(batch?.entries)) throw new TypeError('Provider did not return the turn receipt');
70
+ for (const entry of batch.entries) entries.set(`${entry.item_kind}:${entry.item_id}`, entry);
71
+ unchanged += batch.unchanged_count ?? 0;
65
72
  // What a person hard-deleted since (rec#5 C9), each delete once even when
66
73
  // its sources span two reads.
67
- for (const id of read.deletion_ids ?? []) deletions.add(id);
74
+ for (const id of batch.deletion_ids ?? []) deletions.add(id);
68
75
  }
69
76
  return { entries: [...entries.values()], unchanged_count: unchanged, deleted_count: deletions.size };
70
77
  }
@@ -37,6 +37,24 @@ export function agentHostRequestContext(value, hostSessionId, sourceApplication
37
37
  ...(sourceApplication ? { [HOST_CLIENT]: sourceApplication } : {}) };
38
38
  }
39
39
 
40
+ // Runs the rest of an Agent call for the session its task token is bound to.
41
+ // Only the session gate calls this, with the session the task registry
42
+ // resolved for a current token (session-fuli-gate.js); a payload field or a raw
43
+ // token never reaches it. Every session decision of the call then counts that
44
+ // session as the call's task session.
45
+ export function runWithTaskBoundSession(sessionId, operation) {
46
+ const store = requestContext.getStore();
47
+ if (!store || typeof sessionId !== 'string' || !sessionId) {
48
+ throw new TypeError('A task-bound session needs an Agent request and a resolved session');
49
+ }
50
+ return requestContext.run({ ...store, taskBoundSession: sessionId }, operation);
51
+ }
52
+
53
+ // The session the call's current task token was resolved to, or null.
54
+ export function activeTaskBoundSession() {
55
+ return requestContext.getStore()?.taskBoundSession ?? null;
56
+ }
57
+
40
58
  // The host session of the Agent call being served: a session ID, null when the
41
59
  // client named none, undefined outside an Agent's own call (hooks, console).
42
60
  export function activeAgentHostSession() {
@@ -214,7 +214,10 @@ export function readBearerToken(path, fileSystem = {}) {
214
214
  const constants = fileSystem.constants ?? fsConstants;
215
215
  const absolute = resolve(path);
216
216
  // Windows has no O_NOFOLLOW: refuse a link up front and check the opened file is that entry.
217
- const entry = constants.O_NOFOLLOW === undefined ? (fileSystem.lstatSync ?? lstatSync)(absolute) : null;
217
+ // The identity is compared as BigInt: a Windows file ID above 2^53 rounds as a Number, so a
218
+ // replacement with a neighbouring ID would compare equal (rec#49).
219
+ const entry = constants.O_NOFOLLOW === undefined
220
+ ? (fileSystem.lstatSync ?? lstatSync)(absolute, { bigint: true }) : null;
218
221
  if (entry?.isSymbolicLink()) throw new TypeError('Remote MCP bearer token path must not be a symbolic link');
219
222
  let descriptor;
220
223
  try {
@@ -232,7 +235,8 @@ export function readBearerToken(path, fileSystem = {}) {
232
235
  }
233
236
  try {
234
237
  const metadata = fstat(descriptor);
235
- if (entry && (entry.ino !== metadata.ino || entry.dev !== metadata.dev)) {
238
+ const opened = entry && fstat(descriptor, { bigint: true });
239
+ if (entry && (entry.ino !== opened.ino || entry.dev !== opened.dev)) {
236
240
  throw new TypeError('Remote MCP bearer token path must not be a symbolic link');
237
241
  }
238
242
  if (!metadata.isFile()) throw new TypeError('Remote MCP bearer token path must be a regular file');
@@ -14,6 +14,7 @@ import { askCaptureScope, captureScopeSummary } from './capture-scope-prompt.js'
14
14
  import { captureOnboardingFor } from '../setup/first-run-capture.js';
15
15
  import { setupMigrationNotice } from '../data-format/format-notices.js';
16
16
  import { knowledgeReconciliationMessage } from '../knowledge-hard-delete/reconcile-local.js';
17
+ import { formatShadowedLaunchers, inspectUpdateInstallation } from './update-installation.js';
17
18
 
18
19
  export async function runSetupCommand(args, dependencies = {}) {
19
20
  const options = parseSetupOptions(args);
@@ -53,6 +54,11 @@ export async function runSetupCommand(args, dependencies = {}) {
53
54
  const migrationNotice = dependencies.migrationNotice ?? (applySetup === applyLocalSetup ? setupMigrationNotice : null);
54
55
  const waiting = migrationNotice && plan.paths?.dataDir ? await migrationNotice(plan.paths.dataDir) : null;
55
56
  if (waiting) write(waiting);
57
+ // Stubbed setups in tests leave the host PATH alone too.
58
+ const shadowedLaunchers = dependencies.shadowedLaunchers ?? (applySetup === applyLocalSetup
59
+ ? () => formatShadowedLaunchers(inspectUpdateInstallation({ env: dependencies.env ?? process.env })) : null);
60
+ const shadowed = shadowedLaunchers?.();
61
+ if (shadowed) write(shadowed);
56
62
  return { ...result, exitCode: result.status === 'partial' ? 1 : 0 };
57
63
  }
58
64
 
@@ -10,7 +10,12 @@ import {
10
10
  import { quoteShellArgument } from './shell-argument.js';
11
11
  import { parseUpdateOptions } from '../setup/options.js';
12
12
  import { runLocalRuntimeCommand } from './local-runtime-command.js';
13
- import { formatUpdateInstallation, inspectUpdateInstallation, updateEnvironment } from './update-installation.js';
13
+ import {
14
+ formatShadowedLaunchers,
15
+ formatUpdateInstallation,
16
+ inspectUpdateInstallation,
17
+ updateEnvironment
18
+ } from './update-installation.js';
14
19
  import { readWindowsInstallation } from '../desktop/windows-installation-context.js';
15
20
  import {
16
21
  compareSemanticVersions,
@@ -49,11 +54,17 @@ export async function runUpdateCommand(args = [], dependencies = {}) {
49
54
  const inspectInstallation = dependencies.inspectInstallation ?? inspectUpdateInstallation;
50
55
  const installation = inspectInstallation({ env: originalEnv, platform });
51
56
  write(formatUpdateInstallation(installation, { nodePath, npmCommand }));
57
+ // Judged on the person's own PATH, not the update's, which puts this Node first.
58
+ const writeShadowed = (inspected, target = inspected.cliPath) => {
59
+ const shadowed = formatShadowedLaunchers(inspected, { target, platform });
60
+ if (shadowed) write(shadowed);
61
+ };
52
62
  const latestVersion = resolveLatestVersion();
53
63
  const comparison = compareSemanticVersions(latestVersion, FULI_VERSION);
54
64
  if (comparison === 0) {
55
65
  const result = { status: 'current', previousVersion: FULI_VERSION, version: FULI_VERSION };
56
66
  write(formatUpdateResult(result));
67
+ writeShadowed(installation);
57
68
  return result;
58
69
  }
59
70
  if (comparison < 0) {
@@ -64,6 +75,7 @@ export async function runUpdateCommand(args = [], dependencies = {}) {
64
75
  latestVersion
65
76
  };
66
77
  write(formatUpdateResult(result));
78
+ writeShadowed(installation);
67
79
  return result;
68
80
  }
69
81
 
@@ -149,6 +161,7 @@ export async function runUpdateCommand(args = [], dependencies = {}) {
149
161
  version
150
162
  };
151
163
  write(formatUpdateResult(result));
164
+ writeShadowed(inspectInstallation({ env: originalEnv, platform }), cliPath);
152
165
  if (options.skipAgents) {
153
166
  write('Existing conversations may still use the previous MCP process. Reconnect Fuli in your client or restart the client, then open a new task. Running conversations were not restarted automatically.');
154
167
  }
@@ -1,7 +1,8 @@
1
- import { existsSync, readFileSync, realpathSync } from 'node:fs';
1
+ import { accessSync, constants, existsSync, readFileSync, realpathSync, statSync } from 'node:fs';
2
2
  import { fileURLToPath } from 'node:url';
3
3
  import { FULI_PACKAGE_NAME, FULI_VERSION } from '../package-metadata.js';
4
4
  import { platformPath } from '../system/platform-path.js';
5
+ import { quoteShellArgument } from './shell-argument.js';
5
6
 
6
7
  export function updateEnvironment(env, nodePath, platform = process.platform) {
7
8
  const path = platformPath(platform);
@@ -30,12 +31,55 @@ export function inspectUpdateInstallation({ env = process.env, platform = proces
30
31
  if (manifest.name === FULI_PACKAGE_NAME) version = manifest.version;
31
32
  }
32
33
  } catch { /* Broken or unreadable candidates remain visible with an unknown version. */ }
33
- launchers.push({ path: launcher, target, version });
34
+ launchers.push({ path: launcher, target, version, executable: isExecutable(launcher, platform) });
34
35
  }
35
36
  }
36
37
  return { cliPath: fileURLToPath(new URL('../cli.js', import.meta.url)), launchers };
37
38
  }
38
39
 
40
+ // A shell running a bare `fl`/`fuli` takes the first launcher on PATH. When that is a
41
+ // different Fuli installation, the command keeps answering with the old version even
42
+ // though this one was installed and set up (rec#41). Client hooks and MCP are written
43
+ // with absolute paths, so only bare shell commands are affected.
44
+ export function formatShadowedLaunchers(installation, { target = installation.cliPath, platform = process.platform } = {}) {
45
+ const path = platformPath(platform);
46
+ let realTarget = target;
47
+ try { realTarget = realpathSync(target); } catch { /* compare the path as given */ }
48
+ const own = installation.launchers.find((launcher) => launcher.target === realTarget);
49
+ const shadowing = [];
50
+ for (const command of ['fl', 'fuli']) {
51
+ const first = installation.launchers.find((launcher) => launcher.executable !== false &&
52
+ path.basename(launcher.path).replace(/\.cmd$/i, '') === command);
53
+ // Only a recognized Fuli installation is reported; an unknown wrapper is never guessed at.
54
+ if (first?.version && first.target !== realTarget) shadowing.push({ command, ...first });
55
+ }
56
+ if (!shadowing.length) return null;
57
+ // An npm global package lives at <prefix>/lib/node_modules/<name>/src/cli.js.
58
+ const nodeModules = path.dirname(path.dirname(path.dirname(shadowing[0].target)));
59
+ const lib = path.dirname(nodeModules);
60
+ const fix = path.basename(nodeModules) === 'node_modules' && path.basename(lib) === 'lib'
61
+ ? `npm uninstall --global ${FULI_PACKAGE_NAME} --prefix ${quoteShellArgument(path.dirname(lib), platform)}`
62
+ : 'remove that installation';
63
+ return [
64
+ ...shadowing.map(({ command, path: launcher, version, target: other }) =>
65
+ `Warning: \`${command}\` on PATH is another Fuli installation: ${launcher} -> ${version} (${other}).`),
66
+ 'Shells that run the bare command get that version; client hooks and MCP use absolute paths and are not affected.',
67
+ `To fix: ${fix}${own ? `, or put ${path.dirname(own.path)} first in PATH` : ''}.`
68
+ ].join('\n');
69
+ }
70
+
71
+ // A shell skips a launcher it cannot execute, so only runnable ones can shadow another.
72
+ // Directories carry the execute bit too, so the (followed) target must be a file.
73
+ function isExecutable(launcher, platform) {
74
+ if (platform === 'win32') return true;
75
+ try {
76
+ accessSync(launcher, constants.X_OK);
77
+ return statSync(launcher).isFile();
78
+ } catch {
79
+ return false;
80
+ }
81
+ }
82
+
39
83
  export function formatUpdateInstallation(installation, { nodePath, npmCommand }) {
40
84
  const groups = new Map();
41
85
  for (const launcher of installation.launchers) {