Skip to content

Add deepseek-lossless adapter, web presets, e2e recipe - #8

Open
SutuSebastian wants to merge 86 commits into
mainfrom
feat/deepseek
Open

SutuSebastian wants to merge 86 commits into
mainfrom
feat/deepseek

Conversation

@SutuSebastian

@SutuSebastian SutuSebastian commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds the deepseek-lossless adapter (per-session SQLite sidecar mirror, DAG compaction through the harness seam plus a DAG-bracket manual path, four recall tools, /lcm verbs) and deepseek-lossless-web (Lossless variants of all four shipped presets on an identity-tied shared core). Selecting a Lossless preset is the opt-in; host-plane profiles need only the host bundle.

packages/deepseek/src/
├── plugin.ts        # harness seam entry
├── engine.ts        # ingest plus compaction wiring
├── ingest.ts        # event mirror to sidecar store
├── ladder.ts        # leaf plus condensed summary ladder
├── dag-commit.ts    # DAG checkpoint replace
├── tools.ts         # lcm_grep, lcm_describe, lcm_expand, lcm_expand_query
├── command.ts       # /lcm verbs (status, report, dump, backup, export,
│                    # import, gc, migrate, heal, diagnose, compact)
├── lifecycle.ts     # session open and close
├── metrics.ts       # usage tally sink
├── reader.ts        # in-process cross-session reader
├── model-host.ts    # Go plus OpenRouter routes
├── preset.ts        # preset realm backend entrypoint
└── default-sidecar-dir.ts, sidecar-dump.ts, core.ts
packages/deepseek-web/
├── lossless-standard, lossless-ptc, lossless-minimal, lossless-cordis
└── generated by scripts/sync-lossless-presets.ts from pinned dsh 0.2.1-rc.3
packages/deepseek/test/e2e/
├── run-e2e.sh       # three pong probes plus sidecar checks
├── README.md        # headless recipe with tarball rebuild steps
└── overlays/        # headless plus model overlays

Evidence

  • Before: no lossless adapter for the dsh harness. Base compaction only, no leaf/condensed ladder and no cited checkpoint replaces. Sidecars defaulted to CWD, no spaced /lcm verbs claimed, no recall tools.
    After: pong probes plus sidecar checks pass per the recipe (shipped headless profile, plain base plus overlay, lossless bundle; each asserts the final pong event plus sidecar sqlite and metrics.jsonl checks). Live runs on installed dsh 0.2.1-rc.3 over Go and OpenRouter routes: auto pressure stored leaves plus condensed nodes with checkpoint replaces across 4 swaps (depth-2 DAG: 61 summaries, 47 leaves, 14 condensed, billed usage); a zero-context session answered verbatim with cross-session entry citations; the in-process reader answered through the Go route after the calling session id stamp fixed the MissingSessionID 400s. Note: on 2026-10-27 the headless probes hung with zero output even without the bundle, pointing at the environment rather than the plugin; live web proof stays owner-side and presets are pinned by unit tests.
Test Files  89 passed (89)
     Tests  1121 passed (1121)
$ tsc --noEmit   # clean

Targeted pins verified this pass: packages/deepseek/test/preset.test.ts plus default-sidecar-dir.test.ts (24 passed), covering Lossless preset loading and the dsh home sidecar default. Defaults run mirrored without compacting. Boot and span defects found live are fixed with tests.

Merge Danger

Door: two-way

Unreleased 0.1.0, no registry binding yet, so revert is a branch delete. Owner steps before merge: bind npm trusted-publisher for deepseek-lossless 0.1.0 and deepseek-lossless-web 0.1.0, then manual publish. Roadmap item 10 stays tracking until merge.

Blast Radius: deepseek-only

New surface is packages/deepseek and packages/deepseek-web plus docs and scripts/sync-lossless-presets.ts. Shared seams are small and host-free: metric row filters, usage-tally sink helpers, SidecarStores eviction, compactable range selection, and a toolNameOfText export in packages/core, plus a 3-line config-io tweak in packages/pi. No behavior change for existing users: the adapter is opt-in with enabled, auto, and bracketAuto off.

