fuli-context 0.20.0-beta.8 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/README.md +2 -0
  2. package/README.zh-CN.md +1 -0
  3. package/dist/web/assets/{AboutPage-Dy3drTbS.css → AboutPage-Bxm7RJZg.css} +1 -1
  4. package/dist/web/assets/{AboutPage-BybzKsx-.js → AboutPage-CjDenGS_.js} +1 -1
  5. package/dist/web/assets/{AgentName-CXf8heW-.js → AgentName-DdlJlpT3.js} +1 -1
  6. package/dist/web/assets/{AgentProfilePage-D0YyiAA6.js → AgentProfilePage-Cx_Uf5Vf.js} +1 -1
  7. package/dist/web/assets/{AgentProfilePage-B2yMnmQP.css → AgentProfilePage-DXvLQu-C.css} +1 -1
  8. package/dist/web/assets/{AgentsDirectoryPage-DvPJNJm-.css → AgentsDirectoryPage-BwF-0nFO.css} +1 -1
  9. package/dist/web/assets/{AgentsDirectoryPage-LU-bRYPw.js → AgentsDirectoryPage-DylT-GSW.js} +1 -1
  10. package/dist/web/assets/{BackLink-Dgc1V1EN.js → BackLink-D7oAvDG5.js} +1 -1
  11. package/dist/web/assets/{BoardMoveMenu-XrAiFzGj.js → BoardMoveMenu-B0pA7LLx.js} +1 -1
  12. package/dist/web/assets/CaptureChangePage-Cch3mT4b.css +1 -0
  13. package/dist/web/assets/{CaptureChangePage-DcJKvaGf.js → CaptureChangePage-DEuqPb14.js} +1 -1
  14. package/dist/web/assets/{Card-96u8qomm.js → Card-BZFLZ_2I.js} +1 -1
  15. package/dist/web/assets/{CardHeader-4je7E12I.js → CardHeader-C_c0keQn.js} +1 -1
  16. package/dist/web/assets/{CardTitle-bjMusOR6.js → CardTitle-yXOhV577.js} +1 -1
  17. package/dist/web/assets/ConnectionsPage-DlnHdtwn.js +1 -0
  18. package/dist/web/assets/{CreateProjectDialog-BDwT_wZd.js → CreateProjectDialog-BVJqWdlT.js} +1 -1
  19. package/dist/web/assets/{DataFormatPage-PxwqDWeZ.js → DataFormatPage-BdcjcyhZ.js} +1 -1
  20. package/dist/web/assets/DataFormatPage-Dp7mePUw.css +1 -0
  21. package/dist/web/assets/{DialogFooter-DwgFgHdH.js → DialogFooter-DYawfDCD.js} +1 -1
  22. package/dist/web/assets/{EmployeeRecruitDialog-DjX_wOWx.js → EmployeeRecruitDialog-CB4ARFkM.js} +1 -1
  23. package/dist/web/assets/{EmployeeWorkbenchPage-DWhBevwY.js → EmployeeWorkbenchPage-BUMfMBc8.js} +2 -2
  24. package/dist/web/assets/{EmployeeWorkbenchPage-l_LYqBnr.css → EmployeeWorkbenchPage-BenZP7De.css} +1 -1
  25. package/dist/web/assets/{GrowthLoading-DssogOkP.js → GrowthLoading-smW3-Gfp.js} +1 -1
  26. package/dist/web/assets/{InboxPage-fFg4gETv.css → InboxPage-CbbiHgTr.css} +1 -1
  27. package/dist/web/assets/{InboxPage-BF38gnSV.js → InboxPage-Crn1UU7s.js} +2 -2
  28. package/dist/web/assets/{Input-DHF3Ivr3.js → Input-F1oftPWh.js} +1 -1
  29. package/dist/web/assets/{KnowledgeEditDialog-uAzeQbMB.js → KnowledgeEditDialog-VdQwbX4E.js} +1 -1
  30. package/dist/web/assets/{KnowledgeHardDeleteSection-qGeE1YrK.js → KnowledgeHardDeleteSection-CXRmNnZF.js} +1 -1
  31. package/dist/web/assets/{KnowledgeItemEditPage-Cj5uNVo6.js → KnowledgeItemEditPage-CQo3TbCJ.js} +1 -1
  32. package/dist/web/assets/{KnowledgeItemSummaryCard-CeOSN36n.js → KnowledgeItemSummaryCard-Dd2McM-d.js} +1 -1
  33. package/dist/web/assets/{KnowledgeOrganizerPage-7VC_JAWQ.css → KnowledgeOrganizerPage-BIOaMzgQ.css} +1 -1
  34. package/dist/web/assets/{KnowledgeOrganizerPage-BVLMc2jL.js → KnowledgeOrganizerPage-BVgAyu6U.js} +1 -1
  35. package/dist/web/assets/KnowledgePage-Bfbfz_Z8.js +1 -0
  36. package/dist/web/assets/{KnowledgePeek-BD2zoQqA.js → KnowledgePeek-BNBkh1ey.js} +1 -1
  37. package/dist/web/assets/KnowledgeTurnReceiptPage-Ckw_olrt.js +1 -0
  38. package/dist/web/assets/{KnowledgeWorkspace-CgFI31jK.js → KnowledgeWorkspace-pH2tAFld.js} +1 -1
  39. package/dist/web/assets/{Label-DM1yZ2CL.js → Label-yDCtlpkb.js} +1 -1
  40. package/dist/web/assets/ModelSettingsPage-C3eBDWRL.js +1 -0
  41. package/dist/web/assets/ModelSettingsPage-DZkrJw7R.css +1 -0
  42. package/dist/web/assets/NotFoundPage-8gVVukRR.js +1 -0
  43. package/dist/web/assets/OccupationsPage-BTormZIO.css +1 -0
  44. package/dist/web/assets/{OccupationsPage-CHgGGvDu.js → OccupationsPage-PNoqE21Y.js} +1 -1
  45. package/dist/web/assets/{OverviewPage-E0tfzQRr.js → OverviewPage-DiwYSnhh.js} +2 -2
  46. package/dist/web/assets/{OverviewPage-CpHmwB7u.css → OverviewPage-YBQHyU7s.css} +1 -1
  47. package/dist/web/assets/{PersonalProfilePage-CfqsnB1K.css → PersonalProfilePage-CGW50MHm.css} +1 -1
  48. package/dist/web/assets/{PersonalProfilePage-o5Gpo9nJ.js → PersonalProfilePage-C_v2BFee.js} +1 -1
  49. package/dist/web/assets/PersonalProjectsPage-Cf5mrQmy.css +1 -0
  50. package/dist/web/assets/{PersonalProjectsPage-Boj9kG6I.js → PersonalProjectsPage-DGRV8cM5.js} +1 -1
  51. package/dist/web/assets/{PopperContent-BDOio_9z.js → PopperContent-5zqbtnYr.js} +1 -1
  52. package/dist/web/assets/{Presence-Bk6m9rvx.js → Presence-BYfYJNMD.js} +1 -1
  53. package/dist/web/assets/{ProjectAgentDetailPage-Cyl3ZPBO.js → ProjectAgentDetailPage-BQ9ffaCX.js} +2 -2
  54. package/dist/web/assets/{ProjectAgentDetailPage-Ns2ATys8.css → ProjectAgentDetailPage-CRFE6n-s.css} +1 -1
  55. package/dist/web/assets/{ProjectAgentDialog-C1_KluEx.js → ProjectAgentDialog-BGckQDTq.js} +1 -1
  56. package/dist/web/assets/{ProjectAgentFirstTask-CXKvWwhZ.js → ProjectAgentFirstTask-DrSd3nR-.js} +1 -1
  57. package/dist/web/assets/{ProjectAgentsPage-DKNDXWow.css → ProjectAgentsPage-BBzKAhZx.css} +1 -1
  58. package/dist/web/assets/{ProjectAgentsPage-DHTo0uNy.js → ProjectAgentsPage-U4Om3EPu.js} +1 -1
  59. package/dist/web/assets/{ProjectScopePicker-GjK7Hm4N.js → ProjectScopePicker-D0oxbwOd.js} +1 -1
  60. package/dist/web/assets/{PublicProjectsPage-BuJo0ReR.js → PublicProjectsPage-CvkQ3E8I.js} +1 -1
  61. package/dist/web/assets/{PublicProjectsPage-yA6Md4oM.css → PublicProjectsPage-Ditr0SY-.css} +1 -1
  62. package/dist/web/assets/{RadioGroupItem-DxktHt0c.js → RadioGroupItem-CBpbQlHx.js} +1 -1
  63. package/dist/web/assets/{RoundtablesPage-Bd3XCn7B.js → RoundtablesPage-BEUaKOjI.js} +1 -1
  64. package/dist/web/assets/RoundtablesPage-BMYSDYH8.css +1 -0
  65. package/dist/web/assets/{RovingFocusGroup-DyZDm-Bn.js → RovingFocusGroup-X9U-ufYr.js} +1 -1
  66. package/dist/web/assets/{RovingFocusItem-BKyXKG9n.js → RovingFocusItem-_uA_OCLT.js} +1 -1
  67. package/dist/web/assets/SessionMigrationPage-WVFSDcUO.js +1 -0
  68. package/dist/web/assets/{SessionRecordsPage-CvGaB3h3.js → SessionRecordsPage-Bs2eLXEi.js} +1 -1
  69. package/dist/web/assets/{SettingsPage-DG3ialW3.css → SettingsPage-BbX9ysTX.css} +1 -1
  70. package/dist/web/assets/{SettingsPage-OasIZiIz.js → SettingsPage-DlIwICIz.js} +1 -1
  71. package/dist/web/assets/{SharedJefaReportPage-_f2bnFY-.js → SharedJefaReportPage-B_rreEep.js} +1 -1
  72. package/dist/web/assets/{TabsContent-CTM6GBGk.js → TabsContent-8pXwYJPz.js} +1 -1
  73. package/dist/web/assets/{TabsTrigger-BFj6S2XJ.js → TabsTrigger-Cd6SI2yI.js} +1 -1
  74. package/dist/web/assets/{TagVocabularyPage-Cp1UVDoe.js → TagVocabularyPage-BQiuKG-4.js} +1 -1
  75. package/dist/web/assets/{TaskExecutionPlan-D_MbMVvj.js → TaskExecutionPlan-CupxJeyo.js} +1 -1
  76. package/dist/web/assets/TaskSchedulesPage-DcmDdY10.css +1 -0
  77. package/dist/web/assets/{TaskSchedulesPage-Dd38ntqQ.js → TaskSchedulesPage-zYQs7s6T.js} +1 -1
  78. package/dist/web/assets/{Teleport-D5d1fEVm.js → Teleport-BZX1Eb7R.js} +1 -1
  79. package/dist/web/assets/{TextField-DUZTbKVz.js → TextField-CielK4l3.js} +1 -1
  80. package/dist/web/assets/{UiDialog-CU8nqGKC.js → UiDialog-BSDblUpR.js} +1 -1
  81. package/dist/web/assets/{UiDisclosure-DbxNZe0B.js → UiDisclosure-DLmVwmy1.js} +1 -1
  82. package/dist/web/assets/{UiIcon-DSkB5Juh.js → UiIcon-B8eZeuGI.js} +1 -1
  83. package/dist/web/assets/{UiIconButton-Bgy8Hoy4.js → UiIconButton-e754Tmnq.js} +1 -1
  84. package/dist/web/assets/{UiSegmented-BwkPHeLK.js → UiSegmented-D1HD-qin.js} +1 -1
  85. package/dist/web/assets/{UiSelect-CW3HNsRZ.js → UiSelect-CbkTsi2e.js} +1 -1
  86. package/dist/web/assets/{UiToggle--Z_LpW41.js → UiToggle-Dz93aXFK.js} +1 -1
  87. package/dist/web/assets/{UiWeight-D8U0orbz.js → UiWeight-CUvyApSB.js} +1 -1
  88. package/dist/web/assets/{UnassignedConversationsPanel-BeWzhuBr.js → UnassignedConversationsPanel-xY7gsFot.js} +1 -1
  89. package/dist/web/assets/{VirtualDirectoryList-BT099Zuk.js → VirtualDirectoryList-Dv6PwLjU.js} +1 -1
  90. package/dist/web/assets/{Workbench3D-BAb5m-Qk.js → Workbench3D--4N_uKzp.js} +1 -1
  91. package/dist/web/assets/WritingTastePage-B7KojA4r.js +1 -0
  92. package/dist/web/assets/{WritingTastePage-Dh1qW6bK.css → WritingTastePage-asIa-2U5.css} +1 -1
  93. package/dist/web/assets/{_plugin-vue_export-helper-Crd8aFkh.js → _plugin-vue_export-helper-BmfQlfI8.js} +1 -1
  94. package/dist/web/assets/{accordion-C-pFa1cg.js → accordion-gXElbGP_.js} +1 -1
  95. package/dist/web/assets/{agent-occupation-BooDHzf0.js → agent-occupation-ChN-1QjC.js} +1 -1
  96. package/dist/web/assets/{agent-pins-CFO-xYmz.js → agent-pins-Chh_rdBi.js} +1 -1
  97. package/dist/web/assets/{agent-profile-Bi--2zRQ.css → agent-profile-LzhgJINr.css} +1 -1
  98. 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
  99. package/dist/web/assets/{agent-work-summary-BIZoVGaT.js → agent-work-summary-C9yMf019.js} +1 -1
  100. package/dist/web/assets/{attention-store-dDH6VA6Z.js → attention-store-CG9cF6DX.js} +1 -1
  101. package/dist/web/assets/{badge-BnU2j9Nh.js → badge-DvvDq2Wb.js} +1 -1
  102. package/dist/web/assets/{button-B4gCj85U.js → button-CFEnxtio.js} +1 -1
  103. package/dist/web/assets/{checkbox-CzVOT2cF.js → checkbox-DovdRz8u.js} +1 -1
  104. package/dist/web/assets/{client-Cg0bLxrO.js → client-lh80ewvs.js} +1 -1
  105. package/dist/web/assets/{console-k05BnLkZ.js → console-CQMgYkk9.js} +1 -1
  106. package/dist/web/assets/{conversation-launcher-settings-C745vZJa.js → conversation-launcher-settings-B1QM-wZB.js} +1 -1
  107. package/dist/web/assets/{design-lab-CJiqHzsm.js → design-lab-BDKwIbI8.js} +1 -1
  108. package/dist/web/assets/{dialog-DQaUWk4W.js → dialog-D2mO6m3B.js} +1 -1
  109. package/dist/web/assets/{dist-2CLFk118.js → dist-PmK0PfVA.js} +1 -1
  110. package/dist/web/assets/{dropdown-menu-CN5wjWUD.js → dropdown-menu-YzCnvjAb.js} +1 -1
  111. package/dist/web/assets/{field-6gOLsuT_.js → field-BMEFEyVC.js} +1 -1
  112. package/dist/web/assets/{identity-NbL1GGSB.js → identity-bK-fJdnj.js} +1 -1
  113. package/dist/web/assets/index-BhekqRSJ.js +2 -0
  114. package/dist/web/assets/index-DedvhyS3.css +1 -0
  115. package/dist/web/assets/{judgment-types-DfSuVLnV.js → judgment-types-DJnAr9c0.js} +1 -1
  116. package/dist/web/assets/{model-BjNAHvfb.js → model-BwNZZZNP.js} +1 -1
  117. package/dist/web/assets/{model-DrZFCNN6.js → model-CPMYnu3S.js} +1 -1
  118. package/dist/web/assets/{model-DPykou4S.js → model-Cengn9fg.js} +1 -1
  119. package/dist/web/assets/{model-YYqd0CSe.js → model-CuY1vtEy.js} +1 -1
  120. package/dist/web/assets/{model-2BvryZbU.js → model-DpVrfbnj.js} +1 -1
  121. package/dist/web/assets/{model-BsfqK9w_.js → model-rumuELTi.js} +1 -1
  122. package/dist/web/assets/{motion-preference-CxKthhLy.js → motion-preference-A1AMssSH.js} +1 -1
  123. package/dist/web/assets/{occupation-catalog-JHFMVvBn.js → occupation-catalog-DxwlYD1L.js} +1 -1
  124. package/dist/web/assets/{orchestration-filters-B7ZbjZKo.js → orchestration-filters-DZpJ0FN3.js} +1 -1
  125. package/dist/web/assets/{page-title-BawJ25Bw.js → page-title-Bg-mVyrS.js} +1 -1
  126. package/dist/web/assets/{personal-profile-graph-BEjSAQMe.js → personal-profile-graph-tMneNj_m.js} +1 -1
  127. package/dist/web/assets/{project-capture-BUtkhbr1.js → project-capture-QgMw6qvo.js} +1 -1
  128. package/dist/web/assets/{project-origin-DI7ft7I8.js → project-origin-ppsYHpYL.js} +1 -1
  129. package/dist/web/assets/project-team-api-DwP0O3rn.js +1 -0
  130. package/dist/web/assets/{quick-edit-api-CTMfc9uz.js → quick-edit-api-BiyK3ih-.js} +1 -1
  131. package/dist/web/assets/{shared-report-o1Tvfyn-.js → shared-report-D3Hem1t5.js} +3 -3
  132. package/dist/web/assets/{task-labels-dW28Ybet.js → task-labels-7KyNw9id.js} +1 -1
  133. package/dist/web/assets/{ui-BkbPVq3y.js → ui-Ck58paqr.js} +1 -1
  134. package/dist/web/assets/{useAgentRecords-D6BTApmV.js → useAgentRecords-C6RrZwwv.js} +1 -1
  135. package/dist/web/assets/{useApi-CROJJdhE-BMswzZdS.js → useApi-CROJJdhE-BujjnKN_.js} +1 -1
  136. package/dist/web/assets/{useFocusReturn-DQOtrYO8.js → useFocusReturn-D9IOIg17.js} +1 -1
  137. package/dist/web/assets/{useKnowledgeItemPeek-CGzVMWJz.js → useKnowledgeItemPeek-C6nAzvDL.js} +1 -1
  138. package/dist/web/assets/{useMinimumLoadingDisplay-DEBBYuGI.js → useMinimumLoadingDisplay-HnxkDut6.js} +1 -1
  139. package/dist/web/assets/{useRoutePeek-R9W605pr.js → useRoutePeek-BvYFc1BA.js} +1 -1
  140. package/dist/web/assets/{vue-router-BUjBh_Iw.js → vue-router-Bl55c88B.js} +1 -1
  141. package/dist/web/index.html +33 -33
  142. package/docs/agent-apps.md +110 -0
  143. package/docs/employee-agents.md +1 -1
  144. package/graph-provider/fuli_graph/app.py +16 -11
  145. package/graph-provider/fuli_graph/graph_query.py +30 -2
  146. package/graph-provider/fuli_graph/knowledge_audit.py +9 -1
  147. package/graph-provider/fuli_graph/knowledge_item_routes.py +10 -6
  148. package/graph-provider/fuli_graph/knowledge_item_view.py +41 -12
  149. package/graph-provider/fuli_graph/knowledge_item_view_models.py +3 -3
  150. package/graph-provider/fuli_graph/knowledge_review.py +47 -10
  151. package/graph-provider/fuli_graph/knowledge_search.py +18 -22
  152. package/graph-provider/fuli_graph/knowledge_session_migration.py +14 -4
  153. package/graph-provider/fuli_graph/knowledge_session_migration_models.py +2 -2
  154. package/graph-provider/fuli_graph/knowledge_tag_routes.py +7 -5
  155. package/graph-provider/fuli_graph/knowledge_tags.py +8 -4
  156. package/graph-provider/fuli_graph/knowledge_visibility.py +195 -0
  157. package/graph-provider/fuli_graph/models.py +12 -2
  158. package/graph-provider/fuli_graph/preference_conflicts.py +50 -4
  159. package/graph-provider/fuli_graph/publication_source_copies.py +36 -0
  160. package/graph-provider/fuli_graph/session_records.py +33 -13
  161. package/graph-provider/fuli_graph/session_records_models.py +4 -2
  162. package/graph-provider/fuli_graph/store_knowledge.py +5 -1
  163. package/graph-provider/fuli_graph/store_publication.py +70 -12
  164. package/graph-provider/fuli_graph/task_context_models.py +2 -0
  165. package/graph-provider/fuli_graph/task_session_hints.py +7 -3
  166. package/graph-provider/pyproject.toml +1 -1
  167. package/native/win32/fuli-win-helper.exe +0 -0
  168. package/npm-shrinkwrap.json +8 -8
  169. package/package.json +3 -2
  170. package/skills/capturing-session-knowledge/references/retrieval.md +6 -0
  171. package/src/agent-apps/activation.js +3 -3
  172. package/src/agent-apps/app-host.js +2 -0
  173. package/src/agent-apps/app-launcher.js +25 -0
  174. package/src/agent-apps/authorization.js +6 -4
  175. package/src/agent-apps/bounded-wait.js +13 -0
  176. package/src/agent-apps/{verified-decisions.js → confirmed-decisions.js} +100 -55
  177. package/src/agent-apps/decision-source.js +17 -17
  178. package/src/agent-apps/host-identity.js +8 -2
  179. package/src/agent-apps/instances.js +218 -29
  180. package/src/agent-apps/operations.js +4 -3
  181. package/src/agent-apps/run-gate.js +25 -20
  182. package/src/agent-apps/service.js +40 -16
  183. package/src/agent-apps/store.js +28 -14
  184. package/src/agent-apps/trust-terms.js +23 -0
  185. package/src/agent-apps/trusted-runner.js +136 -0
  186. package/src/agent-apps/versions.js +5 -4
  187. package/src/agent-apps/views.js +11 -6
  188. package/src/agent-tools/agent-app-definitions.js +1 -1
  189. package/src/agent-tools/graph-definitions.js +4 -4
  190. package/src/agent-tools/interface-catalog.js +2 -2
  191. package/src/agent-tools/interface-definitions.js +2 -1
  192. package/src/agent-tools/session-fuli-gate.js +55 -26
  193. package/src/agent-tools.js +2 -4
  194. package/src/agents/claude-code/lifecycle-hook.js +29 -12
  195. package/src/agents/codex/lifecycle-hook.js +25 -10
  196. package/src/agents/lifecycle-message.js +18 -0
  197. package/src/agents/turn-receipt.js +15 -8
  198. package/src/app/agent-request-context.js +18 -0
  199. package/src/cli/app-command.js +46 -61
  200. package/src/cli/remote-mcp-command.js +6 -2
  201. package/src/cli/setup-command.js +6 -0
  202. package/src/cli/terminal-io.js +22 -0
  203. package/src/cli/update-command.js +14 -1
  204. package/src/cli/update-installation.js +46 -2
  205. package/src/conversations/entry-budget.js +116 -0
  206. package/src/conversations/preference-evidence.js +6 -2
  207. package/src/conversations/task-context-view.js +13 -8
  208. package/src/data-format/local-stores.js +2 -0
  209. package/src/graphiti/agent-conversations.js +24 -3
  210. package/src/graphiti/assistant-project-candidate.js +5 -2
  211. package/src/graphiti/capture-notice.js +4 -1
  212. package/src/graphiti/entry-hint-claim.js +13 -0
  213. package/src/graphiti/federated-application.js +55 -62
  214. package/src/graphiti/human-review-channel.js +9 -5
  215. package/src/graphiti/jefa-board-match.js +4 -1
  216. package/src/graphiti/knowledge-item-edit.js +7 -4
  217. package/src/graphiti/knowledge-reader.js +46 -0
  218. package/src/graphiti/knowledge-result-budget.js +63 -12
  219. package/src/graphiti/knowledge-tags.js +12 -1
  220. package/src/graphiti/provider-client.js +18 -25
  221. package/src/graphiti/publication-draft-capture.js +28 -0
  222. package/src/graphiti/session-knowledge-migration.js +7 -3
  223. package/src/graphiti/session-layer-decision.js +28 -6
  224. package/src/graphiti/session-records.js +26 -15
  225. package/src/graphiti/shared-project-list.js +36 -0
  226. package/src/graphiti/task-entry-preferences.js +87 -46
  227. package/src/graphiti/turn-receipt-delivery.js +5 -2
  228. package/src/graphiti/writing-taste-profile-workflow.js +13 -7
  229. package/src/http/api-router.js +2 -1
  230. package/src/http/graph-api-router.js +13 -10
  231. package/src/http/knowledge-item-api-router.js +17 -4
  232. package/src/http/knowledge-tags-api-router.js +21 -9
  233. package/src/http/request-policy.js +18 -2
  234. package/src/http/session-records-api-router.js +7 -3
  235. package/src/judgment/review-prompt.js +21 -1
  236. package/src/knowledge-owner-reads/console-port.js +51 -0
  237. package/src/knowledge-tags/console-port.js +3 -2
  238. package/src/mcp/preference-delivery.js +7 -4
  239. package/src/mcp/provider-task-context-registry.js +23 -0
  240. package/src/mcp/tool-result.js +3 -3
  241. package/src/presence/platforms.js +3 -2
  242. package/src/presence/port.js +2 -1
  243. package/src/presence/windows-helper-pin.js +1 -1
  244. package/src/server.js +14 -2
  245. package/src/standing-assignments/port.js +146 -0
  246. package/src/standing-assignments/store.js +151 -0
  247. package/src/standing-assignments/term-match.js +28 -0
  248. package/src/text/name-identity.js +33 -0
  249. package/dist/web/assets/CaptureChangePage-C833Eiqu.css +0 -1
  250. package/dist/web/assets/ConnectionsPage-EFMP-UeV.js +0 -1
  251. package/dist/web/assets/DataFormatPage-DERqhmng.css +0 -1
  252. package/dist/web/assets/KnowledgePage-8ct5iO0F.js +0 -1
  253. package/dist/web/assets/KnowledgeTurnReceiptPage-Yn3jhDyx.js +0 -1
  254. package/dist/web/assets/ModelSettingsPage-5RkvgNYN.js +0 -1
  255. package/dist/web/assets/ModelSettingsPage-BqtWIKEA.css +0 -1
  256. package/dist/web/assets/NotFoundPage-BUUf2-MZ.js +0 -1
  257. package/dist/web/assets/OccupationsPage-B55DftFp.css +0 -1
  258. package/dist/web/assets/PersonalProjectsPage-aU1rApzX.css +0 -1
  259. package/dist/web/assets/RoundtablesPage-BmmsB1mW.css +0 -1
  260. package/dist/web/assets/SessionMigrationPage-CQhrJ1OQ.js +0 -1
  261. package/dist/web/assets/TaskSchedulesPage-CDalUfNj.css +0 -1
  262. package/dist/web/assets/WritingTastePage-BsekLhC3.js +0 -1
  263. package/dist/web/assets/index-BczJo3GN.js +0 -2
  264. package/dist/web/assets/index-C2rHjaT6.css +0 -1
  265. package/dist/web/assets/project-team-api-BZMMPuUd.js +0 -1
  266. package/src/agent-apps/isolation.js +0 -23
