{"versions":{"0.1.0":{"name":"@wxg-prc-cpg/dsh-weknora","version":"0.1.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"description":"WeKnora knowledge retrieval tools for DeepSeek Harness (dsh): semantic search, document reading and RAG/agent answers over your own knowledge bases.","keywords":["dsh","dsh-plugin","deepseek-harness","cordis","weknora","rag","retrieval","knowledge-base"],"license":"MIT","author":{"name":"WeKnora"},"homepage":"https://github.com/Tencent/WeKnora/tree/main/packages/dsh-weknora","repository":{"type":"git","url":"git+https://github.com/Tencent/WeKnora.git","directory":"packages/dsh-weknora"},"bugs":{"url":"https://github.com/Tencent/WeKnora/issues"},"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./package.json":"./package.json"},"engines":{"node":">=20.11"},"scripts":{"build":"tsc -p tsconfig.build.json","prepare":"npm run build","typecheck":"tsc -p tsconfig.json --noEmit","test":"npm run build && node --test \"test/*.test.mjs\"","e2e":"node test/e2e/run-in-dsh.mjs"},"dsh":{"bundle":{"patch":"./cordis.patch.yml"}},"devDependencies":{"@types/node":"^22.13.0","typescript":"^5.7.3"},"gitHead":"5b140206219e52c7854e0de265de232e04a2c98c","_id":"@wxg-prc-cpg/dsh-weknora@0.1.0","_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-L6q32rNrDBU3Q8xE0SGYMlieC8sKswrp5GOslGka4UnH+f4boxLXLLMgkceE+Ub/c+C2tQ2rsaHXky9bO3pXlw==","shasum":"7c0eef8d3caa0a03aa3d61a7b37a8d365fb42cfc","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@wxg-prc-cpg/dsh-weknora/-/dsh-weknora-0.1.0.tgz","fileCount":22,"unpackedSize":116477,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@wxg-prc-cpg%2fdsh-weknora@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBvYsEuZr4l4jlS08nkexFmPgLhJHsEM2Ru6uncSfP5SAiEA3koaBmYAju6uttkHCq//u9PSY17PqXo1GJjSEg651Zo="}],"size":31772},"_npmUser":{"name":"anonymous","email":"wxg_prc_cpg@tencent.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"wxg_prc_cpg@tencent.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/dsh-weknora_0.1.0_1787288542483_0.06496056726962207"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2026-08-21T05:02:22.629Z","publish_time":1787288542629,"_source_registry_name":"default","contributors":[]}},"dist-tags":{"latest":"0.1.0"},"name":"@wxg-prc-cpg/dsh-weknora","time":{"created":"2026-08-27T07:04:40.150Z","modified":"2026-08-27T07:04:40.796Z","0.1.0":"2026-08-21T05:02:22.629Z"},"readme":"# @wxg-prc-cpg/dsh-weknora\n\nEnglish | [简体中文](./README_CN.md)\n\nA [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (`dsh`) plugin that gives the harness agent\nfirst-class access to a [WeKnora](https://github.com/Tencent/WeKnora) knowledge base: hybrid retrieval, full document\nreading, and WeKnora's own composed answers with citations.\n\ndsh ships no retrieval, embedding or knowledge-base capability of its own — its search tools (`grep`, `glob`) read the\nworkspace, and `web_search` reads the internet. This plugin fills that gap with your organization's documents.\n\n## Install\n\n```sh\n# from npm (recommended: installs prebuilt code, no build permission needed)\ndsh plugin --profile web add @wxg-prc-cpg/dsh-weknora\n\n# or from a checkout of this repository\ndsh plugin --profile web add ./packages/dsh-weknora\n```\n\nThen point it at your deployment. The shipped configuration layer reads environment variables, so the quickest start is:\n\n```sh\nexport WEKNORA_BASE_URL=https://weknora.example.com   # or http://localhost:8080\nexport WEKNORA_API_KEY=sk-...                          # a WeKnora API key with `retrieve` (+ `chat` for ask)\nexport WEKNORA_KNOWLEDGE_BASE_IDS=kb-123,kb-456        # optional default scope\ndsh web\n```\n\nFor anything beyond that, override the row from your profile's `cordis.patch.yml`\n(`$DSH_HOME/profiles/<name>/cordis.patch.yml`):\n\n```yaml\n- id: weknora\n  config:\n    baseUrl: https://weknora.example.com\n    apiKey: !!js process.env.WEKNORA_API_KEY\n    knowledgeBaseIds:\n      - kb-product-docs\n    agentId: ''            # a WeKnora custom agent id makes `weknora_ask` use the ReAct pipeline\n    maxResults: 8\n    maxChunkChars: 1200\n    requestTimeoutMs: 30000\n    chatTimeoutMs: 300000\n    resourceUrls: handle   # `public` asks WeKnora for directly loadable file URLs in citations\n    toolPrefix: weknora    # rename the tools, e.g. to mount two deployments side by side\n    tools:\n      listKnowledgeBases: true\n      search: true\n      readDocument: true\n      ask: true\n```\n\nA patch replaces the row's whole `config`, so restate every field you keep. Invalid configuration fails the plugin load\nwith a message naming each violation, rather than failing inside the first tool call.\n\nMounting two deployments is two rows with two prefixes:\n\n```yaml\n- insert:\n    - id: weknora-internal\n      name: \"@wxg-prc-cpg/dsh-weknora\"\n      config: { baseUrl: https://kb.internal.example.com, toolPrefix: internal_kb }\n    - id: weknora-public\n      name: \"@wxg-prc-cpg/dsh-weknora\"\n      config: { baseUrl: https://kb.public.example.com, toolPrefix: public_kb }\n```\n\n## Tools\n\n| Tool | WeKnora endpoint | What the model gets |\n|---|---|---|\n| `weknora_list_knowledge_bases` | `GET /knowledge-bases` | Knowledge base names and ids, to report what exists or to narrow a later search |\n| `weknora_search` | `POST /knowledge-search` + `GET /knowledge/search` | Ranked passages verbatim, each with a `knowledge_id`, score and chunk index, plus any document the query names |\n| `weknora_read_document` | `GET /chunks/:knowledge_id` + `GET /knowledge/:id` | One document's passages reassembled in order, led by its title and summary, with paging |\n| `weknora_ask` | `POST /sessions` + `POST /knowledge-chat/:id` or `POST /agent-chat/:id` | WeKnora's own answer, its citations, the server-side tools it used, and a resumable `session_id` |\n\n`weknora_search` is the workhorse: it returns the source text for the agent to reason over, which keeps the agent's own\nreasoning auditable. It answers two questions the model cannot always tell apart — *where is this discussed* and *where\nis the document called X* — by matching passage content and document names in the same call. A query that reads like a\ntitle additionally reports the documents it names, so a document whose wording differs from its own title is still\nreachable.\n\nScope works without configuration. An unscoped call is refused by the retrieval endpoint and answered from nothing by\nthe RAG one, so when `knowledgeBaseIds` is empty the plugin resolves every knowledge base the credential can see and\nuses all of them, resolving that list once per process and sharing it between `weknora_search` and `weknora_ask`.\nMaking the model choose first would be worse: knowledge bases are frequently named too poorly to choose between.\n\n`weknora_ask` delegates the whole question to WeKnora. Reserve it for broad or synthesis questions spanning many\ndocuments, where retrieving passages yourself would take several rounds — it runs another model server-side, so it is\nslow, and it returns a conclusion rather than the evidence behind it. With `agentId` set it leaves the scope alone: a\ncustom agent resolves its own from its KB selection mode, and ids sent from here would override that.\n\n`weknora_read_document` exists because retrieval returns fragments: once a passage looks right, the agent usually needs\nits neighbours. Every search hit carries the `knowledge_id` that call needs, and page 1 leads with the document's title\nand WeKnora's generated summary so a long document can be judged without paging through it.\n\nIn [Code Mode](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/core/tools/README.md) the same tools\nare available as `await tools.weknora_search({ query })`, which is a good fit for multi-hop retrieval: one program can\nfan out across ten sub-questions without ten model round trips.\n\n## Permissions and data flow\n\nThe plugin only reads. It never writes to WeKnora: no ingestion, no chunk edits, no deletion. A WeKnora API key scoped\nto `retrieve` is enough for three of the four tools; `weknora_ask` additionally needs `chat`, because it creates a\nsession and streams an answer.\n\nThe key is sent as `X-API-Key`. Set `tenantId` as well if you use a platform-scoped key, which needs `X-Tenant-ID` to\nselect a workspace. Errors are reported with the HTTP status and WeKnora's own reason, never with the key.\n\nPassage content is clipped to `maxChunkChars` before it reaches the model, so one oversized document cannot eat the\ncontext window. The clip is reported to the model (`truncated: true`) instead of silently hiding text.\n\n## Configuration reference\n\n| Field | Default | Notes |\n|---|---|---|\n| `baseUrl` | `http://localhost:8080/api/v1` | `/api/v1` is appended when missing |\n| `apiKey` | unset | `X-API-Key`; unset means an unauthenticated deployment |\n| `tenantId` | unset | `X-Tenant-ID`, required for platform-scoped keys |\n| `knowledgeBaseIds` | `[]` | Default scope when a call names none; empty means every knowledge base the credential can see |\n| `agentId` | unset | Sends `weknora_ask` to the ReAct pipeline |\n| `maxResults` | `8` | Also the ceiling for `max_results` and for cited references |\n| `maxChunkChars` | `1200` | Per-passage character budget |\n| `requestTimeoutMs` | `30000` | Retrieval and document reads |\n| `chatTimeoutMs` | `300000` | `weknora_ask`, which waits on WeKnora's own model calls |\n| `resourceUrls` | `handle` | `public` returns directly loadable file URLs |\n| `toolPrefix` | `weknora` | Tool-name prefix, `^[a-z][a-z0-9_]*$` |\n| `tools.*` | all `true` | Register fewer tools to spend fewer prompt tokens |\n\n## Development\n\n```sh\nnpm install\nnpm test          # builds, then runs the unit and contract tests\nnpm run typecheck\n```\n\nThe end-to-end check installs the package into a throwaway dsh profile, boots the headless profile against a mock\nWeKnora backend and a deterministic OpenAI-compatible model, and asserts that the harness really called the tools and\nanswered from what they returned:\n\n```sh\nnpm run build\nnode test/e2e/run-in-dsh.mjs                        # installs dsh from npm on first run\nDSH_BIN=/path/to/dsh node test/e2e/run-in-dsh.mjs   # or reuse an existing install\n```\n\ndsh needs a Node build with zstd support (Node ≥ 22.15 or ≥ 24) for its session persistence, and pnpm ≥ 10 on `PATH`,\nbecause `dsh plugin add` installs into the profile through pnpm and the profile it writes keeps its settings in\n`pnpm-workspace.yaml`. The plugin itself runs on Node ≥ 20.11 and needs neither.\n\n`test/fixtures/api-contract.json` records every WeKnora call this plugin makes. `test/contract.test.mjs` asserts the\nplugin still emits exactly those calls, and `contract/contract_test.go` asserts WeKnora's real Go request and response\ntypes still accept and serve them — so a rename on either side fails CI instead of a user's agent.\n\n## Compatibility\n\nVerified against dsh `0.1.0-rc.8` and WeKnora `0.7.2`. dsh is in developer preview and states that breaking changes\nwill happen; this package deliberately has **no runtime dependencies** and hands `ctx.tools.register()` a plain object,\nso it does not pin any harness package version. If a harness release changes the tool-definition contract, open an issue\nagainst this repository.\n\n## License\n\nMIT, same as WeKnora and dsh.","users":{}}