dsh-artifact-studio 0.3.0 → 0.3.2
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/dist/host/lib/skill.js +11 -1
- package/dist/host/lib/tools.js +7 -5
- package/locale/en.json +4 -2
- package/locale/zh.json +4 -2
- package/package.json +1 -1
package/dist/host/lib/skill.js
CHANGED
|
@@ -56,13 +56,23 @@ Dark mode is opt in. Add \`<meta name="color-scheme" content="light dark">\` and
|
|
|
56
56
|
- Use one H1 as the title, H2 for sections, and H3 sparingly.
|
|
57
57
|
- Keep paragraphs to four sentences or fewer. Use a table for comparisons and a list for steps.
|
|
58
58
|
|
|
59
|
+
## Check before you save
|
|
60
|
+
|
|
61
|
+
Every \`artifact_create\` and \`artifact_update\` call writes a new version the user sees in History. Treat each save as a release, not a draft.
|
|
62
|
+
|
|
63
|
+
- Finish the artifact before the first save. Reread the full draft once for broken markup, CSS that hides or overrides elements such as \`[hidden]\`, controls without handlers, placeholder copy, and the sandbox rules above.
|
|
64
|
+
- To check a page visually, render a scratch copy outside the artifact, for example a temporary HTML file in a browser tool. Fix what you find there, then create the artifact once.
|
|
65
|
+
- If a check after saving finds problems, fix all of them in one \`artifact_update\`. Never send one update per finding.
|
|
66
|
+
- Do not run polish passes the user did not ask for. One create, plus at most one corrective update, is the normal result of one request.
|
|
67
|
+
|
|
59
68
|
## Updating
|
|
60
69
|
|
|
61
70
|
- Read the artifact first with \`artifact_read\` when the user may have edited it, and pass that version as \`baseVersion\`.
|
|
62
71
|
- For a few local changes, send \`edits\`. Each \`oldText\` must appear exactly once, so include enough surrounding text.
|
|
63
72
|
- Send full \`content\` only when you rewrite most of the artifact.
|
|
64
73
|
- If the update is refused for a stale version, read again and reapply your change. Never overwrite the user's edits.
|
|
65
|
-
- When a create or update returns \`warnings\`, fix them in
|
|
74
|
+
- When a create or update returns \`warnings\`, fix all of them in one follow-up update unless the user asked for that behavior.
|
|
75
|
+
- Several changes the user asked for in one message go into one update.
|
|
66
76
|
|
|
67
77
|
## After writing
|
|
68
78
|
|
package/dist/host/lib/tools.js
CHANGED
|
@@ -8,10 +8,11 @@ const SCOPE_PARAM = {
|
|
|
8
8
|
description: 'workspace (default) stores it under the Harness home for this workspace. library stores it in the user profile, shared by every project; use it only when the user asks for something reusable across projects.',
|
|
9
9
|
};
|
|
10
10
|
const PAGE_GUIDE = [
|
|
11
|
-
'Load the artifact-design skill first if
|
|
12
|
-
'A page is one self-contained HTML document in a sandbox with no network or browser storage: inline all CSS and JavaScript, draw charts with inline SVG or canvas, and use data: URIs for images.
|
|
13
|
-
'Style pages with the injected variables: --artifact-color-primary, -accent, -surface, -text, -muted; --artifact-font-family, -display, -mono;
|
|
14
|
-
'A doc is Markdown: headings, lists, task lists,
|
|
11
|
+
'Load the artifact-design skill first if not loaded yet. Precedence: the user\'s request, then the design system, then your own choices.',
|
|
12
|
+
'A page is one self-contained HTML document in a sandbox with no network or browser storage: inline all CSS and JavaScript, draw charts with inline SVG or canvas, and use data: URIs for images. Keep the layout fluid for a 380 to 700 px panel.',
|
|
13
|
+
'Style pages with the injected variables: --artifact-color-primary, -accent, -surface, -text, -muted; --artifact-font-family, -display, -mono; and the size, space, and radius scales in the skill.',
|
|
14
|
+
'A doc is Markdown: headings, lists, task lists, tables, quotes, and fenced code.',
|
|
15
|
+
'Each save is a version the user sees. Check before saving and batch fixes into one update.',
|
|
15
16
|
].join('\n');
|
|
16
17
|
/**
|
|
17
18
|
* Warnings for the version an update wrote. Full content is checked directly.
|
|
@@ -114,7 +115,7 @@ function writeText(value, verb) {
|
|
|
114
115
|
const warnings = record(value).warnings;
|
|
115
116
|
const list = Array.isArray(warnings) ? warnings.map(String) : [];
|
|
116
117
|
const head = `${line(value, verb)} The user sees a card with an Open action.`;
|
|
117
|
-
return list.length === 0 ? head : `${head}\nWarnings:\n${list.map((item) => `- ${item}`).join('\n')}`;
|
|
118
|
+
return list.length === 0 ? head : `${head}\nWarnings, fix all of them in one update:\n${list.map((item) => `- ${item}`).join('\n')}`;
|
|
118
119
|
}
|
|
119
120
|
const SUMMARY_SCHEMA = {
|
|
120
121
|
type: 'object',
|
|
@@ -235,6 +236,7 @@ export function createTools(host) {
|
|
|
235
236
|
'Save a new version of an artifact. For a few local changes send edits; send complete content only when you rewrite most of it. Each edit oldText must occur exactly once.',
|
|
236
237
|
'The update is refused when baseVersion is not the current version, for example after the user edited it; read it again and reapply your change. Never discard the user\'s edits.',
|
|
237
238
|
'A layout or styling change follows the artifact-design skill and the same precedence: the user\'s request, then the design system, then your own choices.',
|
|
239
|
+
'Each call writes a version the user sees. Put every fix for one request, including all returned warnings, into one update; never send one update per finding.',
|
|
238
240
|
].join('\n'),
|
|
239
241
|
parameters: {
|
|
240
242
|
type: 'object',
|
package/locale/en.json
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
2
|
+
"meta": {
|
|
3
|
+
"title": "Artifacts",
|
|
4
|
+
"description": "Pages and documents the agent creates as versioned files, opened beside the chat with history, export, and a shared design system."
|
|
5
|
+
}
|
|
4
6
|
}
|
package/locale/zh.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-artifact-studio",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Local-first artifacts for DeepSeek Harness: the agent creates pages and documents as versioned files, and you open, edit, restore, and export them beside the chat.",
|
|
6
6
|
"keywords": [
|