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.
77 lines
3.1 KiB
JavaScript
77 lines
3.1 KiB
JavaScript
// End-to-end coverage for the auto/manual compact badge (task #103 P0-3).
|
|
//
|
|
// The classifier itself is unit-tested in test/compact-badge.test.js; this
|
|
// file exercises the whole pipe from `turn/start` → session-meta cache →
|
|
// `compact/summary` → DOM class name, using the renderer harness. Two
|
|
// walkthroughs mirror the intent doc's verification steps in §2.2:
|
|
//
|
|
// 1. Manual: `turn/start { trigger: { kind:'injection', source: { plugin:'compact' }}}`
|
|
// → compact card renders with a `.compact-badge-manual` pill.
|
|
// 2. Auto: `turn/start { trigger: { kind:'user' }}` → `.compact-badge-auto`.
|
|
|
|
'use strict'
|
|
|
|
const test = require('node:test')
|
|
const assert = require('node:assert/strict')
|
|
const { loadRenderer } = require('./renderer-harness.js')
|
|
|
|
async function drive(triggerShape) {
|
|
const { renderer, document } = await loadRenderer()
|
|
renderer.ensureSession('sid-badge', { title: 't', header: {} })
|
|
await renderer.selectSession('sid-badge')
|
|
renderer.onSessionEvent('sid-badge', {
|
|
type: 'turn/start', seq: 10, time: 1,
|
|
data: { trigger: triggerShape },
|
|
})
|
|
renderer.onSessionEvent('sid-badge', {
|
|
type: 'compact/summary', seq: 12, time: 2,
|
|
data: {
|
|
summary: [{ type: 'text', text: 'This is the summary text.' }],
|
|
shadowedTokenCount: 640,
|
|
shadowedSeqs: [1, 2, 3],
|
|
model: 'test-model',
|
|
},
|
|
})
|
|
return { renderer, document }
|
|
}
|
|
|
|
test('manual compact — badge classes render on the compact card', async () => {
|
|
const { document } = await drive({
|
|
kind: 'injection',
|
|
source: { kind: 'plugin', plugin: 'compact' },
|
|
})
|
|
const card = document.querySelector('.compact-card')
|
|
assert.ok(card, 'compact card must render')
|
|
const badge = card.querySelector('.compact-badge')
|
|
assert.ok(badge, 'a compact-badge element must be present')
|
|
assert.ok(badge.classList.contains('compact-badge-manual'),
|
|
'manual badge should carry compact-badge-manual')
|
|
assert.equal(badge.textContent, 'manual')
|
|
})
|
|
|
|
test('auto compact — user turn produces the auto badge', async () => {
|
|
const { document } = await drive({ kind: 'user' })
|
|
const badge = document.querySelector('.compact-badge')
|
|
assert.ok(badge)
|
|
assert.ok(badge.classList.contains('compact-badge-auto'))
|
|
assert.equal(badge.textContent, 'auto')
|
|
})
|
|
|
|
test('no badge on persisted-only replay (no preceding turn/start)', async () => {
|
|
// A compact/summary that arrives without a matching turn/start (e.g. a
|
|
// persisted-only history replay that skipped the boundary) must render
|
|
// the card unbadged instead of falling back to auto — the classifier's
|
|
// null return is respected.
|
|
const { renderer, document } = await loadRenderer()
|
|
renderer.ensureSession('sid-noturn', { title: 't', header: {} })
|
|
await renderer.selectSession('sid-noturn')
|
|
renderer.onSessionEvent('sid-noturn', {
|
|
type: 'compact/summary', seq: 5, time: 1,
|
|
data: { summary: [], shadowedTokenCount: 100, shadowedSeqs: [1] },
|
|
})
|
|
const card = document.querySelector('.compact-card')
|
|
assert.ok(card, 'card still renders')
|
|
assert.equal(card.querySelector('.compact-badge'), null,
|
|
'no badge when we could not identify the trigger')
|
|
})
|