@huanlin/dsh-plugin-aigc-canvas 0.1.7 → 0.1.8

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.
Files changed (3) hide show
  1. package/lib/client.js +3184 -3184
  2. package/lib/context-types.d.ts +114 -114
  3. package/package.json +20 -20
@@ -1,114 +1,114 @@
1
- /**
2
- * Structural types for the cordis services this plugin consumes, plus the
3
- * Context augmentation both halves share. A third-party plugin resolves
4
- * outside the DSH monorepo's single cordis instance, so the upstream
5
- * `declare module 'cordis'` augmentations do not reach this Context — and
6
- * the npm cordis package does not declare the DSH-vendored runtime members
7
- * (`ctx.effect`, the webServer/sessions/loader faces). The members below
8
- * mirror the actual runtime shapes this plugin touches:
9
- *
10
- * - webServer: @deepseek-ai/dsh-host-webserver
11
- * - sessions: @deepseek-ai/dsh-session (host side)
12
- * - loader: @cordisjs/plugin-loader (entry options)
13
- * - effect: the DSH-vendored cordis lifecycle helper
14
- *
15
- * Drift from upstream is contained to this file.
16
- */
17
- import type { IncomingMessage, ServerResponse } from 'node:http';
18
- import type { Duplex } from 'node:stream';
19
- import type { Context } from 'cordis';
20
- import type { AigcCanvasService } from './canvas-registry.js';
21
- /** One named webserver route (mirror of the host-webserver WebRoute). */
22
- export interface AigcWebRoute {
23
- kind: 'exact' | 'prefix';
24
- path: string;
25
- handler: (req: IncomingMessage, res: ServerResponse) => void | Promise<void>;
26
- }
27
- /** One exact-path HTTP upgrade registration (mirror of WebUpgradeRoute). */
28
- export interface AigcWebUpgradeRoute {
29
- path: string;
30
- handler: (req: IncomingMessage, socket: Duplex, head: Buffer) => void | Promise<void>;
31
- }
32
- /** The webServer service face this plugin uses. */
33
- export interface AigcWebServer {
34
- register(route: AigcWebRoute): () => void;
35
- registerUpgrade(route: AigcWebUpgradeRoute): () => void;
36
- }
37
- /** A published session's header slice (authoritative cwd). */
38
- export interface AigcSessionHeader {
39
- cwd?: string;
40
- }
41
- /** The host session store face (`ctx.sessions.get(id)` returns the live session). */
42
- export interface AigcSessionStore {
43
- get(id: string): {
44
- header: AigcSessionHeader;
45
- } | undefined;
46
- }
47
- /**
48
- * The minimal Agent face this plugin uses for context injection.
49
- * Mirrors `@deepseek-ai/dsh-agent`'s `Agent.inject()` — see the DSH
50
- * agent loop's inbox/splice path. The plugin calls `inject()` to push
51
- * a notice into the agent's next-step context (non-waking).
52
- */
53
- export interface AigcAgent {
54
- readonly id: string;
55
- inject(message: AigcUserMessage): void;
56
- }
57
- /** A minimal user-role message for agent.inject (mirrors dsh-llm's UserMessage). */
58
- export interface AigcUserMessage {
59
- readonly id: string;
60
- readonly role: 'user';
61
- readonly content: ReadonlyArray<{
62
- type: 'text';
63
- text: string;
64
- }>;
65
- readonly source: {
66
- readonly kind: 'plugin';
67
- readonly plugin: string;
68
- readonly form?: 'notice';
69
- readonly summary?: string;
70
- };
71
- }
72
- /** The agents registry face (`ctx.agents.get(sessionId)` returns the live agent). */
73
- export interface AigcAgentRegistry {
74
- get(id: string): AigcAgent | undefined;
75
- }
76
- /** One loader entry's options slice (the connection row's resolved config). */
77
- export interface AigcLoaderEntry {
78
- options: {
79
- name: string;
80
- config?: unknown;
81
- };
82
- }
83
- /** The loader face used to read the connection row's trustedHosts config. */
84
- export interface AigcLoader {
85
- entries(): Iterable<AigcLoaderEntry>;
86
- }
87
- /**
88
- * The tools service face restated.
89
- * Mirrored here exactly like better-sidebar does — the dual-cordis-instance
90
- * resolution otherwise hides the upstream augmentation. The `tools` service
91
- * face is declared in `./types.d.ts` (the ambient cordis module augmentation)
92
- * and not restated here to avoid a "subsequent property declarations must
93
- * have the same type" error.
94
- */
95
- export interface AigcToolsService {
96
- register(tool: unknown): () => void;
97
- }
98
- declare module 'cordis' {
99
- interface Context {
100
- webServer: AigcWebServer;
101
- sessions: AigcSessionStore;
102
- agents: AigcAgentRegistry;
103
- loader: AigcLoader;
104
- /**
105
- * The host-side AIGC canvas registry: holds the per-session element
106
- * table (prompts + generated assets) and edges. Provided by the host
107
- * half (see {@link ./canvas-registry.ts}); undefined on the client.
108
- */
109
- aigcCanvas: AigcCanvasService;
110
- /** Register a lifecycle callback (DSH-vendored cordis). */
111
- effect(fn: () => void | (() => void), label?: string): void;
112
- }
113
- }
114
- export type { Context };
1
+ /**
2
+ * Structural types for the cordis services this plugin consumes, plus the
3
+ * Context augmentation both halves share. A third-party plugin resolves
4
+ * outside the DSH monorepo's single cordis instance, so the upstream
5
+ * `declare module 'cordis'` augmentations do not reach this Context — and
6
+ * the npm cordis package does not declare the DSH-vendored runtime members
7
+ * (`ctx.effect`, the webServer/sessions/loader faces). The members below
8
+ * mirror the actual runtime shapes this plugin touches:
9
+ *
10
+ * - webServer: @deepseek-ai/dsh-host-webserver
11
+ * - sessions: @deepseek-ai/dsh-session (host side)
12
+ * - loader: @cordisjs/plugin-loader (entry options)
13
+ * - effect: the DSH-vendored cordis lifecycle helper
14
+ *
15
+ * Drift from upstream is contained to this file.
16
+ */
17
+ import type { IncomingMessage, ServerResponse } from 'node:http';
18
+ import type { Duplex } from 'node:stream';
19
+ import type { Context } from 'cordis';
20
+ import type { AigcCanvasService } from './canvas-registry.js';
21
+ /** One named webserver route (mirror of the host-webserver WebRoute). */
22
+ export interface AigcWebRoute {
23
+ kind: 'exact' | 'prefix';
24
+ path: string;
25
+ handler: (req: IncomingMessage, res: ServerResponse) => void | Promise<void>;
26
+ }
27
+ /** One exact-path HTTP upgrade registration (mirror of WebUpgradeRoute). */
28
+ export interface AigcWebUpgradeRoute {
29
+ path: string;
30
+ handler: (req: IncomingMessage, socket: Duplex, head: Buffer) => void | Promise<void>;
31
+ }
32
+ /** The webServer service face this plugin uses. */
33
+ export interface AigcWebServer {
34
+ register(route: AigcWebRoute): () => void;
35
+ registerUpgrade(route: AigcWebUpgradeRoute): () => void;
36
+ }
37
+ /** A published session's header slice (authoritative cwd). */
38
+ export interface AigcSessionHeader {
39
+ cwd?: string;
40
+ }
41
+ /** The host session store face (`ctx.sessions.get(id)` returns the live session). */
42
+ export interface AigcSessionStore {
43
+ get(id: string): {
44
+ header: AigcSessionHeader;
45
+ } | undefined;
46
+ }
47
+ /**
48
+ * The minimal Agent face this plugin uses for context injection.
49
+ * Mirrors `@deepseek-ai/dsh-agent`'s `Agent.inject()` — see the DSH
50
+ * agent loop's inbox/splice path. The plugin calls `inject()` to push
51
+ * a notice into the agent's next-step context (non-waking).
52
+ */
53
+ export interface AigcAgent {
54
+ readonly id: string;
55
+ inject(message: AigcUserMessage): void;
56
+ }
57
+ /** A minimal user-role message for agent.inject (mirrors dsh-llm's UserMessage). */
58
+ export interface AigcUserMessage {
59
+ readonly id: string;
60
+ readonly role: 'user';
61
+ readonly content: ReadonlyArray<{
62
+ type: 'text';
63
+ text: string;
64
+ }>;
65
+ readonly source: {
66
+ readonly kind: 'plugin';
67
+ readonly plugin: string;
68
+ readonly form?: 'notice';
69
+ readonly summary?: string;
70
+ };
71
+ }
72
+ /** The agents registry face (`ctx.agents.get(sessionId)` returns the live agent). */
73
+ export interface AigcAgentRegistry {
74
+ get(id: string): AigcAgent | undefined;
75
+ }
76
+ /** One loader entry's options slice (the connection row's resolved config). */
77
+ export interface AigcLoaderEntry {
78
+ options: {
79
+ name: string;
80
+ config?: unknown;
81
+ };
82
+ }
83
+ /** The loader face used to read the connection row's trustedHosts config. */
84
+ export interface AigcLoader {
85
+ entries(): Iterable<AigcLoaderEntry>;
86
+ }
87
+ /**
88
+ * The tools service face restated.
89
+ * Mirrored here exactly like better-sidebar does — the dual-cordis-instance
90
+ * resolution otherwise hides the upstream augmentation. The `tools` service
91
+ * face is declared in `./types.d.ts` (the ambient cordis module augmentation)
92
+ * and not restated here to avoid a "subsequent property declarations must
93
+ * have the same type" error.
94
+ */
95
+ export interface AigcToolsService {
96
+ register(tool: unknown): () => void;
97
+ }
98
+ declare module 'cordis' {
99
+ interface Context {
100
+ webServer: AigcWebServer;
101
+ sessions: AigcSessionStore;
102
+ agents: AigcAgentRegistry;
103
+ loader: AigcLoader;
104
+ /**
105
+ * The host-side AIGC canvas registry: holds the per-session element
106
+ * table (prompts + generated assets) and edges. Provided by the host
107
+ * half (see {@link ./canvas-registry.ts}); undefined on the client.
108
+ */
109
+ aigcCanvas: AigcCanvasService;
110
+ /** Register a lifecycle callback (DSH-vendored cordis). */
111
+ effect(fn: () => void | (() => void), label?: string): void;
112
+ }
113
+ }
114
+ export type { Context };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huanlin/dsh-plugin-aigc-canvas",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "DSH plugin: an infinite free canvas for the better-sidebar plus provider-agnostic generation. Exposes aigc_get_provider_info / aigc_http_request (endpoint + apiKey auto-attached) / aigc_provider_set_instructions / aigc_canvas_place / aigc_canvas_link / aigc_canvas_unlink / aigc_canvas_list_elements tools; generated files are placed at arbitrary canvas positions and can be double-clicked for prompt + params.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -51,15 +51,15 @@
51
51
  },
