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
@@ -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() {
@@ -2,83 +2,86 @@ import { userInfo } from 'node:os';
2
2
  import { resolve } from 'node:path';
3
3
  import { parseArgs } from 'node:util';
4
4
 
5
+ import { createConfirmedDecisions } from '../agent-apps/confirmed-decisions.js';
5
6
  import { agentAppContext, agentAppRoot, agentAppServiceOver } from '../agent-apps/service.js';
6
- import { createVerifiedDecisions } from '../agent-apps/verified-decisions.js';
7
7
  import { listAgentTools } from '../agent-tools.js';
8
8
  import { resolveGraphRuntimeOptions } from '../graphiti/runtime-config.js';
9
9
  import { presencePort } from '../presence/port.js';
10
- import { confirmInTerminal, writeLine } from './terminal-io.js';
10
+ import { confirmInTerminal, interactiveTerminal, typedLineInTerminal, writeLine } from './terminal-io.js';
11
11
 
12
- const USAGE = 'Usage: fl app list [--agent AGENT_ID] | show APP_ID | approve APP_ID VERSION | disable APP_ID | '
13
- + 'rollback APP_ID VERSION | stop APP_ID [--force] | delete APP_ID [--data [--output DIR]] | export APP_ID --output DIR '
12
+ const USAGE = 'Usage: fl app list [--agent AGENT_ID] | show APP_ID | approve APP_ID VERSION [--hello] | disable APP_ID | '
13
+ + 'rollback APP_ID VERSION [--hello] | stop APP_ID [--force] | delete APP_ID [--data [--output DIR]] | export APP_ID --output DIR '
14
14
  + '[--runtime-config FILE]';
15
15
  // Decisions that activate or remove Agent-written code ask at an interactive
16
16
  // terminal. That keeps piped callers from answering for the user, but a process
17
17
  // of this OS account can open a terminal too, so it does not show a person
18
- // decided. Approve and rollback therefore add an OS user verification (D-28.8);
19
- // delete records entrypoint cli with presence unverified.
18
+ // decided. stdout must be a terminal too, so the terms and the warning cannot
19
+ // be redirected away from the person typing. Approve and rollback complete the terminal confirmation flow
20
+ // (confirmed-decisions.js, rec#11 D-36.9); delete records entrypoint cli with
21
+ // presence unverified.
20
22
  const INTERACTIVE_ACTIONS = new Set(['approve', 'rollback', 'delete']);
21
- // What the presence check proves and does not, said before the Hello dialog opens (rec#7 D-28.8).
22
- const PRESENCE_NOTICE = [
23
- 'Presence: the trusted CLI starts an OS user verification (Windows Hello) and binds that one successful result to this '
24
- + 'challenge; Hello returns the user verification result and does not sign the challenge.',
25
- ' 可信 CLI 发起 OS 用户验证(Windows Hello),并把该次成功结果绑定到本次 challenge;Hello 返回用户验证结果,不签署 challenge。',
26
- ' Agent 的 shell 可以发起 `fuli app approve`,但 Hello 对话框需本机当前用户交互;取消/失败/不可用一律记 unverified,不运行。',
27
- ' The dialog is not on the secure desktop and does not stop UI automation by a process of this account '
28
- + '(对话框不在安全桌面,不防同账户进程的 UI 自动化).'
29
- ].join('\n');
30
23
 
31
24
  // Local user management of Agent apps. Normal Agent tools only submit and read;
32
25
  // approval, rollback and removal come through this command or the local console.
33
- // platform and presence are seams for tests; a real run uses this computer's.
26
+ // confirm, typeLine, platform and presence are seams for tests; a real run
27
+ // uses this terminal and, with --hello, this computer's Windows Hello.
34
28
  export async function runAppCommand(args, {
35
- env = process.env, interactive = process.stdin.isTTY === true, confirm = confirmInTerminal, print = writeLine,
36
- platform = process.platform, presence = presencePort({ platform })
29
+ env = process.env, interactive = interactiveTerminal(), confirm = confirmInTerminal, typeLine = typedLineInTerminal,
30
+ print = writeLine, platform = process.platform, presence
37
31
  } = {}) {
38
32
  const { values, positionals: [action, appId, version] } = parseAppArguments(args);
39
33
  if (!Object.hasOwn(ACTIONS, action ?? '') || (action !== 'list' && !appId)) throw new TypeError(USAGE);
40
34
  if (INTERACTIVE_ACTIONS.has(action) && !interactive) {
41
- throw new TypeError(`fl app ${action} asks the local user to confirm, so run it in an interactive terminal`);
35
+ // Both ends: with stdout redirected, the terms and the risk warning would not be seen.
36
+ throw new TypeError(`fl app ${action} asks the local user to confirm, so run it in an interactive terminal `
37
+ + '(stdin and stdout both a terminal, so the warning is shown where the answer is typed)');
42
38
  }
39
+ const hello = values.hello ? presence ?? presencePort({ platform }) : null;
40
+ if (hello && !hello.kind) throw new TypeError('--hello uses Windows Hello, which this platform does not have');
43
41
  const { runtimeConfigPath } = resolveGraphRuntimeOptions(
44
42
  values['runtime-config'] ? ['--runtime-config', values['runtime-config']] : [], env);
45
43
  const context = agentAppContext({
46
- root: agentAppRoot(runtimeConfigPath), toolNames: () => listAgentTools().map(({ name }) => name), platform,
47
- ownerKind: 'cli'
44
+ root: agentAppRoot(runtimeConfigPath), toolNames: () => listAgentTools().map(({ name }) => name), ownerKind: 'cli'
48
45
  });
49
46
  const service = agentAppServiceOver(context);
50
- const decisions = createVerifiedDecisions(context, { presence });
47
+ const decisions = createConfirmedDecisions(context, { confirmation: terminalConfirmation({ print, typeLine }), presence: hello });
51
48
  try {
52
49
  return await ACTIONS[action]({ service, decisions, appId, version, values, confirm, print });
53
50
  } finally {
54
- service.close();
51
+ await service.close();
55
52
  }
56
53
  }
57
54
 
55
+ // Shows what the challenge binds (the app name, its terms, the trusted-mode
56
+ // warning) and reads the app name typed back.
57
+ function terminalConfirmation({ print, typeLine }) {
58
+ return {
59
+ ask: async ({ message, appName }) => {
60
+ print(message);
61
+ return typeLine(`Type the app name ${appName} to confirm, or press Enter to cancel `
62
+ + `(输入应用名 ${appName} 确认,直接回车取消): `);
63
+ }
64
+ };
65
+ }
66
+
58
67
  const ACTIONS = Object.freeze({
59
68
  list: ({ service, values, print }) => printed(print, service.list({ agentId: values.agent ?? null })),
60
69
  show: ({ service, appId, print }) => printed(print, service.read({ appId })),
61
- approve: async ({ service, decisions, appId, version, confirm, print }) => {
62
- const detail = service.read({ appId });
63
- const candidate = requiredVersion(detail, version);
64
- if (!await confirm(approvalPreview(detail, candidate), { defaultYes: false })) return printed(print, { approved: false });
65
- return activateConfirmed({ service, confirm, print }, (confirmations) => decisions.approve({
70
+ approve: ({ service, decisions, appId, version, confirm, print }) => {
71
+ const candidate = requiredVersion(service.read({ appId }), version);
72
+ return activateConfirmed({ service, confirm, print, label: `${appId} ${version}` }, (confirmations) => decisions.approve({
66
73
  appId, version, digest: candidate.digest, approver: localUser(), ...confirmations
67
74
  }));
68
75
  },
69
- rollback: async ({ service, decisions, appId, version, confirm, print }) => {
70
- const detail = service.read({ appId });
71
- const target = requiredVersion(detail, version);
72
- const question = `Activate approved version ${version} of ${appId} (${target.title}, digest ${target.digest})?\n`
73
- + `${PRESENCE_NOTICE}\nContinue to Windows Hello? [y/N] `;
74
- if (!await confirm(question, { defaultYes: false })) return printed(print, { activated: false });
75
- return activateConfirmed({ service, confirm, print }, (confirmations) => decisions.rollback({
76
+ rollback: ({ service, decisions, appId, version, confirm, print }) => {
77
+ requiredVersion(service.read({ appId }), version);
78
+ return activateConfirmed({ service, confirm, print, label: `${appId} ${version}` }, (confirmations) => decisions.rollback({
76
79
  appId, version, actor: localUser(), ...confirmations
77
80
  }));
78
81
  },
79
82
  disable: async ({ service, appId, print }) => printed(print, await service.disable({ appId, actor: localUser() })),
80
83
  // --force against a live FULI process holding the app is refused on every
81
- // platform and nothing is signalled (rec#7 D-28.29, rec#11 D-36).
84
+ // platform and nothing is signalled (rec#7 D-28.29, rec#11 D-36.3).
82
85
  stop: async ({ service, appId, values, print }) => printed(print, await service.stop({ appId, force: values.force === true })),
83
86
  delete: ({ service, appId, values, confirm, print }) => (values.data
84
87
  ? deleteData({ service, appId, values, confirm, print })
@@ -89,10 +92,10 @@ const ACTIONS = Object.freeze({
89
92
  }
90
93
  });
91
94
 
92
- // The package approval comes first; a resident service and an irreversible data
93
- // migration each need their own answer, all before the one presence check that
94
- // covers them. The result says what the run gate answers now.
95
- async function activateConfirmed({ service, confirm, print }, activate) {
95
+ // A resident service and an irreversible data migration each need their own
96
+ // answer, all before the one terminal confirmation that covers them. The
97
+ // result says what the run gate answers now.
98
+ async function activateConfirmed({ service, confirm, print, label }, activate) {
96
99
  const confirmations = {};
97
100
  for (;;) {
98
101
  try {
@@ -101,7 +104,7 @@ async function activateConfirmed({ service, confirm, print }, activate) {
101
104
  } catch (error) {
102
105
  const followUp = FOLLOW_UPS[error?.code];
103
106
  if (!followUp || confirmations[followUp.field]) throw error;
104
- if (!await confirm(`${error.message}. ${followUp.question} [y/N] `, { defaultYes: false })) {
107
+ if (!await confirm(`${label}: ${error.message}. ${followUp.question} [y/N] `, { defaultYes: false })) {
105
108
  return printed(print, { activated: false });
106
109
  }
107
110
  confirmations[followUp.field] = true;
@@ -136,24 +139,6 @@ async function deleteData({ service, appId, values, confirm, print }) {
136
139
  return printed(print, await service.deleteData({ appId, ticket: offer.ticket, confirm: offer.confirm, actor: localUser() }));
137
140
  }
138
141
 
139
- function approvalPreview(detail, version) {
140
- const data = version.data.scope === 'app'
141
- ? `own data directory, format ${version.data.format} (opens ${version.data.accepts.join(', ')})` : 'none';
142
- return [
143
- `Approve Agent app ${detail.appId}: ${detail.name} by Agent ${detail.agentId}`,
144
- ` version ${version.version} — ${version.title}`,
145
- ` type ${version.type}`,
146
- ` digest ${version.digest}`,
147
- ` permissions ${version.permissions.join(', ') || 'none'}`,
148
- ` data ${data}`,
149
- ` resident ${version.resident ? 'yes, keeps running in the background' : 'no'}`,
150
- ` files ${version.files} (${version.bytes} bytes)`,
151
- 'The approval covers only this exact package. FULI has no isolation backend yet, so no app code runs now.',
152
- PRESENCE_NOTICE,
153
- 'Approve it and continue to Windows Hello? [y/N] '
154
- ].join('\n');
155
- }
156
-
157
142
  function requiredVersion(detail, version) {
158
143
  const found = detail.versions.find((entry) => entry.version === version);
159
144
  if (!found) throw new TypeError(`${detail.appId} has no version ${version ?? ''}`.trim());
@@ -176,8 +161,8 @@ function printed(print, result) {
176
161
  function parseAppArguments(args) {
177
162
  try {
178
163
  return parseArgs({ args, allowPositionals: true, strict: true, options: {
179
- agent: { type: 'string' }, data: { type: 'boolean' }, force: { type: 'boolean' }, output: { type: 'string' },
180
- 'runtime-config': { type: 'string' }
164
+ agent: { type: 'string' }, data: { type: 'boolean' }, force: { type: 'boolean' }, hello: { type: 'boolean' },
165
+ output: { type: 'string' }, 'runtime-config': { type: 'string' }
181
166
  } });
182
167
  } catch (error) {
183
168
  throw new TypeError(`${error.message}\n${USAGE}`);
@@ -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
 
@@ -1,3 +1,4 @@
1
+ import { createInterface as createLineInterface } from 'node:readline';
1
2
  import { createInterface } from 'node:readline/promises';
2
3
 
3
4
  export function writeLine(value) {
@@ -58,6 +59,27 @@ export async function questionInTerminal(question) {
58
59
  }
59
60
  }
60
61
 
62
+ // Asks for one line to be typed back; null when the user cancels (Ctrl-C) or
63
+ // the input ends, so a closed terminal never reads as an answer.
64
+ export function typedLineInTerminal(prompt, { input = process.stdin, output = process.stdout } = {}) {
65
+ const terminal = createLineInterface({ input, output });
66
+ return new Promise((resolve) => {
67
+ let answered = false;
68
+ const finish = (line) => {
69
+ if (answered) return;
70
+ answered = true;
71
+ terminal.close();
72
+ resolve(line);
73
+ };
74
+ terminal.on('SIGINT', () => {
75
+ output.write('\n');
76
+ finish(null);
77
+ });
78
+ terminal.on('close', () => finish(null));
79
+ terminal.question(prompt, finish);
80
+ });
81
+ }
82
+
61
83
  // Whether this is an interactive terminal (both ends a TTY). A pipe, a script
62
84
  // or an Agent's shell is not; a TTY does not prove a person is there.
63
85
  export function interactiveTerminal() {
@@ -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) {