fuli-context 0.23.0-beta.9 → 0.23.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 (294) hide show
  1. package/dist/web/assets/{AboutPage-Co0jsR1c.js → AboutPage-S8QFfzpA.js} +1 -1
  2. package/dist/web/assets/AboutSectionHeading-B5CzH4Zs.js +1 -0
  3. package/dist/web/assets/AboutSectionHeading-DjXpIV27.css +1 -0
  4. package/dist/web/assets/{AgentAppsPage-DY_TV5EE.js → AgentAppsPage-BYXraPFM.js} +1 -1
  5. package/dist/web/assets/{AgentHand-CTKH7yFY.js → AgentHand-BGGdVdd9.js} +1 -1
  6. package/dist/web/assets/AgentManagement-Bza8k5ra.js +7 -0
  7. package/dist/web/assets/AgentMentionCopy-C72hY2QL.js +1 -0
  8. package/dist/web/assets/{AgentName-DNxVHPb0.js → AgentName-CUjBNQ8j.js} +1 -1
  9. package/dist/web/assets/AgentProfilePage-kp7-gRRx.js +5 -0
  10. package/dist/web/assets/{AgentServicesPage-DEz1dnct.js → AgentServicesPage-IsGaz7FY.js} +1 -1
  11. package/dist/web/assets/{AppViewerPage-BMnN0lgj.js → AppViewerPage-CcOlwxck.js} +1 -1
  12. package/dist/web/assets/{BackToTop-BfdZE6xK.js → BackToTop-C3KYEoCW.js} +1 -1
  13. package/dist/web/assets/{BoardCardFieldsMenu-xjUzesvU.js → BoardCardFieldsMenu-BlBWT1j7.js} +1 -1
  14. package/dist/web/assets/{BoardMoveMenu-CCvochC4.js → BoardMoveMenu-Bc7xC1Uh.js} +1 -1
  15. package/dist/web/assets/{Breadcrumb-ys780J7e.js → Breadcrumb-C_xMiD-Z.js} +1 -1
  16. package/dist/web/assets/{CaptureChangePage-BY7KKPuU.js → CaptureChangePage-Bekp1aWg.js} +1 -1
  17. package/dist/web/assets/{ConnectionsPage-Cj-T0BH2.js → ConnectionsPage-BpvecWXD.js} +1 -1
  18. package/dist/web/assets/{CopyFixPrompt-ERDPz6w7.js → CopyFixPrompt-Bp-UX4Hq.js} +1 -1
  19. package/dist/web/assets/DataFormatPage-dsy8d3oA.js +2 -0
  20. package/dist/web/assets/DataFormatPage-sSnjjUY4.css +1 -0
  21. package/dist/web/assets/{DebugTurnPage-C6xOOTYf.js → DebugTurnPage-cIJV7xDW.js} +1 -1
  22. package/dist/web/assets/{DebugTurnsPage-uclemAXU.js → DebugTurnsPage-B6Te_Alp.js} +1 -1
  23. package/dist/web/assets/{DialogTitle-C86eI8Q_.js → DialogTitle-Lj5s6nwG.js} +1 -1
  24. package/dist/web/assets/{EmployeeRedirectPage-B5Sh-mOu.js → EmployeeRedirectPage-DnvwJeCN.js} +1 -1
  25. package/dist/web/assets/{EmployeeScopeDialog-DbEgouOr.js → EmployeeScopeDialog-CXNZ62Ab.js} +1 -1
  26. package/dist/web/assets/{EmployeeWorkbench-Cd0Yrv4Z.js → EmployeeWorkbench-DALIO-cM.js} +3 -3
  27. package/dist/web/assets/FieldRoot-DRnAC66O.js +1 -0
  28. package/dist/web/assets/{FlaGrowth-BS5MVg54.js → FlaGrowth-7wlv31Tl.js} +1 -1
  29. package/dist/web/assets/{FlaTaskSheets-IQ1HsEu5.js → FlaTaskSheets-CNdaBy1P.js} +1 -1
  30. package/dist/web/assets/{FlasPage-DsAcdiFS.js → FlasPage-BCs1Ffpf.js} +1 -1
  31. package/dist/web/assets/{GrowthLoading-BMf6Z2MU.js → GrowthLoading-Cr8xZwwO.js} +1 -1
  32. package/dist/web/assets/HowtoPage-Cv1YQy1s.js +1 -0
  33. package/dist/web/assets/{HowtoPage-BRV2W1Go.css → HowtoPage-t12tDDpS.css} +1 -1
  34. package/dist/web/assets/{InboxPage-DPV8n8FW.js → InboxPage-CgJnymOY.js} +1 -1
  35. package/dist/web/assets/{KnowledgeDeleteButton-Bo7gXmnS.js → KnowledgeDeleteButton-FEyEvhlR.js} +1 -1
  36. package/dist/web/assets/{KnowledgeHardDeleteSection-amJaLmkS.js → KnowledgeHardDeleteSection-CVwTeMEJ.js} +1 -1
  37. package/dist/web/assets/KnowledgeItemEditPage-rwpM8cF1.js +1 -0
  38. package/dist/web/assets/{KnowledgeItemSummaryCard-CjcKr6Xr.js → KnowledgeItemSummaryCard-49EADY_Z.js} +1 -1
  39. package/dist/web/assets/{KnowledgeOrganizerPage-CzXXBL9z.js → KnowledgeOrganizerPage-7IdnjM3L.js} +1 -1
  40. package/dist/web/assets/KnowledgePage-gxqOIZxf.js +1 -0
  41. package/dist/web/assets/KnowledgePeek-CQyCxHFj.js +1 -0
  42. package/dist/web/assets/{KnowledgeTurnReceiptPage-CbRSAOkW.js → KnowledgeTurnReceiptPage-BOz7IpaK.js} +1 -1
  43. package/dist/web/assets/{KnowledgeWorkspace-6C9dPHLk.js → KnowledgeWorkspace-A7zVb26p.js} +3 -3
  44. package/dist/web/assets/{MeAvatar-Ca5kjZR7.js → MeAvatar-CYVcRiuW.js} +1 -1
  45. package/dist/web/assets/{MeLink-CMsMg8E_.js → MeLink-BdqkzhT6.js} +1 -1
  46. package/dist/web/assets/{MenuSeparator-BlL75cLC.js → MenuSeparator-quqkZZXY.js} +1 -1
  47. package/dist/web/assets/ModelSettingsPage-B8jC_uew.js +3 -0
  48. package/dist/web/assets/ModelSettingsPage-DhCn_SF6.css +1 -0
  49. package/dist/web/assets/{NotFoundPage-j5qbgkxY.js → NotFoundPage-Dmn32VWo.js} +1 -1
  50. package/dist/web/assets/{OccupationsPage-DLIkdMDv.js → OccupationsPage-BVREfX_R.js} +1 -1
  51. package/dist/web/assets/{OverviewPage-BeExbgPK.js → OverviewPage-CHyEbdP4.js} +1 -1
  52. package/dist/web/assets/{PageColumns-C93sMwwH.js → PageColumns-DpfaPeu7.js} +1 -1
  53. package/dist/web/assets/{PageOutline-Dtu7R8Wo.js → PageOutline-BKBQ1T4d.js} +1 -1
  54. package/dist/web/assets/{PersonalProfilePage-CIeXNXqv.js → PersonalProfilePage-Cxp2gn6J.js} +1 -1
  55. package/dist/web/assets/PersonalProjectsPage-821imOxR.js +1 -0
  56. package/dist/web/assets/{PinIcon-Dp4Ubaw6.js → PinIcon-B7dvh7ld.js} +1 -1
  57. package/dist/web/assets/{PopperContent-D6WQ0NV4.js → PopperContent-DNqbLkNa.js} +1 -1
  58. package/dist/web/assets/{Presence-D-jzaDBV.js → Presence-D3HKb5Hb.js} +1 -1
  59. package/dist/web/assets/{ProfileAuthorChip-CpLzynWF.js → ProfileAuthorChip-7HSHODdR.js} +1 -1
  60. package/dist/web/assets/{ProjectAgentsPage-v-Wtq-2-.js → ProjectAgentsPage-DBsXS6Xa.js} +1 -1
  61. package/dist/web/assets/{ProjectJudgmentPolicy-DR8Rk_1K.js → ProjectJudgmentPolicy-GA33aSRi.js} +1 -1
  62. package/dist/web/assets/{PublicProjectsPage-QwAtKnu1.js → PublicProjectsPage-PJlBI8IE.js} +1 -1
  63. package/dist/web/assets/{RoundtablesPage-DLZdviOP.js → RoundtablesPage-DT5DUXsa.js} +1 -1
  64. package/dist/web/assets/{RovingFocusGroup-CmwaBpdi.js → RovingFocusGroup-BB0d3k17.js} +1 -1
  65. package/dist/web/assets/{RovingFocusItem-HhNodnJn.js → RovingFocusItem-CFd7tXzD.js} +1 -1
  66. package/dist/web/assets/{SessionMigrationPage-_W2BnsjS.js → SessionMigrationPage-BZ1lEDQr.js} +1 -1
  67. package/dist/web/assets/{SessionRecordsPage-CedaErNM.js → SessionRecordsPage-BMAAtIAt.js} +1 -1
  68. package/dist/web/assets/SettingsPage-BYNEk6BM.js +1 -0
  69. package/dist/web/assets/{SettingsPage-D85vqpZb.css → SettingsPage-Uj1IpZpS.css} +1 -1
  70. package/dist/web/assets/{SharedJefaReportPage-BkmmPYH1.js → SharedJefaReportPage-g35o6jUb.js} +1 -1
  71. package/dist/web/assets/{TagVocabularyPage-Bcd5fvzW.js → TagVocabularyPage-COubNJXz.js} +1 -1
  72. package/dist/web/assets/{TaskBlockerClear-Bln3zxga.js → TaskBlockerClear-B5MpHdlh.js} +1 -1
  73. package/dist/web/assets/{TaskBlockerNotice-Db1uAtT2.js → TaskBlockerNotice-CIN0HRiE.js} +1 -1
  74. package/dist/web/assets/{TaskReason-BgF2K1hA.js → TaskReason-LQ0CFiKu.js} +1 -1
  75. package/dist/web/assets/{TeamCard-B4J2jkm5.js → TeamCard-D-kLa5rT.js} +1 -1
  76. package/dist/web/assets/{TeamCardsWidget-CZTQVqyh.js → TeamCardsWidget-DGX9k0S6.js} +1 -1
  77. package/dist/web/assets/{TeamIsland-DXIQQ3bx.js → TeamIsland-BIo-l49b.js} +1 -1
  78. package/dist/web/assets/{Teleport-Dg_IoSZh.js → Teleport-C1upABpY.js} +1 -1
  79. package/dist/web/assets/{TextField-Y8DAIUw6.js → TextField-ZnmRqG0h.js} +1 -1
  80. package/dist/web/assets/{UiChip-vvwIQTGB.js → UiChip-CizeOu1Q.js} +1 -1
  81. package/dist/web/assets/UiDialog-CGTzxn3-.js +1 -0
  82. package/dist/web/assets/{UiDisclosure-Bp0vA9km.js → UiDisclosure-ueMA4jl0.js} +1 -1
  83. package/dist/web/assets/UiIcon-sD1hUsOF.js +1 -0
  84. package/dist/web/assets/{UiIconButton-EZ8ktpFH.js → UiIconButton-CCo4NPYv.js} +1 -1
  85. package/dist/web/assets/{UiNotice-DYZn5s6m.js → UiNotice-DGPFbVo7.js} +1 -1
  86. package/dist/web/assets/{UiSegmented-DX8WXXVn.js → UiSegmented-BZ-jqnPE.js} +1 -1
  87. package/dist/web/assets/{UiWeight-Ci6wZg1W.js → UiWeight-BRO3oVMZ.js} +1 -1
  88. package/dist/web/assets/{VirtualDirectoryList-XB8MT97E.js → VirtualDirectoryList-BkV3gj5E.js} +1 -1
  89. package/dist/web/assets/{VisuallyHidden-BLRDANy_.js → VisuallyHidden-B8wfJ_mU.js} +1 -1
  90. package/dist/web/assets/{VisuallyHiddenInput-D-GgOU3T.js → VisuallyHiddenInput-Bdcr9CwC.js} +1 -1
  91. package/dist/web/assets/WidgetSlot-DFojQaSo.js +2 -0
  92. package/dist/web/assets/_plugin-vue_export-helper-B9AJmZbc.js +9 -0
  93. package/dist/web/assets/{agent-apps-CQf2Eba8.js → agent-apps-CKGFfySp.js} +1 -1
  94. package/dist/web/assets/{agent-avatar-lPJyVS9O.js → agent-avatar-V6M_DF3r.js} +1 -1
  95. package/dist/web/assets/agent-occupation-PZ2YAIM8.js +1 -0
  96. package/dist/web/assets/{agent-pins-CoyKIkO2.js → agent-pins-8KX0ynzy.js} +1 -1
  97. package/dist/web/assets/{agent-workflows-CRdfc5xN.js → agent-workflows-DQlqVOoA.js} +1 -1
  98. package/dist/web/assets/{attach-closest-edge-BIyU46Kh.js → attach-closest-edge-D2qlayPy.js} +1 -1
  99. package/dist/web/assets/{attention-store-BrThOc88.js → attention-store-BnZ8l3kk.js} +1 -1
  100. package/dist/web/assets/{badge-mwWygmG4.js → badge-DX_xrLV6.js} +1 -1
  101. package/dist/web/assets/{button-byjQ5eLH.js → button-CEkPBC1E.js} +1 -1
  102. package/dist/web/assets/{card-Bo5Wyknz.js → card-DNQ0_6vT.js} +1 -1
  103. package/dist/web/assets/{catalog-CgoPKxd_.js → catalog-KnpBkv5t.js} +1 -1
  104. package/dist/web/assets/{checkbox-BB8_0W6A.js → checkbox-DPyLHneg.js} +1 -1
  105. package/dist/web/assets/{client-DmgW-kvA.js → client-CSQcWFRh.js} +1 -1
  106. package/dist/web/assets/{client-connection-model-CrDtN1yF.js → client-connection-model-vO2cap6a.js} +1 -1
  107. package/dist/web/assets/{client-links-store-B7VjTEfO.js → client-links-store-DMqe0MbK.js} +1 -1
  108. package/dist/web/assets/combobox-zUq9bkyM.js +1 -0
  109. package/dist/web/assets/{console-BB2sTsSs.js → console-DaoAO-EO.js} +1 -1
  110. package/dist/web/assets/{context-menu-DW29av0t.js → context-menu-CcGDnF_k.js} +1 -1
  111. package/dist/web/assets/{conversation-launcher-settings-DVd61o9s.js → conversation-launcher-settings-CXFE-q_A.js} +1 -1
  112. package/dist/web/assets/{dialog-CHAmruFj.js → dialog-CxhKMo0D.js} +1 -1
  113. package/dist/web/assets/{dist-Bz5tCO-_.js → dist-B9GqMC5C.js} +1 -1
  114. package/dist/web/assets/{dist-B9snV3GY.js → dist-DIJqkL4O.js} +1 -1
  115. package/dist/web/assets/dropdown-menu-CXmMnCBh.js +1 -0
  116. package/dist/web/assets/{field-ZZb3Sy9Y.js → field-LNsBZqam.js} +1 -1
  117. package/dist/web/assets/{format-bytes-DiEwa-ch.js → format-bytes-Bqefdt37.js} +1 -1
  118. package/dist/web/assets/{identity-4i_OR9WP.js → identity-DRfhWjty.js} +1 -1
  119. package/dist/web/assets/index-B4AMPpl_.css +1 -0
  120. package/dist/web/assets/index-BYIOAXnn.js +2 -0
  121. package/dist/web/assets/{input-BP9Wn4Yk.js → input-UoZ-0Xne.js} +1 -1
  122. package/dist/web/assets/{label-xRSp2rqO.js → label-DpjbTOxt.js} +1 -1
  123. package/dist/web/assets/label-table-BnWNYfyk.js +1 -0
  124. package/dist/web/assets/{model-CidDnNzT.js → model-13BQndfF.js} +1 -1
  125. package/dist/web/assets/{model-P1cRTtx9.js → model-B5g0CFcM.js} +1 -1
  126. package/dist/web/assets/{model-DiJvQFH-.js → model-BYKHVgJr.js} +1 -1
  127. package/dist/web/assets/{model-4BHOc7rR.js → model-CDevUwUw.js} +1 -1
  128. package/dist/web/assets/{model-DRrCt6Xz.js → model-CpuIG8Du.js} +1 -1
  129. package/dist/web/assets/{model-CxmTkWuw.js → model-P5fSGsiJ.js} +1 -1
  130. package/dist/web/assets/{model-6a2cm5q3.js → model-pJ6k3zYD.js} +1 -1
  131. package/dist/web/assets/{motion-eJ8Y9ulR.js → motion-C-ZimCUS.js} +1 -1
  132. package/dist/web/assets/{motion-TN6JdrrU.js → motion-QY5FKKko.js} +1 -1
  133. package/dist/web/assets/{motion-preference-CC0XwuGQ.js → motion-preference-BQiiwhab.js} +1 -1
  134. package/dist/web/assets/{occupation-catalog-C3Hj8p4a.js → occupation-catalog-uDDhZwKK.js} +1 -1
  135. package/dist/web/assets/{option-CdihAKf9.js → option-CcHPBOo6.js} +1 -1
  136. package/dist/web/assets/{page-title-CPUoKkyh.js → page-title-NXphgeQI.js} +1 -1
  137. package/dist/web/assets/{person-profile-Cmkd1uXt.js → person-profile-DXXfpvta.js} +1 -1
  138. package/dist/web/assets/popover-xSRzcSmY.js +1 -0
  139. package/dist/web/assets/popup-host-Bmvrf-2t.js +1 -0
  140. package/dist/web/assets/{profile-model-CmC9A3we.js → profile-model-6gTmScHC.js} +1 -1
  141. package/dist/web/assets/{project-board-layout-BPk55Azx.js → project-board-layout-DBQeP_QP.js} +1 -1
  142. package/dist/web/assets/{project-capture-zRbPkI54.js → project-capture-BhYsDWwJ.js} +1 -1
  143. package/dist/web/assets/{project-origin-BNl8Mqof.js → project-origin-D8jy8EF_.js} +1 -1
  144. package/dist/web/assets/{quick-edit-api-D6Xgntqh.js → quick-edit-api-WLh_88w6.js} +1 -1
  145. package/dist/web/assets/{radio-group-AkUGYCQ8.js → radio-group-B4r78nDh.js} +1 -1
  146. package/dist/web/assets/{role-names-BDswxugG.js → role-names-PECaMfQo.js} +1 -1
  147. package/dist/web/assets/{roundtable-live-C1wc_F30.js → roundtable-live-DFeDF56c.js} +1 -1
  148. package/dist/web/assets/{runtime-dom.esm-bundler-CjD1s0uc.js → runtime-dom.esm-bundler-f39i44Mt.js} +1 -1
  149. package/dist/web/assets/select-_JO3Mxdp.js +1 -0
  150. package/dist/web/assets/{session-launch-offers-2SxrTwBr.js → session-launch-offers-X9b0DwF1.js} +1 -1
  151. package/dist/web/assets/{settings-restart-fHB-lEm8.js → settings-restart-BnwcTv3i.js} +1 -1
  152. package/dist/web/assets/shared-report-BxNVLalR.js +3 -0
  153. package/dist/web/assets/{source-adapters-TLaUKVEM.js → source-adapters-aupsL146.js} +1 -1
  154. package/dist/web/assets/{switch-Cq1rT1Ti.js → switch-B3Y3oE_n.js} +1 -1
  155. package/dist/web/assets/{tabs-B8ccOT5z.js → tabs-BlcZiEMY.js} +1 -1
  156. package/dist/web/assets/{task-card-fields-BkwTMtq6.js → task-card-fields-DAx6zMLz.js} +1 -1
  157. package/dist/web/assets/{task-labels-CVomryt6.js → task-labels-BdDFvSAy.js} +1 -1
  158. package/dist/web/assets/{task-reason-BenU3Ly4.js → task-reason-7WnPreht.js} +1 -1
  159. package/dist/web/assets/{team-sheets-BIFVatFG.js → team-sheets-Cr0ZTPw3.js} +1 -1
  160. package/dist/web/assets/{textarea-CEokSlpT.js → textarea-CRzFqL9a.js} +1 -1
  161. package/dist/web/assets/{ui-Pf0_u3Mo.js → ui-BopQuQfc.js} +1 -1
  162. package/dist/web/assets/{useAgentRecords-B0ODDGeO.js → useAgentRecords-CMtpd3Fj.js} +1 -1
  163. package/dist/web/assets/{useAgentWorkSummary-CNoUxwOW.js → useAgentWorkSummary-BQbhaHov.js} +1 -1
  164. package/dist/web/assets/{useApi-CROJJdhE-CbQwoO_u.js → useApi-CROJJdhE-CRCgNOqq.js} +1 -1
  165. package/dist/web/assets/{useClipboardCopy-Dd9bf8dt.js → useClipboardCopy-DkqKK3wY.js} +1 -1
  166. package/dist/web/assets/{useFocusReturn-DFHFciMS.js → useFocusReturn-BZpVmQnM.js} +1 -1
  167. package/dist/web/assets/{useForwardExpose-D3bCxDJx.js → useForwardExpose-Di-MnbTz.js} +1 -1
  168. package/dist/web/assets/{useForwardPropsEmits-CshHUE63.js → useForwardPropsEmits-L9XcB5DG.js} +1 -1
  169. package/dist/web/assets/useForwardScopeId-CUQFIAIj.js +1 -0
  170. package/dist/web/assets/{useKnowledgeItemPeek-24H5cZzL.js → useKnowledgeItemPeek-PmQJixw5.js} +1 -1
  171. package/dist/web/assets/{useMinimumLoadingDisplay-Br2MBA-0.js → useMinimumLoadingDisplay-CWPiOaDl.js} +1 -1
  172. package/dist/web/assets/{useProjectAgentRoster-BLHF34Hj.js → useProjectAgentRoster-CWVpSsQ3.js} +1 -1
  173. package/dist/web/assets/{useRoutePeek-KvY9hOQI.js → useRoutePeek-DxLVksbJ.js} +1 -1
  174. package/dist/web/assets/useTeamPeople-CDISP0PM.js +1 -0
  175. package/dist/web/assets/{useTeamWork-wKGBRcNv.js → useTeamWork-BTZd_wKs.js} +1 -1
  176. package/dist/web/assets/{useTypeahead-C50w2tTI.js → useTypeahead-pEZNpBls.js} +1 -1
  177. package/dist/web/assets/{utils-_mWlJRpS.js → utils-B4pBTmyh.js} +1 -1
  178. package/dist/web/assets/{utils-CArDYAhe.js → utils-BsxOjD1Q.js} +1 -1
  179. package/dist/web/assets/version-db3QWWjt.js +1 -0
  180. package/dist/web/assets/{vue-router-BzQKabzW.js → vue-router-B79HWW1l.js} +1 -1
  181. package/dist/web/assets/website-YgovUEcN.js +1 -0
  182. package/dist/web/index.html +65 -64
  183. package/docs/client-connections.md +3 -2
  184. package/docs/employee-agents.md +1 -1
  185. package/docs/judgment-and-autonomy.md +2 -2
  186. package/graph-provider/fuli_graph/app.py +4 -0
  187. package/graph-provider/fuli_graph/graph_field_contract.py +10 -2
  188. package/graph-provider/fuli_graph/graph_format_migrations.py +10 -0
  189. package/graph-provider/fuli_graph/knowledge_index_scan.py +120 -0
  190. package/graph-provider/fuli_graph/knowledge_retrieval_models.py +95 -0
  191. package/graph-provider/fuli_graph/knowledge_retrieval_terms.py +116 -0
  192. package/graph-provider/fuli_graph/knowledge_search.py +191 -31
  193. package/graph-provider/fuli_graph/knowledge_semantic.py +87 -0
  194. package/graph-provider/fuli_graph/knowledge_semantic_index.py +98 -0
  195. package/graph-provider/fuli_graph/knowledge_semantic_models.py +72 -0
  196. package/graph-provider/fuli_graph/knowledge_semantic_query.py +19 -0
  197. package/graph-provider/fuli_graph/models.py +4 -0
  198. package/graph-provider/fuli_graph/task_context_routes.py +1 -1
  199. package/graph-provider/pyproject.toml +1 -1
  200. package/native/win32/fuli-win-helper.exe +0 -0
  201. package/npm-shrinkwrap.json +2 -2
  202. package/package.json +1 -1
  203. package/skills/capturing-session-knowledge/SKILL.md +9 -5
  204. package/skills/capturing-session-knowledge/references/retrieval.md +2 -0
  205. package/skills/operating-fuli/SKILL.md +5 -1
  206. package/skills/operating-fuli/references/workflow-recipes.md +1 -1
  207. package/src/agent-kits/client-detection.js +7 -0
  208. package/src/agent-kits/client-installer.js +13 -0
  209. package/src/agent-tools/interface-catalog.js +6 -0
  210. package/src/agent-tools/model-backend-definitions.js +1 -1
  211. package/src/agents/claude-code/lifecycle-hook.js +1 -1
  212. package/src/agents/claude-code/transcript-format-probe.js +31 -0
  213. package/src/agents/codex/lifecycle-hook.js +1 -1
  214. package/src/agents/codex/transcript-format-probe.js +29 -0
  215. package/src/agents/transcript-format-registry.js +34 -0
  216. package/src/agents/transcript-format-scan.js +71 -0
  217. package/src/conversations/preference-lifecycle.js +2 -1
  218. package/src/conversations/reply-citations.js +21 -0
  219. package/src/conversations/stop-auto-close.js +21 -9
  220. package/src/dreaming/run.js +310 -0
  221. package/src/dreaming/scheduler.js +58 -0
  222. package/src/graphiti/current-project-knowledge-search.js +24 -1
  223. package/src/graphiti/federated-search.js +8 -1
  224. package/src/graphiti/provider-client.js +36 -0
  225. package/src/graphiti/task-entry-preferences.js +15 -2
  226. package/src/graphiti/task-entry-read-only.js +28 -0
  227. package/src/graphiti/task-knowledge-recall.js +19 -5
  228. package/src/http/api-router.js +11 -1
  229. package/src/http/dreaming-api-router.js +32 -0
  230. package/src/http/knowledge-item-api-router.js +7 -0
  231. package/src/http/retrieval-terms-api-router.js +37 -0
  232. package/src/http/semantic-api-router.js +26 -0
  233. package/src/local-runtime/lifecycle.js +3 -0
  234. package/src/local-runtime/windows-process-handle.js +9 -3
  235. package/src/mcp/process-registry.js +45 -3
  236. package/src/mcp/runtime.js +2 -1
  237. package/src/mcp/stdio-relay.js +4 -1
  238. package/src/model-backends/adapters/anthropic-messages.js +1 -1
  239. package/src/model-backends/adapters/exchange.js +2 -2
  240. package/src/model-backends/adapters/openai-chat.js +1 -1
  241. package/src/model-backends/adapters/openai-embeddings.js +60 -0
  242. package/src/model-backends/adapters/registry.js +3 -1
  243. package/src/model-backends/adapters/typesafe-systemone.js +1 -1
  244. package/src/model-backends/budget.js +14 -8
  245. package/src/model-backends/config.js +49 -15
  246. package/src/model-backends/decision-contract.js +2 -1
  247. package/src/model-backends/http.js +19 -1
  248. package/src/model-backends/model-fetch.js +37 -0
  249. package/src/model-backends/port.js +165 -67
  250. package/src/model-backends/prompt.js +4 -3
  251. package/src/model-backends/request.js +42 -3
  252. package/src/presence/windows-helper-pin.js +1 -1
  253. package/src/retrieval-terms/fill.js +102 -0
  254. package/src/retrieval-terms/runner.js +50 -0
  255. package/src/retrieval-terms/terms-model.js +99 -0
  256. package/src/semantic/scheduler.js +50 -0
  257. package/src/semantic/semantic-index.js +94 -0
  258. package/src/server.js +16 -1
  259. package/src/system/client-connection-status.js +6 -4
  260. package/src/system/doctor.js +62 -3
  261. package/src/system/mcp-process-scan.js +55 -0
  262. package/src/system/system-service.js +23 -5
  263. package/dist/web/assets/AboutSectionHeading-CiD3M3eG.css +0 -1
  264. package/dist/web/assets/AboutSectionHeading-w5P9g9WB.js +0 -1
  265. package/dist/web/assets/AgentManagement-VWpTW_38.js +0 -7
  266. package/dist/web/assets/AgentMentionCopy-DI23ym95.js +0 -1
  267. package/dist/web/assets/AgentProfilePage-DrqWGjqt.js +0 -5
  268. package/dist/web/assets/DataFormatPage-0Ne27K6I.css +0 -1
  269. package/dist/web/assets/DataFormatPage-D39VmkWL.js +0 -2
  270. package/dist/web/assets/FieldRoot-BZby7Lhw.js +0 -1
  271. package/dist/web/assets/HowtoPage-CKJAtKbM.js +0 -1
  272. package/dist/web/assets/KnowledgeItemEditPage-n0jtTdHB.js +0 -1
  273. package/dist/web/assets/KnowledgePage-CZ9oDt3D.js +0 -1
  274. package/dist/web/assets/KnowledgePeek-J6gHDda8.js +0 -1
  275. package/dist/web/assets/ModelSettingsPage-BwUnvtP6.js +0 -1
  276. package/dist/web/assets/ModelSettingsPage-ConWy_ec.css +0 -1
  277. package/dist/web/assets/PersonalProjectsPage-DM70jshg.js +0 -1
  278. package/dist/web/assets/SettingsPage-aRxdnfBu.js +0 -1
  279. package/dist/web/assets/UiDialog-Cbb3AvXb.js +0 -1
  280. package/dist/web/assets/UiIcon-o5x6Sf-c.js +0 -1
  281. package/dist/web/assets/WidgetSlot-URHq8Let.js +0 -2
  282. package/dist/web/assets/_plugin-vue_export-helper-PxAQThRD.js +0 -9
  283. package/dist/web/assets/agent-occupation-DM6nIHrD.js +0 -1
  284. package/dist/web/assets/combobox-BOXLFvvr.js +0 -1
  285. package/dist/web/assets/dropdown-menu-C0AuLdFm.js +0 -1
  286. package/dist/web/assets/index-CSV9nk7P.js +0 -2
  287. package/dist/web/assets/index-DFt6UfTv.css +0 -1
  288. package/dist/web/assets/label-table-BUAeArKh.js +0 -1
  289. package/dist/web/assets/popover-DyX7FE_t.js +0 -1
  290. package/dist/web/assets/select-CuhUd9VL.js +0 -1
  291. package/dist/web/assets/shared-report-BKhY4rtE.js +0 -3
  292. package/dist/web/assets/useForwardScopeId-Bzm9IM9h.js +0 -1
  293. package/dist/web/assets/useTeamPeople-IATXewrX.js +0 -1
  294. package/dist/web/assets/version-Cw272WBv.js +0 -1
