Fix Netx Ops preset and settings for DSH 0.2.0-rc.2.

Ship a declarative @deepseek-ai/dsh-agent-preset patch (directory discovery is dead) and register the settings card on plugins.item via configForms.whileServed while keeping settings.section for older shells.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-10-09 17:04:12 +08:00
parent 9b8e873c18
commit 5dcce3c749
8 changed files with 651 additions and 150 deletions

View file

@ -0,0 +1,44 @@
/**
* Regenerate `presets/netxops.preset.patch.yml` from
* `presets/netxops/{preset.yml,agent.cordis.yml}` so the declarative
* `@deepseek-ai/dsh-agent-preset` row stays in sync with the directory
* composition used on DSH ≤0.1.5.
*/
import { readFileSync, writeFileSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
const cordis = readFileSync(join(root, 'presets/netxops/agent.cordis.yml'), 'utf8')
const metaText = readFileSync(join(root, 'presets/netxops/preset.yml'), 'utf8')
const name = (metaText.match(/^name:\s*(.+)$/m) || [])[1]?.trim() || 'Netx Ops'
const description = (metaText.match(/^description:\s*(.+)$/m) || [])[1]?.trim() || ''
const order = (metaText.match(/^order:\s*(\d+)/m) || [])[1] || '50'
const pluginsBody = cordis
.split(/\r?\n/)
.map((line) => ` ${line}`)
.join('\n')
const out = `# Declarative Netx Ops agent preset for DSH ≥0.2.0-rc.1.
# Directory copy under ~/.dsh/.agent-presets is ignored on these hosts —
# keep presets/netxops/agent.cordis.yml in sync with config.plugins below
# (regenerate: bun run scripts/gen-preset-patch.mjs).
- insert:
- id: preset-netxops
name: '@deepseek-ai/dsh-agent-preset'
config:
id: netxops
order: ${order}
name: ${JSON.stringify(name)}
description: ${JSON.stringify(description)}
plugins:
${pluginsBody}
`
const dest = join(root, 'presets/netxops.preset.patch.yml')
writeFileSync(dest, out)
console.log(`wrote ${dest} (${out.length} bytes)`)