@alexpeng/dsh-custom-plugin 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -4,6 +4,7 @@ import { dirname, isAbsolute, join } from "node:path";
4
4
  import { homedir } from "node:os";
5
5
  import { mkdir, open, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
6
6
  import { readFileSync } from "node:fs";
7
+ import { createHash } from "node:crypto";
7
8
  //#region src/dsh-home.ts
8
9
  /**
9
10
  * DSH_HOME resolution for the plugin's Host half: the environment override
@@ -116,9 +117,49 @@ const PEAK_COUNTER_KEYS = [
116
117
  "peakCacheW",
117
118
  "peakOut"
118
119
  ];
120
+ const COUNTER_KEYS = [
121
+ "in",
122
+ "out",
123
+ "cacheIn",
124
+ "cacheW",
125
+ "reason",
126
+ "calls",
127
+ ...PEAK_COUNTER_KEYS
128
+ ];
119
129
  function isCounter(value) {
120
130
  return typeof value === "number" && Number.isFinite(value) && value >= 0;
121
131
  }
132
+ function counterOf$1(value) {
133
+ return isCounter(value) ? value : 0;
134
+ }
135
+ /**
136
+ * Rebuild a persisted usage ledger from untrusted JSON: keep day buckets and
137
+ * model rows that are objects, coerce every counter to a finite non-negative
138
+ * number, and drop prototype-polluting model keys. This is the load-side
139
+ * counterpart of the browser shape gates; without it a hand-edited or
140
+ * half-written document could make later folds throw (or concatenate a string
141
+ * into a counter) while every save kept succeeding.
142
+ */
143
+ function normalizeUsageMap(raw) {
144
+ const out = {};
145
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return out;
146
+ for (const [day, modelsRaw] of Object.entries(raw)) {
147
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(day)) continue;
148
+ if (modelsRaw === null || typeof modelsRaw !== "object" || Array.isArray(modelsRaw)) continue;
149
+ const clean = {};
150
+ for (const [model, rowRaw] of Object.entries(modelsRaw)) {
151
+ if (model === "__proto__" || model === "constructor" || model === "prototype") continue;
152
+ if (rowRaw === null || typeof rowRaw !== "object" || Array.isArray(rowRaw)) continue;
153
+ const src = rowRaw;
154
+ const row = createUsageRow();
155
+ for (const key of COUNTER_KEYS) row[key] = counterOf$1(src[key]);
156
+ row.peakSplitKnown = src.peakSplitKnown !== false;
157
+ clean[model] = row;
158
+ }
159
+ if (Object.keys(clean).length > 0) out[day] = clean;
160
+ }
161
+ return out;
162
+ }
122
163
  /** Create a row whose peak/off-peak split is exact from its first event. */
