fuli-context 0.20.1 → 0.21.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/assets/{AboutPage-CjDenGS_.js → AboutPage-D0dTwKq8.js} +1 -1
- package/dist/web/assets/{AgentName-DdlJlpT3.js → AgentName-n4oqQUwE.js} +1 -1
- package/dist/web/assets/{AgentProfilePage-Cx_Uf5Vf.js → AgentProfilePage-DH54S93r.js} +1 -1
- package/dist/web/assets/{AgentsDirectoryPage-DylT-GSW.js → AgentsDirectoryPage-xwIRrNb8.js} +1 -1
- package/dist/web/assets/{BackLink-D7oAvDG5.js → BackLink-nM3e40IT.js} +1 -1
- package/dist/web/assets/{BoardMoveMenu-B0pA7LLx.js → BoardMoveMenu-Cxgkbwkl.js} +1 -1
- package/dist/web/assets/{CaptureChangePage-DEuqPb14.js → CaptureChangePage-DWdz9dEk.js} +1 -1
- package/dist/web/assets/{Card-BZFLZ_2I.js → Card-89NKHANE.js} +1 -1
- package/dist/web/assets/{CardHeader-C_c0keQn.js → CardHeader-9MwjWRxl.js} +1 -1
- package/dist/web/assets/{CardTitle-yXOhV577.js → CardTitle-BAhmXjAK.js} +1 -1
- package/dist/web/assets/{ConnectionsPage-DlnHdtwn.js → ConnectionsPage-Yf4UvjDT.js} +1 -1
- package/dist/web/assets/{CreateProjectDialog-BVJqWdlT.js → CreateProjectDialog-crpLTyDf.js} +1 -1
- package/dist/web/assets/{DataFormatPage-BdcjcyhZ.js → DataFormatPage-BPuUH0PG.js} +1 -1
- package/dist/web/assets/{DialogFooter-DYawfDCD.js → DialogFooter-D9A9hRP4.js} +1 -1
- package/dist/web/assets/{EmployeeRecruitDialog-CB4ARFkM.js → EmployeeRecruitDialog-DeB0XHeM.js} +1 -1
- package/dist/web/assets/EmployeeWorkbenchPage-0oK2RfIh.js +3 -0
- package/dist/web/assets/{EmployeeWorkbenchPage-BenZP7De.css → EmployeeWorkbenchPage-CMutwFBC.css} +1 -1
- package/dist/web/assets/{GrowthLoading-smW3-Gfp.js → GrowthLoading-Cs9brXcN.js} +1 -1
- package/dist/web/assets/{InboxPage-Crn1UU7s.js → InboxPage-CTQ425Ez.js} +1 -1
- package/dist/web/assets/{Input-F1oftPWh.js → Input-DGf4juEs.js} +1 -1
- package/dist/web/assets/{KnowledgeEditDialog-VdQwbX4E.js → KnowledgeEditDialog-Ccgj30Wu.js} +1 -1
- package/dist/web/assets/{KnowledgeHardDeleteSection-CXRmNnZF.js → KnowledgeHardDeleteSection-CSnqisUv.js} +1 -1
- package/dist/web/assets/{KnowledgeItemEditPage-CQo3TbCJ.js → KnowledgeItemEditPage-C0Y2DsHz.js} +1 -1
- package/dist/web/assets/{KnowledgeItemSummaryCard-Dd2McM-d.js → KnowledgeItemSummaryCard-BRvaf4Fw.js} +1 -1
- package/dist/web/assets/{KnowledgeOrganizerPage-BVgAyu6U.js → KnowledgeOrganizerPage-CRC3mk0j.js} +1 -1
- package/dist/web/assets/KnowledgePage-NsKFUWth.js +1 -0
- package/dist/web/assets/{KnowledgePeek-BNBkh1ey.js → KnowledgePeek-Bc0bqyZp.js} +1 -1
- package/dist/web/assets/{KnowledgeTurnReceiptPage-Ckw_olrt.js → KnowledgeTurnReceiptPage-Dl0KeFDe.js} +1 -1
- package/dist/web/assets/{KnowledgeWorkspace-pH2tAFld.js → KnowledgeWorkspace-BGlODG7G.js} +1 -1
- package/dist/web/assets/{Label-yDCtlpkb.js → Label-CafdTnDF.js} +1 -1
- package/dist/web/assets/ModelSettingsPage-Bz1tMXtW.js +1 -0
- package/dist/web/assets/ModelSettingsPage-DJuEaw6p.css +1 -0
- package/dist/web/assets/{NotFoundPage-8gVVukRR.js → NotFoundPage-TfZ2eoA2.js} +1 -1
- package/dist/web/assets/{OccupationsPage-PNoqE21Y.js → OccupationsPage-CnSp6362.js} +1 -1
- package/dist/web/assets/{OverviewPage-DiwYSnhh.js → OverviewPage-D5W-DhOz.js} +2 -2
- package/dist/web/assets/{PersonalProfilePage-C_v2BFee.js → PersonalProfilePage-CndOcRQ6.js} +1 -1
- package/dist/web/assets/{PersonalProjectsPage-DGRV8cM5.js → PersonalProjectsPage-CXBOwEqC.js} +1 -1
- package/dist/web/assets/{PopperContent-5zqbtnYr.js → PopperContent-BXbztFFi.js} +1 -1
- package/dist/web/assets/{Presence-BYfYJNMD.js → Presence-BLar6FCs.js} +1 -1
- package/dist/web/assets/{ProjectAgentDetailPage-BQ9ffaCX.js → ProjectAgentDetailPage-SmZ2NYTw.js} +1 -1
- package/dist/web/assets/{ProjectAgentDialog-BGckQDTq.js → ProjectAgentDialog-Bg0V3Zr2.js} +1 -1
- package/dist/web/assets/{ProjectAgentFirstTask-DrSd3nR-.js → ProjectAgentFirstTask-CbOWaP7Q.js} +1 -1
- package/dist/web/assets/{ProjectAgentsPage-U4Om3EPu.js → ProjectAgentsPage-Y6qCYRZj.js} +1 -1
- package/dist/web/assets/{ProjectScopePicker-D0oxbwOd.js → ProjectScopePicker-ClDUoUHW.js} +1 -1
- package/dist/web/assets/{PublicProjectsPage-CvkQ3E8I.js → PublicProjectsPage-C63vW9UZ.js} +1 -1
- package/dist/web/assets/{RadioGroupItem-CBpbQlHx.js → RadioGroupItem-tL_2upmD.js} +1 -1
- package/dist/web/assets/{RoundtablesPage-BEUaKOjI.js → RoundtablesPage-2Akxagrm.js} +1 -1
- package/dist/web/assets/{RovingFocusGroup-X9U-ufYr.js → RovingFocusGroup-D5mf9s6I.js} +1 -1
- package/dist/web/assets/{RovingFocusItem-_uA_OCLT.js → RovingFocusItem-DAumq9xD.js} +1 -1
- package/dist/web/assets/{SessionMigrationPage-WVFSDcUO.js → SessionMigrationPage-B5r2PWCF.js} +1 -1
- package/dist/web/assets/{SessionRecordsPage-Bs2eLXEi.js → SessionRecordsPage-DIc2GoCQ.js} +1 -1
- package/dist/web/assets/{SettingsPage-DlIwICIz.js → SettingsPage-BAxKpnBx.js} +1 -1
- package/dist/web/assets/{SharedJefaReportPage-B_rreEep.js → SharedJefaReportPage-B54qEdIV.js} +1 -1
- package/dist/web/assets/{TabsContent-8pXwYJPz.js → TabsContent-DZQE2Iq8.js} +1 -1
- package/dist/web/assets/{TabsTrigger-Cd6SI2yI.js → TabsTrigger-CHnq6mkI.js} +1 -1
- package/dist/web/assets/{TagVocabularyPage-BQiuKG-4.js → TagVocabularyPage-BIsHYk2i.js} +1 -1
- package/dist/web/assets/{TaskExecutionPlan-CupxJeyo.js → TaskExecutionPlan-IYG_JeuT.js} +1 -1
- package/dist/web/assets/{TaskSchedulesPage-zYQs7s6T.js → TaskSchedulesPage-Cxjqc8XQ.js} +1 -1
- package/dist/web/assets/{Teleport-BZX1Eb7R.js → Teleport-BKN3dSMk.js} +1 -1
- package/dist/web/assets/{TextField-CielK4l3.js → TextField-DoKtn--E.js} +1 -1
- package/dist/web/assets/{UiDialog-BSDblUpR.js → UiDialog-7pnZ-eQA.js} +1 -1
- package/dist/web/assets/{UiDisclosure-DLmVwmy1.js → UiDisclosure-COV4NwHI.js} +1 -1
- package/dist/web/assets/{UiIcon-B8eZeuGI.js → UiIcon-BADOYtHM.js} +1 -1
- package/dist/web/assets/{UiIconButton-e754Tmnq.js → UiIconButton-CkBP6pnX.js} +1 -1
- package/dist/web/assets/{UiSegmented-D1HD-qin.js → UiSegmented-FwOnE2IZ.js} +1 -1
- package/dist/web/assets/{UiSelect-CbkTsi2e.js → UiSelect-BIhr03Gk.js} +1 -1
- package/dist/web/assets/{UiToggle-Dz93aXFK.js → UiToggle-bpyawyIe.js} +1 -1
- package/dist/web/assets/{UiWeight-CUvyApSB.js → UiWeight-TyBehy3K.js} +1 -1
- package/dist/web/assets/{UnassignedConversationsPanel-xY7gsFot.js → UnassignedConversationsPanel-B4PqImRi.js} +1 -1
- package/dist/web/assets/{VirtualDirectoryList-Dv6PwLjU.js → VirtualDirectoryList-DNQP6X8j.js} +1 -1
- package/dist/web/assets/{Workbench3D--4N_uKzp.js → Workbench3D-DNwgymIE.js} +1 -1
- package/dist/web/assets/{WritingTastePage-B7KojA4r.js → WritingTastePage-D-ELo7mh.js} +1 -1
- package/dist/web/assets/{_plugin-vue_export-helper-BmfQlfI8.js → _plugin-vue_export-helper-RegzAV-H.js} +1 -1
- package/dist/web/assets/{accordion-gXElbGP_.js → accordion-DpqAdXTB.js} +1 -1
- package/dist/web/assets/{agent-occupation-ChN-1QjC.js → agent-occupation-Ba5Fl0ys.js} +1 -1
- package/dist/web/assets/{agent-pins-Chh_rdBi.js → agent-pins-Bb7-1Uoz.js} +1 -1
- package/dist/web/assets/{agent-profile.css_vue_type_style_index_0_src_true_lang-DWlz7UoN.js → agent-profile.css_vue_type_style_index_0_src_true_lang-wT8gjVyZ.js} +1 -1
- package/dist/web/assets/{agent-work-summary-C9yMf019.js → agent-work-summary-D0a836ik.js} +1 -1
- package/dist/web/assets/{attention-store-CG9cF6DX.js → attention-store-g2-_vAhV.js} +1 -1
- package/dist/web/assets/{badge-DvvDq2Wb.js → badge-BIoC0hjn.js} +1 -1
- package/dist/web/assets/{button-CFEnxtio.js → button-A2esxd6G.js} +1 -1
- package/dist/web/assets/{checkbox-DovdRz8u.js → checkbox-DxBVlC6t.js} +1 -1
- package/dist/web/assets/{client-lh80ewvs.js → client-DAoXcTUz.js} +1 -1
- package/dist/web/assets/{console-CQMgYkk9.js → console-DiNe1hFP.js} +1 -1
- package/dist/web/assets/{conversation-launcher-settings-B1QM-wZB.js → conversation-launcher-settings-CtOlr9uP.js} +1 -1
- package/dist/web/assets/{design-lab-BDKwIbI8.js → design-lab-UWXx2ZtA.js} +1 -1
- package/dist/web/assets/{dialog-D2mO6m3B.js → dialog-DTVE8tN1.js} +1 -1
- package/dist/web/assets/{dist-PmK0PfVA.js → dist-D-8b3yGa.js} +1 -1
- package/dist/web/assets/{dropdown-menu-YzCnvjAb.js → dropdown-menu-NcUrhhmG.js} +1 -1
- package/dist/web/assets/{field-BMEFEyVC.js → field-6mg5DSC8.js} +1 -1
- package/dist/web/assets/{identity-bK-fJdnj.js → identity-FG3YqHVj.js} +1 -1
- package/dist/web/assets/index-BpQe3IT5.js +2 -0
- package/dist/web/assets/{judgment-types-DJnAr9c0.js → judgment-types-rLsl2Cis.js} +1 -1
- package/dist/web/assets/{model-Cengn9fg.js → model-BCnsjEuP.js} +1 -1
- package/dist/web/assets/{model-rumuELTi.js → model-BcMr6R8m.js} +1 -1
- package/dist/web/assets/{model-DpVrfbnj.js → model-CYJ_LZ47.js} +1 -1
- package/dist/web/assets/{model-BwNZZZNP.js → model-CeF2BATq.js} +1 -1
- package/dist/web/assets/{model-CuY1vtEy.js → model-CtmCtjml.js} +1 -1
- package/dist/web/assets/{model-CPMYnu3S.js → model-t2ZvD7wL.js} +1 -1
- package/dist/web/assets/{motion-preference-A1AMssSH.js → motion-preference-DeZURhN7.js} +1 -1
- package/dist/web/assets/{occupation-catalog-DxwlYD1L.js → occupation-catalog-q0ZjGx2o.js} +1 -1
- package/dist/web/assets/{orchestration-filters-DZpJ0FN3.js → orchestration-filters-CKf_Gzdl.js} +1 -1
- package/dist/web/assets/{page-title-Bg-mVyrS.js → page-title-BLHrexaP.js} +1 -1
- package/dist/web/assets/{personal-profile-graph-tMneNj_m.js → personal-profile-graph-IYovB9sV.js} +1 -1
- package/dist/web/assets/{project-capture-QgMw6qvo.js → project-capture-BvIPecIS.js} +1 -1
- package/dist/web/assets/{project-origin-ppsYHpYL.js → project-origin-JnGPwlfA.js} +1 -1
- package/dist/web/assets/project-team-api-Cfn41MCR.js +1 -0
- package/dist/web/assets/{quick-edit-api-BiyK3ih-.js → quick-edit-api-DzpRAPsr.js} +1 -1
- package/dist/web/assets/{shared-report-D3Hem1t5.js → shared-report-BLmBg2FG.js} +3 -3
- package/dist/web/assets/{task-labels-7KyNw9id.js → task-labels-BArOYZEW.js} +1 -1
- package/dist/web/assets/{ui-Ck58paqr.js → ui-CtW0tAA1.js} +1 -1
- package/dist/web/assets/{useAgentRecords-C6RrZwwv.js → useAgentRecords-BoOqLQcf.js} +1 -1
- package/dist/web/assets/{useApi-CROJJdhE-BujjnKN_.js → useApi-CROJJdhE-CH5wlWTU.js} +1 -1
- package/dist/web/assets/{useFocusReturn-D9IOIg17.js → useFocusReturn-DX2zmPSK.js} +1 -1
- package/dist/web/assets/{useKnowledgeItemPeek-C6nAzvDL.js → useKnowledgeItemPeek-Cfvr5H1q.js} +1 -1
- package/dist/web/assets/{useMinimumLoadingDisplay-HnxkDut6.js → useMinimumLoadingDisplay-GhG1ICNJ.js} +1 -1
- package/dist/web/assets/{useRoutePeek-BvYFc1BA.js → useRoutePeek-DydCbUhy.js} +1 -1
- package/dist/web/assets/{vue-router-Bl55c88B.js → vue-router-Dad-4p7O.js} +1 -1
- package/dist/web/index.html +32 -32
- package/docs/agent-conversations-and-collaboration.md +10 -0
- package/docs/employee-agents.md +3 -1
- package/docs/judgment-and-autonomy.md +30 -1
- package/graph-provider/fuli_graph/agent_conversation_models.py +7 -0
- package/graph-provider/fuli_graph/agent_conversation_routes.py +5 -1
- package/graph-provider/fuli_graph/default_project_lead.py +7 -3
- package/graph-provider/fuli_graph/store_agent_conversations.py +66 -34
- package/graph-provider/pyproject.toml +1 -1
- package/native/win32/fuli-win-helper.exe +0 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/packages/roundtable/src/host.js +5 -0
- package/packages/roundtable/src/peer/coordinator-service.js +20 -3
- package/packages/roundtable/src/roundtable/service.js +31 -5
- package/skills/capturing-session-knowledge/references/retrieval.md +10 -2
- package/skills/operating-fuli/references/workflow-recipes.md +2 -0
- package/src/agent-apps/host-tools/catalog.js +1 -0
- package/src/agent-tools/executor-routing-definitions.js +194 -0
- package/src/agent-tools/graph-definitions.js +20 -1279
- package/src/agent-tools/graph-handlers.js +6 -2
- package/src/agent-tools/graph-tool-fields.js +43 -0
- package/src/agent-tools/interface-catalog.js +5 -1
- package/src/agent-tools/knowledge-curation-definitions.js +167 -0
- package/src/agent-tools/knowledge-definitions.js +431 -0
- package/src/agent-tools/project-agent-tool-definitions.js +271 -0
- package/src/agent-tools/project-space-definitions.js +155 -0
- package/src/agent-tools/session-fuli-gate.js +33 -31
- package/src/agent-tools/standing-assignment-definitions.js +32 -0
- package/src/agent-tools/task-entry-definitions.js +105 -0
- package/src/agent-tools.js +5 -4
- package/src/agents/claude-code/lifecycle-hook.js +16 -2
- package/src/agents/claude-code/preference-evidence.js +11 -1
- package/src/app/application-error.js +21 -3
- package/src/conversations/capture-window.js +8 -3
- package/src/conversations/entry-budget.js +2 -10
- package/src/conversations/entry-inline-budget.js +144 -0
- package/src/conversations/entry-rules.js +1 -1
- package/src/conversations/entry-time.js +15 -0
- package/src/conversations/preference-evidence.js +19 -0
- package/src/conversations/preference-lifecycle.js +28 -7
- package/src/conversations/preference-session.js +26 -10
- package/src/conversations/preference-snapshot.js +12 -1
- package/src/conversations/sync-transcript.js +10 -6
- package/src/conversations/transcript-guard.js +4 -3
- package/src/conversations/transcript-lifecycle.js +6 -3
- package/src/data-format/local-stores.js +3 -0
- package/src/desktop/windows-installation.js +2 -1
- package/src/external-knowledge/connectors/feishu.js +3 -1
- package/src/graphiti/active-personal-space.js +5 -0
- package/src/graphiti/agent-conversations.js +23 -28
- package/src/graphiti/agent-knowledge-workflows.js +12 -1299
- package/src/graphiti/agent-project-resolution.js +11 -0
- package/src/graphiti/agent-view-records.js +19 -0
- package/src/graphiti/capture-notice.js +20 -6
- package/src/graphiti/collaboration-preference-entry.js +89 -0
- package/src/graphiti/collaboration-preference-workflow.js +1 -1
- package/src/graphiti/common-knowledge-candidates.js +222 -0
- package/src/graphiti/cross-project-knowledge-similarity.js +59 -0
- package/src/graphiti/current-project-knowledge-search.js +86 -0
- package/src/graphiti/decision-trace.js +136 -0
- package/src/graphiti/federated-application.js +158 -795
- package/src/graphiti/human-knowledge-changes.js +45 -0
- package/src/graphiti/knowledge-credential-guard.js +43 -0
- package/src/graphiti/knowledge-curation.js +178 -0
- package/src/graphiti/knowledge-feedback.js +25 -0
- package/src/graphiti/knowledge-graph-reads.js +62 -0
- package/src/graphiti/local-runtimes.js +78 -0
- package/src/graphiti/personal-global-preference-candidates.js +431 -0
- package/src/graphiti/personal-projects.js +33 -0
- package/src/graphiti/preference-conflict-requests.js +57 -0
- package/src/graphiti/preference-project-resolution.js +39 -0
- package/src/graphiti/preference-task-scope.js +18 -0
- package/src/graphiti/project-agent-control-plane.js +6 -1
- package/src/graphiti/project-agent-task-entry.js +18 -1
- package/src/graphiti/project-path-context.js +28 -9
- package/src/graphiti/provider-client.js +1 -1
- package/src/graphiti/public-project-relations.js +28 -0
- package/src/graphiti/public-projects.js +125 -0
- package/src/graphiti/publication-review-queues.js +50 -0
- package/src/graphiti/roundtable-host.js +35 -3
- package/src/graphiti/session-capture-pause-request.js +3 -2
- package/src/graphiti/session-fuli-switch.js +4 -3
- package/src/graphiti/session-knowledge-capture.js +59 -0
- package/src/graphiti/session-records.js +4 -3
- package/src/graphiti/source-marker.js +13 -3
- package/src/graphiti/standing-assignment-confirmation.js +66 -0
- package/src/graphiti/standing-assignment-correction.js +148 -0
- package/src/graphiti/standing-assignment-entry.js +223 -0
- package/src/graphiti/task-context-entry.js +114 -0
- package/src/graphiti/task-entry-preferences.js +4 -1
- package/src/graphiti/task-entry-project-mention.js +13 -2
- package/src/graphiti/task-entry-project-scope.js +12 -3
- package/src/graphiti/task-entry-standing-owner.js +141 -0
- package/src/graphiti/task-knowledge-checkpoint.js +212 -0
- package/src/graphiti/task-knowledge-guidance.js +13 -0
- package/src/graphiti/task-knowledge-recall.js +113 -2
- package/src/graphiti/task-preference-reader.js +1 -1
- package/src/graphiti/workflow-learning.js +38 -0
- package/src/graphiti/workspace-provider-client.js +10 -0
- package/src/http/api-router.js +13 -3
- package/src/http/standing-assignment-api-router.js +35 -0
- package/src/judgment/agent-view.js +29 -7
- package/src/judgment/conversation.js +8 -2
- package/src/judgment/engine.js +16 -4
- package/src/judgment/http.js +37 -5
- package/src/judgment/review-injection-precheck.js +97 -0
- package/src/judgment/review-suggestions.js +46 -0
- package/src/judgment/store.js +8 -0
- package/src/knowledge-hard-delete/delete-ledger.js +12 -3
- package/src/knowledge-hard-delete/recovery-gate.js +4 -4
- package/src/knowledge-owner-reads/console-port.js +8 -0
- package/src/knowledge-owner-reads/owner-proof.js +35 -0
- package/src/local-runtime/lifecycle.js +2 -1
- package/src/local-runtime/provider-readiness.js +35 -11
- package/src/mcp/instructions.js +3 -3
- package/src/mcp/preference-delivery.js +13 -3
- package/src/mcp/session-id.js +2 -0
- package/src/mcp/tool-annotations.js +3 -2
- package/src/model-backends/http.js +45 -8
- package/src/model-backends/role-settings.js +25 -3
- package/src/model-backends/role-trust.js +39 -6
- package/src/model-backends/runtime.js +10 -3
- package/src/model-backends/settings-history-list.js +132 -0
- package/src/model-backends/settings-history.js +175 -0
- package/src/native-runtime/java-runtime.js +4 -4
- package/src/presence/windows-helper-pin.js +1 -1
- package/src/semantic-version.js +5 -1
- package/src/server.js +3 -2
- package/src/setup/claude-code-config.js +1 -1
- package/src/setup/graph-runtime.js +42 -15
- package/src/setup/paths.js +2 -0
- package/src/standing-assignments/port.js +189 -44
- package/src/standing-assignments/store.js +12 -1
- package/src/standing-assignments/term-match.js +7 -0
- package/src/system/file-identity.js +11 -0
- package/src/system/platform-path.js +38 -0
- package/src/validation/values.js +22 -6
- package/dist/web/assets/EmployeeWorkbenchPage-BUMfMBc8.js +0 -3
- package/dist/web/assets/KnowledgePage-Bfbfz_Z8.js +0 -1
- package/dist/web/assets/ModelSettingsPage-C3eBDWRL.js +0 -1
- package/dist/web/assets/ModelSettingsPage-DZkrJw7R.css +0 -1
- package/dist/web/assets/index-r-WFOs21.js +0 -2
- package/dist/web/assets/project-team-api-DwP0O3rn.js +0 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { checkpointCompactFields } from './checkpoint-definitions.js';
|
|
2
|
+
import { workingMemorySchema } from './project-agent-memory-definitions.js';
|
|
3
|
+
import { knowledgeUsageItems } from './knowledge-usage-definitions.js';
|
|
4
|
+
import { captureEpisodeFields, captureEpisodeRequired } from './knowledge-definitions.js';
|
|
5
|
+
import { id, shortText } from './graph-tool-fields.js';
|
|
6
|
+
import { arraySchema, boundedString, enumSchema, integerSchema, nullableStringSchema, objectSchema } from './schema.js';
|
|
7
|
+
|
|
8
|
+
// A task's entry, checkpoint and preference loading, which every task meets.
|
|
9
|
+
export const TASK_ENTRY_DEFINITIONS = [
|
|
10
|
+
{
|
|
11
|
+
name: 'begin_task_context',
|
|
12
|
+
title: 'LIFECYCLE · Begin a Fuli-aware task',
|
|
13
|
+
description: 'Supported Agent hooks call before the model processes a user prompt. Resolves the exact local project from projectPath and loads effective collaboration preferences. Uses taskPrompt transiently for bounded automatic recall of signaled stable prior facts, runbooks, URLs, decisions, releases, deployments, or authentication methods. Never stores or returns projectPath/taskPrompt. Inspect task_knowledge_recall before reasking stable context. Returns opaque taskContextToken and required agent_receipt; include agent_receipt.markdown unchanged exactly once in every final user-visible reply, including greetings/capture-disabled tasks. Fuli setup generates Claude Code/Codex UserPromptSubmit hook configuration and a Cursor task-entry adapter; configuration proves neither host loading, trust, nor execution. Use supplied hook context without repeating preference fallback. Cursor retrieves context through the Agent if its hook cannot inject it.',
|
|
14
|
+
inputSchema: objectSchema({
|
|
15
|
+
sessionId: id,
|
|
16
|
+
turnId: id,
|
|
17
|
+
workflow: boundedString(128),
|
|
18
|
+
projectPath: boundedString(4096),
|
|
19
|
+
personalProjectId: nullableStringSchema(),
|
|
20
|
+
projectAgentId: nullableStringSchema(),
|
|
21
|
+
workKind: boundedString(128),
|
|
22
|
+
requiredCapabilities: arraySchema(boundedString(512), { maxItems: 16 }),
|
|
23
|
+
taskPrompt: boundedString(8192)
|
|
24
|
+
}, ['sessionId', 'projectPath'])
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'checkpoint_task_knowledge',
|
|
28
|
+
title: 'LIFECYCLE · Finish knowledge review',
|
|
29
|
+
description: 'Record capture candidates or a meaningful task workLog once. Routine empty finishes follow entry checkpoint_guidance. Employees calling this tool supply a concise truthful workLog, even with retain_nothing. Memory changes include agentMemory with loaded revision and merged notes. capture_candidates is a bounded supported batch; proposals stay pending without valid human/source confirmation. retain_nothing skips knowledge capture. No transcripts, guesses, logs, credentials or disposable output. collaborators contains actual contributing Agent IDs only; unknown/inactive IDs are ignored. Copy returned agent_receipt.markdown unchanged.',
|
|
30
|
+
inputSchema: objectSchema({
|
|
31
|
+
taskContextToken: id,
|
|
32
|
+
disposition: enumSchema(['capture_candidates', 'retain_nothing']),
|
|
33
|
+
reason: boundedString(2000),
|
|
34
|
+
workLog: objectSchema({
|
|
35
|
+
status: enumSchema(['reported', 'completed', 'incomplete', 'failed', 'no_change']),
|
|
36
|
+
summary: boundedString(2000)
|
|
37
|
+
}, ['status', 'summary']),
|
|
38
|
+
knowledgeUsage: { ...knowledgeUsageItems,
|
|
39
|
+
description: 'Explicit material use only, including with retain_nothing. Atomically recorded with checkpoint preparation using the task token as taskId; retries replay the original receipt. Retrieval and automatic preference injection do not qualify. The existing Agent confirmation policy still applies.' },
|
|
40
|
+
capture: objectSchema(captureEpisodeFields, captureEpisodeRequired),
|
|
41
|
+
captureRouting: arraySchema(objectSchema({
|
|
42
|
+
scope: enumSchema(['personal_global', 'current_project']),
|
|
43
|
+
entityKeys: arraySchema(id, { minItems: 1, maxItems: 128 }),
|
|
44
|
+
relationshipKeys: arraySchema(id, { maxItems: 256 }),
|
|
45
|
+
sourceExcerpt: shortText
|
|
46
|
+
}, ['scope', 'entityKeys', 'relationshipKeys']), { minItems: 1, maxItems: 2,
|
|
47
|
+
description: 'Use with one capture. Partition every entity/relationship key exactly once into unique scopes; each scope needs an entity, and relationships stay with their endpoints. Shared episode metadata; optional sourceExcerpt overrides its evidence. Global requires preferences with explicit global evidence; project-limited preferences stay current_project, which requires the registered task project. Ask when scope is uncertain. All routed proposals remain pending; saved IDs open existing human confirmation.' }),
|
|
48
|
+
agentMemory: objectSchema({
|
|
49
|
+
expectedRevision: integerSchema({ minimum: 0 }),
|
|
50
|
+
memory: workingMemorySchema
|
|
51
|
+
}, ['expectedRevision', 'memory']),
|
|
52
|
+
collaborators: arraySchema(boundedString(128), { maxItems: 16 }),
|
|
53
|
+
...checkpointCompactFields
|
|
54
|
+
}, ['taskContextToken', 'disposition', 'reason'])
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'verify_task_checkpoint',
|
|
58
|
+
title: 'LIFECYCLE · Verify end-of-task review',
|
|
59
|
+
description: 'Hook-facing read that returns a Claude Code Stop decision. It blocks stopping only when begin_task_context succeeded for the session and checkpoint_task_knowledge has not yet recorded capture_candidates or retain_nothing.',
|
|
60
|
+
inputSchema: objectSchema({ sessionId: id }, ['sessionId'])
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'get_collaboration_preferences',
|
|
64
|
+
title: 'READ FIRST · Load task collaboration preferences',
|
|
65
|
+
description: 'Without begin_task_context hook context, call this exact tool name at the start of every user task, before any other tool or answer; never substitute a project action. Skip when the entry hook supplied preferences. Set projectPath=current working directory and taskPrompt=current user request. Use the actual native sessionId only when supplied by the host or this turn’s Hook; never guess or use an MCP process ID. With sessionId and taskPrompt, creates a fresh durable task and taskContextToken for checkpoint_task_knowledge with truthful workLog; never treats a pending task as Hook-delivery proof. Without native sessionId or prompt, task_lifecycle=not_started: preferences remain available, checkpoint ownership unverified. Never reuse old tokens. Blocked transcript handoff stays unverified even after successful fallback checkpoint. Fuli uses projectPath/taskPrompt transiently, never stores or returns them; resolves one exact registered local project; performs bounded automatic recall only for requests signaling stable prior context. Inspect task_knowledge_recall before reasking a project fact or method. On miss, call search_current_project_knowledge with 1–4 focused action, artifact, target-system, or identifier queries; never use the full conversational request as the only query. Resolve only relevant deferred_conflicts first; apply effective_preferences before answers or tool arguments. For write tools, enforce preferences in the actual payload; the final answer is not compliance. Personal-global preferences always apply; conflicted, pending, invalid, ambiguous-project, unrelated-project items never auto-apply. Automatic injection is not usage evidence. personalProjectId is an explicit compatibility override. Before substantial implementation, use plan_agent_collaboration and follow divisionPlan with bounded worker briefs; small edits/command-only checks need no artificial split. Include returned agent_receipt.markdown unchanged exactly once in every final reply, including greetings/capture-disabled tasks; never reuse an earlier owner.',
|
|
66
|
+
inputSchema: objectSchema({
|
|
67
|
+
sessionId: id,
|
|
68
|
+
projectPath: boundedString(4096),
|
|
69
|
+
taskPrompt: boundedString(8192),
|
|
70
|
+
personalProjectId: nullableStringSchema(),
|
|
71
|
+
projectAgentId: nullableStringSchema(),
|
|
72
|
+
workKind: boundedString(128),
|
|
73
|
+
workflow: boundedString(128),
|
|
74
|
+
requiredCapabilities: arraySchema(boundedString(512), { maxItems: 16 }),
|
|
75
|
+
limit: integerSchema({ minimum: 1, maximum: 200 })
|
|
76
|
+
}, ['projectPath'])
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'get_user_taste_skill',
|
|
80
|
+
title: 'READ · Generate the current user-taste Skill',
|
|
81
|
+
description: 'Generate a bounded read-only user-taste Skill projection from effective personal preferences for the exact active project. Prior confirmed and explicitly agent-confirmed preferences inform task-specific recommendations, labeled with evidence status and scope. Preserves current-request and authoritative-constraint precedence; never overwrites user-authored taste Skills or promotes pending inferences. Call when UI, writing, product, architecture, code, or other judgment benefits from established user taste.',
|
|
82
|
+
inputSchema: objectSchema({
|
|
83
|
+
projectPath: boundedString(4096),
|
|
84
|
+
taskPrompt: boundedString(8192),
|
|
85
|
+
personalProjectId: nullableStringSchema(),
|
|
86
|
+
limit: integerSchema({ minimum: 1, maximum: 200 })
|
|
87
|
+
}, ['projectPath'])
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'resolve_deferred_preference_conflict',
|
|
91
|
+
description: 'Resolve one AI-deferred conflict from get_collaboration_preferences only when the current task needs that preference. Compare both confirmed sides with their evidence and current context before choosing. Updates effective knowledge, preserves revision history, and permanently marks prior conflict as resolved by AI. Use merge with canonical item and merged instruction, keep_left/keep_right to retain one side, or split_scope to move one side to an exact personal project. An FLA names projectAgentId and personalProjectId.',
|
|
92
|
+
inputSchema: objectSchema({
|
|
93
|
+
personalSpaceId: id, personalProjectId: nullableStringSchema(), projectAgentId: nullableStringSchema(),
|
|
94
|
+
conflictId: boundedString(1024),
|
|
95
|
+
resolution: enumSchema([
|
|
96
|
+
'merge', 'keep_left', 'keep_right', 'split_scope'
|
|
97
|
+
]),
|
|
98
|
+
reason: shortText,
|
|
99
|
+
canonicalItemId: nullableStringSchema(),
|
|
100
|
+
mergedInstruction: nullableStringSchema(),
|
|
101
|
+
splitItemId: nullableStringSchema(),
|
|
102
|
+
splitProjectId: nullableStringSchema()
|
|
103
|
+
}, ['personalSpaceId', 'conflictId', 'resolution', 'reason'])
|
|
104
|
+
}
|
|
105
|
+
];
|
package/src/agent-tools.js
CHANGED
|
@@ -4,9 +4,10 @@ import { runWithAgentRequestContext } from './app/agent-request-context.js';
|
|
|
4
4
|
import { ROUNDTABLE_TOOL_DEFINITIONS, ROUNDTABLE_TOOL_NAMES, callRoundtableTool } from './agent-roundtable/tools.js';
|
|
5
5
|
import { ApplicationError } from './app/application-error.js';
|
|
6
6
|
import { withCaptureLookups } from './graphiti/capture-decision.js';
|
|
7
|
-
import {
|
|
7
|
+
import { createSessionGate } from './agent-tools/session-fuli-gate.js';
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const SESSION_GATE = createSessionGate([...GRAPH_TOOL_DEFINITIONS, ...ROUNDTABLE_TOOL_DEFINITIONS]);
|
|
10
|
+
const TOOL_DEFINITIONS = SESSION_GATE.definitions;
|
|
10
11
|
|
|
11
12
|
export function listAgentTools() {
|
|
12
13
|
return clone(TOOL_DEFINITIONS);
|
|
@@ -16,12 +17,12 @@ export function callAgentTool(app, name, input = {}, requestContext = null) {
|
|
|
16
17
|
if (ROUNDTABLE_TOOL_NAMES.includes(name) && app.getAgentAccessPolicy?.().enabled === false) {
|
|
17
18
|
throw new ApplicationError('agent_access_disabled', 'Agent access is disabled in the local console');
|
|
18
19
|
}
|
|
19
|
-
const toolInput =
|
|
20
|
+
const toolInput = SESSION_GATE.toolInput(name, input);
|
|
20
21
|
const dispatch = () => ROUNDTABLE_TOOL_NAMES.includes(name)
|
|
21
22
|
? callRoundtableTool(app.roundtable, name, toolInput)
|
|
22
23
|
: withCaptureLookups(() => dispatchGraphTool(app, name, toolInput));
|
|
23
24
|
// A session FULI is off for gets no memory and starts no collaboration (rec#5 C3b).
|
|
24
|
-
return runWithAgentRequestContext(requestContext, () =>
|
|
25
|
+
return runWithAgentRequestContext(requestContext, () => SESSION_GATE.run(app, name, input, dispatch));
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
function clone(value) {
|
|
@@ -29,6 +29,19 @@ import { FULI_VERSION } from '../../package-metadata.js';
|
|
|
29
29
|
import { taskSceneInput } from '../../graphiti/task-scene.js';
|
|
30
30
|
import { entryBudget, entryNotice, noteEntryNotice, NO_TASK_AT_DEADLINE, partialEntryText, runWithEntryBudget } from '../../conversations/entry-budget.js';
|
|
31
31
|
|
|
32
|
+
// Claude Code shows the model only a preview (about the first 10,000
|
|
33
|
+
// characters) of a hook context longer than that and saves the rest as a file
|
|
34
|
+
// (rec#47 F1b). The preferences past the preview are then never seen, and the
|
|
35
|
+
// preview is no frame preference-evidence.js can confirm, so every turn
|
|
36
|
+
// resends the whole entry. The task entry is bounded to this many characters,
|
|
37
|
+
// label included (entry-inline-budget.js, rec#11 D-54); the rest of the 10,000
|
|
38
|
+
// is room for a notice appended after it (withOutdatedMcpNotice).
|
|
39
|
+
const CLAUDE_ENTRY_INLINE_CHARS = 9000;
|
|
40
|
+
// Claude Code resumes a session (`--resume`, `/resume`) by replaying the same
|
|
41
|
+
// transcript into the model's context, so the frames delivered before are
|
|
42
|
+
// still seen and a resume keeps the delivery base (rec#47, rec#11 D-69).
|
|
43
|
+
export const CLAUDE_REPLAYED_SOURCES = Object.freeze(['resume']);
|
|
44
|
+
|
|
32
45
|
export async function claudeLifecycleOutput(event, input, invoke, { delivery, currentTask, entryRefusal, onCurrentTask } = {}) {
|
|
33
46
|
if (!['UserPromptSubmit', 'Stop', ...PREFERENCE_RESET_EVENTS].includes(event)) throw new TypeError('Unsupported Claude lifecycle event');
|
|
34
47
|
const sessionId = input?.session_id;
|
|
@@ -37,7 +50,7 @@ export async function claudeLifecycleOutput(event, input, invoke, { delivery, cu
|
|
|
37
50
|
}
|
|
38
51
|
const source = { sourceApplication: 'claude_code', sourceSessionId: sessionId };
|
|
39
52
|
if (PREFERENCE_RESET_EVENTS.includes(event)) return preferenceLifecycleOutput(event, input,
|
|
40
|
-
{ sourceApplication: 'claude_code', delivery, currentTask, invoke });
|
|
53
|
+
{ sourceApplication: 'claude_code', delivery, currentTask, invoke, replayedSources: CLAUDE_REPLAYED_SOURCES });
|
|
41
54
|
if (event === 'UserPromptSubmit') {
|
|
42
55
|
if (typeof input.cwd !== 'string' || !input.cwd.trim() || typeof input.prompt !== 'string') {
|
|
43
56
|
throw new TypeError('Claude task entry requires cwd and prompt');
|
|
@@ -52,7 +65,8 @@ export async function claudeLifecycleOutput(event, input, invoke, { delivery, cu
|
|
|
52
65
|
});
|
|
53
66
|
const entry = compactTaskContext(context);
|
|
54
67
|
return preferenceHookOutput(entry, event, input, delivery, 'claude_code',
|
|
55
|
-
'Fuli task context. Apply effective_preferences. ' + taskClosingInstruction(entry) + PASS_TASK_TOKEN + TASK_RULES_ON_DEMAND
|
|
68
|
+
'Fuli task context. Apply effective_preferences. ' + taskClosingInstruction(entry) + PASS_TASK_TOKEN + TASK_RULES_ON_DEMAND,
|
|
69
|
+
false, { inlineChars: CLAUDE_ENTRY_INLINE_CHARS });
|
|
56
70
|
}
|
|
57
71
|
const check = await invoke('verify_task_checkpoint', { sessionId, ...source });
|
|
58
72
|
return stopHookOutcome(check, invoke, source);
|
|
@@ -5,12 +5,22 @@ export const claudePreferenceEvidence = Object.freeze({
|
|
|
5
5
|
// The same reading the transcript collector stores, so a session's own
|
|
6
6
|
// native message can be matched to its stored event.
|
|
7
7
|
normalize: normalizeClaudeRecord,
|
|
8
|
+
// A record's place in the conversation tree. A rewind leaves the turns after
|
|
9
|
+
// its point in the file as an abandoned branch; a resume replays only the
|
|
10
|
+
// chain that ends at the latest record, by parentUuid (rec#11 D-69). A
|
|
11
|
+
// sidechain or a record without a parentUuid field is not on that chain.
|
|
12
|
+
link(record, sessionId) {
|
|
13
|
+
if (record?.sessionId !== sessionId || typeof record.uuid !== 'string' || record.isSidechain === true
|
|
14
|
+
|| !Object.hasOwn(record, 'parentUuid')) return null;
|
|
15
|
+
return { id: record.uuid, parent: typeof record.parentUuid === 'string' ? record.parentUuid : null };
|
|
16
|
+
},
|
|
8
17
|
events(record, sessionId) {
|
|
9
18
|
if (record?.sessionId !== sessionId) return [];
|
|
10
19
|
if (record.type === 'system' && record.subtype === 'compact_boundary') return [{ type: 'reset' }];
|
|
11
20
|
// Hook-delivered task entry is stored as an attachment; `rendered` is the
|
|
12
21
|
// exact text the model saw. Claude stores an oversized Hook output as a
|
|
13
|
-
// preview, which does not parse as a frame and so stays a full delivery
|
|
22
|
+
// preview, which does not parse as a frame and so stays a full delivery;
|
|
23
|
+
// the task entry is bounded below that size (lifecycle-hook.js, D-54).
|
|
14
24
|
if (record.type === 'attachment' && record.attachment?.type === 'hook_additional_context'
|
|
15
25
|
&& record.attachment.hookEvent === 'UserPromptSubmit' && typeof record.uuid === 'string') {
|
|
16
26
|
const text = (Array.isArray(record.rendered) ? record.rendered : []).map(block => block?.content)
|
|
@@ -2,6 +2,7 @@ import { RoundtableError } from '../../packages/roundtable/src/errors.js';
|
|
|
2
2
|
|
|
3
3
|
export const ApplicationErrorCode = Object.freeze({
|
|
4
4
|
AGENT_ACCESS_DISABLED: 'agent_access_disabled',
|
|
5
|
+
INVALID_INPUT: 'invalid_input',
|
|
5
6
|
NOT_FOUND: 'not_found',
|
|
6
7
|
VALIDATION: 'validation'
|
|
7
8
|
});
|
|
@@ -17,8 +18,25 @@ export class ApplicationError extends Error {
|
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
export function validationError(message) {
|
|
22
|
+
return new ApplicationError(ApplicationErrorCode.VALIDATION, message);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// A caller's argument has a value FULI cannot use (rec#48). It stays a TypeError,
|
|
26
|
+
// so code that treats a TypeError as bad input (HTTP 400, connector parsing)
|
|
27
|
+
// keeps working, and it is controlled, so an Agent sees invalid_input and the
|
|
28
|
+
// message instead of internal_error. The message names the argument and what
|
|
29
|
+
// to pass; it never repeats the value, which may be a secret or a user path.
|
|
30
|
+
export class InvalidInputError extends TypeError {
|
|
31
|
+
constructor(message) {
|
|
32
|
+
super(message);
|
|
33
|
+
this.code = ApplicationErrorCode.INVALID_INPUT;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Errors whose code and message are written for the caller: FULI's own, a
|
|
38
|
+
// caller's invalid input and those raised inside the Roundtable package it hosts.
|
|
22
39
|
export function isControlledError(error) {
|
|
23
|
-
return error instanceof ApplicationError || error instanceof
|
|
40
|
+
return error instanceof ApplicationError || error instanceof InvalidInputError
|
|
41
|
+
|| error instanceof RoundtableError;
|
|
24
42
|
}
|
|
@@ -4,7 +4,12 @@ import { captureSettingsVersion } from '../graphiti/capture-decision.js';
|
|
|
4
4
|
|
|
5
5
|
const budgets = new AsyncLocalStorage();
|
|
6
6
|
const DEFAULT_CAPTURE_MS = 750;
|
|
7
|
-
|
|
7
|
+
// continued: the next hook of this session finishes what this run's capture
|
|
8
|
+
// leaves undone (transcript-lifecycle.js), so a write cut short is deferred,
|
|
9
|
+
// not lost. Only a hook that recorded this entry in its transcript guard says so.
|
|
10
|
+
export const withCaptureBudget = (timeoutMs, operation, { continued = false } = {}) =>
|
|
11
|
+
budgets.run({ timeoutMs, continued }, operation);
|
|
12
|
+
export const captureContinued = () => budgets.getStore()?.continued === true;
|
|
8
13
|
|
|
9
14
|
// Capture/recovery must leave time for preference entry. Revoking this port
|
|
10
15
|
// prevents late continuations (even broken ports ignoring AbortSignal) from
|
|
@@ -15,7 +20,7 @@ export const withCaptureBudget = (timeoutMs, operation) => budgets.run(timeoutMs
|
|
|
15
20
|
// sessionId: a conversation write is refused once it changed, so a capture
|
|
16
21
|
// that started before a pause or a switch never writes after it.
|
|
17
22
|
export async function captureWindow(application, guard, operation, {
|
|
18
|
-
timeoutMs = budgets.getStore() ?? DEFAULT_CAPTURE_MS, signal = activeAgentRequestSignal(),
|
|
23
|
+
timeoutMs = budgets.getStore()?.timeoutMs ?? DEFAULT_CAPTURE_MS, signal = activeAgentRequestSignal(),
|
|
19
24
|
settings = undefined, sessionId = null
|
|
20
25
|
} = {}) {
|
|
21
26
|
const controller = new AbortController();
|
|
@@ -39,7 +44,7 @@ export async function captureWindow(application, guard, operation, {
|
|
|
39
44
|
currentTaskContext: (query, current) => { check(); return application.personal.currentTaskContext(query, options(current)); },
|
|
40
45
|
conversation: (action, query, current) => {
|
|
41
46
|
check();
|
|
42
|
-
if (
|
|
47
|
+
if (['append', 'begin'].includes(action)) unchanged();
|
|
43
48
|
return application.personal.conversation(action, query, options(current));
|
|
44
49
|
}
|
|
45
50
|
} };
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { entryBudgets as budgets, entryTimeBelow } from './entry-time.js';
|
|
3
2
|
import { managementContextView, receiptView } from './task-context-view.js';
|
|
4
3
|
|
|
5
|
-
// The time one lifecycle hook's task entry has left (rec#39 D-40). A hook runs
|
|
6
|
-
// its entry inside a budget that ends at its own deadline; an entry without
|
|
7
|
-
// one (an Agent's own begin_task_context or get_collaboration_preferences
|
|
8
|
-
// call) has no deadline here, as before.
|
|
9
|
-
const budgets = new AsyncLocalStorage();
|
|
10
|
-
|
|
11
4
|
// A built-in Agent's model hint (Astro, Jefa) may take its 3 s model decision
|
|
12
5
|
// plus a few Provider reads; with less than this left the entry goes without.
|
|
13
6
|
const HINT_MIN_REMAINING_MS = 4000;
|
|
@@ -25,8 +18,7 @@ export function runWithEntryBudget(budget, operation) {
|
|
|
25
18
|
|
|
26
19
|
// HINT_SKIPPED when too little of the entry's time is left for a model hint.
|
|
27
20
|
export function entryHintSkipped() {
|
|
28
|
-
|
|
29
|
-
return budget && budget.deadline - budget.now() < HINT_MIN_REMAINING_MS ? HINT_SKIPPED : null;
|
|
21
|
+
return entryTimeBelow(HINT_MIN_REMAINING_MS) ? HINT_SKIPPED : null;
|
|
30
22
|
}
|
|
31
23
|
|
|
32
24
|
// What an entry already holds once its task is written and is cheap to carry:
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { copyPreferenceScope, entryWorkKind } from './preference-snapshot.js';
|
|
2
|
+
import { preferenceAlwaysInline, preferenceNamesWorkKind, preferenceSceneReplaceable } from '../graphiti/preference-task-scope.js';
|
|
3
|
+
import { blockedByDeliveryBudget } from '../mcp/preference-delivery.js';
|
|
4
|
+
|
|
5
|
+
// A task entry bounded to the inline limit of the host that shows it (rec#11
|
|
6
|
+
// D-54). An Agent adapter whose host keeps only a preview of a longer hook
|
|
7
|
+
// context passes its limit; every other entry is delivered as it is.
|
|
8
|
+
export const OMITTED_PREFERENCES_LABEL = 'More preferences apply than this entry lists (preferences_omitted): '
|
|
9
|
+
+ 'read them with its read call before acting where one may apply.';
|
|
10
|
+
// Added when hard rules are among them (D-69). A delta repeats it every turn,
|
|
11
|
+
// so it asks for one read, not one per turn.
|
|
12
|
+
export const ALWAYS_INLINE_OMITTED_LABEL = 'Hard rules are among them (preferences_omitted.includes_always_inline): '
|
|
13
|
+
+ 'if they are not already in this conversation, read the omitted ones once with read_task_preferences before acting; '
|
|
14
|
+
+ 'they stay in force.';
|
|
15
|
+
|
|
16
|
+
// The default: the entry as it is.
|
|
17
|
+
export const WHOLE_ENTRY = (value, { deliver }) => deliver(value);
|
|
18
|
+
|
|
19
|
+
// For a path without a session cache: every candidate is delivered as it is.
|
|
20
|
+
export function fitUncached(fit, value, render) {
|
|
21
|
+
const attempt = candidate => ({ candidate, result: render(candidate) });
|
|
22
|
+
return fit(value, { deliver: attempt, complete: attempt }).result;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// A fit for an inline limit of `limit`, measured by `length(result)`. The
|
|
26
|
+
// delivery passes `deliver(candidate)`, the frame this session would actually
|
|
27
|
+
// get (a delta where one applies), and `complete(candidate)`, its complete
|
|
28
|
+
// frame. The answer is always one `deliver` made.
|
|
29
|
+
//
|
|
30
|
+
// An entry that fits is unchanged. Otherwise, in this order:
|
|
31
|
+
// 1. the automatic recall becomes a pointer to its search, then the recent
|
|
32
|
+
// conversation drops its oldest messages, as the Provider's own window does;
|
|
33
|
+
// 2. then preferences go, lowest ranked first. Closing fields, identity,
|
|
34
|
+
// role, authority, conflicts and everything outside effective_preferences
|
|
35
|
+
// stay; so do hard rules (preferenceAlwaysInline). The rest rank by kind
|
|
36
|
+
// and task scene: a boundary a scene switch never revokes first, then an
|
|
37
|
+
// item whose own scene key names the task's work kind, then human-confirmed
|
|
38
|
+
// before agent-confirmed, then the Provider's order. The set is the largest
|
|
39
|
+
// ranked prefix whose complete frame fits with the leanest context, so the
|
|
40
|
+
// same preferences select the same set on the next turn, and a delta follows;
|
|
41
|
+
// 3. then as much recall and conversation as still fits comes back.
|
|
42
|
+
// What is left out is named by count with its reader. If the hard rules alone
|
|
43
|
+
// are over the limit (D-69), they are bounded the same way, as the largest
|
|
44
|
+
// prefix by scope (Agent, project, global) and then the Provider's order, and
|
|
45
|
+
// the omission says so (includes_always_inline): past Claude Code's preview
|
|
46
|
+
// they were never seen.
|
|
47
|
+
export function inlineEntryFit(limit, length) {
|
|
48
|
+
return (value, { deliver, complete }) => {
|
|
49
|
+
// A frame the renderer blocked as over its own delivery budget is short,
|
|
50
|
+
// but delivers nothing: it does not fit. Size only grows with the entry,
|
|
51
|
+
// so both conditions stay monotonic for the search below. Any other
|
|
52
|
+
// blocked reason is kept as it is.
|
|
53
|
+
const fits = attempt => !blockedByDeliveryBudget(attempt.result.structuredContent) && length(attempt.result) <= limit;
|
|
54
|
+
const levels = contextLevels(value);
|
|
55
|
+
for (const level of levels) {
|
|
56
|
+
const attempt = deliver(level);
|
|
57
|
+
if (fits(attempt)) return attempt;
|
|
58
|
+
}
|
|
59
|
+
const preferences = Array.isArray(value.effective_preferences) ? value.effective_preferences : [];
|
|
60
|
+
const { kept, ranked } = inlineRanking(preferences, entryWorkKind(value));
|
|
61
|
+
const leanestFits = selected => fits(complete(withPreferences(levels.at(-1), selected, preferences.length)));
|
|
62
|
+
// What the search may leave out: the ranked rest after every hard rule,
|
|
63
|
+
// or the hard rules themselves when they alone do not fit.
|
|
64
|
+
const [fixed, order] = !kept.length || leanestFits(new Set(kept)) ? [kept, ranked] : [[], kept];
|
|
65
|
+
if (!order.length) return deliver(levels.at(-1));
|
|
66
|
+
const selection = count => new Set([...fixed, ...order.slice(0, count)]);
|
|
67
|
+
// At least one item of `order` is left out: with all of them nothing fit.
|
|
68
|
+
let low = 0;
|
|
69
|
+
let high = order.length - 1;
|
|
70
|
+
while (low < high) {
|
|
71
|
+
const middle = Math.ceil((low + high) / 2);
|
|
72
|
+
if (leanestFits(selection(middle))) low = middle;
|
|
73
|
+
else high = middle - 1;
|
|
74
|
+
}
|
|
75
|
+
const selected = selection(low);
|
|
76
|
+
let attempt;
|
|
77
|
+
for (const level of levels) {
|
|
78
|
+
attempt = deliver(withPreferences(level, selected, preferences.length));
|
|
79
|
+
if (fits(attempt)) return attempt;
|
|
80
|
+
}
|
|
81
|
+
return attempt;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// A more specific rule overrides a broader one, so it is the one the model is
|
|
86
|
+
// least able to infer: hard rules that must be trimmed keep these first (D-69).
|
|
87
|
+
const SCOPE_SPECIFICITY = Object.freeze({ agent: 0, project: 1, global: 2 });
|
|
88
|
+
const specificity = item => SCOPE_SPECIFICITY[item.preference_scope] ?? 3;
|
|
89
|
+
|
|
90
|
+
// Indexes into effective_preferences: those that always stay, most specific
|
|
91
|
+
// scope first, then the Provider's order, and the rest in rank order.
|
|
92
|
+
function inlineRanking(preferences, workKind) {
|
|
93
|
+
const kept = [], optional = [];
|
|
94
|
+
preferences.forEach((item, index) => (preferenceAlwaysInline(item) ? kept : optional).push(index));
|
|
95
|
+
kept.sort((a, b) => specificity(preferences[a]) - specificity(preferences[b]) || a - b);
|
|
96
|
+
const rank = index => [preferenceSceneReplaceable(preferences[index]) ? 1 : 0,
|
|
97
|
+
preferenceNamesWorkKind(preferences[index], workKind) ? 0 : 1,
|
|
98
|
+
preferences[index].confirmation_status === 'confirmed' ? 0 : 1, index];
|
|
99
|
+
const ranked = optional.map(index => [rank(index), index])
|
|
100
|
+
.sort(([a], [b]) => a[0] - b[0] || a[1] - b[1] || a[2] - b[2] || a[3] - b[3]).map(([, index]) => index);
|
|
101
|
+
return { kept, ranked };
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function withPreferences(level, selected, total) {
|
|
105
|
+
return copyPreferenceScope(level, { ...level,
|
|
106
|
+
effective_preferences: level.effective_preferences.filter((_, index) => selected.has(index)),
|
|
107
|
+
preferences_omitted: { count: total - selected.size,
|
|
108
|
+
...(level.effective_preferences.some((item, index) => !selected.has(index) && preferenceAlwaysInline(item))
|
|
109
|
+
? { includes_always_inline: true } : {}),
|
|
110
|
+
read: { tool: 'read_task_preferences', arguments: { taskContextToken: level.taskContextToken } } } });
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// The entry, then each smaller context: the recall as a pointer, then the
|
|
114
|
+
// conversation window without its oldest message, one at a time. A window
|
|
115
|
+
// that drops a message says so as the Provider does: truncated, with the
|
|
116
|
+
// latest omitted sequence; read_agent_conversation reads it whole.
|
|
117
|
+
function contextLevels(value) {
|
|
118
|
+
const levels = [value];
|
|
119
|
+
let current = value;
|
|
120
|
+
const recall = value.task_knowledge_recall;
|
|
121
|
+
if (recall?.facts?.length || recall?.entities?.length || recall?.knowledge_index) {
|
|
122
|
+
current = copyPreferenceScope(value, { ...value, task_knowledge_recall: recallPointer(recall) });
|
|
123
|
+
levels.push(current);
|
|
124
|
+
}
|
|
125
|
+
const recovery = current.conversation?.recovery;
|
|
126
|
+
const messages = Array.isArray(recovery?.messages) ? recovery.messages : [];
|
|
127
|
+
for (let dropped = 1; dropped <= messages.length; dropped++) {
|
|
128
|
+
levels.push(copyPreferenceScope(value, { ...current, conversation: { ...current.conversation, recovery: { ...recovery,
|
|
129
|
+
messages: messages.slice(dropped), truncated: true,
|
|
130
|
+
omitted_sequence: Math.max(recovery.omitted_sequence ?? 0, messages[dropped - 1].sequence) } } }));
|
|
131
|
+
}
|
|
132
|
+
return levels;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// The recall without its items: what it matched, how many, and the search
|
|
136
|
+
// that reads them (task_knowledge_recall's own guidance says how to query).
|
|
137
|
+
// A title-only knowledge_index (rec#51 D-59) is per task like the recall, so
|
|
138
|
+
// it goes with the recall, before any preference.
|
|
139
|
+
function recallPointer(recall) {
|
|
140
|
+
const { facts = [], entities = [], knowledge_index: index, sourceMarker: _marker, noMatchSourceMarker: _none,
|
|
141
|
+
pending_fallback: _pending, confirmed_use: _confirmed, retrieval_budget: _budget, ...summary } = recall;
|
|
142
|
+
return { ...summary, items_omitted: facts.length + entities.length + (index?.items.length ?? 0),
|
|
143
|
+
read: { tool: 'search_current_project_knowledge' } };
|
|
144
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isDeepStrictEqual } from 'node:util';
|
|
2
2
|
import { contentHash } from '../../packages/roundtable/src/canonical-json.js';
|
|
3
|
-
import { STOP_HOOK_CHECKPOINT_GUIDANCE, taskKnowledgeGuidance } from '../graphiti/
|
|
3
|
+
import { STOP_HOOK_CHECKPOINT_GUIDANCE, taskKnowledgeGuidance } from '../graphiti/task-knowledge-guidance.js';
|
|
4
4
|
import { GENERIC_SCOPE_GUIDANCE, STATIC_APPLICATION_GUIDANCE } from '../graphiti/collaboration-preference-workflow.js';
|
|
5
5
|
import { CONVERSATION_GUIDANCE } from '../graphiti/agent-conversations.js';
|
|
6
6
|
import { PROJECT_AGENT_CONTINUITY_GUIDANCE } from '../graphiti/project-agent-task-entry.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
|
|
3
|
+
// The time one lifecycle hook's task entry has left (rec#39 D-40). A hook runs
|
|
4
|
+
// its entry inside a budget that ends at its own deadline; an entry without
|
|
5
|
+
// one (an Agent's own begin_task_context or get_collaboration_preferences
|
|
6
|
+
// call) has no deadline here, as before. Its own module, free of entry views,
|
|
7
|
+
// so a part of the entry (the recall) can check its time without a cycle.
|
|
8
|
+
export const entryBudgets = new AsyncLocalStorage();
|
|
9
|
+
|
|
10
|
+
// Whether less than `ms` of this entry's time is left. An entry without a
|
|
11
|
+
// budget has no deadline here, so it never is.
|
|
12
|
+
export function entryTimeBelow(ms) {
|
|
13
|
+
const budget = entryBudgets.getStore();
|
|
14
|
+
return Boolean(budget) && budget.deadline - budget.now() < ms;
|
|
15
|
+
}
|
|
@@ -28,6 +28,7 @@ export async function readPreferenceEvidence(path, sessionId, adapter, recordOff
|
|
|
28
28
|
if (bytesRead !== bytes.length || bytes.at(-1) !== 10) return { known: false };
|
|
29
29
|
const calls = new Map();
|
|
30
30
|
const records = new Map();
|
|
31
|
+
const tree = { parents: new Map(), ids: new Map(), leaf: null };
|
|
31
32
|
let frames = [], offset = 0, generation = null, since = 0;
|
|
32
33
|
for (const line of bytes.toString('utf8').split('\n').slice(0, -1)) {
|
|
33
34
|
const end = offset + Buffer.byteLength(line) + 1;
|
|
@@ -36,6 +37,8 @@ export async function readPreferenceEvidence(path, sessionId, adapter, recordOff
|
|
|
36
37
|
if (!adapter.verify(record, sessionId)) return { known: false };
|
|
37
38
|
generation = contentHash(line);
|
|
38
39
|
}
|
|
40
|
+
const link = adapter.link?.(record, sessionId);
|
|
41
|
+
if (link) { tree.parents.set(link.id, link.parent); tree.ids.set(offset, link.id); tree.leaf = link.id; }
|
|
39
42
|
if (recordOffsets.has(offset)) records.set(offset, record);
|
|
40
43
|
for (const event of adapter.events(record, sessionId)) {
|
|
41
44
|
if (event.type === 'reset') { calls.clear(); frames = []; generation = contentHash({ offset, line }); since = end; }
|
|
@@ -59,11 +62,27 @@ export async function readPreferenceEvidence(path, sessionId, adapter, recordOff
|
|
|
59
62
|
}
|
|
60
63
|
offset = end;
|
|
61
64
|
}
|
|
65
|
+
const active = activeChain(tree);
|
|
66
|
+
if (active) {
|
|
67
|
+
frames = frames.filter(frame => active.has(tree.ids.get(frame.offset)));
|
|
68
|
+
for (const at of records.keys()) if (!active.has(tree.ids.get(at))) records.delete(at);
|
|
69
|
+
}
|
|
62
70
|
return { known: true, fileId: `${stat.dev}:${stat.ino}`, size: bytes.length, generation, since, frames, records };
|
|
63
71
|
} catch { return { known: false }; }
|
|
64
72
|
finally { await file?.close(); }
|
|
65
73
|
}
|
|
66
74
|
|
|
75
|
+
// For a host whose records form a tree (an adapter with `link`), only the
|
|
76
|
+
// chain that ends at the latest linked record is the model's context: what a
|
|
77
|
+
// rewind left behind proves nothing. Null for a transcript without links,
|
|
78
|
+
// which is read in file order as before.
|
|
79
|
+
function activeChain({ parents, leaf }) {
|
|
80
|
+
if (leaf === null) return null;
|
|
81
|
+
const chain = new Set();
|
|
82
|
+
for (let id = leaf; id !== null && parents.has(id) && !chain.has(id); id = parents.get(id)) chain.add(id);
|
|
83
|
+
return chain;
|
|
84
|
+
}
|
|
85
|
+
|
|
67
86
|
function evidenceToolName(event) {
|
|
68
87
|
if (!/^(?:mcp__fuli__|mcp__fuli\.)fuli_call$/.test(event.name ?? '')) return event.name;
|
|
69
88
|
try {
|
|
@@ -2,14 +2,23 @@ import { compactTaskContext } from './task-context-view.js';
|
|
|
2
2
|
import { hookAdditionalContextToolResult } from '../mcp/tool-result.js';
|
|
3
3
|
import { SESSION_FULI_OFF } from '../agent-tools/session-fuli-gate.js';
|
|
4
4
|
import { withoutDeliveryProofs } from './recent-context.js';
|
|
5
|
+
import { ALWAYS_INLINE_OMITTED_LABEL, fitUncached, inlineEntryFit, OMITTED_PREFERENCES_LABEL, WHOLE_ENTRY }
|
|
6
|
+
from './entry-inline-budget.js';
|
|
5
7
|
|
|
6
8
|
export const PREFERENCE_RESET_EVENTS = Object.freeze(['SessionStart', 'PreCompact']);
|
|
7
9
|
const RESTORED_LABEL = 'Fuli restored current mandatory preferences for the same owned task. Apply this full result; no replacement task or Agent was selected.';
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
// `replayedSources`: the SessionStart sources after which the Agent's host
|
|
12
|
+
// replays the same native transcript into the model's context (Claude Code's
|
|
13
|
+
// resume, rec#11 D-69). The frames delivered before stay model-visible, so the
|
|
14
|
+
// context generation and its pending frames are kept and nothing is restored;
|
|
15
|
+
// a compaction the host records still starts a new generation.
|
|
16
|
+
export async function preferenceLifecycleOutput(event, input, { sourceApplication, delivery, currentTask, invoke,
|
|
17
|
+
replayedSources = [] }) {
|
|
10
18
|
if (typeof input?.session_id !== 'string' || !input.session_id.trim() || input.session_id.length > 256) {
|
|
11
19
|
throw new TypeError('Preference reset requires a native session identifier');
|
|
12
20
|
}
|
|
21
|
+
if (event === 'SessionStart' && replayedSources.includes(input?.source)) return {};
|
|
13
22
|
const origin = { sourceApplication, nativeSessionId: input?.session_id, transcriptPath: input?.transcript_path };
|
|
14
23
|
await delivery?.reset(origin);
|
|
15
24
|
if (event !== 'SessionStart' || !['compact', 'resume', 'fork'].includes(input?.source)) return {};
|
|
@@ -35,12 +44,24 @@ export async function currentTaskPreferences(input, { sourceApplication, current
|
|
|
35
44
|
return { status: 'refreshed', context: compactTaskContext(recovered) };
|
|
36
45
|
}
|
|
37
46
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
})
|
|
47
|
+
// `inlineChars` is the inline limit of a host that keeps only a preview of a
|
|
48
|
+
// longer hook context (entry-inline-budget.js); without it the entry is whole.
|
|
49
|
+
export async function preferenceHookOutput(value, event, input, delivery, sourceApplication, label, forceFull = false,
|
|
50
|
+
{ inlineChars = null } = {}) {
|
|
51
|
+
const format = projected => hookAdditionalContextToolResult(projected, { hookEventName: event,
|
|
52
|
+
label: omittedLabel(label, projected?.preferences_omitted), limitBytes: 128 * 1024, itemLimit: 1000 });
|
|
53
|
+
const fit = inlineChars ? inlineEntryFit(inlineChars, hookContextLength) : WHOLE_ENTRY;
|
|
42
54
|
const result = delivery ? await delivery.deliver(value, { sourceApplication,
|
|
43
|
-
nativeSessionId: input.session_id, transcriptPath: input.transcript_path, forceFull }, format)
|
|
44
|
-
: format(withoutDeliveryProofs(
|
|
55
|
+
nativeSessionId: input.session_id, transcriptPath: input.transcript_path, forceFull }, format, fit)
|
|
56
|
+
: fitUncached(fit, value, projected => format(withoutDeliveryProofs(projected)));
|
|
45
57
|
return JSON.parse(result.content[0].text);
|
|
46
58
|
}
|
|
59
|
+
|
|
60
|
+
function omittedLabel(label, omitted) {
|
|
61
|
+
if (!omitted) return label;
|
|
62
|
+
return [label, OMITTED_PREFERENCES_LABEL, ...(omitted.includes_always_inline ? [ALWAYS_INLINE_OMITTED_LABEL] : [])].join(' ');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function hookContextLength(result) {
|
|
66
|
+
return JSON.parse(result.content[0].text).hookSpecificOutput.additionalContext.length;
|
|
67
|
+
}
|