52
52
  "peerDependencies": {
53
53
  "@deepseek-ai/cordis": "^4.0.1",
54
- "@deepseek-ai/dsh-client-locale": "^0.0.1",
55
- "@deepseek-ai/dsh-client-ui-primitives": "^0.0.1",
56
- "@deepseek-ai/dsh-client-ui-settings": "^0.0.1",
57
- "@deepseek-ai/dsh-client-ui-conversation": "^0.0.1",
58
- "@deepseek-ai/dsh-client-ui-renderer": "^0.0.1",
59
- "@deepseek-ai/dsh-client-ui-slots": "^0.0.1",
60
- "@deepseek-ai/dsh-host-webserver": "^0.0.1",
61
- "@deepseek-ai/dsh-session": "^0.0.1",
62
- "@deepseek-ai/dsh-tools": "^0.0.1",
54
+ "@deepseek-ai/dsh-client-locale": "^0.1.5-rc.1",
55
+ "@deepseek-ai/dsh-client-ui-primitives": "^0.1.5-rc.1",
56
+ "@deepseek-ai/dsh-client-ui-settings": "^0.1.5-rc.1",
57
+ "@deepseek-ai/dsh-client-ui-conversation": "^0.1.5-rc.1",
58
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.1.5-rc.1",
59
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.5-rc.1",
60
+ "@deepseek-ai/dsh-host-webserver": "^0.1.5-rc.1",
61
+ "@deepseek-ai/dsh-session": "^0.1.5-rc.1",
62
+ "@deepseek-ai/dsh-tools": "^0.1.5-rc.1",
63
63
  "cordis": "^4.0.0-rc.7",
64
64
  "dsh-better-sidebar": "^0.4.0",
65
65
  "react": "^18.2.0",
@@ -110,16 +110,16 @@
110
110
  }
