mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-10-26 16:55:08 +00:00
* feat(preset): declare Agent compositions in profile YAML * fix(preset): share scope binding cleanup and refresh module graph * fix(preset): use host syntax colors in the YAML editor * fix(preset): write new profile declarations as block YAML * fix(preset): align eager activation with browser and worker surfaces * fix(ui-agent-preset): retain the existing preset card layout * fix(preset): keep rows waiting for a Host service mounted and re-audit after settlement A preset row whose Host provider was still activating at declaration time was reported as waiting for a missing service, and the registry recorded the definition as broken for the rest of the process. Split the mount audit into failed and pending rows: failures and root-realm leaks still reject the mount, while pending rows stay mounted and every read and binding re-audits them after the Host Loader tree settles. Remove the accidental self-dependency of @deepseek-ai/dsh-web-app and its lockfile self-link. Archive the copy-only preset authoring note, which the declarative-preset note fully supersedes, and update the ralph note's restore recipe to the profile-patch mechanism. * chore(lint): re-key and prune the unknown-cast baseline after the master merge * refactor(web-app): ship each Agent preset as its own bundle patch file `dsh.bundle.patch` accepts an ordered file list, so the four shipped preset declarations move out of the 1000-line web patch into `presets/<id>.patch.yml`, one insert per file, applied after the host patch. The host patch keeps the preset registry row. Gates and test scaffolds that read the web layer resolve every patch file through `bundlePatchPaths` instead of one hardcoded path. * refactor(preset): drop the save notice injected into live Agents The notice duplicated the save result the Web editor already shows, and after the producer-owned message sources it would have needed its own persisted source kind. Saving now only persists and reports the activation diagnostic; the persistence catalog is unchanged from master. * docs: regenerate the module graph after dropping the registry's llm dependency * test(ui-agent-preset): cover the guide dialog's keyboard handling on the declarative section * fix(preset): address the remaining review comments Apply the lowercase id rule only when creating a declaration, so presets declared with other ids stay editable. Export `isBuiltInPreset` from the display fold and key the client card groups on it. Remove the dead `error` and `retry` locale keys, the JSDoc orphaned by the `trust` removal, the `trust` fields in the plugin-inventory test fixtures, and the stale `dsh-agent-presets` package name in comments and READMEs. * refactor(preset): make the Web preset page view-and-select only Remove the child-plugin YAML editor, the `agent_preset` tool and the registry's read/save Remote methods. Presets are declared and changed only by bundle patches; the settings page keeps the roster, the new-task default and the mode help, and its question icon explains that and offers to start a Creator-mode task. The `editing-cordis-compositions` skill and the Creator persona describe the bundle-based path, and the authored skill-load Session and Web snapshots are refreshed for it. * docs(skill): make the composition skill self-sufficient for preset authoring State where the shipped declarations live, list every declaration field, inline a complete minimal bundle and an override example, and name the verification calls, so Creator mode no longer reads DSH package sources to infer the format. Refresh the authored skill-load Session for the new text. * test(tools): drop the removed agent_preset tool from the catalog expectation
79 lines
3.1 KiB
TypeScript
79 lines
3.1 KiB
TypeScript
/**
|
|
* Cordis YAML parsing and Loader-entry classification shared by repository checks.
|
|
* @module scripts/cordis-yaml
|
|
*/
|
|
|
|
import * as yaml from 'js-yaml'
|
|
|
|
/** A Loader `!!js` expression preserved as data instead of executed. */
|
|
export interface JsExpr {
|
|
__jsExpr: string
|
|
}
|
|
|
|
const jsExprType = new yaml.Type('tag:yaml.org,2002:js', {
|
|
kind: 'scalar',
|
|
resolve: data => typeof data === 'string',
|
|
construct: (data: unknown): JsExpr => {
|
|
if (typeof data !== 'string') throw new TypeError('!!js requires a scalar string')
|
|
return { __jsExpr: data }
|
|
},
|
|
})
|
|
const schema = yaml.JSON_SCHEMA.extend(jsExprType)
|
|
|
|
/**
|
|
* Parse a Cordis config while preserving Loader `!!js` expressions as data.
|
|
* @param source - Cordis YAML source text.
|
|
* @returns the parsed YAML value.
|
|
*/
|
|
export function loadCordisYaml(source: string): unknown {
|
|
return yaml.load(source, { schema })
|
|
}
|
|
|
|
/**
|
|
* Test whether a value is a preserved Loader `!!js` expression.
|
|
* @param value - parsed YAML value.
|
|
* @returns whether the value contains one preserved expression.
|
|
*/
|
|
export function isJsExpr(value: unknown): value is JsExpr {
|
|
return typeof value === 'object'
|
|
&& value !== null
|
|
&& typeof (value as Record<string, unknown>).__jsExpr === 'string'
|
|
}
|
|
|
|
/**
|
|
* Test whether a Loader entry owns nested entries in its `config` array.
|
|
* @param value - parsed Loader entry.
|
|
* @returns whether the entry is an explicit or package-named Cordis group.
|
|
*/
|
|
export function isCordisGroupEntry(value: unknown): value is Record<string, unknown> & { config: unknown[] } {
|
|
return typeof value === 'object'
|
|
&& value !== null
|
|
&& Array.isArray((value as Record<string, unknown>).config)
|
|
&& ((value as Record<string, unknown>).group === true
|
|
|| (value as Record<string, unknown>).name === '@deepseek-ai/cordis-plugin-group')
|
|
}
|
|
|
|
/** Test whether an entry declares an Agent preset with a child plugin list.
|
|
* @param value Parsed Loader entry.
|
|
* @returns Whether config.plugins contains nested entries owned by a preset.
|
|
*/
|
|
export function isAgentPresetEntry(value: unknown): value is Record<string, unknown> & { config: { id: string; plugins: unknown[] } } {
|
|
if (typeof value !== 'object' || value === null) return false
|
|
const row = value as Record<string, unknown>
|
|
if (row.name !== '@deepseek-ai/dsh-agent-preset' || typeof row.config !== 'object' || row.config === null) return false
|
|
const config = row.config as Record<string, unknown>
|
|
return typeof config.id === 'string' && Array.isArray(config.plugins)
|
|
}
|
|
|
|
/** Read preset definitions nested in ordinary groups and patch insertions.
|
|
* @param value Parsed Cordis YAML.
|
|
* @returns Declared identities and child configurations in document order.
|
|
*/
|
|
export function presetDefinitions(value: unknown): { id: string; plugins: unknown[] }[] {
|
|
if (Array.isArray(value)) return value.flatMap(presetDefinitions)
|
|
if (isAgentPresetEntry(value)) return [value.config]
|
|
if (typeof value !== 'object' || value === null) return []
|
|
const row = value as Record<string, unknown>
|
|
return [...presetDefinitions(row.insert), ...(isCordisGroupEntry(row) ? presetDefinitions(row.config) : [])]
|
|
}
|