Minimal Electron shell over the DSH JSON-RPC runtime — a first-look at what a ChatGPT.app-style host on top of the DeepSeek Harness looks like, with the harness's normally-invisible internals (trace timeline, context surface, subagent tree, compaction, plugin registry, rubrics) brought forward as first-class UI surfaces so plugin authors and researchers can see what the agent is actually doing. Runs against three keyless-to-live profiles (stdio-echo works on master out of the box; daemon-echo / daemon-vibe-echo activate once the daemon-demo lands; stdio-deepseek and daemon-vibe hit the real DeepSeek API when you supply a key). HARNESS_DEV auto-resolves to the in-repo runtime when this shell ships under examples/desktop/, so a fresh clone launches without config; env DSH_DEV_ROOT overrides for custom layouts, and a sibling deepseek-harness-dev/ checkout is the original dev workflow. Cold-clone gate (P0 fixes for first-time-clone usability): - HARNESS_DEV: 3-candidate resolver (env → walk-up in-repo marker → sibling), unit-tested via mock fs so ordering is locked without needing either real layout on disk. - config yml leaves rewritten at assemble time so the sibling-clone paths (../../deepseek-harness-dev/examples/echo-agent/…) become the in-repo paths (../../echo-agent/…) in the released tree — source yml stays usable for local dev, released tree ships a working shape. - pnpm-workspace.yaml allowBuilds.electron = true (was placeholder). - missing-key card in stdio-deepseek offers a one-click switch to stdio-echo (the keyless profile that works on master) rather than daemon-echo (blocked on the not-yet-shipped daemon-demo). - assemble-oss-release.sh rewrites the source-side breadcrumb name 'dsh-desktop-demo' → 'dsh-desktop' for the released package.json. FOUC guard on the onboarding gate (41fc5df carried) keeps the first-launch splash from flashing before the runtime probe finishes. Test suite (1634 tests in source, 3990 in the runtime repo) covers resolver ordering, renderer classifiers, trace timeline shape, compaction diff rendering, rubric parity, and the missing-key onboarding paths.
90 lines
3.8 KiB
JavaScript
90 lines
3.8 KiB
JavaScript
// Unit tests for src/main/profiles.js — targeted at leafPathFor, the seam
|
|
// the Plugins tab reads to answer "which yaml is this profile actually
|
|
// booting from?". The previous behavior hardcoded daemon-echo.yml under
|
|
// activeBasePath() in main.js, so the Plugins tab under stdio-deepseek
|
|
// showed the wrong leaf and the runtime fold reconciled against noise.
|
|
// QA round-3 shot 07 (2026-07-16) caught the regression; team-lead
|
|
// asked for a pin here so switching the leaf mapping later can't drift
|
|
// silently.
|
|
|
|
'use strict'
|
|
|
|
const test = require('node:test')
|
|
const assert = require('node:assert')
|
|
const path = require('node:path')
|
|
const fs = require('node:fs')
|
|
|
|
const { profile, listProfiles, leafPathFor, PROFILE_LEAF, configDir } = require('../src/main/profiles.js')
|
|
|
|
test('leafPathFor returns the profile-specific yaml leaf', () => {
|
|
assert.strictEqual(path.basename(leafPathFor('daemon-echo')), 'daemon-echo.yml')
|
|
assert.strictEqual(path.basename(leafPathFor('stdio-echo')), 'echo-jsonrpc.yml')
|
|
assert.strictEqual(path.basename(leafPathFor('stdio-deepseek')), 'deepseek-jsonrpc.yml')
|
|
assert.strictEqual(path.basename(leafPathFor('daemon-vibe-echo')), 'daemon-vibe.yml')
|
|
assert.strictEqual(path.basename(leafPathFor('stdio-vibe-deepseek')), 'deepseek-vibe.yml')
|
|
})
|
|
|
|
test('leafPathFor throws for an unknown profile (fail-loud rather than default)', () => {
|
|
// Silent-default to daemon-echo.yml was the shape that caused the shot-07
|
|
// bug. Locking the error path here so a typo in a future call site never
|
|
// slips back into that behavior.
|
|
assert.throws(() => leafPathFor('nope'), /unknown profile/)
|
|
assert.throws(() => leafPathFor(''), /unknown profile/)
|
|
assert.throws(() => leafPathFor(undefined), /unknown profile/)
|
|
})
|
|
|
|
test('leafPathFor covers every id in listProfiles()', () => {
|
|
// If listProfiles adds a new entry (a future desktop-web profile, say),
|
|
// the map must gain the corresponding leaf too. This test fails until
|
|
// that happens.
|
|
for (const name of listProfiles()) {
|
|
assert.doesNotThrow(() => leafPathFor(name), `missing leaf for profile ${name}`)
|
|
}
|
|
})
|
|
|
|
test('every mapped leaf exists on disk under config/', () => {
|
|
for (const [name, leaf] of Object.entries(PROFILE_LEAF)) {
|
|
const full = path.join(configDir, leaf)
|
|
assert.ok(
|
|
fs.existsSync(full),
|
|
`config leaf missing for profile "${name}": ${full}. Either add the leaf, ` +
|
|
`rename it in profiles.js, or drop the profile from listProfiles.`,
|
|
)
|
|
}
|
|
})
|
|
|
|
test('profile() surfaces leafName matching leafPathFor', () => {
|
|
// The leafName field on the profile object is what other main-side
|
|
// callers can inspect without dipping into PROFILE_LEAF (e.g. a probe
|
|
// handler that wants "the leaf this profile boots from" without
|
|
// reparsing spawn argv).
|
|
for (const name of listProfiles()) {
|
|
const p = profile(name)
|
|
assert.strictEqual(
|
|
p.leafName,
|
|
PROFILE_LEAF[name],
|
|
`profile(${name}).leafName should be "${PROFILE_LEAF[name]}"`,
|
|
)
|
|
assert.strictEqual(
|
|
path.join(configDir, p.leafName),
|
|
leafPathFor(name),
|
|
'leafName + configDir should equal leafPathFor()',
|
|
)
|
|
}
|
|
})
|
|
|
|
test('profile() spawn args reference the profile-specific leaf', () => {
|
|
// Regression pin: daemon-echo boots resolveDaemonLeaf (overlay-aware),
|
|
// every other profile embeds its own config path. If someone hardcodes
|
|
// daemon-echo.yml into another profile's args, this catches it.
|
|
const stdioDeepseek = profile('stdio-deepseek')
|
|
const lastArg = stdioDeepseek.args[stdioDeepseek.args.length - 1]
|
|
assert.match(lastArg, /deepseek-jsonrpc\.yml$/)
|
|
assert.doesNotMatch(lastArg, /daemon-echo\.yml$/)
|
|
|
|
const stdioEcho = profile('stdio-echo')
|
|
const echoArg = stdioEcho.args[stdioEcho.args.length - 1]
|
|
assert.match(echoArg, /echo-jsonrpc\.yml$/)
|
|
assert.doesNotMatch(echoArg, /daemon-echo\.yml$/)
|
|
})
|