@alexpeng/dsh-custom-plugin 0.9.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1687 -850
- package/NOTICE +71 -0
- package/README.i18n.yaml +2 -2
- package/README.md +344 -335
- package/README.zh.md +309 -302
- package/lib/client.js +9416 -2002
- package/lib/client.js.map +1 -1
- package/lib/index.js +233 -99
- package/lib/types/balance.d.ts +44 -0
- package/lib/types/client/api.d.ts +13 -8
- package/lib/types/client/bg-ascii.d.ts +397 -0
- package/lib/types/client/bg-field.d.ts +60 -0
- package/lib/types/client/bg-focus.d.ts +63 -0
- package/lib/types/client/bg-layer.d.ts +152 -0
- package/lib/types/client/bg-ocean.d.ts +31 -0
- package/lib/types/client/bg-params.d.ts +142 -0
- package/lib/types/client/bg-pointer.d.ts +107 -0
- package/lib/types/client/bg-shader.d.ts +329 -0
- package/lib/types/client/bg-wake.d.ts +57 -0
- package/lib/types/client/custom.d.ts +4 -1
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/palette.d.ts +100 -0
- package/lib/types/client/panel-bounds.d.ts +65 -0
- package/lib/types/client/styles.d.ts +9 -4
- package/lib/types/client/ui/anchor.d.ts +55 -0
- package/lib/types/client/ui/appearance-controls.d.ts +24 -0
- package/lib/types/client/ui/command-model.d.ts +28 -0
- package/lib/types/client/ui/folders-model.d.ts +31 -0
- package/lib/types/client/ui/index-bridge.d.ts +6 -0
- package/lib/types/client/ui/overlays.d.ts +66 -0
- package/lib/types/client/ui/primitives.d.ts +93 -0
- package/lib/types/client/ui/prompt-model.d.ts +37 -0
- package/lib/types/host-service.d.ts +68 -15
- package/lib/types/pricing.d.ts +8 -4
- package/lib/types/protocol.d.ts +48 -2
- package/lib/types/usage.d.ts +8 -4
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +13 -12
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Presentational primitives shared by the native-feeling surfaces.
|
|
3
|
+
*
|
|
4
|
+
* Every visual value comes from the host's `--dsw-*` / `--ds-*` tokens (see
|
|
5
|
+
* styles.ts); these components only own structure, state and a11y semantics.
|
|
6
|
+
* @module @alexpeng/dsh-custom-plugin/client/ui/primitives
|
|
7
|
+
*/
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
/** Join class names, dropping falsy entries. */
|
|
10
|
+
export declare function cx(...parts: Array<string | false | null | undefined>): string;
|
|
11
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';
|
|
12
|
+
export type ButtonSize = 'sm' | 'md';
|
|
13
|
+
export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
14
|
+
variant?: ButtonVariant;
|
|
15
|
+
size?: ButtonSize;
|
|
16
|
+
block?: boolean;
|
|
17
|
+
icon?: React.ReactNode;
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/** Text button in the host's control language. */
|
|
21
|
+
export declare function Button(props: ButtonProps): React.ReactElement;
|
|
22
|
+
export interface IconButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'aria-label'> {
|
|
23
|
+
label: string;
|
|
24
|
+
icon: React.ReactNode;
|
|
25
|
+
size?: 'sm' | 'md';
|
|
26
|
+
}
|
|
27
|
+
/** Square icon-only button; the label is mandatory for screen readers. */
|
|
28
|
+
export declare function IconButton(props: IconButtonProps): React.ReactElement;
|
|
29
|
+
export interface SwitchProps {
|
|
30
|
+
label: string;
|
|
31
|
+
checked: boolean;
|
|
32
|
+
onChange: (value: boolean) => void;
|
|
33
|
+
hint?: string;
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
id?: string;
|
|
36
|
+
}
|
|
37
|
+
/** Host-style switch row: label left, track right, optional hint below. */
|
|
38
|
+
export declare function Switch(props: SwitchProps): React.ReactElement;
|
|
39
|
+
export interface SegmentedOption<T extends string> {
|
|
40
|
+
value: T;
|
|
41
|
+
label: string;
|
|
42
|
+
icon?: React.ReactNode;
|
|
43
|
+
}
|
|
44
|
+
export interface SegmentedProps<T extends string> {
|
|
45
|
+
value: T;
|
|
46
|
+
options: ReadonlyArray<SegmentedOption<T>>;
|
|
47
|
+
onChange: (value: T) => void;
|
|
48
|
+
label?: string;
|
|
49
|
+
ariaLabel?: string;
|
|
50
|
+
}
|
|
51
|
+
/** Segmented control for small mutually-exclusive choices. */
|
|
52
|
+
export declare function Segmented<T extends string>(props: SegmentedProps<T>): React.ReactElement;
|
|
53
|
+
export interface FieldProps {
|
|
54
|
+
label: string;
|
|
55
|
+
hint?: string;
|
|
56
|
+
error?: string | null;
|
|
57
|
+
htmlFor?: string;
|
|
58
|
+
children?: React.ReactNode;
|
|
59
|
+
}
|
|
60
|
+
/** Label + control + hint/error block. */
|
|
61
|
+
export declare function Field(props: FieldProps): React.ReactElement;
|
|
62
|
+
export interface CardProps {
|
|
63
|
+
title?: string;
|
|
64
|
+
description?: string;
|
|
65
|
+
actions?: React.ReactNode;
|
|
66
|
+
children?: React.ReactNode;
|
|
67
|
+
className?: string;
|
|
68
|
+
id?: string;
|
|
69
|
+
}
|
|
70
|
+
/** Settings card: host surface, title row, optional description and body. */
|
|
71
|
+
export declare function Card(props: CardProps): React.ReactElement;
|
|
72
|
+
export interface EmptyStateProps {
|
|
73
|
+
title: string;
|
|
74
|
+
hint?: string;
|
|
75
|
+
icon?: React.ReactNode;
|
|
76
|
+
action?: React.ReactNode;
|
|
77
|
+
}
|
|
78
|
+
/** Consistent empty state for lists and panels. */
|
|
79
|
+
export declare function EmptyState(props: EmptyStateProps): React.ReactElement;
|
|
80
|
+
/** Inline loading indicator with an accessible status label. */
|
|
81
|
+
export declare function Spinner(props: {
|
|
82
|
+
label?: string;
|
|
83
|
+
}): React.ReactElement;
|
|
84
|
+
export interface BadgeProps {
|
|
85
|
+
children?: React.ReactNode;
|
|
86
|
+
tone?: 'neutral' | 'accent' | 'danger' | 'success';
|
|
87
|
+
}
|
|
88
|
+
/** Small count/status pill. */
|
|
89
|
+
export declare function Badge(props: BadgeProps): React.ReactElement;
|
|
90
|
+
/** Keyboard keycap. */
|
|
91
|
+
export declare function Kbd(props: {
|
|
92
|
+
children: React.ReactNode;
|
|
93
|
+
}): React.ReactElement;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure prompt-library operations: tag normalization, validation, filtering,
|
|
3
|
+
* sorting and import merging. Kept DOM-free so the panel stays presentational
|
|
4
|
+
* and these rules can be unit tested.
|
|
5
|
+
* @module @alexpeng/dsh-custom-plugin/client/ui/prompt-model
|
|
6
|
+
*/
|
|
7
|
+
import type { PromptItem } from '../../protocol.ts';
|
|
8
|
+
export type PromptSort = 'manual' | 'recent' | 'used' | 'name';
|
|
9
|
+
export type PromptImportMode = 'merge' | 'replace';
|
|
10
|
+
export interface PromptDraft {
|
|
11
|
+
name: string;
|
|
12
|
+
text: string;
|
|
13
|
+
tags: string[];
|
|
14
|
+
}
|
|
15
|
+
/** Split, trim and de-duplicate tags (case-insensitive) while keeping order. */
|
|
16
|
+
export declare function normalizeTags(input: string | readonly string[]): string[];
|
|
17
|
+
/** Validation errors for the editor; an empty array means the draft is valid. */
|
|
18
|
+
export declare function validatePromptDraft(draft: PromptDraft): string[];
|
|
19
|
+
/** Every distinct tag across the library, sorted for the filter menu. */
|
|
20
|
+
export declare function allTags(items: readonly PromptItem[]): string[];
|
|
21
|
+
export interface PromptFilter {
|
|
22
|
+
query?: string;
|
|
23
|
+
tag?: string | null;
|
|
24
|
+
favoritesOnly?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** Filter by free text, one tag and the favourites switch. */
|
|
27
|
+
export declare function filterPrompts(items: readonly PromptItem[], filter: PromptFilter): PromptItem[];
|
|
28
|
+
/** Stable sort for the four supported orders. */
|
|
29
|
+
export declare function sortPrompts(items: readonly PromptItem[], sort: PromptSort): PromptItem[];
|
|
30
|
+
export interface ImportResult {
|
|
31
|
+
next: PromptItem[];
|
|
32
|
+
added: number;
|
|
33
|
+
updated: number;
|
|
34
|
+
removed: number;
|
|
35
|
+
}
|
|
36
|
+
/** Merge an imported set by id, or replace the whole library. */
|
|
37
|
+
export declare function mergePromptImport(current: readonly PromptItem[], incoming: readonly PromptItem[], mode: PromptImportMode): ImportResult;
|
|
@@ -26,6 +26,50 @@ type MermaidFetchResult = {
|
|
|
26
26
|
ok: false;
|
|
27
27
|
error: string;
|
|
28
28
|
};
|
|
29
|
+
/** Minimal wallet face of the DSH account service (Settings → 账号与余额). */
|
|
30
|
+
export interface AccountWalletLike {
|
|
31
|
+
readonly currency: string;
|
|
32
|
+
readonly balance: string;
|
|
33
|
+
}
|
|
34
|
+
/** The account service's balance outcome, mirrored locally so the plugin does
|
|
35
|
+
* not take a hard dependency on `@deepseek-ai/dsh-deepseek-account`. */
|
|
36
|
+
export type AccountBalanceLike = {
|
|
37
|
+
readonly status: 'ready';
|
|
38
|
+
readonly value: readonly AccountWalletLike[];
|
|
39
|
+
readonly bonusWallets: readonly AccountWalletLike[];
|
|
40
|
+
} | {
|
|
41
|
+
readonly status: 'failed';
|
|
42
|
+
};
|
|
43
|
+
/** Platform links the account service exposes for the balance rows. */
|
|
44
|
+
export interface AccountLinksLike {
|
|
45
|
+
readonly usageUrl: string;
|
|
46
|
+
readonly topUpUrl: string;
|
|
47
|
+
}
|
|
48
|
+
/** Wrapper used by the host entry: `pending` means the account is signed in
|
|
49
|
+
* but the wallet query has not settled (a startup grant race), so the caller
|
|
50
|
+
* must retry instead of showing an error. */
|
|
51
|
+
export type AccountBalanceOutcome = {
|
|
52
|
+
readonly status: 'ready';
|
|
53
|
+
readonly value: readonly AccountWalletLike[];
|
|
54
|
+
readonly bonusWallets: readonly AccountWalletLike[];
|
|
55
|
+
readonly links?: AccountLinksLike;
|
|
56
|
+
} | {
|
|
57
|
+
readonly status: 'failed';
|
|
58
|
+
readonly links?: AccountLinksLike;
|
|
59
|
+
} | {
|
|
60
|
+
readonly status: 'signed-out';
|
|
61
|
+
readonly links?: AccountLinksLike;
|
|
62
|
+
} | {
|
|
63
|
+
readonly status: 'pending';
|
|
64
|
+
readonly links?: AccountLinksLike;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Sum the account's normal (recharge) and bonus wallets into the balance shape
|
|
68
|
+
* the header card renders. CNY wins when both currencies exist, matching the
|
|
69
|
+
* balance endpoint's own preference; decimal strings are summed as numbers and
|
|
70
|
+
* re-quantized to two decimals for display.
|
|
71
|
+
*/
|
|
72
|
+
export declare function balanceFromAccountWallets(normal: readonly AccountWalletLike[], bonus: readonly AccountWalletLike[]): BalanceInfo | null;
|
|
29
73
|
/** Options the loader entry supplies to the host service. */
|
|
30
74
|
export interface CustomPluginHostOptions {
|
|
31
75
|
sessionQuery: SessionQueryEngine;
|
|
@@ -47,6 +91,10 @@ export interface CustomPluginHostOptions {
|
|
|
47
91
|
readCredential?: () => Promise<string>;
|
|
48
92
|
/** Test seam and optional platform adapter for OS credential storage. */
|
|
49
93
|
credentialStore?: CredentialStore;
|
|
94
|
+
/** DSH account balance source (the same service Settings → 账号与余额 uses).
|
|
95
|
+
* Resolves `undefined` when the account service is absent (web profile),
|
|
96
|
+
* otherwise a signed-out / pending / ready / failed outcome. */
|
|
97
|
+
accountBalance?: () => Promise<AccountBalanceOutcome | undefined>;
|
|
50
98
|
}
|
|
51
99
|
/** Host capabilities behind the routes and the agent tool. */
|
|
52
100
|
export declare class CustomPluginHost {
|
|
@@ -57,7 +105,11 @@ export declare class CustomPluginHost {
|
|
|
57
105
|
private readonly diagReports;
|
|
58
106
|
private readonly attachments;
|
|
59
107
|
private readonly credentialStore;
|
|
108
|
+
private readonly accountBalance;
|
|
60
109
|
private readonly sessionModel;
|
|
110
|
+
/** Last model seen on any session; attributes events (title generation,
|
|
111
|
+
* synthetic turns) that arrive before their own `request/context`. */
|
|
112
|
+
private lastKnownModel;
|
|
61
113
|
private stateOperation;
|
|
62
114
|
private stateOperationActive;
|
|
63
115
|
private stateOperationPending;
|
|
@@ -94,7 +146,8 @@ export declare class CustomPluginHost {
|
|
|
94
146
|
rememberModel(sessionId: string, model: string | null): void;
|
|
95
147
|
forgetSession(sessionId: string): void;
|
|
96
148
|
/** Fold one assistant/message usage record into the ledger. The event time
|
|
97
|
-
* decides
|
|
149
|
+
* decides the day bucket; the peak counters are legacy telemetry (the
|
|
150
|
+
* current official tariff is flat). */
|
|
98
151
|
foldUsage(sessionId: string, usage: UsageRecord, time?: number, modelOverride?: string | null): void;
|
|
99
152
|
private foldUsageNow;
|
|
100
153
|
/** Snapshot of browser-safe state; the API key value never crosses this boundary. */
|
|
@@ -161,14 +214,24 @@ export declare class CustomPluginHost {
|
|
|
161
214
|
private resolveApiKey;
|
|
162
215
|
/** Browser-safe credential status used by state and save responses. */
|
|
163
216
|
credentialStatus(): Promise<Pick<CustomPluginPublicState, 'apiKeyConfigured' | 'credentialStorage'>>;
|
|
164
|
-
/**
|
|
217
|
+
/**
|
|
218
|
+
* Balance for the header card and the usage tab. The DSH account service is
|
|
219
|
+
* the only source — it is the same recharge + bonus wallet query the
|
|
220
|
+
* Settings 「账号与余额」 page renders, so a signed-in desktop needs no sk- key.
|
|
221
|
+
* The result distinguishes signed-out / pending / failed so the UI can show
|
|
222
|
+
* the right hint instead of a generic failure.
|
|
223
|
+
*/
|
|
165
224
|
balanceGet(): Promise<{
|
|
166
225
|
ok: boolean;
|
|
167
|
-
keyConfigured: boolean;
|
|
168
226
|
balance?: BalanceInfo | null;
|
|
169
|
-
|
|
227
|
+
links?: AccountLinksLike;
|
|
170
228
|
usageToday?: unknown;
|
|
171
|
-
|
|
229
|
+
error?: string | null;
|
|
230
|
+
source?: 'account';
|
|
231
|
+
accountError?: string | null;
|
|
232
|
+
accountSignedOut?: boolean;
|
|
233
|
+
accountPending?: boolean;
|
|
234
|
+
accountUnavailable?: boolean;
|
|
172
235
|
}>;
|
|
173
236
|
/** Re-scan the session logs and rebuild today's usage ledger. Every session
|
|
174
237
|
* is replayed but only usage events whose own timestamp falls on today are
|
|
@@ -209,17 +272,7 @@ export declare class CustomPluginHost {
|
|
|
209
272
|
diagReports: string[];
|
|
210
273
|
}>;
|
|
211
274
|
private httpText;
|
|
212
|
-
private httpJson;
|
|
213
275
|
}
|
|
214
|
-
/**
|
|
215
|
-
* Translate a Node `fetch` connection-level failure into a message a user can
|
|
216
|
-
* act on. Node reports "fetch failed" with the real reason in `error.cause`
|
|
217
|
-
* (e.g. `SELF_SIGNED_CERT_IN_CHAIN` — a local TLS-intercepting proxy or
|
|
218
|
-
* security suite, which makes outbound calls fail *intermittently* whenever
|
|
219
|
-
* the interceptor takes the connection), and passing the bare TypeError
|
|
220
|
-
* through once read as a mysterious network that "sometimes does not exist".
|
|
221
|
-
*/
|
|
222
|
-
export declare function readableFetchError(error: unknown): string;
|
|
223
276
|
/** Resolve `mermaid/dist/mermaid.min.js` from the package's own dependency
|
|
224
277
|
* tree (works for `link:` checkouts and registry installs alike); null when
|
|
225
278
|
* the dependency is absent, which falls mermaidFetch back to the CDN. */
|
package/lib/types/pricing.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* DeepSeek cost-estimation helpers shared by the host-facing usage model and
|
|
3
|
-
* the browser panel. Prices are CNY per 1M tokens
|
|
4
|
-
*
|
|
3
|
+
* the browser panel. Prices are the official peak CNY rates per 1M tokens;
|
|
4
|
+
* off-peak is exactly half (Beijing weekdays 09–12 / 14–18 are peak, weekends
|
|
5
|
+
* and Chinese statutory holidays are off-peak all day).
|
|
5
6
|
* @module @alexpeng/dsh-custom-plugin/pricing
|
|
6
7
|
*/
|
|
7
8
|
import type { UsageRow } from './protocol.ts';
|
|
8
9
|
/** Official source used for the built-in estimate and shown in the panel. */
|
|
9
10
|
export declare const DEEPSEEK_PRICING_SOURCE_URL = "https://api-docs.deepseek.com/zh-cn/quick_start/pricing/";
|
|
10
11
|
/** Date on which the built-in rule was checked against the official page. */
|
|
11
|
-
export declare const DEEPSEEK_PRICING_CHECKED_ON = "2026-
|
|
12
|
+
export declare const DEEPSEEK_PRICING_CHECKED_ON = "2026-11-14";
|
|
13
|
+
/** One-line tariff summary shown under the usage tables. */
|
|
14
|
+
export declare const DEEPSEEK_PRICING_NOTE = "\u5B98\u65B9\u5CF0\u8C37\u4EF7\uFF08\u6BCF\u767E\u4E07 tokens\uFF09\uFF1AFlash \u5CF0\u65F6\u8F93\u5165 \u00A52 / \u7F13\u5B58\u547D\u4E2D \u00A50.04 / \u8F93\u51FA \u00A58\uFF0CPro \u00A59 / \u00A50.30 / \u00A527\uFF1B\u7A7A\u95F2\u65F6\u6BB5\u534A\u4EF7\uFF08\u5DE5\u4F5C\u65E5 9\u201312\u300114\u201318 \u4E3A\u5CF0\u65F6\uFF0C\u5468\u672B\u4E0E\u6CD5\u5B9A\u8282\u5047\u65E5\u5168\u5929\u7A7A\u95F2\uFF09";
|
|
12
15
|
export interface DeepSeekUnitPrice {
|
|
13
16
|
/** Uncached input / cache-miss input price. */
|
|
14
17
|
input: number;
|
|
@@ -26,7 +29,8 @@ export interface UsageCostBreakdown {
|
|
|
26
29
|
offPeakCostCny: number;
|
|
27
30
|
totalCostCny: number;
|
|
28
31
|
}
|
|
29
|
-
/** Resolve a model's peak price
|
|
32
|
+
/** Resolve a model's peak price. Exact ids first; any other `*pro*` id uses
|
|
33
|
+
* Pro pricing, and everything else falls back to Flash (the shipped default). */
|
|
30
34
|
export declare function priceOf(model: string): DeepSeekUnitPrice;
|
|
31
35
|
/**
|
|
32
36
|
* Split one row into peak/off-peak token volume and CNY cost. Rows without
|
package/lib/types/protocol.d.ts
CHANGED
|
@@ -12,11 +12,59 @@
|
|
|
12
12
|
export declare const CUSTOM_PLUGIN_API_PREFIX = "/api/custom-plugin";
|
|
13
13
|
/** Path the host serves the fetched Mermaid engine at (script src). */
|
|
14
14
|
export declare const MERMAID_SCRIPT_PATH = "/custom-plugin/mermaid.js";
|
|
15
|
+
/** ASCII preset ids; keep in sync with `ASCII_PRESETS` in `client/bg-ascii.ts`. */
|
|
16
|
+
export declare const BG_FX_ASCII_PRESETS: readonly ["flow", "rain", "ocean", "starfield", "ripple", "static"];
|
|
17
|
+
/** Shader style ids; keep in sync with `SHADER_STYLES` in `client/bg-shader.ts`. */
|
|
18
|
+
export declare const BG_FX_SHADER_STYLES: readonly ["liquid", "grain"];
|
|
19
|
+
/** The `bgFxPreset` value space: one flat string across both renderer tiers.
|
|
20
|
+
* `normalizeCfg` narrows it to the set that matches the active `bgFx` mode. */
|
|
21
|
+
export type BgFxPreset = (typeof BG_FX_ASCII_PRESETS)[number] | (typeof BG_FX_SHADER_STYLES)[number];
|
|
22
|
+
/** Background ink-strength choices, soft → standard → strong. This is the
|
|
23
|
+
* intuitive "it looks too faint / too loud" outlet; it only scales the ink's
|
|
24
|
+
* lightness step and never touches density, speed or frame rate. */
|
|
25
|
+
export declare const BG_STRENGTHS: readonly ["soft", "standard", "strong"];
|
|
26
|
+
/** One of {@link BG_STRENGTHS}. */
|
|
27
|
+
export type BgStrength = (typeof BG_STRENGTHS)[number];
|
|
15
28
|
/** Plugin appearance and behavior configuration, persisted in the host state file. */
|
|
16
29
|
export interface CustomPluginConfig {
|
|
17
30
|
/** Background preset: 'default' (no color) or one of the 20 palette names.
|
|
18
31
|
* The removed 'aurora' value migrates to 'default' on load. */
|
|
19
32
|
bg?: string;
|
|
33
|
+
/** Animated page-background layer below the content surfaces. `'none'` is
|
|
34
|
+
* off; `'ascii'` runs the character renderer; `'shader'` runs the WebGL1
|
|
35
|
+
* full-screen fragment renderer (falling back to ASCII without WebGL). Flat
|
|
36
|
+
* string on purpose because `normalizeCfg` drops nested values; a Phase 1
|
|
37
|
+
* boolean migrates (true → 'ascii', false → 'none'). */
|
|
38
|
+
bgFx?: 'none' | 'ascii' | 'shader';
|
|
39
|
+
/** Which piece runs in the active tier: the ASCII ids ('flow', 'rain',
|
|
40
|
+
* 'ocean', 'starfield', 'ripple', 'static') or the shader ids ('liquid',
|
|
41
|
+
* 'grain'). One flat field for both because the two tiers never coexist;
|
|
42
|
+
* `normalizeCfg` resets it into the set that matches `bgFx`. Unknown values
|
|
43
|
+
* fall back to the tier default (`'flow'` / `'liquid'`). */
|
|
44
|
+
bgFxPreset?: BgFxPreset;
|
|
45
|
+
/** Ink strength: 'soft' | 'standard' | 'strong'. Default 'soft' (the
|
|
46
|
+
* calibrated default feel, paired with the ocean preset's 0.6 density).
|
|
47
|
+
* It scales the per-piece ink step only; density, speed and frame rate are
|
|
48
|
+
* unaffected. Unknown values fall back to 'soft'. */
|
|
49
|
+
bgStrength?: BgStrength;
|
|
50
|
+
/** Background tunable overrides. One flat numeric field per knob because
|
|
51
|
+
* `normalizeCfg` drops nested values. `BG_PARAM_UNSET` (-1) means "follow
|
|
52
|
+
* the active preset"; any other value is clamped into that preset's
|
|
53
|
+
* declared `ranges` by the renderer and by the panel. The ASCII tier uses
|
|
54
|
+
* density/speed/fps/fontPx/opacity, the shader tier uses
|
|
55
|
+
* density/speed/fps/intensity. */
|
|
56
|
+
bgDensity?: number;
|
|
57
|
+
bgSpeed?: number;
|
|
58
|
+
bgFps?: number;
|
|
59
|
+
bgFontPx?: number;
|
|
60
|
+
bgOpacity?: number;
|
|
61
|
+
bgIntensity?: number;
|
|
62
|
+
/** Calm zone toggle ("避让正文"): when true the reading column keeps a faint
|
|
63
|
+
* texture while the gutters stay at full strength; when false no mask is
|
|
64
|
+
* computed at all and the whole page is uniform. Flat boolean because
|
|
65
|
+
* `normalizeCfg` drops nested values; a document without the field is
|
|
66
|
+
* treated as `true` (the shipped behaviour) with no migration prompt. */
|
|
67
|
+
bgFocus?: boolean;
|
|
20
68
|
/** Weather overlay: 'none' | 'snow' | 'rain' | 'sakura'. */
|
|
21
69
|
weather?: string;
|
|
22
70
|
/** Master glass toggle for the plugin's own surfaces. */
|
|
@@ -25,8 +73,6 @@ export interface CustomPluginConfig {
|
|
|
25
73
|
glassMode?: 'frost' | 'liquid';
|
|
26
74
|
/** Apply backdrop blur to global dialogs/menus/tooltips as well. */
|
|
27
75
|
globalGlass?: boolean;
|
|
28
|
-
/** Enable the selection-quote-reply feature. */
|
|
29
|
-
quote?: boolean;
|
|
30
76
|
/** Force `scroll-behavior: auto` to stop automatic jump-to-bottom. */
|
|
31
77
|
antiScroll?: boolean;
|
|
32
78
|
/** Show LaTeX / MathML copy chips under matching messages. */
|
package/lib/types/usage.d.ts
CHANGED
|
@@ -30,9 +30,12 @@ export declare function hasKnownPeakSplit(row: UsageRow): boolean;
|
|
|
30
30
|
/** Beijing-time (UTC+8) day key `YYYY-MM-DD`. */
|
|
31
31
|
export declare function dayKey(time?: number): string;
|
|
32
32
|
/** DeepSeek peak billing window: Beijing Monday-Friday 09:00-12:00 /
|
|
33
|
-
* 14:00-18:00; all weekend hours
|
|
34
|
-
*
|
|
33
|
+
* 14:00-18:00, excluding Chinese statutory holidays; all weekend hours and
|
|
34
|
+
* holidays are off-peak. Evaluated on China Standard Time so the split matches
|
|
35
|
+
* the published schedule on any host timezone. */
|
|
35
36
|
export declare function isPeakHour(time: number): boolean;
|
|
37
|
+
/** Whether the Beijing calendar day is a Chinese statutory holiday. */
|
|
38
|
+
export declare function isStatutoryHoliday(time: number): boolean;
|
|
36
39
|
/** Remove malformed or expired day buckets from the persisted usage ledger. */
|
|
37
40
|
export declare function pruneUsage(usage: UsageMap, now?: number, retentionDays?: number): number;
|
|
38
41
|
/** Fold one usage record into a ledger row, tracking the peak-hour portion. */
|
|
@@ -43,5 +46,6 @@ export declare function mergeUsageRow(target: UsageRow, source: UsageRow): void;
|
|
|
43
46
|
* `request/context` events anywhere in the log keep the model tracking in
|
|
44
47
|
* order; only `assistant/message` usage events whose own timestamp falls on
|
|
45
48
|
* `day` are folded, so a session crossing midnight contributes exactly the
|
|
46
|
-
* events it produced that day.
|
|
47
|
-
|
|
49
|
+
* events it produced that day. `fallbackModel` covers logs whose first usage
|
|
50
|
+
* event precedes any `request/context` (the live fold has the same rule). */
|
|
51
|
+
export declare function aggregateDayUsage(events: readonly SessionEvent[], day: string, fallbackModel?: string | null): Record<string, UsageRow>;
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Custom Suite",
|
|
4
|
-
"description": "Personalization, message timeline, project folders, prompt library, export and search, Mermaid,
|
|
4
|
+
"description": "Personalization, message timeline, project folders, prompt library, export and search, Mermaid, and DeepSeek balance / token usage for the DSH Web GUI."
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
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: appearance, folders, prompts, session export/search, Mermaid,
|
|
4
|
-
"version": "0.
|
|
3
|
+
"description": "Custom convenience suite for the dsh web GUI: appearance, folders, prompts, session export/search, Mermaid, 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.10.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"icon": "./icon.svg",
|
|
7
7
|
"main": "lib/index.js",
|
|
@@ -71,15 +71,15 @@
|
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@deepseek-ai/cordis": "^4.0.5",
|
|
74
|
-
"@deepseek-ai/dsh-attachment": "0.2.1-rc.
|
|
75
|
-
"@deepseek-ai/dsh-client-store": "0.2.1-rc.
|
|
76
|
-
"@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.
|
|
77
|
-
"@deepseek-ai/dsh-client-ui-theme": "0.2.1-rc.
|
|
78
|
-
"@deepseek-ai/dsh-host-webserver": "0.2.1-rc.
|
|
79
|
-
"@deepseek-ai/dsh-llm": "0.2.1-rc.
|
|
80
|
-
"@deepseek-ai/dsh-session": "0.2.1-rc.
|
|
81
|
-
"@deepseek-ai/dsh-session-query": "0.2.1-rc.
|
|
82
|
-
"@deepseek-ai/dsh-tools": "0.2.1-rc.
|
|
74
|
+
"@deepseek-ai/dsh-attachment": "0.2.1-rc.5",
|
|
75
|
+
"@deepseek-ai/dsh-client-store": "0.2.1-rc.5",
|
|
76
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.5",
|
|
77
|
+
"@deepseek-ai/dsh-client-ui-theme": "0.2.1-rc.5",
|
|
78
|
+
"@deepseek-ai/dsh-host-webserver": "0.2.1-rc.5",
|
|
79
|
+
"@deepseek-ai/dsh-llm": "0.2.1-rc.5",
|
|
80
|
+
"@deepseek-ai/dsh-session": "0.2.1-rc.5",
|
|
81
|
+
"@deepseek-ai/dsh-session-query": "0.2.1-rc.5",
|
|
82
|
+
"@deepseek-ai/dsh-tools": "0.2.1-rc.5",
|
|
83
83
|
"@types/node": "^22.20.0",
|
|
84
84
|
"@types/react": "~18.3.1",
|
|
85
85
|
"@types/react-dom": "^18.3.5",
|
|
@@ -99,7 +99,8 @@
|
|
|
99
99
|
"CHANGELOG.md",
|
|
100
100
|
"README.md",
|
|
101
101
|
"README.zh.md",
|
|
102
|
-
"README.i18n.yaml"
|
|
102
|
+
"README.i18n.yaml",
|
|
103
|
+
"NOTICE"
|
|
103
104
|
],
|
|
104
105
|
"license": "Apache-2.0"
|
|
105
106
|
}
|