@@ -0,0 +1,23 @@
1
+ // The terms an Agent app approval covers in this version (rec#11 D-36.2,
2
+ // D-36.9, D-36.10). There is no system sandbox: an approved app runs in
3
+ // trusted mode, as a process of the user's own OS account. A terminal
4
+ // confirmation binds the exact package to these terms, and the run gate starts
5
+ // only a version confirmed under them. An approval made under other terms (the
6
+ // isolated mode of rec#7 PR①, Windows Hello approvals included) is never
7
+ // carried over: that version is confirmed again. Bump TERMS_VERSION whenever
8
+ // what these sentences promise changes, so every approval is asked again.
9
+ export const TRUST_MODE = 'trusted';
10
+ export const TERMS_VERSION = 1;
11
+
12
+ // The one warning shown before the app name is typed (D-36.2).
13
+ export const TRUST_WARNING = Object.freeze({
14
+ zh: '这个应用会用你的账户权限在本机运行,FULI 不会隔离它。只批准你信任的应用。',
15
+ en: 'This app runs on this computer with your account\'s permissions, and FULI does not isolate it. Approve only apps you trust.'
16
+ });
17
+
18
+ // What typing the app name shows and what it does not (D-36.9).
19
+ export const CONFIRMATION_NOTICE = Object.freeze({
20
+ zh: '输入应用名即完成终端确认流程。这不证明是真人操作,也不能抵御以同一账户运行的其他程序。',
21
+ en: 'Typing the app name completes the terminal confirmation flow. This does not prove a person did it, and it does not '
22
+ + 'protect against other programs running under the same account.'
23
+ });
@@ -0,0 +1,136 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { existsSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+
6
+ import { settledWithin } from './bounded-wait.js';
7
+ import { appConflict } from './errors.js';
8
+ import { createHostIdentity } from './host-identity.js';
9
+ import { TRUST_MODE } from './trust-terms.js';
10
+
11
+ const LAUNCHER = fileURLToPath(new URL('./app-launcher.js', import.meta.url));
12
+ // A stop asks the process to end, then ends it, and waits this long for each.
13
+ const STOP_WAIT_MS = 5000;
14
+ // What a node process needs of the platform; nothing else of FULI's environment
15
+ // (provider tokens, model keys) is handed to an app.
16
+ // Names compare case-insensitively, as Windows does.
17
+ const PLATFORM_ENVIRONMENT = new Set(['PATH', 'SYSTEMROOT', 'WINDIR', 'TEMP', 'TMP', 'HOME', 'USERPROFILE', 'LANG']);
18
+ // How an app process ended: exited (code 0), load_failed (it ended before the
19
+ // launcher reported its entry loaded) or crashed (any other end after that).
20
+ // Nothing the app wrote is read or kept: no output, no error text.
21
+ const EXIT_CATEGORIES = Object.freeze({ exited: 'exited', loadFailed: 'load_failed', crashed: 'crashed' });
22
+ // The launcher's ready signal arrives on this descriptor; after an exit, its
23
+ // last byte is waited for this long at most.
24
+ const READY_FD = 3;
25
+ const READY_FLUSH_MS = 500;
26
+
27
+ // The runner an app instance runs in (rec#7 D-28.2, rec#11 D-36.2). This
28
+ // version has no sandbox: the trusted runner starts the app's service entry
29
+ // as a node process of the user's own OS account, with the user's
30
+ // permissions. FULI does not isolate it: the app can read files, use the
31
+ // network or start processes itself; FULI's fences cover only what it asks of
32
+ // the FULI Host API. A sandboxed runner (AppContainer, bwrap, sandbox-exec,
33
+ // rec#37) implements the same contract:
34
+ // - kind, and selfCheck() → { ok: true } or { ok: false, detail }: the check
35
+ // that must pass before every start (runner_check_failed otherwise);
36
+ // - start({ appId, instanceId, generation, mode, packageDirectory,
37
+ // dataDirectory, manifest, environment, onExit }) → a handle { pid,
38
+ // pidIdentity, exePath, socket } that keeps the runner's own reference to
39
+ // the process; environment holds only FULI_APP_* values; onExit({ code,
40
+ // signal, category }) is called once when the process has ended, for any
41
+ // reason, with one of EXIT_CATEGORIES;
42
+ // - stop(handle): stops the process through that reference and waits for its exit;
43
+ // - stopOrphan(instance): for an instance whose host has exited, answers once
44
+ // its process is confirmed gone, or refuses. A runner never signals a
45
+ // process by PID: the trusted runner stops only processes it holds.
46
+ //
47
+ // A page-only app (no runtime.entry) has no process. A service is started
48
+ // through app-launcher.js, which ends it when its host's pipe closes, so an
49
+ // app does not outlive the FULI process that started it; the child and its
50
+ // pipes do not keep that FULI process alive either.
51
+ // spawnProcess, nodePath, hostIdentity and environment are seams for tests.
52
+ export function createTrustedRunner({
53
+ spawnProcess = spawn, nodePath = process.execPath, hostIdentity = createHostIdentity(), environment = process.env
54
+ } = {}) {
55
+ async function selfCheck() {
56
+ return existsSync(nodePath) && existsSync(LAUNCHER) ? { ok: true } : { ok: false, detail: 'node_missing' };
57
+ }
58
+
59
+ async function start({ manifest, packageDirectory, environment: appEnvironment, onExit = () => {} }) {
60
+ if (!manifest.runtime.entry) return { pid: null, pidIdentity: null, exePath: null, socket: null, child: null };
61
+ const child = spawnProcess(nodePath, [LAUNCHER, join(packageDirectory, manifest.runtime.entry)], {
62
+ cwd: packageDirectory, env: { ...platformEnvironment(environment), ...appEnvironment },
63
+ stdio: ['pipe', 'ignore', 'ignore', 'pipe'], shell: false, windowsHide: true
64
+ });
65
+ const ready = child.stdio[READY_FD];
66
+ let loaded = false;
67
+ ready.once('data', () => { loaded = true; });
68
+ ready.on('error', () => {});
69
+ // An exit may be reported before the ready byte is read; the pipe closes after both.
70
+ const readyClosed = new Promise((resolve) => ready.once('close', resolve));
71
+ child.once('exit', (code, signal) => {
72
+ settledWithin(readyClosed, READY_FLUSH_MS).then(() => onExit({ code, signal, category: exitCategory(code, signal, loaded) }));
73
+ });
74
+ await started(child);
75
+ // A later error (the pipe of an exited app, a failed kill) shows in the stop that follows.
76
+ child.on('error', () => {});
77
+ child.stdin.on('error', () => {});
78
+ for (const each of [child, child.stdin, ready]) each.unref?.();
79
+ return { pid: child.pid, pidIdentity: await hostIdentity.identify(child.pid), exePath: nodePath, socket: null, child };
80
+ }
81
+
82
+ async function stop(handle) {
83
+ const { child } = handle ?? {};
84
+ if (!child || exited(child)) return;
85
+ const exit = exitOf(child);
86
+ child.kill();
87
+ if (!await settledWithin(exit, STOP_WAIT_MS)) {
88
+ child.kill('SIGKILL');
89
+ if (!await settledWithin(exit, STOP_WAIT_MS)) {
90
+ throw appConflict('stop_failed', `The app process ${child.pid} did not end`, { pid: child.pid });
91
+ }
92
+ }
93
+ child.stdin.destroy();
94
+ }
95
+
96
+ // The process of an exited host, which this runner does not hold: it should
97
+ // have ended with its host's pipe; only the OS confirming that ends the
98
+ // instance. It is never signalled from here.
99
+ async function stopOrphan(instance) {
100
+ if (!instance.pid) return { stopped: false, reason: 'not_running' };
101
+ const verdict = await hostIdentity.probe({ pid: instance.pid, identity: instance.pidIdentity });
102
+ if (verdict === 'exited') return { stopped: true, reason: 'exited' };
103
+ throw appConflict('orphan_running', `The app process ${instance.pid}, started by a FULI process that has exited, is still `
104
+ + 'running or cannot be checked. FULI stops only processes it holds: end it yourself, then try again '
105
+ + '(该应用进程由已退出的 FULI 启动,请先自行结束后重试).', { pid: instance.pid });
106
+ }
107
+
108
+ return { kind: TRUST_MODE, selfCheck, start, stop, stopOrphan };
109
+ }
110
+
111
+ function platformEnvironment(environment) {
112
+ return Object.fromEntries(Object.entries(environment)
113
+ .filter(([name, value]) => value !== undefined && PLATFORM_ENVIRONMENT.has(name.toUpperCase())));
114
+ }
115
+
116
+ function exitCategory(code, signal, loaded) {
117
+ if (code === 0 && !signal) return EXIT_CATEGORIES.exited;
118
+ return loaded ? EXIT_CATEGORIES.crashed : EXIT_CATEGORIES.loadFailed;
119
+ }
120
+
121
+ function started(child) {
122
+ return new Promise((resolve, reject) => {
123
+ child.once('spawn', resolve);
124
+ child.once('error', reject);
125
+ });
126
+ }
127
+
128
+ const exited = (child) => child.exitCode !== null || child.signalCode !== null;
129
+
130
+ function exitOf(child) {
131
+ return new Promise((resolve) => {
132
+ if (exited(child)) resolve();
133
+ else child.once('exit', () => resolve());
134
+ });
135
+ }
136
+
@@ -9,8 +9,9 @@ import { commitPackage, discardPackage, parsePackageFiles, stagePackage } from '
9
9
 
10
10
  // Submitting app versions, and the local console's decisions on them. A version
11
11
  // is immutable once stored, and only an approval of its exact digest makes it
12
- // active. These decisions carry no presence check, so the run gate refuses the
13
- // version they activate; `fuli app approve` and `rollback` add one (verified-decisions.js).
12
+ // active. These decisions complete no terminal confirmation, so the run gate
13
+ // refuses the version they activate; `fuli app approve` and `rollback` do
14
+ // (confirmed-decisions.js).
14
15
  // Each decision runs as an app operation (operations.js): an instance this
15
16
  // process hosts is stopped first, and the owner lease is held throughout.
16
17
  export function createAppVersions(context) {
@@ -75,7 +76,7 @@ export function createAppVersions(context) {
75
76
  }));