111
111
  },
112
112
  "devDependencies": {
113
- "@deepseek-ai/cordis": "link:C:/Users/Administrator/.dsh/source/current/vendor/cordis",
114
- "@deepseek-ai/dsh-client-locale": "link:C:/Users/Administrator/.dsh/source/current/packages/client/locale",
115
- "@deepseek-ai/dsh-client-ui-primitives": "link:C:/Users/Administrator/.dsh/source/current/packages/client/ui-primitives",
116
- "@deepseek-ai/dsh-client-ui-settings": "link:C:/Users/Administrator/.dsh/source/current/packages/client/ui-settings",
117
- "@deepseek-ai/dsh-client-ui-conversation": "link:C:/Users/Administrator/.dsh/source/current/packages/client/ui-conversation",
118
- "@deepseek-ai/dsh-client-ui-renderer": "link:C:/Users/Administrator/.dsh/source/current/packages/client/ui-renderer",
119
- "@deepseek-ai/dsh-client-ui-slots": "link:C:/Users/Administrator/.dsh/source/current/packages/client/ui-slots",
120
- "@deepseek-ai/dsh-host-webserver": "link:C:/Users/Administrator/.dsh/source/current/packages/host/webserver",
121
- "@deepseek-ai/dsh-session": "link:C:/Users/Administrator/.dsh/source/current/packages/core/session",
122
- "@deepseek-ai/dsh-tools": "link:C:/Users/Administrator/.dsh/source/current/packages/core/tools",
113
+ "@deepseek-ai/cordis": "link:D:/Projects/deepseek-harness/dsh/vendor/cordis",
114
+ "@deepseek-ai/dsh-client-locale": "link:D:/Projects/deepseek-harness/dsh/packages/client/locale",
115
+ "@deepseek-ai/dsh-client-ui-primitives": "link:D:/Projects/deepseek-harness/dsh/packages/client/ui-primitives",
116
+ "@deepseek-ai/dsh-client-ui-settings": "link:D:/Projects/deepseek-harness/dsh/packages/client/ui-settings",
117
+ "@deepseek-ai/dsh-client-ui-conversation": "link:D:/Projects/deepseek-harness/dsh/packages/client/ui-conversation",
118
+ "@deepseek-ai/dsh-client-ui-renderer": "link:D:/Projects/deepseek-harness/dsh/packages/client/ui-renderer",
119
+ "@deepseek-ai/dsh-client-ui-slots": "link:D:/Projects/deepseek-harness/dsh/packages/client/ui-slots",
120
+ "@deepseek-ai/dsh-host-webserver": "link:D:/Projects/deepseek-harness/dsh/packages/host/webserver",
121
+ "@deepseek-ai/dsh-session": "link:D:/Projects/deepseek-harness/dsh/packages/core/session",
122
+ "@deepseek-ai/dsh-tools": "link:D:/Projects/deepseek-harness/dsh/packages/core/tools",
123
123
  "@types/node": "^24.0.0",
124
124
  "@types/react": "~18.3.1",
125
125
  "@types/react-dom": "~18.3.1",