@@ -4,7 +4,8 @@ import { refuseRemoteDecision } from '../http/request-policy.js';
4
4
  import { readJson, sendJson } from '../http/response.js';
5
5
  import { confirmConsoleOwner } from '../knowledge-owner-reads/owner-proof.js';
6
6
  import { positiveInteger } from '../validation/values.js';
7
- import { MODEL_BACKEND_ROLES } from './config.js';
7
+ import { MODEL_BACKEND_ROLES, SEMANTIC_ROLE } from './config.js';
8
+ import { compactReceipt } from './receipt.js';
8
9
  import { MAX_HISTORY_LIMIT } from './settings-history.js';
9
10
  import { RETENTION } from './suggestion-log.js';
10
11
 
@@ -39,6 +40,7 @@ import { RETENTION } from './suggestion-log.js';
39
40
  // trust change answers whether its change was recorded there.
40
41
  const ROLE_ROUTE = /^\/api\/model-backends\/roles\/([a-z]+)$/;
41
42
  const TRUST_ROUTE = /^\/api\/model-backends\/roles\/([a-z]+)\/trust$/;
43
+ const CHECK_ROUTE = /^\/api\/model-backends\/roles\/([a-z]+)\/check$/;
42
44
  const SUGGESTIONS_ROUTE = '/api/model-backends/suggestions';