76
77
  }
77
78
 
78
- // Without a presence check of its own, an activation never keeps the check an
79
+ // Without a confirmation of its own, an activation never keeps the one an
79
80
  // earlier activation of the same version had.
80
81
  async function rollback({ appId, version, actor, confirmIrreversibleMigration = false }) {
81
82
  const source = decisionSource(actor);
@@ -139,6 +140,6 @@ function submitted(appId, version) {
139
140
  return {
140
141
  appId, version: version.version, status: version.state, digest: version.digest,
141
142
  ...(version.state === 'pending'
142
- ? { approval: `Agent tools cannot approve it; approval comes through the CLI or local console: fuli app approve ${appId} ${version.version}` } : {})
143
+ ? { approval: `Agent tools cannot approve it; it runs only after the local user completes the terminal confirmation: fuli app approve ${appId} ${version.version}` } : {})
143
144
  };
144
145
  }
@@ -8,9 +8,9 @@ const HISTORY_LIMIT = 20;
8
8
 
9
9
  // Management views: one compact row per app for the overview, and the full
10
10
  // metadata of one app for preview and review. Neither returns code or data.
11
- // Both show where each approval came in, the presence FULI verified and what
12
- // the run gate answers now, so a management page never presents an approval as
13
- // more than was checked.
11
+ // Both show where each approval came in, the confirmation and trust mode it
12
+ // went through and what the run gate answers now, so a management page never
13
+ // presents an approval as more than was checked.
14
14
  export function createAppViews(context) {
15
15
  const { store } = context;
16
16
  const { runGate } = createRunGate(context);
@@ -58,8 +58,11 @@ export function createAppViews(context) {
58
58
  if (!instance) return null;
59
59
  const { instanceId, generation, mode, state, version, startedAt, sealedAt, stoppedAt, stopReason } = instance;
60
60
  const waiting = state === 'sealing' ? store.lastEvent(appId, 'seal_waiting_for_writes') : null;
61
+ // An app that ended by itself shows how: exit code, signal and a fixed category and message.
62
+ const exit = stopReason === 'app_exited' ? store.lastEvent(appId, 'app_exited') : null;
61
63
  return { instanceId, generation, mode, state, version, startedAt, sealedAt, stoppedAt, stopReason,
62
- ...(waiting ? { waitingFor: { toolName: waiting.detail.toolName, since: waiting.at } } : {}) };
64
+ ...(waiting ? { waitingFor: { toolName: waiting.detail.toolName, since: waiting.at } } : {}),
65
+ ...(exit?.detail.instanceId === instanceId ? { exit: exitView(exit.detail) } : {}) };
63
66
  }
