@alexpeng/dsh-custom-plugin 0.1.6 → 0.4.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.
@@ -0,0 +1,9 @@
1
+ import { type BackupImportMode, type BackupImportPreview, type CustomPluginBackupV1, type CustomPluginState } from './protocol.ts';
2
+ export declare const BACKUP_FORMAT: "dsh-custom-plugin-backup";
3
+ export declare const BACKUP_VERSION: 1;
4
+ export declare const BACKUP_BODY_LIMIT: number;
5
+ export declare function createBackup(state: CustomPluginState): CustomPluginBackupV1;
6
+ export declare function parseBackup(raw: unknown): CustomPluginBackupV1;
7
+ export declare function backupPreview(current: CustomPluginState, backup: CustomPluginBackupV1): BackupImportPreview;
8
+ export declare function importedState(current: CustomPluginState, backup: CustomPluginBackupV1, mode: BackupImportMode): CustomPluginState;
9
+ export declare function writeRecoveryBackup(path: string, state: CustomPluginState): Promise<string>;
@@ -4,7 +4,7 @@
4
4
  * failures surface as `{ ok: false, error }` instead of throwing.
5
5
  * @module @alexpeng/dsh-custom-plugin/client/api
6
6
  */
7
- import { type CredentialStorage, type CustomPluginConfig, type CustomPluginPublicState, type CustomPluginState, type TimelineItem } from '../protocol.ts';
7
+ import { type BackupImportMode, type BackupImportPreview, type ConversationSearchKind, type ConversationSearchResult, type CredentialStorage, type CustomPluginBackupV1, type CustomPluginConfig, type CustomPluginPublicState, type CustomPluginState, type TimelineItem } from '../protocol.ts';
8
8
  /** State edit the browser sends to the host. */
