@alexpeng/dsh-custom-plugin 0.1.1 → 0.1.3
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/CHANGELOG.md +97 -0
- package/README.i18n.yaml +2 -2
- package/README.md +37 -3
- package/README.zh.md +37 -3
- package/lib/client.js +343 -6
- package/lib/client.js.map +1 -1
- package/lib/index.js +76 -12
- package/lib/types/client/mermaid-code.d.ts +19 -0
- package/lib/types/client/styles.d.ts +1 -1
- package/lib/types/host-service.d.ts +17 -1
- package/lib/types/state.d.ts +6 -2
- package/package.json +20 -12
package/lib/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
1
2
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
2
3
|
import { homedir } from "node:os";
|
|
3
4
|
import { dirname, isAbsolute, join } from "node:path";
|
|
4
5
|
import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
6
|
+
import { readFileSync } from "node:fs";
|
|
5
7
|
//#region src/dsh-home.ts
|
|
6
8
|
/**
|
|
7
9
|
* DSH_HOME resolution for the plugin's Host half: the environment override
|
|
@@ -110,7 +112,9 @@ const DEFAULT_CONFIG = {
|
|
|
110
112
|
* One JSON document at `$DSH_HOME/custom-plugin-state.json` holds the
|
|
111
113
|
* appearance configuration, folder tree, prompt library, starred timeline
|
|
112
114
|
* nodes, the balance API key, and the per-day token usage ledger. Writes are
|
|
113
|
-
* atomic (temp file + rename)
|
|
115
|
+
* atomic (temp file + rename) and serialized (one in-flight write per path),
|
|
116
|
+
* so a crash never truncates the document and concurrent saves never race
|
|
117
|
+
* on the temp file.
|
|
114
118
|
* @module @alexpeng/dsh-custom-plugin/state
|
|
115
119
|
*/
|
|
116
120
|
/** State file name of this plugin. */
|
|
@@ -167,13 +171,26 @@ async function loadStateFile(state, home = dshHome()) {
|
|
|
167
171
|
if (raw !== null) mergeState(state, raw);
|
|
168
172
|
return statePath;
|
|
169
173
|
}
|
|
170
|
-
/**
|
|
171
|
-
|
|
174
|
+
/** In-flight save per state path: concurrent saves queue instead of racing
|
|
175
|
+
* on the shared .tmp file. Two writers renaming one temp file is the Windows
|
|
176
|
+
* EPERM/EBUSY source; queuing also coalesces naturally, because each turn
|
|
177
|
+
* serializes the live document when it runs, not when it was requested. */
|
|
178
|
+
const saveQueues = /* @__PURE__ */ new Map();
|
|
179
|
+
/** Atomically persist the state document. Saves to the same path are
|
|
180
|
+
* serialized: a caller awaits its own turn's completion, a failed turn never
|
|
181
|
+
* poisons the queue behind it. */
|
|
182
|
+
function saveStateFile(state, home = dshHome()) {
|
|
172
183
|
const statePath = join(home, STATE_FILE);
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
184
|
+
const turn = (saveQueues.get(statePath) ?? Promise.resolve()).catch(() => {}).then(async () => {
|
|
185
|
+
await mkdir(dirname(statePath), { recursive: true });
|
|
186
|
+
const tmpPath = statePath + ".tmp";
|
|
187
|
+
await writeFile(tmpPath, JSON.stringify(state), "utf8");
|
|
188
|
+
await rename(tmpPath, statePath);
|
|
189
|
+
});
|
|
190
|
+
saveQueues.set(statePath, turn);
|
|
191
|
+
return turn.finally(() => {
|
|
192
|
+
if (saveQueues.get(statePath) === turn) saveQueues.delete(statePath);
|
|
193
|
+
});
|
|
177
194
|
}
|
|
178
195
|
//#endregion
|
|
179
196
|
//#region src/extract.ts
|
|
@@ -541,6 +558,9 @@ var CustomPluginHost = class {
|
|
|
541
558
|
sessionModel = /* @__PURE__ */ new Map();
|
|
542
559
|
mermaidBytesValue = 0;
|
|
543
560
|
mermaidJs = "";
|
|
561
|
+
mermaidSource = "";
|
|
562
|
+
localMermaidPath;
|
|
563
|
+
readCredential;
|
|
544
564
|
constructor(options) {
|
|
545
565
|
this.sessionQuery = options.sessionQuery;
|
|
546
566
|
this.state = options.state;
|
|
@@ -548,6 +568,8 @@ var CustomPluginHost = class {
|
|
|
548
568
|
this.persistNow = options.saveNow;
|
|
549
569
|
this.diagReports = options.diagReports;
|
|
550
570
|
this.attachments = options.attachments;
|
|
571
|
+
this.localMermaidPath = options.localMermaidPath ?? defaultLocalMermaidPath;
|
|
572
|
+
this.readCredential = options.readCredential ?? readDeepSeekCredential;
|
|
551
573
|
}
|
|
552
574
|
/** Persist the state document (debounced by the loader entry). */
|
|
553
575
|
async persist() {
|
|
@@ -723,11 +745,17 @@ var CustomPluginHost = class {
|
|
|
723
745
|
if (key !== "") return key;
|
|
724
746
|
try {
|
|
725
747
|
const env = globalThis.process?.env;
|
|
726
|
-
const
|
|
727
|
-
|
|
748
|
+
for (const name of [
|
|
749
|
+
"DEEPSEEK_API_KEY",
|
|
750
|
+
"DEEPSEEK_KEY",
|
|
751
|
+
"DEEPSEEK_TOKEN"
|
|
752
|
+
]) {
|
|
753
|
+
const value = env?.[name];
|
|
754
|
+
if (typeof value === "string" && /^sk-/.test(value.trim())) return value.trim();
|
|
755
|
+
}
|
|
728
756
|
} catch {}
|
|
729
757
|
try {
|
|
730
|
-
const candidate = await
|
|
758
|
+
const candidate = await this.readCredential();
|
|
731
759
|
if (/^sk-/.test(candidate)) return candidate;
|
|
732
760
|
} catch {}
|
|
733
761
|
return "";
|
|
@@ -818,12 +846,27 @@ var CustomPluginHost = class {
|
|
|
818
846
|
scannedSessions: scanned
|
|
819
847
|
};
|
|
820
848
|
}
|
|
821
|
-
/**
|
|
849
|
+
/** Resolve the Mermaid engine: the bundled `mermaid` dependency on disk
|
|
850
|
+
* first (no runtime network), CDN mirrors only as a fallback (cached for
|
|
851
|
+
* the host lifetime). */
|
|
822
852
|
async mermaidFetch() {
|
|
823
853
|
if (this.mermaidBytesValue > 0) return {
|
|
824
854
|
ok: true,
|
|
825
855
|
bytes: this.mermaidBytesValue
|
|
826
856
|
};
|
|
857
|
+
const localPath = this.localMermaidPath();
|
|
858
|
+
if (localPath !== null && localPath !== "") try {
|
|
859
|
+
const text = readFileSync(localPath, "utf8");
|
|
860
|
+
if (text.length > 0) {
|
|
861
|
+
this.mermaidJs = text;
|
|
862
|
+
this.mermaidBytesValue = text.length;
|
|
863
|
+
this.mermaidSource = "local";
|
|
864
|
+
return {
|
|
865
|
+
ok: true,
|
|
866
|
+
bytes: text.length
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
} catch {}
|
|
827
870
|
const urls = [
|
|
828
871
|
"https://cdn.jsdelivr.net/npm/mermaid@11.6.0/dist/mermaid.min.js",
|
|
829
872
|
"https://fastly.jsdelivr.net/npm/mermaid@11.6.0/dist/mermaid.min.js",
|
|
@@ -847,6 +890,7 @@ var CustomPluginHost = class {
|
|
|
847
890
|
};
|
|
848
891
|
this.mermaidJs = text;
|
|
849
892
|
this.mermaidBytesValue = text.length;
|
|
893
|
+
this.mermaidSource = "cdn";
|
|
850
894
|
return {
|
|
851
895
|
ok: true,
|
|
852
896
|
bytes: text.length
|
|
@@ -860,6 +904,10 @@ var CustomPluginHost = class {
|
|
|
860
904
|
mermaidBytes() {
|
|
861
905
|
return this.mermaidBytesValue;
|
|
862
906
|
}
|
|
907
|
+
/** Where the engine came from: 'local', 'cdn', or '' while unloaded. */
|
|
908
|
+
mermaidLoadedSource() {
|
|
909
|
+
return this.mermaidSource;
|
|
910
|
+
}
|
|
863
911
|
/** Whether any DeepSeek key source resolves (state, environment, credential
|
|
864
912
|
* file) — the honest answer behind the panel's "key configured" badge. */
|
|
865
913
|
async hasApiKey() {
|
|
@@ -872,6 +920,7 @@ var CustomPluginHost = class {
|
|
|
872
920
|
today: dayKey(),
|
|
873
921
|
usageToday: this.state.usage[dayKey()] ?? {},
|
|
874
922
|
mermaidBytes: this.mermaidBytesValue,
|
|
923
|
+
mermaidSource: this.mermaidSource,
|
|
875
924
|
apiKeySet: await this.hasApiKey(),
|
|
876
925
|
diagReports: [...this.diagReports]
|
|
877
926
|
};
|
|
@@ -939,6 +988,16 @@ var CustomPluginHost = class {
|
|
|
939
988
|
}
|
|
940
989
|
}
|
|
941
990
|
};
|
|
991
|
+
/** Resolve `mermaid/dist/mermaid.min.js` from the package's own dependency
|
|
992
|
+
* tree (works for `link:` checkouts and registry installs alike); null when
|
|
993
|
+
* the dependency is absent, which falls mermaidFetch back to the CDN. */
|
|
994
|
+
function defaultLocalMermaidPath() {
|
|
995
|
+
try {
|
|
996
|
+
return createRequire(import.meta.url).resolve("mermaid/dist/mermaid.min.js");
|
|
997
|
+
} catch {
|
|
998
|
+
return null;
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
942
1001
|
//#endregion
|
|
943
1002
|
//#region src/loopback.ts
|
|
944
1003
|
/** IPv4 127/8 predicate (four decimal octets, first == 127). */
|
|
@@ -1220,7 +1279,9 @@ function applyImpl(ctx) {
|
|
|
1220
1279
|
if (timer !== void 0) clearTimeout(timer);
|
|
1221
1280
|
timer = setTimeout(() => {
|
|
1222
1281
|
timer = void 0;
|
|
1223
|
-
saveStateFile(state).catch(() => {
|
|
1282
|
+
saveStateFile(state).catch((error) => {
|
|
1283
|
+
reportDiag(`state save failed: ${String(error?.message ?? error)}`);
|
|
1284
|
+
});
|
|
1224
1285
|
}, 500);
|
|
1225
1286
|
};
|
|
1226
1287
|
})();
|
|
@@ -1251,6 +1312,9 @@ function applyImpl(ctx) {
|
|
|
1251
1312
|
});
|
|
1252
1313
|
const routeDisposers = [];
|
|
1253
1314
|
for (const route of makeCustomPluginRoutes(host)) routeDisposers.push(ctx.webServer.register(route));
|
|
1315
|
+
host.mermaidFetch().then((result) => {
|
|
1316
|
+
reportDiag(result.ok ? `mermaid engine ready (${result.bytes} bytes, ${host.mermaidLoadedSource()})` : `mermaid engine failed: ${result.error}`);
|
|
1317
|
+
});
|
|
1254
1318
|
const disposeTool = ctx.tools.register(defineTool({
|
|
1255
1319
|
name: "custom_plugin_status",
|
|
1256
1320
|
description: "查看 Custom 便利套件(dsh-custom-plugin)运行状态:外观配置、今日 token 用量(按模型)、DeepSeek 余额(如已配置 API Key)、当前会话时间线样本、Mermaid 引擎加载情况、客户端注入诊断。",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure Mermaid code-block detection helpers for the in-place renderer.
|
|
3
|
+
*
|
|
4
|
+
* The GUI renders a settled ```mermaid fence with its language in the code
|
|
5
|
+
* banner, but while the assistant is still streaming the banner is blank and
|
|
6
|
+
* the fence content grows chunk by chunk — detection then has to fall back to
|
|
7
|
+
* content heuristics (keyword prefix + completeness), the same approach the
|
|
8
|
+
* Gemini Voyager extension uses. Everything here is string-in/string-out so
|
|
9
|
+
* the heuristics stay unit-testable without a DOM.
|
|
10
|
+
* @module @alexpeng/dsh-custom-plugin/client/mermaid-code
|
|
11
|
+
*/
|
|
12
|
+
/** A banner label that names a real programming language must not be
|
|
13
|
+
* content-detected (a Python `%%` comment is not a mermaid directive). */
|
|
14
|
+
export declare function isGenericInfostring(label: string | null | undefined): boolean;
|
|
15
|
+
/** Whitespace normalization: web/CJK paste artifacts break the parser. */
|
|
16
|
+
export declare function normalizeMermaidText(code: string): string;
|
|
17
|
+
/** Does this text look like complete mermaid source? Conservative: during
|
|
18
|
+
* streaming we would rather skip a beat than flash a syntax error. */
|
|
19
|
+
export declare function isMermaidCode(code: string): boolean;
|
|
@@ -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 }";
|
|
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 }";
|
|
@@ -23,6 +23,10 @@ export interface CustomPluginHostOptions {
|
|
|
23
23
|
diagReports: string[];
|
|
24
24
|
/** Optional attachment store used to embed images into PDF exports. */
|
|
25
25
|
attachments?: AttachmentStore | undefined;
|
|
26
|
+
/** Test seam: return the local mermaid engine file path (or null). */
|
|
27
|
+
localMermaidPath?: () => string | null;
|
|
28
|
+
/** Test seam: read the DeepSeek credential from DSH's credentials file. */
|
|
29
|
+
readCredential?: () => Promise<string>;
|
|
26
30
|
}
|
|
27
31
|
/** Host capabilities behind the routes and the agent tool. */
|
|
28
32
|
export declare class CustomPluginHost {
|
|
@@ -35,6 +39,9 @@ export declare class CustomPluginHost {
|
|
|
35
39
|
private readonly sessionModel;
|
|
36
40
|
private mermaidBytesValue;
|
|
37
41
|
private mermaidJs;
|
|
42
|
+
private mermaidSource;
|
|
43
|
+
private localMermaidPath;
|
|
44
|
+
private readCredential;
|
|
38
45
|
constructor(options: CustomPluginHostOptions);
|
|
39
46
|
/** Persist the state document (debounced by the loader entry). */
|
|
40
47
|
persist(): Promise<void>;
|
|
@@ -100,7 +107,9 @@ export declare class CustomPluginHost {
|
|
|
100
107
|
ok: false;
|
|
101
108
|
error: string;
|
|
102
109
|
}>;
|
|
103
|
-
/**
|
|
110
|
+
/** Resolve the Mermaid engine: the bundled `mermaid` dependency on disk
|
|
111
|
+
* first (no runtime network), CDN mirrors only as a fallback (cached for
|
|
112
|
+
* the host lifetime). */
|
|
104
113
|
mermaidFetch(): Promise<{
|
|
105
114
|
ok: true;
|
|
106
115
|
bytes: number;
|
|
@@ -112,6 +121,8 @@ export declare class CustomPluginHost {
|
|
|
112
121
|
mermaidScript(): string;
|
|
113
122
|
/** Mermaid engine byte count for diagnostics. */
|
|
114
123
|
mermaidBytes(): number;
|
|
124
|
+
/** Where the engine came from: 'local', 'cdn', or '' while unloaded. */
|
|
125
|
+
mermaidLoadedSource(): string;
|
|
115
126
|
/** Whether any DeepSeek key source resolves (state, environment, credential
|
|
116
127
|
* file) — the honest answer behind the panel's "key configured" badge. */
|
|
117
128
|
hasApiKey(): Promise<boolean>;
|
|
@@ -121,9 +132,14 @@ export declare class CustomPluginHost {
|
|
|
121
132
|
today: string;
|
|
122
133
|
usageToday: unknown;
|
|
123
134
|
mermaidBytes: number;
|
|
135
|
+
mermaidSource: string;
|
|
124
136
|
apiKeySet: boolean;
|
|
125
137
|
diagReports: string[];
|
|
126
138
|
}>;
|
|
127
139
|
private httpText;
|
|
128
140
|
private httpJson;
|
|
129
141
|
}
|
|
142
|
+
/** Resolve `mermaid/dist/mermaid.min.js` from the package's own dependency
|
|
143
|
+
* tree (works for `link:` checkouts and registry installs alike); null when
|
|
144
|
+
* the dependency is absent, which falls mermaidFetch back to the CDN. */
|
|
145
|
+
export declare function defaultLocalMermaidPath(): string | null;
|
package/lib/types/state.d.ts
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* One JSON document at `$DSH_HOME/custom-plugin-state.json` holds the
|
|
5
5
|
* appearance configuration, folder tree, prompt library, starred timeline
|
|
6
6
|
* nodes, the balance API key, and the per-day token usage ledger. Writes are
|
|
7
|
-
* atomic (temp file + rename)
|
|
7
|
+
* atomic (temp file + rename) and serialized (one in-flight write per path),
|
|
8
|
+
* so a crash never truncates the document and concurrent saves never race
|
|
9
|
+
* on the temp file.
|
|
8
10
|
* @module @alexpeng/dsh-custom-plugin/state
|
|
9
11
|
*/
|
|
10
12
|
import { type CustomPluginConfig, type CustomPluginState } from './protocol.ts';
|
|
@@ -18,5 +20,7 @@ export declare function normalizeCfg(raw: unknown): CustomPluginConfig;
|
|
|
18
20
|
export declare function mergeState(target: CustomPluginState, raw: unknown): void;
|
|
19
21
|
/** Load and merge the persisted document into `state`. */
|
|
20
22
|
export declare function loadStateFile(state: CustomPluginState, home?: string): Promise<string>;
|
|
21
|
-
/** Atomically persist the state document.
|
|
23
|
+
/** Atomically persist the state document. Saves to the same path are
|
|
24
|
+
* serialized: a caller awaits its own turn's completion, a failed turn never
|
|
25
|
+
* poisons the queue behind it. */
|
|
22
26
|
export declare function saveStateFile(state: CustomPluginState, home?: string): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexpeng/dsh-custom-plugin",
|
|
3
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.
|
|
4
|
+
"version": "0.1.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/types/index.d.ts",
|
|
@@ -40,11 +40,25 @@
|
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": ">=22"
|
|
42
42
|
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc -p tsconfig.build.json && tsdown",
|
|
45
|
+
"bundle": "tsdown",
|
|
46
|
+
"watch": "tsdown --watch",
|
|
47
|
+
"typecheck": "tsc --noEmit",
|
|
48
|
+
"test": "vitest run",
|
|
49
|
+
"test:watch": "vitest",
|
|
50
|
+
"check:readme": "node scripts/check-readme-i18n.mjs",
|
|
51
|
+
"smoke": "node scripts/smoke.mjs",
|
|
52
|
+
"prepare": "pnpm build",
|
|
53
|
+
"prepublishOnly": "pnpm typecheck && pnpm test"
|
|
54
|
+
},
|
|
43
55
|
"peerDependencies": {
|
|
44
56
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
45
57
|
"@deepseek-ai/dsh-tools": "^0.1.1-rc.1"
|
|
46
58
|
},
|
|
47
|
-
"dependencies": {
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"mermaid": "^11.6.0"
|
|
61
|
+
},
|
|
48
62
|
"devDependencies": {
|
|
49
63
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
50
64
|
"@deepseek-ai/dsh-attachment": "^0.1.1-rc.1",
|
|
@@ -59,6 +73,7 @@
|
|
|
59
73
|
"@types/node": "^22.20.0",
|
|
60
74
|
"@types/react": "~18.3.1",
|
|
61
75
|
"@types/react-dom": "^18.3.5",
|
|
76
|
+
"puppeteer-core": "^25.8.0",
|
|
62
77
|
"react": "^18.3.1",
|
|
63
78
|
"react-dom": "^18.3.1",
|
|
64
79
|
"tsdown": "0.22.2",
|
|
@@ -68,17 +83,10 @@
|
|
|
68
83
|
"files": [
|
|
69
84
|
"lib",
|
|
70
85
|
"cordis.patch.yml",
|
|
86
|
+
"CHANGELOG.md",
|
|
71
87
|
"README.md",
|
|
72
88
|
"README.zh.md",
|
|
73
89
|
"README.i18n.yaml"
|
|
74
90
|
],
|
|
75
|
-
"license": "Apache-2.0"
|
|
76
|
-
|
|
77
|
-
"build": "tsc -p tsconfig.build.json && tsdown",
|
|
78
|
-
"bundle": "tsdown",
|
|
79
|
-
"watch": "tsdown --watch",
|
|
80
|
-
"typecheck": "tsc --noEmit",
|
|
81
|
-
"test": "vitest run",
|
|
82
|
-
"test:watch": "vitest"
|
|
83
|
-
}
|
|
84
|
-
}
|
|
91
|
+
"license": "Apache-2.0"
|
|
92
|
+
}
|