123
164
  function createUsageRow() {
124
165
  return {
@@ -306,11 +347,17 @@ function mergeState(target, raw) {
306
347
  if (raw === null || typeof raw !== "object") return;
307
348
  const src = raw;
308
349
  if (src.cfg !== void 0) target.cfg = normalizeCfg(src.cfg);
309
- if (Array.isArray(src.folders)) target.folders = src.folders;
350
+ if (Array.isArray(src.folders)) {
351
+ const folders = normalizeFolders(src.folders);
352
+ if (folders !== null) target.folders = folders;
353
+ }
310
354
  if (Array.isArray(src.prompts)) target.prompts = src.prompts.map(normalizePrompt).filter((item) => item !== null);
311
- if (src.stars !== null && typeof src.stars === "object" && !Array.isArray(src.stars)) target.stars = src.stars;
355
+ if (src.stars !== null && typeof src.stars === "object" && !Array.isArray(src.stars)) {
356
+ const stars = normalizeStars(src.stars);
357
+ if (stars !== null) target.stars = stars;
358
+ }
312
359
  if (typeof src.apiKey === "string") target.apiKey = src.apiKey;
313
- if (src.usage !== null && typeof src.usage === "object" && !Array.isArray(src.usage)) target.usage = src.usage;
360
+ if (src.usage !== null && typeof src.usage === "object" && !Array.isArray(src.usage)) target.usage = normalizeUsageMap(src.usage);
314
361
  }
315
362
  /** Rejection caps for browser-supplied documents. A shape beyond them is
316
363
  * rejected outright — never truncated — because the client owns the whole
@@ -401,6 +448,20 @@ const LOAD_RETRY_DELAYS = [
401
448
  6e3
402
449
  ];
403
450
  /**
451
+ * Reject a syntactically valid document whose collections cannot be persisted
452
+ * safely. Browser edits already pass the same gates; a hand-edited or
453
+ * half-written file must not bypass them, or one malformed tree makes every
454
+ * later `JSON.stringify` throw while the plugin keeps "loading" it.
455
+ * @returns a human-readable reason, or null when the shape is safe.
456
+ */
457
+ function validateLoadedShape(raw) {
458
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return "state document is not a JSON object";
459
+ const src = raw;
460
+ if (src.folders !== void 0 && normalizeFolders(src.folders) === null) return "folders tree fails the shape gate";
461
+ if (src.stars !== void 0 && normalizeStars(src.stars) === null) return "stars map fails the shape gate";
462
+ return null;
463
+ }
464
+ /**
404
465
  * Load and merge the persisted document into `state`.
405
466
  *
406
467
  * A missing file (ENOENT) is a fresh install and resolves with defaults. A
@@ -449,6 +510,14 @@ async function loadStateFile(state, home = dshHome(), retryDelays = LOAD_RETRY_D
449
510
  syncBaselines.set(statePath, null);
450
511
  raw = null;
451
512
  }
513
+ if (raw !== null) {
514
+ const shapeError = validateLoadedShape(raw);
515
+ if (shapeError !== null) {
516
+ await quarantineStateFile(statePath, new Error(shapeError));
517
+ syncBaselines.set(statePath, null);
518
+ raw = null;
519
+ }
520
+ }
452
521
  if (raw !== null) {
453
522
  mergeState(state, raw);
454
523
  syncBaselines.set(statePath, {
@@ -609,8 +678,10 @@ function mergeUsageThreeWay(ours, base, theirsRaw) {
609
678
  const theirs = theirsRaw !== null && typeof theirsRaw === "object" && !Array.isArray(theirsRaw) ? theirsRaw : {};
610
679
  const merged = {};
611
680
  for (const day of /* @__PURE__ */ new Set([...Object.keys(ours), ...Object.keys(theirs)])) {
681
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(day)) continue;
612
682
  const mergedDay = {};
613
683
  for (const model of /* @__PURE__ */ new Set([...Object.keys(ours[day] ?? {}), ...Object.keys(theirs[day] ?? {})])) {
684
+ if (model === "__proto__" || model === "constructor" || model === "prototype") continue;
614
685
  const om = ours[day]?.[model];
615
686
  const tm = theirs[day]?.[model];
616
687
  if (om === void 0 && tm === void 0) continue;
@@ -1290,6 +1361,18 @@ async function writeRecoveryBackup(path, state) {
1290
1361
  //#endregion
1291
1362
  //#region src/host-service.ts
1292
1363
  const USAGE_SCAN_CONCURRENCY = 4;
1364
+ /** CDN fallback version: the exact package this build ships. A hardcoded
1365
+ * `mermaid@11.6.0` while the local dependency resolved 11.17.x made the
1366
+ * offline and fallback engines diverge in behavior. */
1367
+ const MERMAID_CDN_VERSION = resolveMermaidVersion();
1368
+ function resolveMermaidVersion() {
1369
+ try {
1370
+ const require = createRequire(import.meta.url);
1371
+ const pkg = JSON.parse(readFileSync(require.resolve("mermaid/package.json"), "utf8"));
1372
+ if (typeof pkg.version === "string" && /^\d+\.\d+\.\d+/.test(pkg.version)) return pkg.version;
1373
+ } catch {}
1374
+ return "11.6.0";
1375
+ }
1293
1376
  async function mapConcurrent(items, limit, worker) {
1294
1377
  const results = new Array(items.length);
1295
1378
  let next = 0;
@@ -1324,6 +1407,7 @@ var CustomPluginHost = class CustomPluginHost {
1324
1407
  mermaidBytesValue = 0;
1325
1408
  mermaidJs = "";
1326
1409
  mermaidSource = "";
1410
+ mermaidEtagValue = "";
1327
1411
  localMermaidPath;
1328
1412
  readCredential;
1329
1413
  credentialCache = null;
@@ -1451,7 +1535,13 @@ var CustomPluginHost = class CustomPluginHost {
1451
1535
  async applyEdit(edit) {
1452
1536
  this.credentialCache = null;
1453
1537
  await this.runStateOperation(async () => {
1454
- const previous = JSON.parse(JSON.stringify(this.state));
1538
+ const previous = {
1539
+ cfg: this.state.cfg,
1540
+ folders: this.state.folders,
1541
+ prompts: this.state.prompts,
1542
+ stars: this.state.stars,
1543
+ apiKey: this.state.apiKey
1544
+ };
1455
1545
  try {
1456
1546
  await this.applyEditNow(edit);
1457
1547
  } catch (error) {
@@ -1508,7 +1598,14 @@ var CustomPluginHost = class CustomPluginHost {
1508
1598
  ok: true,
1509
1599
  preview
1510
1600
  };
1511
- const previous = JSON.parse(JSON.stringify(this.state));
1601
+ const previous = {
1602
+ cfg: this.state.cfg,
1603
+ folders: this.state.folders,
1604
+ prompts: this.state.prompts,
1605
+ stars: this.state.stars,
1606
+ usage: this.state.usage,
1607
+ apiKey: this.state.apiKey
1608
+ };
1512
1609
  const recoveryPath = await writeRecoveryBackup(this.statePath(), previous);
1513
1610
  const next = importedState(previous, backup, mode);
1514
1611
  Object.assign(this.state, next);
@@ -1972,21 +2069,19 @@ var CustomPluginHost = class CustomPluginHost {
1972
2069
  async mermaidFetchImpl() {
1973
2070
  const localPath = this.localMermaidPath();
1974
2071
  if (localPath !== null && localPath !== "") try {
1975
- const text = readFileSync(localPath, "utf8");
2072
+ const text = await readFile(localPath, "utf8");
1976
2073
  if (text.length > 0) {
1977
- this.mermaidJs = text;
1978
- this.mermaidBytesValue = text.length;
1979
- this.mermaidSource = "local";
2074
+ this.cacheMermaid(text, "local");
1980
2075
  return {
1981
2076
  ok: true,
1982
- bytes: text.length
2077
+ bytes: this.mermaidBytesValue
1983
2078
  };
1984
2079
  }
1985
2080
  } catch {}
1986
2081
  const urls = [
1987
- "https://cdn.jsdelivr.net/npm/mermaid@11.6.0/dist/mermaid.min.js",
1988
- "https://fastly.jsdelivr.net/npm/mermaid@11.6.0/dist/mermaid.min.js",
1989
- "https://unpkg.com/mermaid@11.6.0/dist/mermaid.min.js"
2082
+ `https://cdn.jsdelivr.net/npm/mermaid@${MERMAID_CDN_VERSION}/dist/mermaid.min.js`,
2083
+ `https://fastly.jsdelivr.net/npm/mermaid@${MERMAID_CDN_VERSION}/dist/mermaid.min.js`,
2084
+ `https://unpkg.com/mermaid@${MERMAID_CDN_VERSION}/dist/mermaid.min.js`
1990
2085
  ];
1991
2086
  let text = "";
1992
2087
  let lastError = "";
@@ -2008,14 +2103,21 @@ var CustomPluginHost = class CustomPluginHost {
2008
2103
  ok: false,
2009
2104
  error: `无法获取 Mermaid 引擎: ${lastError}`
2010
2105
  };
2011
- this.mermaidJs = text;
2012
- this.mermaidBytesValue = text.length;
2013
- this.mermaidSource = "cdn";
2106
+ this.cacheMermaid(text, "cdn");
2014
2107
  return {
2015
2108
  ok: true,
2016
- bytes: text.length
2109
+ bytes: this.mermaidBytesValue
2017
2110
  };
2018
2111
  }
2112
+ /** Cache the engine and its validators. `bytes` is UTF-8 length, not the
2113
+ * JavaScript string length: the status/debug payloads call it bytes, and a
2114
+ * non-ASCII bundle would otherwise under-report the transfer size. */
2115
+ cacheMermaid(text, source) {
2116
+ this.mermaidJs = text;
2117
+ this.mermaidBytesValue = Buffer.byteLength(text, "utf8");
2118
+ this.mermaidSource = source;
2119
+ this.mermaidEtagValue = createHash("sha256").update(text).digest("hex").slice(0, 32);
2120
+ }
2019
2121
  /** The cached Mermaid engine script (served at the script path). */
2020
2122
  mermaidScript() {
2021
2123
  return this.mermaidJs;
@@ -2024,14 +2126,20 @@ var CustomPluginHost = class CustomPluginHost {
2024
2126
  mermaidBytes() {
2025
2127
  return this.mermaidBytesValue;
2026
2128
  }
2129
+ /** Cache validator for the engine script ('' while unloaded). */
2130
+ mermaidEtag() {
2131
+ return this.mermaidEtagValue;
2132
+ }
2027
2133
  /** Where the engine came from: 'local', 'cdn', or '' while unloaded. */
2028
2134
  mermaidLoadedSource() {
2029
2135
  return this.mermaidSource;
2030
2136
  }
2031
2137
  /** Whether any DeepSeek key source resolves (state, environment, credential
2032
- * file) — the honest answer behind the panel's "key configured" badge. */
2138
+ * file) — the honest answer behind the panel's "key configured" badge.
2139
+ * Goes through the 5s source cache: the status tool and About tab call this
2140
+ * independently of `/state`, and each miss hits the OS keychain plus a file. */
2033
2141
  async hasApiKey() {
2034
- return await this.resolveApiKey() !== "";
2142
+ return (await this.credentialStatus()).apiKeyConfigured;
2035
2143
  }
2036
2144
  /** Diagnostics snapshot for the status tool and the About tab. */
2037
2145
  async debugInfo() {
@@ -2192,7 +2300,7 @@ function isLoopbackRequest(request) {
2192
2300
  }
2193
2301
  //#endregion
2194
2302
  //#region src/routes.ts
2195
- const BODY_LIMIT = 256 * 1024;
2303
+ const STATE_BODY_LIMIT = 1024 * 1024;
2196
2304
  const TIMELINE_LIMIT = 64 * 1024;
2197
2305
  const BACKUP_REQUEST_LIMIT = 5308416;
2198
2306
  function json(res, status, body) {
@@ -2264,7 +2372,15 @@ function makeCustomPluginRoutes(host, ready = Promise.resolve()) {
2264
2372
  return;
2265
2373
  }
2266
2374
  try {
2267
- const body = await readBody(req, BODY_LIMIT);
2375
+ const rawBody = await readBody(req, STATE_BODY_LIMIT);
2376
+ if (rawBody === null || typeof rawBody !== "object" || Array.isArray(rawBody)) {
2377
+ json(res, 400, {
2378
+ ok: false,
2379
+ error: "状态请求结构无效"
2380
+ });
2381
+ return;
2382
+ }
2383
+ const body = rawBody;
2268
2384
  await host.applyEdit({
2269
2385
  cfg: body.cfg,
2270
2386
  folders: Array.isArray(body.folders) ? body.folders : void 0,
@@ -2454,7 +2570,15 @@ function makeCustomPluginRoutes(host, ready = Promise.resolve()) {
2454
2570
  if (!guard(req, res)) return;
2455
2571
  await ready;
2456
2572
  if (!isMethod(req, "GET", res)) return;
2457
- json(res, 200, await host.balanceGet());
2573
+ try {
2574
+ json(res, 200, await host.balanceGet());
2575
+ } catch (error) {
2576
+ json(res, 500, {
2577
+ ok: false,
2578
+ keyConfigured: false,
2579
+ error: String(error?.message ?? error)
2580
+ });
2581
+ }
2458
2582
  }
2459
2583
  },
2460
2584
  {
@@ -2464,8 +2588,15 @@ function makeCustomPluginRoutes(host, ready = Promise.resolve()) {
2464
2588
  if (!guard(req, res)) return;
2465
2589
  await ready;
2466
2590
  if (!isMethod(req, "POST", res)) return;
2467
- const result = await host.usageScan();
2468
- json(res, result.ok ? 200 : 500, result);
2591
+ try {
2592
+ const result = await host.usageScan();
2593
+ json(res, result.ok ? 200 : 500, result);
2594
+ } catch (error) {
2595
+ json(res, 500, {
2596
+ ok: false,
2597
+ error: String(error?.message ?? error)
2598
+ });
2599
+ }
2469
2600
  }
2470
2601
  },
2471
2602
  {
@@ -2474,8 +2605,15 @@ function makeCustomPluginRoutes(host, ready = Promise.resolve()) {
2474
2605
  handler: async (req, res) => {
2475
2606
  if (!guard(req, res)) return;
2476
2607
  if (!isMethod(req, "POST", res)) return;
2477
- const result = await host.mermaidFetch();
2478
- json(res, result.ok ? 200 : 502, result);
2608
+ try {
2609
+ const result = await host.mermaidFetch();
2610
+ json(res, result.ok ? 200 : 502, result);
2611
+ } catch (error) {
2612
+ json(res, 502, {
2613
+ ok: false,
2614
+ error: String(error?.message ?? error)
2615
+ });
2616
+ }
2479
2617
  }
2480
2618
  },
2481
2619
  {
@@ -2489,9 +2627,18 @@ function makeCustomPluginRoutes(host, ready = Promise.resolve()) {
2489
2627
  res.end("mermaid bundle not ready");
2490
2628
  return;
2491
2629
  }
2630
+ const etag = `"${host.mermaidEtag()}"`;
2631
+ res.setHeader("ETag", etag);
2632
+ res.setHeader("Cache-Control", "no-cache");
2633
+ const ifNoneMatch = req.headers["if-none-match"];
2634
+ if (typeof ifNoneMatch === "string" && ifNoneMatch.split(",").some((value) => value.trim() === etag)) {
2635
+ res.statusCode = 304;
2636
+ res.end();
2637
+ return;
2638
+ }
2492
2639
  res.statusCode = 200;
2493
2640
  res.setHeader("Content-Type", "text/javascript; charset=utf-8");
2494
- res.setHeader("Cache-Control", "no-store");
2641
+ res.setHeader("Content-Length", String(Buffer.byteLength(script, "utf8")));
2495
2642
  res.end(script);
2496
2643
  }
2497
2644
  },
@@ -17,7 +17,7 @@ interface InputStateLike {
17
17
  }
18
18
  /** Minimal input-actions face the framework injects into input-region slots. */
19
19
  interface InputActionsLike {
20
- setDraft(text: string, editRange?: unknown): void;
20
+ setDraft(text: string): void;
21
21
  }
22
22
  /** Minimal workspace row face (official WorkspaceView carries workspaceId). */
23
23
  interface WorkspaceRowLike {
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Pure timeline-diff helpers for the browser half: reuse unchanged items so a
3
+ * 3-second poll that appends one turn does not invalidate every turn-tail row,
4
+ * and derive a compact DOM identity for an in-place Mermaid block.
5
+ * @module @alexpeng/dsh-custom-plugin/client/timeline-diff
6
+ */
7
+ import type { TimelineItem } from '../protocol.ts';
8
+ /** Whether two timeline entries would render identically. */
9
+ export declare function sameTimelineItem(a: TimelineItem, b: TimelineItem): boolean;
10
+ /** One poll's diff against the previous snapshot. */
11
+ export interface TimelineDiff {
12
+ /** Next items, with unchanged entries kept by reference. */
13
+ items: TimelineItem[];
14
+ /** seq → item index over {@link items}. */
15
+ bySeq: Map<number, TimelineItem>;
16
+ /** False when the previous snapshot renders identically (no store write). */
17
+ changed: boolean;
18
+ }
19
+ /**
20
+ * Diff one fetched timeline against the previous snapshot by sequence.
21
+ * @param previous - previous ordered items, or null when this is the first fetch.
22
+ * @param previousBySeq - seq index for `previous` (same generation), or null.
23
+ * @param next - freshly fetched items.
24
+ * @returns reused items plus whether any rendered field changed.
25
+ */
26
+ export declare function reuseTimelineItems(previous: readonly TimelineItem[] | null, previousBySeq: ReadonlyMap<number, TimelineItem> | null, next: readonly TimelineItem[]): TimelineDiff;
27
+ /** Compact DOM identity for a rendered Mermaid block. A 32-bit FNV-1a hash
28
+ * plus the source length is enough to distinguish live blocks without
29
+ * duplicating every diagram's text into a `data-*` attribute. */
30
+ export declare function mermaidCodeKey(code: string): string;
@@ -69,6 +69,7 @@ export declare class CustomPluginHost {
69
69
  private mermaidBytesValue;
70
70
  private mermaidJs;
71
71
  private mermaidSource;
72
+ private mermaidEtagValue;
72
73
  private localMermaidPath;
73
74
  private readCredential;
74
75
  private credentialCache;
@@ -180,14 +181,22 @@ export declare class CustomPluginHost {
180
181
  * the host lifetime). */
181
182
  mermaidFetch(): Promise<MermaidFetchResult>;
182
183
  private mermaidFetchImpl;
184
+ /** Cache the engine and its validators. `bytes` is UTF-8 length, not the
185
+ * JavaScript string length: the status/debug payloads call it bytes, and a
186
+ * non-ASCII bundle would otherwise under-report the transfer size. */
187
+ private cacheMermaid;
183
188
  /** The cached Mermaid engine script (served at the script path). */
184
189
  mermaidScript(): string;
185
190
  /** Mermaid engine byte count for diagnostics. */
186
191
  mermaidBytes(): number;
192
+ /** Cache validator for the engine script ('' while unloaded). */
193
+ mermaidEtag(): string;
187
194
  /** Where the engine came from: 'local', 'cdn', or '' while unloaded. */
188
195
  mermaidLoadedSource(): string;
189
196
  /** Whether any DeepSeek key source resolves (state, environment, credential
190
- * file) — the honest answer behind the panel's "key configured" badge. */
197
+ * file) — the honest answer behind the panel's "key configured" badge.
198
+ * Goes through the 5s source cache: the status tool and About tab call this
199
+ * independently of `/state`, and each miss hits the OS keychain plus a file. */
191
200
  hasApiKey(): Promise<boolean>;
192
201
  /** Diagnostics snapshot for the status tool and the About tab. */
193
202
  debugInfo(): Promise<{
@@ -9,5 +9,6 @@
9
9
  */
10
10
  import type { WebRoute } from '@deepseek-ai/dsh-host-webserver';
11
11
  import type { CustomPluginHost } from './host-service.ts';
12
+ export declare const STATE_BODY_LIMIT: number;
12
13
  /** Build the plugin's route set. */
13
14
  export declare function makeCustomPluginRoutes(host: CustomPluginHost, ready?: Promise<void>): WebRoute[];
@@ -14,6 +14,15 @@ export interface UsageRecord {
14
14
  }
15
15
  /** Number of Beijing calendar days retained in the local usage ledger. */
16
16
  export declare const USAGE_RETENTION_DAYS = 90;
17
+ /**
18
+ * Rebuild a persisted usage ledger from untrusted JSON: keep day buckets and
19
+ * model rows that are objects, coerce every counter to a finite non-negative
20
+ * number, and drop prototype-polluting model keys. This is the load-side
21
+ * counterpart of the browser shape gates; without it a hand-edited or
22
+ * half-written document could make later folds throw (or concatenate a string
23
+ * into a counter) while every save kept succeeding.
24
+ */
25
+ export declare function normalizeUsageMap(raw: unknown): UsageMap;
17
26
  /** Create a row whose peak/off-peak split is exact from its first event. */
18
27
  export declare function createUsageRow(): UsageRow;
19
28
  /** Whether a row has enough persisted information for exact tariff math. */
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: appearance, 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.7.1",
4
+ "version": "0.8.0",
5
5
  "type": "module",
6
6
  "icon": "./icon.svg",
7
7
  "main": "lib/index.js",
@@ -45,8 +45,9 @@
45
45
  "homepage": "https://github.com/AlexPeng07/dsh-custom-plugin#readme",
46
46
  "engines": {
47
47
  "node": ">=22",
48
- "dsh": ">=0.1.7-rc.2 <0.2.0-0 || >=0.2.0-rc.2 <0.2.0-rc.3"
48
+ "dsh": ">=0.1.7-rc.2 <0.2.0-0 || >=0.2.0-rc.2 <0.2.0-rc.3 || >=0.2.1-rc.2 <0.2.1-rc.3"
49
49
  },
50
+ "packageManager": "pnpm@11.28.5",
50
51
  "scripts": {
51
52
  "build": "tsc -p tsconfig.build.json && tsdown",
52
53
  "bundle": "tsdown",
@@ -56,27 +57,27 @@
56
57
  "test:watch": "vitest",
57
58
  "check:readme": "node scripts/check-readme-i18n.mjs",
58
59
  "smoke": "node scripts/smoke.mjs",
59
- "prepare": "pnpm build",
60
- "prepublishOnly": "pnpm typecheck && pnpm test"
60
+ "prepare": "npm run build",
61
+ "prepublishOnly": "tsc --noEmit && vitest run"
61
62
  },
62
63
  "peerDependencies": {
63
64
  "@deepseek-ai/cordis": "^4.0.4",
64
- "@deepseek-ai/dsh-tools": ">=0.1.7-rc.2 <0.2.0-0 || >=0.2.0-rc.2 <0.2.0-rc.3"
65
+ "@deepseek-ai/dsh-tools": ">=0.1.7-rc.2 <0.2.0-0 || >=0.2.0-rc.2 <0.2.0-rc.3 || >=0.2.1-rc.2 <0.2.1-rc.3"
65
66
  },
66
67
  "dependencies": {
67
68
  "mermaid": "^11.6.0"
68
69
  },
69
70
  "devDependencies": {
70
- "@deepseek-ai/cordis": "^4.0.4",
71
- "@deepseek-ai/dsh-attachment": "0.2.0-rc.2",
72
- "@deepseek-ai/dsh-client-store": "0.2.0-rc.2",
73
- "@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.2",
74
- "@deepseek-ai/dsh-client-ui-theme": "0.2.0-rc.2",
75
- "@deepseek-ai/dsh-host-webserver": "0.2.0-rc.2",
76
- "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
77
- "@deepseek-ai/dsh-session": "0.2.0-rc.2",
78
- "@deepseek-ai/dsh-session-query": "0.2.0-rc.2",
79
- "@deepseek-ai/dsh-tools": "0.2.0-rc.2",
71
+ "@deepseek-ai/cordis": "^4.0.5",
72
+ "@deepseek-ai/dsh-attachment": "0.2.1-rc.2",
73
+ "@deepseek-ai/dsh-client-store": "0.2.1-rc.2",
74
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.2",
75
+ "@deepseek-ai/dsh-client-ui-theme": "0.2.1-rc.2",
76
+ "@deepseek-ai/dsh-host-webserver": "0.2.1-rc.2",
77
+ "@deepseek-ai/dsh-llm": "0.2.1-rc.2",
78
+ "@deepseek-ai/dsh-session": "0.2.1-rc.2",
79
+ "@deepseek-ai/dsh-session-query": "0.2.1-rc.2",
80
+ "@deepseek-ai/dsh-tools": "0.2.1-rc.2",
80
81
  "@types/node": "^22.20.0",
81
82
  "@types/react": "~18.3.1",
82
83
  "@types/react-dom": "^18.3.5",