9
9
  export interface StateEdit {
10
10
  cfg?: Partial<CustomPluginConfig>;
@@ -53,6 +53,27 @@ export declare function apiTimelineGet(sessionId: string): Promise<{
53
53
  ok: false;
54
54
  error?: string;
55
55
  }>;
56
+ export declare function apiBackupExport(): Promise<{
57
+ ok: true;
58
+ data: CustomPluginBackupV1;
59
+ } | {
60
+ ok: false;
61
+ error?: string;
62
+ }>;
63
+ export declare function apiBackupImport(document: unknown, mode: BackupImportMode, dryRun: boolean): Promise<{
64
+ ok: true;
65
+ preview: BackupImportPreview;
66
+ recoveryPath?: string;
67
+ } | {
68
+ ok: false;
69
+ error?: string;
70
+ }>;
71
+ export declare function apiConversationSearch(sessionId: string, query: string, kinds: ConversationSearchKind[], signal?: AbortSignal): Promise<{
72
+ ok: true;
73
+ } & ConversationSearchResult | {
74
+ ok: false;
75
+ error?: string;
76
+ }>;
56
77
  /** Export one session in the given format. */
57
78
  export declare function apiExportRun(sessionId: string, format: string): Promise<{
58
79
  ok: true;
@@ -4,4 +4,4 @@
4
4
  * vx- and must not be scoped by CSS Modules.
5
5
  * @module @alexpeng/dsh-custom-plugin/client/styles
6
6
  */
7
- export declare const STATIC_CSS = "/* dsh-custom-plugin static styles. Every rule is global by design: the UI\n * mounts into product slots and overlays, so class names are prefixed vx-\n * and must not be scoped by CSS Modules. Dynamic rules (body background,\n * aurora gradient, global-glass blur) are managed at runtime by a style\n * element in custom.tsx and do not live here. */\n.vx-root {\n position: fixed;\n inset: 0;\n pointer-events: none;\n z-index: 2147483000;\n font-family: ui-sans-serif, system-ui, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;\n }\n .vx-fx {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n }\n .vx-anchor {\n display: inline-block;\n width: 0;\n height: 1px;\n vertical-align: bottom;\n }\n .vx-turn-actions {\n display: inline-flex;\n gap: 4px;\n margin-left: 10px;\n vertical-align: middle;\n align-items: center;\n }\n .vx-chip {\n pointer-events: auto;\n border: 1px solid rgba(128, 140, 160, .4);\n background: rgba(255, 255, 255, .16);\n color: inherit;\n border-radius: 8px;\n padding: 2px 8px;\n font-size: 11px;\n cursor: pointer;\n backdrop-filter: blur(6px);\n text-decoration: none;\n display: inline-flex;\n align-items: center;\n gap: 3px;\n }\n .vx-chip:hover {\n background: rgba(255, 255, 255, .28);\n }\n .vx-link {\n text-decoration: none;\n }\n .vx-glass {\n border-radius: 16px;\n background: rgba(255, 255, 255, .64);\n -webkit-backdrop-filter: blur(9px) saturate(1.22);\n backdrop-filter: blur(9px) saturate(1.22);\n box-shadow: 0 0 1px 1px rgba(17, 17, 26, .07) inset, 0 1px 2px rgba(17, 17, 26, .05) inset, 0px 4px 16px rgba(17, 17, 26, .05), 0px 8px 24px rgba(17, 17, 26, .05), 0px 16px 56px rgba(17, 17, 26, .05);\n }\n @media (prefers-color-scheme: dark) {\n .vx-glass {\n background: rgba(13, 17, 25, .62);\n color: #eef1f7;\n }\n }\n .vx-liquid .vx-glass {\n background: rgba(255, 255, 255, .06);\n backdrop-filter: url(#vx-lg);\n -webkit-backdrop-filter: url(#vx-lg);\n }\n @media (prefers-color-scheme: dark) {\n .vx-liquid .vx-glass {\n background: rgba(0, 0, 0, .06);\n }\n }\n @supports not (backdrop-filter: url(#vx-lg)) {\n .vx-liquid .vx-glass {\n background: rgba(255, 255, 255, .64);\n backdrop-filter: blur(9px) saturate(1.22);\n -webkit-backdrop-filter: blur(9px) saturate(1.22);\n }\n @media (prefers-color-scheme: dark) {\n .vx-liquid .vx-glass {\n background: rgba(13, 17, 25, .62);\n }\n }\n }\n .vx-liquid .vx-pattern {\n background-image: radial-gradient(rgba(150, 150, 160, .5) 3px, transparent 3px);\n background-size: 24px 24px;\n -webkit-mask-image: radial-gradient(ellipse at top, transparent 20%, black);\n mask-image: radial-gradient(ellipse at top, transparent 20%, black);\n animation: vx-pattern-move 25000ms linear infinite;\n }\n @media (prefers-color-scheme: dark) {\n .vx-liquid .vx-pattern {\n background-image: radial-gradient(rgba(110, 110, 128, .5) 3px, transparent 3px);\n }\n }\n .vx-pattern {\n position: absolute;\n inset: 0;\n pointer-events: none;\n z-index: -1;\n background-image: radial-gradient(rgba(150, 150, 160, .42) 1px, transparent 1px);\n background-size: 24px 24px;\n -webkit-mask-image: radial-gradient(ellipse at center, transparent 30%, black 100%);\n mask-image: radial-gradient(ellipse at center, transparent 30%, black 100%);\n animation: vx-pattern-move 10000ms linear infinite;\n }\n @media (prefers-color-scheme: dark) {\n .vx-pattern {\n background-image: radial-gradient(rgba(100, 100, 116, .5) 1px, transparent 1px);\n }\n }\n @keyframes vx-pattern-move {\n from {\n background-position: 0 0;\n }\n to {\n background-position: 0 24px;\n }\n }\n @keyframes vx-aurora {\n 0% {\n background-position: 0% 50%;\n }\n 50% {\n background-position: 100% 50%;\n }\n 100% {\n background-position: 0% 50%;\n }\n }\n .vx-rail {\n position: absolute;\n width: 12px;\n border-radius: 8px;\n background: rgba(120, 130, 150, .18);\n border: 1px solid rgba(120, 130, 150, .25);\n pointer-events: auto;\n touch-action: none;\n box-sizing: border-box;\n }\n .vx-rail.right {\n right: 4px;\n }\n .vx-rail.left {\n left: 56px;\n }\n /* When the rail is active it substitutes the native scrollbar: the scrollport\n carrying the vx-rail-scroller class (added by the client when it resolves\n the chat scrollport) hides its own bar so only one scroll affordance\n remains. scrollbar-gutter: stable on the shell keeps the layout width. */\n .vx-rail-scroller {\n scrollbar-width: none;\n }\n .vx-rail-scroller::-webkit-scrollbar {\n display: none;\n }\n .vx-thumb {\n position: absolute;\n left: 1px;\n right: 1px;\n border-radius: 8px;\n background: rgba(90, 105, 135, .5);\n border: 1px solid rgba(255, 255, 255, .35);\n box-sizing: border-box;\n }\n .vx-thumb:hover {\n background: rgba(90, 105, 135, .7);\n }\n .vx-dot {\n position: absolute;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background: rgba(70, 85, 110, .92);\n border: 2px solid rgba(255, 255, 255, .92);\n box-shadow: 0 1px 3px rgba(0, 0, 0, .35);\n pointer-events: auto;\n cursor: pointer;\n transition: transform .12s;\n padding: 0;\n }\n .vx-dot:hover {\n transform: translate(-50%, -50%) scale(1.35);\n }\n .vx-dot.star {\n background: #c9a24b;\n border-color: #f3e3bd;\n }\n @media (prefers-color-scheme: dark) {\n .vx-dot {\n background: rgba(205, 215, 230, .95);\n border-color: rgba(28, 34, 46, .9);\n }\n .vx-thumb {\n background: rgba(165, 180, 205, .45);\n }\n }\n .vx-rail-pop {\n position: absolute;\n pointer-events: auto;\n padding: 10px 12px;\n width: 300px;\n font-size: 12px;\n line-height: 1.55;\n z-index: 5;\n }\n /* Class = which side the rail sits on; the card must open toward the page\n content. It is a child of the 12px-wide rail, so right:20px puts it left\n of the rail and left:20px puts it right (20px = rail width + 8px gap). */\n .vx-rail-pop.right {\n right: 20px;\n }\n .vx-rail-pop.left {\n left: 20px;\n }\n .vx-pop-time {\n color: #6d7689;\n font-size: 11px;\n margin-bottom: 4px;\n }\n .vx-pop-text {\n white-space: pre-wrap;\n word-break: break-word;\n max-height: 150px;\n overflow: hidden;\n margin-bottom: 8px;\n }\n .vx-pop-row {\n display: flex;\n gap: 5px;\n flex-wrap: wrap;\n align-items: center;\n }\n .vx-balance-wrap {\n display: inline-flex;\n align-items: center;\n position: relative;\n }\n .vx-balance-text {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 3px 10px;\n border-radius: 8px;\n font-size: 12.5px;\n color: inherit;\n background: rgba(127, 164, 224, .16);\n border: 1px solid rgba(127, 164, 224, .4);\n cursor: default;\n white-space: nowrap;\n }\n .vx-balance-text:hover {\n background: rgba(127, 164, 224, .28);\n }\n .vx-balance-text.vx-balance-pinned {\n background: rgba(127, 164, 224, .36);\n border-color: rgba(127, 164, 224, .8);\n }\n .vx-balance-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n margin-bottom: 8px;\n }\n .vx-balance-today {\n opacity: .75;\n font-size: 11.5px;\n }\n .vx-balance-hover {\n position: absolute;\n top: calc(100% + 8px);\n right: 0;\n z-index: 70;\n width: 360px;\n max-height: 480px;\n overflow: auto;\n padding: 12px;\n color: #20242e;\n font-size: 12px;\n pointer-events: auto;\n }\n @media (prefers-color-scheme: dark) {\n .vx-balance-hover {\n color: #e8ebf2;\n }\n }\n .vx-balance-lines {\n font-size: 13px;\n margin: 6px 0;\n }\n .vx-header-btn {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n padding: 4px 10px;\n border-radius: 8px;\n font-size: 12.5px;\n color: inherit;\n background: rgba(127, 164, 224, .16);\n border: 1px solid rgba(127, 164, 224, .4);\n cursor: pointer;\n white-space: nowrap;\n }\n .vx-header-btn:hover {\n background: rgba(127, 164, 224, .3);\n }\n .vx-quote-btn {\n position: absolute;\n transform: translate(-50%, -100%);\n pointer-events: auto;\n background: rgba(40, 48, 64, .96);\n color: #eef1f7;\n border: 1px solid rgba(255, 255, 255, .25);\n padding: 5px 12px;\n border-radius: 9px;\n font-size: 12px;\n cursor: pointer;\n box-shadow: 0 6px 18px rgba(0, 0, 0, .28);\n display: inline-flex;\n align-items: center;\n gap: 5px;\n }\n .vx-panel {\n position: absolute;\n width: 430px;\n max-width: calc(100vw - 40px);\n height: min(660px, calc(100vh - 110px));\n display: flex;\n flex-direction: column;\n overflow: hidden;\n pointer-events: auto;\n color: #20242e;\n }\n @media (prefers-color-scheme: dark) {\n .vx-panel, .vx-modal, .vx-folders {\n color: #e8ebf2;\n }\n }\n .vx-panel-head {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 10px 14px;\n cursor: move;\n user-select: none;\n border-bottom: 1px solid rgba(150, 160, 180, .25);\n position: relative;\n z-index: 1;\n }\n .vx-panel-title {\n font-weight: 600;\n font-size: 13px;\n }\n .vx-panel-sub {\n font-size: 11px;\n opacity: .62;\n white-space: nowrap;\n }\n .vx-tabs {\n display: flex;\n flex-wrap: wrap;\n gap: 2px;\n padding: 8px 10px 4px;\n border-bottom: 1px solid rgba(150, 160, 180, .2);\n position: relative;\n z-index: 1;\n }\n .vx-tab {\n border: none;\n background: transparent;\n color: inherit;\n opacity: .75;\n font-size: 12px;\n padding: 5px 9px;\n border-radius: 8px;\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n gap: 4px;\n }\n .vx-tab.on {\n opacity: 1;\n background: rgba(255, 255, 255, .28);\n box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);\n }\n .vx-panel-body {\n flex: 1;\n overflow: auto;\n padding: 12px 14px;\n position: relative;\n z-index: 1;\n }\n .vx-col {\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n .vx-row {\n display: flex;\n gap: 8px;\n align-items: center;\n }\n .vx-row.wrap {\n flex-wrap: wrap;\n }\n .vx-flex1 {\n flex: 1;\n }\n .vx-section-title {\n font-weight: 600;\n font-size: 12.5px;\n margin-top: 4px;\n opacity: .9;\n }\n .vx-swatches {\n display: grid;\n grid-template-columns: repeat(5, 1fr);\n gap: 6px;\n }\n .vx-swatch {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 3px;\n border: none;\n background: transparent;\n color: inherit;\n cursor: pointer;\n padding: 0;\n }\n .vx-swatch-box {\n width: 34px;\n height: 26px;\n border-radius: 8px;\n border: 2px solid rgba(120, 130, 150, .4);\n box-sizing: border-box;\n }\n .vx-swatch.on .vx-swatch-box {\n border-color: #7fa4e0;\n box-shadow: 0 0 0 2px rgba(127, 164, 224, .35);\n }\n .vx-swatch:disabled {\n opacity: .35;\n cursor: not-allowed;\n }\n .vx-swatch-label {\n font-size: 10px;\n opacity: .85;\n }\n .vx-btn {\n pointer-events: auto;\n border: 1px solid rgba(128, 140, 160, .4);\n background: rgba(255, 255, 255, .16);\n color: inherit;\n border-radius: 9px;\n padding: 6px 12px;\n font-size: 12px;\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n gap: 5px;\n }\n .vx-btn:hover {\n background: rgba(255, 255, 255, .28);\n }\n .vx-btn.on {\n background: rgba(127, 164, 224, .35);\n border-color: rgba(127, 164, 224, .8);\n }\n .vx-btn:disabled {\n opacity: .5;\n cursor: default;\n }\n .vx-btn-sm {\n padding: 2px 8px;\n font-size: 11px;\n }\n .vx-btn-danger {\n background: rgba(214, 88, 88, .22);\n border-color: rgba(214, 88, 88, .55);\n }\n .vx-btn.big {\n padding: 10px 16px;\n font-size: 13px;\n }\n .vx-input {\n flex: 1;\n min-width: 0;\n border: 1px solid rgba(128, 140, 160, .4);\n background: rgba(255, 255, 255, .16);\n color: inherit;\n border-radius: 9px;\n padding: 6px 10px;\n font-size: 12px;\n }\n .vx-textarea {\n border: 1px solid rgba(128, 140, 160, .4);\n background: rgba(255, 255, 255, .16);\n color: inherit;\n border-radius: 9px;\n padding: 6px 10px;\n font-size: 12px;\n resize: vertical;\n font-family: inherit;\n }\n .vx-toggle-row {\n display: flex;\n gap: 8px;\n align-items: center;\n font-size: 12.5px;\n }\n .vx-muted {\n color: rgba(120, 128, 148, .95);\n font-size: 11.5px;\n }\n .vx-error {\n color: #d85858;\n font-size: 12px;\n }\n .vx-pad {\n padding: 12px;\n }\n .vx-pad-sm {\n padding: 6px 2px;\n }\n .vx-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n max-height: 300px;\n overflow: auto;\n }\n .vx-list-item {\n text-align: left;\n border: none;\n background: rgba(255, 255, 255, .1);\n color: inherit;\n border-radius: 8px;\n padding: 6px 10px;\n font-size: 12px;\n cursor: pointer;\n }\n .vx-list-item:hover {\n background: rgba(255, 255, 255, .22);\n }\n .vx-check-row {\n display: flex;\n gap: 8px;\n align-items: center;\n font-size: 12.5px;\n padding: 4px 2px;\n }\n .vx-check-title {\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .vx-badge {\n background: rgba(127, 164, 224, .3);\n border-radius: 8px;\n padding: 0 6px;\n font-size: 10px;\n }\n .vx-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 11.5px;\n }\n .vx-table th, .vx-table td {\n border: 1px solid rgba(128, 140, 160, .3);\n padding: 4px 6px;\n text-align: right;\n }\n .vx-table th:first-child, .vx-table td:first-child {\n text-align: left;\n }\n .vx-folder {\n display: flex;\n flex-direction: column;\n }\n .vx-folder-head {\n display: flex;\n gap: 5px;\n align-items: center;\n padding: 5px 4px;\n border-radius: 9px;\n cursor: grab;\n }\n .vx-folder-head:hover {\n background: rgba(255, 255, 255, .14);\n }\n .vx-folder-head.drop-inside {\n background: rgba(127, 164, 224, .3);\n outline: 1px dashed rgba(127, 164, 224, .8);\n }\n .vx-folder-head.drop-before {\n box-shadow: 0 -2px 0 0 rgba(127, 164, 224, .9);\n }\n .vx-folder-head.drop-after {\n box-shadow: 0 2px 0 0 rgba(127, 164, 224, .9);\n }\n .vx-folder-name {\n font-size: 12.5px;\n font-weight: 600;\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .vx-folder-body {\n border-left: 1px dashed rgba(128, 140, 160, .35);\n margin-left: 14px;\n padding-left: 6px;\n display: flex;\n flex-direction: column;\n gap: 2px;\n }\n .vx-item-row {\n display: flex;\n gap: 5px;\n align-items: center;\n padding: 3px 4px;\n border-radius: 8px;\n }\n .vx-item-row:hover {\n background: rgba(255, 255, 255, .12);\n }\n .vx-item-name {\n flex: 1;\n text-align: left;\n border: none;\n background: transparent;\n color: inherit;\n font-size: 12px;\n cursor: pointer;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n padding: 0;\n }\n .vx-mini {\n border: none;\n background: transparent;\n color: inherit;\n opacity: .75;\n cursor: pointer;\n padding: 2px;\n border-radius: 6px;\n display: inline-flex;\n align-items: center;\n }\n .vx-mini:hover {\n opacity: 1;\n background: rgba(255, 255, 255, .2);\n }\n .vx-form {\n display: flex;\n flex-direction: column;\n gap: 6px;\n border: 1px dashed rgba(128, 140, 160, .4);\n border-radius: 10px;\n padding: 8px;\n }\n .vx-prompt-card {\n border: 1px solid rgba(128, 140, 160, .3);\n background: rgba(255, 255, 255, .1);\n border-radius: 10px;\n padding: 8px 10px;\n }\n .vx-prompt-title {\n font-weight: 600;\n font-size: 12.5px;\n }\n .vx-prompt-body {\n margin-top: 4px;\n font-size: 11.5px;\n opacity: .85;\n white-space: pre-wrap;\n word-break: break-word;\n max-height: 72px;\n overflow: hidden;\n }\n .vx-modal-mask {\n position: absolute;\n inset: 0;\n pointer-events: auto;\n background: rgba(8, 10, 16, .4);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 60;\n }\n .vx-modal {\n position: relative;\n width: min(760px, 92vw);\n max-height: 82vh;\n overflow: auto;\n padding: 16px;\n color: #20242e;\n pointer-events: auto;\n }\n .vx-pop-head {\n display: flex;\n gap: 8px;\n align-items: center;\n margin-bottom: 8px;\n font-weight: 600;\n font-size: 13px;\n }\n .vx-svgbox {\n overflow: auto;\n background: rgba(12, 14, 20, .6);\n border-radius: 12px;\n padding: 14px;\n }\n .vx-svgbox svg {\n max-width: 100%;\n height: auto;\n }\n .vx-pre {\n white-space: pre-wrap;\n word-break: break-all;\n font-size: 10.5px;\n opacity: .85;\n }\n .vx-toasts {\n position: absolute;\n left: 50%;\n bottom: 26px;\n transform: translateX(-50%);\n display: flex;\n flex-direction: column;\n gap: 8px;\n align-items: center;\n pointer-events: auto;\n z-index: 80;\n }\n .vx-toast {\n display: flex;\n gap: 10px;\n align-items: center;\n color: #f2f4f8;\n background: rgba(26, 32, 44, .92);\n border: 1px solid rgba(255, 255, 255, .12);\n padding: 8px 14px;\n border-radius: 12px;\n font-size: 12.5px;\n box-shadow: 0 10px 30px rgba(0, 0, 0, .3);\n max-width: 560px;\n backdrop-filter: blur(9px);\n -webkit-backdrop-filter: blur(9px);\n }\n @media (prefers-color-scheme: dark) {\n .vx-toast {\n background: rgba(18, 22, 30, .94);\n }\n }\n .vx-foot-btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n border: 1px solid rgba(127, 164, 224, .4);\n background: rgba(127, 164, 224, .14);\n color: inherit;\n cursor: pointer;\n padding: 4px 10px;\n border-radius: 10px;\n margin: 2px;\n }\n .vx-foot-btn:hover {\n background: rgba(127, 164, 224, .3);\n }\n .vx-foot-label {\n font-size: 12px;\n }\n .vx-folders {\n position: fixed;\n left: 12px;\n bottom: 60px;\n width: 272px;\n max-height: min(560px, calc(100vh - 220px));\n display: flex;\n flex-direction: column;\n overflow: hidden;\n pointer-events: auto;\n color: #20242e;\n z-index: 55;\n }\n /* \u5934\u90E8\u884C\uFF08\u56FE\u6807 + \u6807\u9898 + \u6309\u94AE\uFF09\u4E0B\u79FB\u5E76\u62C9\u5F00\u4E0E\u5BB9\u5668\u8FB9\u7F18\u7684\u95F4\u8DDD */\n .vx-folders .vx-pop-head {\n padding: 14px 14px 0;\n }\n .vx-folders-body {\n flex: 1;\n overflow: auto;\n padding: 4px 14px 12px;\n position: relative;\n z-index: 1;\n }\n .vx-prompt-pop {\n position: fixed;\n width: 320px;\n max-height: 420px;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n pointer-events: auto;\n color: #20242e;\n z-index: 65;\n padding: 10px 12px;\n }\n .vx-settings-page {\n display: flex;\n flex-direction: column;\n gap: 14px;\n max-width: 720px;\n }\n .vx-mmd-wrap {\n position: relative;\n margin: 6px 0;\n border: 1px solid rgba(127, 164, 224, .35);\n border-radius: 12px;\n overflow: hidden;\n background: rgba(127, 164, 224, .05);\n }\n .vx-mmd-bar {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 4px 6px;\n border-bottom: 1px solid rgba(127, 164, 224, .25);\n background: rgba(127, 164, 224, .08);\n }\n .vx-mmd-btn {\n border: none;\n background: transparent;\n color: inherit;\n opacity: .65;\n font-size: 12px;\n padding: 3px 10px;\n border-radius: 8px;\n cursor: pointer;\n }\n .vx-mmd-btn:hover {\n opacity: 1;\n background: rgba(127, 164, 224, .18);\n }\n .vx-mmd-btn.active {\n opacity: 1;\n background: rgba(127, 164, 224, .28);\n font-weight: 600;\n }\n .vx-mmd-live {\n margin-left: auto;\n font-size: 11px;\n opacity: .6;\n color: inherit;\n text-decoration: none;\n padding: 3px 8px;\n }\n .vx-mmd-live:hover {\n opacity: 1;\n }\n .vx-mmd-stage {\n padding: 16px 12px;\n overflow-x: auto;\n text-align: center;\n }\n .vx-mmd-stage svg {\n max-width: 100%;\n height: auto;\n }\n\n /* DSH can select a theme independently of the operating system. The root\n classes are applied from the resolved GUI theme and intentionally win\n over the media-query fallback above. */\n .vx-root.vx-dark .vx-glass {\n background: rgba(13, 17, 25, .62);\n color: #eef1f7;\n }\n .vx-root.vx-dark .vx-liquid .vx-glass {\n background: rgba(0, 0, 0, .06);\n }\n .vx-root.vx-dark .vx-liquid .vx-pattern {\n background-image: radial-gradient(rgba(110, 110, 128, .5) 3px, transparent 3px);\n }\n .vx-root.vx-dark .vx-pattern {\n background-image: radial-gradient(rgba(100, 100, 116, .5) 1px, transparent 1px);\n }\n .vx-root.vx-dark .vx-dot {\n background: rgba(205, 215, 230, .95);\n border-color: rgba(28, 34, 46, .9);\n }\n .vx-root.vx-dark .vx-thumb {\n background: rgba(165, 180, 205, .45);\n }\n .vx-root.vx-dark .vx-balance-hover,\n .vx-root.vx-dark .vx-panel,\n .vx-root.vx-dark .vx-modal,\n .vx-root.vx-dark .vx-folders {\n color: #e8ebf2;\n }\n .vx-root.vx-dark .vx-toast {\n background: rgba(18, 22, 30, .94);\n }\n\n .vx-root.vx-light .vx-glass {\n background: rgba(255, 255, 255, .64);\n color: #20242e;\n }\n .vx-root.vx-light .vx-liquid .vx-glass {\n background: rgba(255, 255, 255, .06);\n }\n .vx-root.vx-light .vx-liquid .vx-pattern {\n background-image: radial-gradient(rgba(150, 150, 160, .5) 3px, transparent 3px);\n }\n .vx-root.vx-light .vx-pattern {\n background-image: radial-gradient(rgba(150, 150, 160, .42) 1px, transparent 1px);\n }\n .vx-root.vx-light .vx-dot {\n background: rgba(70, 85, 110, .92);\n border-color: rgba(255, 255, 255, .92);\n }\n .vx-root.vx-light .vx-thumb {\n background: rgba(90, 105, 135, .5);\n }\n .vx-root.vx-light .vx-balance-hover,\n .vx-root.vx-light .vx-panel,\n .vx-root.vx-light .vx-modal,\n .vx-root.vx-light .vx-folders {\n color: #20242e;\n }\n .vx-root.vx-light .vx-toast {\n background: rgba(26, 32, 44, .92);\n }\n}";
7
+ export declare const STATIC_CSS = "/* dsh-custom-plugin static styles. Every rule is global by design: the UI\n * mounts into product slots and overlays, so class names are prefixed vx-\n * and must not be scoped by CSS Modules. Dynamic rules (body background,\n * aurora gradient, global-glass blur) are managed at runtime by a style\n * element in custom.tsx and do not live here. */\n.vx-root {\n position: fixed;\n inset: 0;\n pointer-events: none;\n z-index: 2147483000;\n font-family: ui-sans-serif, system-ui, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;\n }\n .vx-fx {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n }\n .vx-anchor {\n display: inline-block;\n width: 0;\n height: 1px;\n vertical-align: bottom;\n }\n .vx-turn-actions {\n display: inline-flex;\n gap: 4px;\n margin-left: 10px;\n vertical-align: middle;\n align-items: center;\n }\n .vx-chip {\n pointer-events: auto;\n border: 1px solid rgba(128, 140, 160, .4);\n background: rgba(255, 255, 255, .16);\n color: inherit;\n border-radius: 8px;\n padding: 2px 8px;\n font-size: 11px;\n cursor: pointer;\n backdrop-filter: blur(6px);\n text-decoration: none;\n display: inline-flex;\n align-items: center;\n gap: 3px;\n }\n .vx-chip:hover {\n background: rgba(255, 255, 255, .28);\n }\n .vx-link {\n text-decoration: none;\n }\n .vx-glass {\n border-radius: 16px;\n background: rgba(255, 255, 255, .64);\n -webkit-backdrop-filter: blur(9px) saturate(1.22);\n backdrop-filter: blur(9px) saturate(1.22);\n box-shadow: 0 0 1px 1px rgba(17, 17, 26, .07) inset, 0 1px 2px rgba(17, 17, 26, .05) inset, 0px 4px 16px rgba(17, 17, 26, .05), 0px 8px 24px rgba(17, 17, 26, .05), 0px 16px 56px rgba(17, 17, 26, .05);\n }\n @media (prefers-color-scheme: dark) {\n .vx-glass {\n background: rgba(13, 17, 25, .62);\n color: #eef1f7;\n }\n }\n .vx-liquid .vx-glass {\n background: rgba(255, 255, 255, .06);\n backdrop-filter: url(#vx-lg);\n -webkit-backdrop-filter: url(#vx-lg);\n }\n @media (prefers-color-scheme: dark) {\n .vx-liquid .vx-glass {\n background: rgba(0, 0, 0, .06);\n }\n }\n @supports not (backdrop-filter: url(#vx-lg)) {\n .vx-liquid .vx-glass {\n background: rgba(255, 255, 255, .64);\n backdrop-filter: blur(9px) saturate(1.22);\n -webkit-backdrop-filter: blur(9px) saturate(1.22);\n }\n @media (prefers-color-scheme: dark) {\n .vx-liquid .vx-glass {\n background: rgba(13, 17, 25, .62);\n }\n }\n }\n .vx-liquid .vx-pattern {\n background-image: radial-gradient(rgba(150, 150, 160, .5) 3px, transparent 3px);\n background-size: 24px 24px;\n -webkit-mask-image: radial-gradient(ellipse at top, transparent 20%, black);\n mask-image: radial-gradient(ellipse at top, transparent 20%, black);\n animation: vx-pattern-move 25000ms linear infinite;\n }\n @media (prefers-color-scheme: dark) {\n .vx-liquid .vx-pattern {\n background-image: radial-gradient(rgba(110, 110, 128, .5) 3px, transparent 3px);\n }\n }\n .vx-pattern {\n position: absolute;\n inset: 0;\n pointer-events: none;\n z-index: -1;\n background-image: radial-gradient(rgba(150, 150, 160, .42) 1px, transparent 1px);\n background-size: 24px 24px;\n -webkit-mask-image: radial-gradient(ellipse at center, transparent 30%, black 100%);\n mask-image: radial-gradient(ellipse at center, transparent 30%, black 100%);\n animation: vx-pattern-move 10000ms linear infinite;\n }\n @media (prefers-color-scheme: dark) {\n .vx-pattern {\n background-image: radial-gradient(rgba(100, 100, 116, .5) 1px, transparent 1px);\n }\n }\n @keyframes vx-pattern-move {\n from {\n background-position: 0 0;\n }\n to {\n background-position: 0 24px;\n }\n }\n @keyframes vx-aurora {\n 0% {\n background-position: 0% 50%;\n }\n 50% {\n background-position: 100% 50%;\n }\n 100% {\n background-position: 0% 50%;\n }\n }\n .vx-rail {\n position: absolute;\n width: 12px;\n border-radius: 8px;\n background: rgba(120, 130, 150, .18);\n border: 1px solid rgba(120, 130, 150, .25);\n pointer-events: auto;\n touch-action: none;\n box-sizing: border-box;\n }\n .vx-rail.right {\n right: 4px;\n }\n .vx-rail.left {\n left: 56px;\n }\n /* When the rail is active it substitutes the native scrollbar: the scrollport\n carrying the vx-rail-scroller class (added by the client when it resolves\n the chat scrollport) hides its own bar so only one scroll affordance\n remains. scrollbar-gutter: stable on the shell keeps the layout width. */\n .vx-rail-scroller {\n scrollbar-width: none;\n }\n .vx-rail-scroller::-webkit-scrollbar {\n display: none;\n }\n .vx-thumb {\n position: absolute;\n left: 1px;\n right: 1px;\n border-radius: 8px;\n background: rgba(90, 105, 135, .5);\n border: 1px solid rgba(255, 255, 255, .35);\n box-sizing: border-box;\n }\n .vx-thumb:hover {\n background: rgba(90, 105, 135, .7);\n }\n .vx-dot {\n position: absolute;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background: rgba(70, 85, 110, .92);\n border: 2px solid rgba(255, 255, 255, .92);\n box-shadow: 0 1px 3px rgba(0, 0, 0, .35);\n pointer-events: auto;\n cursor: pointer;\n transition: transform .12s;\n padding: 0;\n }\n .vx-dot:hover {\n transform: translate(-50%, -50%) scale(1.35);\n }\n .vx-dot.star {\n background: #c9a24b;\n border-color: #f3e3bd;\n }\n @media (prefers-color-scheme: dark) {\n .vx-dot {\n background: rgba(205, 215, 230, .95);\n border-color: rgba(28, 34, 46, .9);\n }\n .vx-thumb {\n background: rgba(165, 180, 205, .45);\n }\n }\n .vx-rail-pop {\n position: absolute;\n pointer-events: auto;\n padding: 10px 12px;\n width: 300px;\n font-size: 12px;\n line-height: 1.55;\n z-index: 5;\n }\n /* Class = which side the rail sits on; the card must open toward the page\n content. It is a child of the 12px-wide rail, so right:20px puts it left\n of the rail and left:20px puts it right (20px = rail width + 8px gap). */\n .vx-rail-pop.right {\n right: 20px;\n }\n .vx-rail-pop.left {\n left: 20px;\n }\n .vx-pop-time {\n color: #6d7689;\n font-size: 11px;\n margin-bottom: 4px;\n }\n .vx-pop-text {\n white-space: pre-wrap;\n word-break: break-word;\n max-height: 150px;\n overflow: hidden;\n margin-bottom: 8px;\n }\n .vx-pop-row {\n display: flex;\n gap: 5px;\n flex-wrap: wrap;\n align-items: center;\n }\n .vx-balance-wrap {\n display: inline-flex;\n align-items: center;\n position: relative;\n }\n .vx-balance-text {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 3px 10px;\n border-radius: 8px;\n font-size: 12.5px;\n color: inherit;\n background: rgba(127, 164, 224, .16);\n border: 1px solid rgba(127, 164, 224, .4);\n cursor: default;\n white-space: nowrap;\n }\n .vx-balance-text:hover {\n background: rgba(127, 164, 224, .28);\n }\n .vx-balance-text.vx-balance-pinned {\n background: rgba(127, 164, 224, .36);\n border-color: rgba(127, 164, 224, .8);\n }\n .vx-balance-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n margin-bottom: 8px;\n }\n .vx-balance-today {\n opacity: .75;\n font-size: 11.5px;\n }\n .vx-balance-hover {\n position: absolute;\n top: calc(100% + 8px);\n right: 0;\n z-index: 70;\n width: 360px;\n max-height: 480px;\n overflow: auto;\n padding: 12px;\n color: #20242e;\n font-size: 12px;\n pointer-events: auto;\n }\n @media (prefers-color-scheme: dark) {\n .vx-balance-hover {\n color: #e8ebf2;\n }\n }\n .vx-balance-lines {\n font-size: 13px;\n margin: 6px 0;\n }\n .vx-header-btn {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n padding: 4px 10px;\n border-radius: 8px;\n font-size: 12.5px;\n color: inherit;\n background: rgba(127, 164, 224, .16);\n border: 1px solid rgba(127, 164, 224, .4);\n cursor: pointer;\n white-space: nowrap;\n }\n .vx-header-btn:hover {\n background: rgba(127, 164, 224, .3);\n }\n .vx-quote-btn {\n position: absolute;\n transform: translate(-50%, -100%);\n pointer-events: auto;\n background: rgba(40, 48, 64, .96);\n color: #eef1f7;\n border: 1px solid rgba(255, 255, 255, .25);\n padding: 5px 12px;\n border-radius: 9px;\n font-size: 12px;\n cursor: pointer;\n box-shadow: 0 6px 18px rgba(0, 0, 0, .28);\n display: inline-flex;\n align-items: center;\n gap: 5px;\n }\n .vx-panel {\n position: absolute;\n width: 430px;\n max-width: calc(100vw - 40px);\n height: min(660px, calc(100vh - 110px));\n display: flex;\n flex-direction: column;\n overflow: hidden;\n pointer-events: auto;\n color: #20242e;\n }\n @media (prefers-color-scheme: dark) {\n .vx-panel, .vx-modal, .vx-folders {\n color: #e8ebf2;\n }\n }\n .vx-panel-head {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 10px 14px;\n cursor: move;\n user-select: none;\n border-bottom: 1px solid rgba(150, 160, 180, .25);\n position: relative;\n z-index: 1;\n }\n .vx-panel-title {\n font-weight: 600;\n font-size: 13px;\n }\n .vx-panel-sub {\n font-size: 11px;\n opacity: .62;\n white-space: nowrap;\n }\n .vx-tabs {\n display: flex;\n flex-wrap: wrap;\n gap: 2px;\n padding: 8px 10px 4px;\n border-bottom: 1px solid rgba(150, 160, 180, .2);\n position: relative;\n z-index: 1;\n }\n .vx-tab {\n border: none;\n background: transparent;\n color: inherit;\n opacity: .75;\n font-size: 12px;\n padding: 5px 9px;\n border-radius: 8px;\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n gap: 4px;\n }\n .vx-tab.on {\n opacity: 1;\n background: rgba(255, 255, 255, .28);\n box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);\n }\n .vx-panel-body {\n flex: 1;\n overflow: auto;\n padding: 12px 14px;\n position: relative;\n z-index: 1;\n }\n .vx-col {\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n .vx-row {\n display: flex;\n gap: 8px;\n align-items: center;\n }\n .vx-row.wrap {\n flex-wrap: wrap;\n }\n .vx-flex1 {\n flex: 1;\n }\n .vx-section-title {\n font-weight: 600;\n font-size: 12.5px;\n margin-top: 4px;\n opacity: .9;\n }\n .vx-swatches {\n display: grid;\n grid-template-columns: repeat(5, 1fr);\n gap: 6px;\n }\n .vx-swatch {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 3px;\n border: none;\n background: transparent;\n color: inherit;\n cursor: pointer;\n padding: 0;\n }\n .vx-swatch-box {\n width: 34px;\n height: 26px;\n border-radius: 8px;\n border: 2px solid rgba(120, 130, 150, .4);\n box-sizing: border-box;\n }\n .vx-swatch.on .vx-swatch-box {\n border-color: #7fa4e0;\n box-shadow: 0 0 0 2px rgba(127, 164, 224, .35);\n }\n .vx-swatch:disabled {\n opacity: .35;\n cursor: not-allowed;\n }\n .vx-swatch-label {\n font-size: 10px;\n opacity: .85;\n }\n .vx-btn {\n pointer-events: auto;\n border: 1px solid rgba(128, 140, 160, .4);\n background: rgba(255, 255, 255, .16);\n color: inherit;\n border-radius: 9px;\n padding: 6px 12px;\n font-size: 12px;\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n gap: 5px;\n }\n .vx-btn:hover {\n background: rgba(255, 255, 255, .28);\n }\n .vx-btn.on {\n background: rgba(127, 164, 224, .35);\n border-color: rgba(127, 164, 224, .8);\n }\n .vx-btn:disabled {\n opacity: .5;\n cursor: default;\n }\n .vx-btn-sm {\n padding: 2px 8px;\n font-size: 11px;\n }\n .vx-btn-danger {\n background: rgba(214, 88, 88, .22);\n border-color: rgba(214, 88, 88, .55);\n }\n .vx-btn.big {\n padding: 10px 16px;\n font-size: 13px;\n }\n .vx-input {\n flex: 1;\n min-width: 0;\n border: 1px solid rgba(128, 140, 160, .4);\n background: rgba(255, 255, 255, .16);\n color: inherit;\n border-radius: 9px;\n padding: 6px 10px;\n font-size: 12px;\n }\n .vx-textarea {\n border: 1px solid rgba(128, 140, 160, .4);\n background: rgba(255, 255, 255, .16);\n color: inherit;\n border-radius: 9px;\n padding: 6px 10px;\n font-size: 12px;\n resize: vertical;\n font-family: inherit;\n }\n .vx-toggle-row {\n display: flex;\n gap: 8px;\n align-items: center;\n font-size: 12.5px;\n }\n .vx-muted {\n color: rgba(120, 128, 148, .95);\n font-size: 11.5px;\n }\n .vx-error {\n color: #d85858;\n font-size: 12px;\n }\n .vx-pad {\n padding: 12px;\n }\n .vx-pad-sm {\n padding: 6px 2px;\n }\n .vx-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n max-height: 300px;\n overflow: auto;\n }\n .vx-list-item {\n text-align: left;\n border: none;\n background: rgba(255, 255, 255, .1);\n color: inherit;\n border-radius: 8px;\n padding: 6px 10px;\n font-size: 12px;\n cursor: pointer;\n }\n .vx-list-item:hover {\n background: rgba(255, 255, 255, .22);\n }\n .vx-list-item.on {\n background: rgba(127, 164, 224, .28);\n box-shadow: inset 0 0 0 1px rgba(127, 164, 224, .45);\n }\n .vx-list-item:disabled {\n opacity: .55;\n cursor: not-allowed;\n }\n .vx-check-row {\n display: flex;\n gap: 8px;\n align-items: center;\n font-size: 12.5px;\n padding: 4px 2px;\n }\n .vx-check-title {\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .vx-badge {\n background: rgba(127, 164, 224, .3);\n border-radius: 8px;\n padding: 0 6px;\n font-size: 10px;\n }\n .vx-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 11.5px;\n }\n .vx-table th, .vx-table td {\n border: 1px solid rgba(128, 140, 160, .3);\n padding: 4px 6px;\n text-align: right;\n }\n .vx-table th:first-child, .vx-table td:first-child {\n text-align: left;\n }\n .vx-folder {\n display: flex;\n flex-direction: column;\n }\n .vx-folder-head {\n display: flex;\n gap: 5px;\n align-items: center;\n padding: 5px 4px;\n border-radius: 9px;\n cursor: grab;\n }\n .vx-folder-head:hover {\n background: rgba(255, 255, 255, .14);\n }\n .vx-folder-head.drop-inside {\n background: rgba(127, 164, 224, .3);\n outline: 1px dashed rgba(127, 164, 224, .8);\n }\n .vx-folder-head.drop-before {\n box-shadow: 0 -2px 0 0 rgba(127, 164, 224, .9);\n }\n .vx-folder-head.drop-after {\n box-shadow: 0 2px 0 0 rgba(127, 164, 224, .9);\n }\n .vx-folder-name {\n font-size: 12.5px;\n font-weight: 600;\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .vx-folder-body {\n border-left: 1px dashed rgba(128, 140, 160, .35);\n margin-left: 14px;\n padding-left: 6px;\n display: flex;\n flex-direction: column;\n gap: 2px;\n }\n .vx-item-row {\n display: flex;\n gap: 5px;\n align-items: center;\n padding: 3px 4px;\n border-radius: 8px;\n }\n .vx-item-row:hover {\n background: rgba(255, 255, 255, .12);\n }\n .vx-item-name {\n flex: 1;\n text-align: left;\n border: none;\n background: transparent;\n color: inherit;\n font-size: 12px;\n cursor: pointer;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n padding: 0;\n }\n .vx-mini {\n border: none;\n background: transparent;\n color: inherit;\n opacity: .75;\n cursor: pointer;\n padding: 2px;\n border-radius: 6px;\n display: inline-flex;\n align-items: center;\n }\n .vx-mini:hover {\n opacity: 1;\n background: rgba(255, 255, 255, .2);\n }\n .vx-form {\n display: flex;\n flex-direction: column;\n gap: 6px;\n border: 1px dashed rgba(128, 140, 160, .4);\n border-radius: 10px;\n padding: 8px;\n }\n .vx-prompt-card {\n border: 1px solid rgba(128, 140, 160, .3);\n background: rgba(255, 255, 255, .1);\n border-radius: 10px;\n padding: 8px 10px;\n }\n .vx-prompt-title {\n font-weight: 600;\n font-size: 12.5px;\n }\n .vx-prompt-body {\n margin-top: 4px;\n font-size: 11.5px;\n opacity: .85;\n white-space: pre-wrap;\n word-break: break-word;\n max-height: 72px;\n overflow: hidden;\n }\n .vx-modal-mask {\n position: absolute;\n inset: 0;\n pointer-events: auto;\n background: rgba(8, 10, 16, .4);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 60;\n }\n .vx-modal {\n position: relative;\n width: min(760px, 92vw);\n max-height: 82vh;\n overflow: auto;\n padding: 16px;\n color: #20242e;\n pointer-events: auto;\n }\n .vx-pop-head {\n display: flex;\n gap: 8px;\n align-items: center;\n margin-bottom: 8px;\n font-weight: 600;\n font-size: 13px;\n }\n .vx-svgbox {\n overflow: auto;\n background: rgba(12, 14, 20, .6);\n border-radius: 12px;\n padding: 14px;\n }\n .vx-svgbox svg {\n max-width: 100%;\n height: auto;\n }\n .vx-pre {\n white-space: pre-wrap;\n word-break: break-all;\n font-size: 10.5px;\n opacity: .85;\n }\n .vx-toasts {\n position: absolute;\n left: 50%;\n bottom: 26px;\n transform: translateX(-50%);\n display: flex;\n flex-direction: column;\n gap: 8px;\n align-items: center;\n pointer-events: auto;\n z-index: 80;\n }\n .vx-toast {\n display: flex;\n gap: 10px;\n align-items: center;\n color: #f2f4f8;\n background: rgba(26, 32, 44, .92);\n border: 1px solid rgba(255, 255, 255, .12);\n padding: 8px 14px;\n border-radius: 12px;\n font-size: 12.5px;\n box-shadow: 0 10px 30px rgba(0, 0, 0, .3);\n max-width: 560px;\n backdrop-filter: blur(9px);\n -webkit-backdrop-filter: blur(9px);\n }\n @media (prefers-color-scheme: dark) {\n .vx-toast {\n background: rgba(18, 22, 30, .94);\n }\n }\n .vx-foot-btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n border: 1px solid rgba(127, 164, 224, .4);\n background: rgba(127, 164, 224, .14);\n color: inherit;\n cursor: pointer;\n padding: 4px 10px;\n border-radius: 10px;\n margin: 2px;\n }\n .vx-foot-btn:hover {\n background: rgba(127, 164, 224, .3);\n }\n .vx-foot-label {\n font-size: 12px;\n }\n .vx-folders {\n position: fixed;\n left: 12px;\n bottom: 60px;\n width: 272px;\n max-height: min(560px, calc(100vh - 220px));\n display: flex;\n flex-direction: column;\n overflow: hidden;\n pointer-events: auto;\n color: #20242e;\n z-index: 55;\n }\n /* \u5934\u90E8\u884C\uFF08\u56FE\u6807 + \u6807\u9898 + \u6309\u94AE\uFF09\u4E0B\u79FB\u5E76\u62C9\u5F00\u4E0E\u5BB9\u5668\u8FB9\u7F18\u7684\u95F4\u8DDD */\n .vx-folders .vx-pop-head {\n padding: 14px 14px 0;\n }\n .vx-folders-body {\n flex: 1;\n overflow: auto;\n padding: 4px 14px 12px;\n position: relative;\n z-index: 1;\n }\n .vx-prompt-pop {\n position: fixed;\n width: 320px;\n max-height: 420px;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n pointer-events: auto;\n color: #20242e;\n z-index: 65;\n padding: 10px 12px;\n }\n .vx-settings-page {\n display: flex;\n flex-direction: column;\n gap: 14px;\n max-width: 720px;\n }\n .vx-mmd-wrap {\n position: relative;\n margin: 6px 0;\n border: 1px solid rgba(127, 164, 224, .35);\n border-radius: 12px;\n overflow: hidden;\n background: rgba(127, 164, 224, .05);\n }\n .vx-mmd-bar {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 4px 6px;\n border-bottom: 1px solid rgba(127, 164, 224, .25);\n background: rgba(127, 164, 224, .08);\n }\n .vx-mmd-btn {\n border: none;\n background: transparent;\n color: inherit;\n opacity: .65;\n font-size: 12px;\n padding: 3px 10px;\n border-radius: 8px;\n cursor: pointer;\n }\n .vx-mmd-btn:hover {\n opacity: 1;\n background: rgba(127, 164, 224, .18);\n }\n .vx-mmd-btn.active {\n opacity: 1;\n background: rgba(127, 164, 224, .28);\n font-weight: 600;\n }\n .vx-mmd-live {\n margin-left: auto;\n font-size: 11px;\n opacity: .6;\n color: inherit;\n text-decoration: none;\n padding: 3px 8px;\n }\n .vx-mmd-live:hover {\n opacity: 1;\n }\n .vx-mmd-stage {\n padding: 16px 12px;\n overflow-x: auto;\n text-align: center;\n }\n .vx-mmd-stage svg {\n max-width: 100%;\n height: auto;\n }\n\n /* DSH can select a theme independently of the operating system. The root\n classes are applied from the resolved GUI theme and intentionally win\n over the media-query fallback above. */\n .vx-root.vx-dark .vx-glass {\n background: rgba(13, 17, 25, .62);\n color: #eef1f7;\n }\n .vx-root.vx-dark .vx-liquid .vx-glass {\n background: rgba(0, 0, 0, .06);\n }\n .vx-root.vx-dark .vx-liquid .vx-pattern {\n background-image: radial-gradient(rgba(110, 110, 128, .5) 3px, transparent 3px);\n }\n .vx-root.vx-dark .vx-pattern {\n background-image: radial-gradient(rgba(100, 100, 116, .5) 1px, transparent 1px);\n }\n .vx-root.vx-dark .vx-dot {\n background: rgba(205, 215, 230, .95);\n border-color: rgba(28, 34, 46, .9);\n }\n .vx-root.vx-dark .vx-thumb {\n background: rgba(165, 180, 205, .45);\n }\n .vx-root.vx-dark .vx-balance-hover,\n .vx-root.vx-dark .vx-panel,\n .vx-root.vx-dark .vx-modal,\n .vx-root.vx-dark .vx-folders {\n color: #e8ebf2;\n }\n .vx-root.vx-dark .vx-toast {\n background: rgba(18, 22, 30, .94);\n }\n\n .vx-root.vx-light .vx-glass {\n background: rgba(255, 255, 255, .64);\n color: #20242e;\n }\n .vx-root.vx-light .vx-liquid .vx-glass {\n background: rgba(255, 255, 255, .06);\n }\n .vx-root.vx-light .vx-liquid .vx-pattern {\n background-image: radial-gradient(rgba(150, 150, 160, .5) 3px, transparent 3px);\n }\n .vx-root.vx-light .vx-pattern {\n background-image: radial-gradient(rgba(150, 150, 160, .42) 1px, transparent 1px);\n }\n .vx-root.vx-light .vx-dot {\n background: rgba(70, 85, 110, .92);\n border-color: rgba(255, 255, 255, .92);\n }\n .vx-root.vx-light .vx-thumb {\n background: rgba(90, 105, 135, .5);\n }\n .vx-root.vx-light .vx-balance-hover,\n .vx-root.vx-light .vx-panel,\n .vx-root.vx-light .vx-modal,\n .vx-root.vx-light .vx-folders {\n color: #20242e;\n }\n .vx-root.vx-light .vx-toast {\n background: rgba(26, 32, 44, .92);\n }\n}";
@@ -7,8 +7,9 @@
7
7
  import type { AttachmentStore } from '@deepseek-ai/dsh-attachment';
8
8
  import type { SessionQueryEngine } from '@deepseek-ai/dsh-session-query';
9
9
  import { type CredentialStore } from './system-credentials.ts';
10
- import type { BalanceInfo, CustomPluginPublicState, CustomPluginState, TimelineItem } from './protocol.ts';
10
+ import type { BackupImportMode, BalanceInfo, ConversationSearchKind, ConversationSearchResult, CustomPluginBackupV1, CustomPluginPublicState, CustomPluginState, TimelineItem } from './protocol.ts';
11
11
  import { type UsageRecord } from './usage.ts';
12
+ import { backupPreview } from './backup.ts';
12
13
  type UsageScanResult = {
13
14
  ok: true;
14
15
  day: string;
@@ -57,6 +58,10 @@ export declare class CustomPluginHost {
57
58
  private readonly attachments;
58
59
  private readonly credentialStore;
59
60
  private readonly sessionModel;
61
+ private stateOperation;
62
+ private stateOperationActive;
63
+ private stateOperationPending;
64
+ private readonly queuedUsage;
60
65
  private usageScanPromise;
61
66
  private usageRevision;
62
67
  private lastUsagePruneDay;
@@ -69,6 +74,9 @@ export declare class CustomPluginHost {
69
74
  constructor(options: CustomPluginHostOptions);
70
75
  /** Persist the state document (debounced by the loader entry). */
71
76
  persist(): Promise<void>;
77
+ /** Persist after all queued state mutations have reached a stable point. */
78
+ persistWhenIdle(): Promise<void>;
79
+ private runStateOperation;
72
80
  /** Record a bounded client diagnostic line. */
73
81
  pushDiag(message: string): void;
74
82
  /** Track the model of each session's latest request. */
@@ -76,7 +84,8 @@ export declare class CustomPluginHost {
76
84
  forgetSession(sessionId: string): void;
77
85
  /** Fold one assistant/message usage record into the ledger. The event time
78
86
  * decides both the day bucket and the peak/off-peak portion. */
79
- foldUsage(sessionId: string, usage: UsageRecord, time?: number): void;
87
+ foldUsage(sessionId: string, usage: UsageRecord, time?: number, modelOverride?: string | null): void;
88
+ private foldUsageNow;
80
89
  /** Snapshot of browser-safe state; the API key value never crosses this boundary. */
81
90
  stateView(): Promise<CustomPluginPublicState>;
82
91
  /** Apply a browser-side state edit (config, folders, prompts, stars, api key). */
@@ -87,6 +96,19 @@ export declare class CustomPluginHost {
87
96
  stars?: CustomPluginState['stars'];
88
97
  apiKey?: string;
89
98
  }): Promise<void>;
99
+ private applyEditNow;
100
+ /** Build the portable backup projection; credentials never enter it. */
101
+ backupExport(): CustomPluginBackupV1;
102
+ /** Validate/preview or atomically apply a portable backup. */
103
+ backupImport(raw: unknown, mode: BackupImportMode, dryRun: boolean): Promise<{
104
+ ok: true;
105
+ preview: ReturnType<typeof backupPreview>;
106
+ recoveryPath?: string;
107
+ } | {
108
+ ok: false;
109
+ error: string;
110
+ }>;
111
+ private backupImportNow;
90
112
  /** Move a legacy plaintext state key into the OS store when available. */
91
113
  migrateLegacyApiKey(): Promise<boolean>;
92
114
  /** Timeline nodes for one session, capped to the 400-node tail. The tail cap
@@ -112,6 +134,13 @@ export declare class CustomPluginHost {
112
134
  }>;
113
135
  /** Resolve the key and its source without returning either value to the browser. */
114
136
  private resolveApiKeyWithSource;
137
+ /** Search one session using DSH's indexed event search and bind hits to a user-turn anchor. */
138
+ conversationSearch(sessionId: string, query: string, kinds: readonly ConversationSearchKind[]): Promise<{
139
+ ok: true;
140
+ } & ConversationSearchResult | {
141
+ ok: false;
142
+ error: string;
143
+ }>;
115
144
  private resolveApiKey;
116
145
  /** Browser-safe credential status used by state and save responses. */
117
146
  credentialStatus(): Promise<Pick<CustomPluginPublicState, 'apiKeyConfigured' | 'credentialStorage'>>;
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * The Host owns the state document, the daily token-usage ledger (folded
5
5
  * from `session/event`), the `/api/custom-plugin` routes (state, timeline,
6
- * export, balance, usage scan, Mermaid fetch, diagnostics), and the
6
+ * export, backup, search, balance, usage scan, Mermaid fetch, diagnostics), and the
7
7
  * `custom_plugin_status` agent tool. The browser is a same-origin view over
8
8
  * those routes; this half has no UI of its own.
9
9
  * @module @alexpeng/dsh-custom-plugin
@@ -0,0 +1,30 @@
1
+ /** Pure helpers for usage reporting, prompt templates, and portable files. */
2
+ import type { PromptItem, UsageMap } from './protocol.ts';
3
+ export interface UsageSummary {
4
+ tokens: number;
5
+ calls: number;
6
+ costCny: number;
7
+ exact: boolean;
8
+ }
9
+ export type BudgetState = 'disabled' | 'unknown' | 'ok' | 'warning' | 'over';
10
+ export declare function budgetState(summary: UsageSummary, budgetCny: number, warningPercent?: number): BudgetState;
11
+ export declare function summarizeUsage(usage: UsageMap, days?: ReadonlySet<string>): UsageSummary;
12
+ export declare function usageCsv(usage: UsageMap): string;
13
+ export declare function promptVariables(text: string): string[];
14
+ export declare function fillPromptTemplate(text: string, values: Readonly<Record<string, string>>): string;
15
+ /** Normalize a prompt imported from a portable document without pulling the
16
+ * Node-owned state module into the browser bundle. */
17
+ export declare function normalizePromptItem(raw: unknown): PromptItem | null;
18
+ export declare function promptsMarkdown(prompts: readonly PromptItem[]): string;
19
+ export declare function parsePromptsMarkdown(text: string): PromptItem[];
20
+ export declare function isCommandPaletteShortcut(event: Pick<KeyboardEvent, 'ctrlKey' | 'metaKey' | 'altKey' | 'shiftKey' | 'key'>, target: Pick<HTMLElement, 'isContentEditable' | 'tagName'> | null): boolean;
21
+ export interface ArchiveBatchResultItem {
22
+ id: string;
23
+ ok: boolean;
24
+ error?: string;
25
+ }
26
+ export declare function archiveBatch(ids: readonly string[], running: ReadonlySet<string>, archive: (id: string) => Promise<void>): Promise<{
27
+ succeeded: number;
28
+ failed: number;
29
+ results: ArchiveBatchResultItem[];
30
+ }>;
@@ -38,6 +38,10 @@ export interface CustomPluginConfig {
38
38
  formula?: boolean;
39
39
  /** Show Mermaid render chips under matching messages. */
40
40
  mermaid?: boolean;
41
+ /** Monthly estimated-cost budget in CNY; zero disables it. */
42
+ monthlyBudgetCny?: number;
43
+ /** Percentage at which the monthly budget enters warning state. */
44
+ budgetWarningPercent?: number;
41
45
  }
42
46
  /** Default configuration (also the composition-layer default). */
43
47
  export declare const DEFAULT_CONFIG: CustomPluginConfig;
@@ -55,6 +59,30 @@ export interface PromptItem {
55
59
  id: string;
56
60
  name: string;
57
61
  text: string;
62
+ tags?: string[];
63
+ favorite?: boolean;
64
+ useCount?: number;
65
+ lastUsedAt?: number;
66
+ }
67
+ /** Portable, secret-free backup document. */
68
+ export interface CustomPluginBackupV1 {
69
+ format: 'dsh-custom-plugin-backup';
70
+ version: 1;
71
+ exportedAt: string;
72
+ data: Pick<CustomPluginState, 'cfg' | 'folders' | 'prompts' | 'stars' | 'usage'>;
73
+ }
74
+ export type BackupImportMode = 'merge' | 'replace';
75
+ export interface BackupConflictStats {
76
+ folders: number;
77
+ prompts: number;
78
+ usageDays: number;
79
+ }
80
+ export interface BackupImportPreview {
81
+ folders: number;
82
+ prompts: number;
83
+ starredSessions: number;
84
+ usageDays: number;
85
+ conflicts: BackupConflictStats;
58
86
  }
59
87
  /** Starred timeline nodes, keyed by session id then by user-message seq. */
60
88
  export type StarsMap = Record<string, Record<string, boolean>>;
@@ -108,6 +136,25 @@ export interface TimelineItem {
108
136
  hasMathml: boolean;
109
137
  hasMermaid: boolean;
110
138
  }
139
+ export type ConversationSearchKind = 'user' | 'assistant' | 'tool';
140
+ export interface ConversationSearchRequest {
141
+ sessionId: string;
142
+ query: string;
143
+ kinds?: ConversationSearchKind[];
144
+ }
145
+ export interface ConversationSearchItem {
146
+ /** Session used for the indexed hit; protects against stale cross-session clicks. */
147
+ sessionId: string;
148
+ seq: number;
149
+ anchorSeq: number;
150
+ kind: ConversationSearchKind;
151
+ time: number;
152
+ snippet: string;
153
+ }
154
+ export interface ConversationSearchResult {
155
+ items: ConversationSearchItem[];
156
+ hasMore: boolean;
157
+ }
111
158
  /** Balance payload returned by the DeepSeek balance endpoint. */
112
159
  export interface BalanceInfo {
113
160
  currency: string;
@@ -10,4 +10,4 @@
10
10
  import type { WebRoute } from '@deepseek-ai/dsh-host-webserver';
11
11
  import type { CustomPluginHost } from './host-service.ts';
12
12
  /** Build the plugin's route set. */
13
- export declare function makeCustomPluginRoutes(host: CustomPluginHost): WebRoute[];
13
+ export declare function makeCustomPluginRoutes(host: CustomPluginHost, ready?: Promise<void>): WebRoute[];
@@ -9,13 +9,15 @@
9
9
  * on the temp file.
10
10
  * @module @alexpeng/dsh-custom-plugin/state
11
11
  */
12
- import { type CustomPluginConfig, type CustomPluginState } from './protocol.ts';
12
+ import { type CustomPluginConfig, type CustomPluginState, type PromptItem } from './protocol.ts';
13
13
  /** State file name of this plugin. */
14
14
  export declare const STATE_FILE = "custom-plugin-state.json";
15
15
  /** Default state document. */
16
16
  export declare function defaultState(): CustomPluginState;
17
17
  /** Normalize a stored configuration: strip retired keys and fill defaults. */
18
18
  export declare function normalizeCfg(raw: unknown): CustomPluginConfig;
19
+ /** Normalize one prompt while retaining its stable identity and order. */
20
+ export declare function normalizePrompt(raw: unknown): PromptItem | null;
19
21
  /** Merge a persisted document into the default state, ignoring unknown shapes. */
20
22
  export declare function mergeState(target: CustomPluginState, raw: unknown): void;
21
23
  /** Load and merge the persisted document into `state`. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alexpeng/dsh-custom-plugin",
3
- "description": "Custom convenience suite for the dsh web GUI: background colors with weather FX, liquid glass, a per-user-message timeline rail with stars and branching, multi-level project folders, prompt library, conversation export (JSON / Markdown / PDF-with-images), Mermaid rendering, quote reply, DeepSeek balance and daily token usage; dual-face plugin mounted without dsh source changes.",
4
- "version": "0.1.6",
3
+ "description": "Custom convenience suite for the dsh web GUI: appearance, timeline, folders, prompts, session export/search, Mermaid, quote reply, usage analytics, local budget, key-free backups, and a Ctrl/Cmd+K command palette; dual-face plugin mounted without dsh source changes.",
4
+ "version": "0.4.0",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/types/index.d.ts",