@aqian0/dsh-renderer 0.1.0 → 0.2.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/README.md +8 -5
- package/lib/client.js +76 -25
- package/lib/config.js +6 -2
- package/lib/host/artifact-skill.js +55 -0
- package/lib/host/artifact-tool.js +41 -5
- package/lib/index.js +23 -4
- package/lib/shared/artifact-stream.js +293 -0
- package/lib/shared/config-defaults.js +5 -1
- package/lib/shared/content-complexity.js +76 -12
- package/lib/shared/sandbox-core.js +75 -6
- package/lib/types/client/artifact-node.d.ts +62 -0
- package/lib/types/client/artifact-resource.d.ts +30 -0
- package/lib/types/client/locales.d.ts +3 -0
- package/lib/types/client/styles.d.ts +1 -1
- package/lib/types/client/types.d.ts +113 -1
- package/lib/types/config.d.ts +2 -0
- package/lib/types/host/artifact-skill.d.ts +39 -0
- package/lib/types/host/artifact-tool.d.ts +33 -4
- package/lib/types/shared/artifact-stream.d.ts +52 -0
- package/lib/types/shared/config-defaults.d.ts +3 -1
- package/lib/types/shared/content-complexity.d.ts +8 -2
- package/lib/types/shared/sandbox-core.d.ts +29 -2
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +5 -1
|
@@ -104,8 +104,12 @@ export class SandboxLruPool {
|
|
|
104
104
|
return this.active.size;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
/** Resource
|
|
107
|
+
/** Resource protocol name owned by `@aqian0/dsh-renderer` (`dsh-resource://dsh-renderer/...`). */
|
|
108
|
+
export const ARTIFACT_RESOURCE_PROTOCOL = 'dsh-renderer';
|
|
109
|
+
/** Resource URI prefix used for in-memory / fence-backed right-Sidebar artifact tabs. */
|
|
108
110
|
export const ARTIFACT_RESOURCE_PREFIX = 'dsh-resource://dsh-renderer/artifact/';
|
|
111
|
+
/** Resource URI prefix used for durable Session-backed `render_artifact` tool-call tabs. */
|
|
112
|
+
export const ARTIFACT_CALL_RESOURCE_PREFIX = 'dsh-resource://dsh-renderer/call/';
|
|
109
113
|
/** Build a canonical `dsh-resource://` address for one Artifact id. */
|
|
110
114
|
export function artifactAddressFor(id) {
|
|
111
115
|
return `${ARTIFACT_RESOURCE_PREFIX}${encodeURIComponent(id)}`;
|
|
@@ -115,15 +119,64 @@ export function parseArtifactAddress(address) {
|
|
|
115
119
|
if (!address.startsWith(ARTIFACT_RESOURCE_PREFIX))
|
|
116
120
|
return null;
|
|
117
121
|
const raw = address.slice(ARTIFACT_RESOURCE_PREFIX.length);
|
|
118
|
-
if (raw.length === 0)
|
|
122
|
+
if (raw.length === 0 || raw.includes('/') || raw.includes('?') || raw.includes('#'))
|
|
119
123
|
return null;
|
|
120
124
|
try {
|
|
121
|
-
|
|
125
|
+
const decoded = decodeURIComponent(raw);
|
|
126
|
+
return decoded.length > 0 ? decoded : null;
|
|
122
127
|
}
|
|
123
128
|
catch {
|
|
124
129
|
return null;
|
|
125
130
|
}
|
|
126
131
|
}
|
|
132
|
+
/** Build a durable Session-backed `dsh-resource://` address for one `render_artifact` call. */
|
|
133
|
+
export function artifactCallAddressFor(target) {
|
|
134
|
+
const { session, callId } = target;
|
|
135
|
+
const parts = session.kind === 'session'
|
|
136
|
+
? [session.sessionId, callId]
|
|
137
|
+
: ['subagent', session.parentSessionId, session.childSessionId, session.mode, callId];
|
|
138
|
+
return `${ARTIFACT_CALL_RESOURCE_PREFIX}${parts.map(encodeURIComponent).join('/')}`;
|
|
139
|
+
}
|
|
140
|
+
/** Parse and validate a durable `dsh-resource://dsh-renderer/call/...` address. */
|
|
141
|
+
export function parseArtifactCallAddress(address) {
|
|
142
|
+
if (!address.startsWith(ARTIFACT_CALL_RESOURCE_PREFIX))
|
|
143
|
+
return null;
|
|
144
|
+
const raw = address.slice(ARTIFACT_CALL_RESOURCE_PREFIX.length);
|
|
145
|
+
if (raw.length === 0 || raw.includes('?') || raw.includes('#'))
|
|
146
|
+
return null;
|
|
147
|
+
try {
|
|
148
|
+
const parts = raw.split('/').map((part) => decodeURIComponent(part));
|
|
149
|
+
if (parts.some((part) => part.length === 0))
|
|
150
|
+
return null;
|
|
151
|
+
if (parts.length === 2) {
|
|
152
|
+
return {
|
|
153
|
+
session: { kind: 'session', sessionId: parts[0] },
|
|
154
|
+
callId: parts[1],
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
if (parts.length === 5 &&
|
|
158
|
+
parts[0] === 'subagent' &&
|
|
159
|
+
(parts[3] === 'one-shot' || parts[3] === 'continuable' || parts[3] === 'unknown')) {
|
|
160
|
+
return {
|
|
161
|
+
session: {
|
|
162
|
+
kind: 'subagent',
|
|
163
|
+
parentSessionId: parts[1],
|
|
164
|
+
childSessionId: parts[2],
|
|
165
|
+
mode: parts[3],
|
|
166
|
+
},
|
|
167
|
+
callId: parts[4],
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/** Return whether `address` is a well-formed artifact or call resource owned by `@aqian0/dsh-renderer`. */
|
|
177
|
+
export function isArtifactResourceAddress(address) {
|
|
178
|
+
return parseArtifactAddress(address) !== null || parseArtifactCallAddress(address) !== null;
|
|
179
|
+
}
|
|
127
180
|
/**
|
|
128
181
|
* Bounded in-memory store for Artifacts opened in the right Sidebar workbench
|
|
129
182
|
* or fullscreen modal fallback.
|
|
@@ -131,6 +184,7 @@ export function parseArtifactAddress(address) {
|
|
|
131
184
|
export class ArtifactStore {
|
|
132
185
|
maxEntries;
|
|
133
186
|
records = new Map();
|
|
187
|
+
addressIndex = new Map();
|
|
134
188
|
listeners = new Set();
|
|
135
189
|
modalArtifactId = null;
|
|
136
190
|
seq = 0;
|
|
@@ -140,27 +194,37 @@ export class ArtifactStore {
|
|
|
140
194
|
/** Insert or update an artifact, returning the stored record. */
|
|
141
195
|
put(input) {
|
|
142
196
|
const id = input.id ?? `a-${++this.seq}`;
|
|
197
|
+
const address = input.address ?? artifactAddressFor(id);
|
|
143
198
|
const record = {
|
|
144
199
|
id,
|
|
145
|
-
address
|
|
200
|
+
address,
|
|
146
201
|
kind: input.kind,
|
|
147
202
|
lang: input.lang,
|
|
148
203
|
title: input.title,
|
|
149
204
|
code: input.code,
|
|
150
205
|
sessionId: input.sessionId,
|
|
151
206
|
};
|
|
152
|
-
|
|
207
|
+
const previous = this.records.get(id);
|
|
208
|
+
if (previous !== undefined) {
|
|
153
209
|
this.records.delete(id);
|
|
210
|
+
if (this.addressIndex.get(previous.address) === id) {
|
|
211
|
+
this.addressIndex.delete(previous.address);
|
|
212
|
+
}
|
|
154
213
|
}
|
|
155
214
|
else {
|
|
156
215
|
while (this.records.size >= this.maxEntries) {
|
|
157
216
|
const oldest = this.records.keys().next().value;
|
|
158
217
|
if (oldest === undefined)
|
|
159
218
|
break;
|
|
219
|
+
const evicted = this.records.get(oldest);
|
|
160
220
|
this.records.delete(oldest);
|
|
221
|
+
if (evicted !== undefined && this.addressIndex.get(evicted.address) === oldest) {
|
|
222
|
+
this.addressIndex.delete(evicted.address);
|
|
223
|
+
}
|
|
161
224
|
}
|
|
162
225
|
}
|
|
163
226
|
this.records.set(id, record);
|
|
227
|
+
this.addressIndex.set(address, id);
|
|
164
228
|
this.emit();
|
|
165
229
|
return record;
|
|
166
230
|
}
|
|
@@ -168,8 +232,12 @@ export class ArtifactStore {
|
|
|
168
232
|
get(id) {
|
|
169
233
|
return this.records.get(id);
|
|
170
234
|
}
|
|
171
|
-
/** Look up one artifact by its `dsh-resource://` address. */
|
|
235
|
+
/** Look up one artifact by its `dsh-resource://` address (`/artifact/...` or `/call/...`). */
|
|
172
236
|
getByAddress(address) {
|
|
237
|
+
const indexedId = this.addressIndex.get(address);
|
|
238
|
+
if (indexedId !== undefined) {
|
|
239
|
+
return this.records.get(indexedId);
|
|
240
|
+
}
|
|
173
241
|
const id = parseArtifactAddress(address);
|
|
174
242
|
return id === null ? undefined : this.records.get(id);
|
|
175
243
|
}
|
|
@@ -201,6 +269,7 @@ export class ArtifactStore {
|
|
|
201
269
|
/** Drop all artifacts and listeners on plugin teardown. */
|
|
202
270
|
clear() {
|
|
203
271
|
this.records.clear();
|
|
272
|
+
this.addressIndex.clear();
|
|
204
273
|
this.modalArtifactId = null;
|
|
205
274
|
this.emit();
|
|
206
275
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* First-class Chat Conversation Node (`dsh-renderer:artifact`) promoted outside
|
|
3
|
+
* DSH's Process Grouping and Whole-Turn Folding (`groupTree: 'turn'`).
|
|
4
|
+
*
|
|
5
|
+
* Ensures `render_artifact` cards remain directly visible in the conversation
|
|
6
|
+
* flow across all DSH Work-details modes (`compact`, `standard`, `detailed`,
|
|
7
|
+
* `verbose`), both while streaming and after the turn completes, for native
|
|
8
|
+
* tool calls and PTC dispatches alike.
|
|
9
|
+
*
|
|
10
|
+
* @module dsh-renderer/client/artifact-node
|
|
11
|
+
*/
|
|
12
|
+
import { type ArtifactContentKind } from '../shared/content-complexity.ts';
|
|
13
|
+
import type { ClientEnv } from './types.ts';
|
|
14
|
+
/** Conversation Node kind registered into `ctx.uiConversation.events` and `conversation.chat.node`. */
|
|
15
|
+
export declare const ARTIFACT_CHAT_NODE_KIND = "dsh-renderer:artifact";
|
|
16
|
+
/** View payload stored on each `dsh-renderer:artifact` Chat Node. */
|
|
17
|
+
export interface ArtifactChatNodeData {
|
|
18
|
+
readonly callId: string;
|
|
19
|
+
readonly phase: 'streaming' | 'ready' | 'error';
|
|
20
|
+
readonly sawStreaming: boolean;
|
|
21
|
+
readonly kind: ArtifactContentKind;
|
|
22
|
+
readonly lang: string;
|
|
23
|
+
readonly title: string;
|
|
24
|
+
readonly content: string;
|
|
25
|
+
readonly artifactId: string;
|
|
26
|
+
readonly lines: number;
|
|
27
|
+
readonly bytes: number;
|
|
28
|
+
readonly errorMessage?: string | undefined;
|
|
29
|
+
}
|
|
30
|
+
interface ConversationLocationLike {
|
|
31
|
+
readonly kind?: string;
|
|
32
|
+
readonly turn?: {
|
|
33
|
+
readonly turn?: number;
|
|
34
|
+
readonly status?: string;
|
|
35
|
+
};
|
|
36
|
+
readonly step?: {
|
|
37
|
+
readonly step?: number;
|
|
38
|
+
readonly status?: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Props received by the keyed `conversation.chat.node` renderer for `dsh-renderer:artifact`. */
|
|
42
|
+
export interface ArtifactChatNodeProps {
|
|
43
|
+
readonly node?: {
|
|
44
|
+
readonly key?: string;
|
|
45
|
+
readonly id?: string;
|
|
46
|
+
readonly location?: ConversationLocationLike;
|
|
47
|
+
readonly data?: ArtifactChatNodeData;
|
|
48
|
+
};
|
|
49
|
+
readonly sessionId?: string | undefined;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Create the non-exclusive DSH `ConversationNodeDefinition` that projects
|
|
53
|
+
* `render_artifact` tool calls (native and PTC) as top-level `groupTree: 'turn'`
|
|
54
|
+
* Chat nodes outside Process Grouping and Whole-Turn Folding.
|
|
55
|
+
*/
|
|
56
|
+
export declare function createArtifactNodeDefinition(): Record<string, unknown>;
|
|
57
|
+
/**
|
|
58
|
+
* Create the keyed `conversation.chat.node` renderer for promoted
|
|
59
|
+
* `dsh-renderer:artifact` nodes.
|
|
60
|
+
*/
|
|
61
|
+
export declare function createArtifactChatNodeComponent(env: ClientEnv): (props: ArtifactChatNodeProps) => unknown;
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client `ctx.resources` provider for `dsh-resource://dsh-renderer/**`.
|
|
3
|
+
*
|
|
4
|
+
* Supports two address spaces:
|
|
5
|
+
* 1. `dsh-resource://dsh-renderer/artifact/<id>` — live in-memory / fence-backed
|
|
6
|
+
* artifacts served reactively from `ArtifactStore`.
|
|
7
|
+
* 2. `dsh-resource://dsh-renderer/call/...` — durable `render_artifact` tool calls:
|
|
8
|
+
* instant hit from `ArtifactStore` when warm, and automatic backwards paging
|
|
9
|
+
* through `ctx.remote.session` (`events` + `page`) on cold browser reload.
|
|
10
|
+
*
|
|
11
|
+
* @module dsh-renderer/client/artifact-resource
|
|
12
|
+
*/
|
|
13
|
+
import { type ArtifactRecord, type ArtifactStore } from '../shared/sandbox-core.ts';
|
|
14
|
+
import type { ClientResourceFrame, ClientSessionHistoryRemote } from './types.ts';
|
|
15
|
+
/** Options for constructing the `dsh-renderer` client resource provider. */
|
|
16
|
+
export interface ArtifactResourceProviderOptions {
|
|
17
|
+
readonly artifacts: ArtifactStore;
|
|
18
|
+
readonly getRemoteSession?: () => ClientSessionHistoryRemote | undefined;
|
|
19
|
+
readonly maxContentBytes: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create the `ResourceProvider` registered on `ctx.resources` under protocol
|
|
23
|
+
* `'dsh-renderer'`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createArtifactResourceProvider(options: ArtifactResourceProviderOptions): {
|
|
26
|
+
readonly protocol: string;
|
|
27
|
+
open(address: string, context: {
|
|
28
|
+
readonly signal: AbortSignal;
|
|
29
|
+
}): AsyncIterable<ClientResourceFrame<ArtifactRecord>>;
|
|
30
|
+
};
|
|
@@ -31,6 +31,9 @@ export declare const EN_DICT: {
|
|
|
31
31
|
readonly sandboxFrameTitle: 'Sandboxed HTML preview';
|
|
32
32
|
readonly svgPreviewAlt: 'Rendered SVG preview';
|
|
33
33
|
readonly artifactMissing: 'This preview artifact is no longer available in memory.';
|
|
34
|
+
readonly artifactLoading: 'Loading artifact…';
|
|
35
|
+
readonly artifactNotFound: 'This artifact could not be found in the session history.';
|
|
36
|
+
readonly artifactReceiptOpen: 'Open';
|
|
34
37
|
readonly artifactTabTitle: 'Preview';
|
|
35
38
|
readonly htmlDocument: 'HTML Document';
|
|
36
39
|
readonly svgDocument: 'SVG Graphic';
|
|
@@ -15,6 +15,6 @@
|
|
|
15
15
|
*
|
|
16
16
|
* @module dsh-renderer/client/styles
|
|
17
17
|
*/
|
|
18
|
-
export declare const RENDERER_STYLES = "\n.dshr-card {\n margin: 0;\n border-radius: var(--dsw-radius-lg, 16px);\n border: 0.5px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));\n background: var(--dsw-alias-markdown-code-block, #f9fafb);\n color: var(--dsw-alias-label-primary, inherit);\n font-family: var(--dsw-font-family, system-ui, -apple-system, sans-serif);\n font-size: 13px;\n line-height: 1.5;\n overflow: hidden;\n}\n\n.dshr-toolbar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n height: 40px;\n padding: 0 10px 0 16px;\n background: var(--dsw-alias-markdown-code-block-banner, var(--dsw-alias-markdown-code-block, #f9fafb));\n border-bottom: 0.5px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.04));\n flex-wrap: nowrap;\n}\n\n.dshr-toolbar-group {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n min-width: 0;\n}\n\n.dshr-actions {\n display: inline-flex;\n align-items: center;\n gap: 2px;\n flex: none;\n}\n\n.dshr-lang {\n font-family: var(--ds-font-family-code, ui-monospace, SFMono-Regular, Menlo, monospace);\n font-size: 12px;\n line-height: 18px;\n font-weight: 500;\n color: var(--dsw-alias-label-tertiary, #81858c);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: 240px;\n}\n\n.dshr-seg {\n display: inline-flex;\n align-items: center;\n gap: 2px;\n padding: 2px;\n border-radius: var(--dsw-radius-sm, 8px);\n background: var(--dsw-alias-markdown-code-segment-unselected, rgba(38, 49, 72, 0.06));\n}\n\n.dshr-seg-btn {\n appearance: none;\n border: 0;\n background: transparent;\n color: var(--dsw-alias-label-secondary, #61666b);\n padding: 2px 9px;\n border-radius: 6px;\n font-family: inherit;\n font-size: 12px;\n line-height: 18px;\n font-weight: 500;\n cursor: pointer;\n transition: background-color 0.14s ease, color 0.14s ease;\n}\n\n.dshr-seg-btn:hover:not([data-active=\"true\"]) {\n color: var(--dsw-alias-label-primary, inherit);\n}\n\n.dshr-seg-btn[data-active=\"true\"] {\n background: var(--dsw-alias-markdown-code-segment-selected, #ffffff);\n color: var(--dsw-alias-label-primary, inherit);\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);\n}\n\n.dshr-icon-btn {\n appearance: none;\n border: 0;\n background: transparent;\n color: var(--dsw-alias-label-secondary, #61666b);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n border-radius: var(--dsw-radius-sm, 8px);\n cursor: pointer;\n transition: background-color 0.14s ease, color 0.14s ease;\n}\n\n.dshr-icon-btn:hover {\n background: var(--dsw-alias-interactive-bg-hover, rgba(38, 49, 72, 0.06));\n color: var(--dsw-alias-label-primary, inherit);\n}\n\n.dshr-icon-btn[aria-pressed=\"true\"] {\n background: var(--dsw-alias-interactive-bg-active, rgba(38, 49, 72, 0.1));\n color: var(--dsw-alias-label-primary, inherit);\n}\n\n.dshr-btn {\n appearance: none;\n border: 0.5px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));\n background: var(--dsw-alias-button-floating-fill, var(--dsw-alias-bg-base, #ffffff));\n color: var(--dsw-alias-label-primary, inherit);\n padding: 5px 12px;\n border-radius: var(--dsw-radius-sm, 8px);\n font-family: inherit;\n font-size: 12px;\n line-height: 16px;\n font-weight: 500;\n cursor: pointer;\n transition: background-color 0.14s ease;\n}\n\n.dshr-btn:hover {\n background: var(--dsw-alias-button-floating-hover, var(--dsw-alias-interactive-bg-hover));\n}\n\n.dshr-btn-accent {\n border-color: transparent;\n background: var(--dsw-alias-state-business-tertiary, #e4edfd);\n color: var(--dsw-alias-state-business-primary, #4176e6);\n}\n\n.dshr-btn-accent:hover {\n background: var(--dsw-alias-state-business-tertiary, #e4edfd);\n opacity: 0.88;\n}\n\n.dshr-body {\n position: relative;\n background: var(--dsw-alias-bg-base, #ffffff);\n}\n\n.dshr-code-wrap {\n background: var(--dsw-alias-markdown-code-block, #f9fafb);\n}\n\n.dshr-code-wrap > * {\n margin: 0 !important;\n border: none !important;\n border-radius: 0 !important;\n box-shadow: none !important;\n}\n\n.dshr-code-scroll {\n overflow: auto;\n background: var(--shiki-background, var(--dsw-alias-markdown-code-block, #f9fafb));\n}\n\n.dshr-code-pre {\n margin: 0 !important;\n padding: 14px 16px;\n font-family: var(--ds-font-family-code, ui-monospace, SFMono-Regular, Menlo, monospace);\n font-size: 12.5px;\n line-height: 1.6;\n color: var(--shiki-foreground, var(--dsw-alias-label-primary, inherit));\n background: transparent;\n overflow: visible;\n white-space: pre;\n word-break: normal;\n overflow-wrap: normal;\n tab-size: 2;\n}\n\n.dshr-code-scroll[data-wrap=\"true\"] .dshr-code-pre {\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n}\n\n.dshr-code-inner {\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n background: transparent !important;\n border: none !important;\n padding: 0 !important;\n}\n\n.dshr-frame-host {\n position: relative;\n width: 100%;\n background: var(--dsw-alias-bg-base, #ffffff);\n overflow: hidden;\n contain: layout style;\n}\n\n.dshr-iframe {\n display: block;\n width: 100%;\n height: 100%;\n border: none;\n background: var(--dsw-alias-bg-base, #ffffff);\n}\n\n.dshr-notice {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n padding: 8px 14px;\n font-size: 12px;\n color: var(--dsw-alias-label-secondary, #61666b);\n background: var(--dsw-alias-markdown-code-block, #f9fafb);\n border-bottom: 0.5px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.04));\n}\n\n.dshr-error {\n padding: 8px 14px;\n font-size: 12px;\n color: var(--dsw-alias-state-error-primary, #ec1313);\n background: var(--dsw-alias-interactive-bg-hover-danger, rgba(236, 19, 19, 0.05));\n border-top: 0.5px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.06));\n overflow-wrap: anywhere;\n}\n\n.dshr-sleeping {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 10px;\n padding: 28px 16px;\n color: var(--dsw-alias-label-secondary, #61666b);\n text-align: center;\n}\n\n.dshr-svg-wrap {\n position: relative;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n min-height: 0;\n background: var(--dsw-alias-bg-base, #ffffff);\n}\n\n.dshr-svg-stage {\n overflow: auto;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 20px 16px 42px;\n min-height: 120px;\n}\n\n.dshr-svg-stage[data-checker=\"true\"] {\n background-image:\n linear-gradient(45deg, var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.05)) 25%, transparent 25%),\n linear-gradient(-45deg, var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.05)) 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.05)) 75%),\n linear-gradient(-45deg, transparent 75%, var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.05)) 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0;\n}\n\n.dshr-svg-img {\n display: block;\n max-width: 100%;\n height: auto;\n border-radius: var(--dsw-radius-xs, 4px);\n user-select: none;\n}\n\n.dshr-svg-floating {\n position: absolute;\n right: 10px;\n bottom: 10px;\n display: inline-flex;\n align-items: center;\n gap: 2px;\n padding: 3px;\n border-radius: var(--dsw-radius-sm, 8px);\n border: 0.5px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));\n background: var(--dsw-alias-button-floating-fill, var(--dsw-alias-bg-base, #ffffff));\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);\n}\n\n.dshr-svg-divider {\n width: 1px;\n height: 14px;\n margin: 0 2px;\n background: var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));\n}\n\n.dshr-zoom-readout {\n appearance: none;\n border: 0;\n background: transparent;\n color: var(--dsw-alias-label-secondary, #61666b);\n min-width: 42px;\n height: 24px;\n padding: 0 6px;\n border-radius: 6px;\n font-family: inherit;\n font-size: 11px;\n line-height: 24px;\n text-align: center;\n cursor: pointer;\n transition: background-color 0.14s ease, color 0.14s ease;\n}\n\n.dshr-zoom-readout:hover {\n background: var(--dsw-alias-interactive-bg-hover, rgba(38, 49, 72, 0.06));\n color: var(--dsw-alias-label-primary, inherit);\n}\n\n.dshr-svg-floating .dshr-icon-btn {\n width: 24px;\n height: 24px;\n border-radius: 6px;\n}\n\n.dshr-workbench {\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n background: var(--dsw-alias-bg-base, #ffffff);\n color: var(--dsw-alias-label-primary, inherit);\n font-family: var(--dsw-font-family, system-ui, -apple-system, sans-serif);\n}\n\n.dshr-workbench-title {\n font-family: inherit;\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n color: var(--dsw-alias-label-primary, inherit);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: 280px;\n}\n\n.dshr-tab-title-icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n color: var(--dsw-alias-state-business-primary, #4176e6);\n}\n\n.dshr-doc-card {\n appearance: none;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: 10px;\n min-width: 0;\n width: 100%;\n min-height: 60px;\n padding: 8px 12px 8px 10px;\n margin: 0;\n overflow: hidden;\n border: 0.5px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.06));\n border-radius: var(--dsw-radius-lg, 16px);\n background: var(--dsw-alias-card-fill, var(--dsw-alias-markdown-code-block, #f9fafb));\n color: var(--dsw-alias-label-primary, inherit);\n font-family: var(--dsw-font-family, system-ui, -apple-system, sans-serif);\n text-align: left;\n cursor: pointer;\n transition: background-color 120ms ease, border-color 120ms ease;\n}\n\n@media (hover: hover) {\n .dshr-doc-card[data-dshr-state=\"ready\"]:hover {\n background: var(--dsw-alias-card-fill-hover, var(--dsw-alias-interactive-bg-hover, rgba(38, 49, 72, 0.06)));\n border-color: var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));\n }\n\n .dshr-doc-card[data-dshr-state=\"ready\"]:hover .dshr-doc-chevron {\n color: var(--dsw-alias-label-primary, inherit);\n transform: translateX(2px);\n }\n}\n\n.dshr-doc-card:focus-visible {\n outline: var(--dsw-focus-ring-width, 2px) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary, #4176e6));\n outline-offset: 2px;\n}\n\n.dshr-doc-icon {\n box-sizing: border-box;\n flex: none;\n display: grid;\n place-items: center;\n width: 40px;\n height: 40px;\n border: 0.5px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.06));\n border-radius: 10px;\n background: var(--dsw-alias-card-tile-fill, var(--dsw-alias-bg-base, #ffffff));\n color: var(--dsw-alias-state-business-primary, #4176e6);\n}\n\n.dshr-doc-details {\n display: flex;\n flex: 1;\n flex-direction: column;\n justify-content: center;\n gap: 2px;\n min-width: 0;\n}\n\n.dshr-doc-title {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n color: var(--dsw-alias-label-primary, inherit);\n}\n\n.dshr-doc-meta {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 11px;\n font-weight: 400;\n line-height: 16px;\n color: var(--dsw-alias-label-tertiary, #81858c);\n}\n\n.dshr-doc-card[data-dshr-state=\"streaming\"],\n.dshr-doc-card[data-dshr-state=\"error\"] {\n cursor: default;\n}\n\n.dshr-doc-card[data-dshr-state=\"error\"] {\n border-color: var(--dsw-alias-state-error-primary, #ec1313);\n}\n\n.dshr-doc-card[data-dshr-state=\"error\"] .dshr-doc-icon,\n.dshr-doc-card[data-dshr-state=\"error\"] .dshr-doc-meta {\n color: var(--dsw-alias-state-error-primary, #ec1313);\n}\n\n@keyframes dshr-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n.dshr-spinner {\n box-sizing: border-box;\n width: 15px;\n height: 15px;\n flex: none;\n border-radius: 50%;\n border: 1.75px solid var(--dsw-alias-border-l3, rgba(0, 0, 0, 0.14));\n border-top-color: var(--dsw-alias-state-business-primary, #4176e6);\n animation: dshr-spin 0.8s linear infinite;\n}\n\n.dshr-doc-chevron {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n color: var(--dsw-alias-label-tertiary, #81858c);\n transition: color 120ms ease, transform 120ms ease;\n}\n\n.dshr-workbench-body {\n flex: 1 1 auto;\n min-height: 0;\n overflow: auto;\n display: flex;\n flex-direction: column;\n background: var(--dsw-alias-bg-base, #ffffff);\n}\n\n.dshr-modal-backdrop {\n position: fixed;\n inset: 0;\n z-index: 1200;\n pointer-events: auto;\n background: var(--dsw-alias-bg-mask-1, rgba(0, 0, 0, 0.28));\n backdrop-filter: blur(4px);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 24px;\n}\n\n.dshr-modal-panel {\n width: min(1120px, 94vw);\n height: min(820px, 90vh);\n border-radius: var(--dsw-radius-lg, 16px);\n overflow: hidden;\n border: 0.5px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.12));\n background: var(--dsw-alias-bg-base, #ffffff);\n box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);\n display: flex;\n flex-direction: column;\n}\n\n.dshr-turn-media {\n margin: 8px 0 0;\n padding: 10px 12px;\n border-radius: var(--dsw-radius-md, 12px);\n border: 0.5px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));\n background: var(--dsw-alias-markdown-code-block, #f9fafb);\n font-family: var(--dsw-font-family, system-ui, -apple-system, sans-serif);\n}\n\n.dshr-turn-media-header {\n font-size: 11px;\n line-height: 16px;\n font-weight: 500;\n color: var(--dsw-alias-label-tertiary, #81858c);\n margin-bottom: 8px;\n}\n\n.dshr-turn-media-grid {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n\n.dshr-turn-media-thumb {\n appearance: none;\n padding: 6px;\n border-radius: var(--dsw-radius-sm, 8px);\n border: 0.5px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));\n background: var(--dsw-alias-bg-base, #ffffff);\n cursor: pointer;\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n gap: 5px;\n max-width: 220px;\n transition: border-color 0.14s ease, box-shadow 0.14s ease;\n}\n\n.dshr-turn-media-thumb:hover {\n border-color: var(--dsw-alias-state-business-primary, #4176e6);\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n}\n\n.dshr-turn-media-img {\n display: block;\n max-width: 208px;\n max-height: 150px;\n object-fit: contain;\n border-radius: var(--dsw-radius-xs, 4px);\n}\n\n.dshr-turn-media-caption {\n font-size: 11px;\n color: var(--dsw-alias-label-secondary, #61666b);\n max-width: 204px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.dshr-lightbox-img {\n display: block;\n max-width: 100%;\n max-height: 100%;\n margin: auto;\n object-fit: contain;\n border-radius: var(--dsw-radius-sm, 8px);\n}\n";
|
|
18
|
+
export declare const RENDERER_STYLES = "\n.dshr-card {\n margin: 0;\n border-radius: var(--dsw-radius-lg, 16px);\n border: 0.5px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));\n background: var(--dsw-alias-markdown-code-block, #f9fafb);\n color: var(--dsw-alias-label-primary, inherit);\n font-family: var(--dsw-font-family, system-ui, -apple-system, sans-serif);\n font-size: 13px;\n line-height: 1.5;\n overflow: hidden;\n}\n\n.dshr-toolbar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n height: 40px;\n padding: 0 10px 0 16px;\n background: var(--dsw-alias-markdown-code-block-banner, var(--dsw-alias-markdown-code-block, #f9fafb));\n border-bottom: 0.5px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.04));\n flex-wrap: nowrap;\n}\n\n.dshr-toolbar-group {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n min-width: 0;\n}\n\n.dshr-actions {\n display: inline-flex;\n align-items: center;\n gap: 2px;\n flex: none;\n}\n\n.dshr-lang {\n font-family: var(--ds-font-family-code, ui-monospace, SFMono-Regular, Menlo, monospace);\n font-size: 12px;\n line-height: 18px;\n font-weight: 500;\n color: var(--dsw-alias-label-tertiary, #81858c);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: 240px;\n}\n\n.dshr-seg {\n display: inline-flex;\n align-items: center;\n gap: 2px;\n padding: 2px;\n border-radius: var(--dsw-radius-sm, 8px);\n background: var(--dsw-alias-markdown-code-segment-unselected, rgba(38, 49, 72, 0.06));\n}\n\n.dshr-seg-btn {\n appearance: none;\n border: 0;\n background: transparent;\n color: var(--dsw-alias-label-secondary, #61666b);\n padding: 2px 9px;\n border-radius: 6px;\n font-family: inherit;\n font-size: 12px;\n line-height: 18px;\n font-weight: 500;\n cursor: pointer;\n transition: background-color 0.14s ease, color 0.14s ease;\n}\n\n.dshr-seg-btn:hover:not([data-active=\"true\"]) {\n color: var(--dsw-alias-label-primary, inherit);\n}\n\n.dshr-seg-btn[data-active=\"true\"] {\n background: var(--dsw-alias-markdown-code-segment-selected, #ffffff);\n color: var(--dsw-alias-label-primary, inherit);\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);\n}\n\n.dshr-icon-btn {\n appearance: none;\n border: 0;\n background: transparent;\n color: var(--dsw-alias-label-secondary, #61666b);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n padding: 0;\n border-radius: var(--dsw-radius-sm, 8px);\n cursor: pointer;\n transition: background-color 0.14s ease, color 0.14s ease;\n}\n\n.dshr-icon-btn:hover {\n background: var(--dsw-alias-interactive-bg-hover, rgba(38, 49, 72, 0.06));\n color: var(--dsw-alias-label-primary, inherit);\n}\n\n.dshr-icon-btn[aria-pressed=\"true\"] {\n background: var(--dsw-alias-interactive-bg-active, rgba(38, 49, 72, 0.1));\n color: var(--dsw-alias-label-primary, inherit);\n}\n\n.dshr-btn {\n appearance: none;\n border: 0.5px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));\n background: var(--dsw-alias-button-floating-fill, var(--dsw-alias-bg-base, #ffffff));\n color: var(--dsw-alias-label-primary, inherit);\n padding: 5px 12px;\n border-radius: var(--dsw-radius-sm, 8px);\n font-family: inherit;\n font-size: 12px;\n line-height: 16px;\n font-weight: 500;\n cursor: pointer;\n transition: background-color 0.14s ease;\n}\n\n.dshr-btn:hover {\n background: var(--dsw-alias-button-floating-hover, var(--dsw-alias-interactive-bg-hover));\n}\n\n.dshr-btn-accent {\n border-color: transparent;\n background: var(--dsw-alias-state-business-tertiary, #e4edfd);\n color: var(--dsw-alias-state-business-primary, #4176e6);\n}\n\n.dshr-btn-accent:hover {\n background: var(--dsw-alias-state-business-tertiary, #e4edfd);\n opacity: 0.88;\n}\n\n.dshr-body {\n position: relative;\n background: var(--dsw-alias-bg-base, #ffffff);\n}\n\n.dshr-code-wrap {\n background: var(--dsw-alias-markdown-code-block, #f9fafb);\n}\n\n.dshr-code-wrap > * {\n margin: 0 !important;\n border: none !important;\n border-radius: 0 !important;\n box-shadow: none !important;\n}\n\n.dshr-code-scroll {\n overflow: auto;\n background: var(--shiki-background, var(--dsw-alias-markdown-code-block, #f9fafb));\n}\n\n.dshr-code-pre {\n margin: 0 !important;\n padding: 14px 16px;\n font-family: var(--ds-font-family-code, ui-monospace, SFMono-Regular, Menlo, monospace);\n font-size: 12.5px;\n line-height: 1.6;\n color: var(--shiki-foreground, var(--dsw-alias-label-primary, inherit));\n background: transparent;\n overflow: visible;\n white-space: pre;\n word-break: normal;\n overflow-wrap: normal;\n tab-size: 2;\n}\n\n.dshr-code-scroll[data-wrap=\"true\"] .dshr-code-pre {\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n}\n\n.dshr-code-inner {\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n background: transparent !important;\n border: none !important;\n padding: 0 !important;\n}\n\n.dshr-frame-host {\n position: relative;\n width: 100%;\n background: var(--dsw-alias-bg-base, #ffffff);\n overflow: hidden;\n contain: layout style;\n}\n\n.dshr-iframe {\n display: block;\n width: 100%;\n height: 100%;\n border: none;\n background: var(--dsw-alias-bg-base, #ffffff);\n}\n\n.dshr-notice {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n padding: 8px 14px;\n font-size: 12px;\n color: var(--dsw-alias-label-secondary, #61666b);\n background: var(--dsw-alias-markdown-code-block, #f9fafb);\n border-bottom: 0.5px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.04));\n}\n\n.dshr-error {\n padding: 8px 14px;\n font-size: 12px;\n color: var(--dsw-alias-state-error-primary, #ec1313);\n background: var(--dsw-alias-interactive-bg-hover-danger, rgba(236, 19, 19, 0.05));\n border-top: 0.5px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.06));\n overflow-wrap: anywhere;\n}\n\n.dshr-sleeping {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 10px;\n padding: 28px 16px;\n color: var(--dsw-alias-label-secondary, #61666b);\n text-align: center;\n}\n\n.dshr-svg-wrap {\n position: relative;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n min-height: 0;\n background: var(--dsw-alias-bg-base, #ffffff);\n}\n\n.dshr-svg-stage {\n overflow: auto;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 20px 16px 42px;\n min-height: 120px;\n}\n\n.dshr-svg-stage[data-checker=\"true\"] {\n background-image:\n linear-gradient(45deg, var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.05)) 25%, transparent 25%),\n linear-gradient(-45deg, var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.05)) 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.05)) 75%),\n linear-gradient(-45deg, transparent 75%, var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.05)) 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0;\n}\n\n.dshr-svg-img {\n display: block;\n max-width: 100%;\n height: auto;\n border-radius: var(--dsw-radius-xs, 4px);\n user-select: none;\n}\n\n.dshr-svg-floating {\n position: absolute;\n right: 10px;\n bottom: 10px;\n display: inline-flex;\n align-items: center;\n gap: 2px;\n padding: 3px;\n border-radius: var(--dsw-radius-sm, 8px);\n border: 0.5px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));\n background: var(--dsw-alias-button-floating-fill, var(--dsw-alias-bg-base, #ffffff));\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);\n}\n\n.dshr-svg-divider {\n width: 1px;\n height: 14px;\n margin: 0 2px;\n background: var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));\n}\n\n.dshr-zoom-readout {\n appearance: none;\n border: 0;\n background: transparent;\n color: var(--dsw-alias-label-secondary, #61666b);\n min-width: 42px;\n height: 24px;\n padding: 0 6px;\n border-radius: 6px;\n font-family: inherit;\n font-size: 11px;\n line-height: 24px;\n text-align: center;\n cursor: pointer;\n transition: background-color 0.14s ease, color 0.14s ease;\n}\n\n.dshr-zoom-readout:hover {\n background: var(--dsw-alias-interactive-bg-hover, rgba(38, 49, 72, 0.06));\n color: var(--dsw-alias-label-primary, inherit);\n}\n\n.dshr-svg-floating .dshr-icon-btn {\n width: 24px;\n height: 24px;\n border-radius: 6px;\n}\n\n.dshr-workbench {\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n background: var(--dsw-alias-bg-base, #ffffff);\n color: var(--dsw-alias-label-primary, inherit);\n font-family: var(--dsw-font-family, system-ui, -apple-system, sans-serif);\n}\n\n.dshr-workbench-title {\n font-family: inherit;\n font-size: 13px;\n line-height: 20px;\n font-weight: 500;\n color: var(--dsw-alias-label-primary, inherit);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: 280px;\n}\n\n.dshr-tab-title-icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n color: var(--dsw-alias-state-business-primary, #4176e6);\n}\n\n.dshr-doc-card {\n appearance: none;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: 10px;\n min-width: 0;\n width: 100%;\n min-height: 60px;\n padding: 8px 12px 8px 10px;\n margin: 0;\n overflow: hidden;\n border: 0.5px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.06));\n border-radius: var(--dsw-radius-lg, 16px);\n background: var(--dsw-alias-card-fill, var(--dsw-alias-markdown-code-block, #f9fafb));\n color: var(--dsw-alias-label-primary, inherit);\n font-family: var(--dsw-font-family, system-ui, -apple-system, sans-serif);\n text-align: left;\n cursor: pointer;\n transition: background-color 120ms ease, border-color 120ms ease;\n}\n\n@media (hover: hover) {\n .dshr-doc-card[data-dshr-state=\"ready\"]:hover {\n background: var(--dsw-alias-card-fill-hover, var(--dsw-alias-interactive-bg-hover, rgba(38, 49, 72, 0.06)));\n border-color: var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));\n }\n\n .dshr-doc-card[data-dshr-state=\"ready\"]:hover .dshr-doc-chevron {\n color: var(--dsw-alias-label-primary, inherit);\n transform: translateX(2px);\n }\n}\n\n.dshr-doc-card:focus-visible {\n outline: var(--dsw-focus-ring-width, 2px) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary, #4176e6));\n outline-offset: 2px;\n}\n\n.dshr-doc-icon {\n box-sizing: border-box;\n flex: none;\n display: grid;\n place-items: center;\n width: 40px;\n height: 40px;\n border: 0.5px solid var(--dsw-alias-border-l1, rgba(0, 0, 0, 0.06));\n border-radius: 10px;\n background: var(--dsw-alias-card-tile-fill, var(--dsw-alias-bg-base, #ffffff));\n color: var(--dsw-alias-state-business-primary, #4176e6);\n}\n\n.dshr-doc-details {\n display: flex;\n flex: 1;\n flex-direction: column;\n justify-content: center;\n gap: 2px;\n min-width: 0;\n}\n\n.dshr-doc-title {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n color: var(--dsw-alias-label-primary, inherit);\n}\n\n.dshr-doc-meta {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 11px;\n font-weight: 400;\n line-height: 16px;\n color: var(--dsw-alias-label-tertiary, #81858c);\n}\n\n.dshr-doc-card[data-dshr-state=\"streaming\"],\n.dshr-doc-card[data-dshr-state=\"error\"] {\n cursor: default;\n}\n\n.dshr-doc-card[data-dshr-state=\"error\"] {\n border-color: var(--dsw-alias-state-error-primary, #ec1313);\n}\n\n.dshr-doc-card[data-dshr-state=\"error\"] .dshr-doc-icon,\n.dshr-doc-card[data-dshr-state=\"error\"] .dshr-doc-meta {\n color: var(--dsw-alias-state-error-primary, #ec1313);\n}\n\n.dshr-tool-receipt {\n appearance: none;\n display: inline-flex;\n align-items: center;\n gap: 6px;\n max-width: 100%;\n padding: 2px 6px;\n margin: 0;\n border: none;\n border-radius: 6px;\n background: transparent;\n color: var(--dsw-alias-label-tertiary, #81858c);\n font-family: var(--dsw-font-family, system-ui, -apple-system, sans-serif);\n font-size: 12px;\n line-height: 18px;\n text-align: left;\n cursor: pointer;\n transition: color 120ms ease, background-color 120ms ease;\n}\n\n.dshr-tool-receipt[data-dshr-state=\"streaming\"],\n.dshr-tool-receipt[data-dshr-state=\"error\"] {\n cursor: default;\n}\n\n.dshr-tool-receipt[data-dshr-state=\"error\"] {\n color: var(--dsw-alias-state-error-primary, #ec1313);\n}\n\n@media (hover: hover) {\n .dshr-tool-receipt[data-dshr-state=\"ready\"]:hover {\n color: var(--dsw-alias-label-primary, inherit);\n background: var(--dsw-alias-interactive-bg-hover, rgba(38, 49, 72, 0.05));\n }\n}\n\n.dshr-tool-receipt-title {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n min-width: 0;\n}\n\n.dshr-tool-receipt-action {\n flex: none;\n font-size: 11px;\n color: var(--dsw-alias-state-business-primary, #4176e6);\n}\n\n@keyframes dshr-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n.dshr-spinner {\n box-sizing: border-box;\n width: 15px;\n height: 15px;\n flex: none;\n border-radius: 50%;\n border: 1.75px solid var(--dsw-alias-border-l3, rgba(0, 0, 0, 0.14));\n border-top-color: var(--dsw-alias-state-business-primary, #4176e6);\n animation: dshr-spin 0.8s linear infinite;\n}\n\n.dshr-doc-chevron {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n color: var(--dsw-alias-label-tertiary, #81858c);\n transition: color 120ms ease, transform 120ms ease;\n}\n\n.dshr-workbench-body {\n flex: 1 1 auto;\n min-height: 0;\n overflow: auto;\n display: flex;\n flex-direction: column;\n background: var(--dsw-alias-bg-base, #ffffff);\n}\n\n.dshr-modal-backdrop {\n position: fixed;\n inset: 0;\n z-index: 1200;\n pointer-events: auto;\n background: var(--dsw-alias-bg-mask-1, rgba(0, 0, 0, 0.28));\n backdrop-filter: blur(4px);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 24px;\n}\n\n.dshr-modal-panel {\n width: min(1120px, 94vw);\n height: min(820px, 90vh);\n border-radius: var(--dsw-radius-lg, 16px);\n overflow: hidden;\n border: 0.5px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.12));\n background: var(--dsw-alias-bg-base, #ffffff);\n box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);\n display: flex;\n flex-direction: column;\n}\n\n.dshr-turn-media {\n margin: 8px 0 0;\n padding: 10px 12px;\n border-radius: var(--dsw-radius-md, 12px);\n border: 0.5px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));\n background: var(--dsw-alias-markdown-code-block, #f9fafb);\n font-family: var(--dsw-font-family, system-ui, -apple-system, sans-serif);\n}\n\n.dshr-turn-media-header {\n font-size: 11px;\n line-height: 16px;\n font-weight: 500;\n color: var(--dsw-alias-label-tertiary, #81858c);\n margin-bottom: 8px;\n}\n\n.dshr-turn-media-grid {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n\n.dshr-turn-media-thumb {\n appearance: none;\n padding: 6px;\n border-radius: var(--dsw-radius-sm, 8px);\n border: 0.5px solid var(--dsw-alias-border-l2, rgba(0, 0, 0, 0.1));\n background: var(--dsw-alias-bg-base, #ffffff);\n cursor: pointer;\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n gap: 5px;\n max-width: 220px;\n transition: border-color 0.14s ease, box-shadow 0.14s ease;\n}\n\n.dshr-turn-media-thumb:hover {\n border-color: var(--dsw-alias-state-business-primary, #4176e6);\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n}\n\n.dshr-turn-media-img {\n display: block;\n max-width: 208px;\n max-height: 150px;\n object-fit: contain;\n border-radius: var(--dsw-radius-xs, 4px);\n}\n\n.dshr-turn-media-caption {\n font-size: 11px;\n color: var(--dsw-alias-label-secondary, #61666b);\n max-width: 204px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.dshr-lightbox-img {\n display: block;\n max-width: 100%;\n max-height: 100%;\n margin: auto;\n object-fit: contain;\n border-radius: var(--dsw-radius-sm, 8px);\n}\n";
|
|
19
19
|
/** Insert the plugin stylesheet into `document.head` and return a cleanup callback. */
|
|
20
20
|
export declare function injectRendererStyles(): () => void;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module dsh-renderer/client/types
|
|
8
8
|
*/
|
|
9
9
|
import type { RendererPluginConfig } from '../shared/config-defaults.ts';
|
|
10
|
-
import type { ArtifactKind, ArtifactStore, SandboxLruPool } from '../shared/sandbox-core.ts';
|
|
10
|
+
import type { ArtifactKind, ArtifactRecord, ArtifactSessionAddress, ArtifactStore, SandboxLruPool } from '../shared/sandbox-core.ts';
|
|
11
11
|
import type { SandboxThemeTokens } from '../shared/sanitize.ts';
|
|
12
12
|
import type { LocaleKey } from './locales.ts';
|
|
13
13
|
/** Minimal structural subset of React 18 provided by DSH's browser module table. */
|
|
@@ -41,9 +41,15 @@ export interface ClientThemeService {
|
|
|
41
41
|
readonly id?: string;
|
|
42
42
|
} | undefined;
|
|
43
43
|
}
|
|
44
|
+
/** Minimal observable snapshot interface shared across DSH client services. */
|
|
45
|
+
export interface ClientObservable<T> {
|
|
46
|
+
getSnapshot(): T;
|
|
47
|
+
subscribe(listener: () => void): () => void;
|
|
48
|
+
}
|
|
44
49
|
/** Structural subset of the optional right-Sidebar navigation service (`ctx.get('sidebarRight')`). */
|
|
45
50
|
export interface ClientSidebarRightService {
|
|
46
51
|
openResource(address: string, options?: Record<string, unknown>): void;
|
|
52
|
+
readonly mounted?: ClientObservable<string | undefined>;
|
|
47
53
|
}
|
|
48
54
|
/** Structural subset of the optional right-Sidebar tab registry (`ctx.get('sidebarRightTabs')`). */
|
|
49
55
|
export interface ClientSidebarRightTabsService {
|
|
@@ -52,10 +58,106 @@ export interface ClientSidebarRightTabsService {
|
|
|
52
58
|
readonly kind: string;
|
|
53
59
|
readonly patterns?: readonly string[];
|
|
54
60
|
readonly priority?: 'extension' | 'builtin' | 'fallback';
|
|
61
|
+
readonly canOpen?: (address: string) => boolean;
|
|
55
62
|
readonly title: (address: string) => string;
|
|
56
63
|
readonly keepMounted?: boolean;
|
|
57
64
|
}): () => void;
|
|
58
65
|
}
|
|
66
|
+
/** Structural subset of DSH's `ctx.uiConversation` service (`@deepseek-ai/dsh-client-ui-conversation`). */
|
|
67
|
+
export interface ClientUiConversationService {
|
|
68
|
+
readonly events?: {
|
|
69
|
+
register(definition: Record<string, unknown>): () => void;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/** Structural subset of DSH's `ctx.sessions` service (`@deepseek-ai/dsh-client-ui-session`). */
|
|
73
|
+
export interface ClientSessionsService {
|
|
74
|
+
subagentAddress?(sessionId: string): {
|
|
75
|
+
readonly parentSessionId: string;
|
|
76
|
+
readonly childSessionId: string;
|
|
77
|
+
readonly mode: 'one-shot' | 'continuable' | 'unknown';
|
|
78
|
+
} | undefined;
|
|
79
|
+
}
|
|
80
|
+
/** Structural subset of DSH's `ctx.remote.session` read API for durable history recovery. */
|
|
81
|
+
export interface ClientSessionHistoryRemote {
|
|
82
|
+
events(input: {
|
|
83
|
+
readonly address: ArtifactSessionAddress;
|
|
84
|
+
}, signal?: AbortSignal): Promise<{
|
|
85
|
+
readonly ok: true;
|
|
86
|
+
readonly value: {
|
|
87
|
+
readonly cursor: number;
|
|
88
|
+
readonly hasMore: boolean;
|
|
89
|
+
readonly records: readonly {
|
|
90
|
+
readonly event: {
|
|
91
|
+
readonly type: string;
|
|
92
|
+
readonly seq: number;
|
|
93
|
+
readonly data: unknown;
|
|
94
|
+
};
|
|
95
|
+
}[];
|
|
96
|
+
};
|
|
97
|
+
} | {
|
|
98
|
+
readonly ok: false;
|
|
99
|
+
readonly error: {
|
|
100
|
+
readonly code?: string;
|
|
101
|
+
readonly message?: string;
|
|
102
|
+
};
|
|
103
|
+
}>;
|
|
104
|
+
page(input: {
|
|
105
|
+
readonly address: ArtifactSessionAddress;
|
|
106
|
+
readonly throughSeq: number;
|
|
107
|
+
readonly beforeSeq: number;
|
|
108
|
+
}, signal?: AbortSignal): Promise<{
|
|
109
|
+
readonly ok: true;
|
|
110
|
+
readonly value: {
|
|
111
|
+
readonly hasMore: boolean;
|
|
112
|
+
readonly records: readonly {
|
|
113
|
+
readonly event: {
|
|
114
|
+
readonly type: string;
|
|
115
|
+
readonly seq: number;
|
|
116
|
+
readonly data: unknown;
|
|
117
|
+
};
|
|
118
|
+
}[];
|
|
119
|
+
};
|
|
120
|
+
} | {
|
|
121
|
+
readonly ok: false;
|
|
122
|
+
readonly error: {
|
|
123
|
+
readonly code?: string;
|
|
124
|
+
readonly message?: string;
|
|
125
|
+
};
|
|
126
|
+
}>;
|
|
127
|
+
}
|
|
128
|
+
/** Structural subset of DSH's `ctx.remote` namespace container. */
|
|
129
|
+
export interface ClientRemoteService {
|
|
130
|
+
readonly session?: ClientSessionHistoryRemote;
|
|
131
|
+
}
|
|
132
|
+
/** Frame yielded by a `ctx.resources` provider stream. */
|
|
133
|
+
export type ClientResourceFrame<T = unknown> = {
|
|
134
|
+
readonly ok: true;
|
|
135
|
+
readonly value: T;
|
|
136
|
+
} | {
|
|
137
|
+
readonly ok: false;
|
|
138
|
+
readonly error: {
|
|
139
|
+
readonly code: string;
|
|
140
|
+
readonly message: string;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
/** Structural subset of DSH's `ctx.resources` service (`@deepseek-ai/dsh-client-resources`). */
|
|
144
|
+
export interface ClientResourcesService {
|
|
145
|
+
register(provider: {
|
|
146
|
+
readonly protocol: string;
|
|
147
|
+
open(address: string, context: {
|
|
148
|
+
readonly signal: AbortSignal;
|
|
149
|
+
}): AsyncIterable<ClientResourceFrame<ArtifactRecord>>;
|
|
150
|
+
}): () => void;
|
|
151
|
+
}
|
|
152
|
+
/** Snapshot returned by DSH's root-injected `useResource(address)` hook. */
|
|
153
|
+
export interface ClientResourceSnapshot<T = unknown> {
|
|
154
|
+
readonly status: 'none' | 'loading' | 'live' | 'failed';
|
|
155
|
+
readonly value?: T | undefined;
|
|
156
|
+
readonly failure?: {
|
|
157
|
+
readonly code?: string;
|
|
158
|
+
readonly message?: string;
|
|
159
|
+
} | undefined;
|
|
160
|
+
}
|
|
59
161
|
/** Structural view of the browser Cordis plugin context. */
|
|
60
162
|
export interface ClientContext {
|
|
61
163
|
readonly slots?: ClientSlotsService;
|
|
@@ -155,6 +257,7 @@ export interface SidebarRightTabProps {
|
|
|
155
257
|
};
|
|
156
258
|
};
|
|
157
259
|
};
|
|
260
|
+
readonly useResource?: <T = ArtifactRecord>(address: string) => ClientResourceSnapshot<T>;
|
|
158
261
|
}
|
|
159
262
|
/** Theme observer facade shared across all Client components. */
|
|
160
263
|
export interface ClientThemeBridge {
|
|
@@ -171,6 +274,7 @@ export interface ClientEnv {
|
|
|
171
274
|
readonly artifacts: ArtifactStore;
|
|
172
275
|
readonly openArtifact: (input: {
|
|
173
276
|
readonly id?: string | undefined;
|
|
277
|
+
readonly address?: string | undefined;
|
|
174
278
|
readonly kind: ArtifactKind;
|
|
175
279
|
readonly lang?: string | undefined;
|
|
176
280
|
readonly title: string;
|
|
@@ -178,4 +282,12 @@ export interface ClientEnv {
|
|
|
178
282
|
readonly sessionId?: string | undefined;
|
|
179
283
|
readonly destination?: 'sidebar' | 'float' | 'modal';
|
|
180
284
|
}) => void;
|
|
285
|
+
/** Build a durable `dsh-resource://dsh-renderer/call/...` address for one `render_artifact` invocation. */
|
|
286
|
+
readonly resolveCallAddress?: (sessionId: string | undefined, callId: string) => string | undefined;
|
|
287
|
+
/** Return whether `sessionId` currently owns the on-screen right Sidebar. */
|
|
288
|
+
readonly isSessionOnScreen?: (sessionId: string | undefined) => boolean;
|
|
289
|
+
/** Subscribe to on-screen Session changes (drives deferred live auto-open). */
|
|
290
|
+
readonly subscribeSessionOnScreen?: (listener: () => void) => () => void;
|
|
291
|
+
/** Return whether the standalone `dsh-renderer:artifact` Chat node definition is active. */
|
|
292
|
+
readonly isArtifactNodePromoted?: () => boolean;
|
|
181
293
|
}
|
package/lib/types/config.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
16
16
|
enableWorkbench: z<boolean, boolean, "defined">;
|
|
17
17
|
complexContentToSidebar: z<boolean, boolean, "defined">;
|
|
18
18
|
enableArtifactTool: z<boolean, boolean, "defined">;
|
|
19
|
+
enableArtifactSkill: z<boolean, boolean, "defined">;
|
|
19
20
|
autoOpenArtifact: z<boolean, boolean, "defined">;
|
|
20
21
|
enableTurnMediaFallback: z<boolean, boolean, "defined">;
|
|
21
22
|
bridgeToolDataImages: z<boolean, boolean, "defined">;
|
|
@@ -30,6 +31,7 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
30
31
|
enableWorkbench: z<boolean, boolean, "defined">;
|
|
31
32
|
complexContentToSidebar: z<boolean, boolean, "defined">;
|
|
32
33
|
enableArtifactTool: z<boolean, boolean, "defined">;
|
|
34
|
+
enableArtifactSkill: z<boolean, boolean, "defined">;
|
|
33
35
|
autoOpenArtifact: z<boolean, boolean, "defined">;
|
|
34
36
|
enableTurnMediaFallback: z<boolean, boolean, "defined">;
|
|
35
37
|
bridgeToolDataImages: z<boolean, boolean, "defined">;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundled DSH runtime skill (`visual-artifact`) registered on `ctx.skills`.
|
|
3
|
+
*
|
|
4
|
+
* Keeps the always-on system prompt minimal while surfacing a clear, discoverable
|
|
5
|
+
* entry in DSH's `<available_skills>` catalog and enabling direct user invocation
|
|
6
|
+
* via `/visual-artifact`. When loaded on demand, it gives the model concrete craft
|
|
7
|
+
* rules for self-contained SVG diagrams, interactive HTML apps/charts, and long
|
|
8
|
+
* structured documents rendered through `render_artifact`.
|
|
9
|
+
*
|
|
10
|
+
* @module dsh-renderer/host/artifact-skill
|
|
11
|
+
*/
|
|
12
|
+
/** Kebab-case skill name registered with DSH's `ctx.skills` service. */
|
|
13
|
+
export declare const ARTIFACT_SKILL_NAME = "visual-artifact";
|
|
14
|
+
/** Structural subset of DSH's `ctx.skills` Host service (`@deepseek-ai/dsh-skill`). */
|
|
15
|
+
export interface HostSkillsService {
|
|
16
|
+
register(skill: {
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly description: string;
|
|
19
|
+
readonly whenToUse?: string;
|
|
20
|
+
readonly source: string;
|
|
21
|
+
readonly content: string;
|
|
22
|
+
readonly invocation?: {
|
|
23
|
+
readonly modelInvocable: boolean;
|
|
24
|
+
readonly userInvocable: boolean;
|
|
25
|
+
};
|
|
26
|
+
}): () => void;
|
|
27
|
+
}
|
|
28
|
+
/** Bundled runtime skill registration accepted by DSH `ctx.skills.register`. */
|
|
29
|
+
export declare const ARTIFACT_SKILL_REGISTRATION: {
|
|
30
|
+
readonly name: "visual-artifact";
|
|
31
|
+
readonly description: 'Create visual diagrams (architecture, flow, sequence, ER), interactive HTML demos/charts/prototypes, or long standalone documents rendered directly in the conversation and right Sidebar via render_artifact.';
|
|
32
|
+
readonly whenToUse: 'Use when a diagram, chart, interactive visualization, UI prototype, or long standalone document communicates the answer better than plain text or ASCII art.';
|
|
33
|
+
readonly source: 'bundled';
|
|
34
|
+
readonly invocation: {
|
|
35
|
+
readonly modelInvocable: true;
|
|
36
|
+
readonly userInvocable: true;
|
|
37
|
+
};
|
|
38
|
+
readonly content: string;
|
|
39
|
+
};
|
|
@@ -15,6 +15,13 @@ import { type ArtifactContentKind } from '../shared/content-complexity.ts';
|
|
|
15
15
|
export declare const ARTIFACT_TOOL_NAME = "render_artifact";
|
|
16
16
|
/** System-prompt section name registered on `ctx.systemPrompt`. */
|
|
17
17
|
export declare const ARTIFACT_PROMPT_SECTION_NAME = "dsh-renderer:artifact";
|
|
18
|
+
/**
|
|
19
|
+
* Placement order immediately after DSH's `DELIVERABLE_FILE_REFERENCES` (9000)
|
|
20
|
+
* and before `STRUCTURED_OUTPUT` (9900) / `HARNESS_SOURCE` (10000), so artifact
|
|
21
|
+
* guidance is not overshadowed by workspace file-delivery rules while remaining
|
|
22
|
+
* inside the reusable KV-cache prompt prefix.
|
|
23
|
+
*/
|
|
24
|
+
export declare const ARTIFACT_PROMPT_ORDER = 9050;
|
|
18
25
|
/** Canonical JSON value returned by `render_artifact`. */
|
|
19
26
|
export interface RenderArtifactOutput {
|
|
20
27
|
readonly artifactId: string;
|
|
@@ -27,13 +34,20 @@ export interface RenderArtifactOutput {
|
|
|
27
34
|
/** Structural subset of DSH's `ctx.tools` Host service. */
|
|
28
35
|
export interface HostToolsService {
|
|
29
36
|
register(definition: Record<string, unknown>): () => void;
|
|
37
|
+
get?(name: string, scope?: unknown, toolSet?: unknown): unknown;
|
|
38
|
+
}
|
|
39
|
+
/** Structural subset of `AssembleContext` passed by DSH's `ctx.systemPrompt`. */
|
|
40
|
+
export interface HostPromptAssembleContext {
|
|
41
|
+
readonly scope?: unknown;
|
|
42
|
+
readonly toolSet?: unknown;
|
|
30
43
|
}
|
|
31
44
|
/** Structural subset of DSH's `ctx.systemPrompt` Host service. */
|
|
32
45
|
export interface HostSystemPromptService {
|
|
33
46
|
section(section: {
|
|
34
47
|
readonly name: string;
|
|
35
48
|
readonly order: number;
|
|
36
|
-
readonly text: string;
|
|
49
|
+
readonly text: string | ((context: HostPromptAssembleContext) => string);
|
|
50
|
+
readonly interpolate?: boolean;
|
|
37
51
|
}): () => void;
|
|
38
52
|
}
|
|
39
53
|
/**
|
|
@@ -45,9 +59,24 @@ export interface HostSystemPromptService {
|
|
|
45
59
|
export declare function createRenderArtifactToolDefinition(options: {
|
|
46
60
|
readonly maxContentBytes: number;
|
|
47
61
|
}): Record<string, unknown>;
|
|
48
|
-
/**
|
|
62
|
+
/** Prompt guidance steering natural, intent-driven use of `render_artifact`. */
|
|
63
|
+
export declare const ARTIFACT_PROMPT_TEXT: string;
|
|
64
|
+
/** Static system-prompt section retained for callers and tests inspecting the constant directly. */
|
|
49
65
|
export declare const ARTIFACT_PROMPT_SECTION: {
|
|
50
66
|
readonly name: "dsh-renderer:artifact";
|
|
51
|
-
readonly order:
|
|
52
|
-
readonly text:
|
|
67
|
+
readonly order: 9050;
|
|
68
|
+
readonly text: string;
|
|
69
|
+
readonly interpolate: false;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Create a tool-aware system-prompt section for `render_artifact`.
|
|
73
|
+
*
|
|
74
|
+
* Omits guidance automatically when `render_artifact` is restricted or shadowed
|
|
75
|
+
* for the assembling agent scope (`ctx.tools.get(name, scope, toolSet)`).
|
|
76
|
+
*/
|
|
77
|
+
export declare function createArtifactPromptSection(getTools?: () => HostToolsService | undefined): {
|
|
78
|
+
readonly name: string;
|
|
79
|
+
readonly order: number;
|
|
80
|
+
readonly text: (context: HostPromptAssembleContext) => string;
|
|
81
|
+
readonly interpolate: boolean;
|
|
53
82
|
};
|