ceulen-dsh 0.2.10 → 0.2.12

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.
Files changed (55) hide show
  1. package/README.md +102 -20
  2. package/cordis.patch.yml +20 -1
  3. package/lib/core/settings.d.ts +7 -8
  4. package/lib/core/settings.d.ts.map +1 -1
  5. package/lib/core/settings.js +3 -4
  6. package/lib/core/settings.js.map +1 -1
  7. package/lib/core/tools.d.ts +3 -1
  8. package/lib/core/tools.d.ts.map +1 -1
  9. package/lib/core/tools.js +5 -3
  10. package/lib/core/tools.js.map +1 -1
  11. package/lib/modules/agentmem/config.d.ts.map +1 -1
  12. package/lib/modules/agentmem/config.js +3 -2
  13. package/lib/modules/agentmem/config.js.map +1 -1
  14. package/lib/modules/agentmem/index.d.ts +5 -0
  15. package/lib/modules/agentmem/index.d.ts.map +1 -1
  16. package/lib/modules/agentmem/index.js +55 -34
  17. package/lib/modules/agentmem/index.js.map +1 -1
  18. package/lib/modules/codemode/script.d.ts +30 -1
  19. package/lib/modules/codemode/script.d.ts.map +1 -1
  20. package/lib/modules/codemode/script.js +80 -8
  21. package/lib/modules/codemode/script.js.map +1 -1
  22. package/lib/modules/config/tabs-core.js +1 -1
  23. package/lib/modules/config/tabs-core.js.map +1 -1
  24. package/lib/modules/munin/index.js +3 -3
  25. package/lib/modules/munin/index.js.map +1 -1
  26. package/lib/modules/serena/index.d.ts +25 -0
  27. package/lib/modules/serena/index.d.ts.map +1 -1
  28. package/lib/modules/serena/index.js +113 -9
  29. package/lib/modules/serena/index.js.map +1 -1
  30. package/lib/modules/skills/index.js +1 -1
  31. package/lib/modules/steering/bash-search.d.ts +7 -0
  32. package/lib/modules/steering/bash-search.d.ts.map +1 -1
  33. package/lib/modules/steering/bash-search.js +13 -0
  34. package/lib/modules/steering/bash-search.js.map +1 -1
  35. package/lib/modules/steering/index.d.ts.map +1 -1
  36. package/lib/modules/steering/index.js +20 -3
  37. package/lib/modules/steering/index.js.map +1 -1
  38. package/package.json +3 -1
  39. package/parity.json +18 -10
  40. package/scripts/ceulen-sync.mjs +4 -1
  41. package/scripts/check-bundle.mjs +23 -1
  42. package/scripts/check-pack.mjs +8 -21
  43. package/scripts/pack-contract.mjs +37 -0
  44. package/scripts/smoke-install.mjs +146 -0
  45. package/scripts/spill-page.mjs +64 -0
  46. package/scripts/steer-fixtures/fixtures.mjs +148 -0
  47. package/scripts/steer-fixtures/ws/fixtures/runbook.txt +7 -0
  48. package/scripts/steer-fixtures/ws/package.json +5 -0
  49. package/scripts/steer-fixtures/ws/src/cart.js +18 -0
  50. package/scripts/steer-fixtures/ws/src/format.js +6 -0
  51. package/scripts/steer-fixtures/ws/sum.js +4 -0
  52. package/scripts/steer-fixtures/ws/tools/stamp.js +4 -0
  53. package/scripts/steer-fixtures.mjs +180 -0
  54. package/skills/evo/SKILL.md +1 -2
  55. package/upstream.lock.json +4 -4
