dsh-baton-mcp 0.6.5 → 0.6.6

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.
package/host/lib/index.js CHANGED
@@ -523,7 +523,7 @@ export function apply(ctx) {
523
523
  const ids = new Set(pending.map((m) => m?.source?.rpcId))
524
524
  const gone = waiting.filter((r) => !ids.has(r.requestId))
525
525
  if (!gone.length) return []
526
- const log = await controller.inspect(sessionId, signal()).catch(() => null)
526
+ const log = await sessionLog(sessionId).catch(() => null)
527
527
  if (!Array.isArray(log?.events)) return []
528
528
  const delivered = new Set(log.events.filter((e) => e.type === 'user/message').map((e) => e.data?.source?.rpcId))
529
529
  return gone.filter((r) => !delivered.has(r.requestId) && !r.sawPrompt)
@@ -739,8 +739,32 @@ export function apply(ctx) {
739
739
  return out
740
740
  }
741
741
 
742
+ // A session's whole event log and its folder. Harness up to 0.2.1 has sessionController.inspect;
743
+ // 0.2.2 replaced it with paged history (events): the newest page first, beforeSeq walks back,
744
+ // throughSeq pins every page to the same cut. The folder then comes from the session list.
745
+ async function sessionLog(sessionId) {
746
+ if (typeof controller.inspect === 'function') return controller.inspect(sessionId, signal())
747
+ if (typeof controller.events !== 'function') throw new Error('This DeepSeek Harness version cannot read a session log.')
748
+ const address = { kind: 'session', sessionId }
749
+ const pages = []
750
+ let throughSeq
751
+ let beforeSeq
752
+ for (;;) {
753
+ const page = await controller.events({ address, maxMessages: 500, ...(throughSeq === undefined ? {} : { throughSeq }), ...(beforeSeq === undefined ? {} : { beforeSeq }) }, signal())
754
+ throughSeq ??= page.cursor
755
+ const events = (page.records ?? []).filter((r) => r?.type === 'event' && r.event).map((r) => r.event)
756
+ pages.unshift(events)
757
+ if (!page.hasMore || !events.length || events[0].seq === beforeSeq) break
758
+ beforeSeq = events[0].seq
759
+ }
760
+ const seen = new Set()
761
+ const events = pages.flat().filter((e) => (seen.has(e.seq) ? false : (seen.add(e.seq), true)))
762
+ const { items } = await controller.list({}, signal())
763
+ return { meta: { cwd: items.find((it) => it.sessionId === sessionId)?.cwd ?? null }, events }
764
+ }
765
+
742
766
  async function readSession({ session_id, last = 10 }) {
743
- const { meta, events } = await controller.inspect(session_id, signal())
767
+ const { meta, events } = await sessionLog(session_id)
744
768
  const messages = []
745
769
  let title = null
746
770
  for (const e of events) {
@@ -900,7 +924,7 @@ export function apply(ctx) {
900
924
  // the events so far, to tell whether one came during the read.
901
925
  followedUntil.set(session_id, Date.now() + 60_000)
902
926
  const gen = eventGen.get(session_id) ?? 0
903
- const [goal, log] = await Promise.all([goalOf(session_id), controller.inspect(session_id, signal())])
927
+ const [goal, log] = await Promise.all([goalOf(session_id), sessionLog(session_id)])
904
928
  const { ended, running, runningSince } = turnsOf(log?.events)
905
929
  // A first call counts from the start of the round under way, so what it already wrote is
906
930
  // reported; one that comes after the goal stopped, from the start of the last round.
@@ -989,7 +1013,7 @@ export function apply(ctx) {
989
1013
  // A session at a glance, for a client that holds only its id: what it is doing, its goal
990
1014
  // and the reply of its last turn.
991
1015
  async function sessionStatus({ session_id }) {
992
- const [act, goal, log] = await Promise.all([activity({ session_id }), goalOf(session_id), controller.inspect(session_id, signal()).catch(() => null)])
1016
+ const [act, goal, log] = await Promise.all([activity({ session_id }), goalOf(session_id), sessionLog(session_id).catch(() => null)])
993
1017
  const { ended, running } = turnsOf(log?.events)
994
1018
  const question = questions.get(session_id)
995
1019
  return {
package/host/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-baton-host",
3
- "version": "0.6.5",
3
+ "version": "0.6.6",
4
4
  "description": "DeepSeek Harness plugin for dsh-baton: hand coding tasks from Claude Code or Codex to DeepSeek Harness on your machine. Adding it is the whole install: it registers the dsh-baton MCP server for Claude Code and Codex, runs each task live in the Harness window, wakes the main agent when the run ends and hands back the changed files, the project's own test results and a requirement-by-requirement checklist.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -20,7 +20,7 @@
20
20
  "LICENSE"
21
21
  ],
22
22
  "dependencies": {
23
- "dsh-baton-mcp": "0.6.5"
23
+ "dsh-baton-mcp": "0.6.6"
24
24
  },
25
25
  "license": "MIT",
26
26
  "dsh": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-baton-mcp",
3
- "version": "0.6.5",
3
+ "version": "0.6.6",
4
4
  "mcpName": "io.github.JialaoLiu/dsh-baton",
5
5
  "description": "Pass the baton from Claude Code, Codex or any MCP client to a local DeepSeek Harness: an MCP server that hands off tasks, continues a specific session, shows the run live in Harness and hands the result back when it is done.",
6
6
  "type": "module",
package/server.json CHANGED
@@ -7,12 +7,12 @@
7
7
  "url": "https://github.com/JialaoLiu/dsh-baton",
8
8
  "source": "github"
9
9
  },
10
- "version": "0.6.5",
10
+ "version": "0.6.6",
11
11
  "packages": [
12
12
  {
13
13
  "registryType": "npm",
14
14
  "identifier": "dsh-baton-mcp",
15
- "version": "0.6.5",
15
+ "version": "0.6.6",
16
16
  "transport": {
17
17
  "type": "stdio"
18
18
  }