fuli-context 0.20.1 → 0.21.0-beta.2

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 (262) hide show
  1. package/dist/web/assets/{AboutPage-CjDenGS_.js → AboutPage-D0dTwKq8.js} +1 -1
  2. package/dist/web/assets/{AgentName-DdlJlpT3.js → AgentName-n4oqQUwE.js} +1 -1
  3. package/dist/web/assets/{AgentProfilePage-Cx_Uf5Vf.js → AgentProfilePage-DH54S93r.js} +1 -1
  4. package/dist/web/assets/{AgentsDirectoryPage-DylT-GSW.js → AgentsDirectoryPage-xwIRrNb8.js} +1 -1
  5. package/dist/web/assets/{BackLink-D7oAvDG5.js → BackLink-nM3e40IT.js} +1 -1
  6. package/dist/web/assets/{BoardMoveMenu-B0pA7LLx.js → BoardMoveMenu-Cxgkbwkl.js} +1 -1
  7. package/dist/web/assets/{CaptureChangePage-DEuqPb14.js → CaptureChangePage-DWdz9dEk.js} +1 -1
  8. package/dist/web/assets/{Card-BZFLZ_2I.js → Card-89NKHANE.js} +1 -1
  9. package/dist/web/assets/{CardHeader-C_c0keQn.js → CardHeader-9MwjWRxl.js} +1 -1
  10. package/dist/web/assets/{CardTitle-yXOhV577.js → CardTitle-BAhmXjAK.js} +1 -1
  11. package/dist/web/assets/{ConnectionsPage-DlnHdtwn.js → ConnectionsPage-Yf4UvjDT.js} +1 -1
  12. package/dist/web/assets/{CreateProjectDialog-BVJqWdlT.js → CreateProjectDialog-crpLTyDf.js} +1 -1
  13. package/dist/web/assets/{DataFormatPage-BdcjcyhZ.js → DataFormatPage-BPuUH0PG.js} +1 -1
  14. package/dist/web/assets/{DialogFooter-DYawfDCD.js → DialogFooter-D9A9hRP4.js} +1 -1
  15. package/dist/web/assets/{EmployeeRecruitDialog-CB4ARFkM.js → EmployeeRecruitDialog-DeB0XHeM.js} +1 -1
  16. package/dist/web/assets/EmployeeWorkbenchPage-0oK2RfIh.js +3 -0
  17. package/dist/web/assets/{EmployeeWorkbenchPage-BenZP7De.css → EmployeeWorkbenchPage-CMutwFBC.css} +1 -1
  18. package/dist/web/assets/{GrowthLoading-smW3-Gfp.js → GrowthLoading-Cs9brXcN.js} +1 -1
  19. package/dist/web/assets/{InboxPage-Crn1UU7s.js → InboxPage-CTQ425Ez.js} +1 -1
  20. package/dist/web/assets/{Input-F1oftPWh.js → Input-DGf4juEs.js} +1 -1
  21. package/dist/web/assets/{KnowledgeEditDialog-VdQwbX4E.js → KnowledgeEditDialog-Ccgj30Wu.js} +1 -1
  22. package/dist/web/assets/{KnowledgeHardDeleteSection-CXRmNnZF.js → KnowledgeHardDeleteSection-CSnqisUv.js} +1 -1
  23. package/dist/web/assets/{KnowledgeItemEditPage-CQo3TbCJ.js → KnowledgeItemEditPage-C0Y2DsHz.js} +1 -1
  24. package/dist/web/assets/{KnowledgeItemSummaryCard-Dd2McM-d.js → KnowledgeItemSummaryCard-BRvaf4Fw.js} +1 -1
  25. package/dist/web/assets/{KnowledgeOrganizerPage-BVgAyu6U.js → KnowledgeOrganizerPage-CRC3mk0j.js} +1 -1
  26. package/dist/web/assets/KnowledgePage-NsKFUWth.js +1 -0
  27. package/dist/web/assets/{KnowledgePeek-BNBkh1ey.js → KnowledgePeek-Bc0bqyZp.js} +1 -1
  28. package/dist/web/assets/{KnowledgeTurnReceiptPage-Ckw_olrt.js → KnowledgeTurnReceiptPage-Dl0KeFDe.js} +1 -1
  29. package/dist/web/assets/{KnowledgeWorkspace-pH2tAFld.js → KnowledgeWorkspace-BGlODG7G.js} +1 -1
  30. package/dist/web/assets/{Label-yDCtlpkb.js → Label-CafdTnDF.js} +1 -1
  31. package/dist/web/assets/ModelSettingsPage-Bz1tMXtW.js +1 -0
  32. package/dist/web/assets/ModelSettingsPage-DJuEaw6p.css +1 -0
  33. package/dist/web/assets/{NotFoundPage-8gVVukRR.js → NotFoundPage-TfZ2eoA2.js} +1 -1
  34. package/dist/web/assets/{OccupationsPage-PNoqE21Y.js → OccupationsPage-CnSp6362.js} +1 -1
  35. package/dist/web/assets/{OverviewPage-DiwYSnhh.js → OverviewPage-D5W-DhOz.js} +2 -2
  36. package/dist/web/assets/{PersonalProfilePage-C_v2BFee.js → PersonalProfilePage-CndOcRQ6.js} +1 -1
  37. package/dist/web/assets/{PersonalProjectsPage-DGRV8cM5.js → PersonalProjectsPage-CXBOwEqC.js} +1 -1
  38. package/dist/web/assets/{PopperContent-5zqbtnYr.js → PopperContent-BXbztFFi.js} +1 -1
  39. package/dist/web/assets/{Presence-BYfYJNMD.js → Presence-BLar6FCs.js} +1 -1
  40. package/dist/web/assets/{ProjectAgentDetailPage-BQ9ffaCX.js → ProjectAgentDetailPage-SmZ2NYTw.js} +1 -1
  41. package/dist/web/assets/{ProjectAgentDialog-BGckQDTq.js → ProjectAgentDialog-Bg0V3Zr2.js} +1 -1
  42. package/dist/web/assets/{ProjectAgentFirstTask-DrSd3nR-.js → ProjectAgentFirstTask-CbOWaP7Q.js} +1 -1
  43. package/dist/web/assets/{ProjectAgentsPage-U4Om3EPu.js → ProjectAgentsPage-Y6qCYRZj.js} +1 -1
  44. package/dist/web/assets/{ProjectScopePicker-D0oxbwOd.js → ProjectScopePicker-ClDUoUHW.js} +1 -1
  45. package/dist/web/assets/{PublicProjectsPage-CvkQ3E8I.js → PublicProjectsPage-C63vW9UZ.js} +1 -1
  46. package/dist/web/assets/{RadioGroupItem-CBpbQlHx.js → RadioGroupItem-tL_2upmD.js} +1 -1
  47. package/dist/web/assets/{RoundtablesPage-BEUaKOjI.js → RoundtablesPage-2Akxagrm.js} +1 -1
  48. package/dist/web/assets/{RovingFocusGroup-X9U-ufYr.js → RovingFocusGroup-D5mf9s6I.js} +1 -1
  49. package/dist/web/assets/{RovingFocusItem-_uA_OCLT.js → RovingFocusItem-DAumq9xD.js} +1 -1
  50. package/dist/web/assets/{SessionMigrationPage-WVFSDcUO.js → SessionMigrationPage-B5r2PWCF.js} +1 -1
  51. package/dist/web/assets/{SessionRecordsPage-Bs2eLXEi.js → SessionRecordsPage-DIc2GoCQ.js} +1 -1
  52. package/dist/web/assets/{SettingsPage-DlIwICIz.js → SettingsPage-BAxKpnBx.js} +1 -1
  53. package/dist/web/assets/{SharedJefaReportPage-B_rreEep.js → SharedJefaReportPage-B54qEdIV.js} +1 -1
  54. package/dist/web/assets/{TabsContent-8pXwYJPz.js → TabsContent-DZQE2Iq8.js} +1 -1
  55. package/dist/web/assets/{TabsTrigger-Cd6SI2yI.js → TabsTrigger-CHnq6mkI.js} +1 -1
  56. package/dist/web/assets/{TagVocabularyPage-BQiuKG-4.js → TagVocabularyPage-BIsHYk2i.js} +1 -1
  57. package/dist/web/assets/{TaskExecutionPlan-CupxJeyo.js → TaskExecutionPlan-IYG_JeuT.js} +1 -1
  58. package/dist/web/assets/{TaskSchedulesPage-zYQs7s6T.js → TaskSchedulesPage-Cxjqc8XQ.js} +1 -1
  59. package/dist/web/assets/{Teleport-BZX1Eb7R.js → Teleport-BKN3dSMk.js} +1 -1
  60. package/dist/web/assets/{TextField-CielK4l3.js → TextField-DoKtn--E.js} +1 -1
  61. package/dist/web/assets/{UiDialog-BSDblUpR.js → UiDialog-7pnZ-eQA.js} +1 -1
  62. package/dist/web/assets/{UiDisclosure-DLmVwmy1.js → UiDisclosure-COV4NwHI.js} +1 -1
  63. package/dist/web/assets/{UiIcon-B8eZeuGI.js → UiIcon-BADOYtHM.js} +1 -1
  64. package/dist/web/assets/{UiIconButton-e754Tmnq.js → UiIconButton-CkBP6pnX.js} +1 -1
  65. package/dist/web/assets/{UiSegmented-D1HD-qin.js → UiSegmented-FwOnE2IZ.js} +1 -1
  66. package/dist/web/assets/{UiSelect-CbkTsi2e.js → UiSelect-BIhr03Gk.js} +1 -1
  67. package/dist/web/assets/{UiToggle-Dz93aXFK.js → UiToggle-bpyawyIe.js} +1 -1
  68. package/dist/web/assets/{UiWeight-CUvyApSB.js → UiWeight-TyBehy3K.js} +1 -1
  69. package/dist/web/assets/{UnassignedConversationsPanel-xY7gsFot.js → UnassignedConversationsPanel-B4PqImRi.js} +1 -1
  70. package/dist/web/assets/{VirtualDirectoryList-Dv6PwLjU.js → VirtualDirectoryList-DNQP6X8j.js} +1 -1
  71. package/dist/web/assets/{Workbench3D--4N_uKzp.js → Workbench3D-DNwgymIE.js} +1 -1
  72. package/dist/web/assets/{WritingTastePage-B7KojA4r.js → WritingTastePage-D-ELo7mh.js} +1 -1
  73. package/dist/web/assets/{_plugin-vue_export-helper-BmfQlfI8.js → _plugin-vue_export-helper-RegzAV-H.js} +1 -1
  74. package/dist/web/assets/{accordion-gXElbGP_.js → accordion-DpqAdXTB.js} +1 -1
  75. package/dist/web/assets/{agent-occupation-ChN-1QjC.js → agent-occupation-Ba5Fl0ys.js} +1 -1
  76. package/dist/web/assets/{agent-pins-Chh_rdBi.js → agent-pins-Bb7-1Uoz.js} +1 -1
  77. package/dist/web/assets/{agent-profile.css_vue_type_style_index_0_src_true_lang-DWlz7UoN.js → agent-profile.css_vue_type_style_index_0_src_true_lang-wT8gjVyZ.js} +1 -1
  78. package/dist/web/assets/{agent-work-summary-C9yMf019.js → agent-work-summary-D0a836ik.js} +1 -1
  79. package/dist/web/assets/{attention-store-CG9cF6DX.js → attention-store-g2-_vAhV.js} +1 -1
  80. package/dist/web/assets/{badge-DvvDq2Wb.js → badge-BIoC0hjn.js} +1 -1
  81. package/dist/web/assets/{button-CFEnxtio.js → button-A2esxd6G.js} +1 -1
  82. package/dist/web/assets/{checkbox-DovdRz8u.js → checkbox-DxBVlC6t.js} +1 -1
  83. package/dist/web/assets/{client-lh80ewvs.js → client-DAoXcTUz.js} +1 -1
  84. package/dist/web/assets/{console-CQMgYkk9.js → console-DiNe1hFP.js} +1 -1
  85. package/dist/web/assets/{conversation-launcher-settings-B1QM-wZB.js → conversation-launcher-settings-CtOlr9uP.js} +1 -1
  86. package/dist/web/assets/{design-lab-BDKwIbI8.js → design-lab-UWXx2ZtA.js} +1 -1
  87. package/dist/web/assets/{dialog-D2mO6m3B.js → dialog-DTVE8tN1.js} +1 -1
  88. package/dist/web/assets/{dist-PmK0PfVA.js → dist-D-8b3yGa.js} +1 -1
  89. package/dist/web/assets/{dropdown-menu-YzCnvjAb.js → dropdown-menu-NcUrhhmG.js} +1 -1
  90. package/dist/web/assets/{field-BMEFEyVC.js → field-6mg5DSC8.js} +1 -1
  91. package/dist/web/assets/{identity-bK-fJdnj.js → identity-FG3YqHVj.js} +1 -1
  92. package/dist/web/assets/index-BpQe3IT5.js +2 -0
  93. package/dist/web/assets/{judgment-types-DJnAr9c0.js → judgment-types-rLsl2Cis.js} +1 -1
  94. package/dist/web/assets/{model-Cengn9fg.js → model-BCnsjEuP.js} +1 -1
  95. package/dist/web/assets/{model-rumuELTi.js → model-BcMr6R8m.js} +1 -1
  96. package/dist/web/assets/{model-DpVrfbnj.js → model-CYJ_LZ47.js} +1 -1
  97. package/dist/web/assets/{model-BwNZZZNP.js → model-CeF2BATq.js} +1 -1
  98. package/dist/web/assets/{model-CuY1vtEy.js → model-CtmCtjml.js} +1 -1
  99. package/dist/web/assets/{model-CPMYnu3S.js → model-t2ZvD7wL.js} +1 -1
  100. package/dist/web/assets/{motion-preference-A1AMssSH.js → motion-preference-DeZURhN7.js} +1 -1
  101. package/dist/web/assets/{occupation-catalog-DxwlYD1L.js → occupation-catalog-q0ZjGx2o.js} +1 -1
  102. package/dist/web/assets/{orchestration-filters-DZpJ0FN3.js → orchestration-filters-CKf_Gzdl.js} +1 -1
  103. package/dist/web/assets/{page-title-Bg-mVyrS.js → page-title-BLHrexaP.js} +1 -1
  104. package/dist/web/assets/{personal-profile-graph-tMneNj_m.js → personal-profile-graph-IYovB9sV.js} +1 -1
  105. package/dist/web/assets/{project-capture-QgMw6qvo.js → project-capture-BvIPecIS.js} +1 -1
  106. package/dist/web/assets/{project-origin-ppsYHpYL.js → project-origin-JnGPwlfA.js} +1 -1
  107. package/dist/web/assets/project-team-api-Cfn41MCR.js +1 -0
  108. package/dist/web/assets/{quick-edit-api-BiyK3ih-.js → quick-edit-api-DzpRAPsr.js} +1 -1
  109. package/dist/web/assets/{shared-report-D3Hem1t5.js → shared-report-BLmBg2FG.js} +3 -3
  110. package/dist/web/assets/{task-labels-7KyNw9id.js → task-labels-BArOYZEW.js} +1 -1
  111. package/dist/web/assets/{ui-Ck58paqr.js → ui-CtW0tAA1.js} +1 -1
  112. package/dist/web/assets/{useAgentRecords-C6RrZwwv.js → useAgentRecords-BoOqLQcf.js} +1 -1
  113. package/dist/web/assets/{useApi-CROJJdhE-BujjnKN_.js → useApi-CROJJdhE-CH5wlWTU.js} +1 -1
  114. package/dist/web/assets/{useFocusReturn-D9IOIg17.js → useFocusReturn-DX2zmPSK.js} +1 -1
  115. package/dist/web/assets/{useKnowledgeItemPeek-C6nAzvDL.js → useKnowledgeItemPeek-Cfvr5H1q.js} +1 -1
  116. package/dist/web/assets/{useMinimumLoadingDisplay-HnxkDut6.js → useMinimumLoadingDisplay-GhG1ICNJ.js} +1 -1
  117. package/dist/web/assets/{useRoutePeek-BvYFc1BA.js → useRoutePeek-DydCbUhy.js} +1 -1
  118. package/dist/web/assets/{vue-router-Bl55c88B.js → vue-router-Dad-4p7O.js} +1 -1
  119. package/dist/web/index.html +32 -32
  120. package/docs/agent-conversations-and-collaboration.md +10 -0
  121. package/docs/employee-agents.md +3 -1
  122. package/docs/judgment-and-autonomy.md +30 -1
  123. package/graph-provider/fuli_graph/agent_conversation_models.py +7 -0
  124. package/graph-provider/fuli_graph/agent_conversation_routes.py +5 -1
  125. package/graph-provider/fuli_graph/default_project_lead.py +7 -3
  126. package/graph-provider/fuli_graph/store_agent_conversations.py +66 -34
  127. package/graph-provider/pyproject.toml +1 -1
  128. package/native/win32/fuli-win-helper.exe +0 -0
  129. package/npm-shrinkwrap.json +2 -2
  130. package/package.json +1 -1
  131. package/packages/roundtable/src/host.js +5 -0
  132. package/packages/roundtable/src/peer/coordinator-service.js +20 -3
  133. package/packages/roundtable/src/roundtable/service.js +31 -5
  134. package/skills/capturing-session-knowledge/references/retrieval.md +10 -2
  135. package/skills/operating-fuli/references/workflow-recipes.md +2 -0
  136. package/src/agent-apps/host-tools/catalog.js +1 -0
  137. package/src/agent-tools/executor-routing-definitions.js +194 -0
  138. package/src/agent-tools/graph-definitions.js +20 -1279
  139. package/src/agent-tools/graph-handlers.js +6 -2
  140. package/src/agent-tools/graph-tool-fields.js +43 -0
  141. package/src/agent-tools/interface-catalog.js +5 -1
  142. package/src/agent-tools/knowledge-curation-definitions.js +167 -0
  143. package/src/agent-tools/knowledge-definitions.js +431 -0
  144. package/src/agent-tools/project-agent-tool-definitions.js +271 -0
  145. package/src/agent-tools/project-space-definitions.js +155 -0
  146. package/src/agent-tools/session-fuli-gate.js +33 -31
  147. package/src/agent-tools/standing-assignment-definitions.js +32 -0
  148. package/src/agent-tools/task-entry-definitions.js +105 -0
  149. package/src/agent-tools.js +5 -4
  150. package/src/agents/claude-code/lifecycle-hook.js +16 -2
  151. package/src/agents/claude-code/preference-evidence.js +11 -1
  152. package/src/app/application-error.js +21 -3
  153. package/src/conversations/capture-window.js +8 -3
  154. package/src/conversations/entry-budget.js +2 -10
  155. package/src/conversations/entry-inline-budget.js +144 -0
  156. package/src/conversations/entry-rules.js +1 -1
  157. package/src/conversations/entry-time.js +15 -0
  158. package/src/conversations/preference-evidence.js +19 -0
  159. package/src/conversations/preference-lifecycle.js +28 -7
  160. package/src/conversations/preference-session.js +26 -10
  161. package/src/conversations/preference-snapshot.js +12 -1
  162. package/src/conversations/sync-transcript.js +10 -6
  163. package/src/conversations/transcript-guard.js +4 -3
  164. package/src/conversations/transcript-lifecycle.js +6 -3
  165. package/src/data-format/local-stores.js +3 -0
  166. package/src/desktop/windows-installation.js +2 -1
  167. package/src/external-knowledge/connectors/feishu.js +3 -1
  168. package/src/graphiti/active-personal-space.js +5 -0
  169. package/src/graphiti/agent-conversations.js +23 -28
  170. package/src/graphiti/agent-knowledge-workflows.js +12 -1299
  171. package/src/graphiti/agent-project-resolution.js +11 -0
  172. package/src/graphiti/agent-view-records.js +19 -0
  173. package/src/graphiti/capture-notice.js +20 -6
  174. package/src/graphiti/collaboration-preference-entry.js +89 -0
  175. package/src/graphiti/collaboration-preference-workflow.js +1 -1
  176. package/src/graphiti/common-knowledge-candidates.js +222 -0
  177. package/src/graphiti/cross-project-knowledge-similarity.js +59 -0
  178. package/src/graphiti/current-project-knowledge-search.js +86 -0
  179. package/src/graphiti/decision-trace.js +136 -0
  180. package/src/graphiti/federated-application.js +158 -795
  181. package/src/graphiti/human-knowledge-changes.js +45 -0
  182. package/src/graphiti/knowledge-credential-guard.js +43 -0
  183. package/src/graphiti/knowledge-curation.js +178 -0
  184. package/src/graphiti/knowledge-feedback.js +25 -0
  185. package/src/graphiti/knowledge-graph-reads.js +62 -0
  186. package/src/graphiti/local-runtimes.js +78 -0
  187. package/src/graphiti/personal-global-preference-candidates.js +431 -0
  188. package/src/graphiti/personal-projects.js +33 -0
  189. package/src/graphiti/preference-conflict-requests.js +57 -0
  190. package/src/graphiti/preference-project-resolution.js +39 -0
  191. package/src/graphiti/preference-task-scope.js +18 -0
  192. package/src/graphiti/project-agent-control-plane.js +6 -1
  193. package/src/graphiti/project-agent-task-entry.js +18 -1
  194. package/src/graphiti/project-path-context.js +28 -9
  195. package/src/graphiti/provider-client.js +1 -1
  196. package/src/graphiti/public-project-relations.js +28 -0
  197. package/src/graphiti/public-projects.js +125 -0
  198. package/src/graphiti/publication-review-queues.js +50 -0
  199. package/src/graphiti/roundtable-host.js +35 -3
  200. package/src/graphiti/session-capture-pause-request.js +3 -2
  201. package/src/graphiti/session-fuli-switch.js +4 -3
  202. package/src/graphiti/session-knowledge-capture.js +59 -0
  203. package/src/graphiti/session-records.js +4 -3
  204. package/src/graphiti/source-marker.js +13 -3
  205. package/src/graphiti/standing-assignment-confirmation.js +66 -0
  206. package/src/graphiti/standing-assignment-correction.js +148 -0
  207. package/src/graphiti/standing-assignment-entry.js +223 -0
  208. package/src/graphiti/task-context-entry.js +114 -0
  209. package/src/graphiti/task-entry-preferences.js +4 -1
  210. package/src/graphiti/task-entry-project-mention.js +13 -2
  211. package/src/graphiti/task-entry-project-scope.js +12 -3
  212. package/src/graphiti/task-entry-standing-owner.js +141 -0
  213. package/src/graphiti/task-knowledge-checkpoint.js +212 -0
  214. package/src/graphiti/task-knowledge-guidance.js +13 -0
  215. package/src/graphiti/task-knowledge-recall.js +113 -2
  216. package/src/graphiti/task-preference-reader.js +1 -1
  217. package/src/graphiti/workflow-learning.js +38 -0
  218. package/src/graphiti/workspace-provider-client.js +10 -0
  219. package/src/http/api-router.js +13 -3
  220. package/src/http/standing-assignment-api-router.js +35 -0
  221. package/src/judgment/agent-view.js +29 -7
  222. package/src/judgment/conversation.js +8 -2
  223. package/src/judgment/engine.js +16 -4
  224. package/src/judgment/http.js +37 -5
  225. package/src/judgment/review-injection-precheck.js +97 -0
  226. package/src/judgment/review-suggestions.js +46 -0
  227. package/src/judgment/store.js +8 -0
  228. package/src/knowledge-hard-delete/delete-ledger.js +12 -3
  229. package/src/knowledge-hard-delete/recovery-gate.js +4 -4
  230. package/src/knowledge-owner-reads/console-port.js +8 -0
  231. package/src/knowledge-owner-reads/owner-proof.js +35 -0
  232. package/src/local-runtime/lifecycle.js +2 -1
  233. package/src/local-runtime/provider-readiness.js +35 -11
  234. package/src/mcp/instructions.js +3 -3
  235. package/src/mcp/preference-delivery.js +13 -3
  236. package/src/mcp/session-id.js +2 -0
  237. package/src/mcp/tool-annotations.js +3 -2
  238. package/src/model-backends/http.js +45 -8
  239. package/src/model-backends/role-settings.js +25 -3
  240. package/src/model-backends/role-trust.js +39 -6
  241. package/src/model-backends/runtime.js +10 -3
  242. package/src/model-backends/settings-history-list.js +132 -0
  243. package/src/model-backends/settings-history.js +175 -0
  244. package/src/native-runtime/java-runtime.js +4 -4
  245. package/src/presence/windows-helper-pin.js +1 -1
  246. package/src/semantic-version.js +5 -1
  247. package/src/server.js +3 -2
  248. package/src/setup/claude-code-config.js +1 -1
  249. package/src/setup/graph-runtime.js +42 -15
  250. package/src/setup/paths.js +2 -0
  251. package/src/standing-assignments/port.js +189 -44
  252. package/src/standing-assignments/store.js +12 -1
  253. package/src/standing-assignments/term-match.js +7 -0
  254. package/src/system/file-identity.js +11 -0
  255. package/src/system/platform-path.js +38 -0
  256. package/src/validation/values.js +22 -6
  257. package/dist/web/assets/EmployeeWorkbenchPage-BUMfMBc8.js +0 -3
  258. package/dist/web/assets/KnowledgePage-Bfbfz_Z8.js +0 -1
  259. package/dist/web/assets/ModelSettingsPage-C3eBDWRL.js +0 -1
  260. package/dist/web/assets/ModelSettingsPage-DZkrJw7R.css +0 -1
  261. package/dist/web/assets/index-r-WFOs21.js +0 -2
  262. package/dist/web/assets/project-team-api-DwP0O3rn.js +0 -1
