fuli-context 0.22.0 → 0.23.0-beta.1
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-C2Ak6Jii.js → AboutPage-BZevN4wn.js} +1 -1
- package/dist/web/assets/{AgentHand-Cxou5bPl.js → AgentHand-DQjd-bfo.js} +1 -1
- package/dist/web/assets/{AgentMentionCopy-CibgcJTC.js → AgentMentionCopy-C2xP3yp1.js} +1 -1
- package/dist/web/assets/{AgentName-CrIgUC1K.js → AgentName-DAqd46v2.js} +1 -1
- package/dist/web/assets/{AgentProfilePage-ffwdNhMX.js → AgentProfilePage-DQxcMBrV.js} +1 -1
- package/dist/web/assets/{AgentServicesPage-D1_fa1SC.js → AgentServicesPage-CEkqyXFe.js} +1 -1
- package/dist/web/assets/{AgentsDirectoryPage-SgbPuztQ.js → AgentsDirectoryPage-BlUekfg2.js} +1 -1
- package/dist/web/assets/{BackLink-BrzA4htj.js → BackLink-C0EH7p5J.js} +1 -1
- package/dist/web/assets/{BoardMoveMenu-DgPJT8s1.js → BoardMoveMenu-kA85A60E.js} +1 -1
- package/dist/web/assets/{CaptureChangePage-bCYtY611.js → CaptureChangePage-C5cwSaGI.js} +1 -1
- package/dist/web/assets/{Card-Zhpf1co5.js → Card-BxcUhI7E.js} +1 -1
- package/dist/web/assets/{CardHeader-C9JtHZXs.js → CardHeader-DfhgDeKF.js} +1 -1
- package/dist/web/assets/{CardTitle-B8HEul5N.js → CardTitle-3cnh9i0w.js} +1 -1
- package/dist/web/assets/{ConnectionsPage-CSWl_R-1.js → ConnectionsPage-CX8pPOqs.js} +1 -1
- package/dist/web/assets/{CreateProjectDialog-CApQ6Yzi.js → CreateProjectDialog-CdhDEBNO.js} +1 -1
- package/dist/web/assets/DataFormatPage-CpWphMGD.css +1 -0
- package/dist/web/assets/DataFormatPage-DPxKg9S7.js +2 -0
- package/dist/web/assets/{DialogFooter-CRWvDbVh.js → DialogFooter-DRC89oAS.js} +1 -1
- package/dist/web/assets/{EmployeeScopeDialog-Brpg45xh.js → EmployeeScopeDialog-DNZvMV_n.js} +1 -1
- package/dist/web/assets/{EmployeeWorkbenchPage-7cyTmiY7.js → EmployeeWorkbenchPage-Bac47uQg.js} +1 -1
- package/dist/web/assets/{FieldDescription-C1ZURDEJ.js → FieldDescription-Lmm1kCex.js} +1 -1
- package/dist/web/assets/{GrowthLoading-DnSjbwAi.js → GrowthLoading-B_HiU1ou.js} +1 -1
- package/dist/web/assets/{InboxPage-mwimM5mD.js → InboxPage-EZS5H5dg.js} +1 -1
- package/dist/web/assets/{Input-B45GFhbM.js → Input-DJ3K0uJF.js} +1 -1
- package/dist/web/assets/{KnowledgeHardDeleteSection-BaJhsOxD.js → KnowledgeHardDeleteSection-DDeD2cPD.js} +1 -1
- package/dist/web/assets/{KnowledgeItemEditPage-BpnyOFSx.js → KnowledgeItemEditPage-FK83dnD8.js} +1 -1
- package/dist/web/assets/{KnowledgeItemSummaryCard-0N1WaM7k.js → KnowledgeItemSummaryCard-DWES4QXn.js} +1 -1
- package/dist/web/assets/{KnowledgeOrganizerPage-CCBudWpM.js → KnowledgeOrganizerPage-sgcXe2AK.js} +1 -1
- package/dist/web/assets/KnowledgePage-DMRw4S7w.js +1 -0
- package/dist/web/assets/KnowledgePeek-WvxsaNgI.js +1 -0
- package/dist/web/assets/{KnowledgeTurnReceiptPage-D4c47u_s.js → KnowledgeTurnReceiptPage-ChRKFwAX.js} +1 -1
- package/dist/web/assets/KnowledgeWorkspace-DmruBzCD.js +4 -0
- package/dist/web/assets/{KnowledgeWorkspace-CA8oxVht.css → KnowledgeWorkspace-j8xlGwtg.css} +1 -1
- package/dist/web/assets/{Label-CBRsKlFL.js → Label-DIiyp_v7.js} +1 -1
- package/dist/web/assets/ModelSettingsPage-DuUyIZNh.js +1 -0
- package/dist/web/assets/{NotFoundPage-CWfYMNhr.js → NotFoundPage-D_FKu0_c.js} +1 -1
- package/dist/web/assets/{OccupationsPage-BEbQ19dD.js → OccupationsPage-DAbwzyG5.js} +1 -1
- package/dist/web/assets/{OverviewPage-Dg3wnb1d.js → OverviewPage-BM2JnEp1.js} +2 -2
- package/dist/web/assets/{PersonalProfilePage-CLD5CnhQ.js → PersonalProfilePage-e1zMUNRj.js} +1 -1
- package/dist/web/assets/{PersonalProjectsPage-Dcbgmfi_.js → PersonalProjectsPage-Cox4cA0J.js} +1 -1
- package/dist/web/assets/{PopperContent-CESNmYJq.js → PopperContent-CovGqhrO.js} +1 -1
- package/dist/web/assets/{Presence-DXkWbJEH.js → Presence-BZYrsR06.js} +1 -1
- package/dist/web/assets/{ProjectAgentDetailPage-io2UP0of.js → ProjectAgentDetailPage-e_wpdkjj.js} +1 -1
- package/dist/web/assets/{ProjectAgentDialog-DlzKuGB1.js → ProjectAgentDialog-9A6rbn1A.js} +1 -1
- package/dist/web/assets/{ProjectAgentFirstTask-Dy06Eyzw.js → ProjectAgentFirstTask-BBAdd7eW.js} +1 -1
- package/dist/web/assets/ProjectAgentsPage-BJmeCw6D.js +1 -0
- package/dist/web/assets/ProjectAgentsPage-DeCnoNNz.css +1 -0
- package/dist/web/assets/{ProjectJudgmentPolicy-BFx527E9.js → ProjectJudgmentPolicy-Coan9QA8.js} +1 -1
- package/dist/web/assets/{ProjectScopePicker-Cqk9DQKF.js → ProjectScopePicker-EkhCwjjN.js} +1 -1
- package/dist/web/assets/{PublicProjectsPage-W3CZmgxE.js → PublicProjectsPage-JO_-PUSy.js} +1 -1
- package/dist/web/assets/RadioGroupItem-Cqz8flIX.js +1 -0
- package/dist/web/assets/{RoundtablesPage-BvfBQcJ7.js → RoundtablesPage-CdN51dmm.js} +1 -1
- package/dist/web/assets/RovingFocusGroup-Cu_CS92q.js +1 -0
- package/dist/web/assets/{RovingFocusItem-CkXsXOwz.js → RovingFocusItem-CRGym5zM.js} +1 -1
- package/dist/web/assets/{SessionMigrationPage-elCVaNnK.js → SessionMigrationPage-BG3Ywo58.js} +1 -1
- package/dist/web/assets/{SessionRecordsPage-CgTk9zqc.js → SessionRecordsPage-Ds9rURfz.js} +1 -1
- package/dist/web/assets/{SettingsPage-DpVeP2OZ.css → SettingsPage-BxAXf6EF.css} +1 -1
- package/dist/web/assets/SettingsPage-CZDxLCcd.js +1 -0
- package/dist/web/assets/{SharedJefaReportPage-CViBxD_v.js → SharedJefaReportPage-Y-t_GyHI.js} +1 -1
- package/dist/web/assets/Switch-Bs5Y637D.js +1 -0
- package/dist/web/assets/{TableHeader-B6al55kg.js → TableHeader-DsrA1mBl.js} +1 -1
- package/dist/web/assets/{TabsContent-C6fnXu6I.js → TabsContent-Cggqj6Gq.js} +1 -1
- package/dist/web/assets/{TabsTrigger-CIQwVltR.js → TabsTrigger-DLvQ41jZ.js} +1 -1
- package/dist/web/assets/{TagVocabularyPage-D88AyXKA.js → TagVocabularyPage-QwookbOy.js} +1 -1
- package/dist/web/assets/{TaskBlockerClear-B_xAPoLz.js → TaskBlockerClear-CWC-w1mt.js} +1 -1
- package/dist/web/assets/{TaskBlockerNotice-B3PHEmtC.js → TaskBlockerNotice-DnvnbEYS.js} +1 -1
- package/dist/web/assets/{TaskExecutionPlan-CVcrXGM8.js → TaskExecutionPlan-HrvSyTQS.js} +1 -1
- package/dist/web/assets/{TaskReason-TdaOCf7S.js → TaskReason-DGlV-Itb.js} +1 -1
- package/dist/web/assets/{Teleport-DQmFiMAU.js → Teleport-C1GSsQzn.js} +1 -1
- package/dist/web/assets/{TextField-BdQdL1Lx.js → TextField-DMMC3HFC.js} +1 -1
- package/dist/web/assets/{Textarea-CnjoFPB6.js → Textarea-CPg_f2nP.js} +1 -1
- package/dist/web/assets/{UiChip-CILP7dOO.js → UiChip-CAqxZnZz.js} +1 -1
- package/dist/web/assets/{UiDialog-BIxwydDu.js → UiDialog-CyTDncR_.js} +1 -1
- package/dist/web/assets/{UiDisclosure-SMhU3tcV.js → UiDisclosure-BtlqsGRI.js} +1 -1
- package/dist/web/assets/{UiIcon-BPTz4pnL.js → UiIcon-DHNpp4mP.js} +1 -1
- package/dist/web/assets/{UiIconButton-jmIfQNdm.js → UiIconButton-BaTKxuDb.js} +1 -1
- package/dist/web/assets/{UiNotice-DsJRHRTA.js → UiNotice-BTTebDuY.js} +1 -1
- package/dist/web/assets/{UiSegmented-D-dME5Lr.js → UiSegmented-BEjRqacU.js} +1 -1
- package/dist/web/assets/{UiSelect-B7p9uzs4.js → UiSelect-B39E87Gw.js} +1 -1
- package/dist/web/assets/{UiWeight-B_8vlc3_.js → UiWeight-DqMmxiUB.js} +1 -1
- package/dist/web/assets/{UnassignedConversationsPanel-BGrKUSEX.js → UnassignedConversationsPanel-CzJYgnGt.js} +1 -1
- package/dist/web/assets/{VirtualDirectoryList-B_L9kwcm.js → VirtualDirectoryList-C1n_NU3i.js} +1 -1
- package/dist/web/assets/VisuallyHiddenInput-QRMVXTU-.js +1 -0
- package/dist/web/assets/{Workbench3D-Doh6x9Ot.js → Workbench3D-MUSAOhg5.js} +1 -1
- package/dist/web/assets/{_plugin-vue_export-helper-Be38Jawd.js → _plugin-vue_export-helper-Bgi5Adgh.js} +2 -2
- package/dist/web/assets/accordion-D9KZ6E7n.js +1 -0
- package/dist/web/assets/{agent-pins-CJDVKD1Y.js → agent-pins-DC-qOizG.js} +1 -1
- package/dist/web/assets/{agent-profile.css_vue_type_style_index_0_src_true_lang-W7mMZ3bu.js → agent-profile.css_vue_type_style_index_0_src_true_lang-BkOr_5IO.js} +1 -1
- package/dist/web/assets/{agent-roster-records-DGNNHsa3.js → agent-roster-records-BV26Bxtz.js} +1 -1
- package/dist/web/assets/{agent-work-summary-CbZjWLGE.js → agent-work-summary-CltZ5mHV.js} +1 -1
- package/dist/web/assets/{attach-closest-edge-B0bgWmui.js → attach-closest-edge-CBvjqshP.js} +1 -1
- package/dist/web/assets/{attention-store-BklrG2I7.js → attention-store-Co1U_FVl.js} +1 -1
- package/dist/web/assets/{badge-G1xmTvLV.js → badge-BobeclZM.js} +1 -1
- package/dist/web/assets/{button-Xb0cKhdr.js → button-CPBGqr-G.js} +1 -1
- package/dist/web/assets/checkbox-Ccu3f0uw.js +1 -0
- package/dist/web/assets/{client-CJGUYN1M.js → client-DASPYHDX.js} +1 -1
- package/dist/web/assets/{client-links-store-HoGAJb4t.js → client-links-store-CCOgFz_g.js} +1 -1
- package/dist/web/assets/{console-Cnye1IOw.js → console-BoswQ5iY.js} +1 -1
- package/dist/web/assets/conversation-launcher-settings-CxkWksTz.js +1 -0
- package/dist/web/assets/{design-lab-B9JU_TOQ.js → design-lab-C499L6w7.js} +1 -1
- package/dist/web/assets/{dialog-CWJVMpu3.js → dialog-CYWlUyCj.js} +1 -1
- package/dist/web/assets/{dist-lEETOIok.js → dist-QLkKw6P5.js} +1 -1
- package/dist/web/assets/{dropdown-menu-DVE0b7Uc.js → dropdown-menu-0ZbUpGMn.js} +1 -1
- package/dist/web/assets/{field-ZZ-C7-wp.js → field-Dy7CUUaW.js} +1 -1
- package/dist/web/assets/{identity-wHyBLirA.js → identity-Ck-mMtzd.js} +1 -1
- package/dist/web/assets/index-B5zVxSJb.css +1 -0
- package/dist/web/assets/index-ByTiCAxr.js +2 -0
- package/dist/web/assets/is-equal-8VOV02sH.js +1 -0
- package/dist/web/assets/{judgment-api-BwOm0hL8.js → judgment-api-BGFfL743.js} +1 -1
- package/dist/web/assets/label-table-DlH-VeUf.js +1 -0
- package/dist/web/assets/{model-BndkODhT.js → model-Bpk9KStB.js} +1 -1
- package/dist/web/assets/model-BrfCw_Gc.js +1 -0
- package/dist/web/assets/{model-BnIF0iqb.js → model-D1HOcPfy.js} +1 -1
- package/dist/web/assets/{model-YwLQNm5s.js → model-DGLvlb0a.js} +1 -1
- package/dist/web/assets/{model-DqILignz.js → model-DXgmUEFa.js} +1 -1
- package/dist/web/assets/{model-DdrMcS8b.js → model-FjvfoBQw.js} +1 -1
- package/dist/web/assets/{motion-preference-D7rorL9a.js → motion-preference-CmR8Gccp.js} +1 -1
- package/dist/web/assets/{occupation-catalog-BG1VjWtG.js → occupation-catalog-C4lixlYB.js} +1 -1
- package/dist/web/assets/{orchestration-filters-BKS3yBja.js → orchestration-filters-1eFzjnUI.js} +1 -1
- package/dist/web/assets/{page-title-BiSHyu6N.js → page-title-B3vN5inr.js} +1 -1
- package/dist/web/assets/{profile-model-i36bqqb2.js → profile-model-DqTIwuma.js} +1 -1
- package/dist/web/assets/{project-board-layout-DPItL60Q.js → project-board-layout-BLjje07u.js} +1 -1
- package/dist/web/assets/{project-capture-CFeMGS5O.js → project-capture-CScYj4iL.js} +1 -1
- package/dist/web/assets/{project-origin-wTTsd0pp.js → project-origin-DAnyAkeT.js} +1 -1
- package/dist/web/assets/project-team-api-5qgO5dko.js +1 -0
- package/dist/web/assets/{quick-edit-api-BbKWyjWy.js → quick-edit-api-Ci_1wJx2.js} +1 -1
- package/dist/web/assets/select-CV_88Xs6.js +1 -0
- package/dist/web/assets/shared-report-DcsPHds1.js +3 -0
- package/dist/web/assets/source-adapters-Csc9hH0z.js +1 -0
- package/dist/web/assets/task-labels-CgJ_RP2L.js +1 -0
- package/dist/web/assets/ui-BR5c4U0Q.js +1 -0
- package/dist/web/assets/{useAgentRecords-V5t2SdoJ.js → useAgentRecords-DtZJbT3L.js} +1 -1
- package/dist/web/assets/{useApi-CROJJdhE-BUho7jmG.js → useApi-CROJJdhE-CNRkOM8H.js} +1 -1
- package/dist/web/assets/useDirection-D9oE75cN.js +1 -0
- package/dist/web/assets/{useFocusReturn-DaWUYyV8.js → useFocusReturn-BJpRnQpe.js} +1 -1
- package/dist/web/assets/{useForwardExpose-BW43swEH.js → useForwardExpose-BcO6Kcvk.js} +1 -1
- package/dist/web/assets/{useKnowledgeItemPeek-BJBUG0nY.js → useKnowledgeItemPeek-Bk6vd9MA.js} +1 -1
- package/dist/web/assets/{useMinimumLoadingDisplay-DT1pktOl.js → useMinimumLoadingDisplay-C62LKG66.js} +1 -1
- package/dist/web/assets/usePrimitiveElement-BYtFyLMB.js +1 -0
- package/dist/web/assets/{useRoutePeek-dXJW_jIl.js → useRoutePeek-CxSIJsnT.js} +1 -1
- package/dist/web/assets/{useTypeahead-BVDZWCri.js → useTypeahead-Cuh4nPnt.js} +1 -1
- package/dist/web/assets/{utils-BTTEEOG-.js → utils-pH6w3_EN.js} +1 -1
- package/dist/web/assets/{vue-router-DMMH71_5.js → vue-router-Brbw8DlN.js} +1 -1
- package/dist/web/index.html +44 -41
- 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/skills/operating-fuli/references/workflow-recipes.md +2 -0
- package/src/agent-tools/interface-catalog.js +3 -1
- package/src/cli/local-runtime-command.js +15 -14
- package/src/cli/migrate-command.js +13 -10
- package/src/cli/setup-command.js +16 -14
- package/src/cli/terminal-io.js +7 -0
- package/src/data-format/format-notices.js +19 -11
- package/src/data-format/local-stores.js +2 -0
- package/src/data-format/migration-operations.js +15 -3
- package/src/data-format/notice-delivery.js +124 -0
- package/src/data-format/operations-log.js +6 -1
- package/src/desktop/windows-desktop-client.js +120 -0
- package/src/desktop/windows-rollback-command.js +6 -2
- package/src/desktop/windows-rollback.js +7 -1
- package/src/desktop/windows-tray-update.js +19 -31
- package/src/desktop/windows-uninstall-command.js +2 -1
- package/src/desktop/windows-uninstall.js +10 -4
- package/src/desktop/windows-update-command.js +7 -2
- package/src/desktop/windows-update-lock.js +9 -7
- package/src/desktop/windows-update.js +7 -1
- package/src/graphiti/task-knowledge-checkpoint.js +1 -1
- package/src/graphiti/task-preference-reader.js +1 -1
- package/src/graphiti/turn-receipt-delivery.js +3 -0
- package/src/http/api-router.js +5 -0
- package/src/http/data-format-api-router.js +3 -1
- package/src/http/doctor-api-router.js +31 -0
- package/src/mcp/process-registry.js +12 -6
- package/src/presence/windows-helper-pin.js +1 -1
- package/src/server.js +2 -1
- package/src/system/console-update.js +10 -2
- package/src/system/detached-job.js +8 -0
- package/src/system/doctor-repair.js +61 -0
- package/src/system/doctor.js +115 -0
- package/src/system/package-version-checker.js +8 -1
- package/src/system/system-service.js +15 -1
- package/dist/web/assets/DataFormatPage-DmCKskrj.css +0 -1
- package/dist/web/assets/DataFormatPage-Mrr5EvW-.js +0 -2
- package/dist/web/assets/KnowledgePage-DXibFNna.js +0 -1
- package/dist/web/assets/KnowledgePeek-B9r1G3ix.js +0 -1
- package/dist/web/assets/KnowledgeWorkspace-CJmm-Xs7.js +0 -4
- package/dist/web/assets/ModelSettingsPage-CeEp6z6R.js +0 -1
- package/dist/web/assets/ProjectAgentsPage-CbUffuyy.js +0 -1
- package/dist/web/assets/ProjectAgentsPage-DvJh40Xl.css +0 -1
- package/dist/web/assets/RadioGroupItem-4VcuuIZK.js +0 -1
- package/dist/web/assets/RovingFocusGroup-DyLR4_0m.js +0 -1
- package/dist/web/assets/SettingsPage-9AMTjLAu.js +0 -1
- package/dist/web/assets/UiToggle-B2sPCVZe.css +0 -1
- package/dist/web/assets/UiToggle-Bkg9nRN4.js +0 -1
- package/dist/web/assets/VisuallyHiddenInput-BHE2kO_O.js +0 -1
- package/dist/web/assets/accordion-B2ZGR46D.js +0 -1
- package/dist/web/assets/checkbox-CZg0Iow1.js +0 -1
- package/dist/web/assets/conversation-launcher-settings-BmsEEQjr.js +0 -1
- package/dist/web/assets/index-DdT-r351.js +0 -2
- package/dist/web/assets/index-DuLqKIn8.css +0 -1
- package/dist/web/assets/label-table-DA5V7oXM.js +0 -1
- package/dist/web/assets/model-cgiHaWsF.js +0 -1
- package/dist/web/assets/project-team-api-BrC4ewpy.js +0 -1
- package/dist/web/assets/select-DrMXPnfK.js +0 -1
- package/dist/web/assets/shared-report-D6AgVQoO.js +0 -3
- package/dist/web/assets/task-labels-CIzXKt-p.js +0 -1
- package/dist/web/assets/ui-D936HGK2.js +0 -1
- package/dist/web/assets/useDirection-C0EDWveN.js +0 -1
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
runtimeSettingsWithOverrides
|
|
15
15
|
} from '../system/runtime-settings.js';
|
|
16
16
|
import { parseLocalRuntimeOptions } from './local-runtime-options.js';
|
|
17
|
-
import { writeLine } from './terminal-io.js';
|
|
17
|
+
import { copyableValueStyle, writeLine } from './terminal-io.js';
|
|
18
18
|
|
|
19
19
|
export async function runLocalRuntimeCommand(command, args, dependencies = {}) {
|
|
20
20
|
const options = parseLocalRuntimeOptions(command, args);
|
|
@@ -63,7 +63,8 @@ export async function runLocalRuntimeCommand(command, args, dependencies = {}) {
|
|
|
63
63
|
if (command === 'status' && options.json) {
|
|
64
64
|
write(JSON.stringify(outputResult, null, 2));
|
|
65
65
|
} else {
|
|
66
|
-
write(formatLocalRuntimeResult(command, outputResult
|
|
66
|
+
write(formatLocalRuntimeResult(command, outputResult,
|
|
67
|
+
copyableValueStyle({ output: dependencies.output, env })));
|
|
67
68
|
}
|
|
68
69
|
return {
|
|
69
70
|
...result,
|
|
@@ -74,15 +75,15 @@ export async function runLocalRuntimeCommand(command, args, dependencies = {}) {
|
|
|
74
75
|
};
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
export function formatLocalRuntimeResult(command, result) {
|
|
78
|
+
export function formatLocalRuntimeResult(command, result, copy = String) {
|
|
78
79
|
if (command === 'start') {
|
|
79
80
|
const title = result.status === 'running'
|
|
80
81
|
? 'Fuli local services are already running.'
|
|
81
82
|
: 'Fuli local services started.';
|
|
82
|
-
return formatStartedRuntime(title, result);
|
|
83
|
+
return formatStartedRuntime(title, result, copy);
|
|
83
84
|
}
|
|
84
85
|
if (command === 'restart') {
|
|
85
|
-
return formatStartedRuntime('Fuli local services restarted.', result);
|
|
86
|
+
return formatStartedRuntime('Fuli local services restarted.', result, copy);
|
|
86
87
|
}
|
|
87
88
|
if (command === 'stop') {
|
|
88
89
|
if (result.status === 'partial') {
|
|
@@ -95,21 +96,21 @@ export function formatLocalRuntimeResult(command, result) {
|
|
|
95
96
|
? 'Fuli local services have not been initialized.'
|
|
96
97
|
: 'Fuli local services stopped. Graph data was preserved.';
|
|
97
98
|
}
|
|
98
|
-
if (command === 'open') return `Opened: ${result.url}`;
|
|
99
|
-
if (command === 'status') return formatStatus(result);
|
|
99
|
+
if (command === 'open') return `Opened: ${copy(result.url)}`;
|
|
100
|
+
if (command === 'status') return formatStatus(result, copy);
|
|
100
101
|
throw new TypeError(`Unknown local runtime command: ${command}`);
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
function formatStartedRuntime(title, result) {
|
|
104
|
-
const lines = [title, `Management UI: ${result.url}`];
|
|
104
|
+
function formatStartedRuntime(title, result, copy) {
|
|
105
|
+
const lines = [title, `Management UI: ${copy(result.url)}`];
|
|
105
106
|
const agentSetupNotice = formatAgentSetupNotice(result.agentSetupCheck);
|
|
106
107
|
if (agentSetupNotice) lines.push(agentSetupNotice);
|
|
107
108
|
if (result.lan === true) {
|
|
108
109
|
lines.push(
|
|
109
110
|
'LAN URLs:',
|
|
110
|
-
...result.lanUrls.map((url) => ` ${url}`),
|
|
111
|
-
`Username: ${result.lanAccess.username}`,
|
|
112
|
-
`Temporary access code: ${result.lanAccess.accessCode}`,
|
|
111
|
+
...result.lanUrls.map((url) => ` ${copy(url)}`),
|
|
112
|
+
`Username: ${copy(result.lanAccess.username)}`,
|
|
113
|
+
`Temporary access code: ${copy(result.lanAccess.accessCode)}`,
|
|
113
114
|
'Use only on trusted Wi-Fi. Restarting LAN mode rotates the access code.'
|
|
114
115
|
);
|
|
115
116
|
}
|
|
@@ -169,7 +170,7 @@ function agentNeedsSetup(agent) {
|
|
|
169
170
|
return outdated.join(', ') || 'integration update available';
|
|
170
171
|
}
|
|
171
172
|
|
|
172
|
-
function formatStatus(result) {
|
|
173
|
+
function formatStatus(result, copy) {
|
|
173
174
|
const labels = {
|
|
174
175
|
running: 'running',
|
|
175
176
|
degraded: 'degraded',
|
|
@@ -186,7 +187,7 @@ function formatStatus(result) {
|
|
|
186
187
|
: labels.not_connected;
|
|
187
188
|
const lines = [
|
|
188
189
|
`Fuli local status: ${labels[result.status] ?? result.status}`,
|
|
189
|
-
`Management UI: ${labels[result.console.status] ?? result.console.status} · ${result.console.url}`,
|
|
190
|
+
`Management UI: ${labels[result.console.status] ?? result.console.status} · ${copy(result.console.url)}`,
|
|
190
191
|
`Personal graph: ${providerLabel(result.personal.status, labels)}`,
|
|
191
192
|
`Shared services: ${publicSummary}`
|
|
192
193
|
];
|
|
@@ -15,8 +15,9 @@ import {
|
|
|
15
15
|
import { resolveSetupPaths } from '../setup/paths.js';
|
|
16
16
|
import { acquireMaintenance, holdDataDirectory } from '../data-format/maintenance-lock.js';
|
|
17
17
|
import { localRuntimeControl } from './local-runtime-control.js';
|
|
18
|
-
import { confirmInTerminal, writeLine } from './terminal-io.js';
|
|
18
|
+
import { confirmInTerminal, copyableValueStyle, writeLine } from './terminal-io.js';
|
|
19
19
|
import { reconcileLocalKnowledge, knowledgeReconciliationMessage } from '../knowledge-hard-delete/reconcile-local.js';
|
|
20
|
+
import { quoteShellArgument } from './shell-argument.js';
|
|
20
21
|
|
|
21
22
|
// `fuli migrate` (rec#17 D-09): data formats of one data directory.
|
|
22
23
|
// - status, preview: read only, safe while FULI runs, fine for an Agent to run.
|
|
@@ -61,6 +62,7 @@ export async function runMigrateCommand(args, dependencies = {}) {
|
|
|
61
62
|
const env = dependencies.env ?? process.env;
|
|
62
63
|
const paths = (dependencies.resolvePaths ?? resolveSetupPaths)({ dataDir: options['data-dir'] ?? null, env });
|
|
63
64
|
const context = { options, paths, env, write: dependencies.write ?? writeLine,
|
|
65
|
+
copy: copyableValueStyle({ output: dependencies.output, env }),
|
|
64
66
|
reconcileKnowledge: dependencies.reconcileKnowledge ?? reconcileLocalKnowledge,
|
|
65
67
|
confirm: dependencies.confirm ?? confirmInTerminal, fetchImpl: dependencies.fetchImpl ?? fetch,
|
|
66
68
|
graph: dependencies.graph ?? personalGraphFormat(paths.dataDir, { fetchImpl: dependencies.fetchImpl ?? fetch }),
|
|
@@ -100,13 +102,13 @@ const ACTIONS = Object.freeze({
|
|
|
100
102
|
return { exitCode: UNREADABLE_EXIT_CODE, report };
|
|
101
103
|
},
|
|
102
104
|
|
|
103
|
-
async preview({ options, paths, write, graph }) {
|
|
105
|
+
async preview({ options, paths, write, graph, copy }) {
|
|
104
106
|
const plan = await previewMigrations({ dataDir: paths.dataDir, graph });
|
|
105
|
-
write(options.json ? JSON.stringify(plan, null, 2) : formatPlan(plan, paths.dataDir));
|
|
107
|
+
write(options.json ? JSON.stringify(plan, null, 2) : formatPlan(plan, paths.dataDir, { copy }));
|
|
106
108
|
return { exitCode: 0, plan };
|
|
107
109
|
},
|
|
108
110
|
|
|
109
|
-
async apply({ options, paths, write, confirm, graph, maintenance }) {
|
|
111
|
+
async apply({ options, paths, write, confirm, graph, maintenance, copy }) {
|
|
110
112
|
if (!options.digest) throw new TypeError(`${USAGE}\nRun fuli migrate preview first; apply needs its digest.`);
|
|
111
113
|
const plan = await previewMigrations({ dataDir: paths.dataDir, graph });
|
|
112
114
|
const started = plan.digest !== options.digest && startedApply(paths.dataDir, options.digest);
|
|
@@ -116,11 +118,12 @@ const ACTIONS = Object.freeze({
|
|
|
116
118
|
+ `${started.stores.map((store) => `${store.label} ${store.migrationId}`).join(', ')}`);
|
|
117
119
|
} else if (plan.digest !== options.digest) {
|
|
118
120
|
write(plan.digest ? 'The stores changed since that preview. Nothing was changed; this is the current plan:'
|
|
119
|
-
: '
|
|
120
|
-
|
|
121
|
+
: plan.blocked.length ? 'The migration plan could not be checked. Nothing was changed:'
|
|
122
|
+
: 'Nothing waits for a confirmation now. Nothing was changed.');
|
|
123
|
+
if (plan.digest || plan.blocked.length) write(formatPlan(plan, paths.dataDir, { copy }));
|
|
121
124
|
return { exitCode: FAILED_EXIT_CODE, status: 'stale' };
|
|
122
125
|
}
|
|
123
|
-
if (!started) write(formatPlan(plan, paths.dataDir, { confirming: true }));
|
|
126
|
+
if (!started) write(formatPlan(plan, paths.dataDir, { confirming: true, copy }));
|
|
124
127
|
write(externalWritersLines().join('\n'));
|
|
125
128
|
if (!await confirm('Apply exactly these migrations? Recorded as entrypoint cli, presence unverified. [y/N] ',
|
|
126
129
|
{ defaultYes: false })) {
|
|
@@ -235,10 +238,10 @@ function wholeNumber(value, name) {
|
|
|
235
238
|
return number;
|
|
236
239
|
}
|
|
237
240
|
|
|
238
|
-
function formatPlan(plan, dataDir, { confirming = false } = {}) {
|
|
241
|
+
function formatPlan(plan, dataDir, { confirming = false, copy = String } = {}) {
|
|
239
242
|
const lines = [confirming ? 'FULI data format migrations to apply' : 'FULI data format migrations (preview; '
|
|
240
243
|
+ 'nothing was changed)', `Data directory: ${dataDir}`, ''];
|
|
241
|
-
if (!plan.stores.length) lines.push('Nothing waits for a confirmation.');
|
|
244
|
+
if (!plan.stores.length && !plan.blocked.length) lines.push('Nothing waits for a confirmation.');
|
|
242
245
|
for (const store of plan.stores) {
|
|
243
246
|
const { step } = store;
|
|
244
247
|
lines.push(`${store.label} [${store.store}, ${store.kind}] version ${step.fromVersion} → ${step.toVersion}`,
|
|
@@ -259,7 +262,7 @@ function formatPlan(plan, dataDir, { confirming = false } = {}) {
|
|
|
259
262
|
if (plan.digest) {
|
|
260
263
|
lines.push('', `Plan digest: ${plan.digest}`);
|
|
261
264
|
if (!confirming) {
|
|
262
|
-
lines.push(`Apply exactly this plan: fuli migrate apply --digest ${plan.digest}`,
|
|
265
|
+
lines.push(`Apply exactly this plan: ${copy(`fuli migrate apply --digest ${plan.digest} --data-dir ${quoteShellArgument(dataDir)}`)}`,
|
|
263
266
|
'It is checked again before anything changes; the digest is not a permission.');
|
|
264
267
|
}
|
|
265
268
|
}
|
package/src/cli/setup-command.js
CHANGED
|
@@ -9,12 +9,13 @@ import {
|
|
|
9
9
|
DEFAULT_RUNTIME_SETTINGS,
|
|
10
10
|
runtimeSettingsWithOverrides
|
|
11
11
|
} from '../system/runtime-settings.js';
|
|
12
|
-
import { confirmInTerminal, interactiveTerminal, writeLine } from './terminal-io.js';
|
|
12
|
+
import { confirmInTerminal, copyableValueStyle, interactiveTerminal, writeLine } from './terminal-io.js';
|
|
13
13
|
import { askCaptureScope, captureScopeSummary } from './capture-scope-prompt.js';
|
|
14
14
|
import { captureOnboardingFor } from '../setup/first-run-capture.js';
|
|
15
15
|
import { setupMigrationNotice } from '../data-format/format-notices.js';
|
|
16
16
|
import { knowledgeReconciliationMessage } from '../knowledge-hard-delete/reconcile-local.js';
|
|
17
17
|
import { formatShadowedLaunchers, inspectUpdateInstallation } from './update-installation.js';
|
|
18
|
+
import { quoteShellArgument } from './shell-argument.js';
|
|
18
19
|
|
|
19
20
|
export async function runSetupCommand(args, dependencies = {}) {
|
|
20
21
|
const options = parseSetupOptions(args);
|
|
@@ -24,6 +25,7 @@ export async function runSetupCommand(args, dependencies = {}) {
|
|
|
24
25
|
?? (() => confirmInTerminal('Only the items above will change. Continue? [Y/n] ', { defaultYes: true }));
|
|
25
26
|
const selectAgents = dependencies.selectAgents ?? promptAgentSelection;
|
|
26
27
|
const write = dependencies.write ?? writeLine;
|
|
28
|
+
const copy = copyableValueStyle({ output: dependencies.output, env: dependencies.env });
|
|
27
29
|
let plan = planSetup(options, dependencies);
|
|
28
30
|
if (options.connectedOnly) {
|
|
29
31
|
plan = applyAgentSelection(plan, plan.agents.filter((agent) =>
|
|
@@ -33,7 +35,7 @@ export async function runSetupCommand(args, dependencies = {}) {
|
|
|
33
35
|
const detected = plan.agents.filter(({ available }) => available);
|
|
34
36
|
plan = applyAgentSelection(plan, await selectAgents(detected));
|
|
35
37
|
}
|
|
36
|
-
write(formatSetupPreview(plan, options));
|
|
38
|
+
write(formatSetupPreview(plan, options, copy));
|
|
37
39
|
|
|
38
40
|
if (!options.yes && !await confirm()) {
|
|
39
41
|
write('Cancelled. No changes were made.');
|
|
@@ -44,7 +46,7 @@ export async function runSetupCommand(args, dependencies = {}) {
|
|
|
44
46
|
...dependencies,
|
|
45
47
|
onProgress: write
|
|
46
48
|
});
|
|
47
|
-
write(formatSetupResult(result, plan));
|
|
49
|
+
write(formatSetupResult(result, plan, copy));
|
|
48
50
|
// Stubbed setups in tests never read the data directory they name.
|
|
49
51
|
const onboardingFor = dependencies.captureOnboarding ?? (applySetup === applyLocalSetup ? captureOnboardingFor : null);
|
|
50
52
|
const captureScope = onboardingFor && plan.paths
|
|
@@ -53,7 +55,7 @@ export async function runSetupCommand(args, dependencies = {}) {
|
|
|
53
55
|
// Stubbed setups in tests name no real data directory either.
|
|
54
56
|
const migrationNotice = dependencies.migrationNotice ?? (applySetup === applyLocalSetup ? setupMigrationNotice : null);
|
|
55
57
|
const waiting = migrationNotice && plan.paths?.dataDir ? await migrationNotice(plan.paths.dataDir) : null;
|
|
56
|
-
if (waiting) write(waiting);
|
|
58
|
+
if (waiting) write(waiting.replaceAll('fuli migrate preview', copy('fuli migrate preview')));
|
|
57
59
|
// Stubbed setups in tests leave the host PATH alone too.
|
|
58
60
|
const shadowedLaunchers = dependencies.shadowedLaunchers ?? (applySetup === applyLocalSetup
|
|
59
61
|
? () => formatShadowedLaunchers(inspectUpdateInstallation({ env: dependencies.env ?? process.env })) : null);
|
|
@@ -72,7 +74,7 @@ async function firstRunCaptureScope(onboarding, options, result, dependencies) {
|
|
|
72
74
|
return captureScopeSummary(outcome, result.runtime?.url ?? null);
|
|
73
75
|
}
|
|
74
76
|
|
|
75
|
-
export function formatSetupPreview(plan, options) {
|
|
77
|
+
export function formatSetupPreview(plan, options, copy = String) {
|
|
76
78
|
const available = plan.agents.filter(({ available }) => available);
|
|
77
79
|
const selected = available.filter(({ selected }) => selected !== false);
|
|
78
80
|
const agentSummary = options.skipAgents || (available.length > 0 && selected.length === 0)
|
|
@@ -99,9 +101,9 @@ export function formatSetupPreview(plan, options) {
|
|
|
99
101
|
'disabled; graph services stay running'}`,
|
|
100
102
|
`Management UI: ${options.noStart
|
|
101
103
|
? 'will not start'
|
|
102
|
-
: `http://127.0.0.1:${runtimeSettings.ports.console}`}`,
|
|
104
|
+
: copy(`http://127.0.0.1:${runtimeSettings.ports.console}`)}`,
|
|
103
105
|
`Automatic client setup: ${agentSummary}`,
|
|
104
|
-
|
|
106
|
+
`Other MCP clients: connect after setup with ${copy('fuli connect')} (no model required)`
|
|
105
107
|
];
|
|
106
108
|
if (
|
|
107
109
|
runtimeMode !== 'native' &&
|
|
@@ -120,20 +122,20 @@ export function formatSetupPreview(plan, options) {
|
|
|
120
122
|
return lines.join('\n');
|
|
121
123
|
}
|
|
122
124
|
|
|
123
|
-
export function formatSetupResult(result, plan) {
|
|
125
|
+
export function formatSetupResult(result, plan, copy = String) {
|
|
124
126
|
const lines = [result.status === 'ready'
|
|
125
127
|
? 'Fuli is ready.'
|
|
126
128
|
: result.knowledgeRecovery?.status === 'pending'
|
|
127
129
|
? 'Fuli setup needs knowledge recovery before local stores are ready.'
|
|
128
130
|
: 'Fuli started, but one or more Agents are not connected.'];
|
|
129
131
|
if (result.knowledgeRecovery) lines.push(knowledgeReconciliationMessage(result.knowledgeRecovery));
|
|
130
|
-
if (result.runtime.url) lines.push(`Open: ${result.runtime.url}`);
|
|
132
|
+
if (result.runtime.url) lines.push(`Open: ${copy(result.runtime.url)}`);
|
|
131
133
|
if (result.runtime.lan === true) {
|
|
132
134
|
lines.push(
|
|
133
135
|
'LAN URLs:',
|
|
134
|
-
...result.runtime.lanUrls.map((url) => ` ${url}`),
|
|
135
|
-
`Username: ${result.runtime.lanAccess.username}`,
|
|
136
|
-
`Temporary access code: ${result.runtime.lanAccess.accessCode}`,
|
|
136
|
+
...result.runtime.lanUrls.map((url) => ` ${copy(url)}`),
|
|
137
|
+
`Username: ${copy(result.runtime.lanAccess.username)}`,
|
|
138
|
+
`Temporary access code: ${copy(result.runtime.lanAccess.accessCode)}`,
|
|
137
139
|
'Use only on trusted Wi-Fi. Restarting LAN mode rotates the access code.'
|
|
138
140
|
);
|
|
139
141
|
}
|
|
@@ -162,8 +164,8 @@ export function formatSetupResult(result, plan) {
|
|
|
162
164
|
lines.push('After a package upgrade, reconnect Fuli in already-open clients or restart the clients, then open a new task. Existing MCP processes are not replaced automatically.');
|
|
163
165
|
}
|
|
164
166
|
const dataDir = plan?.paths?.dataDir;
|
|
165
|
-
lines.push(
|
|
166
|
-
if (dataDir) lines.push(`For this installation, use
|
|
167
|
+
lines.push(`Other MCP clients: run ${copy('fuli connect')} and merge the fuli entry into your MCP settings.`);
|
|
168
|
+
if (dataDir) lines.push(`For this installation, use ${copy(`--data-dir ${quoteShellArgument(dataDir)}`)}.`);
|
|
167
169
|
lines.push('MCP provides tools and memory. Automatic conversation capture and wake/resume require a client adapter.');
|
|
168
170
|
return lines.join('\n');
|
|
169
171
|
}
|
package/src/cli/terminal-io.js
CHANGED
|
@@ -5,6 +5,13 @@ export function writeLine(value) {
|
|
|
5
5
|
process.stdout.write(`${value}\n`);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
// Keep redirected output and machines that opt out of color free of escapes.
|
|
9
|
+
// Labels remain present so copying or reading the plain output still works.
|
|
10
|
+
export function copyableValueStyle({ output = process.stdout, env = process.env } = {}) {
|
|
11
|
+
const color = output.isTTY === true && env.TERM !== 'dumb' && !env.NO_COLOR;
|
|
12
|
+
return (value) => color ? `\u001b[1;36m${value}\u001b[0m` : String(value);
|
|
13
|
+
}
|
|
14
|
+
|
|
8
15
|
const ENTER = new Set(['\r', '\n', '\u0004']);
|
|
9
16
|
const ERASE = new Set(['\u007f', '\b']);
|
|
10
17
|
const CANCEL = '\u0003';
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { dirname } from 'node:path';
|
|
2
2
|
|
|
3
|
+
import { receiptConsoleUrl } from '../agents/identity-receipt.js';
|
|
3
4
|
import { externalWritersLines } from './external-writers.js';
|
|
4
5
|
import { PERSONAL_GRAPH_LABEL, personalGraphFormatState } from './format-status.js';
|
|
5
6
|
import { inspectLocalStores } from './local-stores.js';
|
|
6
7
|
import { readFormatOperations } from './operations-log.js';
|
|
8
|
+
import { claimAppliedFormatNotices } from './notice-delivery.js';
|
|
7
9
|
|
|
8
10
|
// The local stores this FULI cannot use as they are, by store and step, for
|
|
9
11
|
// the console's startup log and /api/health (rec#17 D-09). Read only, like
|
|
@@ -56,13 +58,11 @@ export function dataFormatNoticeLine({ store, label, state, steps }) {
|
|
|
56
58
|
+ 'Run `fuli migrate status` for details.';
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
// How long an applied migration is still mentioned in a receipt.
|
|
60
|
-
const APPLIED_NOTICE_MS = 24 * 60 * 60 * 1000;
|
|
61
61
|
const GRAPH_STATE_TTL_MS = 60_000;
|
|
62
62
|
|
|
63
63
|
// The receipt's data format notice (rec#17 D-09 part 2, rec#20), from the
|
|
64
64
|
// same notices the console reports plus the operations log: a step waiting
|
|
65
|
-
// for a person, or a migration
|
|
65
|
+
// for a person, or a migration claimed for this task. null — no bytes at
|
|
66
66
|
// all — when there is neither. graphState() resolves the personal graph's
|
|
67
67
|
// format state from its provider health ({ state, pending }) or null.
|
|
68
68
|
export function dataFormatReceiptNotice(dataDir, { notices = dataFormatNotices(dataDir),
|
|
@@ -76,18 +76,25 @@ export function dataFormatReceiptNotice(dataDir, { notices = dataFormatNotices(d
|
|
|
76
76
|
}
|
|
77
77
|
return graphCache.steps;
|
|
78
78
|
};
|
|
79
|
-
return async () => {
|
|
80
|
-
const pending = [...notices().filter((notice) => notice.state === 'pending_confirmation')
|
|
81
|
-
.flatMap((notice) => notice.steps.length ? notice.steps : [notice.store]), ...await graphPending()];
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
return async ({ taskId = null, includePending = true, closeUrl = null } = {}) => {
|
|
80
|
+
const pending = includePending ? [...notices().filter((notice) => notice.state === 'pending_confirmation')
|
|
81
|
+
.flatMap((notice) => notice.steps.length ? notice.steps : [notice.store]), ...await graphPending()] : [];
|
|
82
|
+
let applied = [];
|
|
83
|
+
try { applied = claimAppliedFormatNotices(dataDir, operations(), taskId, now()); } catch { /* A notice cannot block a task. */ }
|
|
84
84
|
return [
|
|
85
85
|
pending.length ? `数据格式待确认:${several(pending)}(fuli migrate preview)` : null,
|
|
86
|
-
|
|
86
|
+
...appliedNoticeLines(applied),
|
|
87
|
+
closeUrl && applied.some((item) => item.remaining > 0) ? `[关闭提醒](<${closeUrl}>)` : null
|
|
87
88
|
].filter(Boolean).join(' · ') || null;
|
|
88
89
|
};
|
|
89
90
|
}
|
|
90
91
|
|
|
92
|
+
function appliedNoticeLines(applied) {
|
|
93
|
+
const groups = new Map();
|
|
94
|
+
for (const item of applied) groups.set(item.remaining, [...(groups.get(item.remaining) ?? []), item.migrationId]);
|
|
95
|
+
return [...groups].map(([remaining, ids]) => `数据格式已迁移:${several(ids)}(本次后还提示 ${remaining} 次)`);
|
|
96
|
+
}
|
|
97
|
+
|
|
91
98
|
function several(ids) {
|
|
92
99
|
return ids.length > 1 ? `${ids[0]} 等 ${ids.length} 项` : ids[0];
|
|
93
100
|
}
|
|
@@ -107,8 +114,9 @@ function applicationFormatNotice(application) {
|
|
|
107
114
|
return APPLICATION_NOTICES.get(application);
|
|
108
115
|
}
|
|
109
116
|
|
|
110
|
-
export async function receiptFormatNotices(application) {
|
|
111
|
-
const
|
|
117
|
+
export async function receiptFormatNotices(application, options = {}) {
|
|
118
|
+
const closeUrl = `${receiptConsoleUrl(application).replace(/\/$/, '')}/settings/data-format`;
|
|
119
|
+
const notice = await applicationFormatNotice(application)?.({ ...options, closeUrl });
|
|
112
120
|
return notice ? [notice] : [];
|
|
113
121
|
}
|
|
114
122
|
|
|
@@ -35,6 +35,7 @@ import { MODEL_USAGE_FORMAT } from '../model-backends/usage-ledger.js';
|
|
|
35
35
|
import { inspectJsonStore } from '../storage/json-format.js';
|
|
36
36
|
import { APPLY_RECEIPTS_FORMAT } from './apply-receipts.js';
|
|
37
37
|
import { FORMAT_OPERATIONS_FORMAT } from './operations-log.js';
|
|
38
|
+
import { FORMAT_NOTICE_DELIVERY_FORMAT } from './notice-delivery.js';
|
|
38
39
|
import { MODEL_SECRETS_FORMAT } from '../model-backends/secret-store.js';
|
|
39
40
|
import { STANDING_ASSIGNMENTS_FORMAT } from '../standing-assignments/store.js';
|
|
40
41
|
import { CLIENT_CONNECTION_HISTORY_FORMAT } from '../system/client-connection-status.js';
|
|
@@ -89,6 +90,7 @@ const jsonStores = () => [
|
|
|
89
90
|
['model-secrets.json', MODEL_SECRETS_FORMAT],
|
|
90
91
|
['client-connection-observations.json', CLIENT_CONNECTION_HISTORY_FORMAT],
|
|
91
92
|
['format-operations.json', FORMAT_OPERATIONS_FORMAT],
|
|
93
|
+
['format-notice-delivery.json', FORMAT_NOTICE_DELIVERY_FORMAT],
|
|
92
94
|
['format-apply-receipts.json', APPLY_RECEIPTS_FORMAT],
|
|
93
95
|
// A person's permanent deletes, content-free: their state and the fence local stores check (rec#5 C9).
|
|
94
96
|
[HARD_DELETE_LEDGER_FILE, HARD_DELETE_LEDGER_FORMAT],
|
|
@@ -3,7 +3,8 @@ import { backupRetentionPolicy, pruneFormatBackups } from './backup-retention.js
|
|
|
3
3
|
import { pruneFormatRetention } from './format-retention.js';
|
|
4
4
|
import { GRAPH_LABEL, localStore, localStoresWithEngines, previewMigrations } from './migration-plan.js';
|
|
5
5
|
import { findApplyReceipt, recordApplyReceipt } from './apply-receipts.js';
|
|
6
|
-
import { recordFormatOperations } from './operations-log.js';
|
|
6
|
+
import { readFormatOperations, recordFormatOperations } from './operations-log.js';
|
|
7
|
+
import { dismissAppliedFormatNotices, listAppliedFormatNotices } from './notice-delivery.js';
|
|
7
8
|
|
|
8
9
|
// A person's confirmed data format operations on one data directory (rec#17
|
|
9
10
|
// D-09 part 2). Callers are `fuli migrate` at an interactive terminal and the
|
|
@@ -39,7 +40,10 @@ export async function applyMigrations({ dataDir, digest, actor, graph, now = ()
|
|
|
39
40
|
throw new DataFormatError('data-format', 'data_format_stale_preview', plan.digest
|
|
40
41
|
? 'The stores no longer match the preview that was confirmed. Nothing was changed; run the preview again '
|
|
41
42
|
+ 'and confirm what it shows.'
|
|
42
|
-
:
|
|
43
|
+
: plan.blocked.length
|
|
44
|
+
? `The migration plan could not be checked: ${plan.blocked.map((store) =>
|
|
45
|
+
`${store.label} — ${store.reason}`).join('; ')}. Nothing was changed; run the preview again.`
|
|
46
|
+
: 'Nothing waits for a confirmation now. Nothing was changed.');
|
|
43
47
|
}
|
|
44
48
|
stores = started.stores;
|
|
45
49
|
} else {
|
|
@@ -172,9 +176,17 @@ function pruneQuietly(prune, dataDir) {
|
|
|
172
176
|
// whole-store restore (console-restore.js), which restarts FULI around it.
|
|
173
177
|
export function dataFormatMigrations(dataDir, { graph, restore = null, prune = pruneFormatBackups,
|
|
174
178
|
now = () => new Date() } = {}) {
|
|
179
|
+
const notice = () => {
|
|
180
|
+
try { return { active: listAppliedFormatNotices(dataDir, readFormatOperations(dataDir), now().getTime()) }; }
|
|
181
|
+
catch { return { active: [], unavailable: true }; }
|
|
182
|
+
};
|
|
175
183
|
return {
|
|
176
184
|
// With the retention budget, so the console says the one `fuli migrate prune` uses.
|
|
177
|
-
preview: async () => ({ ...await previewMigrations({ dataDir, graph }), retention: retentionPolicyOrNull() }),
|
|
185
|
+
preview: async () => ({ ...await previewMigrations({ dataDir, graph }), retention: retentionPolicyOrNull(), notice: notice() }),
|
|
186
|
+
dismissNotices: (ids) => {
|
|
187
|
+
dismissAppliedFormatNotices(dataDir, readFormatOperations(dataDir), ids, now().getTime());
|
|
188
|
+
return { notice: notice() };
|
|
189
|
+
},
|
|
178
190
|
apply: ({ digest, actor }) => applyMigrations({ dataDir, digest, actor, graph }),
|
|
179
191
|
rollback: ({ label, migrationId, actor }) => rollbackMigration({ dataDir, label, migrationId, actor, graph }),
|
|
180
192
|
// The person's check of a graph prune whose answer never came: the same
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { contentHash } from '../../packages/roundtable/src/canonical-json.js';
|
|
5
|
+
import { sha256Bytes } from '../security/digest.js';
|
|
6
|
+
import { jsonFormat, requireJsonFormatVersion, updateVersionedJsonFileAtomic } from '../storage/json-format.js';
|
|
7
|
+
import { readJsonFile } from '../storage/json-file.js';
|
|
8
|
+
|
|
9
|
+
const FORMAT_VERSION = 1;
|
|
10
|
+
const NOTICE_LIMIT = 7;
|
|
11
|
+
const LEGACY_NOTICE_MS = 24 * 60 * 60 * 1000;
|
|
12
|
+
export const FORMAT_NOTICE_DELIVERY_FORMAT = jsonFormat({ store: 'format-notice-delivery', versions: [FORMAT_VERSION] });
|
|
13
|
+
|
|
14
|
+
function eventId(event) {
|
|
15
|
+
return contentHash({ label: event.label ?? null, store: event.store ?? null,
|
|
16
|
+
migrationId: event.migrationId, at: event.at });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Older versions did not mark new events for count-based delivery. Only their
|
|
20
|
+
// still-visible last-day notices join the new queue; events logged by this
|
|
21
|
+
// version remain eligible even if the person returns much later.
|
|
22
|
+
function eligible(event, entries, now) {
|
|
23
|
+
if (event.kind !== 'applied' || !event.migrationId || !event.at) return false;
|
|
24
|
+
const entry = entries[eventId(event)];
|
|
25
|
+
return !entry?.retired && (Boolean(entry) || event.noticeEligible === true || now - Date.parse(event.at) < LEGACY_NOTICE_MS);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function activeEvents(events, entries, now) {
|
|
29
|
+
const logged = new Set(events.filter((event) => event.kind === 'applied').map(eventId));
|
|
30
|
+
const saved = Object.values(entries).flatMap((entry) => entry.event && !logged.has(eventId(entry.event)) ? [entry.event] : []);
|
|
31
|
+
const all = [...saved, ...events];
|
|
32
|
+
return all.filter((event, index) => eligible(event, entries, now) && !all.slice(index + 1).some((later) =>
|
|
33
|
+
later.label === event.label && (later.kind === 'restored'
|
|
34
|
+
|| (later.kind === 'rolled_back' && later.migrationId === event.migrationId))));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// The operations log has a bounded history. Keep a compact event in the
|
|
38
|
+
// delivery store so its seven claims survive unrelated log pruning.
|
|
39
|
+
export function trackFormatOperationNotices(dataDir, events, readHistory = () => events) {
|
|
40
|
+
if (!events.some((event) => ['applied', 'rolled_back', 'restored'].includes(event.kind))) return;
|
|
41
|
+
const path = join(dataDir, 'format-notice-delivery.json');
|
|
42
|
+
updateVersionedJsonFileAtomic(path, FORMAT_NOTICE_DELIVERY_FORMAT, (current) => {
|
|
43
|
+
const entries = { ...(current?.entries ?? {}) };
|
|
44
|
+
let changed = false;
|
|
45
|
+
for (const event of events) {
|
|
46
|
+
if (event.kind === 'applied' && event.migrationId && event.at) {
|
|
47
|
+
const id = eventId(event);
|
|
48
|
+
if (!entries[id]) {
|
|
49
|
+
entries[id] = { event: { kind: 'applied', label: event.label, store: event.store,
|
|
50
|
+
migrationId: event.migrationId, at: event.at, noticeEligible: true }, claims: [], dismissed: false };
|
|
51
|
+
changed = true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// The log is read under the shared format lock. A rollback may have
|
|
56
|
+
// completed between an apply's log write and its notice being queued.
|
|
57
|
+
const active = new Set(activeEvents(readHistory(), entries, Date.now()).map(eventId));
|
|
58
|
+
for (const [id, entry] of Object.entries(entries)) {
|
|
59
|
+
if (entry.event && !entry.retired && !active.has(id)) {
|
|
60
|
+
entries[id] = { ...entry, retired: true };
|
|
61
|
+
changed = true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return changed ? { ...current, version: FORMAT_VERSION, entries } : undefined;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// One claim per task and event, shared across MCP processes and retries. The
|
|
69
|
+
// task token itself is not stored. A retried checkpoint gets the same count.
|
|
70
|
+
export function claimAppliedFormatNotices(dataDir, events, taskId, now) {
|
|
71
|
+
const path = join(dataDir, 'format-notice-delivery.json');
|
|
72
|
+
if (!taskId || (!events.some((event) => event.kind === 'applied') && !existsSync(path))) return [];
|
|
73
|
+
const taskHash = sha256Bytes(taskId);
|
|
74
|
+
const shown = [];
|
|
75
|
+
updateVersionedJsonFileAtomic(path, FORMAT_NOTICE_DELIVERY_FORMAT, (current) => {
|
|
76
|
+
const entries = { ...(current?.entries ?? {}) };
|
|
77
|
+
let changed = false;
|
|
78
|
+
for (const event of activeEvents(events, entries, now).reverse()) {
|
|
79
|
+
const id = eventId(event);
|
|
80
|
+
const entry = entries[id] ?? { claims: [], dismissed: false };
|
|
81
|
+
if (entry.dismissed) continue;
|
|
82
|
+
let claim = entry.claims.indexOf(taskHash);
|
|
83
|
+
if (claim < 0) {
|
|
84
|
+
if (entry.claims.length >= NOTICE_LIMIT) continue;
|
|
85
|
+
claim = entry.claims.length;
|
|
86
|
+
entries[id] = { ...entry, event, claims: [...entry.claims, taskHash] };
|
|
87
|
+
changed = true;
|
|
88
|
+
}
|
|
89
|
+
shown.push({ id, migrationId: event.migrationId, remaining: NOTICE_LIMIT - claim - 1 });
|
|
90
|
+
}
|
|
91
|
+
return changed ? { ...current, version: FORMAT_VERSION, entries } : undefined;
|
|
92
|
+
});
|
|
93
|
+
return shown;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// The console reads without claiming a delivery. Its IDs bind the person's
|
|
97
|
+
// dismissal to exactly the migrations shown, even if another arrives later.
|
|
98
|
+
export function listAppliedFormatNotices(dataDir, events, now) {
|
|
99
|
+
const current = readJsonFile(join(dataDir, 'format-notice-delivery.json'), null);
|
|
100
|
+
if (current) requireJsonFormatVersion(current, FORMAT_NOTICE_DELIVERY_FORMAT);
|
|
101
|
+
const entries = current?.entries ?? {};
|
|
102
|
+
return activeEvents(events, entries, now).reverse().flatMap((event) => {
|
|
103
|
+
const id = eventId(event);
|
|
104
|
+
const entry = entries[id];
|
|
105
|
+
const remaining = NOTICE_LIMIT - (entry?.claims.length ?? 0);
|
|
106
|
+
return entry?.dismissed || remaining <= 0 ? [] : [{ id, migrationId: event.migrationId, remaining }];
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function dismissAppliedFormatNotices(dataDir, events, ids, now) {
|
|
111
|
+
const wanted = new Set(ids);
|
|
112
|
+
const path = join(dataDir, 'format-notice-delivery.json');
|
|
113
|
+
updateVersionedJsonFileAtomic(path, FORMAT_NOTICE_DELIVERY_FORMAT, (current) => {
|
|
114
|
+
const entries = { ...(current?.entries ?? {}) };
|
|
115
|
+
let changed = false;
|
|
116
|
+
for (const event of activeEvents(events, entries, now)) {
|
|
117
|
+
const id = eventId(event);
|
|
118
|
+
if (!wanted.has(id) || entries[id]?.dismissed) continue;
|
|
119
|
+
entries[id] = { ...(entries[id] ?? { claims: [] }), dismissed: true };
|
|
120
|
+
changed = true;
|
|
121
|
+
}
|
|
122
|
+
return changed ? { ...current, version: FORMAT_VERSION, entries } : undefined;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
@@ -2,6 +2,7 @@ import { join } from 'node:path';
|
|
|
2
2
|
|
|
3
3
|
import { jsonFormat, updateVersionedJsonFileAtomic } from '../storage/json-format.js';
|
|
4
4
|
import { readJsonFile } from '../storage/json-file.js';
|
|
5
|
+
import { trackFormatOperationNotices } from './notice-delivery.js';
|
|
5
6
|
|
|
6
7
|
// What a person did to the data formats of one data directory (rec#17 D-09
|
|
7
8
|
// part 2): applied, undone and restored migrations and pruned backups. Store,
|
|
@@ -18,9 +19,13 @@ function formatOperationsPath(dataDir) {
|
|
|
18
19
|
|
|
19
20
|
export function recordFormatOperations(dataDir, events) {
|
|
20
21
|
if (!events.length) return;
|
|
22
|
+
const recorded = events.map((event) => event.kind === 'applied' ? { ...event, noticeEligible: true } : event);
|
|
21
23
|
updateVersionedJsonFileAtomic(formatOperationsPath(dataDir), FORMAT_OPERATIONS_FORMAT, (current) => ({
|
|
22
|
-
version: LOG_VERSION, events: [...(current?.events ?? []), ...
|
|
24
|
+
version: LOG_VERSION, events: [...(current?.events ?? []), ...recorded].slice(-KEPT_EVENTS)
|
|
23
25
|
}));
|
|
26
|
+
// A reminder is secondary to the already-completed data operation. If its
|
|
27
|
+
// local queue cannot be written, the operations log can still supply it.
|
|
28
|
+
try { trackFormatOperationNotices(dataDir, recorded, () => readFormatOperations(dataDir)); } catch { /* keep the operation result */ }
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
export function readFormatOperations(dataDir) {
|