mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
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.
50 lines
2.0 KiB
JavaScript
50 lines
2.0 KiB
JavaScript
// applyScratchOverlay must be atomic and undoable (drift D12): the live
|
|
// overlay is user project state — a crash mid-apply must never leave a
|
|
// truncated file, and every apply must leave a .bak for manual rollback.
|
|
'use strict'
|
|
const test = require('node:test')
|
|
const assert = require('node:assert')
|
|
const fs = require('node:fs')
|
|
const os = require('node:os')
|
|
const path = require('node:path')
|
|
const { applyScratchOverlay } = require('../src/main/playground.js')
|
|
|
|
function tmpdir() {
|
|
return fs.mkdtempSync(path.join(os.tmpdir(), 'dsh-apply-'))
|
|
}
|
|
|
|
test('applyScratchOverlay writes atomically and snapshots the previous overlay', () => {
|
|
const dir = tmpdir()
|
|
const scratch = path.join(dir, 'scratch.yml')
|
|
const live = path.join(dir, 'live.yml')
|
|
fs.writeFileSync(scratch, ' path: "/scratch/base"\nplugins: [a]\n')
|
|
fs.writeFileSync(live, 'plugins: [old]\n')
|
|
const res = applyScratchOverlay(
|
|
{ scratchOverlayPath: scratch, originalBaseRef: '/orig/base' },
|
|
live,
|
|
)
|
|
assert.strictEqual(res.ok, true)
|
|
// Path line restored to the original base ref, not the scratch one.
|
|
assert.match(fs.readFileSync(live, 'utf8'), /\/orig\/base/)
|
|
// Previous live overlay preserved verbatim in the .bak snapshot.
|
|
assert.strictEqual(res.backupPath, `${live}.bak`)
|
|
assert.strictEqual(fs.readFileSync(res.backupPath, 'utf8'), 'plugins: [old]\n')
|
|
// No temp debris left behind.
|
|
const debris = fs.readdirSync(dir).filter((f) => f.includes('.tmp-'))
|
|
assert.deepStrictEqual(debris, [])
|
|
})
|
|
|
|
test('applyScratchOverlay with no pre-existing live overlay reports null backup', () => {
|
|
const dir = tmpdir()
|
|
const scratch = path.join(dir, 'scratch.yml')
|
|
const live = path.join(dir, 'sub', 'live.yml')
|
|
fs.writeFileSync(scratch, ' path: "/scratch/base"\n')
|
|
const res = applyScratchOverlay(
|
|
{ scratchOverlayPath: scratch, originalBaseRef: '/orig/base' },
|
|
live,
|
|
)
|
|
assert.strictEqual(res.ok, true)
|
|
assert.strictEqual(res.backupPath, null)
|
|
assert.ok(fs.existsSync(live))
|
|
})
|