Files
deepseek-harness/scripts/gen-plugin-packages.ts
Turtle b13bbc027c feat(agent-preset): progressive creator skills and profile shell facts (#4836)
* feat(tool-cordis): inspect live plugin Config schemas

Replace the Host `Builtin` inspect provider, which described a dynamic Host
half the model can no longer define, with a `Config` provider that lists every
live Loader entry with its Config status and projects one entry's native
Schemastery Config into a self-contained JSON Schema document. app-boot exports
its projector, native-schema check, and the shared `loaderExpression`
definition for the live walk; the CLI dump keeps its profile-composition path.

* fix(tool-cordis): refresh config catalog pointer and presets e2e provider list

* feat(agent-preset): progressive creator skills and profile shell facts

Split `cordis-plugin-development` into a short procedure with `references/`
read on demand and copyable `templates/`, replace the source-reading ban in
both creator skills with an ordered list of knowledge sources, and add the
`cordis-composition-reference` skill with the Loader patch dialect and a
generated, doc-sync-gated list of loadable plugin packages. `shell-env`
exposes `DSH_PROFILE` and `DSH_PROFILE_DIR` so skills can address the installed
profile.

* chore(agent-preset): regenerate plugin package list after merging master

* fix(tool-cordis): resolve the Loader at Config query time

A Host composed programmatically without a Loader keeps registering the
inspect providers; `Config.listConfigs` reports the missing Loader when
queried. Refresh the advanced-toolchain recordings whose provider list now
carries `Config` in place of `Builtin`.

* chore(agent-preset): regenerate plugin package list after merging master

* docs: regenerate module graph for the tool-cordis app-boot dependency

* docs: regenerate module graph for the shell-env app-boot dependency

* docs: regenerate event graph pointer for app-boot exports

* fix(agent-preset): address review on creator skills

`Config.listConfigs` reports each entry's resolved `packageDir` through the
profile package lookup, and the skills read READMEs and built declarations
there instead of guessing `$DSH_PROFILE_DIR/node_modules`, which holds only
profile-installed packages. Skills name the PowerShell variable syntax and the
no-profile omission; the composition reference no longer attributes
`overridden` to `list_plugins`; references point at the templates instead of
pasting them. The skills spec renders every skill and bounds it by the pruner
threshold in code points, checks referenced files and the source-reading ban
across all skill files.

* fix(tool-cordis): address review on the Config inspect provider

Report the Loader entry id (unique across include trees) beside the tree-local
patch id, classify group and include carriers as `tree`, treat disabled and
disposed fibers as `inactive`, and drop the unreachable boolean-schema branch
by narrowing the projector's root type. The presets e2e now queries
`Config.listConfigs` over the booted Web profile and projects the shipped
`tools` row; the advanced-toolchain recordings carry the updated manifest.

* fix(tool-cordis): page the Config directory and filter it by plugin name

A full directory of a shipped Web profile exceeds the 50000-byte spill cap
once rows carry more fields, and the spilled preview is no longer JSON.
`Config.listConfigs` now returns pages (`offset`, `limit` up to 100, default
25) with `total` and `nextOffset`, and an exact plugin `name` filter; the
presets e2e reads the shipped rows through the filter.

* chore(agent-preset): refresh skill recordings after the paged Config query

* docs(agent-preset): teach the composition skill to migrate legacy presets

A preset authored before declaration rows lived in
`$DSH_HOME/.agent-presets/<id>/` as `preset.yml` plus `agent.cordis.yml`;
the skill now maps those files onto a declaration bundle and re-checks plugin
names against the package list.

* docs(agent-preset): read skill files through the file-read tool only

Desktop ships the skill directory inside app.asar, which the Host process can
open but shell commands, node, and pnpm cannot. The skills now say to read
references and templates with the file-read tool and copy templates into the
workspace before installing or checking them; the spec rejects shell reads of
skill files.

* docs(agent-preset): document bundle display metadata and package.json icon in the host-plugin reference
2026-09-21 21:28:35 +08:00

84 lines
3.4 KiB
TypeScript

/**
* Generate the loadable-plugin package list shipped inside the
* `cordis-composition-reference` skill from the workspace manifests and the
* config-catalog classification. `--check` exits 1 when the committed file is stale.
*/
import { readFileSync, writeFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { collectConfigCatalog, type CatalogEntry } from './gen-config-catalog.ts'
const root = resolve(import.meta.dirname, '..')
const OUT = 'packages/preset/agent-preset/skills/cordis-composition-reference/references/packages.md'
interface Row {
pkg: string
group: string
config: boolean
description: string
}
function rows(entries: readonly CatalogEntry[]): Row[] {
const result: Row[] = []
for (const entry of entries) {
// Seams are abstract Service Definitions and libraries export no plugin; neither is a Loader row.
if (entry.kind !== 'config' && entry.kind !== 'no-config') continue
const manifest = JSON.parse(readFileSync(resolve(root, entry.dir, 'package.json'), 'utf8')) as { description: string }
// Catalog dirs are `packages/<group>/<pkg>`, so the group segment is always present.
const group = entry.dir.split('/')[1] ?? entry.dir
result.push({ pkg: entry.pkg, group, config: entry.kind === 'config', description: manifest.description })
}
return result.sort((left, right) => left.group.localeCompare(right.group) || left.pkg.localeCompare(right.pkg))
}
/**
* Render the package list as one Markdown document grouped by package group.
* @param entries - config-catalog entries for every workspace package.
* @returns the complete file content.
*/
export function render(entries: readonly CatalogEntry[]): string {
const lines = [
'# Loadable Harness plugin packages',
'',
'This file is GENERATED from workspace manifests (`scripts/gen-plugin-packages.ts`) and verified fresh by `pnpm run verify-plugin-packages` (part of `doc-sync`); do not edit it by hand.',
'',
'Every package below exports a Cordis plugin that a bundle patch can name in a Loader row. `Config` marks packages whose row accepts a `config` mapping; query `Config.listConfigs` through `cordis_inspect_query` (filter by `name`, then query the `entry` id) for the mounted schema. Packages under `experimental` are pre-stable.',
'',
]
let group = ''
for (const row of rows(entries)) {
if (row.group !== group) {
if (group !== '') lines.push('')
group = row.group
lines.push(`## ${group}`, '', '| Package | Config | Description |', '|---|---|---|')
}
lines.push(`| \`${row.pkg}\` | ${row.config ? 'yes' : 'no'} | ${row.description} |`)
}
return `${lines.join('\n')}\n`
}
function main(): void {
const content = render(collectConfigCatalog())
if (process.argv.includes('--check')) {
let committed: string | null
try {
committed = readFileSync(resolve(root, OUT), 'utf8')
} catch {
// A missing or unreadable file has the same remedy as a stale one: regenerate.
committed = null
}
if (committed === content) {
console.log(`gen-plugin-packages: ${OUT} is up to date.`)
process.exit(0)
}
console.error(`gen-plugin-packages: ${OUT} is stale. Run \`pnpm run gen-plugin-packages\` and commit ${OUT}.`)
process.exit(1)
}
writeFileSync(resolve(root, OUT), content)
console.log(`gen-plugin-packages: wrote ${OUT}.`)
}
if (process.argv[1] && import.meta.filename === resolve(process.argv[1])) {
main()
}