@@ -0,0 +1,180 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Run the cold steering fixtures (scripts/steer-fixtures/fixtures.mjs) on a
4
+ * real model and say whether steering helps or hurts.
5
+ *
6
+ * Each fixture runs once per loadout — steering on, steering off, steering
7
+ * module unloaded — as a headless one-shot in its own copy of the fixture
8
+ * workspace, under its own DSH home, so nothing touches ~/.dsh, the user's
9
+ * settings or a real memory store. The bundle under test is this checkout
10
+ * (lib/ must be built). The provider row and the credential store are read
11
+ * from an existing profile.
12
+ *
13
+ * This spends real model calls (18 short runs by default). It is a release
14
+ * gate for changes to src/modules/steering, the playbook, steering.cold or the
15
+ * bash redirect, not part of `npm run check`.
16
+ *
17
+ * Usage: node scripts/steer-fixtures.mjs [--route provider/model] [--effort level]
18
+ * [--configs on,off,unloaded] [--only id,id] [--out dir]
19
+ * [--source-home dir] [--source-profile name] [--timeout seconds] [--list]
20
+ * Exit: 0 steering on scores at least the best loadout without it · 1 it scores
21
+ * lower, or a run could not start · 2 bad usage.
22
+ */
23
+ import { spawn } from 'node:child_process'
24
+ import { cpSync, existsSync, mkdirSync, readFileSync, symlinkSync, writeFileSync } from 'node:fs'
25
+ import { homedir, tmpdir } from 'node:os'
26
+ import { dirname, join, resolve } from 'node:path'
27
+ import { fileURLToPath } from 'node:url'
28
+ import { CONFIGS, FIXTURES, finalText, settingsFor, toolCalls, verdict } from './steer-fixtures/fixtures.mjs'
29
+
30
+ const root = resolve(dirname(fileURLToPath(import.meta.url)), '..')
31
+ const template = join(root, 'scripts', 'steer-fixtures', 'ws')
32
+
33
+ function usage(message) {
34
+ console.error(`steer-fixtures: ${message}\nusage: steer-fixtures.mjs [--route provider/model] [--effort level] [--configs on,off,unloaded] [--only id,id] [--out dir] [--source-home dir] [--source-profile name] [--timeout seconds] [--list]`)
35
+ process.exit(2)
36
+ }
37
+
38
+ const options = { route: 'opencode-go/deepseek-v4.1-flash', effort: 'high', configs: CONFIGS, only: undefined, out: undefined, sourceHome: process.env.DSH_HOME?.trim() || join(homedir(), '.dsh'), sourceProfile: 'tui', timeout: 300, list: false }
39
+ const argv = process.argv.slice(2)
40
+ for (let index = 0; index < argv.length; index += 1) {
41
+ const token = argv[index]
42
+ const value = () => {
43
+ const next = argv[index + 1]
44
+ if (next === undefined || next.startsWith('--')) usage(`${token} needs a value`)
45
+ index += 1
46
+ return next
47
+ }
48
+ if (token === '--route') options.route = value()
49
+ else if (token === '--effort') options.effort = value()
50
+ else if (token === '--configs') options.configs = value().split(',').filter(Boolean)
51
+ else if (token === '--only') options.only = value().split(',').filter(Boolean)
52
+ else if (token === '--out') options.out = resolve(value())
53
+ else if (token === '--source-home') options.sourceHome = resolve(value())
54
+ else if (token === '--source-profile') options.sourceProfile = value()
55
+ else if (token === '--timeout') options.timeout = Number(value())
56
+ else if (token === '--list') options.list = true
57
+ else usage(`unknown option: ${token}`)
58
+ }
59
+ const slash = options.route.indexOf('/')
60
+ if (slash <= 0 || slash === options.route.length - 1) usage('--route must be provider/model')
61
+ const provider = options.route.slice(0, slash)
62
+ const model = options.route.slice(slash + 1)
63
+ for (const config of options.configs) if (!CONFIGS.includes(config)) usage(`unknown config "${config}" (${CONFIGS.join(', ')})`)
64
+ const fixtures = options.only === undefined ? FIXTURES : FIXTURES.filter(fixture => options.only.includes(fixture.id))
65
+ if (fixtures.length === 0) usage(`no fixture matches --only (${FIXTURES.map(fixture => fixture.id).join(', ')})`)
66
+ if (!Number.isFinite(options.timeout) || options.timeout <= 0) usage('--timeout must be a positive number of seconds')
67
+
68
+ if (options.list) {
69
+ for (const fixture of FIXTURES) console.log(`${fixture.id.padEnd(11)} ${fixture.prompt}`)
70
+ process.exit(0)
71
+ }
72
+
73
+ function die(message) {
74
+ console.error(`steer-fixtures: ${message}`)
75
+ process.exit(1)
76
+ }
77
+
78
+ if (!existsSync(join(root, 'lib', 'modules', 'subagent', 'herdr.js'))) die('lib/ is not built; run npm run build first')
79
+ const { overlayText } = await import(join(root, 'lib', 'modules', 'subagent', 'herdr.js'))
80
+ const profilePatch = join(options.sourceHome, 'profiles', options.sourceProfile, 'cordis.patch.yml')
81
+ if (!existsSync(profilePatch)) die(`no provider row to copy: ${profilePatch} does not exist (--source-home, --source-profile)`)
82
+
83
+ const stamp = new Date().toISOString().replace(/[-:]/g, '').replace(/\..*/, '').replace('T', '-')
84
+ // Outside the checkout by default: each loadout's home links the credential store and keeps session logs.
85
+ const out = options.out ?? join(tmpdir(), 'ceulen-steer-fixtures', stamp)
86
+ mkdirSync(out, { recursive: true })
87
+ const overlay = join(out, 'overlay.yml')
88
+ writeFileSync(overlay, overlayText(readFileSync(profilePatch, 'utf8'), { provider, model, effort: options.effort }), { mode: 0o600 })
89
+
90
+ /** One DSH home per loadout: the headless bundles plus this checkout, its own settings, the source credential store. */
91
+ function makeHome(config) {
92
+ const home = join(out, `home-${config}`)
93
+ const profile = join(home, 'profiles', 'fixture')
94
+ mkdirSync(join(profile, 'node_modules'), { recursive: true })
95
+ mkdirSync(join(home, 'ceulen'), { recursive: true })
96
+ writeFileSync(join(profile, 'package.json'), `${JSON.stringify({ name: 'dsh-profile-fixture', private: true, dependencies: { 'ceulen-dsh': `link:${root}` }, dsh: { profile: { bundles: ['@deepseek-ai/dsh-base', '@deepseek-ai/dsh-headless', 'ceulen-dsh'] } } }, null, 2)}\n`)
97
+ writeFileSync(join(profile, 'cordis.yml'), '[]\n')
98
+ writeFileSync(join(profile, 'cordis.patch.yml'), '[]\n')
99
+ symlinkSync(root, join(profile, 'node_modules', 'ceulen-dsh'))
100
+ writeFileSync(join(home, 'ceulen', 'settings.json'), `${JSON.stringify(settingsFor(config, model), null, 2)}\n`)
101
+ const credentials = join(options.sourceHome, '.credentials.yaml')
102
+ if (existsSync(credentials)) symlinkSync(credentials, join(home, '.credentials.yaml'))
103
+ return home
104
+ }
105
+
106
+ function runOne(fixture, config, home) {
107
+ const ws = join(out, 'ws', `${config}-${fixture.id}`)
108
+ cpSync(template, ws, { recursive: true })
109
+ const eventsFile = join(out, `${config}-${fixture.id}.events.jsonl`)
110
+ const env = { ...process.env, DSH_HOME: home, CEULEN_HERDR: 'off' }
111
+ const started = Date.now()
112
+ return new Promise(done => {
113
+ const child = spawn('dsh', ['--profile', 'fixture', '--patch', overlay, '--permission-mode', 'workspace-write', '--approval-policy', 'never', '--json', '-'], { cwd: ws, env, stdio: ['pipe', 'pipe', 'pipe'] })
114
+ let stdout = ''
115
+ let stderr = ''
116
+ let timedOut = false
117
+ const timer = setTimeout(() => {
118
+ timedOut = true
119
+ child.kill('SIGKILL')
120
+ }, options.timeout * 1000)
121
+ child.stdout.on('data', chunk => { stdout += chunk })
122
+ child.stderr.on('data', chunk => { stderr += chunk })
123
+ child.on('error', error => {
124
+ clearTimeout(timer)
125
+ done({ fixture: fixture.id, config, pass: false, why: `could not start dsh: ${error.message}`, broken: true, calls: 0, seconds: 0, tokens: 0, first: '' })
126
+ })
127
+ child.on('close', code => {
128
+ clearTimeout(timer)
129
+ writeFileSync(eventsFile, stdout)
130
+ if (stderr.trim() !== '') writeFileSync(join(out, `${config}-${fixture.id}.stderr.log`), stderr)
131
+ const events = stdout.split('\n').flatMap(line => {
132
+ try {
133
+ return line.trim() === '' ? [] : [JSON.parse(line)]
134
+ } catch {
135
+ return []
136
+ }
137
+ })
138
+ const calls = toolCalls(events)
139
+ const error = events.find(event => event.type === 'error')
140
+ const tokens = events.reduce((sum, event) => sum + (event.type === 'status' ? (event.usage?.inputTokens ?? 0) + (event.usage?.outputTokens ?? 0) : 0), 0)
141
+ const base = { fixture: fixture.id, config, calls: calls.length, seconds: Math.round((Date.now() - started) / 1000), tokens, first: calls[0]?.tool ?? '' }
142
+ // A run that never reached the model says nothing about steering: report it apart from a failed fixture.
143
+ if (timedOut) return done({ ...base, pass: false, why: `timed out after ${options.timeout}s` })
144
+ if (events.length === 0 || (error !== undefined && calls.length === 0 && finalText(events) === '')) {
145
+ return done({ ...base, pass: false, broken: true, why: `run did not start (exit ${code}): ${String(error?.message ?? stderr).trim().split('\n').at(-1)?.slice(0, 200) ?? ''}` })
146
+ }
147
+ let result
148
+ try {
149
+ result = fixture.check({ events, ws, template })
150
+ } catch (thrown) {
151
+ result = { pass: false, why: `check threw: ${thrown instanceof Error ? thrown.message : String(thrown)}` }
152
+ }
153
+ done({ ...base, ...result })
154
+ })
155
+ child.stdin.end(fixture.prompt)
156
+ })
157
+ }
158
+
159
+ console.log(`steer-fixtures: ${fixtures.length} fixture(s) x ${options.configs.length} loadout(s) on ${options.route} (${options.effort}) -> ${out}`)
160
+ const homes = Object.fromEntries(options.configs.map(config => [config, makeHome(config)]))
161
+ const results = Object.fromEntries(options.configs.map(config => [config, {}]))
162
+ const rows = []
163
+ for (const fixture of fixtures) {
164
+ // One fixture at a time, its loadouts side by side: they share no workspace and no home.
165
+ const runs = await Promise.all(options.configs.map(config => runOne(fixture, config, homes[config])))
166
+ for (const run of runs) {
167
+ results[run.config][run.fixture] = run
168
+ rows.push(run)
169
+ console.log(`${run.pass ? 'pass' : 'FAIL'} ${run.fixture.padEnd(11)} ${run.config.padEnd(9)} ${String(run.calls).padStart(2)} call(s) ${String(run.seconds).padStart(3)}s ${String(run.tokens).padStart(6)} tok first: ${(run.first || '-').padEnd(12)} ${run.pass ? '' : run.why}`)
170
+ }
171
+ }
172
+
173
+ const outcome = verdict(results)
174
+ const broken = rows.filter(run => run.broken === true)
175
+ writeFileSync(join(out, 'summary.json'), `${JSON.stringify({ route: options.route, effort: options.effort, at: new Date().toISOString(), ...outcome, broken: broken.length, runs: rows }, null, 2)}\n`)
176
+ console.log('')
177
+ for (const config of options.configs) console.log(`${config.padEnd(9)} ${outcome.scores[config]}/${fixtures.length}`)
178
+ if (broken.length > 0) die(`${broken.length} run(s) did not start; the scores above are not a verdict. See ${out}`)
179
+ if (!outcome.ok) die(`steering on scores ${outcome.scores.on}/${fixtures.length}, below ${outcome.baseline}/${fixtures.length} without it. See ${out}`)
180
+ console.log(`steer-fixtures: steering on is not worse than without it (${out})`)
@@ -104,8 +104,7 @@ context.
104
104
 
