@huanlin/dsh-plugin-aigc-canvas 0.1.6 → 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.
@@ -1,120 +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
- * - invariants: @deepseek-ai/dsh-invariants
14
- * - effect: the DSH-vendored cordis lifecycle helper
15
- *
16
- * Drift from upstream is contained to this file.
17
- */
18
- import type { IncomingMessage, ServerResponse } from 'node:http';
19
- import type { Duplex } from 'node:stream';
20
- import type { Context } from 'cordis';
21
- import type { AigcCanvasService } from './canvas-registry.js';
22
- /** One named webserver route (mirror of the host-webserver WebRoute). */
23
- export interface AigcWebRoute {
24
- kind: 'exact' | 'prefix';
25
- path: string;
26
- handler: (req: IncomingMessage, res: ServerResponse) => void | Promise<void>;
27
- }
28
- /** One exact-path HTTP upgrade registration (mirror of WebUpgradeRoute). */
29
- export interface AigcWebUpgradeRoute {
30
- path: string;
31
- handler: (req: IncomingMessage, socket: Duplex, head: Buffer) => void | Promise<void>;
32
- }
33
- /** The webServer service face this plugin uses. */
34
- export interface AigcWebServer {
35
- register(route: AigcWebRoute): () => void;
36
- registerUpgrade(route: AigcWebUpgradeRoute): () => void;
37
- }
38
- /** A published session's header slice (authoritative cwd). */
39
- export interface AigcSessionHeader {
40
- cwd?: string;
41
- }
42
- /** The host session store face (`ctx.sessions.get(id)` returns the live session). */
43
- export interface AigcSessionStore {
44
- get(id: string): {
45
- header: AigcSessionHeader;
46
- } | undefined;
47
- }
48
- /**
49
- * The minimal Agent face this plugin uses for context injection.
50
- * Mirrors `@deepseek-ai/dsh-agent`'s `Agent.inject()` — see the DSH
51
- * agent loop's inbox/splice path. The plugin calls `inject()` to push
52
- * a notice into the agent's next-step context (non-waking).
53
- */
54
- export interface AigcAgent {
55
- readonly id: string;
56
- inject(message: AigcUserMessage): void;
57
- }
58
- /** A minimal user-role message for agent.inject (mirrors dsh-llm's UserMessage). */
59
- export interface AigcUserMessage {
60
- readonly id: string;
61
- readonly role: 'user';
62
- readonly content: ReadonlyArray<{
63
- type: 'text';
64
- text: string;
65
- }>;
66
- readonly source: {
67
- readonly kind: 'plugin';
68
- readonly plugin: string;
69
- readonly form?: 'notice';
70
- readonly summary?: string;
71
- };
72
- }
73
- /** The agents registry face (`ctx.agents.get(sessionId)` returns the live agent). */
74
- export interface AigcAgentRegistry {
75
- get(id: string): AigcAgent | undefined;
76
- }
77
- /** One loader entry's options slice (the connection row's resolved config). */
78
- export interface AigcLoaderEntry {
79
- options: {
80
- name: string;
81
- config?: unknown;
82
- };
83
- }
84
- /** The loader face used to read the connection row's trustedHosts config. */
85
- export interface AigcLoader {
86
- entries(): Iterable<AigcLoaderEntry>;
87
- }
88
- /** The invariants service face (mirror of @deepseek-ai/dsh-invariants). */
89
- export interface AigcInvariantsService {
90
- register(packageName: string, installer: (ctx: Context, fail: (message: string) => never) => void | Promise<void>): () => void;
91
- }
92
- /**
93
- * The invariant service face restated (mirror of @deepseek-ai/dsh-invariants).
94
- * Mirrored here exactly like better-sidebar does — the dual-cordis-instance
95
- * resolution otherwise hides the upstream augmentation. The `tools` service
96
- * face is declared in `./types.d.ts` (the ambient cordis module augmentation)
97
- * and not restated here to avoid a "subsequent property declarations must
98
- * have the same type" error.
99
- */
100
- export interface AigcToolsService {
101
- register(tool: unknown): () => void;
102
- }
103
- declare module 'cordis' {
104
- interface Context {
105
- webServer: AigcWebServer;
106
- sessions: AigcSessionStore;
107
- agents: AigcAgentRegistry;
108
- loader: AigcLoader;
109
- invariants: AigcInvariantsService;
110
- /**
111
- * The host-side AIGC canvas registry: holds the per-session element
112
- * table (prompts + generated assets) and edges. Provided by the host
113
- * half (see {@link ./canvas-registry.ts}); undefined on the client.
114
- */
115
- aigcCanvas: AigcCanvasService;
116
- /** Register a lifecycle callback (DSH-vendored cordis). */
117
- effect(fn: () => void | (() => void), label?: string): void;
118
- }
119
- }
120
- 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.6",
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",
@@ -11,10 +11,6 @@
11
11
  "types": "./lib/index.d.ts",
