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
|
@@ -50,6 +50,41 @@ export const CONSOLE_SCRIPT = `(function () {
|
|
|
50
50
|
node = node.parentNode;
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
|
+
function copyText(text, btn) {
|
|
54
|
+
var done = function () {
|
|
55
|
+
var orig = btn.getAttribute('data-dcm-orig') || btn.textContent || '复制';
|
|
56
|
+
if (!btn.getAttribute('data-dcm-orig')) btn.setAttribute('data-dcm-orig', orig);
|
|
57
|
+
btn.setAttribute('data-copied', '1');
|
|
58
|
+
btn.textContent = '已复制 ✓';
|
|
59
|
+
if (typeof window.setTimeout === 'function') {
|
|
60
|
+
window.setTimeout(function () {
|
|
61
|
+
btn.removeAttribute('data-copied');
|
|
62
|
+
btn.textContent = orig;
|
|
63
|
+
}, 1200);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
if (typeof navigator !== 'undefined' && navigator.clipboard && typeof navigator.clipboard.writeText === 'function') {
|
|
67
|
+
navigator.clipboard.writeText(text).then(done, function () { fallbackCopy(text, done); });
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
fallbackCopy(text, done);
|
|
71
|
+
}
|
|
72
|
+
function fallbackCopy(text, done) {
|
|
73
|
+
try {
|
|
74
|
+
var ta = document.createElement('textarea');
|
|
75
|
+
ta.value = text;
|
|
76
|
+
ta.setAttribute('readonly', '');
|
|
77
|
+
ta.style.position = 'fixed';
|
|
78
|
+
ta.style.opacity = '0';
|
|
79
|
+
document.body.appendChild(ta);
|
|
80
|
+
ta.select();
|
|
81
|
+
document.execCommand('copy');
|
|
82
|
+
document.body.removeChild(ta);
|
|
83
|
+
done();
|
|
84
|
+
} catch (e) {
|
|
85
|
+
// 剪贴板不可用时静默退出,不打断页面交互
|
|
86
|
+
}
|
|
87
|
+
}
|
|
53
88
|
// 离线救急台的**唯一**客户端脚本:只做两件事 —— ① 会话内状态恢复(sessionStorage,dcm: 前缀)
|
|
54
89
|
// ② 把确认表单从 details 升级成原生 dialog 元素。禁用 JS 时两者都不参与,页面回落到纯 HTML。
|
|
55
90
|
var PREFIX = 'dcm:';
|
|
@@ -113,12 +148,30 @@ export const CONSOLE_SCRIPT = `(function () {
|
|
|
113
148
|
}
|
|
114
149
|
function onField(event) {
|
|
115
150
|
var el = event.target;
|
|
151
|
+
if (el && el.required && typeof el.setAttribute === 'function') {
|
|
152
|
+
el.setAttribute('aria-invalid', String(el.value || '').trim() === '' ? 'true' : 'false');
|
|
153
|
+
}
|
|
116
154
|
if (!persistable(el)) return;
|
|
117
155
|
if (el.type === 'checkbox' || el.type === 'radio') writeJson(fieldKey(el), { checked: el.checked === true });
|
|
118
156
|
else writeJson(fieldKey(el), { value: String(el.value) });
|
|
119
157
|
}
|
|
120
158
|
document.addEventListener('change', onField, true);
|
|
121
159
|
document.addEventListener('input', onField, true);
|
|
160
|
+
document.addEventListener('submit', function (event) {
|
|
161
|
+
var form = event.target;
|
|
162
|
+
if (!form || form.tagName !== 'FORM') return;
|
|
163
|
+
form.setAttribute('aria-busy', 'true');
|
|
164
|
+
if (typeof form.querySelector !== 'function') return;
|
|
165
|
+
var btn = form.querySelector('button[type="submit"]');
|
|
166
|
+
if (!btn || btn.disabled) return;
|
|
167
|
+
btn.disabled = true;
|
|
168
|
+
var spin = document.createElement('span');
|
|
169
|
+
spin.className = 'btnSpinner';
|
|
170
|
+
spin.setAttribute('aria-hidden', 'true');
|
|
171
|
+
btn.textContent = '';
|
|
172
|
+
btn.appendChild(spin);
|
|
173
|
+
btn.appendChild(document.createTextNode('执行中…'));
|
|
174
|
+
}, true);
|
|
122
175
|
function detailsState() {
|
|
123
176
|
var list = document.querySelectorAll('details[data-dcm-persist]');
|
|
124
177
|
for (var i = 0; i < list.length; i++) {
|
|
@@ -216,14 +269,27 @@ export const CONSOLE_SCRIPT = `(function () {
|
|
|
216
269
|
for (var i = 0; i < list.length; i++) enhanceOne(list[i]);
|
|
217
270
|
}
|
|
218
271
|
document.addEventListener('click', function (event) {
|
|
272
|
+
var menus = document.querySelectorAll('details[data-dcm-nav-group][open]');
|
|
273
|
+
for (var m = 0; m < menus.length; m++) {
|
|
274
|
+
var menu = menus[m];
|
|
275
|
+
if (typeof menu.contains === 'function' && (!menu.contains(event.target) || (event.target && event.target.tagName === 'A'))) {
|
|
276
|
+
menu.open = false;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
219
279
|
var node = event.target;
|
|
220
280
|
while (node !== null && node !== document) {
|
|
221
|
-
if (typeof node.hasAttribute === 'function'
|
|
222
|
-
if (
|
|
223
|
-
|
|
224
|
-
|
|
281
|
+
if (typeof node.hasAttribute === 'function') {
|
|
282
|
+
if (node.hasAttribute('data-dcm-copy')) {
|
|
283
|
+
copyText(String(node.getAttribute('data-dcm-copy') || ''), node);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if (node.hasAttribute('data-dcm-back')) {
|
|
287
|
+
if (window.history.length > 1) {
|
|
288
|
+
event.preventDefault();
|
|
289
|
+
window.history.back();
|
|
290
|
+
}
|
|
291
|
+
return;
|
|
225
292
|
}
|
|
226
|
-
return;
|
|
227
293
|
}
|
|
228
294
|
node = node.parentNode;
|
|
229
295
|
}
|
package/lib/cli/web/page.d.ts
CHANGED
|
@@ -11,29 +11,23 @@ export interface PageChrome {
|
|
|
11
11
|
}
|
|
12
12
|
export declare function esc(value: string): string;
|
|
13
13
|
/**
|
|
14
|
-
* **只转义、不脱敏**的展示出口:唯一用途是救急台**有意**回传给终端用户的「能力 URL
|
|
15
|
-
* (启动器从子进程日志抓到的带 token 的认证 URL)。
|
|
16
|
-
*
|
|
17
|
-
* 为什么必须与 esc() 分开(cli-F1):esc() 先过安全侧 redact(),而 redact 的 URL_QUERY_RE
|
|
18
|
-
* 会把 `?token=…` 的值抹成 ***REDACTED*** —— 那正是认证 URL 的形态,于是页面给出一条必然
|
|
19
|
-
* 401 的死链(/profiles 的「打开实例」入口 + 启动结果页)。这些 URL 与终端里打印的 bootstrap
|
|
20
|
-
* URL 同一性质:只给拿到会话 cookie 的人,本来就该原样可见。
|
|
21
|
-
* 纪律:**只允许**用于本层自己签发/抓取的能力 URL;其余一切文本仍走 esc()。
|
|
14
|
+
* **只转义、不脱敏**的展示出口:唯一用途是救急台**有意**回传给终端用户的「能力 URL」。
|
|
22
15
|
*/
|
|
23
16
|
export declare function escCapability(value: string): string;
|
|
24
17
|
export declare function formatBytes(bytes: number): string;
|
|
25
18
|
type Cell = string | {
|
|
26
19
|
html: string;
|
|
27
20
|
};
|
|
21
|
+
export type NavGroupId = 'status' | 'rescue' | 'inspect';
|
|
28
22
|
/**
|
|
29
|
-
*
|
|
30
|
-
* 全部由它派生 ——
|
|
31
|
-
* 又漏掉 `/restore` / `/export`)。`/healthz` 是 JSON 自述、不是页面,故不在表内。
|
|
23
|
+
* 救急台的**页面导航表(唯一事实源)**:处境分组导航与 404 / 405 / 错误页的「可用页面」清单
|
|
24
|
+
* 全部由它派生 —— 绝不另建第二份页面清单。
|
|
32
25
|
*/
|
|
33
26
|
export declare const CONSOLE_PAGE_NAV: ReadonlyArray<{
|
|
34
27
|
key: PageChrome['active'];
|
|
35
28
|
href: string;
|
|
36
29
|
label: string;
|
|
30
|
+
groups: readonly NavGroupId[];
|
|
37
31
|
}>;
|
|
38
32
|
/** 「可用页面」提示行(404 / 405 / 错误页共用这一份派生结果,不再各写一份)。 */
|
|
39
33
|
export declare function consolePagesHint(): string;
|
|
@@ -98,18 +92,12 @@ export interface ActionCard {
|
|
|
98
92
|
id: string;
|
|
99
93
|
title: string;
|
|
100
94
|
description: string;
|
|
95
|
+
/** 什么情况下点它(首页建议卡必现一行) */
|
|
96
|
+
when?: string;
|
|
101
97
|
href: string;
|
|
102
98
|
disabled: boolean;
|
|
103
99
|
disabledReason?: string;
|
|
104
100
|
}
|
|
105
|
-
/**
|
|
106
|
-
* 「确认后执行」表单:放宽的是**展示层**,不是提交语义。
|
|
107
|
-
*
|
|
108
|
-
* 服务端直出的是 `<details open>` + 原始 `<form method="post">`(一次性 token、副作用说明、勾选项
|
|
109
|
-
* 全都在表单里):禁用 JS 时它就是今天那份可直接提交的纯 HTML。有 JS 且浏览器支持 showModal 时,
|
|
110
|
-
* 客户端脚本才把 details 升级成原生 `<dialog>` —— 提交仍然 POST 到同一个 action、带同一个 token,
|
|
111
|
-
* token 校验顺序(token → 安全门)在服务端一字未改。客户端校验/弹窗只算 UX,不构成任何边界。
|
|
112
|
-
*/
|
|
113
101
|
export declare function renderConfirmForm(options: {
|
|
114
102
|
action: string;
|
|
115
103
|
token: string;
|
|
@@ -117,6 +105,8 @@ export declare function renderConfirmForm(options: {
|
|
|
117
105
|
consequence: string;
|
|
118
106
|
submitLabel: string;
|
|
119
107
|
danger: boolean;
|
|
108
|
+
/** 列表页同屏多个非危险按钮时,除首个外设 true 退为中性次要样式,保单屏唯一主色 */
|
|
109
|
+
neutral?: boolean;
|
|
120
110
|
checklist?: ReadonlyArray<{
|
|
121
111
|
name: string;
|
|
122
112
|
label: string;
|