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
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { execFile, spawn } from 'node:child_process';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
|
|
5
|
+
import { readJsonFile } from '../storage/json-file.js';
|
|
6
|
+
import { windowsInstallPathsOverlap } from './windows-installation-context.js';
|
|
7
|
+
import { requestWindowsTrayExit } from './windows-update-lock.js';
|
|
8
|
+
|
|
9
|
+
// The FULI desktop client (desktop/flutter, client\FULI.exe started by the
|
|
10
|
+
// package root's Fuli.exe) as updates, rollbacks and uninstalls see it: closed
|
|
11
|
+
// before the program changes, opened again afterwards, and its per-user
|
|
12
|
+
// Windows entries kept pointing at the installed version. The client writes
|
|
13
|
+
// the same entries itself (desktop/flutter/lib/src/platform/desktop/windows_login_launch.dart).
|
|
14
|
+
|
|
15
|
+
const RUN_KEY = 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run';
|
|
16
|
+
const RUN_VALUE = 'FULI';
|
|
17
|
+
// The client's own settings (the launch-at-login choice) and its notification identity.
|
|
18
|
+
const CLIENT_KEYS = ['HKCU\\Software\\Fuli\\DesktopClient', 'HKCU\\Software\\Classes\\AppUserModelId\\FULI'];
|
|
19
|
+
// A client in the middle of a start, stop or port change finishes it first
|
|
20
|
+
// (each CLI call is bounded to five minutes by windows-controller.js).
|
|
21
|
+
const CLIENT_EXIT_TIMEOUT_MS = 330_000;
|
|
22
|
+
|
|
23
|
+
const windowsLoginCommand = packageRoot => `"${join(packageRoot, 'Fuli.exe')}" --background`;
|
|
24
|
+
|
|
25
|
+
// Asks a running client of this data directory to exit and waits for it.
|
|
26
|
+
// Resolves 'exited' or 'absent'; a client that stays refuses the change.
|
|
27
|
+
async function closeWindowsDesktopClient(dataDir, { exitTray = requestWindowsTrayExit } = {}) {
|
|
28
|
+
const state = await exitTray(dataDir, { timeoutMs: CLIENT_EXIT_TIMEOUT_MS });
|
|
29
|
+
if (state === 'busy') throw new Error('The FULI desktop client did not close; nothing was changed. Finish or close what it is doing and try again.');
|
|
30
|
+
return state;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Opens the client of whichever version installation.json names now.
|
|
34
|
+
function reopenInstalledWindowsClient(installRoot, { launch = launchWindowsDesktopClient } = {}) {
|
|
35
|
+
const record = readJsonFile(join(installRoot, 'installation.json'), null);
|
|
36
|
+
if (record?.packageRoot) launch(record.packageRoot);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function launchWindowsDesktopClient(packageRoot) {
|
|
40
|
+
const launcher = join(packageRoot, 'Fuli.exe');
|
|
41
|
+
if (!existsSync(launcher)) return;
|
|
42
|
+
const child = spawn(launcher, [], { cwd: packageRoot, detached: true, stdio: 'ignore' });
|
|
43
|
+
child.once('error', () => {});
|
|
44
|
+
child.unref();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// After a switch, an existing launch-at-login entry of this installation
|
|
48
|
+
// starts the installed version. A version without the desktop client (an
|
|
49
|
+
// older tray) takes no arguments, so the entry is removed instead. Never
|
|
50
|
+
// fails the switch: 'unchanged', 'retargeted', 'removed' or 'failed'.
|
|
51
|
+
async function retargetWindowsLoginLaunch(installRoot, packageRoot, { reg = runReg } = {}) {
|
|
52
|
+
try {
|
|
53
|
+
const command = await readLoginLaunch(reg);
|
|
54
|
+
if (!command || !launchesFrom(command, installRoot)) return 'unchanged';
|
|
55
|
+
if (existsSync(join(packageRoot, 'client', 'FULI.exe'))) {
|
|
56
|
+
const next = windowsLoginCommand(packageRoot);
|
|
57
|
+
if (command === next) return 'unchanged';
|
|
58
|
+
await requireReg(reg, ['add', RUN_KEY, '/v', RUN_VALUE, '/t', 'REG_SZ', '/d', next, '/f']);
|
|
59
|
+
return 'retargeted';
|
|
60
|
+
}
|
|
61
|
+
await requireReg(reg, ['delete', RUN_KEY, '/v', RUN_VALUE, '/f']);
|
|
62
|
+
return 'removed';
|
|
63
|
+
} catch { return 'failed'; }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Uninstall: the launch-at-login entry (only when it starts this installation),
|
|
67
|
+
// the client's settings and its notification identity. 'removed' or 'failed'.
|
|
68
|
+
async function removeWindowsClientRegistrations(installRoot, { reg = runReg } = {}) {
|
|
69
|
+
try {
|
|
70
|
+
const command = await readLoginLaunch(reg);
|
|
71
|
+
if (command && launchesFrom(command, installRoot)) await requireReg(reg, ['delete', RUN_KEY, '/v', RUN_VALUE, '/f']);
|
|
72
|
+
for (const key of CLIENT_KEYS) {
|
|
73
|
+
if ((await reg(['query', key])).code === 0) await requireReg(reg, ['delete', key, '/f']);
|
|
74
|
+
}
|
|
75
|
+
return 'removed';
|
|
76
|
+
} catch { return 'failed'; }
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const windowsDesktopClient = {
|
|
80
|
+
close: closeWindowsDesktopClient,
|
|
81
|
+
reopen: reopenInstalledWindowsClient,
|
|
82
|
+
followSwitch: retargetWindowsLoginLaunch,
|
|
83
|
+
unregister: removeWindowsClientRegistrations
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// The desktop client of this installation is closed while its program changes
|
|
87
|
+
// and, when it was open, opened again from whichever version is installed
|
|
88
|
+
// afterwards; its launch-at-login entry follows a successful switch.
|
|
89
|
+
export async function withWindowsClientClosed(plan, desktopClient, change) {
|
|
90
|
+
const clientWasOpen = await desktopClient.close(plan.current.dataDir) === 'exited';
|
|
91
|
+
try {
|
|
92
|
+
const result = await change();
|
|
93
|
+
return { ...result, desktopClient: clientWasOpen ? 'reopened' : 'not_open',
|
|
94
|
+
loginLaunch: await desktopClient.followSwitch(plan.installRoot, result.packageRoot) };
|
|
95
|
+
} finally {
|
|
96
|
+
if (clientWasOpen) desktopClient.reopen(plan.installRoot);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async function readLoginLaunch(reg) {
|
|
101
|
+
const result = await reg(['query', RUN_KEY, '/v', RUN_VALUE]);
|
|
102
|
+
if (result.code !== 0) return null; // reg query exits 1 when the value is absent.
|
|
103
|
+
return new RegExp(`^\\s*${RUN_VALUE}\\s+REG_(?:EXPAND_)?SZ\\s+(.*?)\\s*$`, 'mi').exec(result.stdout)?.[1] ?? null;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function launchesFrom(command, installRoot) {
|
|
107
|
+
const executable = /^"([^"]+)"/.exec(command)?.[1] ?? command.split(' ')[0];
|
|
108
|
+
return windowsInstallPathsOverlap(executable, installRoot);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async function requireReg(reg, args) {
|
|
112
|
+
const result = await reg(args);
|
|
113
|
+
if (result.code !== 0) throw new Error('reg ' + args[0] + ' failed (exit ' + result.code + ').');
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function runReg(args) {
|
|
117
|
+
return new Promise(resolve => execFile(join(process.env.SystemRoot, 'System32', 'reg.exe'), args,
|
|
118
|
+
{ windowsHide: true, timeout: 30_000, encoding: 'utf8' },
|
|
119
|
+
(error, stdout) => resolve({ code: error ? (typeof error.code === 'number' ? error.code : 1) : 0, stdout })));
|
|
120
|
+
}
|
|
@@ -2,18 +2,22 @@ import { isMainModule } from '../system/main-module.js';
|
|
|
2
2
|
import { confirmInTerminal, writeLine } from '../cli/terminal-io.js';
|
|
3
3
|
import { parseWindowsCommandOptions } from './windows-command-options.js';
|
|
4
4
|
import { planWindowsRollback, rollbackWindowsInstallation } from './windows-rollback.js';
|
|
5
|
+
import { LOGIN_LAUNCH_NOT_UPDATED } from './windows-update-command.js';
|
|
5
6
|
|
|
6
7
|
export async function runWindowsRollbackCommand(args = [], dependencies = {}) {
|
|
7
8
|
const { options, yes, preview } = parseWindowsCommandOptions(args, dependencies, 'Rollback');
|
|
8
9
|
const write = dependencies.write ?? writeLine;
|
|
9
10
|
const plan = (dependencies.plan ?? planWindowsRollback)(options);
|
|
10
|
-
write(`回退 / Roll back: ${plan.current.applicationVersion} → ${plan.applicationVersion}\n程序 / Application: ${plan.installRoot}\n保留数据 / Keep data: ${plan.current.dataDir}\n只切换程序,不回退数据或数据库;新版写入的内容保持原样。 / Only the program changes; data and the database are not rolled back.\n
|
|
11
|
+
write(`回退 / Roll back: ${plan.current.applicationVersion} → ${plan.applicationVersion}\n程序 / Application: ${plan.installRoot}\n保留数据 / Keep data: ${plan.current.dataDir}\n只切换程序,不回退数据或数据库;新版写入的内容保持原样。 / Only the program changes; data and the database are not rolled back.\n正在运行的 FULI 桌面客户端会先关闭;服务会自动停止后重启。 / A running FULI desktop client closes first; services are stopped and restarted.`);
|
|
11
12
|
if (preview) return { status: 'preview' };
|
|
12
13
|
const confirm = dependencies.confirm ?? (() => confirmInTerminal('回退? / Roll back? [y/N] ', { defaultYes: false }));
|
|
13
14
|
if (!yes && !await confirm()) return { status: 'cancelled' };
|
|
14
15
|
const result = await (dependencies.rollback ?? rollbackWindowsInstallation)({ ...options,
|
|
15
16
|
expectedInstallationId: plan.current.installationId }, { write });
|
|
16
|
-
write('已回退 / Rolled back: ' + result.applicationVersion + '\n
|
|
17
|
+
write('已回退 / Rolled back: ' + result.applicationVersion + '\n请重启已打开的 Claude Code / Codex 会话。 / Restart open client sessions.');
|
|
18
|
+
write(result.desktopClient === 'reopened' ? 'FULI 桌面客户端已重新打开。 / The FULI desktop client is open again.'
|
|
19
|
+
: '可从桌面或开始菜单打开 FULI。 / Open FULI from the Desktop or Start menu.');
|
|
20
|
+
if (result.loginLaunch === 'failed') write(LOGIN_LAUNCH_NOT_UPDATED);
|
|
17
21
|
if (result.clients !== 'reconnected') write('客户端重新连接未完成;请检查后运行 setup。 / Client reconnection did not finish; inspect the installation and run setup.');
|
|
18
22
|
return result;
|
|
19
23
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import { isAbsolute, join } from 'node:path';
|
|
3
3
|
import { compareSemanticVersions } from '../semantic-version.js';
|
|
4
|
+
import { windowsDesktopClient, withWindowsClientClosed } from './windows-desktop-client.js';
|
|
4
5
|
import { canonicalWindowsInstallPath } from './windows-installation-context.js';
|
|
5
6
|
import { createWindowsShortcut, readWindowsShortcut, trayInventory } from './windows-installation.js';
|
|
6
7
|
import { assertInstallationUnchanged, runInstalledCli, stageWindowsShortcuts, stopAndSwitchWindowsInstallation } from './windows-installation-switch.js';
|
|
@@ -21,12 +22,17 @@ export function planWindowsRollback({ installRoot, env = process.env, readShortc
|
|
|
21
22
|
|
|
22
23
|
export async function rollbackWindowsInstallation(options, {
|
|
23
24
|
runCli = runInstalledCli, createShortcut = createWindowsShortcut, readShortcut = readWindowsShortcut,
|
|
24
|
-
acquireLock = acquireWindowsUpdateLock, write = () => {}, stopping
|
|
25
|
+
acquireLock = acquireWindowsUpdateLock, write = () => {}, stopping, desktopClient = windowsDesktopClient
|
|
25
26
|
} = {}) {
|
|
26
27
|
const plan = planWindowsRollback({ ...options, readShortcut });
|
|
27
28
|
if (options.expectedInstallationId && options.expectedInstallationId !== plan.current.installationId) {
|
|
28
29
|
throw new Error('The installation changed after confirmation; review the rollback again.');
|
|
29
30
|
}
|
|
31
|
+
return withWindowsClientClosed(plan, desktopClient,
|
|
32
|
+
() => switchToKeptVersion(plan, { runCli, createShortcut, readShortcut, acquireLock, write, stopping }));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function switchToKeptVersion(plan, { runCli, createShortcut, readShortcut, acquireLock, write, stopping }) {
|
|
30
36
|
const lock = await acquireLock(plan.current.dataDir);
|
|
31
37
|
try {
|
|
32
38
|
lock.assertHeld();
|
|
@@ -1,52 +1,48 @@
|
|
|
1
|
-
import { execFile
|
|
2
|
-
import {
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { mkdtempSync, rmSync } from 'node:fs';
|
|
3
3
|
import { tmpdir } from 'node:os';
|
|
4
4
|
import { join } from 'node:path';
|
|
5
5
|
|
|
6
6
|
import { readJsonFile } from '../storage/json-file.js';
|
|
7
|
-
import {
|
|
7
|
+
import { windowsDesktopClient } from './windows-desktop-client.js';
|
|
8
8
|
import { downloadWindowsTrayRelease } from './windows-tray-release.js';
|
|
9
9
|
|
|
10
10
|
// The console's one-click update of a per-user Windows (tray) installation:
|
|
11
|
-
// download and verify the release's tray package,
|
|
12
|
-
// that package's own Update-Fuli (the same update the
|
|
13
|
-
// stop, switch, start, reconnect clients, roll back on
|
|
14
|
-
// previous version are kept), then open the
|
|
15
|
-
// installed afterwards. Runs in the console's detached
|
|
11
|
+
// download and verify the release's tray package, close the desktop client
|
|
12
|
+
// (the tray app), run that package's own Update-Fuli (the same update the
|
|
13
|
+
// double-click runs: stop, switch, start, reconnect clients, roll back on
|
|
14
|
+
// failure; data and the previous version are kept), then open the client of
|
|
15
|
+
// whichever version is installed afterwards. Runs in the console's detached
|
|
16
|
+
// update worker.
|
|
16
17
|
|
|
17
|
-
// A busy tray finishes its operation (bounded to about three minutes) before it exits.
|
|
18
|
-
const TRAY_EXIT_TIMEOUT_MS = 200_000;
|
|
19
18
|
const UPDATE_TIMEOUT_MS = 30 * 60_000;
|
|
20
19
|
|
|
21
20
|
// installation: the installed record (installation.json) of this package.
|
|
22
|
-
// Returns { status: 'updated', version }; throws with .blockers when running
|
|
21
|
+
// Returns { status: 'updated', version, clients }; throws with .blockers when running
|
|
23
22
|
// FULI processes blocked the switch.
|
|
24
23
|
export async function updateWindowsTrayFromRelease({ installation, version, stopPids = [], progress = () => {} }, {
|
|
25
|
-
download = downloadWindowsTrayRelease,
|
|
26
|
-
|
|
24
|
+
download = downloadWindowsTrayRelease, desktopClient = windowsDesktopClient, runUpdate = runPackagedUpdate,
|
|
25
|
+
tempRoot = tmpdir()
|
|
27
26
|
} = {}) {
|
|
28
27
|
const directory = mkdtempSync(join(tempRoot, 'fuli-tray-update-'));
|
|
29
|
-
let
|
|
28
|
+
let clientWasRunning = false;
|
|
30
29
|
try {
|
|
31
30
|
const source = await download(version, directory, { progress });
|
|
32
31
|
progress('exitingTray');
|
|
33
|
-
|
|
34
|
-
if (tray === 'busy') throw new Error('The Fuli tray did not exit; nothing was installed. Close its open message and try again.');
|
|
35
|
-
trayWasRunning = tray === 'exited';
|
|
32
|
+
clientWasRunning = await desktopClient.close(installation.dataDir) === 'exited';
|
|
36
33
|
progress('installing');
|
|
37
34
|
const resultFile = join(directory, 'result.json');
|
|
38
35
|
const code = await runUpdate(source, ['--yes', '--install-root', installation.installRoot, '--result-file', resultFile,
|
|
39
36
|
...(stopPids.length ? ['--stop-pid', stopPids.join(',')] : [])]);
|
|
40
37
|
const result = readJsonFile(resultFile, null);
|
|
41
|
-
|
|
38
|
+
// clients: whether Update-Fuli reconnected the already connected clients
|
|
39
|
+
// ('reconnected' or 'not_reconnected'); the console's doctor reads it from the journal.
|
|
40
|
+
if (result?.status === 'updated') return { status: 'updated', version: result.applicationVersion, clients: result.clients ?? null };
|
|
42
41
|
throw Object.assign(new Error(result?.error ?? `The update ended without an outcome (exit ${code}); nothing was reported.`),
|
|
43
42
|
result?.blockers ? { blockers: result.blockers } : {});
|
|
44
43
|
} finally {
|
|
45
|
-
// The
|
|
46
|
-
if (
|
|
47
|
-
const record = readJsonFile(join(installation.installRoot, 'installation.json'), null);
|
|
48
|
-
if (record?.packageRoot) launchTray(record.packageRoot);
|
|
49
|
-
}
|
|
44
|
+
// The client of the version installed now: the new one, or the kept one after a rollback.
|
|
45
|
+
if (clientWasRunning) desktopClient.reopen(installation.installRoot);
|
|
50
46
|
rmSync(directory, { recursive: true, force: true });
|
|
51
47
|
}
|
|
52
48
|
}
|
|
@@ -59,11 +55,3 @@ function runPackagedUpdate(source, args) {
|
|
|
59
55
|
error => resolve(error ? error.code ?? 1 : 0));
|
|
60
56
|
});
|
|
61
57
|
}
|
|
62
|
-
|
|
63
|
-
function launchWindowsTray(packageRoot) {
|
|
64
|
-
const tray = join(packageRoot, 'Fuli.exe');
|
|
65
|
-
if (!existsSync(tray)) return;
|
|
66
|
-
const child = spawn(tray, [], { cwd: packageRoot, detached: true, stdio: 'ignore' });
|
|
67
|
-
child.once('error', () => {});
|
|
68
|
-
child.unref();
|
|
69
|
-
}
|
|
@@ -7,7 +7,7 @@ export async function runWindowsUninstallCommand(args = [], dependencies = {}) {
|
|
|
7
7
|
const { options, yes, preview } = parseWindowsCommandOptions(args, dependencies, 'Uninstall');
|
|
8
8
|
const write = dependencies.write ?? writeLine;
|
|
9
9
|
const plan = (dependencies.plan ?? planWindowsUninstall)(options);
|
|
10
|
-
write(`卸载 / Uninstall: Fuli ${plan.current.applicationVersion}(${plan.slots.length} 个版本 / versions)\n程序 / Application: ${plan.installRoot}\n保留数据 / Keep data: ${plan.current.dataDir}\n
|
|
10
|
+
write(`卸载 / Uninstall: Fuli ${plan.current.applicationVersion}(${plan.slots.length} 个版本 / versions)\n程序 / Application: ${plan.installRoot}\n保留数据 / Keep data: ${plan.current.dataDir}\n将关闭 FULI 桌面客户端、停止服务、断开 Agent 客户端,并删除快捷方式和开机启动项;数据目录不会改动。 / The FULI desktop client closes, services stop, Agent clients are disconnected, and shortcuts and the launch-at-login entry are removed; the data folder is not changed.`);
|
|
11
11
|
if (preview) return { status: 'preview' };
|
|
12
12
|
const confirm = dependencies.confirm ?? (() => confirmInTerminal('卸载? / Uninstall? [y/N] ', { defaultYes: false }));
|
|
13
13
|
if (!yes && !await confirm()) return { status: 'cancelled' };
|
|
@@ -15,6 +15,7 @@ export async function runWindowsUninstallCommand(args = [], dependencies = {}) {
|
|
|
15
15
|
expectedInstallationId: plan.current.installationId }, { write });
|
|
16
16
|
write('已卸载 / Uninstalled. 数据保留在 / Data kept at: ' + result.dataDir);
|
|
17
17
|
if (result.status === 'removing_after_exit') write('程序文件将在此窗口关闭后几秒内删除。 / Program files are removed a few seconds after this window closes.');
|
|
18
|
+
if (result.registrations === 'failed') write('开机启动项或桌面客户端设置没有删除;请在 Windows 设置的「启动应用」里检查 FULI。 / The launch-at-login entry or desktop client settings were not removed; check FULI under Startup apps in Windows Settings.');
|
|
18
19
|
for (const path of result.keptShortcuts) write('已保留被修改的快捷方式 / Kept a changed shortcut: ' + path);
|
|
19
20
|
if (result.leftover) write('程序目录中还有其他文件,已保留 / Other files remain in: ' + result.leftover);
|
|
20
21
|
write('重启已打开的 Claude Code / Codex 会话以卸下 Fuli。 / Restart open client sessions to unload Fuli.');
|
|
@@ -2,6 +2,7 @@ import { spawn } from 'node:child_process';
|
|
|
2
2
|
import { existsSync, lstatSync, readdirSync, rmdirSync, rmSync, unlinkSync } from 'node:fs';
|
|
3
3
|
import { tmpdir } from 'node:os';
|
|
4
4
|
import { join } from 'node:path';
|
|
5
|
+
import { windowsDesktopClient } from './windows-desktop-client.js';
|
|
5
6
|
import { windowsInstallPathsOverlap } from './windows-installation-context.js';
|
|
6
7
|
import { readWindowsShortcut } from './windows-installation.js';
|
|
7
8
|
import { assertInstallationUnchanged, requireInstalledCli, runInstalledCli } from './windows-installation-switch.js';
|
|
@@ -10,8 +11,9 @@ import { acquireWindowsUpdateLock } from './windows-update-lock.js';
|
|
|
10
11
|
|
|
11
12
|
const SLOT = /^[a-f0-9-]{36}$/;
|
|
12
13
|
|
|
13
|
-
// Removes the per-user application:
|
|
14
|
-
// removed, then the record, own shortcuts
|
|
14
|
+
// Removes the per-user application: the desktop client closes, services stop,
|
|
15
|
+
// Agent client integrations are removed, then the record, own shortcuts, the
|
|
16
|
+
// client's Windows entries and version slots. Data is never touched.
|
|
15
17
|
export function planWindowsUninstall({ installRoot, env = process.env, readShortcut = readWindowsShortcut } = {}) {
|
|
16
18
|
const installed = readCurrentWindowsInstallation({ installRoot, env, readShortcut, keepForeignShortcuts: true });
|
|
17
19
|
const versions = join(installed.installRoot, 'versions');
|
|
@@ -23,13 +25,16 @@ export function planWindowsUninstall({ installRoot, env = process.env, readShort
|
|
|
23
25
|
|
|
24
26
|
export async function uninstallWindowsInstallation(options, {
|
|
25
27
|
runCli = runInstalledCli, readShortcut = readWindowsShortcut, acquireLock = acquireWindowsUpdateLock,
|
|
26
|
-
write = () => {}, removeAfterExit = removeWindowsDirectoriesAfterExit, runningFrom = process.execPath
|
|
28
|
+
write = () => {}, removeAfterExit = removeWindowsDirectoriesAfterExit, runningFrom = process.execPath,
|
|
29
|
+
desktopClient = windowsDesktopClient
|
|
27
30
|
} = {}) {
|
|
28
31
|
const plan = planWindowsUninstall({ ...options, readShortcut });
|
|
29
32
|
const { current } = plan;
|
|
30
33
|
if (options.expectedInstallationId && options.expectedInstallationId !== current.installationId) {
|
|
31
34
|
throw new Error('The installation changed after confirmation; review the uninstall again.');
|
|
32
35
|
}
|
|
36
|
+
// The running client would hold its version folder open and could start Fuli again.
|
|
37
|
+
await desktopClient.close(current.dataDir);
|
|
33
38
|
const lock = await acquireLock(current.dataDir);
|
|
34
39
|
try {
|
|
35
40
|
lock.assertHeld();
|
|
@@ -53,6 +58,7 @@ export async function uninstallWindowsInstallation(options, {
|
|
|
53
58
|
unlinkSync(path);
|
|
54
59
|
} catch { keptShortcuts.push(path); }
|
|
55
60
|
}
|
|
61
|
+
const registrations = await desktopClient.unregister(plan.installRoot);
|
|
56
62
|
const pending = [];
|
|
57
63
|
for (const slot of plan.slots) {
|
|
58
64
|
// The running node.exe locks its own slot; it is removed once this process exits.
|
|
@@ -63,7 +69,7 @@ export async function uninstallWindowsInstallation(options, {
|
|
|
63
69
|
for (const path of containers) removeIfEmpty(path);
|
|
64
70
|
if (pending.length) await removeAfterExit(pending, containers);
|
|
65
71
|
return { status: pending.length ? 'removing_after_exit' : 'removed', applicationVersion: current.applicationVersion,
|
|
66
|
-
dataDir: current.dataDir, installRoot: plan.installRoot, keptShortcuts,
|
|
72
|
+
dataDir: current.dataDir, installRoot: plan.installRoot, keptShortcuts, registrations,
|
|
67
73
|
leftover: existsSync(plan.installRoot) && !pending.length ? plan.installRoot : null };
|
|
68
74
|
} finally { await lock.release(); }
|
|
69
75
|
}
|
|
@@ -6,6 +6,8 @@ import { writeJsonFileAtomic } from '../storage/json-file.js';
|
|
|
6
6
|
import { parseWindowsCommandOptions } from './windows-command-options.js';
|
|
7
7
|
import { planWindowsUpdate, updateWindowsInstallation } from './windows-update.js';
|
|
8
8
|
|
|
9
|
+
export const LOGIN_LAUNCH_NOT_UPDATED = '开机启动项没有跟着换版本;请在 Windows 设置的「启动应用」里检查 FULI。 / The launch-at-login entry did not follow the version change; check FULI under Startup apps in Windows Settings.';
|
|
10
|
+
|
|
9
11
|
export async function runWindowsUpdateCommand(args = [], dependencies = {}) {
|
|
10
12
|
const { options, yes, preview } = parseWindowsCommandOptions(args, dependencies, 'Update');
|
|
11
13
|
const { resultFile, stopPids = [], ...updateOptions } = options;
|
|
@@ -18,7 +20,7 @@ export async function runWindowsUpdateCommand(args = [], dependencies = {}) {
|
|
|
18
20
|
try {
|
|
19
21
|
const plan = (dependencies.plan ?? planWindowsUpdate)(updateOptions);
|
|
20
22
|
if (plan.downgrade) write('这是降版替换(--allow-downgrade):程序换成更低的版本号,数据不变;更新前请先备份数据目录。 / This replaces Fuli with a lower version (--allow-downgrade); data is kept. Back up the data folder first.');
|
|
21
|
-
write(`更新 / Update: ${plan.current.applicationVersion} → ${plan.applicationVersion}\n程序 / Application: ${plan.installRoot}\n保留数据 / Keep data: ${plan.current.dataDir}\n
|
|
23
|
+
write(`更新 / Update: ${plan.current.applicationVersion} → ${plan.applicationVersion}\n程序 / Application: ${plan.installRoot}\n保留数据 / Keep data: ${plan.current.dataDir}\n正在运行的 FULI 桌面客户端会先关闭;服务会自动停止后重启。 / A running FULI desktop client closes first; services are stopped and restarted.`);
|
|
22
24
|
const upgrade = plan.neo4jUpgrade;
|
|
23
25
|
if (upgrade) write(`Neo4j ${upgrade.from} → ${upgrade.to}:切换前先备份图谱;升级后不能回退到 ${upgrade.from}。 / The graph is backed up before the switch; rolling back to Neo4j ${upgrade.from} afterwards is refused.`);
|
|
24
26
|
if (preview) return { status: 'preview' };
|
|
@@ -30,7 +32,10 @@ export async function runWindowsUpdateCommand(args = [], dependencies = {}) {
|
|
|
30
32
|
const result = await (dependencies.update ?? updateWindowsInstallation)({ ...updateOptions,
|
|
31
33
|
expectedInstallationId: plan.current.installationId, expectedInventorySha256: plan.inventorySha256 }, { write, stopping });
|
|
32
34
|
report({ status: 'updated', applicationVersion: result.applicationVersion, packageRoot: result.packageRoot, clients: result.clients });
|
|
33
|
-
write('已更新 / Updated: ' + result.applicationVersion
|
|
35
|
+
write('已更新 / Updated: ' + result.applicationVersion);
|
|
36
|
+
write(result.desktopClient === 'reopened' ? 'FULI 桌面客户端已重新打开。 / The FULI desktop client is open again.'
|
|
37
|
+
: '可从桌面或开始菜单打开 FULI。 / Open FULI from the Desktop or Start menu.');
|
|
38
|
+
if (result.loginLaunch === 'failed') write(LOGIN_LAUNCH_NOT_UPDATED);
|
|
34
39
|
// Clients keep the MCP server they started; only a restart loads this version.
|
|
35
40
|
write('已打开的 Claude Code / Codex 等会话需要重启才会用上新版(更省 Token)。 / Restart open Claude Code, Codex and other client sessions to load the new version (it uses fewer tokens).');
|
|
36
41
|
if (result.clients !== 'reconnected') write('客户端重新连接未完成;请检查后运行新版 setup。 / Client reconnection did not finish; inspect the installation and run setup from the new version.');
|
|
@@ -2,7 +2,9 @@ import { execFile, spawn } from 'node:child_process';
|
|
|
2
2
|
import { createHash } from 'node:crypto';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
|
|
5
|
-
// The per-user/data mutex
|
|
5
|
+
// The per-user/data mutex the tray app holds while it runs ("Global\FuliTray-<SID>-<key>"):
|
|
6
|
+
// the FULI desktop client now (desktop/flutter/lib/src/platform/desktop/windows_instance.dart),
|
|
7
|
+
// FuliTray.exe before it. The name stays so an update from either side finds the other.
|
|
6
8
|
function trayMutexScript(dataDir) {
|
|
7
9
|
if (process.platform !== 'win32') throw new Error('Windows updates require Windows.');
|
|
8
10
|
const key = createHash('sha256').update(dataDir.toLowerCase()).digest('hex').slice(0, 32);
|
|
@@ -13,13 +15,13 @@ function trayMutexScript(dataDir) {
|
|
|
13
15
|
const powershellPath = () => join(process.env.SystemRoot, 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe');
|
|
14
16
|
const encoded = script => ['-NoProfile', '-NonInteractive', '-EncodedCommand', Buffer.from(script, 'utf16le').toString('base64')];
|
|
15
17
|
|
|
16
|
-
// Hold the same per-user/data mutex as
|
|
17
|
-
// A running
|
|
18
|
+
// Hold the same per-user/data mutex as the tray app for the entire transaction.
|
|
19
|
+
// A running client or another updater must finish before any services are stopped.
|
|
18
20
|
export async function acquireWindowsUpdateLock(dataDir) {
|
|
19
21
|
const script = trayMutexScript(dataDir)
|
|
20
22
|
+ '$m=New-Object Threading.Mutex($false,$name); $owned=$false; try { '
|
|
21
23
|
+ 'try {$owned=$m.WaitOne(0)} catch [Threading.AbandonedMutexException] {$owned=$true}; '
|
|
22
|
-
+ 'if(-not $owned){throw "
|
|
24
|
+
+ 'if(-not $owned){throw "Close the FULI desktop client and other FULI updaters, then try again."}; '
|
|
23
25
|
+ '[Console]::WriteLine("FULI_UPDATE_LOCKED"); [Console]::Out.Flush(); [Console]::In.ReadLine() | Out-Null '
|
|
24
26
|
+ '} finally {if($owned){$m.ReleaseMutex()};$m.Dispose()}';
|
|
25
27
|
const child = spawn(powershellPath(), encoded(script), { windowsHide: true, stdio: ['pipe', 'pipe', 'pipe'] });
|
|
@@ -30,7 +32,7 @@ export async function acquireWindowsUpdateLock(dataDir) {
|
|
|
30
32
|
await new Promise((resolve, reject) => {
|
|
31
33
|
let output = '';
|
|
32
34
|
const timer = setTimeout(() => { child.kill(); reject(new Error('Timed out acquiring the Windows tray lock.')); }, 15000);
|
|
33
|
-
const fail = () => { clearTimeout(timer); reject(new Error('
|
|
35
|
+
const fail = () => { clearTimeout(timer); reject(new Error('Close the FULI desktop client and other FULI updaters, then try again.')); };
|
|
34
36
|
child.once('error', fail); child.once('close', fail);
|
|
35
37
|
child.stdout.on('data', bytes => {
|
|
36
38
|
output += bytes;
|
|
@@ -43,8 +45,8 @@ export async function acquireWindowsUpdateLock(dataDir) {
|
|
|
43
45
|
};
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
//
|
|
47
|
-
// services keep running) and
|
|
48
|
+
// Updates ask a running tray app to exit (its "-exit" event; the
|
|
49
|
+
// services keep running) and wait until the tray mutex is free. A client in the
|
|
48
50
|
// middle of an operation exits when it finishes. Resolves 'exited', 'absent'
|
|
49
51
|
// (no tray was running) or 'busy' (still there after timeoutMs).
|
|
50
52
|
export function requestWindowsTrayExit(dataDir, { timeoutMs }) {
|
|
@@ -5,6 +5,7 @@ import { compareSemanticVersions } from '../semantic-version.js';
|
|
|
5
5
|
import { canonicalWindowsInstallPath, installationSha256, readWindowsInstallation, windowsInstallPathsOverlap } from './windows-installation-context.js';
|
|
6
6
|
import { createWindowsShortcut, readWindowsShortcut, trayInventory } from './windows-installation.js';
|
|
7
7
|
import { assertInstallationUnchanged, installedWindowsShortcuts, runInstalledCli, stageWindowsShortcuts, stopAndSwitchWindowsInstallation } from './windows-installation-switch.js';
|
|
8
|
+
import { windowsDesktopClient, withWindowsClientClosed } from './windows-desktop-client.js';
|
|
8
9
|
import { acquireWindowsUpdateLock } from './windows-update-lock.js';
|
|
9
10
|
import { snapshotWindowsUpdateRuntime } from './windows-update-runtime.js';
|
|
10
11
|
|
|
@@ -46,13 +47,18 @@ export function planWindowsUpdate({ source, installRoot, env = process.env, read
|
|
|
46
47
|
|
|
47
48
|
export async function updateWindowsInstallation(options, {
|
|
48
49
|
runCli = runInstalledCli, createShortcut = createWindowsShortcut, readShortcut = readWindowsShortcut,
|
|
49
|
-
acquireLock = acquireWindowsUpdateLock, write = () => {}, stopping, backupGraph
|
|
50
|
+
acquireLock = acquireWindowsUpdateLock, write = () => {}, stopping, backupGraph, desktopClient = windowsDesktopClient
|
|
50
51
|
} = {}) {
|
|
51
52
|
const plan = planWindowsUpdate({ ...options, readShortcut });
|
|
52
53
|
if ((options.expectedInstallationId && options.expectedInstallationId !== plan.current.installationId)
|
|
53
54
|
|| (options.expectedInventorySha256 && options.expectedInventorySha256 !== plan.inventorySha256)) {
|
|
54
55
|
throw new Error('The installation or update package changed after confirmation; review the update again.');
|
|
55
56
|
}
|
|
57
|
+
return withWindowsClientClosed(plan, desktopClient,
|
|
58
|
+
() => stageAndSwitch(plan, { runCli, createShortcut, readShortcut, acquireLock, write, stopping, backupGraph }));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function stageAndSwitch(plan, { runCli, createShortcut, readShortcut, acquireLock, write, stopping, backupGraph }) {
|
|
56
62
|
const lock = await acquireLock(plan.current.dataDir);
|
|
57
63
|
try {
|
|
58
64
|
lock.assertHeld();
|
|
@@ -104,7 +104,7 @@ export async function checkpointTaskKnowledge(application, {
|
|
|
104
104
|
agentId: task.projectAgentId ?? null, name: team.name, role: team.role, sourceApplication: task.sourceApplication,
|
|
105
105
|
workStatus: effectiveLog.status, conversationId: conversation?.conversation_id ?? null,
|
|
106
106
|
persistence: conversation?.status ?? null, collaborators: team.collaborators,
|
|
107
|
-
notices: [...namedFlaReceiptNotices(task), ...standingReceiptNotices(task), ...receiptNotices(captureCheck, [], { settingsUrl: captureSettingsUrl(application) }), ...await receiptFormatNotices(application)],
|
|
107
|
+
notices: [...namedFlaReceiptNotices(task), ...standingReceiptNotices(task), ...receiptNotices(captureCheck, [], { settingsUrl: captureSettingsUrl(application) }), ...await receiptFormatNotices(application, { taskId: task.token })],
|
|
108
108
|
turnReceipt: await checkpointTurnReceipt(application, checkpointTask, { memory, agentName: team.name }) }),
|
|
109
109
|
...(team.ignored.length ? { ignored_collaborators: team.ignored } : {}) };
|
|
110
110
|
};
|
|
@@ -95,7 +95,7 @@ export async function readTaskPreferences(application, {
|
|
|
95
95
|
agent_receipt: taskAgentReceipt(application, { projectId: task.personalProjectId,
|
|
96
96
|
agentId: task.projectAgentId, name: rawAgent.profile?.display_name ?? null, role: rawAgent.profile?.name ?? null, sourceApplication: task.sourceApplication,
|
|
97
97
|
notices: [...receiptNotices(await captureDecision(application, taskCaptureScope(task)), [],
|
|
98
|
-
{ settingsUrl: captureSettingsUrl(application) }), ...await receiptFormatNotices(application)] }),
|
|
98
|
+
{ settingsUrl: captureSettingsUrl(application) }), ...await receiptFormatNotices(application, { taskId: task.token })] }),
|
|
99
99
|
preference_delivery: { status: 'complete' }, preferences_complete: true,
|
|
100
100
|
same_task_recovery_available: true, truncated: false
|
|
101
101
|
};
|
|
@@ -3,6 +3,7 @@ import { deferredTurnReceipt, MAX_LIST_EPISODES, readEpisodeReceipts, readTurnRe
|
|
|
3
3
|
import { withReceiptLines, withTurnReceipt } from '../agents/identity-receipt.js';
|
|
4
4
|
import { taskKnowledgeReader } from './knowledge-reader.js';
|
|
5
5
|
import { formalTask, sessionMigrationLine, sessionMigrationOffer } from './session-knowledge-migration.js';
|
|
6
|
+
import { receiptFormatNotices } from '../data-format/format-notices.js';
|
|
6
7
|
|
|
7
8
|
// When a turn's receipt reaches a reply, exactly once (rec#20). The Provider
|
|
8
9
|
// marks a checkpoint that saved knowledge as unread. Its own reply claims it
|
|
@@ -44,6 +45,8 @@ async function savedTurnReceipt(application, task, results, { memory, agentName
|
|
|
44
45
|
// never showed, then the offer to migrate what the session's temporary project
|
|
45
46
|
// holds once the session linked to a formal project (rec#20 part 2).
|
|
46
47
|
export async function entryAgentReceipt(application, task, receipt) {
|
|
48
|
+
const format = await receiptFormatNotices(application, { taskId: task.token, includePending: false });
|
|
49
|
+
if (format.length) receipt = { ...receipt, markdown: [receipt.markdown, ...format].join(' · ') };
|
|
47
50
|
const late = await unreadTurnReceipt(application, task);
|
|
48
51
|
const migration = await sessionMigrationOffer(application, task);
|
|
49
52
|
return withReceiptLines(withTurnReceipt(receipt, late), migration ? [migration] : []);
|
package/src/http/api-router.js
CHANGED
|
@@ -5,6 +5,7 @@ import { handleGraphApiRequest } from './graph-api-router.js';
|
|
|
5
5
|
import { handleEmployeeApiRequest } from './employee-api-router.js';
|
|
6
6
|
import { handleAgentAppApiRequest } from './agent-app-api-router.js';
|
|
7
7
|
import { handleDataFormatApiRequest } from './data-format-api-router.js';
|
|
8
|
+
import { handleDoctorApiRequest } from './doctor-api-router.js';
|
|
8
9
|
import { handleKnowledgeHardDeleteRequest } from './knowledge-hard-delete-api-router.js';
|
|
9
10
|
import { handleKnowledgeScopeRequest } from './knowledge-scope-api-router.js';
|
|
10
11
|
import { handleProjectHierarchyRequest } from './project-hierarchy-api-router.js';
|
|
@@ -159,6 +160,10 @@ export async function handleApiRequest({
|
|
|
159
160
|
return true;
|
|
160
161
|
}
|
|
161
162
|
|
|
163
|
+
// Outside the graph runtime lease: polling the doctor never wakes a
|
|
164
|
+
// sleeping provider (its graph format plan then reads as unavailable).
|
|
165
|
+
if (await handleDoctorApiRequest({ request, response, url, system })) return true;
|
|
166
|
+
|
|
162
167
|
if (system && url.pathname === '/api/system/runtime' && request.method === 'GET') {
|
|
163
168
|
sendJson(response, 200, system.runtimeStatus());
|
|
164
169
|
return true;
|
|
@@ -19,9 +19,10 @@ const BODIES = Object.freeze({
|
|
|
19
19
|
apply: z.object({ digest: z.string().regex(/^[0-9a-f]{64}$/) }).strict(),
|
|
20
20
|
rollback: z.object({ label, migrationId: z.string().min(1).max(128) }).strict(),
|
|
21
21
|
prune: z.object({}).strict(),
|
|
22
|
+
'dismiss-notices': z.object({ ids: z.array(z.string().regex(/^[0-9a-f]{64}$/)).min(1).max(200) }).strict(),
|
|
22
23
|
restore: z.object({ label, backupRef, currentDigest: z.string().min(1).max(128).nullable() }).strict()
|
|
23
24
|
});
|
|
24
|
-
const ACTIONS = /^\/api\/data-format\/(apply|rollback|prune|restore)$/;
|
|
25
|
+
const ACTIONS = /^\/api\/data-format\/(apply|rollback|prune|restore|dismiss-notices)$/;
|
|
25
26
|
const RESTORE_READS = new Set(['/api/data-format/restore', '/api/data-format/restore/status']);
|
|
26
27
|
|
|
27
28
|
export async function handleDataFormatApiRequest({ request, response, url, migrations }) {
|
|
@@ -58,6 +59,7 @@ const ACTION_HANDLERS = Object.freeze({
|
|
|
58
59
|
rollback: (migrations, body) => migrations.rollback({ label: body.label, migrationId: body.migrationId,
|
|
59
60
|
actor: LOCAL_CONSOLE }),
|
|
60
61
|
prune: async (migrations) => ({ pruned: await migrations.retain() }),
|
|
62
|
+
'dismiss-notices': (migrations, body) => migrations.dismissNotices(body.ids),
|
|
61
63
|
restore: (migrations, body) => restorePort(migrations.restore).start(body)
|
|
62
64
|
});
|
|
63
65
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { InvalidInputError } from '../app/application-error.js';
|
|
2
|
+
import { assertJsonObject } from '../validation/values.js';
|
|
3
|
+
import { refuseRemoteDecision } from './request-policy.js';
|
|
4
|
+
import { readJson, sendJson } from './response.js';
|
|
5
|
+
|
|
6
|
+
// FULI's 体检 (src/system/doctor.js). The read is open to the console like
|
|
7
|
+
// any read; the repair writes client configuration, so only a request from
|
|
8
|
+
// this computer may start it (local_user_only in the interface catalog).
|
|
9
|
+
|
|
10
|
+
const DOCTOR_PATH = '/api/system/doctor';
|
|
11
|
+
const REPAIR_PATH = '/api/system/doctor/repair';
|
|
12
|
+
|
|
13
|
+
export async function handleDoctorApiRequest({ request, response, url, system }) {
|
|
14
|
+
if (!system?.doctor || (url.pathname !== DOCTOR_PATH && url.pathname !== REPAIR_PATH)) return false;
|
|
15
|
+
response.setHeader('Cache-Control', 'no-store');
|
|
16
|
+
const method = url.pathname === DOCTOR_PATH ? 'GET' : 'POST';
|
|
17
|
+
if (request.method !== method) {
|
|
18
|
+
sendJson(response, 405, { error: 'Method not allowed' });
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
if (method === 'GET') {
|
|
22
|
+
sendJson(response, 200, await system.doctor());
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
if (refuseRemoteDecision(request, response, 'FULI is repaired only on this computer')) return true;
|
|
26
|
+
const body = await readJson(request);
|
|
27
|
+
assertJsonObject(body, 'Doctor repair');
|
|
28
|
+
if (Object.keys(body).length) throw new InvalidInputError('A doctor repair takes no options; send {}.');
|
|
29
|
+
sendJson(response, 200, await system.repairDoctor());
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
@@ -21,21 +21,27 @@ export function registerMcpProcess(runtimeConfigPath, { sourceApplication, versi
|
|
|
21
21
|
return () => { try { rmSync(path, { force: true }); } catch { /* best effort */ } };
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
//
|
|
25
|
-
// processes are removed on the way.
|
|
26
|
-
export function
|
|
24
|
+
// Every live server's record ({ pid, version, sourceApplication, startedAt });
|
|
25
|
+
// files of exited processes are removed on the way.
|
|
26
|
+
export function liveMcpProcesses(runtimeConfigPath, { isAlive = alive } = {}) {
|
|
27
27
|
let names;
|
|
28
28
|
try { names = readdirSync(directory(runtimeConfigPath)); } catch { return []; }
|
|
29
|
-
const
|
|
29
|
+
const live = [];
|
|
30
30
|
for (const name of names.filter(item => /^\d+\.json$/.test(item))) {
|
|
31
31
|
const path = join(directory(runtimeConfigPath), name);
|
|
32
32
|
try {
|
|
33
33
|
const record = JSON.parse(readFileSync(path, 'utf8'));
|
|
34
34
|
if (!isAlive(record.pid)) { rmSync(path, { force: true }); continue; }
|
|
35
|
-
|
|
35
|
+
live.push(record);
|
|
36
36
|
} catch { /* unreadable entry: skip */ }
|
|
37
37
|
}
|
|
38
|
-
return
|
|
38
|
+
return live;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Live servers of this client that run a different version.
|
|
42
|
+
export function outdatedMcpProcesses(runtimeConfigPath, { sourceApplication, version, isAlive = alive }) {
|
|
43
|
+
return liveMcpProcesses(runtimeConfigPath, { isAlive })
|
|
44
|
+
.filter(record => record.sourceApplication === sourceApplication && record.version !== version);
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
// The one-time notice for this session, or null. Shown again only when the
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
// and writes its digest here before publishing (scripts/pin-win-helper.js); a
|
|
4
4
|
// source checkout has no helper and no pin, so Windows Hello is unavailable there.
|
|
5
5
|
// The helper is not Authenticode-signed: this digest is its only integrity check.
|
|
6
|
-
export const WIN_HELPER_SHA256 = '
|
|
6
|
+
export const WIN_HELPER_SHA256 = '48ef409632311fbc085f5ab88e7259a9ff9a4aa9ccaaf6fe262751534954ff3a';
|
package/src/server.js
CHANGED
|
@@ -191,7 +191,8 @@ export async function createServer(options = {}) {
|
|
|
191
191
|
runtimeConfigPath: localOptions.runtimeConfigPath,
|
|
192
192
|
activePort: port,
|
|
193
193
|
activeLan: lanEnabled,
|
|
194
|
-
executorAdapters: options.executorAdapters
|
|
194
|
+
executorAdapters: options.executorAdapters,
|
|
195
|
+
previewDataFormats: dataFormatMigrations ? () => dataFormatMigrations.preview() : null
|
|
195
196
|
})
|
|
196
197
|
: null);
|
|
197
198
|
if (options.workerRuntimeBindings !== undefined) {
|