Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 200 additions & 0 deletions .github/workflows/dsh-plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
name: Build & Publish (dsh-weknora)

# Build, test, and publish the DeepSeek Harness plugin (packages/dsh-weknora/) to npm.
#
# Three jobs:
# test typecheck, unit tests, contract tests, and a packaging check
# e2e install the package into a throwaway dsh profile and drive real
# tool calls through the harness agent loop against a mock backend
# publish on a `dsh-weknora-v*` tag only, publish to npm with provenance
#
# The e2e job pins the harness version so a plugin change is the only thing that
# can turn it red. The weekly drift job runs the same check against dsh@latest and
# is allowed to fail: it exists to notice a harness breaking change early, since
# dsh is in developer preview.

on:
push:
branches: [main]
tags:
- "dsh-weknora-v*"
paths:
- "packages/dsh-weknora/**"
- ".github/workflows/dsh-plugin.yml"
pull_request:
paths:
- "packages/dsh-weknora/**"
- ".github/workflows/dsh-plugin.yml"
schedule:
# Monday 03:00 UTC: catch a harness release that breaks the plugin.
- cron: "0 3 * * 1"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

env:
# The harness release this plugin is verified against. Bump it together with
# the compatibility note in packages/dsh-weknora/README.md.
DSH_PINNED_SPEC: "@deepseek-ai/dsh@0.1.0-rc.6"

jobs:
test:
name: Typecheck, test, pack
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: packages/dsh-weknora
steps:
- uses: actions/checkout@v6

- uses: actions/setup-node@v4
with:
node-version: "24"

- name: Install dependencies
run: npm ci || npm install

- name: Typecheck
run: npm run typecheck

- name: Build
run: npm run build

- name: Unit and contract tests
run: node --test "test/*.test.mjs"

- name: Pack and verify the published file list
run: |
set -e
npm pack --dry-run --json > pack.json
node -e "
const files = require('./pack.json')[0].files.map(f => f.path);
const required = ['dist/index.js', 'dist/index.d.ts', 'cordis.patch.yml', 'README.md', 'package.json'];
const missing = required.filter(name => !files.includes(name));
if (missing.length > 0) {
console.error('missing from the tarball: ' + missing.join(', '));
process.exit(1);
}
const leaked = files.filter(name => name.startsWith('test/') || name.startsWith('src/'));
if (leaked.length > 0) {
console.error('unexpected files in the tarball: ' + leaked.join(', '));
process.exit(1);
}
console.log('tarball contents verified: ' + files.length + ' files');
"
rm pack.json

e2e:
name: End-to-end inside dsh (pinned)
runs-on: ubuntu-latest
timeout-minutes: 25
defaults:
run:
working-directory: packages/dsh-weknora
steps:
- uses: actions/checkout@v6

- uses: actions/setup-node@v4
with:
node-version: "24"

- name: Install dependencies
run: npm ci || npm install

- name: Build
run: npm run build

- name: Run the plugin inside a real dsh profile
env:
DSH_PACKAGE_SPEC: ${{ env.DSH_PINNED_SPEC }}
DSH_E2E_LOG: ${{ runner.temp }}/dsh-weknora-e2e.log
run: node test/e2e/run-in-dsh.mjs

- name: Upload the transcript
if: always()
uses: actions/upload-artifact@v4
with:
name: dsh-weknora-e2e-transcript
path: ${{ runner.temp }}/dsh-weknora-e2e.log
if-no-files-found: ignore

drift:
name: End-to-end inside dsh (latest, advisory)
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 25
continue-on-error: true
defaults:
run:
working-directory: packages/dsh-weknora
steps:
- uses: actions/checkout@v6

- uses: actions/setup-node@v4
with:
node-version: "24"

- name: Install dependencies
run: npm ci || npm install

- name: Build
run: npm run build

- name: Run against the latest harness release
env:
DSH_PACKAGE_SPEC: "@deepseek-ai/dsh@latest"
run: node test/e2e/run-in-dsh.mjs

publish:
name: Publish to npm
needs: [test, e2e]
if: startsWith(github.ref, 'refs/tags/dsh-weknora-v')
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
id-token: write
environment:
name: npm
url: https://www.npmjs.com/package/dsh-weknora
defaults:
run:
working-directory: packages/dsh-weknora
steps:
- uses: actions/checkout@v6

- uses: actions/setup-node@v4
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: npm ci || npm install

- name: Build
run: npm run build

- name: Check whether this version is already published
id: check_npm
run: |
set -e
version="$(node -p "require('./package.json').version")"
echo "packaged version: $version"
if npm view "dsh-weknora@$version" version >/dev/null 2>&1; then
echo "should_publish=false" >> "$GITHUB_OUTPUT"
echo "::warning::dsh-weknora $version is already on npm; skipping publish. Bump package.json to release."
else
echo "should_publish=true" >> "$GITHUB_OUTPUT"
fi

- name: Publish
if: steps.check_npm.outputs.should_publish == 'true'
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,15 @@ The [WeKnora Mini Program](./miniprogram/README.md) provides a lightweight mobil
- **Hybrid Search** — Search within or across knowledge bases with vector + keyword retrieval
- **Knowledge Management** — List, browse, edit, and delete knowledge entries programmatically