Summary by CodeRabbit

  • New Features

    • Added an opt-in DeepSeek adapter for lossless context management, manual compaction, configurable automatic compaction, and session-history search and expansion.
    • Added /lcm commands for status, reports, backups, exports, imports, diagnostics, sidecar maintenance, and manual compaction. Maintenance operations default to dry-run where applicable.
    • Added session backfill and bounded cross-session recall, plus secure file handling for backups, exports, and diagnostic reports.
    • Added DeepSeek setup guides, reference pages, and comparison documentation, with navigation that preserves the current documentation section when available.
  • Bug Fixes

    • Improved recall-tool matching for tool names shown in assistant messages.
    • Pass-condition checks now detect changes to configured mechanical tools.

RetriggerView in GreptileConfidence Score: 5/5

The reviewed changes appear safe to merge, with both numbered previous findings addressed.

Summary

Adds deepseek-lossless with per-session SQLite history, DAG compaction, four recall tools, /lcm commands, and a companion bundle for web presets.

  • DeepSeek sessions keep searchable history and replace compacted spans with cited checkpoints.
  • The model can search session history and use /lcm to inspect and manage it.
  • Four DeepSeek web presets gain Lossless versions that use the shared compaction backend.
  • Shared core helpers now support DeepSeek recall, metrics, and compaction ranges.
  • The docs site and project guides now explain the DeepSeek adapter and its presets.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  History[DeepSeek session events] --> Mirror[History mirror]
  Mirror --> Store[Per-session SQLite store]
  Store --> Ladder[Leaf and condensed summaries]
  Ladder --> Checkpoint[DeepSeek checkpoint]
  Store --> Recall[Four recall tools]
  Commands["/lcm commands"] --> Store
Loading

Reviews (31) · Last reviewed commit: "fix(deepseek): keep json stdout clean an..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
Walkthrough

Adds the deepseek-lossless adapter package. It mirrors session history to sidecars, provides recall tools and /lcm lifecycle commands, and adds manual and optional automatic compaction. The change also adds DeepSeek documentation, navigation, release metadata, and shared core utilities.

Changes: DeepSeek adapter