12
12
  "import": "./lib/index.js"
13
13
  },
14
- "./invariant": {
15
- "types": "./lib/invariant.d.ts",
16
- "import": "./lib/invariant.js"
17
- },
18
14
  "./client": {
19
15
  "types": "./lib/client.d.ts",
20
16
  "default": "./lib/client.js"
@@ -39,9 +35,9 @@
39
35
  },
40
36
  "client": {
41
37
  "inject": [
42
- "@deepseek-ai/dsh-client-runtime",
43
38
  "@deepseek-ai/dsh-client-locale",
44
39
  "@deepseek-ai/dsh-client-ui-conversation",
40
+ "@deepseek-ai/dsh-client-ui-renderer",
45
41
  "@deepseek-ai/dsh-client-ui-slots",
46
42
  "@deepseek-ai/dsh-client-ui-settings",
47
43
  "@deepseek-ai/dsh-client-ui-primitives"
@@ -54,26 +50,26 @@
54
50
  "ws": "^8.18.0"
55
51
  },
56
52
  "peerDependencies": {
57
- "@deepseek-ai/dsh-client-locale": "^0.0.1",
58
- "@deepseek-ai/dsh-client-runtime": "^0.0.1",
59
- "@deepseek-ai/dsh-client-ui-primitives": "^0.0.1",
60
- "@deepseek-ai/dsh-client-ui-settings": "^0.0.1",
61
- "@deepseek-ai/dsh-client-ui-conversation": "^0.0.1",
62
- "@deepseek-ai/dsh-client-ui-slots": "^0.0.1",
63
- "@deepseek-ai/dsh-host-webserver": "^0.0.1",
64
- "@deepseek-ai/dsh-invariants": "^0.0.1",
65
- "@deepseek-ai/dsh-session": "^0.0.1",
66
- "@deepseek-ai/dsh-tools": "^0.0.1",
53
+ "@deepseek-ai/cordis": "^4.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",
67
63
  "cordis": "^4.0.0-rc.7",
68
64
  "dsh-better-sidebar": "^0.4.0",
69
65
  "react": "^18.2.0",
70
66
  "react-dom": "^18.2.0"
71
67
  },
72
68
  "peerDependenciesMeta": {
73
- "@deepseek-ai/dsh-client-locale": {
69
+ "@deepseek-ai/cordis": {
74
70
  "optional": true
75
71
  },
76
- "@deepseek-ai/dsh-client-runtime": {
72
+ "@deepseek-ai/dsh-client-locale": {
77
73
  "optional": true
78
74
  },
79
75
  "@deepseek-ai/dsh-client-ui-primitives": {
@@ -85,13 +81,13 @@
85
81
  "@deepseek-ai/dsh-client-ui-conversation": {
86
82
  "optional": true
87
83
  },
88
- "@deepseek-ai/dsh-client-ui-slots": {
84
+ "@deepseek-ai/dsh-client-ui-renderer": {
89
85
  "optional": true
90
86
  },
91
- "@deepseek-ai/dsh-host-webserver": {
87
+ "@deepseek-ai/dsh-client-ui-slots": {
92
88
  "optional": true
93
89
  },
94
- "@deepseek-ai/dsh-invariants": {
90
+ "@deepseek-ai/dsh-host-webserver": {
95
91
  "optional": true
96
92
  },
97
93
  "@deepseek-ai/dsh-session": {
@@ -114,16 +110,16 @@
114
110
  }
115
111
  },
116
112
  "devDependencies": {
117
- "@deepseek-ai/dsh-client-locale": "link:C:/Users/Administrator/.dsh/source/current/packages/client/locale",
118
- "@deepseek-ai/dsh-client-runtime": "link:C:/Users/Administrator/.dsh/source/current/packages/client/runtime",
119
- "@deepseek-ai/dsh-client-ui-primitives": "link:C:/Users/Administrator/.dsh/source/current/packages/client/ui-primitives",
120
- "@deepseek-ai/dsh-client-ui-settings": "link:C:/Users/Administrator/.dsh/source/current/packages/client/ui-settings",
121
- "@deepseek-ai/dsh-client-ui-conversation": "link:C:/Users/Administrator/.dsh/source/current/packages/client/ui-conversation",
122
- "@deepseek-ai/dsh-client-ui-slots": "link:C:/Users/Administrator/.dsh/source/current/packages/client/ui-slots",
123
- "@deepseek-ai/dsh-host-webserver": "link:C:/Users/Administrator/.dsh/source/current/packages/host/webserver",
124
- "@deepseek-ai/dsh-invariants": "link:C:/Users/Administrator/.dsh/source/current/packages/support/invariants",
125
- "@deepseek-ai/dsh-session": "link:C:/Users/Administrator/.dsh/source/current/packages/core/session",
126
- "@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",
127
123
  "@types/node": "^24.0.0",
128
124
  "@types/react": "~18.3.1",
129
125
  "@types/react-dom": "~18.3.1",
@@ -1,15 +0,0 @@
1
- /**
2
- * Package-owned invariant companion for `@huanlin/dsh-plugin-aigc-canvas`.
3
- * @module @huanlin/dsh-plugin-aigc-canvas/invariant
4
- */
5
- import type { Context } from './context-types.js';
6
- /** Cordis companion plugin name. */
7
- export declare const name = "dsh-aigc-canvas-invariant";
8
- /** Service required before the companion can reserve package ownership. */
9
- export declare const inject: string[];
10
- /**
11
- * Register this package's invariant companion.
12
- * @param ctx - Cordis context carrying the invariant service.
13
- * @returns the installed registration's disposer after setup succeeds.
14
- */
15
- export declare const apply: (ctx: Context) => Promise<() => void>;
package/lib/invariant.js DELETED
@@ -1,22 +0,0 @@
1
- //#region src/invariant.ts
2
- const PACKAGE_NAME = "@huanlin/dsh-plugin-aigc-canvas";
3
- /** Cordis companion plugin name. */
4
- const name = "dsh-aigc-canvas-invariant";
5
- /** Service required before the companion can reserve package ownership. */
6
- const inject = ["invariants"];
7
- /**
8
- * No runtime invariant: the canvas owns no service state or event protocol
9
- * of its own beyond the registry's own assertions (uuid existence, kind
10
- * checks) — every route is mounted under the host's webServer fence, the
11
- * element table is exercised by the smoke spec, and the client view is a
12
- * pure projection of the host state.
13
- */
14
- const install = () => {};
15
- /**
16
- * Register this package's invariant companion.
17
- * @param ctx - Cordis context carrying the invariant service.
18
- * @returns the installed registration's disposer after setup succeeds.
19
- */
20
- const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
21
- //#endregion
22
- export { apply, inject, name };