dsh-config-manager 0.8.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/adapters/mcp.js +51 -15
- package/lib/adapters/messages.d.ts +1 -0
- package/lib/adapters/messages.js +2 -0
- package/lib/adapters/patch-key-guard.d.ts +23 -0
- package/lib/adapters/patch-key-guard.js +13 -0
- package/lib/adapters/plugin-data.d.ts +19 -5
- package/lib/adapters/plugin-data.js +76 -22
- package/lib/adapters/plugins.d.ts +14 -1
- package/lib/adapters/plugins.js +204 -6
- package/lib/adapters/prompts.js +15 -4
- package/lib/adapters/test-helpers.d.ts +15 -1
- package/lib/adapters/test-helpers.js +11 -0
- package/lib/cli/actions.d.ts +7 -105
- package/lib/cli/actions.js +16 -172
- package/lib/cli/control-state.d.ts +54 -0
- package/lib/cli/control-state.js +107 -0
- package/lib/cli/help.d.ts +1 -1
- package/lib/cli/help.js +21 -14
- package/lib/cli/index.js +132 -104
- package/lib/cli/sessions-repair.js +58 -22
- package/lib/cli/web/client-script.d.ts +1 -1
- package/lib/cli/web/client-script.js +71 -5
- package/lib/cli/web/page.d.ts +9 -19
- package/lib/cli/web/page.js +277 -173
- package/lib/cli/web/routes.js +85 -25
- package/lib/cli/write-gates.d.ts +61 -0
- package/lib/cli/write-gates.js +110 -0
- package/lib/client.d.ts +196 -75
- package/lib/client.js +8139 -7487
- package/lib/core/backup.d.ts +0 -4
- package/lib/core/backup.js +21 -4
- package/lib/core/boot-rescue.d.ts +1 -1
- package/lib/core/boot-rescue.js +12 -1
- package/lib/core/boot-safety.js +37 -2
- package/lib/core/conflict-decisions.js +2 -1
- package/lib/core/exporter.js +22 -1
- package/lib/core/journal.d.ts +54 -4
- package/lib/core/journal.js +158 -35
- package/lib/core/local-plugin-host.d.ts +29 -0
- package/lib/core/local-plugin-host.js +55 -48
- package/lib/core/messages.d.ts +17 -0
- package/lib/core/messages.js +34 -0
- package/lib/core/migration-history.js +16 -9
- package/lib/core/model-tools.d.ts +2 -2
- package/lib/core/model-tools.js +20 -2
- package/lib/core/patch-chain.d.ts +65 -0
- package/lib/core/patch-chain.js +100 -0
- package/lib/core/patch-document.d.ts +32 -4
- package/lib/core/patch-document.js +48 -17
- package/lib/core/patch-secret-guard.d.ts +49 -0
- package/lib/core/patch-secret-guard.js +164 -0
- package/lib/core/reconcile.d.ts +8 -0
- package/lib/core/reconcile.js +18 -3
- package/lib/core/reinstall.d.ts +2 -0
- package/lib/core/reinstall.js +6 -2
- package/lib/core/restore.js +31 -6
- package/lib/core/section-sanitize.d.ts +32 -0
- package/lib/core/section-sanitize.js +13 -0
- package/lib/core/snapshot-diff.d.ts +30 -0
- package/lib/core/snapshot-diff.js +56 -20
- package/lib/core/startup-barrier.js +8 -2
- package/lib/core/types.d.ts +38 -1
- package/lib/core/update-check.js +51 -2
- package/lib/foreign/kernel.js +9 -2
- package/lib/foreign/read-claude-plugins.js +29 -11
- package/lib/foreign/read-dsh.js +31 -2
- package/lib/foreign/session-ir.js +50 -9
- package/lib/foreign/session-read.d.ts +8 -0
- package/lib/foreign/session-read.js +26 -0
- package/lib/index.d.ts +9 -4
- package/lib/index.js +42 -47
- package/lib/profiles/dsh-profile-io.d.ts +20 -0
- package/lib/profiles/dsh-profile-io.js +27 -0
- package/lib/profiles/dsh-profile-manager.d.ts +27 -0
- package/lib/profiles/dsh-profile-manager.js +45 -4
- package/lib/profiles/dsh-profile-runtime.d.ts +5 -1
- package/lib/profiles/dsh-profile-runtime.js +16 -3
- package/lib/profiles/process-control.d.ts +18 -1
- package/lib/profiles/process-control.js +25 -1
- package/lib/routes/profiles.js +2 -1
- package/lib/routes/sync.js +19 -1
- package/lib/schema/types.d.ts +11 -0
- package/lib/security/redaction.js +22 -6
- package/lib/sync/autosync-repeat.d.ts +27 -0
- package/lib/sync/autosync-repeat.js +23 -0
- package/lib/sync/autosync-scheduler.d.ts +47 -2
- package/lib/sync/autosync-scheduler.js +217 -53
- package/lib/sync/baseline-heal.js +7 -0
- package/lib/sync/baseline-record.d.ts +67 -0
- package/lib/sync/baseline-record.js +74 -0
- package/lib/sync/blob-store.js +13 -0
- package/lib/sync/content-diff.d.ts +39 -0
- package/lib/sync/content-diff.js +46 -0
- package/lib/sync/git/git-transport.d.ts +32 -1
- package/lib/sync/git/git-transport.js +146 -26
- package/lib/sync/github-auth.d.ts +17 -1
- package/lib/sync/github-auth.js +37 -1
- package/lib/sync/local-changes.d.ts +15 -0
- package/lib/sync/local-changes.js +39 -0
- package/lib/sync/merge-apply-plan.d.ts +38 -0
- package/lib/sync/merge-apply-plan.js +76 -0
- package/lib/sync/merge-keyed.d.ts +68 -0
- package/lib/sync/merge-keyed.js +124 -0
- package/lib/sync/messages.d.ts +1 -0
- package/lib/sync/messages.js +2 -0
- package/lib/sync/patch-line-identity.d.ts +19 -0
- package/lib/sync/patch-line-identity.js +99 -0
- package/lib/sync/pending-merge.d.ts +41 -0
- package/lib/sync/pending-merge.js +61 -0
- package/lib/sync/plugin-removals.d.ts +15 -15
- package/lib/sync/plugin-removals.js +134 -83
- package/lib/sync/push-skip.d.ts +55 -0
- package/lib/sync/push-skip.js +70 -0
- package/lib/sync/s3/s3-transport.d.ts +14 -2
- package/lib/sync/s3/s3-transport.js +72 -48
- package/lib/sync/sync-engine.d.ts +44 -51
- package/lib/sync/sync-engine.js +160 -194
- package/lib/sync/sync-history.d.ts +7 -0
- package/lib/sync/sync-state.d.ts +28 -0
- package/lib/sync/sync-state.js +20 -0
- package/lib/sync/transport.d.ts +12 -3
- package/lib/sync/transport.js +13 -4
- package/lib/sync/webdav/webdav-transport.d.ts +19 -2
- package/lib/sync/webdav/webdav-transport.js +81 -40
- package/lib/sync/workspace-merge.d.ts +8 -2
- package/lib/ui/artifact-view.d.ts +1 -1
- package/lib/ui/commands.js +5 -11
- package/lib/ui/dsh-profiles-view.d.ts +8 -3
- package/lib/ui/dsh-profiles-view.js +9 -5
- package/lib/ui/foreign-view.d.ts +14 -0
- package/lib/ui/foreign-view.js +34 -0
- package/lib/ui/i18n.d.ts +7 -1
- package/lib/ui/i18n.js +15 -2
- package/lib/ui/menu-placement.js +1 -1
- package/lib/ui/migration-consult-view.d.ts +11 -0
- package/lib/ui/migration-consult-view.js +15 -0
- package/lib/ui/overview-view.d.ts +7 -0
- package/lib/ui/overview-view.js +3 -0
- package/lib/ui/report.d.ts +9 -0
- package/lib/ui/report.js +17 -4
- package/lib/ui/selection-model.d.ts +10 -2
- package/lib/ui/selection-model.js +23 -3
- package/lib/utils/async-once.d.ts +11 -0
- package/lib/utils/async-once.js +15 -0
- package/lib/utils/patch-chain-read.d.ts +51 -0
- package/lib/utils/patch-chain-read.js +240 -0
- package/lib/utils/patch-yaml.d.ts +39 -1
- package/lib/utils/patch-yaml.js +82 -2
- package/lib/utils/paths.d.ts +13 -0
- package/lib/utils/paths.js +35 -0
- package/lib/utils/workdir-lock.js +18 -3
- package/package.json +3 -2
- package/src/adapters/mcp.test.ts +29 -0
- package/src/adapters/mcp.ts +52 -14
- package/src/adapters/messages.ts +2 -0
- package/src/adapters/patch-key-guard.ts +29 -0
- package/src/adapters/plugin-data.test.ts +126 -0
- package/src/adapters/plugin-data.ts +97 -26
- package/src/adapters/plugins.test.ts +403 -0
- package/src/adapters/plugins.ts +198 -8
- package/src/adapters/prompts.ts +15 -4
- package/src/adapters/test-helpers.ts +15 -1
- package/src/cli/actions.test.ts +74 -1
- package/src/cli/actions.ts +27 -246
- package/src/cli/control-state.ts +143 -0
- package/src/cli/help.ts +21 -14
- package/src/cli/index.ts +123 -107
- package/src/cli/sessions-repair.ts +55 -22
- package/src/cli/web/client-script.ts +71 -5
- package/src/cli/web/page.ts +327 -208
- package/src/cli/web/routes.ts +85 -25
- package/src/cli/web/web.test.ts +65 -0
- package/src/cli/write-gates.ts +149 -0
- package/src/client/ConfigManagerSection.tsx +8 -4
- package/src/client/about/AboutPanel.tsx +9 -12
- package/src/client/about/release-notes-view.test.ts +17 -0
- package/src/client/about/release-notes-view.ts +49 -24
- package/src/client/api.ts +2 -1
- package/src/client/chat/ChatEntryView.tsx +2 -2
- package/src/client/chat/rollback-entry-view.ts +6 -1
- package/src/client/common/CommandPalette.tsx +6 -3
- package/src/client/common/ConfirmDialog.tsx +29 -12
- package/src/client/common/ContentPicker.tsx +24 -24
- package/src/client/common/Modal.tsx +12 -5
- package/src/client/common/MoreMenu.tsx +4 -1
- package/src/client/common/RunsCenter.tsx +103 -32
- package/src/client/common/Select.tsx +2 -2
- package/src/client/common/floating-bounds.ts +1 -1
- package/src/client/common/floating-units.test.ts +1 -2
- package/src/client/common/plan-text-redaction.test.ts +190 -5
- package/src/client/common/runs-center-guard.test.ts +60 -0
- package/src/client/common/runs-center-view.test.ts +128 -0
- package/src/client/common/runs-center-view.ts +96 -0
- package/src/client/common/section-title-action.test.ts +66 -0
- package/src/client/common/ui.tsx +93 -30
- package/src/client/config-manager.module.css +1515 -270
- package/src/client/consult/ConsultCard.tsx +7 -6
- package/src/client/environment/EnvironmentPanel.tsx +22 -25
- package/src/client/environment/maintenance/DiskUsageCard.tsx +69 -96
- package/src/client/environment/profiles-incomplete-ui.test.ts +8 -8
- package/src/client/export/ExportView.tsx +7 -16
- package/src/client/history/HistoryPanel.tsx +88 -28
- package/src/client/history/history-locales.ts +3 -3
- package/src/client/home/BackupScheduleCard.tsx +77 -69
- package/src/client/home/HomePanel.tsx +47 -12
- package/src/client/import/ConflictList.tsx +13 -13
- package/src/client/import/ForeignImportView.tsx +67 -9
- package/src/client/import/ImportWizardView.tsx +4 -4
- package/src/client/import/PathMappingForm.tsx +36 -9
- package/src/client/import/PathPickerDialog.tsx +2 -1
- package/src/client/import/import-wizard-split.test.ts +1 -1
- package/src/client/import/import-wizard-steps.tsx +51 -39
- package/src/client/import/use-import-wizard-controller.test.ts +129 -0
- package/src/client/import/use-import-wizard-controller.ts +116 -22
- package/src/client/library/ArtifactRow.tsx +2 -2
- package/src/client/library/BackupInspectView.tsx +21 -15
- package/src/client/library/LibraryActions.tsx +116 -28
- package/src/client/library/LibraryPanel.tsx +14 -15
- package/src/client/library/RestorePlanView.tsx +13 -8
- package/src/client/locales/about.ts +0 -2
- package/src/client/locales/backup.ts +15 -12
- package/src/client/locales/common.ts +2 -0
- package/src/client/locales/export.ts +5 -12
- package/src/client/locales/foreign.ts +4 -2
- package/src/client/locales/import.ts +5 -2
- package/src/client/locales/overview.ts +4 -0
- package/src/client/locales/profiles.ts +32 -4
- package/src/client/locales/restore.ts +2 -2
- package/src/client/locales/sessions.ts +0 -2
- package/src/client/locales/shell.ts +2 -2
- package/src/client/market/MarketImportReview.tsx +4 -4
- package/src/client/market/MarketPanel.tsx +58 -56
- package/src/client/market/MyConfigsList.tsx +34 -32
- package/src/client/market/MyConfigsLoginCard.tsx +12 -15
- package/src/client/market/MyConfigsView.tsx +8 -15
- package/src/client/market/MyConfigsWizard.tsx +7 -12
- package/src/client/market/market-locales.ts +0 -6
- package/src/client/market/my-configs-split.test.ts +2 -1
- package/src/client/nav-menu-clip-guard.test.ts +52 -0
- package/src/client/recovery/IncompleteCopiesSection.tsx +1 -3
- package/src/client/recovery/RecoveryPanel.tsx +35 -22
- package/src/client/recovery/RollbackCard.tsx +132 -75
- package/src/client/recovery/RollbackFileChanges.tsx +40 -27
- package/src/client/recovery/SessionHealthCard.tsx +2 -2
- package/src/client/recovery/SessionHealthDialog.tsx +5 -7
- package/src/client/recovery/SessionLayoutSection.tsx +3 -5
- package/src/client/recovery/recovery-locales.ts +12 -8
- package/src/client/recovery/rollback-enabled.ts +29 -0
- package/src/client/recovery/use-recovery-write.ts +5 -0
- package/src/client/run-store.test.ts +30 -0
- package/src/client/run-store.ts +21 -1
- package/src/client/sync/AddChannelCard.tsx +65 -0
- package/src/client/sync/AutosyncCard.tsx +184 -108
- package/src/client/sync/ChannelClearConfirmDialog.tsx +5 -1
- package/src/client/sync/ChannelConfigDialog.tsx +27 -48
- package/src/client/sync/MergePreviewView.tsx +5 -7
- package/src/client/sync/PushPreviewCard.tsx +2 -1
- package/src/client/sync/PushReportSections.tsx +35 -0
- package/src/client/sync/SyncChannelEntryCard.tsx +33 -24
- package/src/client/sync/SyncConfirmView.tsx +130 -133
- package/src/client/sync/SyncLogList.tsx +29 -14
- package/src/client/sync/SyncPanel.tsx +188 -185
- package/src/client/sync/SyncProbeRow.tsx +5 -7
- package/src/client/sync/SyncRepositoryPicker.tsx +17 -4
- package/src/client/sync/SyncSecuritySection.tsx +157 -0
- package/src/client/sync/SyncSettingsDialog.tsx +293 -0
- package/src/client/sync/SyncSettingsView.test.ts +26 -8
- package/src/client/sync/WorkDirCard.tsx +2 -4
- package/src/client/sync/config-clear-guard.test.ts +94 -0
- package/src/client/sync/config-clear-guard.ts +98 -0
- package/src/client/sync/config-dirty.test.ts +91 -0
- package/src/client/sync/config-dirty.ts +88 -0
- package/src/client/sync/history-model.test.ts +2 -0
- package/src/client/sync/history-model.ts +5 -0
- package/src/client/sync/merge-request.ts +20 -0
- package/src/client/sync/sync-api.ts +13 -1
- package/src/client/sync/sync-locales.ts +95 -47
- package/src/client/sync/sync-panel-clear.test.ts +44 -0
- package/src/client/sync/sync-push-preview.test.ts +9 -0
- package/src/client/sync/sync-view.test.ts +20 -0
- package/src/client/sync/sync-view.ts +76 -4
- package/src/core/backup.test.ts +61 -1
- package/src/core/backup.ts +21 -4
- package/src/core/boot-rescue.test.ts +35 -0
- package/src/core/boot-rescue.ts +13 -2
- package/src/core/boot-safety.test.ts +25 -0
- package/src/core/boot-safety.ts +37 -2
- package/src/core/conflict-decisions.ts +2 -1
- package/src/core/exporter.ts +21 -1
- package/src/core/journal.test.ts +183 -0
- package/src/core/journal.ts +163 -25
- package/src/core/local-plugin-host.test.ts +68 -2
- package/src/core/local-plugin-host.ts +31 -4
- package/src/core/messages.ts +34 -0
- package/src/core/migration-history.test.ts +27 -0
- package/src/core/migration-history.ts +12 -4
- package/src/core/model-tools.test.ts +67 -0
- package/src/core/model-tools.ts +22 -4
- package/src/core/patch-chain.test.ts +83 -0
- package/src/core/patch-chain.ts +150 -0
- package/src/core/patch-document.test.ts +48 -1
- package/src/core/patch-document.ts +66 -15
- package/src/core/patch-layers.test.ts +1 -1
- package/src/core/patch-secret-guard.test.ts +110 -0
- package/src/core/patch-secret-guard.ts +176 -0
- package/src/core/reconcile.ts +32 -4
- package/src/core/reinstall.ts +8 -2
- package/src/core/restore.ts +32 -7
- package/src/core/section-sanitize.ts +37 -0
- package/src/core/smoke.test.ts +2 -1
- package/src/core/snapshot-diff.test.ts +73 -1
- package/src/core/snapshot-diff.ts +66 -21
- package/src/core/startup-barrier.test.ts +64 -0
- package/src/core/startup-barrier.ts +8 -2
- package/src/core/types.ts +43 -2
- package/src/core/update-check.test.ts +40 -0
- package/src/core/update-check.ts +53 -2
- package/src/foreign/claude-code.test.ts +5 -0
- package/src/foreign/claude-plugins.test.ts +57 -0
- package/src/foreign/claude-sessions-bytes.test.ts +7 -1
- package/src/foreign/dsh.test.ts +23 -0
- package/src/foreign/kernel.ts +9 -2
- package/src/foreign/read-claude-plugins.ts +32 -11
- package/src/foreign/read-dsh.ts +33 -2
- package/src/foreign/session-ir.test.ts +67 -0
- package/src/foreign/session-ir.ts +54 -14
- package/src/foreign/session-read.ts +23 -0
- package/src/index.facade.test.ts +186 -6
- package/src/index.ts +53 -47
- package/src/profiles/dsh-profile-copy-rollback.test.ts +58 -4
- package/src/profiles/dsh-profile-io.ts +29 -0
- package/src/profiles/dsh-profile-manager.test.ts +30 -0
- package/src/profiles/dsh-profile-manager.ts +53 -5
- package/src/profiles/dsh-profile-runtime.test.ts +29 -7
- package/src/profiles/dsh-profile-runtime.ts +17 -3
- package/src/profiles/process-control.test.ts +97 -0
- package/src/profiles/process-control.ts +28 -1
- package/src/routes/profiles.ts +2 -1
- package/src/routes/sync.ts +19 -1
- package/src/schema/types.ts +16 -1
- package/src/security/redaction.test.ts +31 -0
- package/src/security/redaction.ts +23 -6
- package/src/security/security.test.ts +1 -1
- package/src/sync/autosync-repeat.test.ts +58 -0
- package/src/sync/autosync-repeat.ts +55 -0
- package/src/sync/autosync-scheduler.test.ts +515 -0
- package/src/sync/autosync-scheduler.ts +225 -51
- package/src/sync/baseline-heal.ts +6 -0
- package/src/sync/baseline-record.ts +135 -0
- package/src/sync/blob-store.test.ts +16 -0
- package/src/sync/blob-store.ts +13 -0
- package/src/sync/content-diff.test.ts +95 -0
- package/src/sync/content-diff.ts +79 -0
- package/src/sync/git/git-transport.test.ts +151 -4
- package/src/sync/git/git-transport.ts +143 -27
- package/src/sync/github-auth.test.ts +26 -1
- package/src/sync/github-auth.ts +37 -1
- package/src/sync/local-changes.ts +40 -0
- package/src/sync/merge-apply-plan.ts +117 -0
- package/src/sync/merge-keyed.test.ts +167 -0
- package/src/sync/merge-keyed.ts +160 -0
- package/src/sync/messages.ts +3 -0
- package/src/sync/patch-line-identity.test.ts +73 -0
- package/src/sync/patch-line-identity.ts +105 -0
- package/src/sync/pending-merge.test.ts +41 -0
- package/src/sync/pending-merge.ts +85 -0
- package/src/sync/plugin-removals.test.ts +199 -39
- package/src/sync/plugin-removals.ts +150 -64
- package/src/sync/push-skip.test.ts +326 -0
- package/src/sync/push-skip.ts +102 -0
- package/src/sync/s3/s3-delete-and-blob-index.test.ts +249 -0
- package/src/sync/s3/s3-transport.ts +76 -42
- package/src/sync/sync-config.test.ts +39 -12
- package/src/sync/sync-device-identity.test.ts +3 -0
- package/src/sync/sync-engine.test.ts +465 -12
- package/src/sync/sync-engine.ts +189 -193
- package/src/sync/sync-history.ts +7 -0
- package/src/sync/sync-state.ts +48 -0
- package/src/sync/transport.test.ts +13 -1
- package/src/sync/transport.ts +12 -4
- package/src/sync/webdav/webdav-delete-and-blob-index.test.ts +249 -0
- package/src/sync/webdav/webdav-transport.ts +86 -34
- package/src/sync/workspace-merge.ts +9 -2
- package/src/ui/artifact-view.ts +1 -1
- package/src/ui/commands.test.ts +11 -0
- package/src/ui/commands.ts +5 -14
- package/src/ui/dsh-profiles-view.test.ts +16 -0
- package/src/ui/dsh-profiles-view.ts +11 -5
- package/src/ui/foreign-view.test.ts +49 -0
- package/src/ui/foreign-view.ts +47 -0
- package/src/ui/i18n.ts +15 -2
- package/src/ui/menu-placement.ts +1 -1
- package/src/ui/migration-consult-view.test.ts +20 -1
- package/src/ui/migration-consult-view.ts +17 -0
- package/src/ui/overview-view.ts +10 -0
- package/src/ui/report.test.ts +25 -1
- package/src/ui/report.ts +15 -4
- package/src/ui/selection-model.test.ts +29 -1
- package/src/ui/selection-model.ts +25 -4
- package/src/utils/async-once.ts +14 -0
- package/src/utils/js-yaml4.d.ts +35 -0
- package/src/utils/patch-chain-read.test.ts +171 -0
- package/src/utils/patch-chain-read.ts +259 -0
- package/src/utils/patch-yaml.test.ts +215 -3
- package/src/utils/patch-yaml.ts +98 -2
- package/src/utils/paths.test.ts +14 -1
- package/src/utils/paths.ts +35 -0
- package/src/utils/workdir-lock.test.ts +69 -0
- package/src/utils/workdir-lock.ts +17 -3
- package/lib/ui/path-mapping.d.ts +0 -38
- package/lib/ui/path-mapping.js +0 -75
- package/src/client/common/InfoHint.tsx +0 -289
- package/src/client/common/info-hint-guard.test.ts +0 -1119
- package/src/client/sync/DecryptPasswordCard.tsx +0 -48
- package/src/client/sync/SecurityOptionsCard.tsx +0 -97
- package/src/client/sync/SyncSectionPickerDialog.tsx +0 -213
- package/src/ui/path-mapping.test.ts +0 -67
- package/src/ui/path-mapping.ts +0 -103
package/lib/sync/sync-state.d.ts
CHANGED
|
@@ -17,6 +17,17 @@ export interface SyncSectionState {
|
|
|
17
17
|
hash: string;
|
|
18
18
|
updatedAt: string;
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* 分区 id → 内容哈希(= hashSection 的结果)。
|
|
22
|
+
*
|
|
23
|
+
* 同一个形状服务两种**完全不同**的观测,调用方必须分清(G-44:
|
|
24
|
+
* docs/known-issues/known-gaps.md 的「祖先副本与 state.sections 一参两用」):
|
|
25
|
+
* - `SyncState.sections`:**本机**文件最近一次基线的内容哈希(含本机尚未推送的改动);
|
|
26
|
+
* - `SyncState.lastRemoteSections`:上一次**远端快照实际携带**的分区哈希(远端观测);
|
|
27
|
+
* - 推送前刚导出的本地哈希(content-diff.hashSections)。
|
|
28
|
+
* 内容判定(src/sync/content-diff.ts)只接受后两者,绝不拿 state.sections 冒充远端观测。
|
|
29
|
+
*/
|
|
30
|
+
export type SectionHashes = Partial<Record<SectionId, string>>;
|
|
20
31
|
/**
|
|
21
32
|
* 待裁决的合并状态(基线纪律,2026-10)。
|
|
22
33
|
*
|
|
@@ -80,6 +91,23 @@ export interface SyncState {
|
|
|
80
91
|
* 让冲突在下一轮重新出现(详见 PendingMerge)。
|
|
81
92
|
*/
|
|
82
93
|
pendingMerge?: PendingMerge;
|
|
94
|
+
/**
|
|
95
|
+
* issue #140:上一次**远端快照实际携带**的分区哈希(远端观测,不是本机观测)。
|
|
96
|
+
*
|
|
97
|
+
* 用途:拉取侧判定「远端最新快照的内容是否真的变了」——只比 id 时,任何一次新推送
|
|
98
|
+
* (哪怕分区逐字相同)都会判成「有新生」,白跑 download + 三方合并。
|
|
99
|
+
*
|
|
100
|
+
* 纪律(G-44):
|
|
101
|
+
* - 只许由「真的看到了远端快照 sections」的路径写入(推送成功 / 推送跳过收养 / 收养孤儿头 /
|
|
102
|
+
* 合并应用到某个远端快照之后);
|
|
103
|
+
* - 指针变化但本轮没有远端观测 ⇒ 必须**删除**该字段(未知 ⇒ 调用方回落 id 比较),
|
|
104
|
+
* 绝不保留上一份观测冒充「远端现在也是这样」;
|
|
105
|
+
* - 加密快照的 sections 恒为空(transport.ts)⇒ 该字段保持缺席,判定恒为 unknown。
|
|
106
|
+
*
|
|
107
|
+
* 纯可选字段:**不提升 SYNC_STATE_SCHEMA_VERSION**(旧文件缺它 → 读回形状逐键不变;
|
|
108
|
+
* 旧版本代码读到新文件只是忽略它)。
|
|
109
|
+
*/
|
|
110
|
+
lastRemoteSections?: SectionHashes;
|
|
83
111
|
}
|
|
84
112
|
/**
|
|
85
113
|
* 分区内容 hash:
|
package/lib/sync/sync-state.js
CHANGED
|
@@ -93,6 +93,22 @@ function readPendingMerge(raw) {
|
|
|
93
93
|
return undefined;
|
|
94
94
|
return { remoteSnapshotId: o['remoteSnapshotId'], sections: sections, since: o['since'] };
|
|
95
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* 读取「远端观测」(分区 id → hash)。
|
|
98
|
+
*
|
|
99
|
+
* 形状不符(损坏/被篡改)或为空对象 → undefined:空集合无法证伪任何内容,
|
|
100
|
+
* 按「没有观测」处理(调用方回落到 id 比较),绝不把空对象当成「远端什么都没有」。
|
|
101
|
+
*/
|
|
102
|
+
function readSectionHashes(raw) {
|
|
103
|
+
if (raw === null || typeof raw !== 'object' || Array.isArray(raw))
|
|
104
|
+
return undefined;
|
|
105
|
+
const out = {};
|
|
106
|
+
for (const [sid, value] of Object.entries(raw)) {
|
|
107
|
+
if (typeof value === 'string' && value !== '')
|
|
108
|
+
out[sid] = value;
|
|
109
|
+
}
|
|
110
|
+
return Object.keys(out).length > 0 ? out : undefined;
|
|
111
|
+
}
|
|
96
112
|
/** 读取同步状态;文件不存在 → 返回缺省空状态(从未同步)。
|
|
97
113
|
* 旧版本文件(v1/v2)→ 在内存中迁移到当前版本(见 SYNC_STATE_SUPPORTED_VERSIONS),
|
|
98
114
|
* 不在磁盘上就地升级(首次 saveSyncState 时才写回新版本)。 */
|
|
@@ -148,6 +164,10 @@ export async function loadSyncState(dir, fsx = createSnapshotFs(), msg = zhMsg)
|
|
|
148
164
|
...(typeof obj['deviceName'] === 'string' && obj['deviceName'] !== '' ? { deviceName: obj['deviceName'] } : {}),
|
|
149
165
|
// 基线纪律:同样「写过才回填」—— 缺席 = 无待裁决冲突(旧文件读回形状逐键不变)
|
|
150
166
|
...(readPendingMerge(obj['pendingMerge']) !== undefined ? { pendingMerge: readPendingMerge(obj['pendingMerge']) } : {}),
|
|
167
|
+
// issue #140:远端观测同样「写过才回填」—— 缺席/空 = 未知(判定层回落 id 比较)
|
|
168
|
+
...(readSectionHashes(obj['lastRemoteSections']) !== undefined
|
|
169
|
+
? { lastRemoteSections: readSectionHashes(obj['lastRemoteSections']) }
|
|
170
|
+
: {}),
|
|
151
171
|
};
|
|
152
172
|
const t = obj['transport'];
|
|
153
173
|
if (t !== undefined) {
|
package/lib/sync/transport.d.ts
CHANGED
|
@@ -106,9 +106,18 @@ export interface SyncProbeResult {
|
|
|
106
106
|
/** 本次探测顺带创建的目标目录层级(webdav 首连自建;无则为空数组) */
|
|
107
107
|
createdCollections?: string[];
|
|
108
108
|
}
|
|
109
|
-
/**
|
|
110
|
-
*
|
|
111
|
-
|
|
109
|
+
/**
|
|
110
|
+
* 写出/删除路径的**条件写**失败判定(两条通道共用的唯一实现处):
|
|
111
|
+
* - 412 Precondition Failed 恒算(If-Match / If-None-Match 的语义);
|
|
112
|
+
* - 409 只在**本次确实带了条件写头**时才算 —— S3 兼容端点用 409 表达「对象已存在 / 冲突」,
|
|
113
|
+
* 而 WebDAV 的 409(如 MKCOL 缺父目录)与无条件的 409 另有含义,绝不能吞成并发冲突。
|
|
114
|
+
*
|
|
115
|
+
* 判定通过后仍须按通道报文细分:OSS 的 409 还可能表示 FileImmutable(桶被保护),
|
|
116
|
+
* 那必须如实报错而不是谎称「别的设备改过索引」(见 s3-transport 的 conditionalFailure)。
|
|
117
|
+
*/
|
|
118
|
+
export declare function isPreconditionFailedStatus(status: number, opts?: {
|
|
119
|
+
guarded?: boolean;
|
|
120
|
+
}): boolean;
|
|
112
121
|
export interface SyncTransport {
|
|
113
122
|
readonly type: string;
|
|
114
123
|
/** 列出远端已有快照(按 createdAt 升序) */
|
package/lib/sync/transport.js
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { hashSection } from './sync-state.js';
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
/**
|
|
3
|
+
* 写出/删除路径的**条件写**失败判定(两条通道共用的唯一实现处):
|
|
4
|
+
* - 412 Precondition Failed 恒算(If-Match / If-None-Match 的语义);
|
|
5
|
+
* - 409 只在**本次确实带了条件写头**时才算 —— S3 兼容端点用 409 表达「对象已存在 / 冲突」,
|
|
6
|
+
* 而 WebDAV 的 409(如 MKCOL 缺父目录)与无条件的 409 另有含义,绝不能吞成并发冲突。
|
|
7
|
+
*
|
|
8
|
+
* 判定通过后仍须按通道报文细分:OSS 的 409 还可能表示 FileImmutable(桶被保护),
|
|
9
|
+
* 那必须如实报错而不是谎称「别的设备改过索引」(见 s3-transport 的 conditionalFailure)。
|
|
10
|
+
*/
|
|
11
|
+
export function isPreconditionFailedStatus(status, opts = {}) {
|
|
12
|
+
if (status === 412)
|
|
13
|
+
return true;
|
|
14
|
+
return status === 409 && opts.guarded === true;
|
|
6
15
|
}
|
|
7
16
|
/** 默认可重试分类 = 瞬时网络故障;其余一律不重试(语义不明不冒险)。 */
|
|
8
17
|
const RETRYABLE_KINDS = ['network', 'timeout', 'server'];
|
|
@@ -86,7 +86,10 @@ export declare class WebDavTransport implements SyncTransport {
|
|
|
86
86
|
private blobsIndexUrl;
|
|
87
87
|
/** 幂等创建 blobs 集合(405/301 等「已存在」语义一律视为成功,与 ensureCollection 同口径)。 */
|
|
88
88
|
private ensureBlobsCollection;
|
|
89
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* 把本次新写入的 blob 合并进远端索引(写失败 → 抛错,调用方看到的是上传失败而非静默漏记)。
|
|
91
|
+
* audit-sync sync-P6-4(P3):这里的读失败必须上抛 —— 整体 PUT 会覆盖远端已登记条目。
|
|
92
|
+
*/
|
|
90
93
|
private appendBlobIndex;
|
|
91
94
|
/**
|
|
92
95
|
* 远端是否已存在历史内容(t66)。判据 = **blob 仓索引文件存在**:它是本通道在远端唯一的、
|
|
@@ -99,8 +102,22 @@ export declare class WebDavTransport implements SyncTransport {
|
|
|
99
102
|
* 能力 ⇒ 无法自证),此时仍走读改写路径。C7 的伤害面(blob 被回收)恰由本判据覆盖。
|
|
100
103
|
*/
|
|
101
104
|
private remoteHasPriorContent;
|
|
102
|
-
/** 读取 blob 索引(哈希 → 写入时间 ms
|
|
105
|
+
/** 读取 blob 索引(哈希 → 写入时间 ms);只读失败即抛,绝不回落成空索引,见 readBlobIndexDetailed。 */
|
|
103
106
|
private readBlobIndex;
|
|
107
|
+
/**
|
|
108
|
+
* audit-sync sync-P6-4(P3):读 blob 索引的**带缺失标志**版本 —— 「读失败」与「确实没有索引」必须分开。
|
|
109
|
+
*
|
|
110
|
+
* 旧实现把 5xx / 坏 JSON / 非法结构一律当成空索引返回,紧接着 appendBlobIndex 读→合并→**整体 PUT**,
|
|
111
|
+
* 于是「一次读抖动」= 远端索引被覆盖成本次新增的那几条,已登记条目全丢(GC 从此看不见这些 blob,
|
|
112
|
+
* 等于远端漏账;再叠加 delete 的 GC 就可能删掉它们)。语义因此必须三态:
|
|
113
|
+
* - 404 / 405 / 501 → missing = true:**缺资源**。405/501 是部分 WebDAV 服务端表达「没有这个资源」
|
|
114
|
+
* 的方言(与 remoteHasPriorContent 同口径),此时确实没有索引可丢,按空处理是安全的;
|
|
115
|
+
* - 其它非 2xx(5xx / 403 / …)→ 抛错(可重试):读不出来就**不许**整体覆盖,让上传显式失败;
|
|
116
|
+
* - 200 但坏 JSON / 非对象 → 抛 protocol(不可重试):索引损坏是远端状态问题,覆盖写会抹掉残存记录。
|
|
117
|
+
*
|
|
118
|
+
* 最坏情况(可重试失败):本可跳过的 blob 被重传一遍,或本次 blob 漏登记(只占空间,不误删)。
|
|
119
|
+
*/
|
|
120
|
+
private readBlobIndexDetailed;
|
|
104
121
|
private writeBlobIndex;
|
|
105
122
|
/**
|
|
106
123
|
* blob 仓端口。`index` 是「仓里有哪些 blob」的权威视图(GC 与跳过判定同源):
|
|
@@ -34,7 +34,7 @@ import { GC_SKIP_REFERENCE_MISSING, GC_SKIP_REFERENCE_UNREADABLE, GC_SKIP_SNAPSH
|
|
|
34
34
|
import '../messages.js';
|
|
35
35
|
import { deserializeSnapshot, serializeSnapshot } from '../snapshot-json.js';
|
|
36
36
|
import { BLOB_SECTIONS, gcBlobs, isBlobRefsSection, isFilesSectionLike, referencedBlobHashes, refsToSection, sectionToBlobRefs } from '../blob-store.js';
|
|
37
|
-
import { classifyHttpStatus, classifyNetworkErrorText, computeSnapshotMeta, DEFAULT_SYNC_TIMEOUT_MS, isEncryptedSections, sectionsEqual, SyncTransportError, withSyncRetry, } from '../transport.js';
|
|
37
|
+
import { classifyHttpStatus, classifyNetworkErrorText, computeSnapshotMeta, DEFAULT_SYNC_TIMEOUT_MS, isEncryptedSections, isPreconditionFailedStatus, sectionsEqual, SyncTransportError, withSyncRetry, } from '../transport.js';
|
|
38
38
|
import { parseJsonSafe } from '../../utils/json.js';
|
|
39
39
|
/** 快照 id 安全字符集:字母数字开头,仅 . _ -;防路径穿越与 URL 注入 */
|
|
40
40
|
const SAFE_ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
@@ -337,12 +337,15 @@ export class WebDavTransport {
|
|
|
337
337
|
const merged = idxBefore.filter((m) => m.id !== snapshot.id);
|
|
338
338
|
merged.push(meta);
|
|
339
339
|
merged.sort((a, b) => (a.createdAt < b.createdAt ? -1 : a.createdAt > b.createdAt ? 1 : 0));
|
|
340
|
+
const idxHeaders = conditionalHeaders(idxEtag, indexMissing);
|
|
340
341
|
const putIdx = await this.send('PUT', idxUrl, pwd, {
|
|
341
342
|
body: JSON.stringify(merged),
|
|
342
|
-
headers:
|
|
343
|
+
headers: idxHeaders,
|
|
343
344
|
});
|
|
344
|
-
|
|
345
|
+
// 条件写失败判定与 s3 通道共用 transport.ts 的唯一实现(412 恒算;409 仅在真的带了条件头时算)
|
|
346
|
+
if (isPreconditionFailedStatus(putIdx.status, { guarded: Object.keys(idxHeaders).length > 0 })) {
|
|
345
347
|
throw this.concurrentWrite(idxUrl, putIdx.status);
|
|
348
|
+
}
|
|
346
349
|
if (!putIdx.ok) {
|
|
347
350
|
throw new WebDavTransportError(await this.failText('PUT', idxUrl, putIdx, pwd), classifyHttpStatus(putIdx.status));
|
|
348
351
|
}
|
|
@@ -385,31 +388,47 @@ export class WebDavTransport {
|
|
|
385
388
|
// gcBlobStore 以空引用集回收,删掉仍被现存快照文件引用的会话 blob(不可恢复)。
|
|
386
389
|
// 与 F1 同口径:宁可显式失败,也不制造不可恢复的远端状态。list() 仍保留「404 = 空集合」语义。
|
|
387
390
|
const { entries: idx, missing: indexMissing, etag: idxEtag } = await this.readIndexDetailed(pwd);
|
|
388
|
-
// delete 快照文件:404 = 不存在,视为成功
|
|
389
391
|
const url = this.snapshotUrl(id);
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
392
|
+
if (indexMissing) {
|
|
393
|
+
// audit-sync sync-N1(P0):索引真缺失(404)= **缺信息**而不是「集合为空」。此时「哪些 blob
|
|
394
|
+
// 无人引用」无从证明 —— 一律**不写回 index.json、不触发 blob GC**,其余快照与其引用的 blob
|
|
395
|
+
// 原样保留(宁可留垃圾,不可删在用的)。目标快照文件按用户意图删除(404 视为成功)。
|
|
396
|
+
const res = await this.send('DELETE', url, pwd);
|
|
397
|
+
if (!res.ok && res.status !== 404) {
|
|
398
|
+
throw new WebDavTransportError(await this.failText('DELETE', url, res, pwd), classifyHttpStatus(res.status));
|
|
399
|
+
}
|
|
398
400
|
return;
|
|
399
|
-
|
|
401
|
+
}
|
|
400
402
|
const remaining = idx.filter((m) => m.id !== id);
|
|
401
|
-
|
|
402
|
-
|
|
403
|
+
const entryPresent = remaining.length !== idx.length;
|
|
404
|
+
// audit-sync sync-P6-1(P3):**先写索引、后删对象**。
|
|
405
|
+
// 反序(旧实现先 DELETE 快照文件)的伤害:索引 PUT 回 412(别的设备刚改过索引)时本次删除已
|
|
406
|
+
// 抛错中止,但对象已经没了 ⇒ 索引里留下指向不存在对象的条目;list() 不校验存在性,别的设备
|
|
407
|
+
// pull 到该 id 就是 notfound 硬失败,只能靠用户再删一次自愈。
|
|
408
|
+
// 调整顺序后的**最坏情况**:索引写成功而对象 DELETE 失败 ⇒ 远端留一个索引里不存在、list()
|
|
409
|
+
// 看不到、pull 不会命中的孤儿文件(只占空间);重跑 delete 会把对象补删(404 视为成功)。
|
|
410
|
+
// 「多一个看不见的孤儿文件」远轻于「索引指向已删对象」,因此顺序必须是索引在前。
|
|
411
|
+
if (entryPresent) {
|
|
412
|
+
const idxHeaders = conditionalHeaders(idxEtag, false);
|
|
413
|
+
const putIdx = await this.send('PUT', idxUrl, pwd, {
|
|
414
|
+
body: JSON.stringify(remaining),
|
|
415
|
+
headers: idxHeaders,
|
|
416
|
+
});
|
|
417
|
+
// 判定与 s3 通道共用同一实现(412 恒算;409 仅在真的带了条件头时算)
|
|
418
|
+
if (isPreconditionFailedStatus(putIdx.status, { guarded: Object.keys(idxHeaders).length > 0 })) {
|
|
419
|
+
throw this.concurrentWrite(idxUrl, putIdx.status);
|
|
420
|
+
}
|
|
421
|
+
if (!putIdx.ok) {
|
|
422
|
+
throw new WebDavTransportError(await this.failText('PUT', idxUrl, putIdx, pwd), classifyHttpStatus(putIdx.status));
|
|
423
|
+
}
|
|
403
424
|
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
if (putIdx.status === 412)
|
|
409
|
-
throw this.concurrentWrite(idxUrl, putIdx.status);
|
|
410
|
-
if (!putIdx.ok) {
|
|
411
|
-
throw new WebDavTransportError(await this.failText('PUT', idxUrl, putIdx, pwd), classifyHttpStatus(putIdx.status));
|
|
425
|
+
// 索引已摘除(或本来就无该 id)后才动对象:404 = 不存在,视为成功
|
|
426
|
+
const res = await this.send('DELETE', url, pwd);
|
|
427
|
+
if (!res.ok && res.status !== 404) {
|
|
428
|
+
throw new WebDavTransportError(await this.failText('DELETE', url, res, pwd), classifyHttpStatus(res.status));
|
|
412
429
|
}
|
|
430
|
+
if (!entryPresent && !res.ok)
|
|
431
|
+
return; // 索引无该 id 且对象本就不存在 → 静默成功,无 GC 可做
|
|
413
432
|
// P1-4:快照被裁掉后回收无人引用的 blob(best-effort,失败不影响删除结果)
|
|
414
433
|
await this.gcBlobStore(pwd, remaining).catch(() => undefined);
|
|
415
434
|
}
|
|
@@ -437,7 +456,10 @@ export class WebDavTransport {
|
|
|
437
456
|
throw new WebDavTransportError(await this.failText('MKCOL', url, res, pwd), classifyHttpStatus(res.status));
|
|
438
457
|
}
|
|
439
458
|
}
|
|
440
|
-
/**
|
|
459
|
+
/**
|
|
460
|
+
* 把本次新写入的 blob 合并进远端索引(写失败 → 抛错,调用方看到的是上传失败而非静默漏记)。
|
|
461
|
+
* audit-sync sync-P6-4(P3):这里的读失败必须上抛 —— 整体 PUT 会覆盖远端已登记条目。
|
|
462
|
+
*/
|
|
441
463
|
async appendBlobIndex(fresh, pwd) {
|
|
442
464
|
const index = await this.readBlobIndex(pwd);
|
|
443
465
|
for (const [hash, at] of fresh)
|
|
@@ -480,28 +502,47 @@ export class WebDavTransport {
|
|
|
480
502
|
return true; // 体读不出来 ⇒ 判不了 ⇒ 按有内容
|
|
481
503
|
}
|
|
482
504
|
}
|
|
483
|
-
/** 读取 blob 索引(哈希 → 写入时间 ms
|
|
505
|
+
/** 读取 blob 索引(哈希 → 写入时间 ms);只读失败即抛,绝不回落成空索引,见 readBlobIndexDetailed。 */
|
|
484
506
|
async readBlobIndex(pwd) {
|
|
507
|
+
return (await this.readBlobIndexDetailed(pwd)).index;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* audit-sync sync-P6-4(P3):读 blob 索引的**带缺失标志**版本 —— 「读失败」与「确实没有索引」必须分开。
|
|
511
|
+
*
|
|
512
|
+
* 旧实现把 5xx / 坏 JSON / 非法结构一律当成空索引返回,紧接着 appendBlobIndex 读→合并→**整体 PUT**,
|
|
513
|
+
* 于是「一次读抖动」= 远端索引被覆盖成本次新增的那几条,已登记条目全丢(GC 从此看不见这些 blob,
|
|
514
|
+
* 等于远端漏账;再叠加 delete 的 GC 就可能删掉它们)。语义因此必须三态:
|
|
515
|
+
* - 404 / 405 / 501 → missing = true:**缺资源**。405/501 是部分 WebDAV 服务端表达「没有这个资源」
|
|
516
|
+
* 的方言(与 remoteHasPriorContent 同口径),此时确实没有索引可丢,按空处理是安全的;
|
|
517
|
+
* - 其它非 2xx(5xx / 403 / …)→ 抛错(可重试):读不出来就**不许**整体覆盖,让上传显式失败;
|
|
518
|
+
* - 200 但坏 JSON / 非对象 → 抛 protocol(不可重试):索引损坏是远端状态问题,覆盖写会抹掉残存记录。
|
|
519
|
+
*
|
|
520
|
+
* 最坏情况(可重试失败):本可跳过的 blob 被重传一遍,或本次 blob 漏登记(只占空间,不误删)。
|
|
521
|
+
*/
|
|
522
|
+
async readBlobIndexDetailed(pwd) {
|
|
485
523
|
const url = this.blobsIndexUrl();
|
|
486
524
|
const res = await this.send('GET', url, pwd);
|
|
487
|
-
if (res.status === 404)
|
|
488
|
-
return {};
|
|
489
|
-
if (!res.ok)
|
|
490
|
-
|
|
525
|
+
if (res.status === 404 || res.status === 405 || res.status === 501)
|
|
526
|
+
return { index: {}, missing: true };
|
|
527
|
+
if (!res.ok) {
|
|
528
|
+
throw new WebDavTransportError(await this.failText('GET', url, res, pwd), classifyHttpStatus(res.status));
|
|
529
|
+
}
|
|
530
|
+
let parsed;
|
|
491
531
|
try {
|
|
492
|
-
|
|
493
|
-
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
494
|
-
return {};
|
|
495
|
-
const out = {};
|
|
496
|
-
for (const [hash, at] of Object.entries(parsed)) {
|
|
497
|
-
if (BLOB_HASH_RE.test(hash) && typeof at === 'number' && Number.isFinite(at))
|
|
498
|
-
out[hash] = at;
|
|
499
|
-
}
|
|
500
|
-
return out;
|
|
532
|
+
parsed = parseJsonSafe(await res.text());
|
|
501
533
|
}
|
|
502
|
-
catch {
|
|
503
|
-
|
|
534
|
+
catch (err) {
|
|
535
|
+
throw new WebDavTransportError(this.o.msg('sync.webdav.indexInvalid', { url, err: this.mask(String(err?.message ?? ''), pwd) }), { kind: 'protocol', retryable: false });
|
|
536
|
+
}
|
|
537
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
538
|
+
throw new WebDavTransportError(this.o.msg('sync.webdav.indexInvalid', { url, err: 'not an object' }), { kind: 'protocol', retryable: false });
|
|
539
|
+
}
|
|
540
|
+
const out = {};
|
|
541
|
+
for (const [hash, at] of Object.entries(parsed)) {
|
|
542
|
+
if (BLOB_HASH_RE.test(hash) && typeof at === 'number' && Number.isFinite(at))
|
|
543
|
+
out[hash] = at;
|
|
504
544
|
}
|
|
545
|
+
return { index: out, missing: false };
|
|
505
546
|
}
|
|
506
547
|
async writeBlobIndex(pwd, index) {
|
|
507
548
|
const url = this.blobsIndexUrl();
|
|
@@ -31,11 +31,17 @@ export interface GranularMergeOutcome {
|
|
|
31
31
|
mergePoints: number;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
34
|
+
* 钩子可读的合并上下文(只放「用户开关」与「本进程事实」,不放会让钩子做出猜测的东西)。
|
|
35
|
+
*
|
|
36
|
+
* issue #145 起两者分工固定:
|
|
37
|
+
* - 合并**恒参与**(开关不再决定钩子是否介入,否则 patch 行这类与卸载无关的改动永远合不进去);
|
|
38
|
+
* - `deletePlugins` 只管「远端删了、本机未改的条目要不要真的删掉」;
|
|
39
|
+
* - `selfPluginName` 让 plugins 钩子排除自身(自身条目永不删、不报冲突)。
|
|
36
40
|
*/
|
|
37
41
|
export interface GranularMergeHooks {
|
|
38
42
|
deletePlugins?: boolean;
|
|
43
|
+
/** 本插件的包名(空串 / 缺省 = 不知道,不排除任何条目)。 */
|
|
44
|
+
selfPluginName?: string;
|
|
39
45
|
}
|
|
40
46
|
/** 记录级合并钩子签名(`merge.ts` 按分区 id 调用;返回 undefined = 不参与,走通用路径)。 */
|
|
41
47
|
export type GranularMerger = (local: SectionData, remote: SectionData, ancestor: SectionData | undefined, hooks?: GranularMergeHooks) => GranularMergeOutcome | undefined;
|
|
@@ -43,7 +43,7 @@ export interface ArtifactInput {
|
|
|
43
43
|
/** 远端当前基线(sync-state.lastSnapshotId);命中即标「当前基线」。未知/缺省 = 不标 */
|
|
44
44
|
remoteCurrentId?: string | null;
|
|
45
45
|
/** 远端通道类型(元数据行第 1 段)。未知 = 该段不渲染(不猜成 Git) */
|
|
46
|
-
remoteChannel?: 'git' | 'webdav' | null;
|
|
46
|
+
remoteChannel?: 'git' | 'webdav' | 's3' | 'gist' | null;
|
|
47
47
|
marketItems?: readonly MarketItemInput[];
|
|
48
48
|
}
|
|
49
49
|
export type ArtifactKind = 'snapshot' | 'backup-file' | 'remote-snapshot' | 'market';
|
package/lib/ui/commands.js
CHANGED
|
@@ -11,16 +11,10 @@
|
|
|
11
11
|
* - 命令 id 用英文(`go.overview` / `export.open`),顺带充当英文别名:
|
|
12
12
|
* 中文用户敲「导出」命中标题,英文用户敲 "export" 命中 id。
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* 字面量相邻出现」视为第二处通道枚举声明(历史上一模一样的两份数组漏改过一份,导致某通道
|
|
19
|
-
* 永不排期),只有带 `satisfies` 穷尽标记的客户端镜像才放行。**连注释里都不许把这两个名字
|
|
20
|
-
* 写成相邻的带引号字面量** —— 守卫扫的是文本,不区分代码与注释。
|
|
21
|
-
* 写成搜索关键词也一样要守这条规矩 —— 守卫认的是形状,不是用途。
|
|
22
|
-
*/
|
|
23
|
-
const SYNC_CHANNEL_TERMS = ['git', 'webdav'];
|
|
14
|
+
// 通道搜索词只认**唯一事实源** `SYNC_CHANNELS`(`src/utils/shared-constants.ts`,零依赖,
|
|
15
|
+
// client 侧已有多处运行时 import 先例)。这里绝不再抄一份清单:手写镜像漏过 s3/gist,
|
|
16
|
+
// 结果搜这两个通道名时「同步」一条命令都不出现(审计 P10-1)。通道增删时这里自动跟随。
|
|
17
|
+
import { SYNC_CHANNELS } from '../utils/shared-constants.js';
|
|
24
18
|
/** 命令面板的分组渲染顺序。 */
|
|
25
19
|
export const COMMAND_GROUP_ORDER = ['navigate', 'library', 'action', 'view', 'rescue'];
|
|
26
20
|
/** 默认最多返回多少条(面板限高,再多也看不见)。 */
|
|
@@ -41,7 +35,7 @@ export const COMMANDS = [
|
|
|
41
35
|
// —— 前往:四个一级页面(v3 §3.1;市场不再是页面)——
|
|
42
36
|
{ id: 'go.home', group: 'navigate', titleKey: 'nav.home', keywords: ['home', 'overview', '首页', '总览'] },
|
|
43
37
|
{ id: 'go.library', group: 'navigate', titleKey: 'library.title', keywords: ['library', 'artifact', '产物', '快照'] },
|
|
44
|
-
{ id: 'go.sync', group: 'navigate', titleKey: 'nav.sync', keywords: ['sync', ...
|
|
38
|
+
{ id: 'go.sync', group: 'navigate', titleKey: 'nav.sync', keywords: ['sync', ...SYNC_CHANNELS, '同步'] },
|
|
45
39
|
{
|
|
46
40
|
// 环境 = 档案 + 维护与诊断。文案用导航条上的名字(environment.title),
|
|
47
41
|
// 不用旧的 nav.profiles('档案')—— 面板里找不到「档案」这个页面。
|
|
@@ -73,10 +73,14 @@ export declare function profileInstallCommand(name: string): string;
|
|
|
73
73
|
*/
|
|
74
74
|
export declare function suggestCopyName(name: string, existingNames: readonly string[], maxLength?: number): string;
|
|
75
75
|
/**
|
|
76
|
-
* 复制告警码 → i18n key。目前只有 `depsNotInstalled` 一类(副本没带 node_modules
|
|
77
|
-
*
|
|
76
|
+
* 复制告警码 → i18n key。目前只有 `depsNotInstalled` 一类(副本没带 node_modules 却声明了依赖)。
|
|
77
|
+
*
|
|
78
|
+
* 为什么是 `Record<告警码, 文案键>` 而不是 if + 兜底:原先 if 与兜底 return 同一字面量,
|
|
79
|
+
* 任何新告警码都会被静默显示成「缺 node_modules」的文案,注释里承诺的「新增码编译报错」
|
|
80
|
+
* 并不存在(审计 P10-4)。Record 的键即告警码全集 —— 码增删而映射不跟上就是编译错误。
|
|
78
81
|
*/
|
|
79
|
-
|
|
82
|
+
declare const COPY_WARNING_KEY: Record<DshProfileCopyWarning, 'profiles.duplicate.warn.depsNotInstalled'>;
|
|
83
|
+
export declare function copyWarningKey(warning: DshProfileCopyWarning): (typeof COPY_WARNING_KEY)[DshProfileCopyWarning];
|
|
80
84
|
/** 终端启动命令(非 web 形态没有浏览器界面,只能在终端用它拉起)。 */
|
|
81
85
|
export declare function restartCommand(name: string): string;
|
|
82
86
|
/**
|
|
@@ -173,3 +177,4 @@ export declare function issueLabelKey(issue: DshProfileIssue): 'profiles.issue.m
|
|
|
173
177
|
export declare function formatProfileTime(ms: number | null): string;
|
|
174
178
|
/** 字节数 → 人类可读(B / KB / MB,保留一位小数)。 */
|
|
175
179
|
export declare function formatBytes(bytes: number): string;
|
|
180
|
+
export {};
|
|
@@ -112,13 +112,17 @@ export function suggestCopyName(name, existingNames, maxLength = 64) {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
/**
|
|
115
|
-
* 复制告警码 → i18n key。目前只有 `depsNotInstalled` 一类(副本没带 node_modules
|
|
116
|
-
*
|
|
115
|
+
* 复制告警码 → i18n key。目前只有 `depsNotInstalled` 一类(副本没带 node_modules 却声明了依赖)。
|
|
116
|
+
*
|
|
117
|
+
* 为什么是 `Record<告警码, 文案键>` 而不是 if + 兜底:原先 if 与兜底 return 同一字面量,
|
|
118
|
+
* 任何新告警码都会被静默显示成「缺 node_modules」的文案,注释里承诺的「新增码编译报错」
|
|
119
|
+
* 并不存在(审计 P10-4)。Record 的键即告警码全集 —— 码增删而映射不跟上就是编译错误。
|
|
117
120
|
*/
|
|
121
|
+
const COPY_WARNING_KEY = {
|
|
122
|
+
depsNotInstalled: 'profiles.duplicate.warn.depsNotInstalled',
|
|
123
|
+
};
|
|
118
124
|
export function copyWarningKey(warning) {
|
|
119
|
-
|
|
120
|
-
return 'profiles.duplicate.warn.depsNotInstalled';
|
|
121
|
-
return 'profiles.duplicate.warn.depsNotInstalled';
|
|
125
|
+
return COPY_WARNING_KEY[warning];
|
|
122
126
|
}
|
|
123
127
|
/** 终端启动命令(非 web 形态没有浏览器界面,只能在终端用它拉起)。 */
|
|
124
128
|
export function restartCommand(name) {
|
package/lib/ui/foreign-view.d.ts
CHANGED
|
@@ -183,3 +183,17 @@ export interface ForeignImportFailure {
|
|
|
183
183
|
}
|
|
184
184
|
/** 失败载荷的构造(未知码 → 原样返回 message,绝不猜语义) */
|
|
185
185
|
export declare function foreignImportFailure(err: unknown, t: UiT): ForeignImportFailure;
|
|
186
|
+
/** 产包阶段的跳过项(POST /foreign-import 的 skipped)→ 可渲染行。 */
|
|
187
|
+
export declare function foreignProducedSkips(skipped: readonly ForeignSkip[] | null | undefined, t: UiT): ForeignSkipLine[];
|
|
188
|
+
/** 构造外部转换任务 Prompt 的输入(用于一键复制给 Agent)。 */
|
|
189
|
+
export interface ForeignAgentPromptInput {
|
|
190
|
+
label: string;
|
|
191
|
+
paths: readonly string[];
|
|
192
|
+
skips: readonly ForeignSkipLine[];
|
|
193
|
+
failure?: ForeignImportFailure | null;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* 把「检测路径 + 未自动迁移项 + 可选失败原因」组织成可直接贴进对话的 Agent 转换 Prompt。
|
|
197
|
+
* 既没有 skip 也没有 failure 时返回空串,避免渲染出一个空提示词复制动作。
|
|
198
|
+
*/
|
|
199
|
+
export declare function foreignAgentPrompt(input: ForeignAgentPromptInput, t: UiT): string;
|
package/lib/ui/foreign-view.js
CHANGED
|
@@ -280,4 +280,38 @@ export function foreignImportFailure(err, t) {
|
|
|
280
280
|
const mapped = IMPORT_FAILURE_KEYS[code] ?? (isKnownSkipCode(code) ? FOREIGN_SKIP_KEY[code] : undefined);
|
|
281
281
|
return { code, message, text: mapped === undefined ? message : t(mapped) };
|
|
282
282
|
}
|
|
283
|
+
/* ------------------------------------------------ 产包跳过 & Agent Prompt */
|
|
284
|
+
/** 产包阶段的跳过项(POST /foreign-import 的 skipped)→ 可渲染行。 */
|
|
285
|
+
export function foreignProducedSkips(skipped, t) {
|
|
286
|
+
if (!skipped || skipped.length === 0)
|
|
287
|
+
return [];
|
|
288
|
+
return skipped.map((s) => foreignSkipLine(s, t));
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* 把「检测路径 + 未自动迁移项 + 可选失败原因」组织成可直接贴进对话的 Agent 转换 Prompt。
|
|
292
|
+
* 既没有 skip 也没有 failure 时返回空串,避免渲染出一个空提示词复制动作。
|
|
293
|
+
*/
|
|
294
|
+
export function foreignAgentPrompt(input, t) {
|
|
295
|
+
if (input.skips.length === 0 && (input.failure === undefined || input.failure === null))
|
|
296
|
+
return '';
|
|
297
|
+
const lines = [t('foreign.prompt.header', { source: input.label })];
|
|
298
|
+
if (input.paths.length > 0) {
|
|
299
|
+
lines.push(t('foreign.prompt.paths', { paths: input.paths.join(', ') }));
|
|
300
|
+
}
|
|
301
|
+
if (input.failure !== undefined && input.failure !== null) {
|
|
302
|
+
const reason = input.failure.code !== null
|
|
303
|
+
? `${input.failure.code}: ${input.failure.text}`
|
|
304
|
+
: input.failure.text;
|
|
305
|
+
lines.push(t('foreign.prompt.failure', { reason }));
|
|
306
|
+
}
|
|
307
|
+
if (input.skips.length > 0) {
|
|
308
|
+
lines.push(t('foreign.prompt.skips'));
|
|
309
|
+
for (const s of input.skips) {
|
|
310
|
+
const origin = s.origin !== undefined && s.origin !== '' ? ` (${s.origin})` : '';
|
|
311
|
+
const count = s.count !== undefined && s.count > 1 ? ` ×${String(s.count)}` : '';
|
|
312
|
+
lines.push(`- [${s.code}]${origin}${count} ${s.text}`);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return lines.join('\n');
|
|
316
|
+
}
|
|
283
317
|
//# sourceMappingURL=foreign-view.js.map
|
package/lib/ui/i18n.d.ts
CHANGED
|
@@ -137,7 +137,6 @@ export declare const uiZh: {
|
|
|
137
137
|
readonly 'snapshots.failed': '失败';
|
|
138
138
|
readonly 'snapshots.skipped': '跳过';
|
|
139
139
|
readonly 'snapshots.noActions': '该快照无可恢复动作(或全部跳过)。';
|
|
140
|
-
readonly 'snapshots.selectHint': '选择一个快照预览其恢复计划(只读预览,不会改动任何设置):';
|
|
141
140
|
readonly 'snapshots.reportTitle': '恢复报告';
|
|
142
141
|
readonly 'sync.privateRepoHint': '安全要求:同步仓库必须为私有仓库(public 仓库会公开你的配置内容)。认证 token 仅用于仓库访问,绝不写入同步文件、提交内容或日志。';
|
|
143
142
|
readonly 'sync.kind.create': '新增';
|
|
@@ -166,6 +165,8 @@ export declare const uiZh: {
|
|
|
166
165
|
readonly 'sync.neverSyncedShort': '从未同步';
|
|
167
166
|
readonly 'sync.pushFailed': '推送失败';
|
|
168
167
|
readonly 'sync.pushOk': '推送成功(快照 {id})';
|
|
168
|
+
readonly 'sync.pushSkipped': '内容未变化,已跳过(沿用远端快照 {id})';
|
|
169
|
+
readonly 'sync.pushAllConflicted': '未推送任何分区:还有分区待冲突裁决(远端与基线都未改动)';
|
|
169
170
|
readonly 'sync.conflictUnresolved': '冲突项 {id} 必须先选择解决方式(保留当前 / 使用导入)';
|
|
170
171
|
readonly 'sync.pushPreviewHeadline': '将推送 {total} 个分区({changed} 个有变化)';
|
|
171
172
|
readonly 'sync.pushPreviewEncrypted': '加密快照:载荷将整体加密,各分区相对基线的变化不可比对。';
|
|
@@ -247,6 +248,7 @@ export declare const uiZh: {
|
|
|
247
248
|
readonly 'consult.loading': '正在生成咨询报告…';
|
|
248
249
|
readonly 'diskUsage.title': '磁盘占用';
|
|
249
250
|
readonly 'diskUsage.files': '{count} 个文件';
|
|
251
|
+
readonly 'diskUsage.total': '合计 {size} · {files}';
|
|
250
252
|
readonly 'diskUsage.refresh': '重新体检';
|
|
251
253
|
readonly 'diskUsage.loading': '正在统计磁盘占用…';
|
|
252
254
|
readonly 'diskUsage.unreadable': '未统计';
|
|
@@ -446,6 +448,10 @@ export declare const uiZh: {
|
|
|
446
448
|
readonly 'foreign.lossy.entry-backslash.detail': 'ZIP 条目名里出现在中段的反斜杠不会被拒绝:同一个包在 Windows 目标上会被当作路径分隔符(落成多级目录),在 POSIX 目标上只是一个普通字符。本实现刻意不改这一格式行为;界面无法逐条检查条目名,跨平台导入后请核对这类文件是否落在预期位置。';
|
|
447
449
|
readonly 'foreign.lossy.prompt-persona-reshape.title': 'prompts 的 systemPrompt 形状变化';
|
|
448
450
|
readonly 'foreign.lossy.prompt-persona-reshape.detail': '源里的 systemPrompt 是字符串,导入落盘时写成带 persona 字段的对象:persona 文本无损,字段形状改变。兼容性评分不会为这一条给出原因 —— 它不改变内容,只改变形态。';
|
|
451
|
+
readonly 'foreign.prompt.header': '请帮我将以下 {source} 配置/会话转换为 DSH 可导入的格式:';
|
|
452
|
+
readonly 'foreign.prompt.paths': '检测路径:{paths}';
|
|
453
|
+
readonly 'foreign.prompt.skips': '未自动迁移项:';
|
|
454
|
+
readonly 'foreign.prompt.failure': '失败原因:{reason}';
|
|
449
455
|
readonly 'export.category.settings': 'DSH 全局设置(namespace 分区,redacted)';
|
|
450
456
|
readonly 'export.category.providers': 'LLM Provider / Model / 默认模型 / BaseURL';
|
|
451
457
|
readonly 'export.category.plugins': '已安装插件清单与启用状态(不含二进制)';
|
package/lib/ui/i18n.js
CHANGED
|
@@ -146,7 +146,6 @@ export const uiZh = {
|
|
|
146
146
|
'snapshots.failed': '失败',
|
|
147
147
|
'snapshots.skipped': '跳过',
|
|
148
148
|
'snapshots.noActions': '该快照无可恢复动作(或全部跳过)。',
|
|
149
|
-
'snapshots.selectHint': '选择一个快照预览其恢复计划(只读预览,不会改动任何设置):',
|
|
150
149
|
'snapshots.reportTitle': '恢复报告',
|
|
151
150
|
// 同步区块(sync-view)
|
|
152
151
|
'sync.privateRepoHint': '安全要求:同步仓库必须为私有仓库(public 仓库会公开你的配置内容)。认证 token 仅用于仓库访问,绝不写入同步文件、提交内容或日志。',
|
|
@@ -176,6 +175,8 @@ export const uiZh = {
|
|
|
176
175
|
'sync.neverSyncedShort': '从未同步',
|
|
177
176
|
'sync.pushFailed': '推送失败',
|
|
178
177
|
'sync.pushOk': '推送成功(快照 {id})',
|
|
178
|
+
'sync.pushSkipped': '内容未变化,已跳过(沿用远端快照 {id})',
|
|
179
|
+
'sync.pushAllConflicted': '未推送任何分区:还有分区待冲突裁决(远端与基线都未改动)',
|
|
179
180
|
'sync.conflictUnresolved': '冲突项 {id} 必须先选择解决方式(保留当前 / 使用导入)',
|
|
180
181
|
'sync.pushPreviewHeadline': '将推送 {total} 个分区({changed} 个有变化)',
|
|
181
182
|
'sync.pushPreviewEncrypted': '加密快照:载荷将整体加密,各分区相对基线的变化不可比对。',
|
|
@@ -265,6 +266,7 @@ export const uiZh = {
|
|
|
265
266
|
'consult.loading': '正在生成咨询报告…',
|
|
266
267
|
'diskUsage.title': '磁盘占用',
|
|
267
268
|
'diskUsage.files': '{count} 个文件',
|
|
269
|
+
'diskUsage.total': '合计 {size} · {files}',
|
|
268
270
|
'diskUsage.refresh': '重新体检',
|
|
269
271
|
'diskUsage.loading': '正在统计磁盘占用…',
|
|
270
272
|
'diskUsage.unreadable': '未统计',
|
|
@@ -478,6 +480,11 @@ export const uiZh = {
|
|
|
478
480
|
'foreign.lossy.entry-backslash.detail': 'ZIP 条目名里出现在中段的反斜杠不会被拒绝:同一个包在 Windows 目标上会被当作路径分隔符(落成多级目录),在 POSIX 目标上只是一个普通字符。本实现刻意不改这一格式行为;界面无法逐条检查条目名,跨平台导入后请核对这类文件是否落在预期位置。',
|
|
479
481
|
'foreign.lossy.prompt-persona-reshape.title': 'prompts 的 systemPrompt 形状变化',
|
|
480
482
|
'foreign.lossy.prompt-persona-reshape.detail': '源里的 systemPrompt 是字符串,导入落盘时写成带 persona 字段的对象:persona 文本无损,字段形状改变。兼容性评分不会为这一条给出原因 —— 它不改变内容,只改变形态。',
|
|
483
|
+
// 复制外部转换提示词(competitor-ui-review §5.2 #1)
|
|
484
|
+
'foreign.prompt.header': '请帮我将以下 {source} 配置/会话转换为 DSH 可导入的格式:',
|
|
485
|
+
'foreign.prompt.paths': '检测路径:{paths}',
|
|
486
|
+
'foreign.prompt.skips': '未自动迁移项:',
|
|
487
|
+
'foreign.prompt.failure': '失败原因:{reason}',
|
|
481
488
|
// ---------- 英文界面零中文(t3):静态目录 / 纯逻辑层的文案 ----------
|
|
482
489
|
// 导出分类目录的**描述**:静态目录(ui/export-flow.ts)只留键,渲染层用 t() 解析
|
|
483
490
|
// (见 ExportCategory.descriptionKey)。此前这些中文硬编码在纯逻辑层。
|
|
@@ -644,7 +651,6 @@ export const uiEn = {
|
|
|
644
651
|
'snapshots.failed': 'Failed',
|
|
645
652
|
'snapshots.skipped': 'Skipped',
|
|
646
653
|
'snapshots.noActions': 'No restorable actions for this snapshot (or all skipped).',
|
|
647
|
-
'snapshots.selectHint': 'Select a snapshot to preview its restore plan (read-only preview, changes nothing):',
|
|
648
654
|
'snapshots.reportTitle': 'Restore Report',
|
|
649
655
|
'sync.privateRepoHint': 'Security requirement: the sync repository MUST be private (a public repo would expose your configuration). The auth token is only used for repository access and is never written into sync files, commit content, or logs.',
|
|
650
656
|
'sync.kind.create': 'Create',
|
|
@@ -673,6 +679,8 @@ export const uiEn = {
|
|
|
673
679
|
'sync.neverSyncedShort': 'Never synced',
|
|
674
680
|
'sync.pushFailed': 'Push failed',
|
|
675
681
|
'sync.pushOk': 'Push succeeded (snapshot {id})',
|
|
682
|
+
'sync.pushSkipped': 'No content changes — skipped (reusing remote snapshot {id})',
|
|
683
|
+
'sync.pushAllConflicted': 'Nothing pushed: some sections still await conflict resolution (remote and baseline untouched)',
|
|
676
684
|
'sync.conflictUnresolved': 'Conflict item {id} must be resolved first (keep current / use imported)',
|
|
677
685
|
'sync.pushPreviewHeadline': 'Will push {total} {total, plural, section|sections} ({changed} changed)',
|
|
678
686
|
'sync.pushPreviewEncrypted': 'Encrypted snapshot: the payload is encrypted as a whole; per-section changes vs the baseline cannot be compared.',
|
|
@@ -754,6 +762,7 @@ export const uiEn = {
|
|
|
754
762
|
'consult.loading': 'Generating consultation report…',
|
|
755
763
|
'diskUsage.title': 'Disk Usage',
|
|
756
764
|
'diskUsage.files': '{count} {count, plural, file|files}',
|
|
765
|
+
'diskUsage.total': 'Total {size} · {files}',
|
|
757
766
|
'diskUsage.refresh': 'Re-scan',
|
|
758
767
|
'diskUsage.loading': 'Measuring disk usage…',
|
|
759
768
|
'diskUsage.unreadable': 'not measured',
|
|
@@ -960,6 +969,10 @@ export const uiEn = {
|
|
|
960
969
|
'foreign.lossy.entry-backslash.detail': 'A backslash in the middle of a ZIP entry name is not rejected: the same bundle treats it as a path separator on Windows targets (creating extra directory levels) and as an ordinary character on POSIX targets. This format behaviour is left unchanged on purpose; the UI cannot inspect entry names one by one, so check where such files landed after a cross-platform import.',
|
|
961
970
|
'foreign.lossy.prompt-persona-reshape.title': 'prompts systemPrompt changes shape',
|
|
962
971
|
'foreign.lossy.prompt-persona-reshape.detail': 'A source systemPrompt is a string and is written back as an object with a persona field: the persona text is lossless, the field shape changes. The compatibility score gives no reason for this one because it changes the form, not the content.',
|
|
972
|
+
'foreign.prompt.header': 'Please help me convert the following {source} configuration/sessions into a DSH-importable format:',
|
|
973
|
+
'foreign.prompt.paths': 'Detected paths: {paths}',
|
|
974
|
+
'foreign.prompt.skips': 'Items not migrated automatically:',
|
|
975
|
+
'foreign.prompt.failure': 'Failure reason: {reason}',
|
|
963
976
|
// --- English-UI zero-Chinese (t3): static catalogs / pure logic layer ---
|
|
964
977
|
'export.category.settings': 'Global DSH settings (namespace sections, redacted)',
|
|
965
978
|
'export.category.providers': 'LLM providers / models / default model / base URL',
|
package/lib/ui/menu-placement.js
CHANGED
|
@@ -46,7 +46,7 @@ export function placeMenu(anchor, bounds, menu) {
|
|
|
46
46
|
if (left + menu.width > bounds.right - MENU_EDGE)
|
|
47
47
|
left = anchor.right - menu.width;
|
|
48
48
|
left = clampNumber(left, minLeft, maxLeft);
|
|
49
|
-
// 垂直:下方优先;下方放不下且上方更宽裕 → 向上翻转(与
|
|
49
|
+
// 垂直:下方优先;下方放不下且上方更宽裕 → 向上翻转(与 Select 菜单同一判据)。
|
|
50
50
|
const below = bounds.bottom - anchor.bottom - MENU_GAP - MENU_EDGE;
|
|
51
51
|
const above = anchor.top - bounds.top - MENU_GAP - MENU_EDGE;
|
|
52
52
|
const side = menu.height > below && above > below ? 'top' : 'bottom';
|