Layer / File(s) Summary
Package foundation and shared utilities
packages/deepseek/package.json, packages/deepseek/src/index.ts, packages/core/src/util/*, package.json, packages/deepseek/vite.config.ts, packages/deepseek/test/publish-surface.test.ts
Adds package build and publish configuration, public adapter exports, metrics helpers, compactable-range selection, and sidecar cache eviction.
Session mirroring and plugin setup
packages/deepseek/src/ingest.ts, packages/deepseek/src/plugin.ts, packages/core/src/util/sidecar-store.ts, packages/deepseek/test/{backfill,ingest,plugin}.test.ts
Adds event projection, live mirroring, bounded history backfill, per-session indexes, opt-in registration, and disposal behavior.
Model host and recall tools
packages/deepseek/src/{model-host,reader,tools}.ts, packages/deepseek/test/{model-host,reader,tools,cross-session,expand-query}.test.ts
Adds streaming model routing, reader execution, current-session recall, read-only past-session search, and bounded query expansion.
Summarization and DAG compaction
packages/deepseek/src/{ladder,dag-commit,engine}.ts, packages/deepseek/test/{dag-commit,engine,calibration,metrics}.test.ts
Adds checkpoint hydration, summarization, balanced range selection, bracketed transactions, manual compaction, and optional bracketed automatic compaction.
Lifecycle commands and diagnostics
packages/deepseek/src/{command,lifecycle,sidecar-dump}.ts, packages/deepseek/test/{lifecycle,lifecycle-mutating}.test.ts
Adds /lcm dispatch, status and report output, secure file operations, diagnostics, garbage collection, migration, healing, import, and bounded sidecar dumps.
Documentation, navigation, and release metadata
packages/deepseek/{README.md,CHANGELOG.md,LICENSE,skills/*}, apps/docs/content/**, apps/docs/components/*, README.md, docs/*, .changeset/*
Adds DeepSeek package, guide, reference, comparison, navigation, governance, roadmap, and release documentation.

Priority: Normal

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant LcmCommand
  participant LosslessSummarizerEngine
  participant commitDagTransaction
  participant runLadder
  participant dshModelHost
  participant LcmStore
  Operator->>LcmCommand: invoke /lcm compact
  LcmCommand->>LosslessSummarizerEngine: compactNow
  LosslessSummarizerEngine->>commitDagTransaction: submit selected range
  commitDagTransaction->>runLadder: summarize selected entries
  runLadder->>dshModelHost: stream summarization request
  dshModelHost-->>runLadder: answer and token usage
  runLadder->>LcmStore: commit summary run
  commitDagTransaction-->>LosslessSummarizerEngine: checkpoint and sequence results
  LosslessSummarizerEngine-->>LcmCommand: compaction result
Loading

Possibly related PRs

  • stainless-code/lossless#12: Adds core recall, metrics, sidecar, import-integrity, mechanical-compaction, and dump contracts used by the DeepSeek adapter.
Merge Risk: Moderate · up to 96358

A supported retention setting can prevent the adapter from loading, and the web-profile instructions do not switch the preset backend. Correct those paths before merging; the disabled-adapter troubleshooting instructions also need updating.

Pre-merge checks: Passed 4
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title identifies the main change, the new deepseek-lossless adapter. It also references related setup and validation work, although those details are less prominent than the adapter and documentat…
Full details: Title check

Explanation

The title identifies the main change, the new deepseek-lossless adapter. It also references related setup and validation work, although those details are less prominent than the adapter and documentation changes.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@changeset-bot

changeset-bot Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6944136

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
lossless-core Patch
deepseek-lossless Patch
deepseek-lossless-web Patch
pi-lossless Patch
opencode-lossless Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@SutuSebastian SutuSebastian changed the title DeepSeek adapter spike (extracted, not for merge) DeepSeek adapter Oct 24, 2026
Comment thread packages/deepseek/src/core.ts Outdated
Comment thread packages/deepseek-web/cordis.presets.patch.yml Outdated
Comment thread apps/docs/components/seo/deepseek-faqs.ts Outdated
Comment thread packages/deepseek/src/preset.ts Outdated
Comment thread packages/deepseek/src/ingest.ts
Comment thread apps/docs/content/_snippets/reference/files/deepseek.mdx Outdated
…ecar restore

Fixes Greptile P2 4389431440 (tool result prefix) and 4389431449 (remount restore qualifier).
@SutuSebastian

Copy link
Copy Markdown
Contributor Author

@pullfrog review

@pullfrog pullfrog Bot 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.

Important

Manual /lcm compact fails on exactly the sessions that need it most (long pre-mount histories and races with the async mount backfill). The auto seam path heals the same mirror gap; the DAG bracket path does not. The remaining notes are minor inconsistencies worth aligning before merge.

Reviewed changes

  • DeepSeek adapter (packages/deepseek/src/): per-session SQLite mirror with paged/capped async backfill, shared ladder over dshModelHost, DAG bracket transaction plus engine override, four recall tools with cross-session search, and eleven /lcm verbs with dry-run defaults.
  • Shared core seams (packages/core/src/): order-dependent recall scope machine with removed-row handling, readMetricRows session/limit filters plus usage tally helpers, SidecarStores evict/clear, selectCompactableRange, and exported toolNameOfText.
  • Pi pass conditions: mechanicalTools joins the compared pass-condition set so async passes go stale on tool-list change.
  • Web presets (packages/deepseek-web/): four generated Lossless presets plus the sync-lossless-presets generator pinned to the harness version.
  • Docs and releases: DeepSeek guides, reference, audited comparison, nav/home wiring, and per-package changesets.

Two specialist passes (DAG transaction fidelity, sidecar file safety) back the comments below; every finding was re-validated against the checked-out code. Dropped as non-actionable: memory-note-before-flush ordering (matches the existing seam summarize path), non-atomic export/diagnose/gc writes (explicit user paths, delete-after-successful-write ordering is fail-closed), and read-only path traversal (listing-based lookup, sanitized stems).

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using muse-spark-1.3-contributor | 𝕏

Comment thread packages/deepseek/src/dag-commit.ts Outdated
Comment thread packages/deepseek/src/dag-commit.ts
Comment thread packages/deepseek/src/plugin.ts Outdated
Comment thread packages/deepseek/src/ladder.ts Outdated
@stainless-code stainless-code deleted a comment from pullfrog Bot Oct 27, 2026
@stainless-code stainless-code deleted a comment from pullfrog Bot Oct 27, 2026
- ptc preset swaps the unreleased executor row for the pinned presentation row (dsh-agent-tool-presentation, mode ptc)
- generator pins the harness checkout to exactly 0.2.1-rc.3 at tag dsh-v0.2.1-rc.3, with content pins that fail fast on master HEAD
- 4 preset descriptions, one per lossless preset, rendered by the UI for non built-in ids
- publish-surface test asserts every lossless preset declares a non-empty description with no em dash
- lcm command declares input hint <subcommand> ... so spaced verbs route through one handler with bare input on status

- ptc preset swaps the unreleased executor row for the pinned dsh-agent-tool-presentation row with mode ptc

- generator pins the harness checkout to exactly 0.2.1-rc.3 at tag dsh-v0.2.1-rc.3

- 4 lossless preset descriptions, one per preset, rendered by the UI for non built-in ids

- lifecycle shape test asserts the hint plus bare, spaced status, and dump dispatch

- e2e probes use a portable tarball path with a runner that checks pong finals and sidecars
Each bracket writes a single condensed summary to the session log and keeps leaves sidecar only in sqlite.

Adds a two-compaction regression test pinning one log summary per bracket.

Resolves loader repeats that re-read leaf records on harness reload.
Default sidecarDir is the global dsh home path ($DSH_HOME/lossless, else ~/.dsh/lossless) with ./.lossless only as fallback. First publish ships no legacy path, so the startup CWD warning and migrate hint are gone; mount keeps the one startup log line with dir plus source.
Bracket span mapping retries once through history backfill before throwing.

Manual taxonomy rethrows already-memory so it matches the auto path.

Recall wiring reads through peek so lookups create no empty sidecar.

Half-set summarizer pair falls back to the agent route.

@pullfrog pullfrog Bot 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.

ℹ️ No critical issues — two minor inconsistencies inline, both in new delta files. Prior feedback is fully addressed.

Reviewed changes since the prior Pullfrog review (9fdbbfa..323ab3f, five commits):

  • Bracket writes one condensed summary per pass with leaves sidecar-only, keeping the single-summary session log shape plus sidecar ids on the result for metrics.
  • Sidecar default moved to the dsh home ($DSH_HOME/lossless, else ~/.dsh/lossless, else ./.lossless) via a pure resolver with tests.
  • Preset surface corrected to the pinned harness rows with per-preset descriptions, and the sync script now pins the exact harness tag with fail-fast row guards.
  • Manual e2e probes added as recipes plus a runner script against real dsh profiles.
  • Prior review gaps closed: DAG catch-up backfill, already-memory rethrow, half-set summarizer fallback, and peek-based recall wiring (threads retired).

No specialist pass was needed: the delta is narrow, and each prior fix was verified by direct reads against the checked-out code.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using muse-spark-1.3-contributor | 𝕏

Comment thread packages/deepseek/src/plugin.ts Outdated
Comment thread packages/deepseek/test/e2e/run-e2e.sh Outdated
Comment thread packages/deepseek/src/plugin.ts Outdated
Comment thread packages/deepseek/test/e2e/run-e2e.sh Outdated

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes since the prior Pullfrog review (323ab3f..6944136, one commit):

  • Routed the sidecar-dir notice through the harness logger instead of console.log, keeping headless --json stdout clean NDJSON, with a regression test asserting nothing reaches console.log or stdout.
  • Scoped the e2e runner to a scratch DSH_HOME (/tmp/e2e-dsh/lossless) for sidecar creation and assertions, replacing the stale /tmp/.lossless path, with string-guard tests on the script.
  • Added a patch changeset describing both fixes.

Both prior threads were verified fixed against the checked-out code and retired. One verification limit: the new engine logger test was checked by reading only, since the sandbox lacks the private @deepseek-ai/* harness packages needed to execute the deepseek suite.

Pullfrog  | View workflow run | Using muse-spark-1.3-contributor | 𝕏

@SutuSebastian SutuSebastian changed the title Add deepseek-lossless: adapter, docs, and live proof Add deepseek-lossless adapter, web presets, e2e recipe Oct 27, 2026

This branch has not been deployed

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

Labels

docs Deploy docs site on merge to main documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant