fuli-context 0.23.0-beta.8 → 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.
- package/dist/web/assets/{AboutPage-BHbNacTY.js → AboutPage-S8QFfzpA.js} +1 -1
- package/dist/web/assets/AboutSectionHeading-B5CzH4Zs.js +1 -0
- package/dist/web/assets/AboutSectionHeading-DjXpIV27.css +1 -0
- package/dist/web/assets/AgentAppsPage-BYXraPFM.js +1 -0
- package/dist/web/assets/{AgentHand-BGzGOjzl.js → AgentHand-BGGdVdd9.js} +1 -1
- package/dist/web/assets/AgentManagement-Bza8k5ra.js +7 -0
- package/dist/web/assets/AgentManagement-CeF4mjtg.css +1 -0
- package/dist/web/assets/AgentMentionCopy-C72hY2QL.js +1 -0
- package/dist/web/assets/{AgentName-C5HzUHaA.js → AgentName-CUjBNQ8j.js} +1 -1
- package/dist/web/assets/AgentProfilePage-D5QUzw5N.css +1 -0
- package/dist/web/assets/AgentProfilePage-kp7-gRRx.js +5 -0
- package/dist/web/assets/AgentServicesPage-IsGaz7FY.js +1 -0
- package/dist/web/assets/{AppViewerPage-N5C_6WLz.css → AppViewerPage-CJ0Zy6LA.css} +1 -1
- package/dist/web/assets/AppViewerPage-CcOlwxck.js +1 -0
- package/dist/web/assets/{BackToTop-SL4ai3_g.js → BackToTop-C3KYEoCW.js} +1 -1
- package/dist/web/assets/BoardCardFieldsMenu-BlBWT1j7.js +1 -0
- package/dist/web/assets/BoardMoveMenu-Bc7xC1Uh.js +1 -0
- package/dist/web/assets/Breadcrumb-BbwBNrG2.css +1 -0
- package/dist/web/assets/Breadcrumb-C_xMiD-Z.js +1 -0
- package/dist/web/assets/CaptureChangePage-Bekp1aWg.js +1 -0
- package/dist/web/assets/ConnectionsPage-BpvecWXD.js +1 -0
- package/dist/web/assets/{CopyFixPrompt-CCrPxN5x.js → CopyFixPrompt-Bp-UX4Hq.js} +1 -1
- package/dist/web/assets/DataFormatPage-dsy8d3oA.js +2 -0
- package/dist/web/assets/DataFormatPage-sSnjjUY4.css +1 -0
- package/dist/web/assets/DebugTurnPage-HdFAyc2D.css +1 -0
- package/dist/web/assets/DebugTurnPage-cIJV7xDW.js +1 -0
- package/dist/web/assets/DebugTurnsPage-B6Te_Alp.js +1 -0
- package/dist/web/assets/DebugTurnsPage-BFuOzyWR.css +1 -0
- package/dist/web/assets/{DialogTitle-CTKjDGQc.js → DialogTitle-Lj5s6nwG.js} +1 -1
- package/dist/web/assets/EmployeeRedirectPage-DnvwJeCN.js +1 -0
- package/dist/web/assets/EmployeeScopeDialog-CXNZ62Ab.js +1 -0
- package/dist/web/assets/EmployeeWorkbench-BhReI8l6.css +1 -0
- package/dist/web/assets/EmployeeWorkbench-DALIO-cM.js +4 -0
- package/dist/web/assets/FieldRoot-DRnAC66O.js +1 -0
- package/dist/web/assets/FlaGrowth-7wlv31Tl.js +1 -0
- package/dist/web/assets/FlaGrowth-BzXY8pcx.css +1 -0
- package/dist/web/assets/FlaTaskSheets-CNdaBy1P.js +1 -0
- package/dist/web/assets/FlasPage-BCs1Ffpf.js +1 -0
- package/dist/web/assets/{FlasPage-Cb6Q5lge.css → FlasPage-SLQDMv47.css} +1 -1
- package/dist/web/assets/{button-CaCh3Iim.css → GrowthLoading-CigPij0N.css} +1 -1
- package/dist/web/assets/GrowthLoading-Cr8xZwwO.js +1 -0
- package/dist/web/assets/HowtoPage-Cv1YQy1s.js +1 -0
- package/dist/web/assets/{HowtoPage-BRV2W1Go.css → HowtoPage-t12tDDpS.css} +1 -1
- package/dist/web/assets/{InboxPage-DSOmt6VL.js → InboxPage-CgJnymOY.js} +2 -2
- package/dist/web/assets/KnowledgeDeleteButton-FEyEvhlR.js +1 -0
- package/dist/web/assets/KnowledgeHardDeleteSection-CVwTeMEJ.js +1 -0
- package/dist/web/assets/KnowledgeItemEditPage-rwpM8cF1.js +1 -0
- package/dist/web/assets/{KnowledgeItemSummaryCard-D1h0e1Hn.js → KnowledgeItemSummaryCard-49EADY_Z.js} +1 -1
- package/dist/web/assets/KnowledgeOrganizerPage-7IdnjM3L.js +1 -0
- package/dist/web/assets/KnowledgePage-gxqOIZxf.js +1 -0
- package/dist/web/assets/KnowledgePeek-Bm5jRVA9.css +1 -0
- package/dist/web/assets/KnowledgePeek-CQyCxHFj.js +1 -0
- package/dist/web/assets/KnowledgeTurnReceiptPage-BOz7IpaK.js +1 -0
- package/dist/web/assets/KnowledgeWorkspace-A7zVb26p.js +4 -0
- package/dist/web/assets/KnowledgeWorkspace-DCoVFyf0.css +1 -0
- package/dist/web/assets/{MeAvatar-DHJA3h2E.js → MeAvatar-CYVcRiuW.js} +1 -1
- package/dist/web/assets/{MeLink-CU7zuYgD.js → MeLink-BdqkzhT6.js} +1 -1
- package/dist/web/assets/{MenuSeparator-DV3U0Y8_.js → MenuSeparator-quqkZZXY.js} +1 -1
- package/dist/web/assets/ModelSettingsPage-B8jC_uew.js +3 -0
- package/dist/web/assets/ModelSettingsPage-DhCn_SF6.css +1 -0
- package/dist/web/assets/{NotFoundPage-BMWxdf6r.js → NotFoundPage-Dmn32VWo.js} +1 -1
- package/dist/web/assets/OccupationsPage-BVREfX_R.js +1 -0
- package/dist/web/assets/OverviewPage-CHyEbdP4.js +1 -0
- package/dist/web/assets/OverviewPage-xdF5g6bZ.css +1 -0
- package/dist/web/assets/{PageColumns-D7jIeVv6.js → PageColumns-DpfaPeu7.js} +1 -1
- package/dist/web/assets/PageOutline-BKBQ1T4d.js +1 -0
- package/dist/web/assets/PageOutline-BqVgnlos.css +1 -0
- package/dist/web/assets/PersonalProfilePage-Cxp2gn6J.js +1 -0
- package/dist/web/assets/PersonalProjectsPage-821imOxR.js +1 -0
- package/dist/web/assets/{PinIcon-DzYhXU_p.js → PinIcon-B7dvh7ld.js} +1 -1
- package/dist/web/assets/{PopperContent-BnejG-fO.js → PopperContent-DNqbLkNa.js} +1 -1
- package/dist/web/assets/{Presence-o9BoSyBV.js → Presence-D3HKb5Hb.js} +1 -1
- package/dist/web/assets/ProfileAuthorChip-7HSHODdR.js +1 -0
- package/dist/web/assets/ProfileAuthorChip-C_0hzDoP.css +1 -0
- package/dist/web/assets/ProjectAgentsPage-DBsXS6Xa.js +5 -0
- package/dist/web/assets/{ProjectAgentsPage-Dt37ogX1.css → ProjectAgentsPage-RpfiV2Fm.css} +1 -1
- package/dist/web/assets/ProjectJudgmentPolicy-GA33aSRi.js +2 -0
- package/dist/web/assets/PublicProjectsPage-PJlBI8IE.js +1 -0
- package/dist/web/assets/{RoundtablesPage-C6vo4kl6.css → RoundtablesPage-DK9A9J-y.css} +1 -1
- package/dist/web/assets/{RoundtablesPage-B2mqkwwR.js → RoundtablesPage-DT5DUXsa.js} +2 -2
- package/dist/web/assets/{RovingFocusGroup-CKxT5j44.js → RovingFocusGroup-BB0d3k17.js} +1 -1
- package/dist/web/assets/{RovingFocusItem-Cr-XrVve.js → RovingFocusItem-CFd7tXzD.js} +1 -1
- package/dist/web/assets/SessionMigrationPage-BZ1lEDQr.js +1 -0
- package/dist/web/assets/SessionRecordsPage-BMAAtIAt.js +1 -0
- package/dist/web/assets/SettingsPage-BYNEk6BM.js +1 -0
- package/dist/web/assets/SettingsPage-Uj1IpZpS.css +1 -0
- package/dist/web/assets/SharedJefaReportPage-g35o6jUb.js +1 -0
- package/dist/web/assets/TagVocabularyPage-COubNJXz.js +1 -0
- package/dist/web/assets/{TaskBlockerClear-38qdj0bl.js → TaskBlockerClear-B5MpHdlh.js} +1 -1
- package/dist/web/assets/{TaskBlockerNotice--X8TtCGj.js → TaskBlockerNotice-CIN0HRiE.js} +1 -1
- package/dist/web/assets/{TaskReason-COiuiZVd.js → TaskReason-LQ0CFiKu.js} +1 -1
- package/dist/web/assets/{TeamCard-Bl4riuQt.css → TeamCard-CsmWDw2Q.css} +1 -1
- package/dist/web/assets/TeamCard-D-kLa5rT.js +1 -0
- package/dist/web/assets/TeamCardsWidget-DGX9k0S6.js +1 -0
- package/dist/web/assets/{TeamIsland-D8ycFpkZ.js → TeamIsland-BIo-l49b.js} +2 -2
- package/dist/web/assets/{Teleport-BAIkXp2z.js → Teleport-C1upABpY.js} +1 -1
- package/dist/web/assets/{TextField-BFGv0VA5.js → TextField-ZnmRqG0h.js} +1 -1
- package/dist/web/assets/{UiChip-h_SUumBM.js → UiChip-CizeOu1Q.js} +1 -1
- package/dist/web/assets/UiDialog-CGTzxn3-.js +1 -0
- package/dist/web/assets/{UiDisclosure-BO5EAYyS.js → UiDisclosure-ueMA4jl0.js} +1 -1
- package/dist/web/assets/UiIcon-sD1hUsOF.js +1 -0
- package/dist/web/assets/{UiIconButton-C0WP-F-p.js → UiIconButton-CCo4NPYv.js} +1 -1
- package/dist/web/assets/{UiNotice-NCEwjNQR.js → UiNotice-DGPFbVo7.js} +1 -1
- package/dist/web/assets/{UiSegmented-B49yYjJ3.js → UiSegmented-BZ-jqnPE.js} +1 -1
- package/dist/web/assets/{UiWeight-DRIwuLUX.js → UiWeight-BRO3oVMZ.js} +1 -1
- package/dist/web/assets/{VirtualDirectoryList-Dieq64pn.js → VirtualDirectoryList-BkV3gj5E.js} +1 -1
- package/dist/web/assets/{VisuallyHidden-DIWFV5lV.js → VisuallyHidden-B8wfJ_mU.js} +1 -1
- package/dist/web/assets/{VisuallyHiddenInput-WxcAZDj2.js → VisuallyHiddenInput-Bdcr9CwC.js} +1 -1
- package/dist/web/assets/WidgetSlot-DFojQaSo.js +2 -0
- package/dist/web/assets/_plugin-vue_export-helper-B9AJmZbc.js +9 -0
- package/dist/web/assets/{agent-apps-CXhZLNMa.js → agent-apps-CKGFfySp.js} +1 -1
- package/dist/web/assets/{agent-avatar-xTnj6P4n.js → agent-avatar-V6M_DF3r.js} +1 -1
- package/dist/web/assets/agent-occupation-PZ2YAIM8.js +1 -0
- package/dist/web/assets/{agent-pins-CMBM9w6b.js → agent-pins-8KX0ynzy.js} +1 -1
- package/dist/web/assets/agent-profile-Clb-gYu-.css +1 -0
- package/dist/web/assets/{agent-roster-records-pCYzR1as.js → agent-roster-records-PfAgndHp.js} +1 -1
- package/dist/web/assets/{agent-workflows-IeF737kp.js → agent-workflows-DQlqVOoA.js} +1 -1
- package/dist/web/assets/{attach-closest-edge-B34lttZK.js → attach-closest-edge-D2qlayPy.js} +1 -1
- package/dist/web/assets/{attention-store-BTKBC8TZ.js → attention-store-BnZ8l3kk.js} +1 -1
- package/dist/web/assets/{badge-Bnc2nVhV.js → badge-DX_xrLV6.js} +1 -1
- package/dist/web/assets/button-CEkPBC1E.js +1 -0
- package/dist/web/assets/button-CoXXgtY5.css +1 -0
- package/dist/web/assets/{card-B2JIXyum.js → card-DNQ0_6vT.js} +1 -1
- package/dist/web/assets/{catalog-C8eUDXUx.js → catalog-KnpBkv5t.js} +1 -1
- package/dist/web/assets/{checkbox-Blw3CguI.js → checkbox-DPyLHneg.js} +1 -1
- package/dist/web/assets/{client-AaxCWoEF.js → client-CSQcWFRh.js} +2 -2
- package/dist/web/assets/client-connection-model-vO2cap6a.js +1 -0
- package/dist/web/assets/{client-links-store-CmP5Qsfa.js → client-links-store-DMqe0MbK.js} +1 -1
- package/dist/web/assets/combobox-zUq9bkyM.js +1 -0
- package/dist/web/assets/{console-DtxpKdVW.js → console-DaoAO-EO.js} +1 -1
- package/dist/web/assets/{context-menu-DSGaOBX2.js → context-menu-CcGDnF_k.js} +1 -1
- package/dist/web/assets/{conversation-launcher-settings-DAL9Kf4y.js → conversation-launcher-settings-CXFE-q_A.js} +1 -1
- package/dist/web/assets/{dialog-CwFuZvhM.js → dialog-CxhKMo0D.js} +1 -1
- package/dist/web/assets/dist-B9GqMC5C.js +1 -0
- package/dist/web/assets/dist-DIJqkL4O.js +1 -0
- package/dist/web/assets/dropdown-menu-CXmMnCBh.js +1 -0
- package/dist/web/assets/field-LNsBZqam.js +1 -0
- package/dist/web/assets/{format-bytes-N7zRFzUD.js → format-bytes-Bqefdt37.js} +1 -1
- package/dist/web/assets/{identity-BUFzZs1s.js → identity-DRfhWjty.js} +1 -1
- package/dist/web/assets/index-B4AMPpl_.css +1 -0
- package/dist/web/assets/index-BYIOAXnn.js +2 -0
- package/dist/web/assets/{input-Db1wVnd4.js → input-UoZ-0Xne.js} +1 -1
- package/dist/web/assets/{label--RjFNYxb.js → label-DpjbTOxt.js} +1 -1
- package/dist/web/assets/label-table-BnWNYfyk.js +1 -0
- package/dist/web/assets/{model-crzN3PVX.js → model-13BQndfF.js} +1 -1
- package/dist/web/assets/{model-KuA63FiT.js → model-B5g0CFcM.js} +1 -1
- package/dist/web/assets/model-BYKHVgJr.js +1 -0
- package/dist/web/assets/{model-B5f68kqL.js → model-CDevUwUw.js} +1 -1
- package/dist/web/assets/model-CpuIG8Du.js +4 -0
- package/dist/web/assets/{model-B5dQs6Zt.js → model-P5fSGsiJ.js} +1 -1
- package/dist/web/assets/{model-DOf6QDiY.js → model-pJ6k3zYD.js} +1 -1
- package/dist/web/assets/{motion-CeLn8y1x.js → motion-C-ZimCUS.js} +1 -1
- package/dist/web/assets/{motion-wEp9RlID.js → motion-QY5FKKko.js} +1 -1
- package/dist/web/assets/{motion-preference-DfUreaML.js → motion-preference-BQiiwhab.js} +1 -1
- package/dist/web/assets/{occupation-catalog-Crs_Zc8R.js → occupation-catalog-uDDhZwKK.js} +1 -1
- package/dist/web/assets/{option-DCSIgajR.js → option-CcHPBOo6.js} +1 -1
- package/dist/web/assets/{orchestration-filters-Cu9KEzWE.js → orchestration-filters-DmF4Qs8E.js} +1 -1
- package/dist/web/assets/{page-title-Bvm24KbY.js → page-title-NXphgeQI.js} +1 -1
- package/dist/web/assets/{person-profile-Cf0Sytyw.js → person-profile-DXXfpvta.js} +1 -1
- package/dist/web/assets/popover-xSRzcSmY.js +1 -0
- package/dist/web/assets/popup-host-Bmvrf-2t.js +1 -0
- package/dist/web/assets/{profile-model-DkDH6Qth.js → profile-model-6gTmScHC.js} +1 -1
- package/dist/web/assets/{project-board-layout-OeuzohUI.js → project-board-layout-DBQeP_QP.js} +1 -1
- package/dist/web/assets/{project-capture-BQAqeAJf.js → project-capture-BhYsDWwJ.js} +1 -1
- package/dist/web/assets/{project-origin-CENDtRuK.js → project-origin-D8jy8EF_.js} +1 -1
- package/dist/web/assets/{quick-edit-api-Qndjqk1h.js → quick-edit-api-WLh_88w6.js} +1 -1
- package/dist/web/assets/{radio-group-pfWejLFt.js → radio-group-B4r78nDh.js} +1 -1
- package/dist/web/assets/{role-names-aIXV-sMx.js → role-names-PECaMfQo.js} +1 -1
- package/dist/web/assets/{roundtable-live-D7Asm_GB.js → roundtable-live-DFeDF56c.js} +1 -1
- package/dist/web/assets/{runtime-dom.esm-bundler-BS2lpl87.js → runtime-dom.esm-bundler-f39i44Mt.js} +1 -1
- package/dist/web/assets/save-file-rPduHi2f.js +1 -0
- package/dist/web/assets/select-_JO3Mxdp.js +1 -0
- package/dist/web/assets/{session-launch-offers-kLW-dRsW.js → session-launch-offers-X9b0DwF1.js} +1 -1
- package/dist/web/assets/settings-restart-BnwcTv3i.js +1 -0
- package/dist/web/assets/shared-report-BxNVLalR.js +3 -0
- package/dist/web/assets/shared-report-mYIyRY9C.css +1 -0
- package/dist/web/assets/{source-adapters-CUxqZHz7.js → source-adapters-aupsL146.js} +1 -1
- package/dist/web/assets/{switch-Cdz4-JcE.js → switch-B3Y3oE_n.js} +1 -1
- package/dist/web/assets/{tabs-C3w1-eMu.js → tabs-BlcZiEMY.js} +1 -1
- package/dist/web/assets/{task-board-model-DSr4P56O.js → task-board-model-CmMKsWdY.js} +1 -1
- package/dist/web/assets/task-card-fields-DAx6zMLz.js +1 -0
- package/dist/web/assets/task-labels-BdDFvSAy.js +1 -0
- package/dist/web/assets/{task-reason-BywD_kfi.js → task-reason-7WnPreht.js} +1 -1
- package/dist/web/assets/{team-sheets-D8Y--CP4.js → team-sheets-Cr0ZTPw3.js} +1 -1
- package/dist/web/assets/{textarea-C228nxbD.js → textarea-CRzFqL9a.js} +1 -1
- package/dist/web/assets/{ui-BM8jZcP6.js → ui-BopQuQfc.js} +1 -1
- package/dist/web/assets/{useAgentRecords-D7x4xQ9O.js → useAgentRecords-CMtpd3Fj.js} +1 -1
- package/dist/web/assets/{useAgentWorkSummary-pc1i6nr0.js → useAgentWorkSummary-BQbhaHov.js} +1 -1
- package/dist/web/assets/{useApi-CROJJdhE-DZtkWJZv.js → useApi-CROJJdhE-CRCgNOqq.js} +1 -1
- package/dist/web/assets/{useClipboardCopy-sTthF_MD.js → useClipboardCopy-DkqKK3wY.js} +1 -1
- package/dist/web/assets/{useFocusReturn-BoyUh5y3.js → useFocusReturn-BZpVmQnM.js} +1 -1
- package/dist/web/assets/{useForwardExpose-CqXuqZvd.js → useForwardExpose-Di-MnbTz.js} +1 -1
- package/dist/web/assets/{useForwardPropsEmits-0F_e7unJ.js → useForwardPropsEmits-L9XcB5DG.js} +1 -1
- package/dist/web/assets/useForwardScopeId-CUQFIAIj.js +1 -0
- package/dist/web/assets/useKnowledgeItemPeek-PmQJixw5.js +1 -0
- package/dist/web/assets/{useMinimumLoadingDisplay-CzfqbQPs.js → useMinimumLoadingDisplay-CWPiOaDl.js} +1 -1
- package/dist/web/assets/useProjectAgentRoster-CWVpSsQ3.js +1 -0
- package/dist/web/assets/{useRoutePeek-BDgll9Fy.js → useRoutePeek-DxLVksbJ.js} +1 -1
- package/dist/web/assets/useTeamPeople-CDISP0PM.js +1 -0
- package/dist/web/assets/{useTeamWork-BSFi27vj.js → useTeamWork-BTZd_wKs.js} +1 -1
- package/dist/web/assets/{useTypeahead-D_g4j3Xp.js → useTypeahead-pEZNpBls.js} +1 -1
- package/dist/web/assets/{utils-C6vsxGrE.js → utils-B4pBTmyh.js} +1 -1
- package/dist/web/assets/utils-BsxOjD1Q.js +1 -0
- package/dist/web/assets/version-db3QWWjt.js +1 -0
- package/dist/web/assets/{vue-router-BPhQ0Qow.js → vue-router-B79HWW1l.js} +1 -1
- package/dist/web/assets/website-YgovUEcN.js +1 -0
- package/dist/web/index.html +71 -66
- package/docs/agent-interface-architecture.md +13 -4
- package/docs/client-connections.md +3 -2
- package/docs/employee-agents.md +11 -9
- package/docs/judgment-and-autonomy.md +4 -4
- package/graph-provider/fuli_graph/app.py +4 -0
- package/graph-provider/fuli_graph/collaboration_context.py +3 -7
- package/graph-provider/fuli_graph/graph_field_contract.py +10 -2
- package/graph-provider/fuli_graph/graph_format_builtin_occupations.py +33 -1
- package/graph-provider/fuli_graph/graph_format_migrations.py +18 -0
- package/graph-provider/fuli_graph/graph_query.py +3 -12
- package/graph-provider/fuli_graph/knowledge_index_scan.py +120 -0
- package/graph-provider/fuli_graph/knowledge_outdated.py +9 -1
- package/graph-provider/fuli_graph/knowledge_retrieval_models.py +95 -0
- package/graph-provider/fuli_graph/knowledge_retrieval_terms.py +116 -0
- package/graph-provider/fuli_graph/knowledge_search.py +220 -39
- package/graph-provider/fuli_graph/knowledge_semantic.py +87 -0
- package/graph-provider/fuli_graph/knowledge_semantic_index.py +98 -0
- package/graph-provider/fuli_graph/knowledge_semantic_models.py +72 -0
- package/graph-provider/fuli_graph/knowledge_semantic_query.py +19 -0
- package/graph-provider/fuli_graph/knowledge_versions.py +14 -7
- package/graph-provider/fuli_graph/models.py +4 -0
- package/graph-provider/fuli_graph/occupation_catalog.py +6 -3
- package/graph-provider/fuli_graph/personal_global_preferences.py +3 -7
- package/graph-provider/fuli_graph/preference_versions.py +110 -0
- package/graph-provider/fuli_graph/project_agent_models.py +3 -0
- package/graph-provider/fuli_graph/project_agent_recruitment_occupation.py +1 -1
- package/graph-provider/fuli_graph/provider_values.py +7 -0
- package/graph-provider/fuli_graph/search_projection.py +2 -6
- package/graph-provider/fuli_graph/store_knowledge.py +10 -1
- package/graph-provider/fuli_graph/task_context_routes.py +1 -1
- package/graph-provider/pyproject.toml +1 -1
- package/native/win32/fuli-win-helper.exe +0 -0
- package/npm-shrinkwrap.json +3 -4
- package/package.json +2 -1
- package/skills/capturing-session-knowledge/SKILL.md +14 -7
- package/skills/capturing-session-knowledge/references/capture.md +12 -2
- package/skills/capturing-session-knowledge/references/retrieval.md +13 -4
- package/skills/grilling-project/SKILL.md +2 -0
- package/skills/operating-fuli/SKILL.md +36 -8
- package/skills/operating-fuli/references/workflow-recipes.md +10 -9
- package/src/agent-apps/host-tools/catalog.js +3 -0
- package/src/agent-delegation/agent-tool.js +12 -2
- package/src/agent-delegation/delegation-header.js +32 -8
- package/src/agent-delegation/entry-prompts.js +54 -0
- package/src/agent-delegation/operation-log.js +17 -7
- package/src/agent-delegation/person-words.js +38 -0
- package/src/agent-delegation/port.js +6 -4
- package/src/agent-delegation/refusals.js +14 -0
- package/src/agent-kits/client-detection.js +7 -0
- package/src/agent-kits/client-installer.js +13 -0
- package/src/agent-tools/delegation-definitions.js +5 -3
- package/src/agent-tools/diagnostic-definitions.js +23 -0
- package/src/agent-tools/graph-definitions.js +4 -0
- package/src/agent-tools/graph-handlers.js +6 -1
- package/src/agent-tools/interface-catalog.js +47 -17
- package/src/agent-tools/model-backend-definitions.js +1 -1
- package/src/agent-tools/old-data-definitions.js +16 -0
- package/src/agent-tools/task-entry-definitions.js +1 -1
- package/src/agent-tools/work-surface-definitions.js +1 -1
- package/src/agents/claude-code/lifecycle-hook.js +19 -5
- package/src/agents/claude-code/transcript-format-probe.js +31 -0
- package/src/agents/codex/lifecycle-hook.js +27 -7
- package/src/agents/codex/transcript-format-probe.js +29 -0
- package/src/agents/cursor/lifecycle-hook.js +4 -1
- package/src/agents/lifecycle-failure.js +27 -0
- package/src/agents/lifecycle-message.js +10 -0
- package/src/agents/opencode/lifecycle-hook.js +18 -2
- package/src/agents/transcript-format-registry.js +34 -0
- package/src/agents/transcript-format-scan.js +71 -0
- package/src/cli/command-registry.js +3 -0
- package/src/cli/diagnostics-command.js +59 -0
- package/src/cli/setup-command.js +3 -0
- package/src/cli.js +5 -0
- package/src/conversations/entry-budget.js +1 -1
- package/src/conversations/entry-detail-readers.js +22 -0
- package/src/conversations/entry-inline-budget.js +24 -12
- package/src/conversations/entry-skeleton.js +27 -9
- package/src/conversations/preference-lifecycle.js +2 -1
- package/src/conversations/preference-session.js +5 -2
- package/src/conversations/preference-snapshot.js +4 -1
- package/src/conversations/preference-view.js +5 -1
- package/src/conversations/reply-citations.js +21 -0
- package/src/conversations/stop-auto-close.js +21 -9
- package/src/conversations/task-context-view.js +31 -0
- package/src/data-format/backup-retention.js +8 -0
- package/src/data-format/local-stores.js +24 -2
- package/src/debug-turns/fuli-surface.js +23 -0
- package/src/debug-turns/model-capture.js +84 -0
- package/src/debug-turns/model-request.js +97 -0
- package/src/debug-turns/record.js +178 -0
- package/src/debug-turns/recorder.js +53 -0
- package/src/debug-turns/store.js +91 -0
- package/src/debug-turns/transcript-reader.js +64 -0
- package/src/debug-turns/trigger.js +25 -0
- package/src/diagnostics/agent-tool.js +14 -0
- package/src/diagnostics/event-log.js +133 -0
- package/src/diagnostics/failure-records.js +43 -0
- package/src/diagnostics/query.js +114 -0
- package/src/diagnostics/safe-event.js +83 -0
- package/src/dreaming/run.js +310 -0
- package/src/dreaming/scheduler.js +58 -0
- package/src/employees/builtin/jefa/board-store.js +78 -19
- package/src/employees/builtin/jefa/http.js +8 -5
- package/src/employees/builtin/jefa/project-board.js +2 -0
- package/src/employees/builtin/jefa/tools.js +7 -6
- package/src/employees/recruitment.js +20 -2
- package/src/employees/service.js +11 -1
- package/src/graphiti/agent-growth.js +64 -0
- package/src/graphiti/collaboration-preference-projection.js +7 -0
- package/src/graphiti/collaboration-preference-workflow.js +3 -3
- package/src/graphiti/current-project-knowledge-search.js +24 -1
- package/src/graphiti/federated-application.js +19 -1
- package/src/graphiti/federated-search.js +8 -1
- package/src/graphiti/local-runtimes.js +13 -0
- package/src/graphiti/personal-projects.js +11 -0
- package/src/graphiti/project-agent-mapping.js +1 -0
- package/src/graphiti/project-agent-task-sheets.js +6 -2
- package/src/graphiti/project-agent-workflows.js +22 -4
- package/src/graphiti/project-profile-authors.js +14 -7
- package/src/graphiti/provider-client.js +36 -0
- package/src/graphiti/session-knowledge-migration.js +103 -3
- package/src/graphiti/session-migration-notices.js +65 -0
- package/src/graphiti/session-records.js +22 -4
- package/src/graphiti/task-context-entry.js +5 -1
- package/src/graphiti/task-entry-preferences.js +31 -2
- package/src/graphiti/task-entry-read-only.js +28 -0
- package/src/graphiti/task-knowledge-checkpoint.js +2 -0
- package/src/graphiti/task-knowledge-recall.js +96 -19
- package/src/graphiti/task-remember.js +7 -2
- package/src/graphiti/task-update-request.js +13 -0
- package/src/graphiti/temporary-project-scope.js +7 -1
- package/src/graphiti/turn-receipt-delivery.js +5 -3
- package/src/http/agent-delegation-gate.js +5 -4
- package/src/http/agent-growth-api-router.js +17 -0
- package/src/http/api-router.js +18 -2
- package/src/http/capture-onboarding-api-router.js +3 -2
- package/src/http/debug-turns-api-router.js +70 -0
- package/src/http/diagnostic-events-api-router.js +27 -0
- package/src/http/dreaming-api-router.js +32 -0
- package/src/http/graph-api-router.js +35 -1
- package/src/http/knowledge-item-api-router.js +19 -2
- package/src/http/knowledge-scope-api-router.js +3 -2
- package/src/http/old-data-api-router.js +47 -0
- package/src/http/person-profile-api-router.js +3 -2
- package/src/http/retrieval-terms-api-router.js +37 -0
- package/src/http/semantic-api-router.js +26 -0
- package/src/judgment/agent-view.js +1 -1
- package/src/judgment/backend.js +30 -0
- package/src/judgment/http.js +2 -1
- package/src/judgment/review-prompt.js +2 -0
- package/src/judgment/routing.js +10 -2
- package/src/judgment/service.js +8 -2
- package/src/judgment/store.js +17 -7
- package/src/local-runtime/lifecycle.js +3 -0
- package/src/local-runtime/windows-process-handle.js +9 -3
- package/src/mcp/create-mcp-server.js +42 -25
- package/src/mcp/process-registry.js +45 -3
- package/src/mcp/runtime.js +2 -1
- package/src/mcp/stdio-relay.js +4 -1
- package/src/mcp/tool-annotations.js +2 -0
- package/src/model-backends/adapters/anthropic-messages.js +1 -1
- package/src/model-backends/adapters/exchange.js +2 -2
- package/src/model-backends/adapters/openai-chat.js +1 -1
- package/src/model-backends/adapters/openai-embeddings.js +60 -0
- package/src/model-backends/adapters/registry.js +3 -1
- package/src/model-backends/adapters/typesafe-systemone.js +1 -1
- package/src/model-backends/budget.js +14 -8
- package/src/model-backends/config.js +49 -15
- package/src/model-backends/decision-contract.js +2 -1
- package/src/model-backends/http.js +19 -1
- package/src/model-backends/model-fetch.js +37 -0
- package/src/model-backends/port.js +165 -67
- package/src/model-backends/prompt.js +4 -3
- package/src/model-backends/request.js +42 -3
- package/src/native-runtime/runtime.js +28 -4
- package/src/old-data/agent-tools.js +17 -0
- package/src/old-data/backup-reader.js +78 -0
- package/src/old-data/console-actions.js +53 -0
- package/src/old-data/guarded-stores.js +18 -0
- package/src/old-data/inventory.js +142 -0
- package/src/old-data/port.js +53 -0
- package/src/person-profile/port.js +2 -1
- package/src/presence/windows-helper-pin.js +1 -1
- package/src/project-change-log/port.js +65 -0
- package/src/project-change-log/store.js +60 -0
- package/src/retrieval-terms/fill.js +102 -0
- package/src/retrieval-terms/runner.js +50 -0
- package/src/retrieval-terms/terms-model.js +99 -0
- package/src/security/sensitive-content.js +11 -0
- package/src/semantic/scheduler.js +50 -0
- package/src/semantic/semantic-index.js +94 -0
- package/src/server.js +20 -1
- package/src/setup/paths.js +1 -1
- package/src/setup/setup.js +7 -0
- package/src/system/client-connection-status.js +6 -4
- package/src/system/doctor-repair.js +16 -4
- package/src/system/doctor.js +75 -3
- package/src/system/log-paths.js +11 -0
- package/src/system/log-retention.js +2 -8
- package/src/system/mcp-process-scan.js +55 -0
- package/src/system/resource-monitor.js +18 -2
- package/src/system/system-service.js +39 -7
- package/src/system/windows-data-acl.js +109 -0
- package/src/work-surfaces/port.js +17 -11
- package/src/work-surfaces/sources.js +4 -3
- package/dist/web/assets/AboutSectionHeading-BOXKE5Le.js +0 -1
- package/dist/web/assets/AboutSectionHeading-CiD3M3eG.css +0 -1
- package/dist/web/assets/AgentAppsPage-DS2X485q.js +0 -1
- package/dist/web/assets/AgentConversations-D7QJVFIo.js +0 -2
- package/dist/web/assets/AgentConversations-oZFXZE1X.css +0 -1
- package/dist/web/assets/AgentMentionCopy-O6pAjjYE.js +0 -1
- package/dist/web/assets/AgentProfilePage-CKCTcTzc.js +0 -2
- package/dist/web/assets/AgentProfilePage-D1ha8O3z.css +0 -1
- package/dist/web/assets/AgentServicesPage-C3npKkHp.js +0 -1
- package/dist/web/assets/AgentWorkbench-CJ4TYQA1.css +0 -1
- package/dist/web/assets/AgentWorkbench-D9HGRW-n.js +0 -2
- package/dist/web/assets/AppViewerPage-Al4TzYJF.js +0 -1
- package/dist/web/assets/BoardMoveMenu-ncWgEitd.js +0 -1
- package/dist/web/assets/Breadcrumb-QzjzIJdS.js +0 -1
- package/dist/web/assets/Breadcrumb-bsc0JKtG.css +0 -1
- package/dist/web/assets/CaptureChangePage-BQdqH2qC.js +0 -1
- package/dist/web/assets/ConnectionsPage-Be8jIb93.js +0 -1
- package/dist/web/assets/DataFormatPage-0Ne27K6I.css +0 -1
- package/dist/web/assets/DataFormatPage-C92rwzHa.js +0 -2
- package/dist/web/assets/EmployeeScopeDialog-DdR2DzcW.js +0 -1
- package/dist/web/assets/EmployeeTaskBoard-Bo8JT36K.js +0 -3
- package/dist/web/assets/EmployeeTaskBoard-Dljjy_L7.css +0 -1
- package/dist/web/assets/EmployeeWorkbenchPage-B249Mgle.js +0 -3
- package/dist/web/assets/EmployeeWorkbenchPage-BBjZJ6Od.css +0 -1
- package/dist/web/assets/FieldRoot-YdKVCBhW.js +0 -1
- package/dist/web/assets/FlaTaskSheets-Cm5SLq7J.js +0 -1
- package/dist/web/assets/FlasPage-C57gTN5X.js +0 -1
- package/dist/web/assets/HowtoPage-CDJScY6b.js +0 -1
- package/dist/web/assets/KnowledgeDeleteButton-5EtCPPl4.js +0 -1
- package/dist/web/assets/KnowledgeHardDeleteSection-r0lZ7ijb.js +0 -1
- package/dist/web/assets/KnowledgeItemEditPage-BStIRllM.js +0 -1
- package/dist/web/assets/KnowledgeOrganizerPage-BByk8hbw.js +0 -1
- package/dist/web/assets/KnowledgePage-DuWS3bRP.js +0 -1
- package/dist/web/assets/KnowledgePeek-BycBJ2xR.js +0 -1
- package/dist/web/assets/KnowledgePeek-EvumfJER.css +0 -1
- package/dist/web/assets/KnowledgeTurnReceiptPage-DTcDN-pG.js +0 -1
- package/dist/web/assets/KnowledgeWorkspace-CJo-6xdn.js +0 -4
- package/dist/web/assets/KnowledgeWorkspace-DPBq-At0.css +0 -1
- package/dist/web/assets/ModelSettingsPage-C1ghraAh.js +0 -1
- package/dist/web/assets/ModelSettingsPage-ConWy_ec.css +0 -1
- package/dist/web/assets/OccupationsPage-BY1jej7i.js +0 -1
- package/dist/web/assets/OverviewPage-C7YJf-Cq.css +0 -1
- package/dist/web/assets/OverviewPage-Dl-H0EBe.js +0 -1
- package/dist/web/assets/PersonalProfilePage-BcaVzKM6.js +0 -1
- package/dist/web/assets/PersonalProjectsPage-CO4ZYVAI.js +0 -1
- package/dist/web/assets/ProjectAgentDetailPage-Bgh78Mr5.js +0 -8
- package/dist/web/assets/ProjectAgentDetailPage-h7hr9iee.css +0 -1
- package/dist/web/assets/ProjectAgentDialog--T6mU-FW.css +0 -1
- package/dist/web/assets/ProjectAgentDialog-DzTor5ky.js +0 -5
- package/dist/web/assets/ProjectAgentsPage-CzN183pa.js +0 -1
- package/dist/web/assets/ProjectJudgmentPolicy-BMlEBJM3.js +0 -2
- package/dist/web/assets/PublicProjectsPage-DAHT31B8.js +0 -1
- package/dist/web/assets/SessionMigrationPage-IW07XhmD.js +0 -1
- package/dist/web/assets/SessionRecordsPage-Du76tewc.js +0 -1
- package/dist/web/assets/SettingsPage-CJNXe313.js +0 -1
- package/dist/web/assets/SettingsPage-D3AYCNTC.css +0 -1
- package/dist/web/assets/SharedJefaReportPage-dzHSSGhu.js +0 -1
- package/dist/web/assets/TagVocabularyPage-C_oV6GFs.js +0 -1
- package/dist/web/assets/TeamCard-CdO0RiNB.js +0 -1
- package/dist/web/assets/TeamCardsWidget-Cg_kJmb-.js +0 -1
- package/dist/web/assets/UiDialog-CUgrU6SQ.js +0 -1
- package/dist/web/assets/UiIcon-DPv0eZIU.js +0 -1
- package/dist/web/assets/WidgetSlot-BSU_-l_4.js +0 -2
- package/dist/web/assets/_plugin-vue_export-helper-DQENg-QE.js +0 -9
- package/dist/web/assets/agent-occupation-BvOgDW-q.js +0 -1
- package/dist/web/assets/agent-profile-BBqkfac0.css +0 -1
- package/dist/web/assets/agent-task-board-Cf9il_1i.js +0 -1
- package/dist/web/assets/button-N4FjuQuJ.js +0 -1
- package/dist/web/assets/client-connection-model-C3gpYYl7.js +0 -1
- package/dist/web/assets/combobox-DHwWXUpj.js +0 -1
- package/dist/web/assets/desktop-client-DnfjyLBX.js +0 -1
- package/dist/web/assets/dist-BInsvNsv.js +0 -1
- package/dist/web/assets/dist-Dc8jFf8M.js +0 -1
- package/dist/web/assets/field-BQLn7Hfw.js +0 -1
- package/dist/web/assets/index-CXPYDcyq.js +0 -2
- package/dist/web/assets/index-x95VDmzK.css +0 -1
- package/dist/web/assets/judgment-api-CK9yqrpU.js +0 -1
- package/dist/web/assets/label-table-KdyaCTvK.js +0 -1
- package/dist/web/assets/model-D4kKYvpj.js +0 -1
- package/dist/web/assets/popover-D4YFkL_5.js +0 -1
- package/dist/web/assets/project-board-settings-DPP6xKLz.js +0 -1
- package/dist/web/assets/project-team-api-7ybLH-uJ.js +0 -1
- package/dist/web/assets/save-file-CRxAsski.js +0 -1
- package/dist/web/assets/select-CUy1AIwE.js +0 -1
- package/dist/web/assets/settings-restart-JYH81qB-.js +0 -1
- package/dist/web/assets/shared-report-8p3nBKr-.js +0 -1
- package/dist/web/assets/source-coverage-4PsHC9TK.js +0 -1
- package/dist/web/assets/task-labels-CXBG2chm.js +0 -1
- package/dist/web/assets/useForwardScopeId-DVUFcuwO.js +0 -1
- package/dist/web/assets/useKnowledgeItemPeek-KZveY8Wz.js +0 -1
- package/dist/web/assets/useTeamPeople-Dna3Yrm3.js +0 -1
- package/dist/web/assets/utils-BX1QI2N6.js +0 -1
- package/dist/web/assets/version-CBPeq5nI.js +0 -1
|
@@ -3,6 +3,7 @@ import { containsEntryRules, DETAILS_GUIDANCE, ENTRY_RULES_URI, entryRules, entr
|
|
|
3
3
|
import { preferenceScopeGuidance } from '../graphiti/collaboration-preference-workflow.js';
|
|
4
4
|
import { copyPreferenceScope } from './preference-snapshot.js';
|
|
5
5
|
import { preferenceInstructionView } from './preference-view.js';
|
|
6
|
+
import { managerRead, memoryRead, teamRead } from './entry-detail-readers.js';
|
|
6
7
|
|
|
7
8
|
const SUMMARY_PREVIEW = 800;
|
|
8
9
|
const NOTE_COUNT_PREVIEW = 3;
|
|
@@ -79,9 +80,39 @@ export function compactTaskContext(value) {
|
|
|
79
80
|
}
|
|
80
81
|
if (share && result.project_agent_context) result.project_agent_context = withoutDefaults(result.project_agent_context,
|
|
81
82
|
{ flags: false, keep: AGENT_CONTEXT_STATES });
|
|
83
|
+
if (share && withoutTaskToken(value)) return copyPreferenceScope(value, withRulesVersion(onDemandDetails(result)));
|
|
82
84
|
return copyPreferenceScope(value, share ? withRulesVersion(result) : result);
|
|
83
85
|
}
|
|
84
86
|
|
|
87
|
+
// get_collaboration_preferences without a native session or prompt creates no
|
|
88
|
+
// task (task_lifecycle not_started), and its entry is re-read on every later
|
|
89
|
+
// model step. Such a turn cannot checkpoint, staff a grouped team or title a
|
|
90
|
+
// native session, so the details that serve those become the calls that read
|
|
91
|
+
// them: the memory layers keep their revision, the team its size, each manager
|
|
92
|
+
// its routing summary, and Tonborg the sentence assess_agent_action needs (it
|
|
93
|
+
// reads the saved policy itself). The directory snapshot mirrors the memory
|
|
94
|
+
// read. Preferences, conflicts, receipt, recall, IDs and lifecycle stay.
|
|
95
|
+
function withoutTaskToken(value) {
|
|
96
|
+
return value.task_lifecycle?.status === 'not_started' && !value.taskContextToken && !value.task_context_token;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function onDemandDetails(value) {
|
|
100
|
+
const continuity = value.project_agent_context;
|
|
101
|
+
const managers = value.project_management_context?.managers;
|
|
102
|
+
const layer = (field, personalProjectId) => Object.hasOwn(continuity, field) ? { [field]: continuity[field]
|
|
103
|
+
&& { revision: continuity[field].revision, view: 'omitted', read: memoryRead(value, personalProjectId) } } : {};
|
|
104
|
+
return { ...value,
|
|
105
|
+
...(continuity ? { project_agent_context: { ...continuity, directorySnapshot: undefined, team_guidance: undefined,
|
|
106
|
+
...layer('memory', value.context?.personal_project_id ?? null), ...layer('global_memory', null),
|
|
107
|
+
...(continuity.team ? { team: { roster_total: continuity.team.roster_total ?? continuity.team.roster?.length ?? 0,
|
|
108
|
+
read: teamRead(value) } } : {}) } } : {}),
|
|
109
|
+
...(managers ? { project_management_context: { ...value.project_management_context,
|
|
110
|
+
managers: managers.map(manager => withoutDefaults({ template_id: manager.template_id, agent_id: manager.agent_id,
|
|
111
|
+
name: manager.name, guidance: manager.guidance, read: managerRead(manager) })) } } : {}),
|
|
112
|
+
...(value.judgment_context ? { judgment_context: { agentId: value.judgment_context.agentId,
|
|
113
|
+
guidance: value.judgment_context.guidance } } : {}) };
|
|
114
|
+
}
|
|
115
|
+
|
|
85
116
|
// Every shared rule reference names the same rules version, so an entry with
|
|
86
117
|
// two or more states it once as rules_version (one costs less than the field).
|
|
87
118
|
// Preferences, recovered history and recalled items are data, never rule
|
|
@@ -95,6 +95,14 @@ export function pruneFormatBackups(dataDir, { policy = backupRetentionPolicy(),
|
|
|
95
95
|
return { pruned: events, kept: candidates.length - pruned.length, plannedBytesKept: total, sharedPruned, policy };
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
// Whether an undo, the store's latest ledger entry or its current version
|
|
99
|
+
// still needs this backup, as pruning decides; the person's 「立即删除」 of old
|
|
100
|
+
// data (src/old-data/console-actions.js) refuses such a backup.
|
|
101
|
+
export function formatBackupNeeded(dataDir, label, ref) {
|
|
102
|
+
const store = localStoreFiles(dataDir).find((candidate) => candidate.label === label);
|
|
103
|
+
return Boolean(store) && neededBackups(store, formatBackupsOf(store.path)).has(ref);
|
|
104
|
+
}
|
|
105
|
+
|
|
98
106
|
function neededBackups(store, backups) {
|
|
99
107
|
const everything = new Set(backups.map((backup) => backup.ref));
|
|
100
108
|
const needed = new Set();
|
|
@@ -13,6 +13,7 @@ import { AGENT_SERVICES_FORMAT } from '../agent-services/store.js';
|
|
|
13
13
|
import { AGENT_WORKFLOWS_FORMAT } from '../agent-workflows/store.js';
|
|
14
14
|
import { RECALL_IMPRESSIONS_FORMAT } from '../knowledge-impressions/store.js';
|
|
15
15
|
import { AGENT_AVATARS_FORMAT } from '../agent-avatars/store.js';
|
|
16
|
+
import { PROJECT_CHANGE_LOG_FORMAT } from '../project-change-log/store.js';
|
|
16
17
|
import { WORK_SURFACES_FORMAT } from '../work-surfaces/store.js';
|
|
17
18
|
import { EMPLOYEE_MANAGEMENT_FORMAT } from '../employees/management-policy.js';
|
|
18
19
|
import { JEFA_BOARD_FORMAT } from '../employees/builtin/jefa/board-store.js';
|
|
@@ -47,9 +48,13 @@ import { CLIENT_CONNECTION_HISTORY_FORMAT } from '../system/client-connection-st
|
|
|
47
48
|
import { RUNTIME_SETTINGS_FORMAT } from '../system/runtime-settings.js';
|
|
48
49
|
import { CLIENT_LINKS_STATE_FORMAT } from '../client-links/registry.js';
|
|
49
50
|
import { SESSION_CLIENT_FORMAT } from '../agent-kits/session-clients.js';
|
|
51
|
+
import { ENTRY_PROMPT_FORMAT } from '../agent-delegation/entry-prompts.js';
|
|
50
52
|
import { PERSON_PROFILE_FORMAT } from '../person-profile/port.js';
|
|
51
53
|
import { AGENT_DELEGATION_FORMAT } from '../agent-delegation/operation-log.js';
|
|
52
54
|
import { AGENT_DELEGATION_POLICY_FORMAT } from '../agent-delegation/policy-store.js';
|
|
55
|
+
import { DEBUG_TURN_FORMAT, DEBUG_TURN_PENDING_FORMAT } from '../debug-turns/store.js';
|
|
56
|
+
import { SESSION_MIGRATION_NOTICE_DIRECTORY, SESSION_MIGRATION_NOTICE_FORMAT } from '../graphiti/session-migration-notices.js';
|
|
57
|
+
import { DIAGNOSTICS_DIRECTORY, inspectDiagnosticEvents } from '../diagnostics/event-log.js';
|
|
53
58
|
|
|
54
59
|
// Every FULI store kept in one data directory, by the path its owner opens
|
|
55
60
|
// (rec#17 D-09). Labels are relative to the data directory, so a report names
|
|
@@ -77,6 +82,8 @@ const sqliteStores = () => [
|
|
|
77
82
|
['recall-impressions.sqlite', RECALL_IMPRESSIONS_FORMAT],
|
|
78
83
|
// Each Agent's look as the person chose it, every earlier choice kept (rec#11 D-89).
|
|
79
84
|
['agent-avatars.sqlite', AGENT_AVATARS_FORMAT],
|
|
85
|
+
// Who changed which field of a project's profile and when, with before and after text; never pruned.
|
|
86
|
+
['project-change-log.sqlite', PROJECT_CHANGE_LOG_FORMAT],
|
|
80
87
|
// 全部暂停 snapshots of every FLA's work surfaces and each pause and resume (rec#11 D-85).
|
|
81
88
|
['work-surfaces.sqlite', WORK_SURFACES_FORMAT],
|
|
82
89
|
// Each console change an FLA made for the person under their AI permissions (rec#11 D-81); never pruned.
|
|
@@ -136,7 +143,21 @@ const jsonDirectories = () => [
|
|
|
136
143
|
['capture-session-pause/pins/on', CAPTURE_SESSION_PAUSE_FORMAT],
|
|
137
144
|
['capture-session-pause/pins/off', CAPTURE_SESSION_PAUSE_FORMAT],
|
|
138
145
|
// Which client each session ran in, as the session launcher classified it (rec#11 D-79).
|
|
139
|
-
['session-clients', SESSION_CLIENT_FORMAT]
|
|
146
|
+
['session-clients', SESSION_CLIENT_FORMAT],
|
|
147
|
+
// The prompt of the session's current hook-entered task, until its checkpoint (rec#80 relay check).
|
|
148
|
+
['entry-prompts', ENTRY_PROMPT_FORMAT],
|
|
149
|
+
// The #fulidebug turn records the person reads in Settings › 系统, newest 20 within 50 MB; local only.
|
|
150
|
+
['debug-turns', DEBUG_TURN_FORMAT],
|
|
151
|
+
// The turn a #fulidebug prompt began, until its Stop records it.
|
|
152
|
+
['debug-turns/pending', DEBUG_TURN_PENDING_FORMAT],
|
|
153
|
+
// A person's confirmed session migration until that session's next task entry claims it (rec#82).
|
|
154
|
+
[SESSION_MIGRATION_NOTICE_DIRECTORY, SESSION_MIGRATION_NOTICE_FORMAT]
|
|
155
|
+
];
|
|
156
|
+
// Append-only logs whose every line carries its own version: inspected, never
|
|
157
|
+
// migrated or restored (a line this FULI does not read is skipped and counted).
|
|
158
|
+
const logStores = () => [
|
|
159
|
+
// FULI's runtime failures (rec#73), at most four rotated files of about 1 MB.
|
|
160
|
+
[DIAGNOSTICS_DIRECTORY, inspectDiagnosticEvents]
|
|
140
161
|
];
|
|
141
162
|
// The worst state of a directory's records names the directory's state.
|
|
142
163
|
const STATE_ORDER = ['unavailable', 'newer_format', 'half_applied', 'pending_confirmation', 'unsupported',
|
|
@@ -156,7 +177,8 @@ export function inspectLocalStores(dataDir) {
|
|
|
156
177
|
return [
|
|
157
178
|
...sqliteStores().map(([label, format]) => ({ label, ...inspectSqliteStore(join(dataDir, label), format) })),
|
|
158
179
|
...jsonStores().map(([label, format]) => ({ label, ...inspectJsonStore(join(dataDir, label), format) })),
|
|
159
|
-
...jsonDirectories().map(([label, format]) => ({ label, ...inspectJsonDirectory(join(dataDir, label), format) }))
|
|
180
|
+
...jsonDirectories().map(([label, format]) => ({ label, ...inspectJsonDirectory(join(dataDir, label), format) })),
|
|
181
|
+
...logStores().map(([label, inspect]) => ({ label, ...inspect(dataDir) }))
|
|
160
182
|
];
|
|
161
183
|
}
|
|
162
184
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// FULI's MCP instructions and tool list as a client receives them from the
|
|
2
|
+
// chat profile, the profile FULI's client setup installs (pack-manifest.js
|
|
3
|
+
// CHAT_PROFILE; a person may have switched an entry to full). Read through an
|
|
4
|
+
// in-memory MCP client, so it is exactly what initialize and tools/list
|
|
5
|
+
// answer; no FULI data is opened.
|
|
6
|
+
export async function fuliMcpSurface() {
|
|
7
|
+
const [{ createMcpServer }, { Client }, { InMemoryTransport }] = await Promise.all([
|
|
8
|
+
import('../mcp/create-mcp-server.js'),
|
|
9
|
+
import('@modelcontextprotocol/sdk/client/index.js'),
|
|
10
|
+
import('@modelcontextprotocol/sdk/inMemory.js')
|
|
11
|
+
]);
|
|
12
|
+
const server = createMcpServer({}, { env: {}, toolProfile: 'chat', registerResources: false });
|
|
13
|
+
const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
|
|
14
|
+
const client = new Client({ name: 'fuli-debug-turn', version: '1.0.0' });
|
|
15
|
+
try {
|
|
16
|
+
await Promise.all([server.connect(serverTransport), client.connect(clientTransport)]);
|
|
17
|
+
const { tools } = await client.listTools();
|
|
18
|
+
return { instructions: client.getInstructions() ?? '', tools };
|
|
19
|
+
} finally {
|
|
20
|
+
await client.close();
|
|
21
|
+
await server.close();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { createServer } from 'node:http';
|
|
2
|
+
import { request as httpsRequest } from 'node:https';
|
|
3
|
+
|
|
4
|
+
import { buildModelRequestRecord } from './record.js';
|
|
5
|
+
import { opensTurn, requestParts, usageFrom } from './model-request.js';
|
|
6
|
+
|
|
7
|
+
// Debug: a local proxy between a client and its model API, so the person can
|
|
8
|
+
// read the whole request, which a hook can't see (Jevons 11-04). Off until the
|
|
9
|
+
// person turns it on in the hidden Debug page, and off again after a restart.
|
|
10
|
+
// It listens on this computer only and forwards everything unchanged; it writes
|
|
11
|
+
// no log and no file of its own. The request that opens a turn becomes a Debug
|
|
12
|
+
// record, secrets masked. Request headers are never kept.
|
|
13
|
+
export const MODEL_CAPTURE_PORT = 8788;
|
|
14
|
+
const UPSTREAM = 'https://api.anthropic.com';
|
|
15
|
+
const HOP_HEADERS = new Set(['host', 'connection', 'content-length', 'accept-encoding', 'transfer-encoding']);
|
|
16
|
+
|
|
17
|
+
function keepTurn(store, sourceApplication, body, answer) {
|
|
18
|
+
try {
|
|
19
|
+
const parsed = JSON.parse(body);
|
|
20
|
+
if (opensTurn(parsed)) store.write(buildModelRequestRecord({ sourceApplication, ...requestParts(parsed, usageFrom(answer)) }));
|
|
21
|
+
} catch { /* A request that cannot be read is still forwarded; capture never changes the turn. */ }
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function forwarding({ store, upstream, send }) {
|
|
25
|
+
const target = new URL(upstream);
|
|
26
|
+
return (incoming, outgoing) => {
|
|
27
|
+
// A web page may reach this port too; only a client on this computer is served.
|
|
28
|
+
if (incoming.headers.origin) {
|
|
29
|
+
outgoing.writeHead(403);
|
|
30
|
+
outgoing.end();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const chunks = [];
|
|
34
|
+
incoming.on('data', chunk => chunks.push(chunk));
|
|
35
|
+
incoming.on('end', () => {
|
|
36
|
+
const body = Buffer.concat(chunks);
|
|
37
|
+
const headers = Object.fromEntries(Object.entries(incoming.headers).filter(([name]) => !HOP_HEADERS.has(name)));
|
|
38
|
+
const forward = send({ protocol: target.protocol, hostname: target.hostname, port: target.port || undefined,
|
|
39
|
+
path: incoming.url, method: incoming.method,
|
|
40
|
+
// Identity, so usage can be read from the answer as it passes through.
|
|
41
|
+
headers: { ...headers, host: target.host, 'accept-encoding': 'identity', 'content-length': body.length } }, (answer) => {
|
|
42
|
+
outgoing.writeHead(answer.statusCode ?? 502, answer.headers);
|
|
43
|
+
const seen = [];
|
|
44
|
+
answer.on('data', (chunk) => { seen.push(chunk); outgoing.write(chunk); });
|
|
45
|
+
answer.on('end', () => {
|
|
46
|
+
outgoing.end();
|
|
47
|
+
if (incoming.method === 'POST' && /\/messages(\?|$)/.test(incoming.url ?? '')) {
|
|
48
|
+
keepTurn(store, 'claude_code', body.toString('utf8'), Buffer.concat(seen).toString('utf8'));
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
forward.on('error', () => {
|
|
53
|
+
if (!outgoing.headersSent) outgoing.writeHead(502);
|
|
54
|
+
outgoing.end();
|
|
55
|
+
});
|
|
56
|
+
forward.end(body);
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function createModelCapture({ store, upstream = UPSTREAM, port = MODEL_CAPTURE_PORT, send = httpsRequest }) {
|
|
62
|
+
let server = null;
|
|
63
|
+
const status = () => ({ on: Boolean(server), port: server?.address()?.port ?? port });
|
|
64
|
+
return {
|
|
65
|
+
status,
|
|
66
|
+
async set(on) {
|
|
67
|
+
if (on === Boolean(server)) return status();
|
|
68
|
+
if (!on) {
|
|
69
|
+
const closing = server;
|
|
70
|
+
server = null;
|
|
71
|
+
await new Promise(done => { closing.close(done); closing.closeAllConnections?.(); });
|
|
72
|
+
return status();
|
|
73
|
+
}
|
|
74
|
+
const starting = createServer(forwarding({ store, upstream, send }));
|
|
75
|
+
await new Promise((resolve, reject) => {
|
|
76
|
+
starting.once('error', reject);
|
|
77
|
+
starting.listen(port, '127.0.0.1', resolve);
|
|
78
|
+
});
|
|
79
|
+
server = starting;
|
|
80
|
+
return status();
|
|
81
|
+
},
|
|
82
|
+
close() { return this.set(false); },
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// What one model request is made of, by source. Sizes are exact bytes; tokens
|
|
2
|
+
// come from the answer's own usage, so only their total is what was counted.
|
|
3
|
+
|
|
4
|
+
const size = (value) => Buffer.byteLength(typeof value === 'string' ? value : JSON.stringify(value ?? ''), 'utf8');
|
|
5
|
+
const textBlocks = (content) => (typeof content === 'string' ? [content]
|
|
6
|
+
: (Array.isArray(content) ? content : []).filter(block => block?.type === 'text').map(block => block.text ?? ''));
|
|
7
|
+
// FULI's task entry and rules, however a host wraps them in the turn.
|
|
8
|
+
const FULI_CONTEXT = /Fuli task context|taskContextToken|fuli:\/\/rules\//;
|
|
9
|
+
// The person's own instruction and memory files, which may talk about FULI.
|
|
10
|
+
const PERSON_FILES = /Contents of .*(CLAUDE|AGENTS|MEMORY)\.md/;
|
|
11
|
+
|
|
12
|
+
// A host packs several things into one text block: reminder tags, and each
|
|
13
|
+
// hook's context one after another. FULI's share is counted per piece, so a
|
|
14
|
+
// block that merely mentions FULI next to other hooks' text is not FULI's.
|
|
15
|
+
const pieces = (text) => text.split(/(?=<system-reminder>)|(?<=<\/system-reminder>)|(?=\b[A-Za-z]+ hook additional context:)|(?=<EXTREMELY_IMPORTANT>)|(?<=<\/EXTREMELY_IMPORTANT>)/);
|
|
16
|
+
|
|
17
|
+
function messageSections(messages = []) {
|
|
18
|
+
let fuliContext = 0;
|
|
19
|
+
let total = 0;
|
|
20
|
+
for (const message of messages) {
|
|
21
|
+
total += size(message.content);
|
|
22
|
+
for (const text of textBlocks(message.content)) {
|
|
23
|
+
for (const piece of pieces(text)) if (isFuliPiece(piece)) fuliContext += size(piece);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return { fuliContext, conversation: total - fuliContext };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const systemText = (system) => textBlocks(system).join('\n\n');
|
|
30
|
+
const blockText = (block) => (block?.type === 'text' ? block.text ?? '' : JSON.stringify(block));
|
|
31
|
+
const contentText = (content) => (typeof content === 'string' ? content : (content ?? []).map(blockText).join('\n'));
|
|
32
|
+
const isFuliPiece = (piece) => FULI_CONTEXT.test(piece) && !PERSON_FILES.test(piece);
|
|
33
|
+
const isReminder = (piece) => /^\s*(<system-reminder>|<EXTREMELY_IMPORTANT>|[A-Za-z]+ hook additional context:)/.test(piece);
|
|
34
|
+
|
|
35
|
+
/** True for the request that opens a turn: it ends on the person's words, not a tool's answer. */
|
|
36
|
+
export function opensTurn(body) {
|
|
37
|
+
const messages = Array.isArray(body?.messages) ? body.messages : [];
|
|
38
|
+
const at = turnStart(messages);
|
|
39
|
+
if (!Array.isArray(body?.tools) || !body.tools.length || at < 0) return false;
|
|
40
|
+
const { content } = messages[at];
|
|
41
|
+
return !(Array.isArray(content) && content.some(block => block?.type === 'tool_result'));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// The person's latest message; a host may put its own system messages after it.
|
|
45
|
+
const turnStart = (messages) => {
|
|
46
|
+
const at = messages.findLastIndex(message => message.role !== 'system');
|
|
47
|
+
return messages[at]?.role === 'user' ? at : -1;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** The request as Debug record parts, in reading order, each with who put it there. */
|
|
51
|
+
export function requestParts(body, usage) {
|
|
52
|
+
const tools = Array.isArray(body?.tools) ? body.tools : [];
|
|
53
|
+
const fuliTools = tools.filter(tool => /^mcp__fuli__/.test(tool?.name ?? ''));
|
|
54
|
+
const clientTools = tools.filter(tool => !fuliTools.includes(tool));
|
|
55
|
+
const messages = Array.isArray(body?.messages) ? body.messages : [];
|
|
56
|
+
const parts = [
|
|
57
|
+
{ source: 'host', kind: 'model_system', text: systemText(body?.system) },
|
|
58
|
+
{ source: 'host', kind: 'model_client_tools', label: String(clientTools.length), text: JSON.stringify(clientTools, null, 2) },
|
|
59
|
+
{ source: 'fuli', kind: 'model_fuli_tools', label: String(fuliTools.length), text: JSON.stringify(fuliTools, null, 2) },
|
|
60
|
+
];
|
|
61
|
+
const start = Math.max(turnStart(messages), 0);
|
|
62
|
+
const earlier = messages.slice(0, start);
|
|
63
|
+
if (earlier.length) parts.push({ source: 'host', kind: 'history', label: String(earlier.length),
|
|
64
|
+
text: earlier.map(message => `[${message.role}] ${contentText(message.content)}`).join('\n\n') });
|
|
65
|
+
let prompt = '';
|
|
66
|
+
for (const message of messages.slice(start)) {
|
|
67
|
+
for (const piece of textBlocks(message.content).flatMap(pieces).filter(text => text.trim())) {
|
|
68
|
+
if (isFuliPiece(piece)) parts.push({ source: 'fuli', kind: 'model_context', text: piece });
|
|
69
|
+
// Only the person's own message holds their words; a host's system message never does.
|
|
70
|
+
else if (message.role !== 'user' || isReminder(piece)) parts.push({ source: 'host', kind: 'model_context', text: piece });
|
|
71
|
+
else { parts.push({ source: 'person', kind: 'prompt', text: piece }); prompt ||= piece.trim(); }
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (usage) parts.push({ source: 'host', kind: 'model_usage', text: JSON.stringify(usage, null, 2) });
|
|
75
|
+
return { prompt: prompt || 'Model request', parts };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function requestSections(body) {
|
|
79
|
+
const tools = Array.isArray(body?.tools) ? body.tools : [];
|
|
80
|
+
const fuliTools = tools.filter(tool => /^mcp__fuli__/.test(tool?.name ?? ''));
|
|
81
|
+
const otherTools = tools.filter(tool => !fuliTools.includes(tool));
|
|
82
|
+
return {
|
|
83
|
+
system: size(body?.system),
|
|
84
|
+
clientTools: size(otherTools),
|
|
85
|
+
fuliTools: size(fuliTools),
|
|
86
|
+
...messageSections(body?.messages),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Token counts from a streamed or plain response, null when it reported none. */
|
|
91
|
+
export function usageFrom(text) {
|
|
92
|
+
const usage = {};
|
|
93
|
+
for (const match of text.matchAll(/"usage"\s*:\s*(\{[^{}]*(?:\{[^{}]*\}[^{}]*)*\})/g)) {
|
|
94
|
+
try { Object.assign(usage, JSON.parse(match[1])); } catch { /* A partial event carries nothing to count. */ }
|
|
95
|
+
}
|
|
96
|
+
return Object.keys(usage).length ? usage : null;
|
|
97
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
|
|
3
|
+
import { redactSensitiveContent } from '../security/sensitive-content.js';
|
|
4
|
+
|
|
5
|
+
// One #fulidebug turn as a person reads it (Jevons 11-04): ordered parts, each
|
|
6
|
+
// with who put it there. FULI's own additions (its hook frames, MCP surface
|
|
7
|
+
// and tool calls) are `fuli`, so the console can show them apart.
|
|
8
|
+
export const DEBUG_PART_SOURCES = Object.freeze(['person', 'fuli', 'ai', 'host', 'not_visible']);
|
|
9
|
+
export const DEBUG_RECORD_VERSION = 1;
|
|
10
|
+
export const DEBUG_RECORD_MAX_BYTES = 2 * 1024 * 1024;
|
|
11
|
+
|
|
12
|
+
// FULI's MCP server is registered as "fuli"; both hosts name its tools mcp__fuli__<tool>.
|
|
13
|
+
const FULI_TOOL = /^mcp__fuli(?:__|\.)/;
|
|
14
|
+
// A task token is the key to the task's checkpoint; the record never keeps one.
|
|
15
|
+
// Only a value is masked, quoted (also inside escaped JSON) or bare, never a schema's `{`.
|
|
16
|
+
const TASK_TOKEN_FIELD = /(\\?"?task_?context_?token\\?"?\s*[:=]\s*)(\\?")?[^"\\\s,{}[\]]+/gi;
|
|
17
|
+
const TASK_TOKEN_VALUE = /\bfuli-task-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
|
|
18
|
+
const PROMPT_LINE_CHARS = 200;
|
|
19
|
+
|
|
20
|
+
const NOT_VISIBLE = 'FULI 看不到客户端自己的系统提示词和工具定义,所以这里是 FULI 能看到的全部内容,不是逐字节的模型输入。 '
|
|
21
|
+
+ 'FULI cannot see the client\'s own system prompt and tool definitions, so this is everything FULI can see, '
|
|
22
|
+
+ 'not a byte-exact model input.';
|
|
23
|
+
const NO_TRANSCRIPT = Object.freeze({
|
|
24
|
+
unavailable: 'FULI 没有读到这个会话的记录文件,所以没有 AI 的回复、其他工具调用和历史对话。 '
|
|
25
|
+
+ 'FULI could not read this session\'s transcript, so the assistant\'s messages, other tool calls and the history are missing.',
|
|
26
|
+
not_supported: '这个客户端不给 FULI 会话记录,所以没有 AI 的回复、其他工具调用和历史对话。 '
|
|
27
|
+
+ 'This client gives FULI no transcript, so the assistant\'s messages, other tool calls and the history are missing.'
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export function redactDebugText(text) {
|
|
31
|
+
return redactSensitiveContent(text)
|
|
32
|
+
.replace(TASK_TOKEN_FIELD, '$1$2[redacted:task_context_token]')
|
|
33
|
+
.replace(TASK_TOKEN_VALUE, '[redacted:task_context_token]');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// turn: { sourceApplication, sessionId, prompt, frames: [{ event, text }],
|
|
37
|
+
// surface: { instructions, tools } | null, transcript: { status, history,
|
|
38
|
+
// historyComplete, events } (normalized events, transcript-reader.js), and
|
|
39
|
+
// lastAssistantMessage from the Stop input }. Every text is redacted here.
|
|
40
|
+
export function buildDebugRecord(turn, { now = () => new Date(), id = randomUUID() } = {}) {
|
|
41
|
+
const { transcript } = turn;
|
|
42
|
+
const parts = [part('not_visible', 'system_prompt', '', NOT_VISIBLE)];
|
|
43
|
+
if (transcript.status !== 'read') parts.push(part('not_visible', 'no_transcript', '', NO_TRANSCRIPT[transcript.status]));
|
|
44
|
+
if (turn.surface) {
|
|
45
|
+
parts.push(part('fuli', 'mcp_instructions', '', turn.surface.instructions));
|
|
46
|
+
parts.push(part('fuli', 'mcp_tools', String(turn.surface.tools.length), JSON.stringify(turn.surface.tools, null, 2)));
|
|
47
|
+
}
|
|
48
|
+
const history = transcript.status === 'read' ? historyPart(transcript.history, transcript.historyComplete) : null;
|
|
49
|
+
if (history) parts.push(history.part);
|
|
50
|
+
parts.push(part('person', 'prompt', '', turn.prompt));
|
|
51
|
+
const [entry, ...later] = turn.frames;
|
|
52
|
+
if (entry) parts.push(part('fuli', 'hook_frame', entry.event, entry.text));
|
|
53
|
+
const events = turnParts(transcript.events ?? []);
|
|
54
|
+
parts.push(...events);
|
|
55
|
+
const last = turn.lastAssistantMessage;
|
|
56
|
+
if (typeof last === 'string' && last && events.findLast((item) => item.source === 'ai')?.text !== redactDebugText(last)) {
|
|
57
|
+
parts.push(part('ai', 'assistant_message', '', last));
|
|
58
|
+
}
|
|
59
|
+
for (const frame of later) parts.push(part('fuli', 'hook_frame', frame.event, frame.text));
|
|
60
|
+
const record = {
|
|
61
|
+
version: DEBUG_RECORD_VERSION, id, createdAt: now().toISOString(), sourceApplication: turn.sourceApplication,
|
|
62
|
+
sessionId: turn.sessionId, promptLine: promptLine(parts.find((item) => item.source === 'person').text),
|
|
63
|
+
transcript: transcript.status, parts, totals: null, cut: null
|
|
64
|
+
};
|
|
65
|
+
return withTotals(withinCap(record, history));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// One model request from the dev capture proxy (model-capture.js): the
|
|
69
|
+
// whole request, so nothing here is out of sight. `parts` come in reading order.
|
|
70
|
+
export function buildModelRequestRecord({ sourceApplication, prompt, parts }, { now = () => new Date(), id = randomUUID() } = {}) {
|
|
71
|
+
const record = { version: DEBUG_RECORD_VERSION, id, createdAt: now().toISOString(), sourceApplication, sessionId: 'model-capture',
|
|
72
|
+
promptLine: promptLine(redactDebugText(prompt)), transcript: 'read',
|
|
73
|
+
parts: parts.map(item => part(item.source, item.kind, item.label ?? '', item.text)), totals: null, cut: null };
|
|
74
|
+
return withTotals(withinCap(record, null));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function part(source, kind, label, text) {
|
|
78
|
+
const stored = redactDebugText(String(text ?? ''));
|
|
79
|
+
return { source, kind, label, text: stored, bytes: Buffer.byteLength(stored) };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function promptLine(prompt) {
|
|
83
|
+
const line = prompt.split(/\r?\n/, 1)[0];
|
|
84
|
+
return line.length > PROMPT_LINE_CHARS ? `${line.slice(0, PROMPT_LINE_CHARS)}…` : line;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// The conversation since the last compaction, as one part: a line per message.
|
|
88
|
+
function historyPart(events, complete) {
|
|
89
|
+
const lines = events.map((event) => `[${event.kind === 'message' ? event.role : event.kind}] ${redactDebugText(event.content)}`);
|
|
90
|
+
const text = lines.join('\n');
|
|
91
|
+
return { lines, complete, part: { source: 'host', kind: 'history', label: String(lines.length), messages: lines.length,
|
|
92
|
+
complete, text, bytes: Buffer.byteLength(text) } };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// The turn's own transcript events: the assistant's words are `ai`; a call
|
|
96
|
+
// to a FULI tool and its result are `fuli`; every other call and result is `host`.
|
|
97
|
+
function turnParts(events) {
|
|
98
|
+
const calls = new Map();
|
|
99
|
+
return events.flatMap((event) => {
|
|
100
|
+
if (event.kind === 'message') {
|
|
101
|
+
return [part(event.role === 'assistant' ? 'ai' : 'host', event.role === 'assistant' ? 'assistant_message' : 'user_message',
|
|
102
|
+
'', event.content)];
|
|
103
|
+
}
|
|
104
|
+
if (event.kind === 'tool_call') {
|
|
105
|
+
const call = parsed(event.content);
|
|
106
|
+
const source = FULI_TOOL.test(call?.name ?? '') ? 'fuli' : 'host';
|
|
107
|
+
if (call?.call_id) calls.set(call.call_id, { source, name: call.name ?? '' });
|
|
108
|
+
return [part(source, 'tool_call', call?.name ?? '', event.content)];
|
|
109
|
+
}
|
|
110
|
+
if (event.kind === 'tool_result') {
|
|
111
|
+
const call = calls.get(parsed(event.content)?.call_id) ?? { source: 'host', name: '' };
|
|
112
|
+
return [part(call.source, 'tool_result', call.name, event.content)];
|
|
113
|
+
}
|
|
114
|
+
return [part('host', event.kind, '', event.content)];
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function parsed(content) {
|
|
119
|
+
try { return JSON.parse(content); } catch { return null; }
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const recordBytes = (record) => Buffer.byteLength(JSON.stringify(record));
|
|
123
|
+
|
|
124
|
+
// At most DEBUG_RECORD_MAX_BYTES: the oldest history goes first, and the
|
|
125
|
+
// history says how much was cut. Only a turn too big even without its
|
|
126
|
+
// history has its largest parts shortened, each marked where it was cut.
|
|
127
|
+
function withinCap(record, history) {
|
|
128
|
+
if (recordBytes(record) <= DEBUG_RECORD_MAX_BYTES) return record;
|
|
129
|
+
let parts = record.parts;
|
|
130
|
+
let cut = null;
|
|
131
|
+
if (history) {
|
|
132
|
+
const index = parts.indexOf(history.part);
|
|
133
|
+
const shown = { ...history.part, text: '' };
|
|
134
|
+
const room = DEBUG_RECORD_MAX_BYTES - recordBytes({ ...record, parts: parts.with(index, shown), cut: CUT_SHAPE });
|
|
135
|
+
const kept = [];
|
|
136
|
+
let used = 0;
|
|
137
|
+
for (let at = history.lines.length - 1; at >= 0; at -= 1) {
|
|
138
|
+
const size = Buffer.byteLength(JSON.stringify(history.lines[at])) + 1;
|
|
139
|
+
if (used + size > room - CUT_NOTE_ROOM) break;
|
|
140
|
+
kept.unshift(history.lines[at]);
|
|
141
|
+
used += size;
|
|
142
|
+
}
|
|
143
|
+
const dropped = history.lines.length - kept.length;
|
|
144
|
+
const droppedBytes = history.part.bytes - Buffer.byteLength(kept.join('\n'));
|
|
145
|
+
cut = { historyMessages: dropped, historyBytes: droppedBytes, parts: [] };
|
|
146
|
+
const note = `[${dropped} earlier messages (${droppedBytes} bytes) were cut to keep this record under 2 MB]`;
|
|
147
|
+
parts = parts.with(index, { ...history.part, text: [note, ...kept].join('\n') });
|
|
148
|
+
}
|
|
149
|
+
const capped = { ...record, parts, cut: cut ?? { historyMessages: 0, historyBytes: 0, parts: [] } };
|
|
150
|
+
return recordBytes(capped) <= DEBUG_RECORD_MAX_BYTES ? capped : shortenLargest(capped);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const CUT_SHAPE = Object.freeze({ historyMessages: Number.MAX_SAFE_INTEGER, historyBytes: Number.MAX_SAFE_INTEGER, parts: [] });
|
|
154
|
+
const CUT_NOTE_ROOM = 256;
|
|
155
|
+
const SHORTENED = '\n[…cut to keep this record under 2 MB]';
|
|
156
|
+
|
|
157
|
+
function shortenLargest(record) {
|
|
158
|
+
const parts = [...record.parts];
|
|
159
|
+
const shortened = [];
|
|
160
|
+
while (recordBytes({ ...record, parts }) > DEBUG_RECORD_MAX_BYTES) {
|
|
161
|
+
const index = parts.reduce((largest, item, at) => (item.text.length > parts[largest].text.length ? at : largest), 0);
|
|
162
|
+
const over = recordBytes({ ...record, parts }) - DEBUG_RECORD_MAX_BYTES;
|
|
163
|
+
const target = parts[index];
|
|
164
|
+
const keep = Math.max(0, Buffer.byteLength(target.text) - over - SHORTENED.length * 2 - 1024);
|
|
165
|
+
// A cut inside a code point leaves U+FFFD at the end; drop it.
|
|
166
|
+
const text = Buffer.from(target.text).subarray(0, keep).toString('utf8').replace(/\uFFFD+$/, '') + SHORTENED;
|
|
167
|
+
parts[index] = { ...target, text };
|
|
168
|
+
if (!shortened.includes(index)) shortened.push(index);
|
|
169
|
+
}
|
|
170
|
+
return { ...record, parts, cut: { ...record.cut, parts: shortened.sort((a, b) => a - b) } };
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Bytes per source, from what FULI saw (a cut history counts as it was).
|
|
174
|
+
function withTotals(record) {
|
|
175
|
+
const totals = Object.fromEntries(DEBUG_PART_SOURCES.map((source) => [source, 0]));
|
|
176
|
+
for (const item of record.parts) totals[item.source] += item.bytes;
|
|
177
|
+
return { ...record, totals };
|
|
178
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { dirname } from 'node:path';
|
|
2
|
+
|
|
3
|
+
import { buildDebugRecord, redactDebugText } from './record.js';
|
|
4
|
+
import { debugTurnStore } from './store.js';
|
|
5
|
+
import { debugPromptDigest, readDebugTranscript } from './transcript-reader.js';
|
|
6
|
+
import { isDebugPrompt } from './trigger.js';
|
|
7
|
+
import { fuliMcpSurface } from './fuli-surface.js';
|
|
8
|
+
|
|
9
|
+
// The one call an Agent's lifecycle hook makes for #fulidebug (Jevons 11-04),
|
|
10
|
+
// after its output is final, a failed hook included: that turn is the one worth
|
|
11
|
+
// reading. It only reads what the hook decided and writes local files. A marked
|
|
12
|
+
// prompt's entry frame is kept until a Stop, which builds the record from it,
|
|
13
|
+
// the Stop frame and the host's transcript (adapter: the Agent's transcript port,
|
|
14
|
+
// or null for a host without one). A message queued mid-turn leaves it in place.
|
|
15
|
+
// Recording never changes or fails the turn: an error is logged and the hook
|
|
16
|
+
// goes on.
|
|
17
|
+
export async function recordDebugTurn({ runtimeConfigPath, sourceApplication, event, input, output, adapter = null },
|
|
18
|
+
{ surface = fuliMcpSurface, log = defaultLog, now = () => new Date() } = {}) {
|
|
19
|
+
try {
|
|
20
|
+
const sessionId = input?.session_id;
|
|
21
|
+
if (!runtimeConfigPath || typeof sessionId !== 'string' || !sessionId) return;
|
|
22
|
+
const store = debugTurnStore(dirname(runtimeConfigPath));
|
|
23
|
+
// Only a marked turn pays for this: every other turn leaves here untouched.
|
|
24
|
+
const frame = () => ({ event, text: redactDebugText(JSON.stringify(output ?? null)) });
|
|
25
|
+
if (event === 'UserPromptSubmit') {
|
|
26
|
+
if (!isDebugPrompt(input.prompt)) return;
|
|
27
|
+
store.pending.write(sourceApplication, sessionId, { prompt: redactDebugText(input.prompt),
|
|
28
|
+
promptDigest: debugPromptDigest(input.prompt), frames: [frame()] });
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (event !== 'Stop') return;
|
|
32
|
+
const pending = store.pending.read(sourceApplication, sessionId);
|
|
33
|
+
if (!pending) return;
|
|
34
|
+
try {
|
|
35
|
+
const [mcp, transcript] = await Promise.all([
|
|
36
|
+
surface().catch(() => null),
|
|
37
|
+
readDebugTranscript(input.transcript_path, sessionId, adapter, pending.promptDigest)
|
|
38
|
+
]);
|
|
39
|
+
store.write(buildDebugRecord({ sourceApplication, sessionId, prompt: pending.prompt,
|
|
40
|
+
frames: [...pending.frames, frame()], surface: mcp, transcript,
|
|
41
|
+
lastAssistantMessage: input.last_assistant_message ?? null }, { now }));
|
|
42
|
+
} finally {
|
|
43
|
+
store.pending.remove(sourceApplication, sessionId);
|
|
44
|
+
}
|
|
45
|
+
} catch (error) {
|
|
46
|
+
// No prompt, path or message: only what kind of failure it was.
|
|
47
|
+
log(`FULI: this #fulidebug turn was not recorded (${error?.code ?? error?.name ?? 'error'}).`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function defaultLog(line) {
|
|
52
|
+
process.stderr.write(`${line}\n`);
|
|
53
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { readdirSync, statSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { sha256Bytes } from '../security/digest.js';
|
|
5
|
+
import { readJsonFile } from '../storage/json-file.js';
|
|
6
|
+
import { jsonFormat, readJsonRecord, removeVersionedJsonFileAtomic, writeVersionedJsonFileAtomic } from '../storage/json-format.js';
|
|
7
|
+
import { DEBUG_RECORD_VERSION } from './record.js';
|
|
8
|
+
|
|
9
|
+
// The #fulidebug turn records of one data directory (Jevons 11-04), one file per
|
|
10
|
+
// turn under debug-turns/, and the turn a #fulidebug prompt began, kept until its
|
|
11
|
+
// Stop under debug-turns/pending/. Local only: nothing here reaches the Provider.
|
|
12
|
+
export const DEBUG_TURN_FORMAT = jsonFormat({ store: 'debug-turns', versions: [DEBUG_RECORD_VERSION] });
|
|
13
|
+
export const DEBUG_TURN_PENDING_FORMAT = jsonFormat({ store: 'debug-turn-pending', versions: [1] });
|
|
14
|
+
const PENDING_VERSION = 1;
|
|
15
|
+
const KEEP_RECORDS = 20;
|
|
16
|
+
const KEEP_BYTES = 50 * 1024 * 1024;
|
|
17
|
+
const RECORD_FILE = /^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.json$/;
|
|
18
|
+
|
|
19
|
+
export function debugTurnStore(dataDir) {
|
|
20
|
+
const directory = join(dataDir, 'debug-turns');
|
|
21
|
+
const recordPath = (id) => join(directory, `${id}.json`);
|
|
22
|
+
const pendingPath = (sourceApplication, sessionId) =>
|
|
23
|
+
join(directory, 'pending', `${sha256Bytes(`${sourceApplication}\0${sessionId}`)}.json`);
|
|
24
|
+
const read = (id) => {
|
|
25
|
+
if (typeof id !== 'string' || !RECORD_FILE.test(`${id}.json`)) return null;
|
|
26
|
+
const record = readJsonRecord(recordPath(id), DEBUG_TURN_FORMAT);
|
|
27
|
+
return record?.version === DEBUG_RECORD_VERSION && record.id === id ? record : null;
|
|
28
|
+
};
|
|
29
|
+
// Every readable record with its file size, newest first. There are at most 20.
|
|
30
|
+
const records = () => {
|
|
31
|
+
let names;
|
|
32
|
+
try { names = readdirSync(directory); } catch (error) {
|
|
33
|
+
if (error?.code === 'ENOENT') return [];
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
return names.flatMap((name) => {
|
|
37
|
+
const id = RECORD_FILE.exec(name)?.[1];
|
|
38
|
+
const record = id ? read(id) : null;
|
|
39
|
+
if (!record) return [];
|
|
40
|
+
try { return [{ record, bytes: statSync(recordPath(id)).size }]; } catch { return []; }
|
|
41
|
+
}).sort((left, right) => right.record.createdAt.localeCompare(left.record.createdAt));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
list() {
|
|
46
|
+
return records().map(({ record }) => ({ id: record.id, createdAt: record.createdAt,
|
|
47
|
+
sourceApplication: record.sourceApplication, promptLine: record.promptLine, totals: record.totals }));
|
|
48
|
+
},
|
|
49
|
+
read,
|
|
50
|
+
write(record) {
|
|
51
|
+
writeVersionedJsonFileAtomic(recordPath(record.id), record, DEBUG_TURN_FORMAT);
|
|
52
|
+
prune(records());
|
|
53
|
+
},
|
|
54
|
+
remove(id) {
|
|
55
|
+
if (!read(id)) return false;
|
|
56
|
+
removeVersionedJsonFileAtomic(recordPath(id), DEBUG_TURN_FORMAT);
|
|
57
|
+
return true;
|
|
58
|
+
},
|
|
59
|
+
// The ones of these IDs that were there and are now gone.
|
|
60
|
+
removeMany(ids) {
|
|
61
|
+
return ids.filter((id) => this.remove(id));
|
|
62
|
+
},
|
|
63
|
+
// The turn a #fulidebug prompt began in this session, until its Stop.
|
|
64
|
+
pending: {
|
|
65
|
+
read(sourceApplication, sessionId) {
|
|
66
|
+
try {
|
|
67
|
+
const value = readJsonFile(pendingPath(sourceApplication, sessionId), null);
|
|
68
|
+
return value?.version === PENDING_VERSION && value.sessionId === sessionId ? value : null;
|
|
69
|
+
} catch { return null; }
|
|
70
|
+
},
|
|
71
|
+
write(sourceApplication, sessionId, turn) {
|
|
72
|
+
writeVersionedJsonFileAtomic(pendingPath(sourceApplication, sessionId),
|
|
73
|
+
{ version: PENDING_VERSION, sourceApplication, sessionId, ...turn }, DEBUG_TURN_PENDING_FORMAT);
|
|
74
|
+
},
|
|
75
|
+
remove(sourceApplication, sessionId) {
|
|
76
|
+
removeVersionedJsonFileAtomic(pendingPath(sourceApplication, sessionId), DEBUG_TURN_PENDING_FORMAT);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// The newest 20 records within 50 MB; the newest one always stays.
|
|
82
|
+
function prune(current) {
|
|
83
|
+
let bytes = 0;
|
|
84
|
+
current.forEach(({ record, bytes: size }, index) => {
|
|
85
|
+
bytes += size;
|
|
86
|
+
if (index > 0 && (index >= KEEP_RECORDS || bytes > KEEP_BYTES)) {
|
|
87
|
+
removeVersionedJsonFileAtomic(recordPath(record.id), DEBUG_TURN_FORMAT);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|