Skip to content

feat(deepseek): add DeepSeek Harness transcript provider - #72

Open
tommy0103 wants to merge 2 commits into
mainfrom
feat/deepseek-provider
Open

feat(deepseek): add DeepSeek Harness transcript provider#72
tommy0103 wants to merge 2 commits into
mainfrom
feat/deepseek-provider

Conversation

@tommy0103

Copy link
Copy Markdown
Owner

Summary

Adds a deepseek provider adapter that indexes DeepSeek Harness session artifacts ($DSH_HOME/sessions, default ~/.dsh/sessions) into the shared Obelisk schema, alongside claude, codex, kimi, and pi.

What changed

  • packages/core/src/providers/deepseek.ts — the provider adapter:
    • Line-incremental like claude: mtime:lines cursor skips already-indexed lines (countMode: 'delta'), with a full reparse ('total') on first index or when a crash repair truncated the artifact below the indexed line count.
    • Subagent child sessions (header origin: 'subagent' + parentSession) project into their parent session as sidechain messages plus a subagent row.
    • user/message events with a non-user source kind map to is_meta (injected system prompts / skill reminders).
    • tool/call <-> tool/result correlation via callId; thinking (reasoning) blocks become content_type: 'thinking' messages ordered before the text message so assembleSessionDetail folds them correctly.
    • Stable message uuids deepseek:<sessionId>:<line> (plus :0/:1 suffixes for thinking/text) so raw() returns the original artifact line.
    • Respects $DSH_HOME; falls back to ~/.dsh/sessions.
  • packages/core/src/zstd.ts — ports the frame scanner from @deepseek-ai/dsh-session-persistence-jsonl (MIT, attribution header kept) and decodes complete frames via built-in node:zlib (zstd), skipping a torn crash tail. No new runtime dependencies.
  • builtins.ts / package.json — provider registration and exports.
  • Teststests/deepseek-parse.test.mjs (golden: plaintext / zstd frames / torn tail / incremental delta resume / truncation fallback / subagent / discover / raw), tests/deepseek-session-detail.test.mjs (ADR-0007 conformance: parse -> assembleSessionDetail -> persist round-trip), plus updated registry and schema-doc assertions.
  • Docs — README / SKILL / skill-doc source lists now include deepseek.
  • Test-harness fixes — CLI test helpers clear a harness-exported DSH_HOME so CLI tests resolve the deepseek root against the temp HOME (the deepseek provider prefers $DSH_HOME over ~/.dsh).

Design notes

  • DSH logs are single-carrier and append-only (unlike Codex), so the adapter does not need full-reparse; incremental resume is the norm.
  • No inactive visibility handling: DSH compaction summarizes history but never supersedes branches (no tree semantics), so all messages stay visible, consistent with claude/codex.
  • The ADR-0008 invocation-nonce self-identification works for DSH: DeepSeek Harness checkpoints the tool/call record to disk before the tool body runs (session-checkpoint-policy), so a CLI invocation's nonce record is indexed before the resolver runs. Verified end-to-end (overview().current.session_id resolves to the invoking DSH session in a live environment).

Verification

  • npm run typecheck — clean.
  • npm test — 473/473 pass.
  • End-to-end: built against a real ~/.dsh/sessions artifact (zstd), searched, and confirmed the live DSH session is recognized as the invoking session via the nonce path.

Index DeepSeek Harness session artifacts under $DSH_HOME/sessions
(default ~/.dsh/sessions) into the shared schema as a new 'deepseek'
source, alongside claude, codex, kimi, and pi.

The adapter is line-incremental like claude: a 'mtime:lines' cursor skips
already-indexed lines (countMode 'delta'), falling back to a full reparse
('total') on first index or when a crash repair truncated the artifact
below the indexed line count. Subagent child sessions project into their
parent session as sidechain messages plus a subagent row via the header's
origin/parentSession fields. Messages use stable uuids of the form
deepseek:<sessionId>:<line> so raw() can return the original artifact line.

zstd: a new core util (packages/core/src/zstd.ts) ports the frame scanner
from @deepseek-ai/dsh-session-persistence-jsonl (MIT) and decodes complete
frames via node:zlib, skipping a torn crash tail with no new dependencies.

Tests: golden parse tests (plaintext/zstd/torn tail/incremental delta/
truncation fallback/subagent/discover/raw), ADR-0007 session-detail
conformance with a persist round-trip, and updated registry/schema-doc
assertions. Full suite passes (473 tests).
@KinomotoMio
KinomotoMio requested a lite review from Copilot August 18, 2026 17:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants