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.
42 lines
2.0 KiB
JavaScript
42 lines
2.0 KiB
JavaScript
// Probe live 9224 for eventCount / hasUserMessage distribution on session/list.
|
|
// Same raw-WebSocket pattern as qa-cdp-shot.mjs (built-in WS = no Origin).
|
|
const port = process.argv[2] || '9224'
|
|
const tabs = await (await fetch(`http://127.0.0.1:${port}/json/list`)).json()
|
|
const target = tabs.find(t => t.type === 'page' && t.url && t.url.startsWith('file://'))
|
|
if (!target) { console.error('no page target'); process.exit(1) }
|
|
const ws = new WebSocket(target.webSocketDebuggerUrl)
|
|
let id = 0
|
|
const pending = new Map()
|
|
function call(method, params={}) {
|
|
const nid = ++id
|
|
return new Promise((res, rej) => {
|
|
pending.set(nid, { res, rej })
|
|
ws.send(JSON.stringify({ id: nid, method, params }))
|
|
})
|
|
}
|
|
await new Promise(r => ws.addEventListener('open', r, { once: true }))
|
|
ws.addEventListener('message', ev => {
|
|
const m = JSON.parse(ev.data)
|
|
if (m.id && pending.has(m.id)) { const { res, rej } = pending.get(m.id); pending.delete(m.id); m.error ? rej(new Error(JSON.stringify(m.error))) : res(m.result) }
|
|
})
|
|
await call('Runtime.enable')
|
|
const r = await call('Runtime.evaluate', {
|
|
expression: `(async () => {
|
|
const sessions = window.__dshChat && window.__dshChat.getSessions ? window.__dshChat.getSessions() : []
|
|
const arr = Array.isArray(sessions) ? sessions : []
|
|
const total = arr.length
|
|
let withEC = 0, ecZero = 0, ecUndef = 0, huTrue = 0, huUndef = 0
|
|
for (const s of arr) {
|
|
if (typeof s.eventCount === 'number') { withEC++; if (s.eventCount === 0) ecZero++ }
|
|
else ecUndef++
|
|
if (s.hasUserMessage === true) huTrue++
|
|
else if (s.hasUserMessage === undefined) huUndef++
|
|
}
|
|
return JSON.stringify({ total, withEC, ecZero, ecUndef, huTrue, huUndef, sample: arr.slice(0,3).map(s => ({ id: s.sessionId && s.sessionId.slice(0,8), eventCount: s.eventCount, hasUserMessage: s.hasUserMessage, live: s.live, persisted: s.persisted, title: s.header && s.header.title })) })
|
|
})()`,
|
|
returnByValue: true,
|
|
awaitPromise: true,
|
|
})
|
|
console.log(r.result && r.result.value)
|
|
ws.close()
|