dsh-weknora
Tencent/WeKnora把 WeKnora 知识库接入 dsh 的四个只读工具:列出知识库、混合检索原文片段、按顺序还原单篇文档,以及直接取用 WeKnora 自己带引用的 RAG 或 ReAct agent 回答(含可续聊的 session id)。
DSH 本地代码智能插件:Impact X-Ray 可视化展示潜在变更影响、源码证据与不确定性,并提供符号导航、有界 Context Pack 和 ArkTS 支持。
English | 中文
See the blast radius before your AI edits the code.
A local plugin for DeepSeek Harness (DSH). See which callers, imports and tests may be affected by a code change, then click a relationship to inspect its actual source, file and line. Uncertain matches and missing evidence stay visible.
Try v0.11.1 in DSH Desktop 0.2.1-rc.2 using Desktop's bundled CLI:
dsh plugin --profile desktop add dsh-code-index@0.11.1Restart Desktop after installation. Other profiles and compatibility.
30-second real Desktop demo: normalize() changes → inspect callers and tests → click an arrow for source evidence.
Full-size GIF · MP4 · Reproduce the demo · Report what helped or was missing
The recording is the real 0.11.0-dev.0 MVP in Desktop 0.2.1-rc.2. Later first-screen improvements have separate real Desktop screenshots. Open the full-size media to read small source text.
name-only candidates, import scope, unmapped ranges, missing source and truncation stay visible. A test lead does not prove coverage or failure.This is an interactive presentation of the existing code_change_context analysis, with source from the existing reader. It does not introduce a new impact-analysis engine.
Verified hosts: Desktop 0.2.1-rc.2 received full Impact X-Ray UI verification. Desktop 0.2.0-rc.2 passed installation and ToolRuntime checks; its full X-Ray UI was not validated. v0.11.1 also verifies DSH Web/Host 0.2.1-rc.3 (all eight tools and Impact X-Ray; no model-driven Agent run). See v0.11.1 evidence. These three exact DSH/dsh-tools host groups are declared; keep each host's first-party packages on the same version. For local development, use Node 22/24 and pnpm 11. Release evidence and limits · Bilingual release notes.
Ask the Agent to call code_change_context with:
{"repoRoot":"/absolute/path/to/repo","outputFormat":"xray"}Expand the tool result, choose Expand view, and select an arrow. The UI follows the host language and also offers English / 简体中文. Call graph, import graph, test leads, impact paths and gaps each have their own tab. Depth/confidence filters and local expansion only reveal the bounded snapshot; they do not fetch more analysis.
Relationship · Display · Meaning exact · Solid · Structurally resolved under the existing index; not guaranteed runtime impact import-scoped · Dashed · Import-scope evidence, with the original reason retained name-only · Dotted amber · Name candidate; inspect and verify manually
Arrows retain actual caller → callee or importer → module endpoints. Test conventions never become invented function-call arrows. Whole-path confidence retains the weakest relation. Saved source is a snapshot; rerun after edits. Deleted declarations use baseline source when available and do not offer a misleading current-file preview.
The presentation caps at 32 nodes, 48 arrows, 12 paths, 8 test/import leads each, 900 characters per source window and 96,000 UTF-8 bytes of metadata. Call relationships reserve at most 24 symbol nodes / 32 arrows. Optional X-Ray text caps at 24,000 JS characters; the default canonical text and code_context packs remain unchanged. The existing index/reference analysis runs before projection, so these UI caps are not a constant-memory guarantee for large repositories. See the measured costs and host compatibility methods in the MVP report.
Reproduce the real demo without overwriting an existing directory:
npm run build
node scripts/impact-xray-demo.mjs /absolute/path/to/new-demo-repoThe script commits a six-source-file baseline and changes normalize() from trimming to uppercase conversion. Its baseline Node test passes; the edited test intentionally fails. looseUsage deliberately lacks an import, so its name-only relation remains uncertain.
Give your DeepSeek Harness agent the bounded source context it needs to start a code task. One code_context call selects primary declarations, strong callers/callees, imports, current changes, and likely tests, with exact source ranges and reasons for inclusion. When evidence is missing, the pack says so.
exact / import-scoped / name-only relationship provenance. No probability or confidence estimate is invented.Introduced in v0.10.0 and retained in v0.11.0: ArkTS .ets files use a dedicated, pinned parser to find component structs, methods, fields and decorators, navigate statically identifiable ETS/TS references, and retrieve actual source in bounded Context Packs. The installed package passed real DSH Desktop Agent verification and Node 22/24 release checks. Partial or failed parses report bounded diagnostics.
This supports syntax and static code context, without full HarmonyOS SDK semantics, HAR/module-alias resolution or state-update/UI rerender graphs. See release evidence, ArkTS PoC and the bilingual announcement. The v0.9.1 Gitignore directory whitelist fix remains included.
Requires Node 22/24 and a matching DSH 0.2.0-rc.2, 0.2.1-rc.2 or 0.2.1-rc.3 host group. Install into an existing Desktop profile using its bundled dsh CLI:
dsh plugin --profile desktop add dsh-code-index@0.11.1Restart Desktop after installation. For a matching Web profile:
npx @deepseek-ai/dsh@0.2.1-rc.2 plugin --profile web add dsh-code-index@0.11.1
npx @deepseek-ai/dsh@0.2.1-rc.2 webFor local development, run pnpm install and pnpm build at the repository root, then use plugin --profile web add .. See Install for profile options.
Open repo A → search finds A's symbols
Switch to repo B → search finds B's symbols, not A's
Edit files outside DSH → the next query sees the change
Switch back to A → A's context is still isolatedEach Git worktree gets its own index and change state. The plugin watches projects accessed by the session and checks file metadata on tool calls, so additions, edits, and deletions become visible without a manual rebuild.
42 seconds in DSH Desktop: why did loading `' input '` produce `'INPUT'`?
One real code_context call returned loadConfig at src/config.ts:1–3, its callers, Git additions/modifications/deletions, and a likely test, with inclusion reasons and relationship provenance: 2347/5000 characters. The Agent used that context to identify .toUpperCase() as the cause.
This is actual desktop footage recorded on 2026-10-08, using the installed v0.9.0 plugin and a tiny demonstration repository. Only DSH is shown; waiting was cut and audio removed. No files were edited or tests run. The clip is not a latency measurement or a claim that a fix/tests succeeded. MP4 · Recording notes and provenance · Actual tool-card evidence.
The earlier bilingual terminal replay remains available as a separate, clearly labeled replay of audited 2026-10-05 Agent records. It also shows external-edit freshness and a 500-character signature-only fallback.
Try asking: “Use code_context to locate a config-loading bug, show the relevant source and callers, and identify likely tests.” Tell us what helped or what context was missing in the DSH discussion.
The earlier 30-second local tool demo remains available and can be reproduced with pnpm build, then node scripts/context-pack-demo.mjs. It is a separate Context Pack demo, not the Impact X-Ray Desktop recording above.
Tool · Purpose code_index · Status / (re)build the index for the current workspace code_symbols · List symbols (functions, classes, interfaces, types, methods…) with file:line — filtered by name, path, kind, exported code_search · Ranked lookup: exact > prefix > substring > subsequence-fuzzy, exports first, relevance score + file:line code_map · Bounded ranked repo map (top files by symbol density + import-graph PageRank, key symbols + lines) code_refs · Trace a symbol through the call graph: callers (who calls it) and callees (what it calls), resolved to file:line code_change_context · Start from the working-tree or an explicit diff and return changed symbols, callers, import dependents, bounded impact paths, and likely tests code_context · Edit-ready ContextPack: bounded source, reasons, relationships, changes/tests, gaps, and a hard budget; text by default code_health · Opt-in (codeHealth: true): circular dependencies (import cycles) and orphan modules
Plus an optional auto-injected system prompt section (code-index:repo-map, order 60): a compact ranked map selected from the active DSH session workspace. Set autoInject: false to disable and rely on the code_map tool only.
Requires dsh (any install path — npx, npm, or source) and Node ≥ 22.
v0.11.1 extends the compatibility range to @deepseek-ai/dsh-tools: 0.2.0-rc.2 || 0.2.1-rc.2 || 0.2.1-rc.3. Use matching DSH/dsh-tools groups, rather than mixing first-party RC packages. The DSH plugin surface remains a preview API; other RCs and future releases are outside this compatibility declaration.
Desktop checks DSH peer requirements before activation. v0.10.0's exact 0.2.0-rc.2 pin is rejected by DSH 0.2.1-rc.2; v0.10.1 enumerates the supported groups instead of requiring a version exemption or an unbounded range. Its development dependency stays on 0.2.0-rc.2 for backward API checks.
# from npm (prebuilt)
npx @deepseek-ai/dsh@0.2.0-rc.2 plugin --profile web add dsh-code-index@0.11.1
# or from a directory containing this checkout
npx @deepseek-ai/dsh@0.2.0-rc.2 plugin --profile web add ./dsh-code-indexRestart the Web UI (npx @deepseek-ai/dsh@0.2.0-rc.2 web) — startup logs confirm each tool:
[dsh-code-index] plugin loaded
[dsh-code-index] registered tool: code_index
...Verify the composed config without booting: dsh --profile web --dump-config.
In a workspace session, ask the agent:
parse and where it lives."No API key is needed to *index*; the model must of course be configured to call the tools.
The index builds lazily on first use; later calls are served from the on-disk cache with mtime-incremental refresh.
code_refs traces definitions, callers, and callees. The following is an earlier real example of that existing tool, not a v0.9 Context Card:
code_change_context defaults to the current Git working tree against HEAD. It also accepts an inline unified diff, repo-relative files, or stable symbols IDs. Results are bounded and each inferred relationship carries a provenance label: exact, import-scoped, or name-only. Deletions and renames use the baseline ref when available; untracked non-ignored files are included in working-tree mode.
code_context routes change, symbol, architecture, test, exploration, and ambiguous tasks. Deterministic camel/snake terms plus file/path/signature terms rank candidates; exact named symbols are retained before selection. Strong primary seeds find likely tests even on a clean tree. Graph neighborhoods are bounded. BM25 is not used.
budgetChars defaults to 5000 and is normalized to 300–20000; maxFiles defaults to 12 and maxSymbols to 10. Budget units are JavaScript string characters, not tokens or UTF-8 bytes. Both rendered text and serialized final pack must fit. Code is never cut mid-line to fill the cap. Very small budgets can leave only signatures or gaps; a repository identity that cannot fit produces an explicit error. Task display is summarized to 120 characters without affecting routing.
The default canonical return remains a string. Request outputFormat: "pack" explicitly for the exported ContextPack DTO. Its items are already selected, with source file/startLine/endLine/side/ref/mode/code, reason, and separate relationship resolution/provenance where relevant. budget.usedChars accounts for text; budget.packChars accounts for serialized JSON. Render with renderContextPack; no hidden candidate list is exposed through the result.
Git changes with a readable, frozen baseline commit classify declarations as added/modified/deleted. Reliable file renames remain supported. Unknown or ambiguous structural identity is unclassified; symbol renames are not guessed. Explicit files/symbols in code_change_context remain selection modes, not a proof of a Git modification.
Options are passed as the plugin row's config in the profile patch (or defaults are used if absent):
# $DSH_HOME/profiles/<name>/cordis.patch.yml — a bare row overrides by id.
- id: code-index
config:
excludeDirs: [generated, playground]
mapTopFiles: 30
mapMaxChars: 4000
autoInject: true
toolSurface: fullKey · Default · Meaning excludeDirs · [] · Extra directory names appended to built-in excludes. Matching is by exact path component; glob patterns such as secrets/** are not supported. mapTopFiles · 24 · Max files in a ranked map mapMaxChars · 3200 · Hard cap on rendered map characters mapTtlMs · 60000 · Refresh interval for the auto-injected map (ms, min 1000) autoInject · true · Register the system prompt section codeHealth · false · Register the code_health tool (cycles / orphan modules) toolSurface · full · Experimental compact mode exposes code_index, code_context, and enabled code_health; full preserves all tools externalWatch · true · Watch source files in active project contexts for external edits watchDebounceMs · 120 · Coalesce watcher events before refreshing affected files (minimum 20 ms)
ArkTS, TypeScript, JavaScript, Python, Go, Rust, Java, C++ and C (.ets .ts .tsx .mts .cts .js .jsx .mjs .cjs .py .pyi .go .rs .java .cpp .cc .cxx .c++ .hpp .hxx .hh .h .ipp .tpp .inl .c) via tree-sitter WASM — pure parsing, no native build. The symbol provider seam (src/extract.ts + grammars) is where other languages/embeddings plug in later. C/C++ symbol extraction resolves names through the declarator chain (templates, qualified ns::name definitions, in-class methods), and #include "…" specifiers feed the repo-map reference graph.
struct appear as kind: class, signature struct Name.Methods, fields, global functions, classes/interfaces/types/enums and module variables have stable qualified IDs, owners and source line ranges. Decorators (@Component, @ComponentV2, @State, @Local, @Builder, etc.) are retained as metadata and included in the definition's source range.