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
package/parity.json CHANGED
@@ -3,8 +3,8 @@
3
3
  "upstream": {
4
4
  "package": "ceulen",
5
5
  "repo": "ceulen-dev/ceulen",
6
- "version": "0.23.0",
7
- "commit": "ee0187ea923ee815615e984044788f2adb493e6e"
6
+ "version": "0.31.0",
7
+ "commit": "28fe08a1465c1e2d4258974ccef96a77ab54fdca"
8
8
  },
9
9
  "modules": [
10
10
  {
@@ -13,7 +13,7 @@
13
13
  "status": "native",
14
14
  "dsh": "agentmem_search/get/store/list/recent/delete/versions/diff/rollback/share/capabilities; /agentmem-status; the Memory Protocol section; optional first-turn brief (agentmem.brief, off by default) with an automatic Munin fallback",
15
15
  "phase": 0,
16
- "notes": "New in ceulen-dsh, no upstream counterpart: the default memory family on the Munin wire protocol, pinned to one opimem server (Munin keeps the cloud backup). Resolves AGENTMEM_* env > DSH credential store > the agentmem settings section, with no default endpoint, no project config and no write failover: a write never lands in the backup store by accident. Reads (search/get/list/recent) and the first-turn brief do fall back to the configured Munin cloud after one bounded attempt and label the answer; the protocol says to mirror each stored memory with munin_store at session end. share copies memories by key into other projects on the same pi server and is capability-gated: an older opimem without share answers with a clean FEATURE_DISABLED.",
16
+ "notes": "New in ceulen-dsh, no upstream counterpart: an optional second memory family on the Munin wire protocol, pinned to one self-hosted server. Resolves AGENTMEM_* env > DSH credential store > the agentmem settings section, with no default endpoint, no project config and no write failover: a write never lands in another store by accident. Until it is configured its tools are held behind ceulen_tools and cost no prompt bytes. Reads (search/get/list/recent) and the first-turn brief fall back to the configured Munin after one bounded attempt and label the answer. The Memory Protocol section lives in this module and names the store that is configured: Munin when it is, AgentMem when that is the only one. share copies memories by key into other projects on the same server and is capability-gated: a server without share answers with a clean FEATURE_DISABLED.",
17
17
  "rowId": "ceulen-agentmem"
18
18
  },
19
19
  {
@@ -73,9 +73,9 @@
73
73
  "name": "munin",
74
74
  "category": "Memory",
75
75
  "status": "port",
76
- "dsh": "munin_search/get/store/list/recent/share/delete/capabilities/versions/diff/rollback; /munin-status; optional first-turn brief (munin.brief, off by default). The cloud backup: no prompt section of its own — munin_store mirrors at session end and search/get serve the read fallback",
76
+ "dsh": "munin_search/get/store/list/recent/share/delete/capabilities/versions/diff/rollback; /munin-status; optional first-turn brief (munin.brief, off by default); optional failover to a second server (munin.fallback)",
77
77
  "phase": 2,
78
- "notes": "Now the cloud backup for the AgentMem default store: the Memory Protocol moved to ceulen-agentmem so disabling this module cannot delete the rules. Project config is opt-in because DSH exposes no project-trust predicate to plugins. The brief is pinned+recent memories (recency-filtered, undated dropped) rendered at order 56; /context prints its exact char count.",
78
+ "notes": "The primary memory store. The Memory Protocol text lives in ceulen-agentmem, so disabling this module cannot delete the rules. Project config is opt-in because DSH exposes no project-trust predicate to plugins. The brief is pinned+recent memories (recency-filtered, undated dropped) rendered at order 56; /context prints its exact char count.",
79
79
  "rowId": "ceulen-munin"
80
80
  },
81
81
  {
@@ -93,7 +93,7 @@
93
93
  "status": "partial",
94
94
  "dsh": "native subagent, subagent_fork, send_message, workflow, list_agents; `delegate` role presets (planner, reviewer, scout, tester, worker) with function-based provider/model routing; optional `schema` reply contract and the `validate_schema` tool; /subagent; inside a Herdr pane `delegate` takes `runner: \"herdr\"` (headless DSH child in a visible pane, blocking, result.json evidence)",
95
95
  "phase": 6,
96
- "notes": "Role personas and model routing port from Ceulen. The child runs with the parent's DSH preset, so per-role tool allowlists, sandbox, and timeouts stay advisory; fan-out uses native workflow, and the worktree sandbox remains unported. Typed delegation ships the reply contract in the child prompt plus `validate_schema` for the parent: the subagent service exposes no final-text hook, so the adapter does not validate in place. The herdr runner is the only path with a real sandbox per role (read-only for planner/reviewer/scout, workspace-write for tester/worker, read-only in plan mode).",
96
+ "notes": "Role personas and model routing port from Ceulen. The child runs with the parent's DSH preset, so per-role tool allowlists, sandbox, and timeouts stay advisory; fan-out uses native workflow, and the worktree sandbox remains unported. Typed delegation ships the reply contract in the child prompt plus `validate_schema` for the parent: the subagent service exposes no final-text hook, so the adapter does not validate in place. The herdr runner is the only path with a real sandbox per role (read-only for planner/reviewer/scout, workspace-write for tester/worker, read-only in plan mode). Upstream's other pane backends (herdr-app in 0.27, Rex in 0.28) are not ported: the runner drives the herdr TUI only.",
97
97
  "rowId": "ceulen-subagent"
98
98
  },
99
99
  {
@@ -114,6 +114,14 @@
114
114
  "notes": "Ceulen-DSH-only recovery over the native goal services. DSH's goal-round driver stops for good on agent/error and pauses a cancelled goal round; this module re-arms the same goal after 5/10/20/40/60 s, at most 5 times per failure streak, and counts agent/error + turn/end of one turn as one failure. Re-arming is goals.resume(), which the driver's own goal/changed listener turns into the next round, so round budget, revision fence and checkpoint stay native. A completed turn resets the streak; /goal pause|edit|complete|block|clear cancels the pending retry; exhaustion blocks with recovery-exhausted, and a human /goal resume grants a fresh 5-attempt budget (the module's own re-arm keeps the streak, or the cap would never bind). The harness is never patched. /ceulen module off goal-retry restores stock behaviour.",
115
115
  "rowId": "ceulen-goal-retry"
116
116
  },
117
+ {
118
+ "name": "goal",
119
+ "category": "Tasks",
120
+ "status": "native",
121
+ "dsh": "native /goal with the goal-round driver and the goal tools",
122
+ "phase": 0,
123
+ "notes": "Upstream added an autonomous goal mode in 0.25.0. The Harness already ships one (dsh-goal, dsh-goal-round-driver, dsh-tool-goal), so nothing is ported; goal-retry adds recovery on top."
124
+ },
117
125
  {
118
126
  "name": "a2a",
119
127
  "category": "Tasks",
@@ -165,16 +173,16 @@
165
173
  "status": "partial",
166
174
  "dsh": "apply_patch, read_slice, conflict footer, destructive bash audit",
167
175
  "phase": 3,
168
- "notes": "The built-in edit tool is not wrapped; DSH already has read-before-write and atomic edits.",
176
+ "notes": "The built-in edit tool is not wrapped; DSH already has read-before-write and atomic edits. What upstream 0.29–0.30 added to its repair module (persistentBash, spillMaxTokens, repeatReminder, clock) is Harness-native here and not ported: dsh-tool-bash-persistent, dsh-spill-policy, dsh-repeat-tool-reminder and dsh-time-context. The bundle patch moves the spill-local root from the OS temp directory to $DSH_HOME/spill, because the workspace-write sandbox hides /tmp from the shell.",
169
177
  "rowId": "ceulen-repair"
170
178
  },
171
179
  {
172
180
  "name": "serena",
173
181
  "category": "Tools",
174
182
  "status": "config",
175
- "dsh": "/serena MCP recipe + status (native dsh-mcp-client)",
183
+ "dsh": "/serena MCP recipe + status (native dsh-mcp-client); /serena cold holds the editing, memory and onboarding tools behind ceulen_tools",
176
184
  "phase": 5,
177
- "notes": "No bundled Python worker; Serena runs as a native MCP server after adding the printed row.",
185
+ "notes": "No bundled Python worker; Serena runs as a native MCP server after adding the printed row. The row follows the installed version: serena-agent 2 answers a new config with one serena_repl tool, so the recipe adds --agent-interface tools there (checked on 1.5.3 and 2.1.0). Like upstream 0.28.1, the navigation tools stay in the tool list.",
178
186
  "rowId": "ceulen-serena"
179
187
  },
180
188
  {
@@ -279,7 +287,7 @@
279
287
  "status": "partial",
280
288
  "dsh": "GLM/DeepSeek family hints and retry guidance",
281
289
  "phase": 3,
282
- "notes": "DSH owns reasoning levels and its own error taxonomy; only Ceulen-specific hints are ported.",
290
+ "notes": "DSH owns reasoning levels and its own error taxonomy; only Ceulen-specific hints are ported. Upstream's ds-anchor first-request bootstrap (added in 0.28.2, deleted in 0.29.0 after it measured worse on cold fixtures) was never ported; scripts/steer-fixtures.mjs holds the cold fixtures used here.",
283
291
  "rowId": "ceulen-steering"
284
292
  },
285
293
  {
@@ -339,7 +339,10 @@ async function analyze(target) {
339
339
  // "missing from the target" banner must not name them. `context` and `evo` are
340
340
  // DSH-only (parity status native); `codemode`/`skills`/`themes`/`upstream` are
341
341
  // renamed or bundle-owned. A new DSH-only module belongs here too.
342
- const extras = new Set(['themes', 'skills', 'upstream', 'codemode', 'context', 'evo'])
342
+ const extras = new Set([
343
+ 'themes', 'skills', 'upstream', 'codemode', 'context', 'evo',
344
+ 'agentmem', 'goal-retry', 'agentbar', 'notebooklm', 'dashboard', 'tools',
345
+ ])
343
346
  const newModules = upstream.modules.filter(name => !classified.has(name))
344
347
  const removedModules = parity.modules
345
348
  .map(module => module.name)
@@ -21,11 +21,30 @@ function fail(message) {
21
21
  process.exitCode = 1
22
22
  }
23
23
 
24
+ /**
25
+ * Harness rows the bundle patch reconfigures instead of inserting. Each one
26
+ * changes how DSH itself behaves for everyone who installs the bundle, so a
27
+ * new top-level entry has to be named here before the check passes.
28
+ */
29
+ const HARNESS_OVERRIDES = new Set(['spill-local'])
30
+
31
+ /** Top-level `- id:` entries: overrides of rows another bundle owns. */
32
+ function parseOverrides(text) {
33
+ return [...text.matchAll(/^-\s*id:\s*([A-Za-z0-9._-]+)\s*$/gm)].map(match => match[1])
34
+ }
35
+
36
+ /** The rows of the insert list: indented `- id:` entries. */
24
37
  function parseRows(text) {
25
38
  const rows = []
26
39
  let current
27
40
  for (const line of text.split(/\r?\n/)) {
28
- const id = /^\s*-\s*id:\s*([A-Za-z0-9._-]+)\s*$/.exec(line)
41
+ if (/^\S/.test(line)) {
42
+ // A top-level entry ends the row above it; it is an override or the insert list itself.
43
+ if (current !== undefined) rows.push(current)
44
+ current = undefined
45
+ continue
46
+ }
47
+ const id = /^\s+-\s*id:\s*([A-Za-z0-9._-]+)\s*$/.exec(line)
29
48
  if (id !== null) {
30
49
  if (current !== undefined) rows.push(current)
31
50
  current = { id: id[1] }
@@ -41,6 +60,9 @@ function parseRows(text) {
41
60
  const patch = await readFile(join(root, 'cordis.patch.yml'), 'utf8')
42
61
  const rows = parseRows(patch)
43
62
  if (rows.length === 0) fail('cordis.patch.yml contains no rows')
63
+ for (const id of parseOverrides(patch)) {
64
+ if (!HARNESS_OVERRIDES.has(id)) fail(`cordis.patch.yml overrides the harness row "${id}", which scripts/check-bundle.mjs does not list`)
65
+ }
44
66
 
45
67
  const seen = new Set()
46
68
  for (const row of rows) {
@@ -1,13 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
3
  * Pack contract check (plan 5.3): the tarball actually published must carry the
4
- * built modules, every skill pack, the compiled themes and the bundle patch.
5
- * Runs `npm pack --dry-run --json`, which writes no tarball.
4
+ * built modules, every skill pack, the compiled themes and the bundle patch,
5
+ * and nothing that stays on the development machine (pack-contract.mjs).
6
+ * Runs `npm pack --dry-run --json`, which writes no tarball. The same contract
7
+ * is checked on the installed package by smoke-install.mjs after a publish.
6
8
  */
7
9
  import { execFileSync } from 'node:child_process'
8
10
  import { readdirSync, statSync } from 'node:fs'
9
11
  import { dirname, join } from 'node:path'
10
12
  import { fileURLToPath } from 'node:url'
13
+ import { REQUIRED, forbiddenReason } from './pack-contract.mjs'
11
14
 
12
15
  const root = join(dirname(fileURLToPath(import.meta.url)), '..')
13
16
  const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm'
@@ -23,22 +26,7 @@ const parsed = JSON.parse(output)
23
26
  const report = Array.isArray(parsed) ? parsed[0] : Object.values(parsed)[0]
24
27
  const files = new Set(report.files.map(file => file.path))
25
28
 
26
- const required = [
27
- 'package.json',
28
- 'cordis.patch.yml',
29
- 'parity.json',
30
- 'upstream.lock.json',
31
- 'vendor.manifest.json',
32
- 'lib/index.js',
33
- 'lib/modules/skills/index.js',
34
- 'lib/modules/web/index.js',
35
- 'lib/modules/dashboard/index.js',
36
- 'lib/modules/dashboard/model.js',
37
- 'lib/modules/dashboard/scene.js',
38
- 'lib/modules/dashboard/tokens.js',
39
- 'lib/themes/generated.js',
40
- ]
41
- for (const path of required) {
29
+ for (const path of REQUIRED) {
42
30
  if (!files.has(path)) fail(`missing from the tarball: ${path}`)
43
31
  }
44
32
 
@@ -49,9 +37,8 @@ for (const entry of readdirSync(join(root, 'skills'))) {
49
37
  }
50
38
 
51
39
  for (const path of files) {
52
- if (path.startsWith('src/') || path.startsWith('test/') || path.startsWith('release/') || path.startsWith('node_modules/')) {
53
- fail(`tarball must not carry ${path}`)
54
- }
40
+ const reason = forbiddenReason(path)
41
+ if (reason !== undefined) fail(`tarball must not carry ${path} (${reason})`)
55
42
  }
56
43
 
57
44
  if (process.exitCode === undefined) {
@@ -0,0 +1,37 @@
1
+ /**
2
+ * The pack contract: what the published package must carry and what must never
3
+ * ship. One list, two checks: check-pack.mjs reads it before a publish (over
4
+ * `npm pack --dry-run`), smoke-install.mjs after one (over the installed copy).
5
+ */
6
+
7
+ /** Paths every release carries. */
8
+ export const REQUIRED = [
9
+ 'package.json',
10
+ 'cordis.patch.yml',
11
+ 'parity.json',
12
+ 'upstream.lock.json',
13
+ 'vendor.manifest.json',
14
+ 'lib/index.js',
15
+ 'lib/modules/skills/index.js',
16
+ 'lib/modules/web/index.js',
17
+ 'lib/modules/dashboard/index.js',
18
+ 'lib/modules/dashboard/model.js',
19
+ 'lib/modules/dashboard/scene.js',
20
+ 'lib/modules/dashboard/tokens.js',
21
+ 'lib/themes/generated.js',
22
+ ]
23
+
24
+ /** Top-level folders that stay on the development machine: sources, the local test suite, internal notes, build output. */
25
+ export const FORBIDDEN_PREFIXES = ['src/', 'test/', 'docs/', 'release/', 'node_modules/', 'out/', '.dsh/', '.devhome/', '.scratch/']
26
+
27
+ /** Path segments that are private wherever they sit: the personal agent-mode plugin left the public bundle in 0.2.10. */
28
+ export const FORBIDDEN_SEGMENTS = [/^agent[-_]?mode/i]
29
+
30
+ /** Why `path` (relative to the package root, forward slashes) must not ship, or undefined when it may. */
31
+ export function forbiddenReason(path) {
32
+ const prefix = FORBIDDEN_PREFIXES.find(entry => path === entry.slice(0, -1) || path.startsWith(entry))
33
+ if (prefix !== undefined) return `${prefix} stays out of the package`
34
+ const segment = path.split('/').find(part => FORBIDDEN_SEGMENTS.some(pattern => pattern.test(part)))
35
+ if (segment !== undefined) return `"${segment}" is private`
36
+ return undefined
37
+ }
@@ -0,0 +1,146 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Post-publish smoke: install the package the way a user gets it, into a
4
+ * throwaway directory, and assert the payload. check-pack.mjs looks at what
5
+ * `npm pack` would ship; this looks at what a registry (or a tarball) really
6
+ * delivered, so a wrong `files` list, a stale `lib/` or a version that never
7
+ * landed shows up before anyone else installs it.
8
+ *
9
+ * Every assertion is fatal and the exit code is the verdict:
10
+ * - npm install's own exit status
11
+ * - the installed package.json version is the one asked for
12
+ * - every required path exists (pack-contract.mjs plus --require)
13
+ * - no forbidden path exists (pack-contract.mjs plus --forbid)
14
+ * - no file names this machine's home directory
15
+ *
16
+ * Usage: node scripts/smoke-install.mjs <version> [--package <name>] [--tarball <file>]
17
+ * [--require <path>]... [--forbid <path>]... [--expect-version <v>]
18
+ * [--no-contract] [--no-private-scan]
19
+ * Exit: 0 installed and every assertion held · 1 a check failed · 2 bad usage.
20
+ */
21
+ import { execFileSync } from 'node:child_process'
22
+ import { existsSync, mkdtempSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs'
23
+ import { homedir, tmpdir } from 'node:os'
24
+ import { join, resolve } from 'node:path'
25
+ import { REQUIRED, forbiddenReason } from './pack-contract.mjs'
26
+
27
+ const USAGE = 'usage: smoke-install.mjs <version> [--package name] [--tarball file] [--require p]... [--forbid p]... [--expect-version v] [--no-contract] [--no-private-scan]'
28
+
29
+ function usage(message) {
30
+ console.error(`smoke-install: ${message}\n${USAGE}`)
31
+ process.exit(2)
32
+ }
33
+
34
+ const options = { package: 'ceulen-dsh', require: [], forbid: [], contract: true, privateScan: true }
35
+ const argv = process.argv.slice(2)
36
+ for (let index = 0; index < argv.length; index += 1) {
37
+ const token = argv[index]
38
+ const value = () => {
39
+ const next = argv[index + 1]
40
+ if (next === undefined || next.startsWith('--')) usage(`${token} needs a value`)
41
+ index += 1
42
+ return next
43
+ }
44
+ if (token === '--package') options.package = value()
45
+ else if (token === '--tarball') options.tarball = value()
46
+ else if (token === '--require') options.require.push(value())
47
+ else if (token === '--forbid') options.forbid.push(value())
48
+ else if (token === '--expect-version') options.expectVersion = value()
49
+ else if (token === '--no-contract') options.contract = false
50
+ else if (token === '--no-private-scan') options.privateScan = false
51
+ else if (token.startsWith('--')) usage(`unknown option: ${token}`)
52
+ else if (options.version === undefined) options.version = token
53
+ else usage(`unexpected argument: ${token}`)
54
+ }
55
+ if (options.version === undefined) usage('no version given')
56
+ if (options.tarball !== undefined && !existsSync(options.tarball)) usage(`tarball not found: ${options.tarball}`)
57
+
58
+ const expected = options.expectVersion ?? options.version
59
+ const spec = options.tarball !== undefined ? resolve(options.tarball) : `${options.package}@${options.version}`
60
+ const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm'
61
+ const work = mkdtempSync(join(tmpdir(), 'ceulen-smoke-install-'))
62
+ const failures = []
63
+ const fail = message => {
64
+ failures.push(message)
65
+ console.error(`FAIL ${message}`)
66
+ }
67
+ const ok = message => console.log(`ok ${message}`)
68
+
69
+ /** Every file under `dir`, as forward-slash paths relative to it. */
70
+ function walk(dir, prefix = '') {
71
+ const out = []
72
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
73
+ const path = prefix === '' ? entry.name : `${prefix}/${entry.name}`
74
+ if (entry.isDirectory()) out.push(...walk(join(dir, entry.name), path))
75
+ else out.push(path)
76
+ }
77
+ return out
78
+ }
79
+
80
+ try {
81
+ writeFileSync(join(work, 'package.json'), '{ "name": "smoke-install", "private": true }\n')
82
+ try {
83
+ // npm's own exit status: execFileSync throws on a non-zero exit, with no pipeline in between.
84
+ execFileSync(npm, ['install', spec, '--no-save', '--ignore-scripts', '--no-audit', '--no-fund', '--loglevel=error'], { cwd: work, encoding: 'utf8', stdio: 'pipe' })
85
+ ok(`npm install ${spec}`)
86
+ } catch (error) {
87
+ const detail = String(error.stderr || error.stdout || error.message).trim().split('\n').slice(-12).join('\n')
88
+ fail(`npm install ${spec} exited ${error.status ?? 'without a status'}\n${detail}`)
89
+ }
90
+
91
+ const base = join(work, 'node_modules', ...options.package.split('/'))
92
+ if (failures.length === 0 && !existsSync(join(base, 'package.json'))) fail(`${options.package} is not in node_modules after the install`)
93
+
94
+ if (failures.length === 0) {
95
+ const installed = JSON.parse(readFileSync(join(base, 'package.json'), 'utf8')).version
96
+ if (installed === expected) ok(`version ${installed}`)
97
+ else fail(`installed version is ${installed}, expected ${expected}`)
98
+
99
+ const files = walk(base)
100
+ const present = new Set(files)
101
+ const has = path => present.has(path) || existsSync(join(base, path))
102
+ const required = [...(options.contract ? REQUIRED : []), ...options.require]
103
+ const missing = required.filter(path => !has(path))
104
+ for (const path of missing) fail(`required path is missing: ${path}`)
105
+ if (missing.length === 0) ok(`${required.length} required path(s) present`)
106
+
107
+ if (options.contract) {
108
+ const skills = join(base, 'skills')
109
+ const packs = existsSync(skills) ? readdirSync(skills).filter(entry => statSync(join(skills, entry)).isDirectory()) : []
110
+ const empty = packs.filter(entry => !has(`skills/${entry}/SKILL.md`))
111
+ for (const entry of empty) fail(`skill pack has no SKILL.md: skills/${entry}`)
112
+ if (packs.length === 0) fail('no skill pack in the package')
113
+ else if (empty.length === 0) ok(`${packs.length} skill pack(s)`)
114
+ }
115
+
116
+ const banned = []
117
+ for (const path of options.forbid) if (has(path)) banned.push(`${path} (--forbid)`)
118
+ if (options.contract) {
119
+ for (const path of files) {
120
+ const reason = forbiddenReason(path)
121
+ if (reason !== undefined) banned.push(`${path} (${reason})`)
122
+ }
123
+ }
124
+ for (const entry of banned.slice(0, 20)) fail(`forbidden path is present: ${entry}`)
125
+ if (banned.length > 20) fail(`…and ${banned.length - 20} more forbidden path(s)`)
126
+ if (banned.length === 0) ok(`no forbidden path in ${files.length} file(s)`)
127
+
128
+ if (options.privateScan) {
129
+ const home = homedir()
130
+ const leaks = home.length < 4 ? [] : files.filter(path => {
131
+ const file = join(base, path)
132
+ return statSync(file).size <= 4 * 1024 * 1024 && readFileSync(file).includes(home)
133
+ })
134
+ for (const path of leaks.slice(0, 20)) fail(`file names this machine's home directory (${home}): ${path}`)
135
+ if (leaks.length === 0) ok('no file names the home directory')
136
+ }
137
+ }
138
+ } finally {
139
+ rmSync(work, { recursive: true, force: true })
140
+ }
141
+
142
+ if (failures.length > 0) {
143
+ console.error(`smoke-install: ${failures.length} check(s) failed for ${spec}`)
144
+ process.exit(1)
145
+ }
146
+ console.log(`smoke-install: ${spec} — ok`)
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Print one part of a spilled tool output.
4
+ *
5
+ * codemode keeps the head and tail of an oversized result and writes the whole
6
+ * text to a file. Reading that file back is where a model loops: `read` caps
7
+ * long lines (a JSON result is one line), `cat` returns everything over the
8
+ * budget again, and a byte cut (`head -c`) splits multi-byte characters. The
9
+ * cut notice names this command instead. Parts are counted in characters,
10
+ * never split a surrogate pair, and are sized from the budget that was active,
11
+ * so each one fits.
12
+ *
13
+ * Usage: node scripts/spill-page.mjs <file> <part> [chars-per-part]
14
+ * Exit: 0 printed · 1 no such part, or the file cannot be read · 2 bad usage.
15
+ */
16
+ import { readFileSync } from 'node:fs'
17
+
18
+ const DEFAULT_CHARS = 2400
19
+
20
+ function usage(message) {
21
+ console.error(`spill-page: ${message}\nusage: spill-page.mjs <file> <part> [chars-per-part]`)
22
+ process.exit(2)
23
+ }
24
+
25
+ /** `index`, moved back by one when it would fall between the two halves of a surrogate pair. */
26
+ function safeCut(text, index) {
27
+ if (index <= 0) return 0
28
+ if (index >= text.length) return text.length
29
+ const before = text.charCodeAt(index - 1)
30
+ const after = text.charCodeAt(index)
31
+ return before >= 0xd800 && before <= 0xdbff && after >= 0xdc00 && after <= 0xdfff ? index - 1 : index
32
+ }
33
+
34
+ function shellArg(value) {
35
+ return /^[\w@%+=:,./-]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`
36
+ }
37
+
38
+ const [file, partArg, charsArg, ...rest] = process.argv.slice(2)
39
+ if (file === undefined || partArg === undefined || rest.length > 0) usage('expected a file and a part number')
40
+ if (!/^[1-9]\d*$/.test(partArg)) usage(`part must be a positive integer, got "${partArg}"`)
41
+ if (charsArg !== undefined && !/^[1-9]\d*$/.test(charsArg)) usage(`chars-per-part must be a positive integer, got "${charsArg}"`)
42
+ const part = Number(partArg)
43
+ const chars = charsArg === undefined ? DEFAULT_CHARS : Number(charsArg)
44
+
45
+ let text
46
+ try {
47
+ text = readFileSync(file, 'utf8')
48
+ } catch (error) {
49
+ console.error(`spill-page: cannot read ${file}: ${error instanceof Error ? error.message : String(error)}`)
50
+ process.exit(1)
51
+ }
52
+
53
+ const parts = Math.max(1, Math.ceil(text.length / chars))
54
+ if (part > parts) {
55
+ console.error(`spill-page: ${file} has ${parts} part(s) of ${chars} chars; there is no part ${part}`)
56
+ process.exit(1)
57
+ }
58
+
59
+ const start = safeCut(text, (part - 1) * chars)
60
+ const end = safeCut(text, part * chars)
61
+ const next = part < parts
62
+ ? `next: ${[process.execPath, process.argv[1], file, String(part + 1), String(chars)].map(shellArg).join(' ')}`
63
+ : 'end of output'
64
+ process.stdout.write(`${text.slice(start, end)}\n[part ${part} of ${parts} · chars ${start + 1}-${end} of ${text.length} · ${next}]\n`)
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Cold fixtures for steering changes: six one-shot tasks, each started in a
3
+ * fresh session, with a pass rule read from the run's own events.
4
+ *
5
+ * Why they exist: upstream Ceulen shipped a first-request bootstrap for
6
+ * DeepSeek flash in 0.28.2 and deleted it in 0.29.0 after exactly this kind of
7
+ * run showed 3/5 with it on against 5/5 with it off. Guidance that reads well
8
+ * can still make the model worse, and only a run on the model tells. Each
9
+ * fixture is one way steering has gone wrong, here or upstream:
10
+ *
11
+ * held-tool the user names a tool steering holds cold; it must still be called
12
+ * read-first "read X, then run its command": the read comes first
13
+ * run a plain run request goes straight to bash
14
+ * symbol a definition is found and cited with its line
15
+ * edit a one-line change touches one line
16
+ * verbatim a lookup command the user typed out runs as typed
17
+ */
18
+ import { readFileSync } from 'node:fs'
19
+ import { join } from 'node:path'
20
+
21
+ /** Tool calls of a run, in order, each with the result that answered it. */
22
+ export function toolCalls(events) {
23
+ const results = new Map()
24
+ for (const event of events) if (event.type === 'tool_result') results.set(event.callId, event)
25
+ return events
26
+ .filter(event => event.type === 'tool_call')
27
+ .map((event, index) => {
28
+ const result = results.get(event.callId)
29
+ return { index, tool: event.tool, input: event.input ?? {}, status: result?.status, result: typeof result?.result === 'string' ? result.result : JSON.stringify(result?.result ?? '') }
30
+ })
31
+ }
32
+
33
+ export function finalText(events) {
34
+ const final = events.findLast(event => event.type === 'final')
35
+ return typeof final?.text === 'string' ? final.text : ''
36
+ }
37
+
38
+ const text = call => JSON.stringify(call.input)
39
+
40
+ /** True when the call runs tool `name`: directly, through ceulen_tools, or inside a codemode script. */
41
+ export function reaches(call, name) {
42
+ if (call.tool === name) return true
43
+ if (call.tool === 'ceulen_tools') return call.input.action === 'call' && call.input.name === name
44
+ if (call.tool === 'codemode') return new RegExp(`tools\\.${name}\\b|["']${name}["']`).test(String(call.input.code ?? ''))
45
+ return false
46
+ }
47
+
48
+ /** A shell command in the call: a direct bash call, or one inside a codemode script. */
49
+ function runs(call, fragment) {
50
+ return (call.tool === 'bash' || call.tool === 'codemode') && text(call).includes(fragment)
51
+ }
52
+
53
+ const ok = { pass: true, why: 'ok' }
54
+ const fail = why => ({ pass: false, why })
55
+
56
+ export const FIXTURES = [
57
+ {
58
+ id: 'held-tool',
59
+ prompt: 'Use the read_slice tool (not read) to show lines 3 to 5 of src/format.js. Reply with those three lines.',
60
+ check({ events }) {
61
+ const calls = toolCalls(events)
62
+ if (calls.length === 0) return fail('the turn ended without a tool call')
63
+ if (!calls.some(call => reaches(call, 'read_slice'))) return fail(`read_slice was never called (calls: ${calls.map(call => call.tool).join(', ')})`)
64
+ return finalText(events).includes('String(value)') ? ok : fail('the reply does not show the lines')
65
+ },
66
+ },
67
+ {
68
+ id: 'read-first',
69
+ prompt: 'Read fixtures/runbook.txt, then run its command and report the exact stdout.',
70
+ check({ events }) {
71
+ const calls = toolCalls(events)
72
+ const read = calls.find(call => text(call).includes('runbook.txt'))
73
+ const run = calls.find(call => runs(call, 'stamp.js'))
74
+ if (read === undefined) return fail('the runbook was never read')
75
+ if (run === undefined) return fail('the runbook command was never run')
76
+ if (run.index < read.index) return fail('the command ran before the runbook was read')
77
+ return finalText(events).includes('steer-fixture-42') ? ok : fail('the reply does not carry the stdout (steer-fixture-42)')
78
+ },
79
+ },
80
+ {
81
+ id: 'run',
82
+ prompt: 'Run `node sum.js` and tell me the number it prints.',
83
+ check({ events }) {
84
+ const calls = toolCalls(events)
85
+ if (calls.length === 0) return fail('the turn ended without a tool call')
86
+ if (!runs(calls[0], 'sum.js')) return fail(`the first call was ${calls[0].tool}, not the command`)
87
+ return finalText(events).includes('4950') ? ok : fail('the reply does not carry the number (4950)')
88
+ },
89
+ },
90
+ {
91
+ id: 'symbol',
92
+ prompt: 'Where is the function computeTotal defined? Answer as file:line.',
93
+ check({ events }) {
94
+ if (toolCalls(events).length === 0) return fail('the turn ended without a tool call')
95
+ return /cart\.js(?::|,? line )10\b/.test(finalText(events)) ? ok : fail('the reply does not say src/cart.js:10')
96
+ },
97
+ },
98
+ {
99
+ id: 'edit',
100
+ prompt: 'In src/cart.js change the value of TAX_RATE from 0.08 to 0.1. Change nothing else.',
101
+ check({ ws, template }) {
102
+ const want = readFileSync(join(template, 'src', 'cart.js'), 'utf8').replace('TAX_RATE = 0.08', 'TAX_RATE = 0.1')
103
+ const got = readFileSync(join(ws, 'src', 'cart.js'), 'utf8')
104
+ if (got === want) return ok
105
+ return got.includes('TAX_RATE = 0.1') ? fail('TAX_RATE changed, and so did something else') : fail('TAX_RATE was not changed')
106
+ },
107
+ },
108
+ {
109
+ id: 'verbatim',
110
+ // `grep -n` on purpose: a plain lookup, exactly what the steered redirect turns into the grep tool.
111
+ prompt: 'Run `grep -n TODO src/cart.js` and paste the exact output.',
112
+ check({ events }) {
113
+ const calls = toolCalls(events)
114
+ const typed = calls.filter(call => runs(call, 'grep -n TODO src/cart.js'))
115
+ if (typed.length === 0) return fail('the command the user typed was never sent')
116
+ if (!typed.some(call => call.status === 'completed' && !call.result.includes('Not run:'))) return fail('the command the user typed was refused')
117
+ const reply = finalText(events)
118
+ return ['load discounts', 'round per line item', 'more than one currency'].every(part => reply.includes(part)) ? ok : fail('the reply does not carry the three matching lines')
119
+ },
120
+ },
121
+ ]
122
+
123
+ /** The three loadouts a steering change is judged across. Everything else is the same in all of them. */
124
+ export const CONFIGS = ['on', 'off', 'unloaded']
125
+
126
+ const QUIET = ['advisor', 'munin', 'agentmem', 'evo', 'cron', 'a2a', 'notebooklm', 'ux', 'usage', 'dashboard']
127
+
128
+ /** ceulen settings for one loadout. Memory, review and background modules are off in all three: a fixture must not write to a real memory store. */
129
+ export function settingsFor(config, model) {
130
+ const base = { schemaVersion: 1, upstream: { enabled: false } }
131
+ if (config === 'on') return { ...base, disabled: QUIET, steering: { models: [model], bashLookups: 'redirect', cold: ['read_slice'], coldModels: [] } }
132
+ const off = { models: [], bashLookups: 'off', cold: [], coldModels: [] }
133
+ if (config === 'off') return { ...base, disabled: QUIET, steering: off }
134
+ if (config === 'unloaded') return { ...base, disabled: [...QUIET, 'steering'], steering: off }
135
+ throw new Error(`unknown config "${config}" (${CONFIGS.join(', ')})`)
136
+ }
137
+
138
+ /**
139
+ * Steering must not make the model worse: with it on, the score is at least
140
+ * the best score without it. `results` is { config: { fixtureId: { pass } } }.
141
+ */
142
+ export function verdict(results) {
143
+ const score = config => Object.values(results[config] ?? {}).filter(run => run.pass).length
144
+ const scores = Object.fromEntries(Object.keys(results).map(config => [config, score(config)]))
145
+ const baseline = Math.max(0, ...Object.keys(results).filter(config => config !== 'on').map(score))
146
+ const ok = results.on === undefined || scores.on >= baseline
147
+ return { ok, scores, baseline }
148
+ }
@@ -0,0 +1,7 @@
1
+ Release runbook
2
+
3
+ Step 1. Run this command from the project root, exactly as written:
4
+
5
+ node tools/stamp.js --seed 7
6
+
7
+ Step 2. Report the line it prints.
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "steer-fixture",
3
+ "private": true,
4
+ "type": "module"
5
+ }
@@ -0,0 +1,18 @@
1
+ // Cart totals for the steer fixtures. Line numbers matter: the fixtures ask for them.
2
+ export const TAX_RATE = 0.08
3
+
4
+ // TODO: load discounts from the price list
5
+ export function applyDiscount(amount, percent) {
6
+ return amount - (amount * percent) / 100
7
+ }
8
+
9
+ // TODO: round per line item, not per order
10
+ export function computeTotal(items) {
11
+ const subtotal = items.reduce((sum, item) => sum + item.price * item.qty, 0)
12
+ return subtotal + subtotal * TAX_RATE
13
+ }
14
+
15
+ // TODO: support more than one currency
16
+ export function formatTotal(total) {
17
+ return `$${total.toFixed(2)}`
18
+ }
@@ -0,0 +1,6 @@
1
+ // Formatting helpers for the steer fixtures.
2
+ export function pad(value, width) {
3
+ const text = String(value)
4
+ if (text.length >= width) return text
5
+ return ' '.repeat(width - text.length) + text
6
+ }
@@ -0,0 +1,4 @@
1
+ // Prints the sum of 0..99.
2
+ let total = 0
3
+ for (let value = 0; value < 100; value += 1) total += value
4
+ console.log(total)
@@ -0,0 +1,4 @@
1
+ // Prints a stamp derived from --seed, so the answer cannot be guessed from the runbook text.
2
+ const at = process.argv.indexOf('--seed')
3
+ const seed = Number(at === -1 ? 0 : process.argv[at + 1])
4
+ console.log(`steer-fixture-${seed * 6}`)