43
45
  const HISTORY_ROUTE = '/api/model-backends/history';
44
46
  const READ_ROUTES = ['/api/model-backends/usage', '/api/model-backends/roles', SUGGESTIONS_ROUTE, HISTORY_ROUTE];
@@ -48,11 +50,27 @@ const TRUST_EDIT = z.union([
48
50
  z.object({ expectedRevision: revision, acknowledgeWarning: z.number().int().min(1) }).strict()
49
51
  ]);
50
52
 
53
+ // 测试连接 on the model page: one real request with the saved settings. The
54
+ // fixed check carries no project and nothing of the person's, as `fuli models check` does.
55
+ async function handleConnectionCheck({ request, response, modelBackends, role }) {
56
+ if (request.method !== 'POST') { sendJson(response, 405, { error: 'Method not allowed' }); return true; }
57
+ if (refuseRemoteDecision(request, response, 'A model is tested only on this computer')) return true;
58
+ if (!modelBackends) { sendJson(response, 503, { error: 'Model backends need a local FULI installation' }); return true; }
59
+ if (!MODEL_BACKEND_ROLES.includes(role)) throw new TypeError(`Unknown role: ${role}`);
60
+ const { modelReceipt, dimensions } = await modelBackends.checkConnection(role);
61
+ // The semantic role's check also says how long its vectors are; never the vector itself.
62
+ sendJson(response, 200, { ok: modelReceipt.status === 'completed', receipt: compactReceipt(modelReceipt),
63
+ ...(role === SEMANTIC_ROLE ? { dimensions: dimensions ?? null } : {}) });
64
+ return true;
65
+ }
66
+
51
67
  export async function handleModelBackendApiRequest({
52
68
  request, response, url, modelBackends, roleWork = null, readRoleSuggestions = null, roleSettings = null, operations = {},
53
69
  automaticOperations = {}, modelTrust = null, settingsHistory = null, readEvaluation = null, ownerReads = null,
54
70
  personalSpaceId = null
55
71
  }) {
72
+ const checked = CHECK_ROUTE.exec(url.pathname)?.[1] ?? null;
73
+ if (checked) return handleConnectionCheck({ request, response, modelBackends, role: checked });
56
74
  const roleEdit = ROLE_ROUTE.exec(url.pathname)?.[1] ?? null;
57
75
  const trustEdit = TRUST_ROUTE.exec(url.pathname)?.[1] ?? null;
58
76
  if (!roleEdit && !trustEdit && !READ_ROUTES.includes(url.pathname)) return false;
@@ -0,0 +1,37 @@
1
+ import { request as httpRequest } from 'node:http';
2
+ import { request as httpsRequest } from 'node:https';
3
+ import { Readable } from 'node:stream';
4
+
5
+ // fetch refuses the ports browsers block, such as 6665 to 6669, with "bad port".
6
+ // That rule protects web pages from other protocols; a model server the person
7
+ // set up on one of those ports is simply where their model lives. Such a call
8
+ // goes through node:http instead, unchanged: it follows no redirect, so the
9
+ // refusal in no-redirect-fetch.js still applies.
10
+ const NULL_BODY_STATUSES = new Set([204, 205, 304]);
11
+
12
+ export async function modelFetch(url, init = {}) {
13
+ try {
14
+ return await globalThis.fetch(url, init);
15
+ } catch (error) {
16
+ if (error?.cause?.message !== 'bad port') throw error;
17
+ return sendOverNodeHttp(url, init);
18
+ }
19
+ }
20
+
21
+ function sendOverNodeHttp(url, { method = 'GET', headers = {}, body, signal }) {
22
+ const send = new URL(url).protocol === 'https:' ? httpsRequest : httpRequest;
23
+ return new Promise((resolve, reject) => {
24
+ // No pooled socket: a server that closed one between calls would read as a network fault.
25
+ const outgoing = send(url, { method, headers, signal, agent: false }, (incoming) => {
26
+ const received = new Headers();
27
+ for (const [name, value] of Object.entries(incoming.headers)) {
28
+ for (const item of [value].flat()) received.append(name, item);
29
+ }
30
+ resolve(new Response(NULL_BODY_STATUSES.has(incoming.statusCode) ? null : Readable.toWeb(incoming),
31
+ { status: incoming.statusCode, headers: received }));
32
+ });
33
+ // As fetch does: a cut request fails with why it was cut, which tells a timeout from a network fault.
34
+ outgoing.on('error', error => reject(signal?.aborted ? signal.reason : error));
35
+ outgoing.end(body);
36
+ });
37
+ }
@@ -1,17 +1,22 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import { setTimeout as delay } from 'node:timers/promises';
3
+ import { modelFetch } from './model-fetch.js';
3
4
 
4
5
  import { MODEL_ADAPTERS } from './adapters/registry.js';
5
6
  import { budgetBlock, callLimits, ceilingCost, estimateCost, estimateTokens, roundCost, windowStart } from './budget.js';
6
- import { MODEL_BACKEND_ROLES, configRevision, connectionIdentity } from './config.js';
7
+ import { MODEL_BACKEND_ROLES, SEMANTIC_ROLE, configRevision, connectionIdentity } from './config.js';
7
8
  import { decisionContract, decisionEnvelope } from './decision-contract.js';
8
9
  import { egressAllowed } from './egress.js';
9
10
  import { FAILURE_STATUS, isFallbackEligible, modelFailure } from './failures.js';
10
11
  import { decisionPrompt, promptForMode, repairTurns } from './prompt.js';
11
- import { CONNECTION_CHECK, connectionCheckRequest, parseDecisionRequest, parseUsageQuery } from './request.js';
12
+ import {
13
+ CONNECTION_CHECK, connectionCheckRequest, embeddingCheckRequest, embeddingEgress, parseDecisionRequest, parseEmbeddingRequest,
14
+ parseUsageQuery
15
+ } from './request.js';
12
16
  import { reportedUsage } from './usage.js';
13
17
 
14
- // The shared model port of the four built-in Agents (rec#8, D-04). It owns
18
+ // The shared model port of the four built-in Agents (rec#8, D-04), and of
19
+ // the person's semantic search model (rec#88), which only embeds. It owns
15
20
  // configuration, egress, budget, bounded retry and repair, strict output
16
21
  // validation and the usage ledger; protocol differences stay in adapters.
17
22
  // It returns the compact decision envelope and a model receipt; it never
@@ -36,21 +41,46 @@ const USAGE_NOTES = 'One record per actual model API attempt; requests count dis
36
41
  + 'cachedInput, cacheWriteInput and reasoning are subsets of input or output as each provider defines them and are never added to totals. '
37
42
  + 'Costs are estimates from configured unit prices only; without prices the cost is unknown.';
38
43
 
39
- export function createModelBackendPort({ readConfig, secrets, ledger, fetchImpl = globalThis.fetch, wait = delay,
44
+ export function createModelBackendPort({ readConfig, secrets, ledger, fetchImpl = modelFetch, wait = delay,
40
45
  now = () => new Date(), timeoutSignal = ms => AbortSignal.timeout(ms) }) {
41
46
  // Endpoints that rejected json_schema output, for this process.
42
47
  const promptOnly = new Set();
43
48
 
44
- async function run(request) {
45
- const startedAt = now().getTime();
46
- const attempts = [];
47
- let target = null;
48
- let roleConfig = null;
49
- let mode = null;
50
- let reportedConfidence = null;
49
+ // What every call needs before its first attempt: the role's enabled
50
+ // settings for this operation, its connection and adapter, the egress
51
+ // approval and the key, kept on the call. Answers { stop } with the result
52
+ // that ends the call, or { adapter, secret }.
53
+ async function prepare(request, call, { approved }) {
54
+ const loaded = readConfig();
55
+ if (loaded.state === 'absent') return { stop: call.notConfigured('no_config') };
56
+ if (loaded.state === 'invalid') return { stop: call.stop('configuration', 'invalid_config') };
57
+ call.roleConfig = loaded.config.roles[request.role] ?? null;
58
+ if (!call.roleConfig) return { stop: call.notConfigured('role_not_configured') };
59
+ if (!call.roleConfig.enabled) return { stop: call.notConfigured('role_disabled') };
60
+ if (request.operation !== CONNECTION_CHECK && !call.roleConfig.allowedOperations.includes(request.operation)) {
61
+ return { stop: call.notConfigured('operation_not_allowed') };
62
+ }
63
+ call.target = { id: call.roleConfig.connection, ...loaded.config.connections[call.roleConfig.connection] };
64
+ const adapter = MODEL_ADAPTERS[call.target.protocol];
65
+ if (!approved.supports(adapter)) return { stop: call.stop('configuration', 'unsupported_output') };
66
+ if (!approved.egress(call.roleConfig.egress)) return { stop: call.stop('refusal', 'egress_not_approved') };
67
+ if (!call.target.secretRef) return { adapter, secret: null };
68
+ let secret;
69
+ try {
70
+ secret = await secrets.read(call.target.secretRef);
71
+ } catch (error) {
72
+ return { stop: call.stop('configuration', error?.code === 'secret_store_insecure' ? 'secret_store_insecure' : 'secret_unreadable') };
73
+ }
74
+ return secret ? { adapter, secret } : { stop: call.stop('configuration', 'missing_key') };
75
+ }
51
76
 
52
- const receipt = (status, { reason = null, failure = null } = {}) => {
53
- const fallbackEligible = failure ? isFallbackEligible(failure, roleConfig) : false;
77
+ // The receipt of one call and the results that end it. empty is the
78
+ // result without an answer, to which each ending adds its receipt.
79
+ function callRecord(empty) {
80
+ const call = { startedAt: now().getTime(), attempts: [], target: null, roleConfig: null, mode: null, reportedConfidence: null };
81
+ call.receipt = (status, { reason = null, failure = null } = {}) => {
82
+ const { target, attempts } = call;
83
+ const fallbackEligible = failure ? isFallbackEligible(failure, call.roleConfig) : false;
54
84
  return {
55
85
  backend: 'model_api', status, reason: failure?.reason ?? reason, failureClass: failure?.failureClass ?? null,
56
86
  fallbackEligible, fallbackReason: fallbackEligible ? failure.reason : null,
@@ -58,44 +88,53 @@ export function createModelBackendPort({ readConfig, secrets, ledger, fetchImpl
58
88
  // Which configured connection was asked (config.js connectionIdentity); a role's trust gate compares it.
59
89
  connectionIdentity: target ? connectionIdentity(target.id, target) : null,
60
90
  actualModel: attempts.findLast(attempt => attempt.actualModel)?.actualModel ?? null,
61
- outputMode: attempts.length ? mode : null, attempts: attempts.length, usage: receiptUsage(attempts),
62
- reportedConfidence, durationMs: now().getTime() - startedAt
91
+ outputMode: attempts.length ? call.mode : null, attempts: attempts.length, usage: receiptUsage(attempts),
92
+ reportedConfidence: call.reportedConfidence, durationMs: now().getTime() - call.startedAt
63
93
  };
64
94
  };
65
- const notConfigured = reason => ({ envelope: null, modelReceipt: receipt('not_configured', { reason }) });
66
- const fail = failure => ({ envelope: null, modelReceipt: receipt(FAILURE_STATUS[failure.failureClass], { failure }) });
67
- const stop = (failureClass, reason) => fail(modelFailure(failureClass, reason));
95
+ call.notConfigured = reason => ({ ...empty, modelReceipt: call.receipt('not_configured', { reason }) });
96
+ call.fail = failure => ({ ...empty, modelReceipt: call.receipt(FAILURE_STATUS[failure.failureClass], { failure }) });
97
+ call.stop = (failureClass, reason) => call.fail(modelFailure(failureClass, reason));
98
+ return call;
99
+ }
68
100
 
69
- const loaded = readConfig();
70
- if (loaded.state === 'absent') return notConfigured('no_config');
71
- if (loaded.state === 'invalid') return stop('configuration', 'invalid_config');
72
- roleConfig = loaded.config.roles[request.role] ?? null;
73
- if (!roleConfig) return notConfigured('role_not_configured');
74
- if (!roleConfig.enabled) return notConfigured('role_disabled');
75
- if (request.operation !== CONNECTION_CHECK && !roleConfig.allowedOperations.includes(request.operation)) {
76
- return notConfigured('operation_not_allowed');
77
- }
78
- target = { id: roleConfig.connection, ...loaded.config.connections[roleConfig.connection] };
79
- const adapter = MODEL_ADAPTERS[target.protocol];
80
- if (!adapter.supports(request)) return stop('configuration', 'unsupported_output');
81
- if (!egressAllowed(request, roleConfig.egress)) return stop('refusal', 'egress_not_approved');
101
+ // An attempt as the ledger keeps it before it goes out: metadata only,
102
+ // never prompt text, texts or vectors. Reserves its ceiling in the role's
103
+ // window and answers the reason it may not start, or null.
104
+ function reserveAttempt(request, call, { purpose, inputTokens, maxOutputTokens, remainingMs }) {
105
+ const { target, roleConfig } = call;
106
+ const attemptStarted = now();
107
+ const pending = {
108
+ requestId: request.requestId, attemptId: randomUUID(), attemptNumber: call.attempts.length + 1, purpose, channel: 'model_api',
109
+ role: request.role, operation: request.operation, personalSpaceId: request.scope.personalSpaceId,
110
+ personalProjectId: request.scope.personalProjectId, connectionId: target.id, protocol: target.protocol,
111
+ endpointHost: new URL(target.endpoint).host, endpoint: target.endpoint, requestedModel: target.model, outputMode: call.mode,
112
+ startedAt: attemptStarted.toISOString(), budgetCeilingTokens: inputTokens + maxOutputTokens,
113
+ costCurrency: target.pricing?.currency ?? null
114
+ };
115
+ const blocked = ledger.reserve({ attempt: pending, ceilingCost: ceilingCost(target.pricing, inputTokens, maxOutputTokens),
116
+ expiresAt: new Date(attemptStarted.getTime() + remainingMs + RESERVATION_GRACE_MS).toISOString(),
117
+ since: windowStart(roleConfig.budget, attemptStarted), now: attemptStarted.toISOString(),
118
+ check: window => budgetBlock({ budget: roleConfig.budget, pricing: target.pricing, window,
119
+ estimatedInputTokens: inputTokens, maxOutputTokens }) });
120
+ return { pending, attemptStarted, blocked };
121
+ }
82
122
 
83
- let secret = null;
84
- if (target.secretRef) {
85
- try {
86
- secret = await secrets.read(target.secretRef);
87
- } catch (error) {
88
- return stop('configuration', error?.code === 'secret_store_insecure' ? 'secret_store_insecure' : 'secret_unreadable');
89
- }
90
- if (!secret) return stop('configuration', 'missing_key');
91
- }
123
+ async function run(request) {
124
+ const call = callRecord({ envelope: null });
125
+ const { stop, fail } = call;
126
+ const prepared = await prepare(request, call, { approved: {
127
+ supports: adapter => adapter.supports(request), egress: egress => egressAllowed(request, egress) } });
128
+ if (prepared.stop) return prepared.stop;
129
+ const { adapter, secret } = prepared;
130
+ const { target, roleConfig, attempts, startedAt } = call;
92
131
 
93
132
  const contract = decisionContract(request);
94
133
  const prompt = decisionPrompt(request, contract.providerSchema);
95
134
  const limits = callLimits(roleConfig.budget, request.budget);
96
135
  const deadline = startedAt + limits.timeoutMs;
97
136
  const formatKey = `${target.protocol} ${target.endpoint} ${target.model}`;
98
- mode = adapter.outputMode === 'json_schema' && promptOnly.has(formatKey) ? 'prompt' : adapter.outputMode;
137
+ call.mode = adapter.outputMode === 'json_schema' && promptOnly.has(formatKey) ? 'prompt' : adapter.outputMode;
99
138
  let turns = prompt.turns;
100
139
  let purpose = 'initial';
101
140
  let retries = 0;
@@ -106,30 +145,18 @@ export function createModelBackendPort({ readConfig, secrets, ledger, fetchImpl
106
145
  if (remainingMs < MIN_ATTEMPT_MS) return stop('transient', 'timeout');
107
146
  // Each attempt is checked as it will go out: a repair adds turns and
108
147
  // prompt mode writes the schema into the prompt.
109
- const outgoing = promptForMode({ ...prompt, turns }, mode);
148
+ const outgoing = promptForMode({ ...prompt, turns }, call.mode);
110
149
  const inputTokens = estimateTokens(outgoing);
111
150
  if (inputTokens > limits.maxInputTokens) return stop('budget_exhausted', 'per_call_input');
112
151
 
113
- const attemptStarted = now();
114
- const pending = {
115
- requestId: request.requestId, attemptId: randomUUID(), attemptNumber: attempts.length + 1, purpose, channel: 'model_api',
116
- role: request.role, operation: request.operation, personalSpaceId: request.scope.personalSpaceId,
117
- personalProjectId: request.scope.personalProjectId, connectionId: target.id, protocol: target.protocol,
118
- endpointHost: new URL(target.endpoint).host, endpoint: target.endpoint, requestedModel: target.model, outputMode: mode,
119
- startedAt: attemptStarted.toISOString(), budgetCeilingTokens: inputTokens + limits.maxOutputTokens,
120
- costCurrency: target.pricing?.currency ?? null
121
- };
122
- const blocked = ledger.reserve({ attempt: pending, ceilingCost: ceilingCost(target.pricing, inputTokens, limits.maxOutputTokens),
123
- expiresAt: new Date(attemptStarted.getTime() + remainingMs + RESERVATION_GRACE_MS).toISOString(),
124
- since: windowStart(roleConfig.budget, attemptStarted), now: attemptStarted.toISOString(),
125
- check: window => budgetBlock({ budget: roleConfig.budget, pricing: target.pricing, window,
126
- estimatedInputTokens: inputTokens, maxOutputTokens: limits.maxOutputTokens }) });
152
+ const { pending, attemptStarted, blocked } = reserveAttempt(request, call,
153
+ { purpose, inputTokens, maxOutputTokens: limits.maxOutputTokens, remainingMs });
127
154
  if (blocked) return stop('budget_exhausted', blocked);
128
155
 
129
156
  let result;
130
157
  const attemptSignal = timeoutSignal(remainingMs);
131
158
  try {
132
- result = await adapter.call({ connection: target, secret, request, mode, signal: attemptSignal,
159
+ result = await adapter.call({ connection: target, secret, request, mode: call.mode, signal: attemptSignal,
133
160
  prompt: outgoing, maxOutputTokens: limits.maxOutputTokens, fetchImpl });
134
161
  } catch (error) {
135
162
  ledger.settleUnknown(pending, { durationMs: now().getTime() - attemptStarted.getTime(), failureReason: 'attempt_error' });
@@ -151,26 +178,88 @@ export function createModelBackendPort({ readConfig, secrets, ledger, fetchImpl
151
178
  attempts.push(attempt);
152
179
 
153
180
  if (verdict.ok) {
154
- reportedConfidence = result.reportedConfidence ?? null;
155
- return { envelope: decisionEnvelope(request, verdict.value), modelReceipt: receipt('completed') };
181
+ call.reportedConfidence = result.reportedConfidence ?? null;
182
+ return { envelope: decisionEnvelope(request, verdict.value), modelReceipt: call.receipt('completed') };
156
183
  }
157
184
  if (verdict.issues) {
185
+ // JSON outside the schema means the endpoint took the schema and ignored
186
+ // it, as some gateways do: later calls get it in the prompt.
187
+ if (verdict.offSchema && call.mode === 'json_schema') promptOnly.add(formatKey);
158
188
  if (!adapter.repairable || repairs >= REPAIR_LIMIT) return stop('configuration', 'invalid_output');
159
189
  repairs += 1;
160
190
  purpose = 'repair';
161
- turns = repairTurns(turns, result.reply ?? '', verdict.issues);
191
+ turns = repairTurns(turns, result.reply ?? '', verdict.issues, prompt.schema);
162
192
  continue;
163
193
  }
164
194
  const { failure } = verdict;
165
- if (failure.reason === 'unsupported_response_format' && mode === 'json_schema') {
195
+ if (failure.reason === 'unsupported_response_format' && call.mode === 'json_schema') {
166
196
  promptOnly.add(formatKey);
167
- mode = 'prompt';
197
+ call.mode = 'prompt';
168
198
  purpose = 'format_fallback';
169
199
  continue;
170
200
  }
171
- if (failure.failureClass !== 'transient' || retries >= TRANSIENT_RETRY_LIMIT) return fail(failure);
172
- const pauseMs = failure.retryAfterMs ?? BASE_BACKOFF_MS * 2 ** retries;
173
- if (now().getTime() + pauseMs + MIN_ATTEMPT_MS > deadline) return fail(failure);
201
+ const pauseMs = retryPause(failure, retries, deadline);
202
+ if (pauseMs === null) return fail(failure);
203
+ retries += 1;
204
+ purpose = 'retry';
205
+ await wait(pauseMs);
206
+ }
207
+ }
208
+
209
+ // How long to wait before retrying a failed attempt, or null when it is
210
+ // not retried: not transient, out of retries, or past the deadline.
211
+ function retryPause(failure, retries, deadline) {
212
+ if (failure.failureClass !== 'transient' || retries >= TRANSIENT_RETRY_LIMIT) return null;
213
+ const pauseMs = failure.retryAfterMs ?? BASE_BACKOFF_MS * 2 ** retries;
214
+ return now().getTime() + pauseMs + MIN_ATTEMPT_MS > deadline ? null : pauseMs;
215
+ }
216
+
217
+ // The semantic role's call (rec#88): its texts as vectors, whole or not at
218
+ // all. The same settings, egress, budget, retry and ledger as a decision;
219
+ // no repair, and no fallback, because a session cannot embed. Texts and
220
+ // vectors never reach the ledger or a log.
221
+ async function embedTexts(request) {
222
+ const call = callRecord({ vectors: null, dimensions: null, model: null });
223
+ const { stop, fail } = call;
224
+ const prepared = await prepare(request, call, { approved: {
225
+ supports: adapter => typeof adapter.embed === 'function', egress: egress => egressAllowed(embeddingEgress(request), egress) } });
226
+ if (prepared.stop) return prepared.stop;
227
+ const { adapter, secret } = prepared;
228
+ const { target, roleConfig, attempts, startedAt } = call;
229
+ call.mode = adapter.outputMode;
230
+ const limits = callLimits(roleConfig.budget, request.budget);
231
+ const deadline = startedAt + limits.timeoutMs;
232
+ const inputTokens = estimateTokens(request.texts);
233
+ if (inputTokens > limits.maxInputTokens) return stop('budget_exhausted', 'per_call_input');
234
+ let purpose = 'initial';
235
+ let retries = 0;
236
+
237
+ for (;;) {
238
+ const remainingMs = deadline - now().getTime();
239
+ if (remainingMs < MIN_ATTEMPT_MS) return stop('transient', 'timeout');
240
+ const { pending, attemptStarted, blocked } = reserveAttempt(request, call, { purpose, inputTokens, maxOutputTokens: 0, remainingMs });
241
+ if (blocked) return stop('budget_exhausted', blocked);
242
+ let result;
243
+ try {
244
+ result = await adapter.embed({ connection: target, secret, texts: request.texts, signal: timeoutSignal(remainingMs), fetchImpl });
245
+ } catch (error) {
246
+ ledger.settleUnknown(pending, { durationMs: now().getTime() - attemptStarted.getTime(), failureReason: 'attempt_error' });
247
+ throw error;
248
+ }
249
+ const failure = result.ok ? null : result.failure;
250
+ const attempt = {
251
+ ...pending, actualModel: result.actualModel, durationMs: now().getTime() - attemptStarted.getTime(),
252
+ outcome: failure ? 'failed' : 'succeeded', failureClass: failure?.failureClass ?? null, failureReason: failure?.reason ?? null,
253
+ usage: result.usage, estimatedCost: estimateCost(result.usage, target.pricing)
254
+ };
255
+ ledger.settle(attempt);
256
+ attempts.push(attempt);
257
+ if (!failure) {
258
+ return { vectors: result.vectors, dimensions: result.dimensions, model: result.actualModel ?? target.model,
259
+ modelReceipt: call.receipt('completed') };
260
+ }
261
+ const pauseMs = retryPause(failure, retries, deadline);
262
+ if (pauseMs === null) return fail(failure);
174
263
  retries += 1;
175
264
  purpose = 'retry';
176
265
  await wait(pauseMs);
@@ -191,11 +280,20 @@ export function createModelBackendPort({ readConfig, secrets, ledger, fetchImpl
191
280
  return run(parseDecisionRequest(input));
192
281
  }
193
282
 
283
+ // { role: 'semantic', operation: 'knowledge_embedding', requestId, scope,
284
+ // texts } with at most MAX_EMBEDDING_TEXTS texts, answering { vectors,
285
+ // dimensions, model, modelReceipt }; vectors is null unless it completed.
286
+ async function embed(input) {
287
+ return embedTexts(parseEmbeddingRequest(input));
288
+ }
289
+
194
290
  return {
195
291
  decide,
292
+ embed,
196
293
  // A user-run check with fixed synthetic text: it carries no project or
197
294
  // user content, so any enabled role may run it within its own budget.
198
- checkConnection: role => decide(connectionCheckRequest(role)),
295
+ // The semantic role embeds its one short text instead of deciding.
296
+ checkConnection: role => (role === SEMANTIC_ROLE ? embedTexts(embeddingCheckRequest()) : decide(connectionCheckRequest(role))),
199
297
  usage(input) {
200
298
  const query = parseUsageQuery(input);
201
299
  const loaded = readConfig();
@@ -235,7 +333,7 @@ export function createModelBackendPort({ readConfig, secrets, ledger, fetchImpl
235
333
  // disabled or no longer allowed the operation allows nothing.
236
334
  allowsEgress(request) {
237
335
  const settings = this.operationSettings(request.role, request.operation);
238
- return Boolean(settings) && egressAllowed(request, settings.egress);
336
+ return Boolean(settings) && egressAllowed(request.texts ? embeddingEgress(request) : request, settings.egress);
239
337
  },
240
338
  // What Settings shows of the local build behind a role's latest answer
241
339
  // on its configured endpoint and model (rec#10 D-32). An observation of
@@ -30,9 +30,10 @@ export function promptForMode(prompt, mode) {
30
30
  : prompt;
31
31
  }
32
32
 
33
- // The one bounded repair: the model sees its reply and why it was rejected.
34
- export function repairTurns(turns, reply, issues) {
33
+ // The one bounded repair: the model sees its reply, why it was rejected and the
34
+ // schema, which an endpoint that ignored it never showed.
35
+ export function repairTurns(turns, reply, issues, schema) {
35
36
  return [...turns,
36
37
  { role: 'assistant', text: reply.slice(0, REPAIR_ECHO_CHARS) || '(empty reply)' },
37
- { role: 'user', text: `Your previous reply was not valid: ${issues.join('; ')}. Reply again with only the corrected JSON object.` }];
38
+ { role: 'user', text: `Your previous reply was not valid: ${issues.join('; ')}. Reply again with only the corrected JSON object. It must match this JSON schema: ${JSON.stringify(schema)}` }];
38
39
  }
@@ -1,7 +1,7 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import { z } from 'zod';
3
3
 
4
- import { MODEL_BACKEND_ROLES, OPERATION_PATTERN } from './config.js';
4
+ import { KNOWLEDGE_EMBEDDING_OPERATION, MODEL_BACKEND_ROLES, OPERATION_PATTERN, SEMANTIC_ROLE } from './config.js';
5
5
  import { DECISIONS, DEFAULT_DECISIONS } from './decision-contract.js';
6
6
 
7
7
  // Caller input of the model port. Invalid input is a programming error and
@@ -10,6 +10,12 @@ import { DECISIONS, DEFAULT_DECISIONS } from './decision-contract.js';
10
10
  // so the egress check sees it; instructions and options are operation text.
11
11
 
12
12
  export const CONNECTION_CHECK = 'connection_check';
13
+ // The most texts one embedding call sends; a caller batches longer lists.
14
+ const MAX_EMBEDDING_TEXTS = 64;
15
+ const MAX_EMBEDDING_TEXT_CHARS = 20_000;
16
+ const CHECK_TEXT = 'FULI connection check.';
17
+ // The built-in Agents decide; the semantic role only embeds.
18
+ const DECISION_ROLES = MODEL_BACKEND_ROLES.filter(role => role !== SEMANTIC_ROLE);
13
19
 
14
20
  const id = z.string().trim().min(1).max(256);
15
21
  const key = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9:._-]{0,127}$/);
@@ -23,12 +29,14 @@ const outputSchema = z.discriminatedUnion('type', [
23
29
  z.object({ type: z.literal('structured'), schema: z.looseObject({}) }).strict()
24
30
  ]);
25
31
 
32
+ const scopeSchema = z.object({ personalSpaceId: id, personalProjectId: id.nullable(), sessionRef: id.nullable() }).strict();
33
+
26
34
  const requestSchema = z.object({
27
- role: z.enum(MODEL_BACKEND_ROLES),
35
+ role: z.enum(DECISION_ROLES),
28
36
  operation: z.string().regex(OPERATION_PATTERN),
29
37
  requestId: id,
30
38
  sourceEventId: id.nullable().default(null),
31
- scope: z.object({ personalSpaceId: id, personalProjectId: id.nullable(), sessionRef: id.nullable() }).strict(),
39
+ scope: scopeSchema,
32
40
  versions: z.object({ evidence: id, policy: id }).strict(),
33
41
  instructions: z.string().trim().min(1).max(4000),
34
42
  evidence: z.array(z.object({ id: key, personalProjectId: id.nullable(), text: z.string().trim().min(1).max(20_000) }).strict())
@@ -40,6 +48,17 @@ const requestSchema = z.object({
40
48
  .partial().strict().default({})
41
49
  }).strict();
42
50
 
51
+ // Every text belongs to the request's project, or to none.
52
+ const embeddingSchema = z.object({
53
+ role: z.literal(SEMANTIC_ROLE),
54
+ operation: z.literal(KNOWLEDGE_EMBEDDING_OPERATION),
55
+ requestId: id,
56
+ scope: scopeSchema,
57
+ texts: z.array(z.string().trim().min(1).max(MAX_EMBEDDING_TEXT_CHARS)).min(1).max(MAX_EMBEDDING_TEXTS),
58
+ // A search waits only so long for its query's vector, then goes on by words.
59
+ budget: z.object({ timeoutMs: z.number().int().positive() }).strict().optional()
60
+ }).strict();
61
+
43
62
  const usageQuerySchema = z.object({
44
63
  role: z.enum(MODEL_BACKEND_ROLES).nullable().default(null),
45
64
  from: isoTime.nullable().default(null),
@@ -58,6 +77,18 @@ export function parseDecisionRequest(input) {
58
77
  return parse(requestSchema, input, 'model decision request');
59
78
  }
60
79
 
80
+ export function parseEmbeddingRequest(input) {
81
+ return parse(embeddingSchema, input, 'embedding request');
82
+ }
83
+
84
+ // What the egress check sees of an embedding request: each text as an item
85
+ // of the request's project. The connection check's fixed text is nobody's
86
+ // content, so it carries none.
87
+ export function embeddingEgress(request) {
88
+ const items = request.operation === CONNECTION_CHECK ? [] : request.texts;
89
+ return { scope: request.scope, evidence: items.map(() => ({ personalProjectId: request.scope.personalProjectId })) };
90
+ }
91
+
61
92
  export function parseRoleWorkClaim(input) {
62
93
  return parse(claimSchema, input, 'role work claim');
63
94
  }
@@ -83,6 +114,14 @@ export function connectionCheckRequest(role) {
83
114
  };
84
115
  }
85
116
 
117
+ // The semantic role's check: one short fixed text, no project.
118
+ export function embeddingCheckRequest() {
119
+ return {
120
+ role: SEMANTIC_ROLE, operation: CONNECTION_CHECK, requestId: `${CONNECTION_CHECK}:${randomUUID()}`,
121
+ scope: { personalSpaceId: 'connection-check', personalProjectId: null, sessionRef: null }, texts: [CHECK_TEXT]
122
+ };
123
+ }
124
+
86
125
  function parse(schema, input, label) {
87
126
  const result = schema.safeParse(input);
88
127
  if (!result.success) {
@@ -3,4 +3,4 @@
3
3
  // and writes its digest here before publishing (scripts/pin-win-helper.js); a
4
4
  // source checkout has no helper and no pin, so Windows Hello is unavailable there.
5
5
  // The helper is not Authenticode-signed: this digest is its only integrity check.
6
- export const WIN_HELPER_SHA256 = '610ce29169c643a0ccb336a5c36edec2c4a56c0b7afbac9c1114e90337f8618c';
6
+ export const WIN_HELPER_SHA256 = '1bcf9774d56aca66a91d229525522b8514dfa96b4ace9709aeef2ba941a3c488';
@@ -0,0 +1,102 @@
1
+ import { askQuestions, askTerms, termsReadiness } from './terms-model.js';
2
+
3
+ // Filling retrieval terms for old knowledge (rec#92). Three steps the person
4
+ // takes one at a time: counting what lacks terms costs nothing; a self-test
5
+ // on a small sample measures, with real searches, how many more items are
6
+ // found and what one item costs; then a fill writes terms for the rest. The
7
+ // self-test writes the sample's terms too, so nothing it paid for is lost.
8
+
9
+ export const SAMPLE_SIZE = 20;
10
+ const BATCH = 16;
11
+ const TOP = 5;
12
+ // The self-test's advice: when items are already found this often, terms are
13
+ // not needed; a gain this large is worth the fill.
14
+ const ALREADY_FOUND = 0.9;
15
+ const WORTH_GAIN = 0.15;
16
+ // Before any self-test: characters per token of mixed Chinese and English,
17
+ // and the instructions and answer each item adds.
18
+ const CHARS_PER_TOKEN = 2;
19
+ const TOKENS_PER_ITEM = 80;
20
+
21
+ export async function termsStats(application, personalProjectId) {
22
+ const stats = await application.personal.retrievalStats({ personalSpaceId: spaceOf(application), personalProjectId });
23
+ const missing = stats.items - stats.with_terms;
24
+ return { ...stats, missing, roughTokens: Math.round(stats.missing_chars / CHARS_PER_TOKEN + missing * TOKENS_PER_ITEM) };
25
+ }
26
+
27
+ export async function trialTerms(application, { personalProjectId, now = () => new Date() }) {
28
+ const readiness = termsReadiness(application, personalProjectId);
29
+ if (readiness !== 'ready') return { status: readiness };
30
+ const personalSpaceId = spaceOf(application);
31
+ const { items: candidates } = await application.personal.retrievalCandidates({
32
+ personalSpaceId, personalProjectId, limit: SAMPLE_SIZE, missingOnly: true });
33
+ if (!candidates.length) return { status: 'nothing_missing' };
34
+ const questions = await askQuestions(application, { personalProjectId, candidates });
35
+ if (!questions.byId.size) return { status: 'model_failed', reason: questions.reason };
36
+ const before = await found(application, personalProjectId, questions.byId);
37
+ const terms = await askTerms(application, { personalProjectId, candidates });
38
+ if (!terms.byId.size) return { status: 'model_failed', reason: terms.reason, tokens: { trial: questions.tokens } };
39
+ const written = await writeTerms(application, candidates, terms.byId);
40
+ const after = await found(application, personalProjectId, questions.byId);
41
+ const stats = await termsStats(application, personalProjectId);
42
+ const perItem = Math.ceil(terms.tokens / candidates.length);
43
+ const sample = questions.byId.size;
44
+ return { status: 'tested', at: now().toISOString(), personalProjectId, sample, before, after,
45
+ written: written.written, remaining: stats.missing,
46
+ tokens: { trial: questions.tokens + terms.tokens, perItem, projected: perItem * stats.missing },
47
+ advice: advice(before / sample, after / sample) };
48
+ }
49
+
50
+ // Terms for every item of the project still without them, a batch per call.
51
+ export async function fillTerms(application, { personalProjectId, signal = null, onProgress = () => {} }) {
52
+ const counts = { written: 0, skipped: 0, tokens: 0 };
53
+ let after = null;
54
+ do {
55
+ if (signal?.aborted) return { status: 'stopped', ...counts };
56
+ if (termsReadiness(application, personalProjectId) !== 'ready') return { status: 'superseded', ...counts };
57
+ const page = await application.personal.retrievalCandidates({
58
+ personalSpaceId: spaceOf(application), personalProjectId, limit: BATCH, missingOnly: true,
59
+ ...(after ? { after } : {}) });
60
+ if (page.items.length) {
61
+ const terms = await askTerms(application, { personalProjectId, candidates: page.items });
62
+ counts.tokens += terms.tokens;
63
+ if (!terms.byId.size) return { status: 'model_failed', reason: terms.reason, ...counts };
64
+ const written = await writeTerms(application, page.items, terms.byId);
65
+ counts.written += written.written;
66
+ counts.skipped += page.items.length - written.written;
67
+ }
68
+ onProgress({ ...counts });
69
+ after = page.next ?? null;
70
+ } while (after);
71
+ return { status: 'done', ...counts };
72
+ }
73
+
74
+ export function advice(before, after) {
75
+ if (before >= ALREADY_FOUND) return 'not_needed';
76
+ if (after - before >= WORTH_GAIN) return 'fill';
77
+ return after > before ? 'optional' : 'not_worth';
78
+ }
79
+
80
+ async function writeTerms(application, candidates, byId) {
81
+ const items = candidates.filter(candidate => byId.has(candidate.item_id)).map((candidate) => {
82
+ const { terms, context } = byId.get(candidate.item_id);
83
+ return { item_kind: candidate.item_kind, item_id: candidate.item_id, hash: candidate.hash, terms,
84
+ ...(context ? { context } : {}) };
85
+ });
86
+ if (!items.length) return { written: 0 };
87
+ return application.personal.writeRetrievalTerms({ personalSpaceId: spaceOf(application), items });
88
+ }
89
+
90
+ // How many of the items their question finds in the top results, by words.
91
+ async function found(application, personalProjectId, questions) {
92
+ let hits = 0;
93
+ for (const [itemId, query] of questions) {
94
+ const result = await application.personal.search({ space_ids: [spaceOf(application)], query, limit: TOP,
95
+ personal_project_ids: [personalProjectId], active_personal_project_id: personalProjectId });
96
+ const ids = [...(result.entities ?? []), ...(result.facts ?? [])].map(row => row.id);
97
+ if (ids.includes(itemId)) hits += 1;
98
+ }
99
+ return hits;
100
+ }
101
+
102
+ const spaceOf = application => application.config.personal.spaceId;