64
67
 
65
68
  function ownerView(appId) {
@@ -75,10 +78,12 @@ export function createAppViews(context) {
75
78
  return { list, read };
76
79
  }
77
80
 
81
+ const exitView = ({ code, signal, category, message }) => ({ code, signal, category, message });
82
+
78
83
  function activeApproval(approval) {
79
84
  if (!approval) return null;
80
- const { approvedBy, entrypoint, presence, verification, challengeId, verifiedAt, approvedAt } = approval;
81
- return { approvedBy, entrypoint, presence, verification, challengeId, verifiedAt, approvedAt };
85
+ const { approvedBy, entrypoint, presence, verification, challengeId, verifiedAt, trustMode, termsVersion, approvedAt } = approval;
86
+ return { approvedBy, entrypoint, presence, verification, challengeId, verifiedAt, trustMode, termsVersion, approvedAt };
82
87
  }
83
88
 
84
89
  function approvalView(approval) {
@@ -9,7 +9,7 @@ const id = { ...stringSchema(), minLength: 1, maxLength: 256 };
9
9
  export const AGENT_APP_TOOL_DEFINITIONS = [
10
10
  {
11
11
  name: 'submit_agent_app_version', title: 'WRITE · Submit an Agent app version',
12
- description: 'Submit one immutable version of an app this Agent built for a real, repeated need. It stays pending; Agent tools cannot approve or remove apps (fuli app does), and no app code runs yet. manifest: {schemaVersion:1, name:a-z0-9-, version:x.y.z, title, description, permissions:["fuli.<tool>"], runtime:{apiVersion:1, entry?:service file, webRoot?:dir with index.html}, resident?:bool, data:{scope:"app", format:N, accepts?:[N], migration?:none|reversible|irreversible} or {scope:"none"}}. files: relative visible paths, at most 128 files and 1 MiB. Same version and files is idempotent; changed files need a new version.',
12
+ description: 'Submit one immutable version of an app this Agent built for a real, repeated need. It stays pending; Agents cannot approve or remove apps (fuli app does); approved apps run unsandboxed. manifest: {schemaVersion:1, name:a-z0-9-, version:x.y.z, title, description, permissions:["fuli.<tool>"], runtime:{apiVersion:1, entry?:service file, webRoot?:dir with index.html}, resident?:bool, data:{scope:"app", format:N, accepts?:[N], migration?:none|reversible|irreversible} or {scope:"none"}}. files: relative visible paths, at most 128 files and 1 MiB. Same version and files is idempotent; changed files need a new version.',
13
13
  inputSchema: objectSchema({
14
14
  personalSpaceId: id,
15
15
  agentId: id,
@@ -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
  },
@@ -106,9 +106,9 @@ const UI_MUTATION_PARITY = Object.freeze([
106
106
  local('PATCH /employee-workspaces/:templateId/:projectId/api/projects/:projectId/sharing', 'Changing public project visibility requires explicit local human approval; the read-only report never grants access to private tasks.'),
107
107
  local('POST /api/data-format/apply', 'Applying a data format migration rewrites real local data; a person confirms the previewed plan in the local console or at a terminal (fuli migrate apply). Agents may run fuli migrate status or preview, which only read.'),
108
108
  local('POST /api/data-format/rollback', 'Undoing a data format migration changes real local data and is confirmed by a person in the local console or with fuli migrate rollback.'),
109
- local('POST /api/agent-apps/:appId/approve', 'Approving Agent-written code for its exact digest, permissions, data scope and resident service has no Agent tool; the local console records it with presence unverified, so the run gate refuses that version; only fuli app approve adds an OS user verification (Windows Hello) bound to the decision challenge.'),
109
+ local('POST /api/agent-apps/:appId/approve', 'Approving Agent-written code for its exact digest, permissions, data scope and resident service has no Agent tool; the local console records it unconfirmed, so the run gate refuses that version; only fuli app approve completes the terminal confirmation flow bound to the decision challenge (typing the app name; it does not prove a person did it), after which the app runs in trusted mode with the user\'s own permissions.'),
110
110
  local('POST /api/agent-apps/:appId/disable', 'Stopping an Agent app is a local user decision.'),
111
- local('POST /api/agent-apps/:appId/rollback', 'Activating an earlier approved app version is a local user decision checked against the app data and current authorization; from the console it is unverified, and only fuli app rollback adds a Windows Hello check.'),
111
+ local('POST /api/agent-apps/:appId/rollback', 'Activating an earlier approved app version is a local user decision checked against the app data and current authorization; from the console it is unconfirmed, and only fuli app rollback completes the terminal confirmation flow.'),
112
112
  local('POST /api/agent-apps/:appId/delete-code', 'Deleting an Agent app\'s code and pages is a local user decision; its data is kept.'),
113
113
  local('POST /api/agent-apps/:appId/data-deletion', 'Only the local user starts deleting an Agent app\'s data, which first offers an export.'),
114
114
  local('POST /api/agent-apps/:appId/delete-data', 'Permanently deleting an Agent app\'s data needs a second explicit confirmation from the local user.'),
@@ -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']),
@@ -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);