feat(agent-preset): require detail documents for creator bundles

This commit is contained in:
turtle1999 committed 2026-10-20 00:20:18 +08:00
1 parent c94f46b325
commit d352a080fc
12 files changed
+69 -21

No files matched your search

@@ -43,6 +43,7 @@
"@deepseek-ai/cordis-plugin-loader": "workspace:~",
"@deepseek-ai/dsh-agent-preset-registry": "workspace:*",
"@deepseek-ai/dsh-compaction-tool-result-pruner": "workspace:*",
"@deepseek-ai/dsh-plugin-detail": "workspace:*",
"@deepseek-ai/dsh-skill": "workspace:*",
"@deepseek-ai/dsh-skill-filesystem": "workspace:*",
"@deepseek-ai/schemastery": "workspace:~",
@@ -21,7 +21,7 @@ A shipped bundle can resolve a plugin row and leave it `disabled`. The row id an
1. Resolve the requested result and destination. An unspecified visual destination is the current Harness Web UI; a standalone image or HTML file does not complete such a request. Choose reasonable visual details and implement a small first version; install it before visual refinement.
2. Discover only the APIs needed for that version: `cordis_inspect_list`, then targeted `cordis_inspect_query` calls. For UI, query Client `Slots.listSubTree` and the selected slot's registration options and props. For anything beyond a static decoration, such as tool policy, agent context, session-derived state, or Chat rows, read `references/practices.md` before choosing the extension point; for a user action in plugin UI, also read `references/user-actions.md`. Once the chosen slot and registration API are known, write the plugin.
3. Read and copy the matching template files into one workspace directory, or author the package, patch, and required Host/Client files there. Before installing, complete the display checklist in `references/host-plugin.md`: meaningful localized titles/descriptions, an original or licensed icon, and exported resources with distribution checks where applicable. This applies to Host-only and configuration-only bundles too; adapt template text and artwork to the request. Check JavaScript syntax and the manifest, then install. Use the installed plugin as the first preview; do not create preview HTML, mock shells, design variants, screenshot scripts, or rasterizer tooling first.
3. Read and copy the matching template files into one workspace directory, or author the package, patch, and required Host/Client files there. Before installing, complete the display checklist in `references/host-plugin.md`: localized titles, descriptions, and detail documents, an original or licensed icon, and exported resources with distribution checks where applicable. This applies to Host-only and configuration-only bundles too; adapt template text and artwork to the request. Check JavaScript syntax and the manifest, then install. Use the installed plugin as the first preview; do not create preview HTML, mock shells, design variants, screenshot scripts, or rasterizer tooling first.
4. Read the installation result: `application` and `warnings` decide whether the change is live, not logs, process lists, or the page's boot payload. Confirm new rows with approval-free `cordis_inspect_query`, not `list_plugins`. After `application: applied`, exercise the capability or inspect the live Client registration. Verify installed display metadata and the icon using `references/host-plugin.md`. Use the connected page when available; follow `references/verification.md` for page/panel design checks and unavailable browser control, and `references/user-actions.md` for user actions. Restore user state changed during testing. Report verification limits; installation and slot registration alone do not establish what the user sees.
5. Fix observed defects in the same plugin. When the requested result works, finish with its location, verification status, and the reason for any display-resource exception; never silently accept default artwork. Do not continue speculative variants, optional features, or mock previews. Close any task list.
@@ -31,11 +31,11 @@ A shipped bundle can resolve a plugin row and leave it `disabled`. The row id an
2. Package documentation: `Config.listConfigs` with `name` set to the package finds its entries; querying one `entry` returns its `packageDir`, the resolved package directory. Read `<packageDir>/README.md`. Bundled packages resolve from the dsh installation and profile-installed bundles from the profile, so never guess the path from `$DSH_PROFILE_DIR`.
3. Source: installed packages ship built `lib/index.js` and `lib/types/**/*.d.ts` with JSDoc under that same `packageDir`, not `src/`; a source checkout of DSH has `packages/<group>/<name>/src`. Read them when inspection and the README leave a question open, and start source-level diagnosis from a concrete installation or runtime failure.
`DSH_PROFILE` (profile name) and `DSH_PROFILE_DIR` (its directory, whose `node_modules` holds only profile-installed bundles) are set in every shell call of a profile-launched Harness and absent when the Harness was booted without a profile. Bash reads them as `$DSH_PROFILE`; PowerShell, which the Windows preset uses, reads them as `$env:DSH_PROFILE`. With `dsh` on the PATH, `dsh --profile "$DSH_PROFILE" --dump-config` prints the composed profile.
`DSH_PROFILE` (profile name) and `DSH_PROFILE_DIR` (its directory, whose `node_modules` holds only profile-installed bundles) are set in every shell call of a profile-launched Harness and absent when the Harness was booted without a profile. Bash reads them as `$DSH_PROFILE`; PowerShell reads them as `$env:DSH_PROFILE`. With `dsh` on the PATH, `dsh --profile "$DSH_PROFILE" --dump-config` prints the composed profile.
## Read next
The files below live in this skill's base directory, which the `skill` tool reported, and the table is the complete list: do not enumerate that directory. In every deployment, including a source checkout, read these files with the file-read tool, write copies into the workspace with the file-write tool, and verify a copy by reading it back. In Desktop the directory sits inside `app.asar`, which only the Host process's own file reads can open; shell commands (`ls`, `cat`, `cp`, `cmp`), the glob and search tools (they run a native ripgrep process), `node`, and pnpm all fail on it. Never install or syntax-check a template in place; copy its contents into the workspace first.
The files below live in this skill's base directory, which the `skill` tool reported, and the table is the complete list: do not enumerate that directory. In every deployment, including a source checkout, read these files with the file-read tool, write copies into the workspace with the file-write tool, and verify a copy by reading it back. In Desktop the directory sits inside `app.asar`, which only the Host process's own file reads can open; shell commands (`ls`, `cat`, `cp`, `cmp`), the glob and search tools, `node`, and pnpm all fail on it. Never install or syntax-check a template in place; copy its contents into the workspace first.
| Task | File |
|---|---|
@@ -43,9 +43,9 @@ The files below live in this skill's base directory, which the `skill` tool repo
| Web UI: Client manifest, module loader, slot registration | `references/ui-plugin.md` |
| Connecting an MCP server through a configuration-only bundle | `references/mcp-bundle.md` |
| Page/panel design checks and verification without browser control | `references/verification.md` |
| Drawing an icon | `references/artwork.md` |
| UI plugin template, including display resources | `templates/decoration/package.json`, `templates/decoration/cordis.patch.yml`, `templates/decoration/index.js`, `templates/decoration/client.js`, `templates/decoration/locale/en.json`, `templates/decoration/icon.svg` |
| MCP bundle template, including display resources | `templates/mcp/package.json`, `templates/mcp/cordis.patch.yml`, `templates/mcp/locale/en.json`, `templates/mcp/icon.svg` |
| Icons and feature images | `references/artwork.md` |
| UI plugin template | `templates/decoration/package.json`, `templates/decoration/cordis.patch.yml`, `templates/decoration/index.js`, `templates/decoration/client.js`, `templates/decoration/locale/en.json`, `templates/decoration/docs/DETAIL.md`, `templates/decoration/icon.svg` |
| MCP bundle template | `templates/mcp/package.json`, `templates/mcp/cordis.patch.yml`, `templates/mcp/locale/en.json`, `templates/mcp/docs/DETAIL.md`, `templates/mcp/icon.svg` |
| Loader patch dialect and the list of installable plugin packages | the `cordis-composition-reference` skill |
| Choosing extension points, contexts, and state mechanisms for upgrade stability and performance | `references/practices.md` |
| Sharing application operations between UI actions and agent tools | `references/user-actions.md` |
@@ -1,6 +1,6 @@
# Plugin artwork
Draw an icon that is recognizable at row size and belongs beside the icons of installed DSH plugins. The display checklist in `references/host-plugin.md` owns manifest exports, accepted formats, size limits, and installed-display checks.
Draw an icon that is recognizable at row size and belongs beside the icons of installed DSH plugins, and, when it helps, a feature image for the detail document. The display checklist in `references/host-plugin.md` owns manifest exports, accepted formats, size limits, and installed-display checks.
## Establish the subject
@@ -22,6 +22,10 @@ Draw an icon that is recognizable at row size and belongs beside the icons of in
- Plugin Manager renders the icon through `<img>`, which silently drops what it cannot load. Export self-contained SVG geometry with local, uniquely named gradient, mask, and clip references. Use no scripts, event handlers, `<style>`, `<text>`, animation, `<image>`, or `foreignObject`.
- Do not change assets the feature itself produces merely to change its icon.
## Feature image
A detail document may start with one feature image when a picture shows the result better than text. Draw it only when the user asks for one or the result cannot be shown in text, after the plugin works. Save one SVG per document language, such as `docs/preview.svg` and `docs/preview.zh.svg`, with `width="640" height="300" viewBox="0 0 640 300"`, and reference it from the first line of that document as `![Short description](preview.svg)`, and `preview.zh.svg` from `DETAIL.zh.md`. The bundle page refuses images above 5 MiB. Show one main example of the real interface or result, optionally with one close-up, using the plugin's exact UI labels; keep important content about 32 units from the edges. The export rules above apply, so outline every word into paths. Check that it stays readable at its displayed width in light and dark themes.
## Review
1. Deliver the plugin with one icon first. Show a few numbered SVG alternatives only when the user asks for alternatives or refinement; keep their numbers through review and apply the chosen one. Write alternatives outside the bundle directory.
@@ -26,31 +26,32 @@ A Host-only bundle needs no dependencies, install scripts, or build tool:
config: {}
```
## Display metadata and icon
## Display metadata, detail document, and icon
Plugin Manager and Settings read `meta.title` and `meta.description` from exported locale JSON and an icon from exported resources without activating plugins. Complete this checklist before installation:
Plugin Manager and Settings read `meta.title` and `meta.description` from exported locale JSON and an icon from exported resources without activating plugins. The bundle's page in Plugin Manager shows the detail document that `meta.detail` names, otherwise the package README. Complete this checklist before installation:
- Write a recognizable title and a description of the capability in `locale/en.json` under `meta.title` and `meta.description`. Add the same fields for the user's language and other supported locales, such as `locale/zh.json`; do not leave template copy unrelated to the delivered plugin.
- Write a detail document for users in each locale's language, and name it with `meta.detail` in that locale file: a `/`-separated path relative to the package root, inside a subdirectory so images beside it are published, that ends in `.md`, such as `docs/DETAIL.md` for `en` and `docs/DETAIL.zh.md` for `zh`. Start with one paragraph on what the user gets, then `## How to use` (where to find or trigger the feature, with its exact UI labels) and `## Good to know` (added tokens or model requests, data read or sent elsewhere, risks, and what changes when the plugin is turned off); Chinese documents use `## 使用方法` and `## 注意事项`. State only behavior you implemented and verified. An optional feature image goes on the first line; see `references/artwork.md`. A malformed `meta.detail`, a missing named file, or a document above 1 MiB makes the page show an error, not the README.
- Create an original icon or use artwork whose license permits redistribution, retaining any required attribution. Read `references/artwork.md` before drawing or revising an icon.
- Export `./locale/*.json` and `./icon`; retain existing runtime exports. Keep the patch, locales, icon, and every runtime file in `files`, updating it whenever you add modules or assets. For a packed or published bundle, verify the actual packed file list. Local directory installation links the checkout instead, so check the files directly; `files` does not filter a linked directory.
- Export `./locale/*.json` and `./icon`; retain existing runtime exports. Keep the patch, locales, the detail document's directory, icon, and every runtime file in `files`, updating it whenever you add modules or assets. For a packed or published bundle, verify the actual packed file list. Local directory installation links the checkout instead, so check the files directly; `files` does not filter a linked directory.
- Check that the icon is a valid image of the declared format and satisfies the path and size limits below. An accepted filename alone does not establish that its bytes render.
For example, the locale file contains:
```json
{ "meta": { "title": "My Decoration", "description": "Draws a badge under the composer." } }
{ "meta": { "title": "My Decoration", "description": "Draws a badge under the composer.", "detail": "docs/DETAIL.md" } }
```
```json
{
"exports": { "./locale/*.json": "./locale/*.json", "./icon": "./icon.svg" },
"files": ["index.js", "cordis.patch.yml", "locale/*.json", "icon.svg"]
"files": ["index.js", "cordis.patch.yml", "locale/*.json", "docs", "icon.svg"]
}
```
A package-root plugin may instead declare a top-level `icon` in `package.json`; it takes priority over `./icon` and is a path relative to the manifest directory. A subpath plugin such as `my-plugins/search` is not a package and never reads a `package.json`; it exports `./search/locale/*.json` and `./search/icon` instead. Icons may be SVG, PNG, JPEG, or WebP up to 256 KiB and must stay inside the package; absolute paths, URLs, and symlinks leaving it are rejected. Missing fields of a package-root plugin fall back to `package.json` `name` and `description`, and missing images use the panel's default artwork; malformed metadata produces a diagnostic and keeps the valid text.
After installation, verify the intended title and description in bundle details and plugin rows, plus the rendered icons, in English and the user's locale where supplied. Check for metadata diagnostics and unintended fallbacks, and that each plugin row shows its own exported icon or, when it has none, the generic artwork. Without browser control, inspect the installed resources and report that rendered display remains unverified; do not claim visual success from installation alone.
After installation, verify the intended title, description, and detail document in bundle details and plugin rows, plus the rendered icons, in English and the user's locale where supplied. Check for metadata diagnostics and unintended fallbacks, and that each plugin row shows its own exported icon or, when it has none, the generic artwork. Without browser control, inspect the installed resources and report that rendered display remains unverified; do not claim visual success from installation alone.
An existing plugin's metadata may remain unchanged when it still describes the requested result. A disposable test fixture or an explicitly requested metadata-free package may omit resources, but explain each omission in the delivery report. A Host-only or configuration-only bundle still has a visible inventory entry; neither is an exception by itself.
@@ -0,0 +1,10 @@
A blue circle appears below the message composer in every session.
## How to use
- Open any session; the circle is below the message box.
## Good to know
- The circle is a decoration only. It adds nothing to model requests.
- Turning the plugin off removes the circle from open pages.
@@ -1,6 +1,7 @@
{
"meta": {
"title": "Composer Decoration",
"description": "Displays a blue circle below the message composer."
"description": "Displays a blue circle below the message composer.",
"detail": "docs/DETAIL.md"
}
}
@@ -9,7 +9,7 @@
"./locale/*.json": "./locale/*.json",
"./icon": "./icon.svg"
},
"files": ["index.js", "client.js", "cordis.patch.yml", "locale/*.json", "icon.svg"],
"files": ["index.js", "client.js", "cordis.patch.yml", "locale/*.json", "docs", "icon.svg"],
"dsh": {
"bundle": { "patch": "./cordis.patch.yml" },
"client": {
@@ -0,0 +1,11 @@
Agents can call the tools of the Demo MCP server.
## How to use
- Ask the agent for a task that the server's tools perform. The agent decides when to call them.
## Good to know
- The server's tools and any instructions it sends are added to every model request, so they use some tokens even when the agent does not call them.
- Tool arguments the agent chooses are sent to the server, and its replies are added to the conversation.
- Turning the plugin off removes the tools from the agent's next request; that request cannot reuse cached input.
@@ -1,6 +1,7 @@
{
"meta": {
"title": "Demo MCP Connection",
"description": "Connects a remote MCP server to make its tools available to the agent."
"description": "Connects a remote MCP server to make its tools available to the agent.",
"detail": "docs/DETAIL.md"
}
}
@@ -4,6 +4,6 @@
"private": true,
"type": "module",
"exports": { "./locale/*.json": "./locale/*.json", "./icon": "./icon.svg" },
"files": ["cordis.patch.yml", "locale/*.json", "icon.svg"],
"files": ["cordis.patch.yml", "locale/*.json", "docs", "icon.svg"],
"dsh": { "bundle": { "patch": "./cordis.patch.yml" } }
}
@@ -1,6 +1,6 @@
/**
* Shipped creator skills: every rendered skill stays below the pruner threshold, referenced
* files exist, templates parse, and no skill bans reading DSH sources.
* files exist, templates parse and show their detail documents, and no skill bans reading DSH sources.
*/
import { execFileSync } from 'node:child_process'
import { lstatSync, readdirSync, readFileSync, readlinkSync, realpathSync, statSync } from 'node:fs'
@@ -10,6 +10,7 @@ import { fileURLToPath } from 'node:url'
import * as yaml from 'js-yaml'
import { entryListSchema } from '@deepseek-ai/cordis-plugin-include'
import { codePointLength } from '@deepseek-ai/dsh-compaction-tool-result-pruner'
import { languageChain, localFiles, readPackageDocument } from '@deepseek-ai/dsh-plugin-detail'
import SkillRegistry, { renderSkillContent } from '@deepseek-ai/dsh-skill'
import * as SkillFileSystem from '@deepseek-ai/dsh-skill-filesystem'
import { describe, expect, it } from 'vitest'
@@ -117,22 +118,37 @@ describe('the shipped creator skills', () => {
expect(manifest.exports['./icon']).toBe('./icon.svg')
const locales = readdirSync(join(dir, 'locale')).map(file => `locale/${file}`)
expect(locales).toContain('locale/en.json')
const details: string[] = []
for (const file of locales) {
const locale = JSON.parse(readFileSync(join(dir, file), 'utf8')) as { meta: { title: string; description: string } }
const locale = JSON.parse(readFileSync(join(dir, file), 'utf8')) as {
meta: { title: string; description: string; detail: string }
}
expect(locale.meta.title).toMatch(/\S/u)
expect(locale.meta.description).toMatch(/\S/u)
expect(locale.meta.detail, file).toMatch(/^[^/]+\/.+\.md$/u)
details.push(locale.meta.detail)
}
const resources = new Set([...Object.values(manifest.exports).filter(file => !file.includes('*')),
...locales, manifest.dsh.bundle.patch])
...locales, ...details, manifest.dsh.bundle.patch])
for (const resource of resources) {
const file = resource.replace(/^\.\//u, '')
expect(body('cordis-plugin-development'), file).toContain(`\`templates/${name}/${file}\``)
expect(statSync(join(dir, file)).isFile(), file).toBe(true)
if (file !== 'package.json') expect(manifest.files.some(pattern => matchesGlob(file, pattern)), file).toBe(true)
// npm `files` publishes a listed directory with its contents.
const published = manifest.files.some(pattern => matchesGlob(file, pattern) || file.startsWith(`${pattern}/`))
if (file !== 'package.json') expect(published, file).toBe(true)
}
}
})
it.for(readdirSync(join(skills, 'cordis-plugin-development', 'templates')))('shows the %s template detail document on its bundle page', async (name) => {
const dir = join(skills, 'cordis-plugin-development', 'templates', name)
const document = await readPackageDocument(localFiles(dir, '1.0.0'), '', languageChain('en'), 1 << 20, AbortSignal.timeout(10_000))
const locale = JSON.parse(readFileSync(join(dir, 'locale', 'en.json'), 'utf8')) as { meta: { detail: string } }
expect(document).toMatchObject({ origin: 'locale', path: locale.meta.detail })
expect(document?.markdown).toMatch(/\n## How to use\n[\s\S]*\n## Good to know\n/u)
})
it('never forbid reading DSH package sources and never route skill files through the shell', () => {
for (const name of names) {
for (const file of markdownFiles(join(skills, name))) {
+3
View File
@@ -11893,6 +11893,9 @@ importers:
'@deepseek-ai/dsh-compaction-tool-result-pruner':
specifier: workspace:*
version: link:../../compaction/compaction-tool-result-pruner
'@deepseek-ai/dsh-plugin-detail':
specifier: workspace:*
version: link:../../util/plugin-detail
'@deepseek-ai/dsh-skill':
specifier: workspace:*
version: link:../../skill/skill