Pular para o conteúdo principal
W

dsh-cntokenworld-kb

weber-pan/dsh-cntokenworld-kb

Connects DeepSeek Harness to a CntokenWorld knowledge base: a sidebar workbench for the documents, the wiki, the link graph and the gallery, plus four read-only tools for retrieval, reading the original passages and answering with references.

Instalar

dsh plugin --profile web add github:weber-pan/dsh-cntokenworld-kb

README

dsh-cntokenworld-kb

Connect DeepSeek Harness to a CntokenWorld knowledge base: a sidebar workbench for the documents, the wiki, the link graph and the gallery, plus four read-only retrieval tools for the agent.

MIT License Node Awesome DSH Plugin Topic

English · 简体中文

Features

  • 📚 Knowledge base workbench — the Knowledge base entry in the left sidebar opens a full panel: the first screen lists the knowledge bases as folders, and a click opens one of them.
  • 📄 Original file preview — documents carry an icon for their extension and open in their own format: images directly, PDFs in the built-in reader, Word documents rendered into laid-out text, plain text as text, and the remaining formats fall back to the content parsed by the service.
  • ⬆️ Four ways to add documents — upload files, upload a whole folder, import a web page, or edit Markdown online; the bytes travel through the host bridge, so the API key never reaches the browser.
  • 🔍 Hybrid retrieval — vector and keyword search inside one knowledge base, with the score, the match type and the passage itself.
  • 📚 Wiki editing — browse the generated articles, search them, and write them too: new pages, edits guarded by a version check, the version history with a restore, the link check and the auto fix.
  • 🕸️ Link graph — the wiki link graph drawn with a d3-force simulation: the nodes settle, can be dragged, zoomed and panned, and a node opens its article.
  • 🎨 Gallery — the image assets of a knowledge base, with a keyword filter and a lightbox.
  • 🧭 Knowledge base picker under the composer — every conversation picks the bases it may read: all of them, a single one, or several of them.
  • ⚙️ Its own section in the settings window — Knowledge base settings sits next to the general and model settings, and holds the service address, the API key and the tool switches.
  • 🌗 Follows the host theme — every colour comes from the host design system's semantic tokens, so the panel and the settings section follow the light and dark theme.

Install

From GitHub

git clone https://github.com/weber-pan/dsh-cntokenworld-kb.git
dsh plugin --profile desktop add /absolute/path/dsh-cntokenworld-kb

From npm (once published)

dsh plugin --profile desktop add dsh-cntokenworld-kb

The plugin needs a running CntokenWorld knowledge base service. It ships without any service address: fill in your own in the settings, next to the API key.

Restart the Harness after the install, so the new module generation takes effect.

Quick start

  1. Open Settings → Knowledge base settings.
  2. Fill in the service address (the plugin appends /api/v1 itself) and paste the API key the service issued. The key is write-only: it is never shown again after it is saved.
  3. Save. The tools are registered right away; no restart is needed.
  4. Open the Knowledge base entry in the left sidebar to browse, upload and edit documents.
  5. Under the composer, pick the knowledge bases the conversation may read.

Configuration

Everything is configured in Settings → Knowledge base settings, next to the general and the model settings. The plugin's own page in the Plugin Manager shows the same form.

SettingMeaningDefault
Service addressThe root of your knowledge base service; the plugin appends /api/v1.none, you have to fill it in
API keyThe key the service issued; write-only, never shown again.none
Tenant IDOptional, sent as X-Tenant-ID.none
Knowledge base IDsComma separated; empty means every base the credential can read.all
Agent IDWhen set, ask uses the server-side agent pipeline instead of the plain RAG flow.none
Tool name prefixDecides the tool names the model sees.cntokenworld_kb
Tool switchesTurn list_knowledge_bases, search, read_document and ask off one by one.all on
Retrieval countThe largest number of passages one search returns.8
Passage lengthThe largest number of characters kept per passage.1200
Request timeoutThe timeout of one REST call, in milliseconds.30000
Answer timeoutThe timeout of the streaming answer, in milliseconds.300000
Resource linkshandle keeps the private handles, public asks for public links.handle

The knowledge base scope of a conversation

The picker under the composer decides which bases a conversation may read:

  • all — every base the credential can see;
  • one — a single base;
  • several — the bases you tick.

The choice is kept by the host, per conversation, and the search and ask tools work inside it from the next call on: the model may still narrow the scope down, but it cannot leave it. Restore the default hands the scope back to the knowledge base IDs of the settings.

The service itself does not remember this choice: a CntokenWorld session only has a title and a description, so every request has to carry the knowledge_base_ids array again. The plugin therefore stores the scope of each conversation in the host and translates it into that array on every call.

Tools

ToolWhat it does
cntokenworld_kb_list_knowledge_basesLists the knowledge bases the credential can read.
cntokenworld_kb_searchHybrid vector and keyword retrieval, returning source passages with their document ids and scores.
cntokenworld_kb_read_documentReassembles the passages of one document in order, with paging.
cntokenworld_kb_askDelegates to the server-side RAG or agent pipeline and returns an answer with references.

The scope of the retrieval tools follows the scope of the conversation → the knowledge base IDs of the settings → everything the credential can see. The knowledge_base_ids a model writes in its arguments can only narrow that scope, never widen it.

Limitations

  • The tools are read-only: list_knowledge_bases, search, read_document and ask never upload, change or delete a document. Writing only happens in the Add document menu of the panel.
  • The API key needs the retrieve capability on the service side, ask additionally needs chat, and uploading needs ingest.
  • The credential is read from the configuration, it is not an interactive login.
  • Importing a web page is limited by the service's SSRF allow list.

Directory

dsh-cntokenworld-kb/
├── cordis.patch.yml     # the plugin row (its id is the settings namespace)
├── dist/
│   ├── index.js         # host entry: registers the tools, declares the settings, mounts the bridge
│   ├── schema.js        # the settings fields (schemastery, volatile)
│   ├── config.js        # defaults and validation
│   ├── client.js        # the host-side HTTP client
│   ├── bridge.js        # the host-side bridge routes (the browser panel reads through them)
│   ├── scope.js         # the host-side scope store (the picker and the tools share it)
│   ├── tools.js         # the four tool definitions
│   ├── render.js        # the tool output
│   └── web.js           # the browser half: the sidebar panel, the settings section, the picker (built by scripts/build-client.mjs)
├── src/client/          # the browser sources (00-shared / 01-styles / 15-docs / 20-panel / 25-kb / 30-wiki / 30-settings / 40-scope / 90-entry)
│   └── vendor/          # bundled dependencies: d3-force.js (the force simulation), docx-preview.js (the Word renderer)
├── scripts/
│   └── build-client.mjs # concatenates src/client/*.js into dist/web.js
├── locale/              # en.json / zh.json
├── docs/                # DETAIL.md / DETAIL.zh.md / PUBLISHING.md / preview.svg
├── assets/              # the icon and the screenshots
├── screenshots.json     # the screenshots the marketplace shows
└── icon.svg

License

MIT © 2026 weber-pan

Plugins relacionados