@@ -5,6 +5,16 @@ import {
5
5
  statSync
6
6
  } from 'node:fs';
7
7
  import path from 'node:path';
8
+ import { ApplicationError, InvalidInputError } from '../app/application-error.js';
9
+ import { hostPathOfCallerPath } from '../system/platform-path.js';
10
+
11
+ // Says what to pass, never the path the caller sent.
12
+ const INVALID_PATH_MESSAGE = 'projectPath must be an existing absolute directory. '
13
+ + 'Pass the absolute path of the current working directory.';
14
+
15
+ const UNSUPPORTED_PATH_MESSAGE = 'projectPath is a WSL or POSIX path this Windows FULI cannot open. '
16
+ + 'Pass the Windows path of the current working directory, such as C:\\Users\\name\\project; '
17
+ + '/mnt/<drive>/ paths are translated.';
8
18
 
9
19
  const CHILD_PROJECT_MARKERS = Object.freeze([
10
20
  '.git',
@@ -24,17 +34,17 @@ export function resolvePersonalProjectPath(projectPath, projects, {
24
34
  if (projectPath === undefined || projectPath === null) {
25
35
  return unresolved('not_provided');
26
36
  }
27
- if (
28
- typeof projectPath !== 'string'
29
- || !projectPath.trim()
30
- || !pathApi.isAbsolute(projectPath)
31
- ) {
32
- throw new TypeError('projectPath must be an existing absolute directory');
37
+ if (typeof projectPath !== 'string' || !projectPath.trim()) {
38
+ throw new InvalidInputError(INVALID_PATH_MESSAGE);
39
+ }
40
+ const hostPath = hostProjectPath(projectPath, pathApi);
41
+ if (!pathApi.isAbsolute(hostPath)) {
42
+ throw new InvalidInputError(INVALID_PATH_MESSAGE);
33
43
  }
34
44
 
35
- const currentPath = realPath(pathApi.resolve(projectPath));
45
+ const currentPath = realPath(pathApi.resolve(hostPath));
36
46
  if (!fileExists(currentPath) || !isDirectory(currentPath)) {
37
- throw new TypeError('projectPath must be an existing absolute directory');
47
+ throw new InvalidInputError(INVALID_PATH_MESSAGE);
38
48
  }
39
49
 
40
50
  const projectIds = new Set(
@@ -96,7 +106,7 @@ export function findRepositoryRoot(projectPath, {
96
106
  fileExists = existsSync,
97
107
  pathApi = path
98
108
  } = {}) {
99
- let current = pathApi.resolve(projectPath);
109
+ let current = pathApi.resolve(hostProjectPath(projectPath, pathApi));
100
110
  const filesystemRoot = pathApi.parse(current).root;
101
111
  while (true) {
102
112
  if (fileExists(pathApi.join(current, '.git'))) return current;
@@ -107,6 +117,15 @@ export function findRepositoryRoot(projectPath, {
107
117
  }
108
118
  }
109
119
 
120
+ // The caller's directory as this host opens it (rec#48), before any existence
121
+ // check or project match, so a translated WSL path is checked exactly like the
122
+ // native path it names. A path this host cannot open says what to pass instead.
123
+ function hostProjectPath(projectPath, pathApi) {
124
+ const hostPath = hostPathOfCallerPath(projectPath, pathApi);
125
+ if (hostPath === null) throw new ApplicationError('project_path_unsupported', UNSUPPORTED_PATH_MESSAGE);
126
+ return hostPath;
127
+ }
128
+
110
129
  function worktreeOriginProjectId(gitMarkerPath, {
111
130
  readText,
112
131
  pathApi
@@ -82,7 +82,7 @@ export class GraphitiProviderClient {
82
82
  return this.#request(`/v1/agent-loans/${operation}`, { method: 'POST', body: input });
83
83
  }
84
84
  conversation(operation, input, { signal, timeoutMs = this.requestTimeoutMs } = {}) {
85
- if (!['query', 'append', 'resume', 'policy', 'boundary'].includes(operation)) throw new TypeError('Unknown conversation operation');
85
+ if (!['query', 'begin', 'append', 'resume', 'policy', 'boundary'].includes(operation)) throw new TypeError('Unknown conversation operation');
86
86
  return this.#request(`/v1/agent-conversations/${operation}`, {
87
87
  method: operation === 'policy' ? 'PUT' : 'POST', body: input, signal, timeoutMs
88
88
  });
@@ -0,0 +1,28 @@
1
+ import { configuredWorkspace } from './workspace-provider-client.js';
2
+
3
+ export async function createProjectRelation(application, input) {
4
+ const workspace = configuredWorkspace(application.workspaces, input.providerUrl);
5
+ return workspace.client.createProjectRelation(input.sourceProjectId, {
6
+ target_project_id: input.targetProjectId,
7
+ relation_type: input.relationType,
8
+ note: input.note ?? null
9
+ });
10
+ }
11
+
12
+ export async function listProjectRelations(application, input) {
13
+ const workspace = configuredWorkspace(application.workspaces, input.providerUrl);
14
+ return {
15
+ projectId: input.projectId,
16
+ providerUrl: workspace.providerUrl,
17
+ relations: await workspace.client.listProjectRelations(input.projectId)
18
+ };
19
+ }
20
+
21
+ export async function reviewProjectRelation(application, input) {
22
+ const workspace = configuredWorkspace(application.workspaces, input.providerUrl);
23
+ return workspace.client.decideProjectRelation(
24
+ input.targetProjectId,
25
+ input.relationId,
26
+ { decision: input.decision, note: input.note ?? null }
27
+ );
28
+ }
@@ -0,0 +1,125 @@
1
+ import { providerProjectProfile } from './project-profile-mapping.js';
2
+ import { configuredWorkspace } from './workspace-provider-client.js';
3
+
4
+ export async function listKnowledgeSpaces(application) {
5
+ const [availablePersonalSpaces, personalProjects, subscriptions, ...workspaceSpaces] = await Promise.all([
6
+ application.personal.listSpaces(),
7
+ application.personal.listPersonalProjects(application.config.personal.spaceId),
8
+ application.personal.listSubscriptions(application.config.personal.spaceId),
9
+ ...[...application.workspaces.values()].map(async (workspace) => ({
10
+ providerUrl: workspace.providerUrl,
11
+ principalId: workspace.principalId,
12
+ spaces: await safely(() => workspace.client.listSpaces(), [])
13
+ }))
14
+ ]);
15
+ const personalSpaces = availablePersonalSpaces.filter(({ id }) => id === application.config.personal.spaceId);
16
+ return {
17
+ activePersonalSpaceId: application.config.personal.spaceId,
18
+ personalSpaces,
19
+ personalProjects,
20
+ projects: workspaceSpaces.flatMap(({ providerUrl, principalId, spaces }) =>
21
+ spaces.map((space) => ({
22
+ ...space,
23
+ providerUrl,
24
+ isOwner: space.owner_id === principalId
25
+ }))
26
+ ),
27
+ subscriptions
28
+ };
29
+ }
30
+
31
+ export async function subscribePublicProject(application, input) {
32
+ if (input.personalSpaceId !== application.config.personal.spaceId) {
33
+ throw new TypeError('Subscription must belong to the active personal space');
34
+ }
35
+ const workspace = configuredWorkspace(application.workspaces, input.providerUrl);
36
+ const accessible = await workspace.client.listSpaces();
37
+ if (!accessible.some(({ id }) => id === input.projectId)) {
38
+ throw new TypeError('Public project is not accessible with the configured identity');
39
+ }
40
+ return application.personal.subscribe({
41
+ personal_space_id: input.personalSpaceId,
42
+ project_id: input.projectId,
43
+ provider_url: workspace.providerUrl,
44
+ project_name: input.projectName
45
+ });
46
+ }
47
+
48
+ export async function unsubscribePublicProject(application, input) {
49
+ if (input.personalSpaceId !== application.config.personal.spaceId) {
50
+ throw new TypeError('Subscription must belong to the active personal space');
51
+ }
52
+ const workspace = configuredWorkspace(application.workspaces, input.providerUrl);
53
+ return application.personal.unsubscribe(
54
+ input.personalSpaceId,
55
+ input.projectId,
56
+ workspace.providerUrl
57
+ );
58
+ }
59
+
60
+ export async function publishPersonalProject(application, input) {
61
+ if (input.personalSpaceId !== application.config.personal.spaceId) {
62
+ throw new TypeError('Published project must belong to the active personal space');
63
+ }
64
+ const localProjectId = String(input.localProjectId ?? '').trim();
65
+ if (!localProjectId) throw new TypeError('Local project ID is required');
66
+ const releaseVersion = String(input.releaseVersion ?? '').trim();
67
+ const updateSummary = String(input.updateSummary ?? '').trim();
68
+ if (!/^[0-9A-Za-z][0-9A-Za-z._-]{0,63}$/.test(releaseVersion)) {
69
+ throw new TypeError('Release version must use letters, numbers, dots, underscores, or hyphens');
70
+ }
71
+ if (!updateSummary || updateSummary.length > 4096) {
72
+ throw new TypeError('Release update summary is required and must be at most 4096 characters');
73
+ }
74
+ const localProject = await application.personal.getPersonalProject(
75
+ input.personalSpaceId,
76
+ localProjectId
77
+ );
78
+ const workspace = configuredWorkspace(application.workspaces, input.providerUrl);
79
+ const project = await workspace.client.createSpace({
80
+ name: localProject.profile.name,
81
+ kind: 'project',
82
+ description: localProject.profile.purpose?.slice(0, 2000) ?? null,
83
+ publication_key: localProject.publication_key,
84
+ profile: providerProjectProfile(localProject.profile),
85
+ release: {
86
+ version: releaseVersion,
87
+ summary: updateSummary
88
+ }
89
+ });
90
+ const subscription = await application.personal.subscribe({
91
+ personal_space_id: input.personalSpaceId,
92
+ project_id: project.id,
93
+ provider_url: workspace.providerUrl,
94
+ project_name: project.name
95
+ });
96
+ return { project: { ...project, providerUrl: workspace.providerUrl }, subscription };
97
+ }
98
+
99
+ export async function listProjectReleases(application, input) {
100
+ const workspace = configuredWorkspace(application.workspaces, input.providerUrl);
101
+ return {
102
+ projectId: input.projectId,
103
+ providerUrl: workspace.providerUrl,
104
+ releases: await workspace.client.listProjectReleases(input.projectId)
105
+ };
106
+ }
107
+
108
+ export async function deletePublicProject(application, input) {
109
+ const workspace = configuredWorkspace(application.workspaces, input.providerUrl);
110
+ const result = await workspace.client.deleteProject(input.projectId);
111
+ await application.personal.unsubscribe(
112
+ application.config.personal.spaceId,
113
+ input.projectId,
114
+ workspace.providerUrl
115
+ );
116
+ return { ...result, providerUrl: workspace.providerUrl };
117
+ }
118
+
119
+ async function safely(operation, fallback) {
120
+ try {
121
+ return await operation();
122
+ } catch {
123
+ return fallback;
124
+ }
125
+ }
@@ -0,0 +1,50 @@
1
+ import { submitPersonalDraft } from './public-submission.js';
2
+ import { reconcilePublicSubmissions } from './public-submission-reconciliation.js';
3
+ import { parsePersonalDraftDecision } from './publication-draft-input.js';
4
+ import { configuredWorkspace } from './workspace-provider-client.js';
5
+
6
+ // An Agent's list leaves out a draft of an FLA's work (made before the Provider refused them);
7
+ // only the console passes ownerReads (src/knowledge-owner-reads) for the person's full list.
8
+ export async function listPersonalReviewQueue(application, input = {}, ownerReads = null) {
9
+ const personalSpaceId = input.personalSpaceId ?? application.config.personal.spaceId;
10
+ if (personalSpaceId !== application.config.personal.spaceId) {
11
+ throw new TypeError('Personal review must use the active personal space');
12
+ }
13
+ await application.reconcilePersonalSubmissions({}, ownerReads);
14
+ const status = input.status ?? 'pending';
15
+ return { personalSpaceId, drafts: ownerReads ? await ownerReads.publicationDrafts({ personalSpaceId, status })
16
+ : await application.personal.listPublicationDrafts(personalSpaceId, status) };
17
+ }
18
+
19
+ // ownerReads: the console's port, which alone lists and settles a draft of an FLA's work.
20
+ export function reconcilePersonalSubmissions(application, options = {}, ownerReads = null) {
21
+ return reconcilePublicSubmissions({ personal: ownerReads?.submissions ?? application.personal,
22
+ workspaceFor: url => configuredWorkspace(application.workspaces, url), spaceId: application.config.personal.spaceId }, options);
23
+ }
24
+
25
+ // ownerReads: the console's port; an Agent decides only a draft of positively plain work.
26
+ export async function reviewPersonalDraft(application, input, ownerReads = null) {
27
+ input = parsePersonalDraftDecision(input);
28
+ const personalSpaceId = application.config.personal.spaceId;
29
+ const personal = ownerReads?.submissions ?? application.personal;
30
+ if (input.decision !== 'submit_public') {
31
+ return personal.decidePublicationDraft(personalSpaceId, input.draftId, { decision: input.decision,
32
+ shared_proposal_id: null });
33
+ }
34
+ return submitPersonalDraft({ personal, workspaceFor: url => configuredWorkspace(application.workspaces, url),
35
+ spaceId: personalSpaceId, draftId: input.draftId });
36
+ }
37
+
38
+ export async function listReviewQueue(application, { projectId, providerUrl, status = 'pending' }) {
39
+ const workspace = configuredWorkspace(application.workspaces, providerUrl);
40
+ return {
41
+ projectId,
42
+ providerUrl: workspace.providerUrl,
43
+ proposals: await workspace.client.listProposals(projectId, status)
44
+ };
45
+ }
46
+
47
+ export async function reviewProposal(application, { projectId, providerUrl, proposalId, decision, note = null }) {
48
+ const workspace = configuredWorkspace(application.workspaces, providerUrl);
49
+ return workspace.client.decideProposal(projectId, proposalId, { decision, note });
50
+ }
@@ -2,10 +2,12 @@ import { assertRoundtableHost } from '../../packages/roundtable/src/host.js';
2
2
  import { loadProjectTeam } from './project-team-view.js';
3
3
  import { recordProjectMemoryUsage } from './project-memory-usage.js';
4
4
  import { activeAgentRequestSignal, activeSealedWorkerRequest } from '../app/agent-request-context.js';
5
+ import { termsOverlap } from '../standing-assignments/term-match.js';
6
+ import { identityKey } from '../text/name-identity.js';
5
7
 
6
8
  // FULI as the Roundtable host: Agents, projects, task identity and wake
7
9
  // authority all come from the Provider of this device's personal space.
8
- export function createFuliRoundtableHost(app) {
10
+ export function createFuliRoundtableHost(app, { warn = line => process.stderr.write(line) } = {}) {
9
11
  const spaceId = () => app.config.personal.spaceId;
10
12
  const projectView = project => ({ projectId: project.project_id ?? project.personal_project_id ?? project.id,
11
13
  name: project.profile?.name ?? project.name ?? null, temporary: project.scope_type === 'temporary',
@@ -14,6 +16,20 @@ export function createFuliRoundtableHost(app) {
14
16
  const value = await app.personal.listPersonalProjects(spaceId());
15
17
  return Array.isArray(value) ? value : value?.projects ?? [];
16
18
  };
19
+ const projectLeadId = async projectId =>
20
+ (await app.personal.getProjectAgentCoordinationPolicy(spaceId(), projectId)).team_lead_agent_id ?? null;
21
+ // A standing-assignments store this run cannot read (a newer format, a
22
+ // locked file) leaves discovery to project names; said once, by code only,
23
+ // since the message may carry local paths.
24
+ let standingUnreadable = false;
25
+ const standingMatches = query => {
26
+ try { return app.standingAssignments.discover(spaceId(), query); }
27
+ catch (error) {
28
+ if (!standingUnreadable) warn(`FULI: find_agents is matching project names only; standing assignments are unreadable (${error.code ?? error.name}).\n`);
29
+ standingUnreadable = true;
30
+ return [];
31
+ }
32
+ };
17
33
  return assertRoundtableHost({
18
34
  spaceId,
19
35
  listAgents: () => app.listProjectAgents({ personalSpaceId: spaceId() }),
@@ -26,8 +42,7 @@ export function createFuliRoundtableHost(app) {
26
42
  taskContext: (token, client) => app.taskContextRegistry.context(token, client),
27
43
  listProjects: async () => (await projects()).map(projectView),
28
44
  getProject: async projectId => projectView(await app.personal.getPersonalProject(spaceId(), projectId)),
29
- projectLeadId: async projectId =>
30
- (await app.personal.getProjectAgentCoordinationPolicy(spaceId(), projectId)).team_lead_agent_id ?? null,
45
+ projectLeadId,
31
46
  staffProjectLead: ({ projectId, client }) => app.personal.staffDefaultProjectLead({ personal_space_id: spaceId(),
32
47
  personal_project_id: projectId, source_application: client }),
33
48
  async projectTeam(projectId) {
@@ -35,6 +50,23 @@ export function createFuliRoundtableHost(app) {
35
50
  return { lead: team.lead ?? null,
36
51
  people: [team.lead, ...team.members, ...team.collaborators, ...team.peers].filter(Boolean) };
37
52
  },
53
+ // The person's own names for work (rec#29 F4): an open formal project the
54
+ // query names finds its lead, and an active standing assignment of this
55
+ // space whose terms or responsibility it names finds the lead it routes to.
56
+ // A project whose lead cannot be read is left out; the others still match.
57
+ async matchWork(query) {
58
+ const open = new Map((await projects()).map(projectView).filter(project => !project.temporary && !project.archived)
59
+ .map(project => [project.projectId, project.name]));
60
+ const standing = standingMatches(query)
61
+ .filter(({ assignment }) => open.has(assignment.projectId))
62
+ .map(({ assignment, matchedTerms }) => ({ agentId: assignment.leadAgentId, projectId: assignment.projectId,
63
+ project: open.get(assignment.projectId), responsibility: assignment.responsibility, matchedTerms }));
64
+ const key = identityKey(query);
65
+ const named = await Promise.all([...open].filter(([projectId, name]) => name
66
+ && !standing.some(match => match.projectId === projectId) && termsOverlap(key, identityKey(name)))
67
+ .map(async ([projectId, project]) => ({ agentId: await projectLeadId(projectId).catch(() => null), projectId, project })));
68
+ return [...standing, ...named.filter(match => match.agentId)];
69
+ },
38
70
  async projectForPath(path) {
39
71
  if (!path || !app.projectPathResolver) return null;
40
72
  const resolved = app.projectPathResolver(path, await projects());
@@ -1,5 +1,5 @@
1
1
  import { captureSettingsUrl, taskAgentReceipt } from '../agents/identity-receipt.js';
2
- import { requiredString } from '../validation/values.js';
2
+ import { requiredBinding, requiredString } from '../validation/values.js';
3
3
  import { taskAgentIdentity } from './agent-conversations.js';
4
4
  import { captureDecision, captureSettingsVersion, taskCaptureScope } from './capture-decision.js';
5
5
  import { receiptNotices } from './capture-notice.js';
@@ -22,7 +22,8 @@ export async function setSessionCapturePause(application, { taskContextToken, se
22
22
  if (typeof sessionPaused !== 'boolean') throw new TypeError('sessionPaused must be a boolean');
23
23
  const task = await application.taskContextRegistry.context(requiredString(taskContextToken, 'taskContextToken'),
24
24
  sourceApplication);
25
- const sessionId = requiredString(task.sessionId, 'Task host session');
25
+ // The task's stored host session, not the caller's argument.
26
+ const sessionId = requiredBinding(task.sessionId, 'Task host session');
26
27
  const state = await keptInSessionLedger(application, task.sourceApplication, sessionId, 'session_paused')
27
28
  ? savedPause(application, sessionId, { paused: sessionPaused, sourceApplication: task.sourceApplication }) : null;
28
29
  // A resumed session may still be off by another layer; the receipt says so.
@@ -1,4 +1,4 @@
1
- import { requiredString } from '../validation/values.js';
1
+ import { requiredBinding } from '../validation/values.js';
2
2
  import { captureDecision } from './capture-decision.js';
3
3
  import { captureNotice, sinceNotice } from './capture-notice.js';
4
4
  import { keptInSessionLedger } from './session-capture-pause-request.js';
@@ -23,8 +23,9 @@ const LEDGER_REASON = 'session_stopped';
23
23
 
24
24
  export async function switchSessionFuli(application, { sessionId, sourceApplication, action, projectPath = null }) {
25
25
  if (!SESSION_FULI_ACTIONS.includes(action)) throw new TypeError(`Unknown FULI session action: ${action}`);
26
- requiredString(sessionId, 'Host session');
27
- requiredString(sourceApplication, 'Client');
26
+ // The hook's or the CLI's own host session, never one a caller names.
27
+ requiredBinding(sessionId, 'Host session');
28
+ requiredBinding(sourceApplication, 'Client');
28
29
  const before = readState(application, sessionId);
29
30
  if (!before) return answer('unavailable', action, null);
30
31
  const scope = { sessionId, sourceApplication, projectPath };
@@ -0,0 +1,59 @@
1
+ import { ApplicationError, ApplicationErrorCode } from '../app/application-error.js';
2
+ import { captureDecision, captureDisabled } from './capture-decision.js';
3
+ import { preflightTaskCaptures } from './task-knowledge-routing.js';
4
+ import {
5
+ assertPublicKnowledgeEligible,
6
+ providerEpisode,
7
+ providerPersonalCommit
8
+ } from './knowledge-provider-mapping.js';
9
+ import { queuePublicationDraft } from './publication-draft-capture.js';
10
+ import { assertNoCredentials } from './knowledge-credential-guard.js';
11
+ import { configuredWorkspace } from './workspace-provider-client.js';
12
+
13
+ // captureScope: the write's own scope when it differs from the target, as for
14
+ // a task checkpoint whose global preference was learned in the task's project.
15
+ export async function validateCaptureSessionKnowledge(application, input, { captureScope = knowledgeCaptureScope(input) } = {}) {
16
+ if ((await captureDecision(application, captureScope)).allowed) prepareKnowledgeCapture(application, input);
17
+ }
18
+
19
+ export async function preflightPersonalKnowledgeCaptures(application, inputs) {
20
+ return preflightTaskCaptures(application.personal, inputs, input => prepareKnowledgeCapture(application, input));
21
+ }
22
+
23
+ export async function captureSessionKnowledge(application, input, { captureScope = knowledgeCaptureScope(input) } = {}) {
24
+ const capture = await captureDecision(application, captureScope);
25
+ if (!capture.allowed) return { route: 'disabled', ...captureDisabled(capture) };
26
+ const { episode, workspace, commit } = prepareKnowledgeCapture(application, input);
27
+ if (input.targetKind === 'personal') {
28
+ const result = await application.personal.commit(commit);
29
+ return { route: 'personal', ...result };
30
+ }
31
+ return queuePublicationDraft(application, { input, workspace, episode });
32
+ }
33
+
34
+ function prepareKnowledgeCapture(application, input) {
35
+ assertNoCredentials(input);
36
+ const episode = providerEpisode(input);
37
+ if (input.targetKind === 'personal') {
38
+ return { episode, commit: providerPersonalCommit(input, episode, application.config.personal.spaceId) };
39
+ }
40
+ if (input.projectAgentId) {
41
+ throw new ApplicationError(
42
+ ApplicationErrorCode.VALIDATION,
43
+ 'Project Agent knowledge can only be captured in the personal graph'
44
+ );
45
+ }
46
+ if (episode.sensitivity !== 'normal') {
47
+ throw new ApplicationError(
48
+ ApplicationErrorCode.VALIDATION,
49
+ 'Private or restricted knowledge cannot enter a team-shared project queue. Use targetKind "personal" with personalProjectId to keep it in the personal graph'
50
+ );
51
+ }
52
+ assertPublicKnowledgeEligible(episode);
53
+ return { episode, workspace: configuredWorkspace(application.workspaces, input.providerUrl) };
54
+ }
55
+
56
+ function knowledgeCaptureScope(input) {
57
+ return { sourceApplication: input?.sourceApplication, personalProjectId: input?.personalProjectId ?? null,
58
+ sessionId: input?.sessionId ?? null };
59
+ }
@@ -4,7 +4,7 @@ import { CATEGORY, CONFIRMATION } from '../agents/turn-receipt.js';
4
4
  import { notRecordedReason } from '../conversations/transcript-capture-gap.js';
5
5
  import { localClockTime } from '../text/clock-time.js';
6
6
  import { providerReaderFields, taskKnowledgeReader } from './knowledge-reader.js';
7
- import { requiredString } from '../validation/values.js';
7
+ import { requiredBinding, requiredString } from '../validation/values.js';
8
8
 
9
9
  // "本会话记了什么" (rec#5 C6): one host session's records in three groups,
10
10
  // numbered once here so the console page and the Agent's answer list the same
@@ -39,10 +39,11 @@ export async function readSessionRecords(application, ownerReads, { personalSpac
39
39
 
40
40
  // The caller's own session, as the Agent tool reads it: entries of the turns
41
41
  // it worked in this same project, renumbered, with no content of the others,
42
- // as the numbered lines the Agent repeats.
42
+ // as the numbered lines the Agent repeats. Its client is the MCP process's own
43
+ // (normalizeAgentSessionInput), never an argument the caller could correct.
43
44
  export async function readOwnSessionRecords(application, { taskContextToken, sourceApplication }) {
44
45
  const task = await application.taskContextRegistry.context(requiredString(taskContextToken, 'taskContextToken', 160),
45
- client(sourceApplication));
46
+ requiredBinding(sourceApplication, 'sourceApplication', MAX_CLIENT));
46
47
  const session = { sourceApplication: task.sourceApplication, sessionId: task.sessionId };
47
48
  const reader = providerReaderFields(taskKnowledgeReader(task));
48
49
  const read = await providerRead(application, session,
@@ -55,8 +55,7 @@ function factCitation(fact) {
55
55
  scopeDistance: fact.scope_distance,
56
56
  score: fact.score,
57
57
  role: knowledgeItemRole(fact),
58
- title: [fact.source_entity, fact.target_entity].filter(Boolean).join(' → ') ||
59
- fact.fact || '关系知识'
58
+ title: knowledgeItemTitle(fact, 'relationship')
60
59
  });
61
60
  }
62
61
 
@@ -70,10 +69,18 @@ function entityCitation(entity) {
70
69
  scopeDistance: entity.scope_distance,
71
70
  score: entity.score,
72
71
  role: knowledgeItemRole(entity),
73
- title: entity.name || entity.summary || '实体知识'
72
+ title: knowledgeItemTitle(entity, 'entity')
74
73
  });
75
74
  }
76
75
 
76
+ // What a person sees as a knowledge item's name: its endpoints for a
77
+ // relationship, its name for an entity.
78
+ export function knowledgeItemTitle(item, itemKind) {
79
+ return itemKind === 'relationship'
80
+ ? [item.source_entity, item.target_entity].filter(Boolean).join(' → ') || item.fact || '关系知识'
81
+ : item.name || item.summary || '实体知识';
82
+ }
83
+
77
84
  function citation({
78
85
  scope,
79
86
  spaceId,
@@ -132,6 +139,9 @@ function uniqueCitations(citations) {
132
139
  });
133
140
  }
134
141
 
142
+ // Markers are built only for a search that ran (a search tool or the entry's
143
+ // automatic recall), so "已检索,未命中" is true when shown. A task with no search
144
+ // has no marker at all; the MCP instructions tell the Agent to show none.
135
145
  function sourceLeadMarkdown({ consoleUrl, citations }) {
136
146
  if (!citations.length) {
137
147
  const origin = safeLoopbackOrigin(consoleUrl) ?? DEFAULT_CONSOLE_URL;
@@ -0,0 +1,66 @@
1
+ import { contentHash } from '../../packages/roundtable/src/canonical-json.js';
2
+ import { ApplicationError } from '../app/application-error.js';
3
+ import { requiredString } from '../validation/values.js';
4
+ import { hostInternalActivity } from './task-entry-activity-origin.js';
5
+ import { projectByName } from './task-entry-project-mention.js';
6
+
7
+ // What every change the person makes to a standing assignment in a
8
+ // conversation shares (rec#29 D-41: registering it, F5: correcting or ending
9
+ // it): only the person's own conversation may ask for it, preview resolves a
10
+ // plan and writes nothing, and confirm applies the plan only while it still
11
+ // hashes to the digest the person was asked about.
12
+
13
+ const DIGEST_LIMIT = 64;
14
+ const TOKEN_LIMIT = 256;
15
+ const ASK_ONCE = 'Nothing was saved. Ask the user once with restatement, in their language; only after a clear yes call confirm with the same input and this confirmationDigest.';
16
+
17
+ export function standingAssignmentsOf(application) {
18
+ if (!application.standingAssignments) {
19
+ throw new ApplicationError('standing_assignments_unavailable', 'Standing assignments need a local FULI installation',
20
+ { status: 503 });
21
+ }
22
+ return application.standingAssignments;
23
+ }
24
+
25
+ // The calling task's conversation; internal Agent activity is refused.
26
+ export async function personsConversation(application, input) {
27
+ const task = await application.taskContextRegistry.context(
28
+ requiredString(input.taskContextToken, 'taskContextToken', TOKEN_LIMIT), input.sourceApplication ?? 'other');
29
+ if (task.activityOrigin || hostInternalActivity(application, { sessionId: task.sessionId })) {
30
+ throw new ApplicationError('standing_assignment_internal_activity', 'Internal Agent activity cannot register or '
31
+ + 'change a standing assignment; only the person can, in their own conversation. Nothing was saved.', { status: 403 });
32
+ }
33
+ return task;
34
+ }
35
+
36
+ // The one nameable project of this name, or null when there is none.
37
+ export async function projectNamed(application, name) {
38
+ const named = await projectByName(application, name);
39
+ if (named?.ambiguous) {
40
+ throw new ApplicationError('standing_assignment_project_ambiguous', `${named.candidateCount} projects are named `
41
+ + `"${name}"; ask the user which one they mean. Nothing was saved.`, { status: 409 });
42
+ }
43
+ return named?.personalProjectId ?? null;
44
+ }
45
+
46
+ export async function projectLead(application, spaceId, projectId) {
47
+ return (await application.personal.getProjectAgentCoordinationPolicy(spaceId, projectId))?.team_lead_agent_id ?? null;
48
+ }
49
+
50
+ export async function leadName(application, spaceId, projectId, agentId) {
51
+ return (await application.personal.getProjectAgent(spaceId, projectId, agentId))?.profile?.name ?? agentId;
52
+ }
53
+
54
+ export function previewOf(plan, view, restatement) {
55
+ return { status: 'preview', plan: view, restatement, confirmationDigest: contentHash(plan), executed: false,
56
+ guidance: ASK_ONCE };
57
+ }
58
+
59
+ export function assertPreviewed(input, plan) {
60
+ if (requiredString(input.confirmationDigest, 'confirmationDigest', DIGEST_LIMIT) === contentHash(plan)) return;
61
+ throw new ApplicationError('standing_assignment_plan_changed', 'The plan is not the one previewed: it changed '
62
+ + 'since, or the digest belongs to other input. Nothing was saved; preview again and ask the user again.',
63
+ { status: 409 });
64
+ }
65
+
66
+ export const quoted = terms => terms.map(term => `"${term}"`).join(', ');