mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-09 04:02:35 +00:00
docs(visualizer): require self-contained widget sources
This commit is contained in:
@@ -2,5 +2,5 @@
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write docs/tool-catalog.md
|
||||
tool-catalog.md: ac1b84c279247990f22728995684f8d4ca6e5254
|
||||
tool-catalog.zh.md: 42071bbbf65fb0fb1ace66e8b1858a834a4b5e12
|
||||
tool-catalog.md: 731d7b0c45d2e2834848fbb2e27440e5ac8a7401
|
||||
tool-catalog.zh.md: b976a15113cb2272f2e51c8a688abcb34131be68
|
||||
|
||||
@@ -2097,7 +2097,7 @@ Render one temporary inline graphic or interactive widget from conversation cont
|
||||
},
|
||||
"widget_code": {
|
||||
"type": "string",
|
||||
"description": "For HTML: one fragment. Put any inline <style> first, content next (semantic HTML, inline <svg>, <canvas> using 2D or WebGL, or native controls), and any inline <script> last. For SVG: raw SVG beginning with <svg>, with a viewBox that declares its aspect ratio. External resources are blocked; inline everything."
|
||||
"description": "For HTML: one fragment. Put any inline <style> first, content next (semantic HTML, inline <svg>, <canvas> using 2D or WebGL, or native controls), and any inline <script> last. For SVG: raw SVG beginning with <svg>, with a viewBox that declares its aspect ratio. Keep the widget self-contained: include all required styles, scripts, data, and assets in the source."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
||||
@@ -2104,7 +2104,7 @@ todo_write 是会话所有的状态;UI 将最新的 todo/write 事件渲染为
|
||||
},
|
||||
"widget_code": {
|
||||
"type": "string",
|
||||
"description": "For HTML: one fragment. Put any inline <style> first, content next (semantic HTML, inline <svg>, <canvas> using 2D or WebGL, or native controls), and any inline <script> last. For SVG: raw SVG beginning with <svg>, with a viewBox that declares its aspect ratio. External resources are blocked; inline everything."
|
||||
"description": "For HTML: one fragment. Put any inline <style> first, content next (semantic HTML, inline <svg>, <canvas> using 2D or WebGL, or native controls), and any inline <script> last. For SVG: raw SVG beginning with <svg>, with a viewBox that declares its aspect ratio. Keep the widget self-contained: include all required styles, scripts, data, and assets in the source."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
||||
@@ -49,7 +49,7 @@ export function registerVisualizerTools(
|
||||
ctx: Context,
|
||||
limits: { readonly maxTitleBytes: number; readonly maxWidgetBytes: number },
|
||||
): void {
|
||||
const sourceDescription = 'For HTML: one fragment. Put any inline <style> first, content next (semantic HTML, inline <svg>, <canvas> using 2D or WebGL, or native controls), and any inline <script> last. For SVG: raw SVG beginning with <svg>, with a viewBox that declares its aspect ratio. External resources are blocked; inline everything.'
|
||||
const sourceDescription = 'For HTML: one fragment. Put any inline <style> first, content next (semantic HTML, inline <svg>, <canvas> using 2D or WebGL, or native controls), and any inline <script> last. For SVG: raw SVG beginning with <svg>, with a viewBox that declares its aspect ratio. Keep the widget self-contained: include all required styles, scripts, data, and assets in the source.'
|
||||
|
||||
ctx.tools.register(defineTool({
|
||||
name: 'widget_guidelines',
|
||||
|
||||
@@ -87,7 +87,7 @@ exports[`Visualizer model surface > ships one neutral SVG and HTML model surface
|
||||
"type": "string",
|
||||
},
|
||||
"widget_code": {
|
||||
"description": "For HTML: one fragment. Put any inline <style> first, content next (semantic HTML, inline <svg>, <canvas> using 2D or WebGL, or native controls), and any inline <script> last. For SVG: raw SVG beginning with <svg>, with a viewBox that declares its aspect ratio. External resources are blocked; inline everything.",
|
||||
"description": "For HTML: one fragment. Put any inline <style> first, content next (semantic HTML, inline <svg>, <canvas> using 2D or WebGL, or native controls), and any inline <script> last. For SVG: raw SVG beginning with <svg>, with a viewBox that declares its aspect ratio. Keep the widget self-contained: include all required styles, scripts, data, and assets in the source.",
|
||||
"type": "string",
|
||||
},
|
||||
},
|
||||
|
||||
@@ -171,7 +171,9 @@ describe('Visualizer model surface', () => {
|
||||
expect(sourceDescription).toContain('<canvas> using 2D or WebGL')
|
||||
expect(sourceDescription).toContain('inline <script>')
|
||||
expect(sourceDescription).toContain('For SVG: raw SVG')
|
||||
expect(sourceDescription).toContain('External resources are blocked; inline everything')
|
||||
expect(sourceDescription).toContain(
|
||||
'Keep the widget self-contained: include all required styles, scripts, data, and assets in the source',
|
||||
)
|
||||
expect(sourceDescription).not.toContain('load and follow the interactive widget_guidelines module')
|
||||
expect(sourceDescription).not.toContain('window.dshWidget')
|
||||
})
|
||||
|
||||
@@ -416,7 +416,7 @@
|
||||
},
|
||||
"widget_code": {
|
||||
"type": "string",
|
||||
"description": "For HTML: one fragment. Put any inline <style> first, content next (semantic HTML, inline <svg>, <canvas> using 2D or WebGL, or native controls), and any inline <script> last. For SVG: raw SVG beginning with <svg>, with a viewBox that declares its aspect ratio. External resources are blocked; inline everything."
|
||||
"description": "For HTML: one fragment. Put any inline <style> first, content next (semantic HTML, inline <svg>, <canvas> using 2D or WebGL, or native controls), and any inline <script> last. For SVG: raw SVG beginning with <svg>, with a viewBox that declares its aspect ratio. Keep the widget self-contained: include all required styles, scripts, data, and assets in the source."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
||||
Reference in New Issue
Block a user