@alexpeng/dsh-custom-plugin 0.1.0 → 0.1.1

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.
@@ -41,8 +41,8 @@ export declare function apiStateSave(edit: StateEdit): Promise<{
41
41
  ok: false;
42
42
  error?: string;
43
43
  }>;
44
- /** Timeline nodes for one session. */
45
- export declare function apiTimelineGet(sessionId: string, afterSeq?: number): Promise<{
44
+ /** Timeline nodes for one session (tail-capped by the host). */
45
+ export declare function apiTimelineGet(sessionId: string): Promise<{
46
46
  ok: true;
47
47
  sessionId: string;
48
48
  items: TimelineItem[];
@@ -2,7 +2,8 @@
2
2
  * Browser-half entry for dsh-custom-plugin.
3
3
  *
4
4
  * Mounts the Custom UI surfaces (overlay, timeline, folders, prompts,
5
- * balance, quote reply) through the nine slot injections. The slots ledger is
5
+ * balance, quote reply) through eight injections into seven official slots.
6
+ * The slots ledger is
6
7
  * the only coupling point: the declarations are provided by the web shell
7
8
  * itself, so this plugin needs no family-side integration to work. All
8
9
  * surfaces ship plain Chinese copy, with no i18n registration and no polling
@@ -4,12 +4,10 @@
4
4
  * The routes in `routes.ts` are a thin HTTP fence over this class.
5
5
  * @module @alexpeng/dsh-custom-plugin/host-service
6
6
  */
7
- import type { Context } from '@deepseek-ai/cordis';
8
7
  import type { AttachmentStore } from '@deepseek-ai/dsh-attachment';
9
8
  import type { SessionQueryEngine } from '@deepseek-ai/dsh-session-query';
10
9
  import type { BalanceInfo, CustomPluginState, TimelineItem } from './protocol.ts';
11
10
  import { type UsageRecord } from './usage.ts';
12
- export type { BalanceInfo, TimelineItem };
13
11
  /** Options the loader entry supplies to the host service. */
14
12
  export interface CustomPluginHostOptions {
15
13
  sessionQuery: SessionQueryEngine;
@@ -35,10 +33,9 @@ export declare class CustomPluginHost {
35
33
  private readonly diagReports;
36
34
  private readonly attachments;
37
35
  private readonly sessionModel;
38
- private readonly timelineCache;
39
36
  private mermaidBytesValue;
40
37
  private mermaidJs;
41
- constructor(_ctx: Context, options: CustomPluginHostOptions);
38
+ constructor(options: CustomPluginHostOptions);
42
39
  /** Persist the state document (debounced by the loader entry). */
43
40
  persist(): Promise<void>;
44
41
  /** Record a bounded client diagnostic line. */
@@ -59,8 +56,10 @@ export declare class CustomPluginHost {
59
56
  stars?: CustomPluginState['stars'];
60
57
  apiKey?: string;
61
58
  }): void;
62
- /** Timeline nodes for one session, with a 10-second cache. */
63
- timelineGet(sessionId: string, afterSeq: number): Promise<{
59
+ /** Timeline nodes for one session, capped to the 400-node tail. The tail cap
60
+ * bounds the payload (each item carries up to 4k of preview text); 400 keeps
61
+ * dots available when the GUI deep-loads history. */
62
+ timelineGet(sessionId: string): Promise<{
64
63
  ok: true;
65
64
  sessionId: string;
66
65
  items: TimelineItem[];
@@ -104,8 +104,3 @@ export interface BalanceInfo {
104
104
  granted: string;
105
105
  toppedUp: string;
106
106
  }
107
- /** Host response envelope. */
108
- export type ApiResult<T> = {
109
- ok: true;
110
- [key: string]: unknown;
111
- } & T;
@@ -12,11 +12,11 @@ export interface UsageRecord {
12
12
  cacheWriteTokens?: number;
13
13
  reasoningTokens?: number;
14
14
  }
15
- /** Local-timezone day key `YYYY-MM-DD`. */
15
+ /** Beijing-time (UTC+8) day key `YYYY-MM-DD`. */
16
16
  export declare function dayKey(time?: number): string;
17
- /** DeepSeek peak billing window: 09:00-12:00 / 14:00-18:00, off-peak is the
18
- * remainder at half price. Approximated on the host-local clock — the ledger
19
- * day key already uses the same clock. */
17
+ /** DeepSeek peak billing window: Beijing 09:00-12:00 / 14:00-18:00, off-peak is
18
+ * the remainder at half price. Evaluated on China Standard Time so the split
19
+ * matches the published schedule on any host timezone. */
20
20
  export declare function isPeakHour(time: number): boolean;
21
21
  /** Fold one usage record into a ledger row, tracking the peak-hour portion. */
22
22
  export declare function foldUsageRecord(row: UsageRow, usage: UsageRecord, peak: boolean): void;
package/package.json CHANGED
@@ -1,79 +1,84 @@
1
- {
2
- "name": "@alexpeng/dsh-custom-plugin",
3
- "description": "Custom convenience suite for the dsh web GUI: background colors with weather FX, liquid glass, a per-user-message timeline rail with stars and branching, multi-level project folders, prompt library, conversation export (JSON / Markdown / PDF-with-images), Mermaid rendering, quote reply, DeepSeek balance and daily token usage; dual-face plugin mounted without dsh source changes.",
4
- "version": "0.1.0",
5
- "type": "module",
6
- "main": "lib/index.js",
7
- "types": "lib/types/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./lib/types/index.d.ts",
11
- "default": "./lib/index.js"
12
- },
13
- "./client": {
14
- "types": "./lib/types/client/index.d.ts",
15
- "default": "./lib/client.js"
16
- },
17
- "./src/*": "./src/*",
18
- "./package.json": "./package.json"
19
- },
20
- "dsh": {
21
- "bundle": {
22
- "patch": "./cordis.patch.yml"
23
- },
24
- "client": {
25
- "inject": [
26
- "@deepseek-ai/dsh-client-runtime"
27
- ],
28
- "platform": "web"
29
- }
30
- },
31
- "publishConfig": {
32
- "access": "public"
33
- },
34
- "scripts": {
35
- "build": "tsc -p tsconfig.build.json && tsdown",
36
- "bundle": "tsdown",
37
- "watch": "tsdown --watch",
38
- "typecheck": "tsc --noEmit",
39
- "test": "vitest run",
40
- "test:watch": "vitest"
41
- },
42
- "peerDependencies": {
43
- "@deepseek-ai/cordis": "^4.0.1"
44
- },
45
- "dependencies": {},
46
- "devDependencies": {
47
- "@deepseek-ai/cordis": "^4.0.1",
48
- "@deepseek-ai/dsh-attachment": "^0.1.1-rc.1",
49
- "@deepseek-ai/dsh-client-locale": "^0.1.1-rc.1",
50
- "@deepseek-ai/dsh-client-runtime": "^0.1.1-rc.1",
51
- "@deepseek-ai/dsh-client-ui-conversation": "^0.1.1-rc.1",
52
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.1-rc.1",
53
- "@deepseek-ai/dsh-client-ui-theme": "^0.1.1-rc.1",
54
- "@deepseek-ai/dsh-host-webserver": "^0.1.1-rc.1",
55
- "@deepseek-ai/dsh-llm": "^0.1.1-rc.1",
56
- "@deepseek-ai/dsh-session": "^0.1.1-rc.1",
57
- "@deepseek-ai/dsh-session-query": "^0.1.1-rc.1",
58
- "@deepseek-ai/dsh-settings": "^0.1.1-rc.1",
59
- "@deepseek-ai/dsh-system-prompt": "^0.1.1-rc.1",
60
- "@deepseek-ai/dsh-tools": "^0.1.1-rc.1",
61
- "@types/node": "^22.20.0",
62
- "@types/react": "~18.3.1",
63
- "@types/react-dom": "^18.3.5",
64
- "jsdom": "^25.0.0",
65
- "react": "^18.3.1",
66
- "react-dom": "^18.3.1",
67
- "tsdown": "0.22.2",
68
- "typescript": "~5.7.2",
69
- "vitest": "^3.0.0"
70
- },
71
- "files": [
72
- "lib",
73
- "cordis.patch.yml",
74
- "README.md",
75
- "README.zh.md",
76
- "README.i18n.yaml"
77
- ],
78
- "license": "Apache-2.0"
79
- }
1
+ {
2
+ "name": "@alexpeng/dsh-custom-plugin",
3
+ "description": "Custom convenience suite for the dsh web GUI: background colors with weather FX, liquid glass, a per-user-message timeline rail with stars and branching, multi-level project folders, prompt library, conversation export (JSON / Markdown / PDF-with-images), Mermaid rendering, quote reply, DeepSeek balance and daily token usage; dual-face plugin mounted without dsh source changes.",
4
+ "version": "0.1.1",
5
+ "type": "module",
6
+ "main": "lib/index.js",
7
+ "types": "lib/types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./lib/types/index.d.ts",
11
+ "default": "./lib/index.js"
12
+ },
13
+ "./client": {
14
+ "types": "./lib/types/client/index.d.ts",
15
+ "default": "./lib/client.js"
16
+ },
17
+ "./package.json": "./package.json"
18
+ },
19
+ "dsh": {
20
+ "bundle": {
21
+ "patch": "./cordis.patch.yml"
22
+ },
23
+ "client": {
24
+ "inject": [
25
+ "@deepseek-ai/dsh-client-runtime"
26
+ ],
27
+ "platform": "web"
28
+ }
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/AlexPeng07/dsh-custom-plugin.git"
36
+ },
37
+ "author": "AlexPeng <alexpeng07@outlook.com>",
38
+ "bugs": "https://github.com/AlexPeng07/dsh-custom-plugin/issues",
39
+ "homepage": "https://github.com/AlexPeng07/dsh-custom-plugin#readme",
40
+ "engines": {
41
+ "node": ">=22"
42
+ },
43
+ "peerDependencies": {
44
+ "@deepseek-ai/cordis": "^4.0.1",
45
+ "@deepseek-ai/dsh-tools": "^0.1.1-rc.1"
46
+ },
47
+ "dependencies": {},
48
+ "devDependencies": {
49
+ "@deepseek-ai/cordis": "^4.0.1",
50
+ "@deepseek-ai/dsh-attachment": "^0.1.1-rc.1",
51
+ "@deepseek-ai/dsh-client-runtime": "^0.1.1-rc.1",
52
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.1-rc.1",
53
+ "@deepseek-ai/dsh-client-ui-theme": "^0.1.1-rc.1",
54
+ "@deepseek-ai/dsh-host-webserver": "^0.1.1-rc.1",
55
+ "@deepseek-ai/dsh-llm": "^0.1.1-rc.1",
56
+ "@deepseek-ai/dsh-session": "^0.1.1-rc.1",
57
+ "@deepseek-ai/dsh-session-query": "^0.1.1-rc.1",
58
+ "@deepseek-ai/dsh-tools": "^0.1.1-rc.1",
59
+ "@types/node": "^22.20.0",
60
+ "@types/react": "~18.3.1",
61
+ "@types/react-dom": "^18.3.5",
62
+ "react": "^18.3.1",
63
+ "react-dom": "^18.3.1",
64
+ "tsdown": "0.22.2",
65
+ "typescript": "~5.7.2",
66
+ "vitest": "^3.0.0"
67
+ },
68
+ "files": [
69
+ "lib",
70
+ "cordis.patch.yml",
71
+ "README.md",
72
+ "README.zh.md",
73
+ "README.i18n.yaml"
74
+ ],
75
+ "license": "Apache-2.0",
76
+ "scripts": {
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
+ }