105
105
  3. Store only durable, verified knowledge. `munin_search` for a near-duplicate
106
106
  first; found it → skip, or upsert the same key deliberately. Store once with
107
- `munin_store`; never a second copy through `agentmem_store` (that is the Pi
108
- replica, refreshed from the cloud). Store recurring bug root causes
107
+ `munin_store`; never a second copy in another store. Store recurring bug root causes
109
108
  (`type:bug-fix`), stable setup facts (`type:fact`), decisions with rationale
110
109
  (`type:decision`), dependency choices (`type:dependency`), each with one
111
110
  `domain:` tag. Never store transient progress, TODOs, raw logs, unverified
@@ -3,10 +3,10 @@
3
3
  "upstream": {
4
4
  "package": "ceulen",
5
5
  "repo": "ceulen-dev/ceulen",
6
- "version": "0.23.0",
7
- "commit": "ee0187ea923ee815615e984044788f2adb493e6e",
8
- "tarball": "https://registry.npmjs.org/ceulen/-/ceulen-0.23.0.tgz",
9
- "syncedAt": "2026-10-23T00:00:00.000Z"
6
+ "version": "0.31.0",
7
+ "commit": "28fe08a1465c1e2d4258974ccef96a77ab54fdca",
8
+ "tarball": "https://registry.npmjs.org/ceulen/-/ceulen-0.31.0.tgz",
9
+ "syncedAt": "2026-11-24T06:14:05.764Z"
10
10
  },
11
11
  "vendored": {
12
12
  "src/vendor/ceulen/rules/rules.ts": {