## 🐋 DeepSeek Harness Plugin

[**`dsh-weknora`**](./packages/dsh-weknora/README.md) is the official [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (`dsh`) plugin. The harness ships no retrieval, embedding or knowledge-base capability of its own, so the plugin gives a coding agent your documents: `dsh plugin --profile web add dsh-weknora`, point it at a deployment, and four read-only tools appear in the agent's tool set.

- **`weknora_search`** — hybrid retrieval returning source passages verbatim, each with a reusable `knowledge_id`
- **`weknora_read_document`** — one document's passages reassembled in order, with paging
- **`weknora_ask`** — WeKnora's own composed answer with citations, over the RAG or the ReAct pipeline
- **`weknora_list_knowledge_bases`** — knowledge base names and ids, so the agent can scope its own search

## ⌨️ Command-Line Interface

`weknora` is the official CLI for driving the API from a terminal or an AI
Expand Down
9 changes: 9 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,15 @@
- **混合检索** — 在单个或多个知识库中进行向量 + 关键词混合搜索
- **知识管理** — 以编程方式浏览、编辑和删除知识条目

## 🐋 DeepSeek Harness 插件

[**`dsh-weknora`**](./packages/dsh-weknora/README_CN.md) 是官方的 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(`dsh`)插件。harness 自身不带任何检索、向量或知识库能力,这个插件把你的文档接进编码 Agent:`dsh plugin --profile web add dsh-weknora`,指向一个部署,Agent 的工具集里就会出现四个只读工具。

- **`weknora_search`** — 混合检索,返回原文片段,每条都带可复用的 `knowledge_id`
- **`weknora_read_document`** — 把单个文档的分块按序拼回正文,支持翻页
- **`weknora_ask`** — WeKnora 自己带引用的成稿答案,走 RAG 或 ReAct 流水线
- **`weknora_list_knowledge_bases`** — 知识库名称与 id,便于 Agent 自己缩小检索范围

## 🚀 快速开始

### 🛠 环境要求
Expand Down
9 changes: 9 additions & 0 deletions README_JA.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,15 @@ Feishu、Notion、Yuqueなどの外部プラットフォームからのナレッ
- **ハイブリッド検索** — 単一または複数のナレッジベースをベクトル + キーワードで横断検索
- **ナレッジ管理** — プログラムによるナレッジエントリの閲覧、編集、削除

## 🐋 DeepSeek Harness プラグイン

[**`dsh-weknora`**](./packages/dsh-weknora/README.md) は公式の [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(`dsh`)プラグインです。harness 自体は検索・埋め込み・ナレッジベースの機能を持たないため、このプラグインがコーディングエージェントに自社ドキュメントを与えます。`dsh plugin --profile web add dsh-weknora` でインストールしてデプロイ先を指定すると、4 つの読み取り専用ツールがエージェントのツールセットに現れます。

- **`weknora_search`** — ハイブリッド検索。原文のパッセージをそのまま返し、各件に再利用可能な `knowledge_id` が付く
- **`weknora_read_document`** — 1 つのドキュメントのチャンクを順番に再構成、ページング対応
- **`weknora_ask`** — WeKnora 自身が引用付きで作成した回答(RAG または ReAct パイプライン)
- **`weknora_list_knowledge_bases`** — ナレッジベースの名前と id。エージェントが自分で検索範囲を絞れる


## 🚀 クイックスタート

Expand Down
9 changes: 9 additions & 0 deletions README_KO.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,15 @@ Feishu, Notion, Yuque 등 외부 플랫폼에서 지식 자동 동기화를 지
- **하이브리드 검색** — 단일 또는 다중 지식베이스에서 벡터 + 키워드 통합 검색
- **지식 관리** — 프로그래밍 방식으로 지식 항목 조회, 편집, 삭제

## 🐋 DeepSeek Harness 플러그인

[**`dsh-weknora`**](./packages/dsh-weknora/README.md)는 공식 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(`dsh`) 플러그인입니다. harness 자체에는 검색·임베딩·지식베이스 기능이 없으므로, 이 플러그인이 코딩 에이전트에 사내 문서를 제공합니다. `dsh plugin --profile web add dsh-weknora`로 설치하고 배포 주소를 지정하면 네 개의 읽기 전용 도구가 에이전트 도구 목록에 나타납니다.

- **`weknora_search`** — 하이브리드 검색. 원문 구절을 그대로 반환하며 각 항목에 재사용 가능한 `knowledge_id` 포함
- **`weknora_read_document`** — 한 문서의 청크를 순서대로 재조합, 페이징 지원
- **`weknora_ask`** — WeKnora가 직접 작성한 인용 포함 답변(RAG 또는 ReAct 파이프라인)
- **`weknora_list_knowledge_bases`** — 지식베이스 이름과 id로 에이전트가 검색 범위를 스스로 좁힘


## 🚀 시작하기

Expand Down
2 changes: 2 additions & 0 deletions packages/dsh-weknora/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
node_modules/
Loading
Loading