refactor: 项目更名 WeKnora → Academy
Build & Publish (dsh-academy) / End-to-end inside dsh (latest, advisory) (push) Skipped
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Frontend / Docker multi-stage image (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-academy) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-academy) / Publish to npm (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Helm / chart (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (latest, advisory) (push) Skipped
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Frontend / Docker multi-stage image (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-academy) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-academy) / Publish to npm (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Helm / chart (push) Canceled after 0s
- 全量替换代码/配置/文档中的项目名(保留上游 GitHub 链接、weixin 文档域名、Docker Hub 镜像名) - 重命名 32 个含项目名的文件/目录;Go module 路径改为 academy(含 client/cli 子模块) - docreader proto 描述符采用等长替换,保持序列化字节布局有效 - Dockerfile.app 构建网络修复: browserskill 离线产物通道、PyPI/apt 国内镜像 - 运行验证: go build ✓ docker compose up ✓ 健康检查 ✓
This commit is contained in:
1 parent
9097ee699d
commit
9058149576
3136 files changed
+18018
-18004
No files matched your search
@@ -7,7 +7,7 @@ tmp_dir = "tmp"
|
||||
bin = "./tmp/main"
|
||||
cmd = "go build -tags \"${GO_BUILD_TAGS}\" -ldflags=\"$(./scripts/get_version.sh ldflags) -X 'google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn'\" -o ./tmp/main ./cmd/server"
|
||||
delay = 1000
|
||||
exclude_dir = ["assets", "tmp", "vendor", "testdata", "frontend", "migrations", "node_modules", "docs", "logs", "data", "WeKnora-Chrome-Extension", "Formula", "dataset", "docreader", "docker", "llm_debug", "web", "mcp-server", "misc", "scripts", "dist", "client", "helm", "website-docs"]
|
||||
exclude_dir = ["assets", "tmp", "vendor", "testdata", "frontend", "migrations", "node_modules", "docs", "logs", "data", "Academy-Chrome-Extension", "Formula", "dataset", "docreader", "docker", "llm_debug", "web", "mcp-server", "misc", "scripts", "dist", "client", "helm", "website-docs"]
|
||||
exclude_file = []
|
||||
exclude_regex = ["_test.go"]
|
||||
exclude_unchanged = false
|
||||
|
||||
+3
-3
@@ -27,7 +27,7 @@
|
||||
# 所以这里可以直接排除整个 frontend/ 目录。
|
||||
**/node_modules/
|
||||
frontend/
|
||||
WeKnora-Chrome-Extension/
|
||||
Academy-Chrome-Extension/
|
||||
|
||||
# 日志 / 临时文件
|
||||
logs/
|
||||
@@ -37,8 +37,8 @@ temp/
|
||||
*.pid
|
||||
|
||||
# 本地构建产物 / 二进制
|
||||
WeKnora
|
||||
WeKnora-lite
|
||||
Academy
|
||||
Academy-lite
|
||||
/server
|
||||
/dist/
|
||||
/build/
|
||||
|
||||
+90
-90
@@ -1,5 +1,5 @@
|
||||
# =====================================================================
|
||||
# WeKnora 环境变量配置示例
|
||||
# Academy 环境变量配置示例
|
||||
# ---------------------------------------------------------------------
|
||||
# 使用说明:
|
||||
# 1. 复制此文件为 .env:cp .env.example .env
|
||||
@@ -30,8 +30,8 @@
|
||||
# #####################################################################
|
||||
|
||||
# ========== A1. 镜像版本与构建 ==========
|
||||
# WeKnora 镜像版本标签:latest(稳定版)/ main(最新开发版)。升级到固定版本时,请填写目标 release 的 git tag(如 v0.7.0,注意 v 前缀),并执行 docker compose pull 拉取对应镜像。
|
||||
WEKNORA_VERSION=latest
|
||||
# Academy 镜像版本标签:latest(稳定版)/ main(最新开发版)。升级到固定版本时,请填写目标 release 的 git tag(如 v0.7.0,注意 v 前缀),并执行 docker compose pull 拉取对应镜像。
|
||||
ACADEMY_VERSION=latest
|
||||
# Debian APT 镜像源主机名(构建 app 镜像用,留空用默认源;国内可设 mirrors.tencent.com 加速)。
|
||||
APK_MIRROR_ARG=mirrors.tencent.com
|
||||
# 构建 app 镜像时是否链接 anydoc 进程内解析引擎(默认 1)。设 0 可跳过 Rust 工具链、缩短构建时间,引擎在设置页显示为不可用。
|
||||
@@ -59,7 +59,7 @@ GIN_MODE=release
|
||||
# LOG_PATH=
|
||||
# 自定义日志格式模板,必须包含 %msg(留空用内置默认格式;不支持 json 关键字)。
|
||||
# 未设置时兼容旧 LOG_FORMAT;显式设置为空可禁用旧变量。
|
||||
# WEKNORA_LOG_FORMAT=
|
||||
# ACADEMY_LOG_FORMAT=
|
||||
# LLM 调试日志:把每次大模型调用的完整请求/响应写入独立文件,排查上下文问题用。
|
||||
# 可选值:true(写 LOG_PATH 同目录 llm_debug.log)/ false/空(关闭)/ 指定文件路径。
|
||||
# LLM_DEBUG_LOG=true
|
||||
@@ -68,7 +68,7 @@ GIN_MODE=release
|
||||
TZ=Asia/Shanghai
|
||||
# 系统默认语言(BCP-47),用于 Prompt 中 {{language}} 占位符回退。
|
||||
# 优先级:Accept-Language 请求头 > 此变量 > 内置默认值 (en-US)。
|
||||
# WEKNORA_LANGUAGE=zh-CN
|
||||
# ACADEMY_LANGUAGE=zh-CN
|
||||
# 前端界面默认语言(BCP-47)。可选:zh-CN | zh-TW | en-US | ru-RU | ko-KR | ja-JP。
|
||||
# 优先级:用户已选语言(localStorage) > 此变量 > 内置默认 zh-CN。
|
||||
# 仅影响首次访问/未手动切换语言的用户;改完重启 frontend 容器即生效,无需重建镜像。
|
||||
@@ -81,7 +81,7 @@ AUTO_MIGRATE=true
|
||||
AUTO_RECOVER_DIRTY=true
|
||||
# 启动时自动把指定 email 的用户提升为系统管理员(幂等;仅 PROMOTE 从不 DEMOTE)。
|
||||
# 适用于 docker-compose/k8s 首次自举;后续提权/撤销走 SystemAdmin 管理页。
|
||||
# WEKNORA_BOOTSTRAP_SYSTEM_ADMIN_EMAIL=
|
||||
# ACADEMY_BOOTSTRAP_SYSTEM_ADMIN_EMAIL=
|
||||
|
||||
# ========== A3. 网络与外部地址 ==========
|
||||
# 应用服务主机名,默认 app(Docker 内部服务名);远程后端可设远程地址。
|
||||
@@ -100,11 +100,11 @@ DOCREADER_ADDR=docreader:50051
|
||||
# Docreader 连接方式:grpc / http / https。
|
||||
DOCREADER_TRANSPORT=grpc
|
||||
# 应用外部访问地址(影响 IM 渠道的图片/文件外链)。
|
||||
# 设为 WeKnora 实例「IM 平台/客户端公网可达」的 URL,如 https://weknora.example.com。
|
||||
# 设为 Academy 实例「IM 平台/客户端公网可达」的 URL,如 https://academy.example.com。
|
||||
# IM 要显示知识库图片,需让 IM 端能通过公网 http URL 拿到图,二选一:
|
||||
# (A) 存储后端本身公网可达(对象存储用公网 endpoint,或 MINIO_ENDPOINT 设为公网 host);
|
||||
# 此时 resource:// 回退到后端预签名 URL,无需本变量。
|
||||
# (B) 设本变量,resource:// 图片改写成 <APP_EXTERNAL_URL>/r/<token> 走 WeKnora(需 nginx 代理 /r/)。
|
||||
# (B) 设本变量,resource:// 图片改写成 <APP_EXTERNAL_URL>/r/<token> 走 Academy(需 nginx 代理 /r/)。
|
||||
# 默认 MinIO 部署(minio:9000 为内网)走 (B) 最简单;local 后端只能走 (B)。
|
||||
# 内网 IP 和 localhost 对飞书/企微/Slack 等 IM 平台不可达;本地开发请用 ngrok/cloudflared/frp。
|
||||
# APP_EXTERNAL_URL=
|
||||
@@ -116,7 +116,7 @@ DOCREADER_TRANSPORT=grpc
|
||||
# 单次请求可用 ?resource_urls=handle|public 覆盖本变量,覆盖范围见 README「API 参考」。
|
||||
# public 依赖上面的 APP_EXTERNAL_URL(或存储后端本身公网可达)才能生成外链;
|
||||
# 无法生成时该引用保持 resource:// 原样,客户端仍可回退到 /files。
|
||||
# 注意:public 会为每个被引用文件签发限时(WeKnora 2 小时 / MinIO 24 小时)的匿名可读链接。
|
||||
# 注意:public 会为每个被引用文件签发限时(Academy 2 小时 / MinIO 24 小时)的匿名可读链接。
|
||||
# 匿名的 embed 渠道与限定知识库的 API Key 不受本变量影响,始终返回 handle。
|
||||
# 建议同时配置 SYSTEM_AES_KEY,以便复用 grant 行、稳定直链 URL 并降低读接口的写入压力。
|
||||
# RESOURCE_URL_MODE=handle
|
||||
@@ -140,9 +140,9 @@ DB_USER=postgres
|
||||
# 数据库密码。
|
||||
DB_PASSWORD=postgres123!@#
|
||||
# 数据库名称。
|
||||
DB_NAME=WeKnora
|
||||
DB_NAME=Academy
|
||||
# SQLite 驱动时使用(DB_DRIVER=sqlite),postgres 驱动忽略。
|
||||
# DB_PATH=./data/weknora.db
|
||||
# DB_PATH=./data/academy.db
|
||||
|
||||
# ========== B2. Redis / 流处理 / Asynq 队列 ==========
|
||||
# --- 流处理后端与 Redis 连接 ---
|
||||
@@ -159,9 +159,9 @@ REDIS_DB=0
|
||||
# Redis key 前缀,用于命名空间隔离。
|
||||
REDIS_PREFIX=stream:
|
||||
# Redis 频道命名空间后缀(多部署共享同一 Redis 时隔离用)。
|
||||
# WEKNORA_REDIS_NAMESPACE=
|
||||
# ACADEMY_REDIS_NAMESPACE=
|
||||
# Asynq 客户端 Redis 读写超时(毫秒,默认 500,写可扩到 1000)。
|
||||
# WEKNORA_REDIS_OP_TIMEOUT_MS=500
|
||||
# ACADEMY_REDIS_OP_TIMEOUT_MS=500
|
||||
|
||||
# --- Redis TLS(托管 Redis 加密传输,如 AWS ElastiCache;默认关闭)---
|
||||
# 是否启用 TLS。
|
||||
@@ -174,19 +174,19 @@ REDIS_PREFIX=stream:
|
||||
# --- Asynq worker 并发 ---
|
||||
# 每个 pool 是独立 asynq.Server,硬隔离;留空或 <1 走代码默认。值为「每实例保底并发」,多副本部署按副本数累加。也可在系统设置(asynq.*_concurrency)运行时调整,无需重启。格式:变量 = 默认值 — 消费的队列 / 说明
|
||||
# default + chat_attachment(文档解析主链路;chat_attachment 权重更高,避免被批量导入挤占)
|
||||
# WEKNORA_ASYNQ_CORE_CONCURRENCY=8
|
||||
# ACADEMY_ASYNQ_CORE_CONCURRENCY=8
|
||||
# postprocess(解析后的知识库后处理/fan-out;独立成池避免排在长耗时 DocReader 后,需低延迟)
|
||||
# WEKNORA_ASYNQ_POSTPROCESS_CONCURRENCY=2
|
||||
# ACADEMY_ASYNQ_POSTPROCESS_CONCURRENCY=2
|
||||
# summary / multimodal / graph / question(摘要、图片多模态、图谱 chunk 抽取、问题生成;LLM/VLM 重,按 provider 预算调)
|
||||
# WEKNORA_ASYNQ_ENRICHMENT_CONCURRENCY=12
|
||||
# ACADEMY_ASYNQ_ENRICHMENT_CONCURRENCY=12
|
||||
# sync + low(数据源同步、FAQ 导入、KB 克隆/删除、批量重解析、知识移动;长耗时,不参与 shared 借用)
|
||||
# WEKNORA_ASYNQ_MAINTENANCE_CONCURRENCY=4
|
||||
# ACADEMY_ASYNQ_MAINTENANCE_CONCURRENCY=4
|
||||
# 弹性池,可借用 CORE/ENRICHMENT 队列(atomic dequeue 安全);不消费 POSTPROCESS/MAINTENANCE
|
||||
# WEKNORA_ASYNQ_SHARED_CONCURRENCY=6
|
||||
# ACADEMY_ASYNQ_SHARED_CONCURRENCY=6
|
||||
# Wiki 生成专用池(LLM 绑定,按 provider 并发预算调整)
|
||||
# WEKNORA_WIKI_ASYNQ_CONCURRENCY=8
|
||||
# ACADEMY_WIKI_ASYNQ_CONCURRENCY=8
|
||||
# 后台任务每模型并发上限(0/负数禁用;交互 chat 不受其限制)
|
||||
# WEKNORA_MODEL_MAX_CONCURRENCY=32
|
||||
# ACADEMY_MODEL_MAX_CONCURRENCY=32
|
||||
|
||||
# ========== B3. 文件存储(通用)==========
|
||||
# 文件存储类型:local / minio / cos / tos / s3 / obs / oss / dummy。
|
||||
@@ -243,7 +243,7 @@ LOCAL_STORAGE_BASE_DIR=/data/files
|
||||
# S3_SECRET_KEY=your_s3_secret_key
|
||||
# S3_ACCESS_KEY=your_s3_access_key
|
||||
# S3_BUCKET_NAME=your_s3_bucket_name
|
||||
# S3_PATH_PREFIX=weknora/
|
||||
# S3_PATH_PREFIX=academy/
|
||||
# S3_USE_SSL=true
|
||||
# S3_FORCE_PATH_STYLE=false
|
||||
# ----- 华为云 OBS(STORAGE_TYPE=obs)-----
|
||||
@@ -252,7 +252,7 @@ LOCAL_STORAGE_BASE_DIR=/data/files
|
||||
# OBS_ACCESS_KEY=your_obs_access_key
|
||||
# OBS_SECRET_KEY=your_obs_secret_key
|
||||
# OBS_BUCKET_NAME=your_obs_bucket_name
|
||||
# OBS_PATH_PREFIX=weknora/
|
||||
# OBS_PATH_PREFIX=academy/
|
||||
# OBS_USE_SSL=true
|
||||
# OBS_PROXY_DOMAIN=https://your-domain.com/obs
|
||||
# ----- 阿里云 OSS(STORAGE_TYPE=oss)-----
|
||||
@@ -261,7 +261,7 @@ LOCAL_STORAGE_BASE_DIR=/data/files
|
||||
# OSS_ACCESS_KEY=your_oss_access_key
|
||||
# OSS_SECRET_KEY=your_oss_secret_key
|
||||
# OSS_BUCKET_NAME=your_oss_bucket_name
|
||||
# OSS_PATH_PREFIX=weknora/
|
||||
# OSS_PATH_PREFIX=academy/
|
||||
# OSS_TEMP_BUCKET_NAME=your_oss_temp_bucket_name
|
||||
# OSS_TEMP_REGION=your_oss_temp_region
|
||||
|
||||
@@ -280,23 +280,23 @@ RETRIEVE_DRIVER=postgres
|
||||
# ELASTICSEARCH_ADDR=http://localhost:9200
|
||||
# ELASTICSEARCH_USERNAME=your_elasticsearch_username
|
||||
# ELASTICSEARCH_PASSWORD=your_elasticsearch_password
|
||||
# ELASTICSEARCH_INDEX=WeKnora
|
||||
# ELASTICSEARCH_INDEX=Academy
|
||||
# ----- OpenSearch(dev compose 自带单节点 profile)-----
|
||||
# OPENSEARCH_ADDR=http://opensearch:9200
|
||||
# OPENSEARCH_USERNAME=
|
||||
# OPENSEARCH_PASSWORD=
|
||||
# OPENSEARCH_INSECURE_SKIP_VERIFY=false
|
||||
# OPENSEARCH_INDEX=WeKnora
|
||||
# OPENSEARCH_INDEX=Academy
|
||||
# ----- Qdrant -----
|
||||
# QDRANT_HOST=qdrant
|
||||
# QDRANT_PORT=6334
|
||||
# QDRANT_REST_PORT=6333
|
||||
# QDRANT_COLLECTION=weknora_embeddings
|
||||
# QDRANT_COLLECTION=academy_embeddings
|
||||
# QDRANT_API_KEY=your_qdrant_api_key
|
||||
# QDRANT_USE_TLS=false
|
||||
# ----- Milvus -----
|
||||
# MILVUS_ADDRESS=milvus:19530
|
||||
# MILVUS_COLLECTION=weknora_embeddings
|
||||
# MILVUS_COLLECTION=academy_embeddings
|
||||
# MILVUS_METRIC_TYPE=IP # IP(默认)/COSINE/L2,改后需重建 collection。
|
||||
# 新版 Collection 会为 content 配置 english/chinese/default 多语言分析器;
|
||||
# 旧 Collection 请先运行 go run ./cmd/milvus-migrate(metric 沿用源 Collection),
|
||||
@@ -315,10 +315,10 @@ RETRIEVE_DRIVER=postgres
|
||||
# ----- Apache Doris 4.1+ -----
|
||||
# DORIS_ADDR=doris-fe:9030 # FE MySQL 协议地址。
|
||||
# DORIS_HTTP_PORT=8030 # FE HTTP,Stream Load partial update 入口。
|
||||
# DORIS_DATABASE=weknora
|
||||
# DORIS_DATABASE=academy
|
||||
# DORIS_USERNAME=root
|
||||
# DORIS_PASSWORD=
|
||||
# DORIS_TABLE_PREFIX=weknora_embeddings
|
||||
# DORIS_TABLE_PREFIX=academy_embeddings
|
||||
# DORIS_COMPAT_MODE=auto # auto(探测)/legacy(cosine_distance)/inner_product_duplicate;建表后不可互换。
|
||||
# compose 端口。
|
||||
# DORIS_FE_HTTP_PORT=8030
|
||||
@@ -328,8 +328,8 @@ RETRIEVE_DRIVER=postgres
|
||||
# TENCENT_VECTORDB_ADDR=http://your-instance.tencentvectordb.com
|
||||
# TENCENT_VECTORDB_USERNAME=root
|
||||
# TENCENT_VECTORDB_API_KEY=your_tencent_vectordb_api_key
|
||||
# TENCENT_VECTORDB_DATABASE=weknora
|
||||
# TENCENT_VECTORDB_COLLECTION=weknora_embeddings
|
||||
# TENCENT_VECTORDB_DATABASE=academy
|
||||
# TENCENT_VECTORDB_COLLECTION=academy_embeddings
|
||||
# TENCENT_VECTORDB_REPLICA_NUMBER=1
|
||||
|
||||
# ========== C2. 知识图谱(Neo4j,可选)==========
|
||||
@@ -337,7 +337,7 @@ RETRIEVE_DRIVER=postgres
|
||||
# 注:ENABLE_GRAPH_RAG 自 v0.1.6 起已被 NEO4J_ENABLE 取代,Go 主应用不再读取,已移除。
|
||||
# NEO4J_ENABLE=false
|
||||
# Neo4j 连接 URI。bolt:// 直连单机(推荐,无路由开销);neo4j:// 走集群路由发现(单机也能用但多一次探测)。
|
||||
# WeKnora 默认部署单机 Neo4j,故用 bolt://。
|
||||
# Academy 默认部署单机 Neo4j,故用 bolt://。
|
||||
# NEO4J_URI=bolt://neo4j:7687
|
||||
# NEO4J_USERNAME=neo4j
|
||||
# NEO4J_PASSWORD=password
|
||||
@@ -362,9 +362,9 @@ OLLAMA_BASE_URL=http://host.docker.internal:11434
|
||||
# KNOWLEDGE_BASE_PROFILE_MAX_TOKENS=
|
||||
# VLM 单次 HTTP 请求超时(秒,默认 180;慢端点超时报 context deadline 时调大)。
|
||||
# VLM_HTTP_TIMEOUT_SECONDS=180
|
||||
# LLM 流原始转储(排查上下文问题;1 启用,默认目录 ~/.weknora/investigate/llm-stream)。
|
||||
# WEKNORA_LLM_STREAM_RAW_DUMP=
|
||||
# WEKNORA_LLM_STREAM_RAW_DUMP_DIR=
|
||||
# LLM 流原始转储(排查上下文问题;1 启用,默认目录 ~/.academy/investigate/llm-stream)。
|
||||
# ACADEMY_LLM_STREAM_RAW_DUMP=
|
||||
# ACADEMY_LLM_STREAM_RAW_DUMP_DIR=
|
||||
|
||||
# ========== D2. 内置模型声明式配置(可选)==========
|
||||
# 启用 config/builtin_models.yaml(见 config/builtin_models.yaml.example)后,YAML 中的
|
||||
@@ -539,30 +539,30 @@ OLLAMA_BASE_URL=http://host.docker.internal:11434
|
||||
|
||||
# ========== E8. 文档处理 / 任务超时 ==========
|
||||
# 单文档处理任务总超时(Go duration,默认 2h;大文件可调大)。
|
||||
# WEKNORA_DOCUMENT_PROCESS_TIMEOUT=2h
|
||||
# ACADEMY_DOCUMENT_PROCESS_TIMEOUT=2h
|
||||
# 单次 DocReader RPC 超时(默认 30m,须小于上一项)。
|
||||
# WEKNORA_DOCREADER_CALL_TIMEOUT=30m
|
||||
# ACADEMY_DOCREADER_CALL_TIMEOUT=30m
|
||||
# 自建 PaddleOCR-VL HTTP 请求超时(正数 Go duration,默认 1000s;无效值回退默认值)。
|
||||
# 大文件示例:本项 90m、DocReader 100m、单文档任务 2h,外层超时需留余量。
|
||||
# WEKNORA_PADDLEOCR_VL_TIMEOUT=1000s
|
||||
# ACADEMY_PADDLEOCR_VL_TIMEOUT=1000s
|
||||
# 自建 MinerU 单次解析超时(正数 Go duration,默认 1000s;无效值回退默认值)。
|
||||
# 超大 PDF 同样需要外层留余量,例如本项 90m、DocReader 100m、单文档任务 2h。
|
||||
# WEKNORA_MINERU_TIMEOUT=1000s
|
||||
# ACADEMY_MINERU_TIMEOUT=1000s
|
||||
# MinerU 云端(mineru.net)轮询解析结果的最长时间(正数 Go duration,默认 600s)。
|
||||
# WEKNORA_MINERU_CLOUD_TIMEOUT=600s
|
||||
# ACADEMY_MINERU_CLOUD_TIMEOUT=600s
|
||||
# PaddleOCR-VL 云端(AI Studio)轮询解析结果的最长时间(正数 Go duration,默认 600s)。
|
||||
# WEKNORA_PADDLEOCR_VL_CLOUD_TIMEOUT=600s
|
||||
# WeKnoraCloud 托管 docreader 轮询任务结果的最长时间(正数 Go duration,默认 20m;应小于 WEKNORA_DOCREADER_CALL_TIMEOUT)。
|
||||
# WEKNORA_WEKNORACLOUD_TIMEOUT=20m
|
||||
# ACADEMY_PADDLEOCR_VL_CLOUD_TIMEOUT=600s
|
||||
# AcademyCloud 托管 docreader 轮询任务结果的最长时间(正数 Go duration,默认 20m;应小于 ACADEMY_DOCREADER_CALL_TIMEOUT)。
|
||||
# ACADEMY_ACADEMYCLOUD_TIMEOUT=20m
|
||||
# 知识库巡检回收(回收卡在 processing 的脏数据;false 禁用,不建议)。
|
||||
# WEKNORA_HOUSEKEEPING_ENABLED=true
|
||||
# ACADEMY_HOUSEKEEPING_ENABLED=true
|
||||
# 聊天附件解析产物保留时长(小时,默认 24)。
|
||||
# WEKNORA_CHAT_ATTACHMENT_TTL_HOURS=24
|
||||
# ACADEMY_CHAT_ATTACHMENT_TTL_HOURS=24
|
||||
# 单轮问答等待附件解析完成的最长时间(秒,默认 60;大/扫描件调大)。
|
||||
# WEKNORA_CHAT_ATTACHMENT_WAIT_TIMEOUT_SEC=60
|
||||
# ACADEMY_CHAT_ATTACHMENT_WAIT_TIMEOUT_SEC=60
|
||||
# 附件 VLM OCR 调优(扫描件/图片型文档):并发数 / 最大页数。
|
||||
# WEKNORA_CHAT_ATTACHMENT_OCR_CONCURRENCY=8
|
||||
# WEKNORA_CHAT_ATTACHMENT_OCR_MAX_PAGES=8
|
||||
# ACADEMY_CHAT_ATTACHMENT_OCR_CONCURRENCY=8
|
||||
# ACADEMY_CHAT_ATTACHMENT_OCR_MAX_PAGES=8
|
||||
|
||||
# ========== E9. 飞书云文档解析模式(已废弃,仅一个版本的兼容) ==========
|
||||
# 解析模式已改为在知识库 → 数据源编辑页按数据源配置(settings.parse_mode,默认
|
||||
@@ -593,7 +593,7 @@ OLLAMA_BASE_URL=http://host.docker.internal:11434
|
||||
JWT_SECRET=
|
||||
# AES-256 主密钥,用于数据库中 API Key 等敏感字段落盘加密(必须为 32 字节)。
|
||||
# 加密范围:tenants.api_key、模型 API key、向量库凭证、web search provider key、
|
||||
# WeKnoraCloud.AppSecret 等。缺失或长度不对时已加密字段无法解密(UI 显示为空,需重填)。
|
||||
# AcademyCloud.AppSecret 等。缺失或长度不对时已加密字段无法解密(UI 显示为空,需重填)。
|
||||
# 生产必须显式设置且妥善保管,丢失则所有加密数据不可恢复。
|
||||
# 注:TENANT_AES_KEY / CRYPTO_MASTER_KEY / CRYPTO_SALT 已废弃。v0.4.0 起 CryptoService(PBKDF2)被移除,加密统一改用 SYSTEM_AES_KEY。这三个变量 Go 主应用不再读取,已移除。
|
||||
# Generate once: openssl rand -hex 16 (32 ASCII bytes); retain existing keys on upgrade.
|
||||
@@ -606,27 +606,27 @@ SYSTEM_SIGNING_KEY=
|
||||
# 禁止新用户注册(生产建议 true)。
|
||||
# DISABLE_REGISTRATION=false
|
||||
# 开启后密码必须包含大小写字母、数字和特殊字符,特殊字符包含:!@#$%^&*()_+-=[]{}|;:,.<>?
|
||||
# WEKNORA_AUTH_COMPLEX_PASSWORD_ENABLED=false
|
||||
# ACADEMY_AUTH_COMPLEX_PASSWORD_ENABLED=false
|
||||
# 公开注册后的默认空间策略:create_personal(默认,自动创建个人空间)/ tenantless。
|
||||
# WEKNORA_AUTH_DEFAULT_TENANT_MODE=create_personal
|
||||
# ACADEMY_AUTH_DEFAULT_TENANT_MODE=create_personal
|
||||
# 是否允许普通用户登录后主动创建空间(默认 true;false 仅能邀请加入,超管不受影响)。
|
||||
# WEKNORA_TENANT_SELF_SERVICE_CREATION_ENABLED=true
|
||||
# ACADEMY_TENANT_SELF_SERVICE_CREATION_ENABLED=true
|
||||
# 启用空间级 RBAC(true 默认强制鉴权 / false 观察模式:空间内角色检查仅记录不拦截;跨空间访问始终拦截)。
|
||||
# WEKNORA_TENANT_ENABLE_RBAC=true
|
||||
# ACADEMY_TENANT_ENABLE_RBAC=true
|
||||
# 启用跨空间访问(需配合用户的 CanAccessAllTenants 权限;默认 false)。如需跨空间管理员,需要手动修改数据库,为对应用户授予跨空间管理权限
|
||||
# WEKNORA_TENANT_ENABLE_CROSS_TENANT_ACCESS=false
|
||||
# ACADEMY_TENANT_ENABLE_CROSS_TENANT_ACCESS=false
|
||||
# 单个非超管用户可自助创建空间数上限(>0 强制限额;=0 走默认;<0 关闭限额)。
|
||||
# WEKNORA_TENANT_MAX_OWNED_PER_USER=
|
||||
# ACADEMY_TENANT_MAX_OWNED_PER_USER=
|
||||
# 创建空间时是否自动生成 full_access API Key 并在响应中返回 token(默认 false,兼容旧版回退开关)。
|
||||
# WEKNORA_TENANT_AUTO_CREATE_API_KEY=false
|
||||
# ACADEMY_TENANT_AUTO_CREATE_API_KEY=false
|
||||
# 新建空间默认存储配额(GB,默认 10)。
|
||||
# WEKNORA_TENANT_DEFAULT_STORAGE_QUOTA_GB=10
|
||||
# ACADEMY_TENANT_DEFAULT_STORAGE_QUOTA_GB=10
|
||||
# 空间邀请链接 TTL(Go duration,默认 168h=7 天)。
|
||||
# WEKNORA_INVITATION_TTL=168h
|
||||
# ACADEMY_INVITATION_TTL=168h
|
||||
# 全局开关:邀请已注册用户时直接加入空间。默认 false,可在系统设置页修改。
|
||||
# WEKNORA_TENANT_AUTO_ACCEPT_INVITATION=false
|
||||
# ACADEMY_TENANT_AUTO_ACCEPT_INVITATION=false
|
||||
# 审计日志保留天数(0 禁用清理,默认 90)。
|
||||
# WEKNORA_AUDIT_RETENTION_DAYS=90
|
||||
# ACADEMY_AUDIT_RETENTION_DAYS=90
|
||||
|
||||
# ========== F3. OIDC 认证(可选,OIDC_AUTH_ENABLE=true 启用)==========
|
||||
# OIDC_AUTH_ENABLE=false
|
||||
@@ -642,11 +642,11 @@ SYSTEM_SIGNING_KEY=
|
||||
# OIDC_AUTH_USER_INFO_ENDPOINT=http://127.0.0.1:5556/dex/userinfo
|
||||
# OIDC_AUTH_JWKS_URI=http://127.0.0.1:5556/dex/keys
|
||||
# OIDC_AUTH_SCOPES="openid profile email"
|
||||
# OIDC 首次自动开户后的空间策略与本地注册共用 WEKNORA_AUTH_DEFAULT_TENANT_MODE。
|
||||
# OIDC 首次自动开户后的空间策略与本地注册共用 ACADEMY_AUTH_DEFAULT_TENANT_MODE。
|
||||
# 另有独立开关:开启后 OIDC 开户用户自动加入本部署最早 OIDC 用户的主空间
|
||||
# (contributor),同源用户视为同一组织;被移除成员与待接受邀请不受影响。
|
||||
# 也可在管理界面「系统管理 → 全局设置 → 访问控制」中修改。
|
||||
# WEKNORA_AUTH_OIDC_AUTO_JOIN_SHARED_SPACE=false
|
||||
# ACADEMY_AUTH_OIDC_AUTO_JOIN_SHARED_SPACE=false
|
||||
# OIDC_USER_INFO_MAPPING_USER_NAME=name
|
||||
# OIDC_USER_INFO_MAPPING_EMAIL=email
|
||||
# 工号式 IdP(如 Casdoor 用户 name=工号必填、email 选填)的兜底域:provider 未返回
|
||||
@@ -670,26 +670,26 @@ SYSTEM_SIGNING_KEY=
|
||||
# 按空间维护。唯一的部署级开关是 Docker 后端:默认关闭,因为本机
|
||||
# docker.sock 等同宿主机 root;私有化单机需要时改为 true,或由系统管理员在
|
||||
# 「设置 → 系统设置 → 网络安全」打开(立即生效,无需重启)。
|
||||
WEKNORA_SANDBOX_DOCKER_ENABLED=false
|
||||
ACADEMY_SANDBOX_DOCKER_ENABLED=false
|
||||
# 多实例仍应配置通用 REDIS_ADDR,以共享 session→sandbox binding。
|
||||
# 用户模式沙箱分配(同一合格用户的会话共用一台沙箱,目录按会话隔离)。
|
||||
# 设为 enabled 打开;还要求 REDIS_ADDR 已配置,多副本靠它协调同一台机器。
|
||||
# 升级顺序:所有实例都跑上新版本后,再在所有实例上设置,避免旧实例仍按
|
||||
# 每会话一台分配。未设置或 Redis 缺失时,沙箱配置里的「分配模式」不可
|
||||
# 保存为用户模式,已保存的用户模式配置在分配时回退为每会话一台。
|
||||
# WEKNORA_SANDBOX_USER_ALLOCATION=
|
||||
# ACADEMY_SANDBOX_USER_ALLOCATION=
|
||||
|
||||
# 智能体大模型调用默认超时(秒,默认 120;复杂推理调大如 300/600)。
|
||||
# 注:全局默认;单个智能体在数据库配独立 llm_call_timeout 时以其为准。
|
||||
# WEKNORA_AGENT_LLM_TIMEOUT=300
|
||||
# ACADEMY_AGENT_LLM_TIMEOUT=300
|
||||
# web_fetch 单页抓取预算(默认 3m)。HTTP 与 chromedp 共用这一预算,不叠加。
|
||||
# 支持 Go duration(150s、3m)或纯数字秒(180)。空值、无效值或非正数使用默认值。
|
||||
# 工具包装层再多等 5 秒,以便返回工具自己的超时结果。快速回答管道仍为 15s,不使用此项。
|
||||
# WEKNORA_WEB_FETCH_TIMEOUT=3m
|
||||
# ACADEMY_WEB_FETCH_TIMEOUT=3m
|
||||
# MCP 工具人工审核等待超时(秒,默认 600;支持 Go duration 如 30s/5m/1h)。
|
||||
# WEKNORA_AGENT_TOOL_APPROVAL_TIMEOUT=600
|
||||
# ACADEMY_AGENT_TOOL_APPROVAL_TIMEOUT=600
|
||||
# MCP 工具人工审批失败时是否放行(true 放行 / 默认 fail-close 拒绝)。
|
||||
# WEKNORA_AGENT_TOOL_APPROVAL_FAIL_OPEN=
|
||||
# ACADEMY_AGENT_TOOL_APPROVAL_FAIL_OPEN=
|
||||
|
||||
|
||||
# #####################################################################
|
||||
@@ -726,14 +726,14 @@ WEKNORA_SANDBOX_DOCKER_ENABLED=false
|
||||
# TAVILY_API_KEY=tvly-your_tavily_api_key
|
||||
|
||||
# ========== H2. MCP Server(可选,--profile full 时启动)==========
|
||||
# MCP Server 访问 WeKnora REST API 用的 API Key(在前端「设置 -> API Keys」生成)。
|
||||
# WEKNORA_API_KEY=
|
||||
# MCP Server 访问 Academy REST API 用的 API Key(在前端「设置 -> API Keys」生成)。
|
||||
# ACADEMY_API_KEY=
|
||||
# HTTP/SSE 传输必填:mcp-server 启动时若缺少此项会拒绝启动(客户端以 Authorization: Bearer 携带)。
|
||||
# MCP_SERVER_AUTH_TOKEN=
|
||||
# 调用 WeKnora REST 的读超时(秒,默认 300)。
|
||||
# WEKNORA_CHAT_TIMEOUT=300
|
||||
# 是否校验 WeKnora 后端 TLS 证书(默认 true;自签证书可设 false)。
|
||||
# WEKNORA_VERIFY_SSL=true
|
||||
# 调用 Academy REST 的读超时(秒,默认 300)。
|
||||
# ACADEMY_CHAT_TIMEOUT=300
|
||||
# 是否校验 Academy 后端 TLS 证书(默认 true;自签证书可设 false)。
|
||||
# ACADEMY_VERIFY_SSL=true
|
||||
# 允许上传的目录白名单(逗号分隔;留空禁用文件上传工具)。
|
||||
# MCP_ALLOWED_UPLOAD_DIRS=
|
||||
|
||||
@@ -776,22 +776,22 @@ LANGFUSE_HOST=http://langfuse-web:3000
|
||||
# LANGFUSE_DEBUG=false
|
||||
|
||||
# ========== I2. Langfuse 自建栈配置(仅在使用 --profile langfuse 时需要)==========
|
||||
# 设计说明:为最小化资源占用,Langfuse 自建栈会**复用** WeKnora 已有的
|
||||
# 设计说明:为最小化资源占用,Langfuse 自建栈会**复用** Academy 已有的
|
||||
# - postgres:创建独立的 "langfuse" 数据库(由 langfuse-db-init 容器一次性创建)
|
||||
# - redis :使用独立的 Redis DB 号(默认 1,WeKnora 用 0)
|
||||
# - redis :使用独立的 Redis DB 号(默认 1,Academy 用 0)
|
||||
# 真正新增的只有 3 个常驻容器:langfuse-web、langfuse-worker、langfuse-clickhouse
|
||||
# + 1 个专用 S3:langfuse-minio
|
||||
# + 1 个一次性 init:langfuse-db-init
|
||||
# Langfuse Web UI 对外端口。
|
||||
# LANGFUSE_WEB_PORT=3000
|
||||
# Langfuse 专用 MinIO 端口(避免和 WeKnora 主 MinIO 9000/9001 冲突)。
|
||||
# Langfuse 专用 MinIO 端口(避免和 Academy 主 MinIO 9000/9001 冲突)。
|
||||
# LANGFUSE_MINIO_S3_PORT=9100
|
||||
# LANGFUSE_MINIO_CONSOLE_PORT=9101
|
||||
# 媒体上传外部 endpoint(浏览器直连 Langfuse MinIO),默认指向宿主机映射的 9100 端口。
|
||||
# LANGFUSE_S3_MEDIA_UPLOAD_ENDPOINT=http://localhost:9100
|
||||
# 在 WeKnora-postgres 中创建的 Langfuse 库名。
|
||||
# 在 Academy-postgres 中创建的 Langfuse 库名。
|
||||
# LANGFUSE_DB_NAME=langfuse
|
||||
# 在 WeKnora-redis 中使用的 DB 号(1~15,不要和 WeKnora 的 0 冲突)。
|
||||
# 在 Academy-redis 中使用的 DB 号(1~15,不要和 Academy 的 0 冲突)。
|
||||
# LANGFUSE_REDIS_DB=1
|
||||
# ClickHouse / Langfuse 专用 MinIO 凭证(生产请务必修改)。
|
||||
# LANGFUSE_CLICKHOUSE_USER=clickhouse
|
||||
@@ -808,12 +808,12 @@ LANGFUSE_HOST=http://langfuse-web:3000
|
||||
# LANGFUSE_NEXTAUTH_URL=http://localhost:3000
|
||||
# LANGFUSE_TELEMETRY_ENABLED=false
|
||||
# 可选:自动化首次启动(填写后直接注入管理员+项目,跳过 UI 注册)。
|
||||
# LANGFUSE_INIT_ORG_ID=WeKnora
|
||||
# LANGFUSE_INIT_ORG_NAME=WeKnora
|
||||
# LANGFUSE_INIT_PROJECT_ID=WeKnora
|
||||
# LANGFUSE_INIT_PROJECT_NAME=WeKnora
|
||||
# LANGFUSE_INIT_PROJECT_PUBLIC_KEY=pk-lf-weknora-init
|
||||
# LANGFUSE_INIT_PROJECT_SECRET_KEY=sk-lf-weknora-init
|
||||
# LANGFUSE_INIT_ORG_ID=Academy
|
||||
# LANGFUSE_INIT_ORG_NAME=Academy
|
||||
# LANGFUSE_INIT_PROJECT_ID=Academy
|
||||
# LANGFUSE_INIT_PROJECT_NAME=Academy
|
||||
# LANGFUSE_INIT_PROJECT_PUBLIC_KEY=pk-lf-academy-init
|
||||
# LANGFUSE_INIT_PROJECT_SECRET_KEY=sk-lf-academy-init
|
||||
# LANGFUSE_INIT_USER_EMAIL=admin@example.com
|
||||
# LANGFUSE_INIT_USER_NAME=Admin
|
||||
# LANGFUSE_INIT_USER_PASSWORD=change-me-please
|
||||
@@ -836,7 +836,7 @@ LANGFUSE_HOST=http://langfuse-web:3000
|
||||
#
|
||||
# 出站拨号超时(Go duration,默认 5s):模型、连接器等外部端点在此时间内连不上即失败。
|
||||
# 冷启动较慢的 serverless 端点可调大,例如 15s。
|
||||
# WEKNORA_OUTBOUND_DIAL_TIMEOUT=5s
|
||||
# ACADEMY_OUTBOUND_DIAL_TIMEOUT=5s
|
||||
#
|
||||
# ===== 向量库地址的 SSRF 校验 =====
|
||||
# 通过 API 创建/测试向量库连接时,地址会经过 SSRF 校验。docker-compose 内置服务
|
||||
@@ -859,7 +859,7 @@ LANGFUSE_HOST=http://langfuse-web:3000
|
||||
# ========== J2. 代理与并发 ==========
|
||||
# gin 信任的代理 CIDR(逗号分隔)。默认信任 loopback + 私网段(容器网络内 nginx 已覆盖)。
|
||||
# 显式设为空字符串则禁用代理信任(ClientIP 返回直连对端)。生产部署在多层代理后需按实际填写。
|
||||
# WEKNORA_TRUSTED_PROXIES=
|
||||
# ACADEMY_TRUSTED_PROXIES=
|
||||
# ants 协程池大小(Embedding 并发,出现 429 时调小)。
|
||||
CONCURRENCY_POOL_SIZE=5
|
||||
|
||||
@@ -868,13 +868,13 @@ CONCURRENCY_POOL_SIZE=5
|
||||
# Docker app 镜像已内置 bsk 和配套扩展,默认从用户当前页面自动生成连接地址,无需配置 PUBLIC_URL。
|
||||
# 原生部署还需构建产物并配置下面两个文件路径;显式设置 BROWSERSKILL_BINARY= 可关闭此功能。
|
||||
# 后端所在系统/架构的官方 bsk 可执行文件绝对路径(Docker 已预设,不必重复配置)。
|
||||
# BROWSERSKILL_BINARY=/opt/weknora/browserskill/bsk
|
||||
# BROWSERSKILL_BINARY=/opt/academy/browserskill/bsk
|
||||
# 可选覆盖:仅在网关使用独立域名/路径等特殊部署时设置;远程部署必须使用 WSS(包括内网)。
|
||||
# BROWSERSKILL_PUBLIC_URL=wss://weknora.example.com/api/v1/local-browser/extension
|
||||
# BROWSERSKILL_PUBLIC_URL=wss://academy.example.com/api/v1/local-browser/extension
|
||||
# 单应用实例共用一个 daemon;最多保留的用户配对记录数(默认 32,非实测承载量)。
|
||||
# BROWSERSKILL_MAX_CONNECTIONS=32
|
||||
# 供个人设置下载的配套扩展 ZIP(服务器本地绝对路径,Docker 已预设)。
|
||||
# BROWSERSKILL_EXTENSION_PATH=/opt/weknora/browserskill/browser-skill-weknora-0.3.1.zip
|
||||
# BROWSERSKILL_EXTENSION_PATH=/opt/academy/browserskill/browser-skill-academy-0.3.1.zip
|
||||
# 多副本:每个节点填写可被其他节点直接访问的地址,不要使用负载均衡地址。
|
||||
# BROWSERSKILL_INTERNAL_URL=http://10.0.0.12:8080
|
||||
# 所有副本使用相同的随机密钥(至少 32 字符),从 Secret 注入,不提交到仓库。
|
||||
|
||||
+10
-10
@@ -1,4 +1,4 @@
|
||||
# WeKnora Lite 配置模板
|
||||
# Academy Lite 配置模板
|
||||
# 复制此文件为 .env.lite 并按需修改
|
||||
# cp .env.lite.example .env.lite
|
||||
|
||||
@@ -8,14 +8,14 @@ GIN_MODE=debug
|
||||
LOG_LEVEL=debug
|
||||
|
||||
# 可选:日志文件绝对路径;未配置时,macOS .app 默认写入
|
||||
# ~/Library/Logs/WeKnora Lite/WeKnora Lite.log
|
||||
# LOG_PATH=/absolute/path/to/weknora-lite.log
|
||||
# ~/Library/Logs/Academy Lite/Academy Lite.log
|
||||
# LOG_PATH=/absolute/path/to/academy-lite.log
|
||||
|
||||
# === 数据库 ===
|
||||
# macOS .app 中相对路径会自动重定向到
|
||||
# ~/Library/Application Support/WeKnora Lite/data/
|
||||
# ~/Library/Application Support/Academy Lite/data/
|
||||
DB_DRIVER=sqlite
|
||||
DB_PATH=./data/weknora.db
|
||||
DB_PATH=./data/academy.db
|
||||
|
||||
# === 检索引擎(FTS5 + sqlite-vec)===
|
||||
RETRIEVE_DRIVER=sqlite
|
||||
@@ -44,7 +44,7 @@ JWT_SECRET=
|
||||
|
||||
# === 功能开关 ===
|
||||
NEO4J_ENABLE=false
|
||||
WEKNORA_SANDBOX_MODE=disabled
|
||||
ACADEMY_SANDBOX_MODE=disabled
|
||||
ENABLE_GRAPH_RAG=false
|
||||
DISABLE_REGISTRATION=false
|
||||
# 保留原始 URL 的图片域名白名单(可选)
|
||||
@@ -61,18 +61,18 @@ DISABLE_REGISTRATION=false
|
||||
CONCURRENCY_POOL_SIZE=3
|
||||
|
||||
# 聊天附件解析产物保留时长(小时),默认 24 小时
|
||||
# WEKNORA_CHAT_ATTACHMENT_TTL_HOURS=24
|
||||
# ACADEMY_CHAT_ATTACHMENT_TTL_HOURS=24
|
||||
|
||||
# 单轮问答等待附件解析完成的最长时间(秒),超时后未完成的附件会被跳过。
|
||||
# 大文件 / 扫描件解析较慢时可调大,默认 60 秒。智能体里的「附件解析等待超时」> 0 时优先于此全局值。
|
||||
# WEKNORA_CHAT_ATTACHMENT_WAIT_TIMEOUT_SEC=60
|
||||
# ACADEMY_CHAT_ATTACHMENT_WAIT_TIMEOUT_SEC=60
|
||||
|
||||
# 附件 VLM OCR 调优(扫描件 / 图片型文档)。解析慢的瓶颈是逐页 VLM OCR,而非文档解析器。
|
||||
# OCR_CONCURRENCY 为并行 OCR 的页数(默认 8,与页数上限一致,让扫描件一波跑完;调大会加重 VLM 负载,
|
||||
# 所有智能体共享 VLM 后端,故保持全局);OCR_MAX_PAGES 为扫描件送入 VLM 的最大页数(默认 8),
|
||||
# 智能体里的「扫描件 OCR 最大页数」> 0 时优先于此全局值。
|
||||
# WEKNORA_CHAT_ATTACHMENT_OCR_CONCURRENCY=8
|
||||
# WEKNORA_CHAT_ATTACHMENT_OCR_MAX_PAGES=8
|
||||
# ACADEMY_CHAT_ATTACHMENT_OCR_CONCURRENCY=8
|
||||
# ACADEMY_CHAT_ATTACHMENT_OCR_MAX_PAGES=8
|
||||
|
||||
# Docreader 地址
|
||||
DOCREADER_ADDR=127.0.0.1:50051
|
||||
|
||||
@@ -66,7 +66,7 @@ body:
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: WeKnora Version
|
||||
label: Academy Version
|
||||
description: |
|
||||
Please provide the concrete version number you are running, **not** `latest`, `main` or `master`.
|
||||
You can find it on the **Settings → System Info** page (both "App Version" and "UI Version" — if they differ, please report both).
|
||||
@@ -79,7 +79,7 @@ body:
|
||||
id: deployment
|
||||
attributes:
|
||||
label: Deployment Method
|
||||
description: How are you running WeKnora?
|
||||
description: How are you running Academy?
|
||||
options:
|
||||
- Docker Compose
|
||||
- Build from source
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: WeKnora Documentation
|
||||
- name: Academy Documentation
|
||||
url: https://weknora.weixin.qq.com/docs/01-getting-started/05-troubleshooting
|
||||
about: Check WeKnora FAQ
|
||||
about: Check Academy FAQ
|
||||
- name: Discussions
|
||||
url: https://github.com/Tencent/WeKnora/discussions
|
||||
about: Ask questions or share ideas in Discussions
|
||||
@@ -58,7 +58,7 @@ body:
|
||||
- Just me / a personal preference
|
||||
- My team or a small group
|
||||
- Many users would benefit
|
||||
- Blocking adoption of WeKnora
|
||||
- Blocking adoption of Academy
|
||||
validations:
|
||||
required: true
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: ❓ Question
|
||||
description: Ask a question about WeKnora or seek help
|
||||
description: Ask a question about Academy or seek help
|
||||
title: "[Question]: "
|
||||
labels: ["question", "needs-triage"]
|
||||
body:
|
||||
@@ -57,8 +57,8 @@ body:
|
||||
label: Other Environment Info
|
||||
description: Please provide other relevant environment information
|
||||
placeholder: |
|
||||
- WeKnora App Version: [concrete version from Settings → System Info, e.g., v0.6.0 — NOT "latest"]
|
||||
- WeKnora UI Version: [concrete version from Settings → System Info, e.g., v0.6.0]
|
||||
- Academy App Version: [concrete version from Settings → System Info, e.g., v0.6.0 — NOT "latest"]
|
||||
- Academy UI Version: [concrete version from Settings → System Info, e.g., v0.6.0]
|
||||
- Deployment: [e.g., Docker, build from source]
|
||||
- Other relevant info...
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Dependabot configuration for the WeKnora repository.
|
||||
# Dependabot configuration for the Academy repository.
|
||||
#
|
||||
# Policy:
|
||||
# * `/cli` is the only ecosystem that receives routine version updates
|
||||
|
||||
@@ -65,7 +65,7 @@ jobs:
|
||||
run: ./scripts/build-anydoc-lib.sh
|
||||
|
||||
# The vendored bindings pull anydoc and its PDF stack from crates.io, and
|
||||
# WeKnora parses untrusted uploads in-process. A Rust advisory there (as
|
||||
# Academy parses untrusted uploads in-process. A Rust advisory there (as
|
||||
# in RUSTSEC-2026-0187, an uncatchable abort on a hostile PDF) has to
|
||||
# break the build, not wait for someone to notice. Vulnerabilities fail
|
||||
# the job; unmaintained-crate warnings only report, since a transitive
|
||||
|
||||
@@ -78,7 +78,7 @@ env:
|
||||
GO_VERSION: "1.26"
|
||||
GOPROXY: https://proxy.golang.org,direct
|
||||
# Keep tests independent of a developer machine's custom log template.
|
||||
WEKNORA_LOG_FORMAT: ""
|
||||
ACADEMY_LOG_FORMAT: ""
|
||||
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
name: CLI E2E
|
||||
|
||||
# Runs the cli/acceptance/e2e/ suite against a real WeKnora server.
|
||||
# Runs the cli/acceptance/e2e/ suite against a real Academy server.
|
||||
# Cost-gated so it doesn't fire on every PR:
|
||||
# - workflow_dispatch: maintainer can trigger manually
|
||||
# - pull_request labeled "acceptance-e2e": adding the label kicks a run
|
||||
#
|
||||
# Required repo secrets (only set on Tencent/WeKnora; cross-fork PRs have no
|
||||
# access and the job exits early via the secrets-present guard):
|
||||
# WEKNORA_E2E_HOST - https URL of the test server
|
||||
# WEKNORA_E2E_TOKEN - bearer token / API key for that host
|
||||
# ACADEMY_E2E_HOST - https URL of the test server
|
||||
# ACADEMY_E2E_TOKEN - bearer token / API key for that host
|
||||
#
|
||||
# Mirrors gh acceptance/ trigger pattern: env-gated, opt-in, single matrix.
|
||||
|
||||
@@ -48,11 +48,11 @@ jobs:
|
||||
- name: secrets present
|
||||
id: secrets
|
||||
env:
|
||||
E2E_HOST: ${{ secrets.WEKNORA_E2E_HOST }}
|
||||
E2E_TOKEN: ${{ secrets.WEKNORA_E2E_TOKEN }}
|
||||
E2E_HOST: ${{ secrets.ACADEMY_E2E_HOST }}
|
||||
E2E_TOKEN: ${{ secrets.ACADEMY_E2E_TOKEN }}
|
||||
run: |
|
||||
if [ -z "$E2E_HOST" ] || [ -z "$E2E_TOKEN" ]; then
|
||||
echo "::warning::WEKNORA_E2E_HOST or WEKNORA_E2E_TOKEN not set; skipping e2e."
|
||||
echo "::warning::ACADEMY_E2E_HOST or ACADEMY_E2E_TOKEN not set; skipping e2e."
|
||||
echo "skip=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "skip=false" >> "$GITHUB_OUTPUT"
|
||||
@@ -61,6 +61,6 @@ jobs:
|
||||
- name: go test -tags=acceptance_e2e
|
||||
if: steps.secrets.outputs.skip == 'false'
|
||||
env:
|
||||
WEKNORA_E2E_HOST: ${{ secrets.WEKNORA_E2E_HOST }}
|
||||
WEKNORA_E2E_TOKEN: ${{ secrets.WEKNORA_E2E_TOKEN }}
|
||||
ACADEMY_E2E_HOST: ${{ secrets.ACADEMY_E2E_HOST }}
|
||||
ACADEMY_E2E_TOKEN: ${{ secrets.ACADEMY_E2E_TOKEN }}
|
||||
run: go test -tags=acceptance_e2e -v -timeout=8m ./acceptance/e2e/...
|
||||
@@ -39,7 +39,7 @@ jobs:
|
||||
id: meta
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/weknora-ui
|
||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/academy-ui
|
||||
|
||||
- name: Build ui Image
|
||||
uses: docker/build-push-action@v7
|
||||
@@ -90,7 +90,7 @@ jobs:
|
||||
id: meta
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/weknora-docreader
|
||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/academy-docreader
|
||||
|
||||
- name: Build docreader Image
|
||||
uses: docker/build-push-action@v7
|
||||
@@ -123,7 +123,7 @@ jobs:
|
||||
id: meta
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/weknora-sandbox
|
||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/academy-sandbox
|
||||
|
||||
- name: Build sandbox Image
|
||||
uses: docker/build-push-action@v7
|
||||
@@ -144,7 +144,7 @@ jobs:
|
||||
id: meta-cube
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/weknora-sandbox
|
||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/academy-sandbox
|
||||
flavor: |
|
||||
suffix=-cube,onlatest=true
|
||||
|
||||
@@ -165,7 +165,7 @@ jobs:
|
||||
id: meta-desktop
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/weknora-sandbox
|
||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/academy-sandbox
|
||||
flavor: |
|
||||
suffix=-desktop,onlatest=true
|
||||
|
||||
@@ -186,7 +186,7 @@ jobs:
|
||||
id: meta-desktop-cube
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/weknora-sandbox
|
||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/academy-sandbox
|
||||
flavor: |
|
||||
suffix=-desktop-cube,onlatest=true
|
||||
|
||||
@@ -232,7 +232,7 @@ jobs:
|
||||
id: meta
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/weknora-app
|
||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/academy-app
|
||||
|
||||
- name: Prepare version info
|
||||
id: version
|
||||
@@ -264,7 +264,7 @@ jobs:
|
||||
${{ format('GO_VERSION_ARG={0}', steps.version.outputs.go_version) }}
|
||||
WITH_ANYDOC=1
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/weknora-app
|
||||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/academy-app
|
||||
cache-from: type=gha,scope=build-app-${{ env.PLATFORM_PAIR }}
|
||||
cache-to: type=gha,scope=build-app-${{ env.PLATFORM_PAIR }},mode=max
|
||||
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
|
||||
@@ -308,14 +308,14 @@ jobs:
|
||||
id: meta
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/weknora-app
|
||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/academy-app
|
||||
|
||||
- name: Create manifest list and push
|
||||
working-directory: ${{ runner.temp }}/digests
|
||||
run: |
|
||||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
||||
$(printf '${{ secrets.DOCKERHUB_USERNAME }}/weknora-app@sha256:%s ' *)
|
||||
$(printf '${{ secrets.DOCKERHUB_USERNAME }}/academy-app@sha256:%s ' *)
|
||||
|
||||
- name: Inspect image
|
||||
run: |
|
||||
docker buildx imagetools inspect ${{ secrets.DOCKERHUB_USERNAME }}/weknora-app:${{ steps.meta.outputs.version }}
|
||||
docker buildx imagetools inspect ${{ secrets.DOCKERHUB_USERNAME }}/academy-app:${{ steps.meta.outputs.version }}
|
||||
@@ -1,13 +1,13 @@
|
||||
name: Build & Publish (dsh-weknora)
|
||||
name: Build & Publish (dsh-academy)
|
||||
|
||||
# Build, test, and publish the DeepSeek Harness plugin (packages/dsh-weknora/) to npm.
|
||||
# Build, test, and publish the DeepSeek Harness plugin (packages/dsh-academy/) to npm.
|
||||
#
|
||||
# Three jobs:
|
||||
# test typecheck, unit tests, both halves of the contract, 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
|
||||
# publish on a `dsh-academy-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
|
||||
@@ -18,13 +18,13 @@ on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags:
|
||||
- "dsh-weknora-v*"
|
||||
- "dsh-academy-v*"
|
||||
paths:
|
||||
- "packages/dsh-weknora/**"
|
||||
- "packages/dsh-academy/**"
|
||||
- ".github/workflows/dsh-plugin.yml"
|
||||
pull_request:
|
||||
paths:
|
||||
- "packages/dsh-weknora/**"
|
||||
- "packages/dsh-academy/**"
|
||||
- ".github/workflows/dsh-plugin.yml"
|
||||
schedule:
|
||||
# Monday 03:00 UTC: catch a harness release that breaks the plugin.
|
||||
@@ -40,11 +40,11 @@ permissions:
|
||||
|
||||
env:
|
||||
# The harness release this plugin is verified against. Bump it together with
|
||||
# the compatibility note in packages/dsh-weknora/README.md.
|
||||
# the compatibility note in packages/dsh-academy/README.md.
|
||||
DSH_PINNED_SPEC: "@deepseek-ai/dsh@0.1.0-rc.8"
|
||||
# The contract's Go half lives in this repository's module. app.yml runs it
|
||||
# only for a Go diff, so a change to the fixture or to the plugin alone would
|
||||
# otherwise skip the side that checks WeKnora still serves those calls.
|
||||
# otherwise skip the side that checks Academy still serves those calls.
|
||||
GO_VERSION: "1.26"
|
||||
# `dsh plugin add` shells out to pnpm to install into the profile, and the
|
||||
# runner image ships only npm and yarn. The profile it writes carries its
|
||||
@@ -58,7 +58,7 @@ jobs:
|
||||
timeout-minutes: 15
|
||||
defaults:
|
||||
run:
|
||||
working-directory: packages/dsh-weknora
|
||||
working-directory: packages/dsh-academy
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
@@ -66,7 +66,7 @@ jobs:
|
||||
with:
|
||||
node-version: "24"
|
||||
cache: npm
|
||||
cache-dependency-path: packages/dsh-weknora/package-lock.json
|
||||
cache-dependency-path: packages/dsh-academy/package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci || npm install
|
||||
@@ -85,9 +85,9 @@ jobs:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
cache: true
|
||||
|
||||
- name: Contract tests against WeKnora's Go types
|
||||
- name: Contract tests against Academy's Go types
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: go test ./packages/dsh-weknora/contract/...
|
||||
run: go test ./packages/dsh-academy/contract/...
|
||||
|
||||
- name: Pack and verify the published file list
|
||||
run: |
|
||||
@@ -117,7 +117,7 @@ jobs:
|
||||
timeout-minutes: 25
|
||||
defaults:
|
||||
run:
|
||||
working-directory: packages/dsh-weknora
|
||||
working-directory: packages/dsh-academy
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
@@ -125,7 +125,7 @@ jobs:
|
||||
with:
|
||||
node-version: "24"
|
||||
cache: npm
|
||||
cache-dependency-path: packages/dsh-weknora/package-lock.json
|
||||
cache-dependency-path: packages/dsh-academy/package-lock.json
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
@@ -149,15 +149,15 @@ jobs:
|
||||
env:
|
||||
DSH_PACKAGE_SPEC: ${{ env.DSH_PINNED_SPEC }}
|
||||
DSH_INSTALL_DIR: ${{ github.workspace }}/.cache/dsh-e2e-install
|
||||
DSH_E2E_LOG: ${{ runner.temp }}/dsh-weknora-e2e.log
|
||||
DSH_E2E_LOG: ${{ runner.temp }}/dsh-academy-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
|
||||
name: dsh-academy-e2e-transcript
|
||||
path: ${{ runner.temp }}/dsh-academy-e2e.log
|
||||
if-no-files-found: ignore
|
||||
|
||||
drift:
|
||||
@@ -168,7 +168,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
defaults:
|
||||
run:
|
||||
working-directory: packages/dsh-weknora
|
||||
working-directory: packages/dsh-academy
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
@@ -176,7 +176,7 @@ jobs:
|
||||
with:
|
||||
node-version: "24"
|
||||
cache: npm
|
||||
cache-dependency-path: packages/dsh-weknora/package-lock.json
|
||||
cache-dependency-path: packages/dsh-academy/package-lock.json
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
@@ -208,7 +208,7 @@ jobs:
|
||||
publish:
|
||||
name: Publish to npm
|
||||
needs: [test, e2e]
|
||||
if: startsWith(github.ref, 'refs/tags/dsh-weknora-v')
|
||||
if: startsWith(github.ref, 'refs/tags/dsh-academy-v')
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
permissions:
|
||||
@@ -216,10 +216,10 @@ jobs:
|
||||
id-token: write
|
||||
environment:
|
||||
name: npm-publish
|
||||
url: https://www.npmjs.com/package/@wxg-prc-cpg/dsh-weknora
|
||||
url: https://www.npmjs.com/package/@wxg-prc-cpg/dsh-academy
|
||||
defaults:
|
||||
run:
|
||||
working-directory: packages/dsh-weknora
|
||||
working-directory: packages/dsh-academy
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
@@ -228,7 +228,7 @@ jobs:
|
||||
node-version: "24"
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
cache: npm
|
||||
cache-dependency-path: packages/dsh-weknora/package-lock.json
|
||||
cache-dependency-path: packages/dsh-academy/package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci || npm install
|
||||
@@ -240,10 +240,10 @@ jobs:
|
||||
run: |
|
||||
set -e
|
||||
version="$(node -p "require('./package.json').version")"
|
||||
expected="dsh-weknora-v${version}"
|
||||
expected="dsh-academy-v${version}"
|
||||
if [ "$GITHUB_REF_NAME" != "$expected" ]; then
|
||||
echo "::error::tag $GITHUB_REF_NAME does not name the packaged version $version (expected $expected)."
|
||||
echo "::error::Bump packages/dsh-weknora/package.json, or retag — publishing here would ship a version the tag does not name."
|
||||
echo "::error::Bump packages/dsh-academy/package.json, or retag — publishing here would ship a version the tag does not name."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -68,8 +68,8 @@ jobs:
|
||||
docker build \
|
||||
-f frontend/Dockerfile \
|
||||
--build-arg VITE_FRONTEND_COMMIT="${GITHUB_SHA::7}" \
|
||||
-t weknora-ui:ci \
|
||||
-t academy-ui:ci \
|
||||
frontend/
|
||||
|
||||
- name: Test embed and MCP proxy routes
|
||||
run: python3 scripts/test_embed_nginx.py weknora-ui:ci
|
||||
run: python3 scripts/test_embed_nginx.py academy-ui:ci
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
render_image() {
|
||||
local template="$1"
|
||||
shift
|
||||
helm template weknora ./helm \
|
||||
helm template academy ./helm \
|
||||
--show-only "$template" \
|
||||
--set secrets.dbPassword=test \
|
||||
--set secrets.redisPassword=test \
|
||||
|
||||
@@ -6,7 +6,7 @@ name: Build & Publish (mcp-server)
|
||||
#
|
||||
# Release policy: publishing does NOT depend on tags. Bump the version in
|
||||
# mcp-server/pyproject.toml (and the synced version strings in setup.py,
|
||||
# __init__.py, weknora_mcp_server.py server_version, main.py --version),
|
||||
# __init__.py, academy_mcp_server.py server_version, main.py --version),
|
||||
# merge to main, and the pipeline builds + publishes automatically.
|
||||
# A pre-publish check queries PyPI and skips upload if that version is
|
||||
# already published, so re-running on an unchanged version stays green.
|
||||
@@ -105,7 +105,7 @@ jobs:
|
||||
id-token: write
|
||||
environment:
|
||||
name: pypi
|
||||
url: https://pypi.org/project/tencent-weknora-mcp/
|
||||
url: https://pypi.org/project/tencent-academy-mcp/
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -123,7 +123,7 @@ jobs:
|
||||
import json, sys, urllib.request
|
||||
v = sys.argv[1]
|
||||
try:
|
||||
d = json.load(urllib.request.urlopen("https://pypi.org/pypi/tencent-weknora-mcp/json"))
|
||||
d = json.load(urllib.request.urlopen("https://pypi.org/pypi/tencent-academy-mcp/json"))
|
||||
print("true" if v in d.get("releases", {}) else "false")
|
||||
except Exception:
|
||||
# If PyPI is unreachable or the project is brand-new (404), treat as unpublished.
|
||||
@@ -132,7 +132,7 @@ jobs:
|
||||
echo "already on PyPI: $exists"
|
||||
if [ "$exists" = "true" ]; then
|
||||
echo "should_publish=false" >> "$GITHUB_OUTPUT"
|
||||
echo "::warning::tencent-weknora-mcp $version is already on PyPI; skipping publish. Bump pyproject.toml (and synced version strings) to release new changes."
|
||||
echo "::warning::tencent-academy-mcp $version is already on PyPI; skipping publish. Bump pyproject.toml (and synced version strings) to release new changes."
|
||||
else
|
||||
echo "should_publish=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
@@ -103,13 +103,13 @@ jobs:
|
||||
export CGO_LDFLAGS="-Wl,-no_warn_duplicate_libraries"
|
||||
fi
|
||||
go build -tags "sqlite_fts5" -ldflags="${LDFLAGS}" \
|
||||
-o WeKnora-lite ./cmd/server
|
||||
-o Academy-lite ./cmd/server
|
||||
|
||||
- name: Package tarball
|
||||
run: |
|
||||
ARCHIVE="WeKnora-lite_${{ steps.ver.outputs.version }}_${{ matrix.goos }}_${{ matrix.goarch }}"
|
||||
ARCHIVE="Academy-lite_${{ steps.ver.outputs.version }}_${{ matrix.goos }}_${{ matrix.goarch }}"
|
||||
mkdir -p "${ARCHIVE}/web"
|
||||
cp WeKnora-lite "${ARCHIVE}/"
|
||||
cp Academy-lite "${ARCHIVE}/"
|
||||
bash ./scripts/copy-licenses.sh "${ARCHIVE}"
|
||||
cp -r web/* "${ARCHIVE}/web/"
|
||||
cp .env.lite.example "${ARCHIVE}/"
|
||||
@@ -121,8 +121,8 @@ jobs:
|
||||
mkdir -p "${ARCHIVE}/migrations/sqlite"
|
||||
cp -r migrations/sqlite/* "${ARCHIVE}/migrations/sqlite/"
|
||||
fi
|
||||
if [ -f deploy/weknora-lite.service ]; then
|
||||
cp deploy/weknora-lite.service "${ARCHIVE}/"
|
||||
if [ -f deploy/academy-lite.service ]; then
|
||||
cp deploy/academy-lite.service "${ARCHIVE}/"
|
||||
fi
|
||||
tar czf "${ARCHIVE}.tar.gz" "${ARCHIVE}"
|
||||
shasum -a 256 "${ARCHIVE}.tar.gz" > "${ARCHIVE}.tar.gz.sha256"
|
||||
@@ -131,8 +131,8 @@ jobs:
|
||||
with:
|
||||
name: release-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
path: |
|
||||
WeKnora-lite_*.tar.gz
|
||||
WeKnora-lite_*.tar.gz.sha256
|
||||
Academy-lite_*.tar.gz
|
||||
Academy-lite_*.tar.gz.sha256
|
||||
retention-days: 3
|
||||
|
||||
# ── 2b. Build Desktop APP per platform (Wails) ──
|
||||
@@ -241,13 +241,13 @@ jobs:
|
||||
-platform "${{ matrix.platform }}" \
|
||||
${NSIS_FLAG} \
|
||||
-ldflags="${LDFLAGS}" \
|
||||
-o "WeKnora Lite"
|
||||
-o "Academy Lite"
|
||||
|
||||
# ── macOS: bundle .app with resources, then create DMG ──
|
||||
- name: Package macOS app
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
APP_BUNDLE="WeKnora Lite.app"
|
||||
APP_BUNDLE="Academy Lite.app"
|
||||
SRC="cmd/desktop/build/bin/${APP_BUNDLE}"
|
||||
RESOURCES="${SRC}/Contents/Resources"
|
||||
|
||||
@@ -265,14 +265,14 @@ jobs:
|
||||
cp -r config/* "${RESOURCES}/config/"
|
||||
fi
|
||||
|
||||
DMG_NAME="WeKnora-Lite-App_${{ steps.ver.outputs.version }}_${{ matrix.arch_label }}"
|
||||
DMG_NAME="Academy-Lite-App_${{ steps.ver.outputs.version }}_${{ matrix.arch_label }}"
|
||||
|
||||
DMG_SRC="dmg_staging"
|
||||
mkdir -p "${DMG_SRC}"
|
||||
cp -R "cmd/desktop/build/bin/${APP_BUNDLE}" "${DMG_SRC}/"
|
||||
ln -s /Applications "${DMG_SRC}/Applications"
|
||||
|
||||
hdiutil create -volname "WeKnora Lite" \
|
||||
hdiutil create -volname "Academy Lite" \
|
||||
-srcfolder "${DMG_SRC}" \
|
||||
-ov -format UDZO \
|
||||
"${DMG_NAME}.dmg"
|
||||
@@ -283,9 +283,9 @@ jobs:
|
||||
- name: Package Linux app
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
ARCHIVE="WeKnora-Lite-App_${{ steps.ver.outputs.version }}_${{ matrix.arch_label }}"
|
||||
ARCHIVE="Academy-Lite-App_${{ steps.ver.outputs.version }}_${{ matrix.arch_label }}"
|
||||
mkdir -p "${ARCHIVE}"
|
||||
cp "cmd/desktop/build/bin/WeKnora Lite" "${ARCHIVE}/"
|
||||
cp "cmd/desktop/build/bin/Academy Lite" "${ARCHIVE}/"
|
||||
bash ./scripts/copy-licenses.sh "${ARCHIVE}"
|
||||
if [ -f .env.lite.example ]; then
|
||||
cp .env.lite.example "${ARCHIVE}/"
|
||||
@@ -306,8 +306,8 @@ jobs:
|
||||
if: runner.os == 'Windows'
|
||||
shell: bash
|
||||
run: |
|
||||
ARCHIVE="WeKnora-Lite-App_${{ steps.ver.outputs.version }}_${{ matrix.arch_label }}"
|
||||
INSTALLER="cmd/desktop/build/bin/WeKnora Lite-amd64-installer.exe"
|
||||
ARCHIVE="Academy-Lite-App_${{ steps.ver.outputs.version }}_${{ matrix.arch_label }}"
|
||||
INSTALLER="cmd/desktop/build/bin/Academy Lite-amd64-installer.exe"
|
||||
# Do not publish a bare executable if NSIS was unavailable: the
|
||||
# installer also carries the notices/source and supports auto-update.
|
||||
test -f "$INSTALLER"
|
||||
@@ -318,7 +318,7 @@ jobs:
|
||||
with:
|
||||
name: ${{ matrix.artifact_name }}
|
||||
path: |
|
||||
WeKnora-Lite-App_*
|
||||
Academy-Lite-App_*
|
||||
retention-days: 3
|
||||
|
||||
# ── 3. Create GitHub Release ──
|
||||
@@ -352,7 +352,7 @@ jobs:
|
||||
id: notes
|
||||
run: |
|
||||
cat > notes.md << 'NOTES'
|
||||
## WeKnora Lite ${{ steps.ver.outputs.version }}
|
||||
## Academy Lite ${{ steps.ver.outputs.version }}
|
||||
|
||||
### Web CLI 版(命令行 / 服务器部署)
|
||||
|
||||
@@ -360,8 +360,8 @@ jobs:
|
||||
|
||||
```bash
|
||||
# 1. 解压
|
||||
tar xzf WeKnora-lite_${{ steps.ver.outputs.version }}_<os>_<arch>.tar.gz
|
||||
cd WeKnora-lite_${{ steps.ver.outputs.version }}_<os>_<arch>
|
||||
tar xzf Academy-lite_${{ steps.ver.outputs.version }}_<os>_<arch>.tar.gz
|
||||
cd Academy-lite_${{ steps.ver.outputs.version }}_<os>_<arch>
|
||||
|
||||
# 2. 配置
|
||||
cp .env.lite.example .env.lite
|
||||
@@ -374,16 +374,16 @@ jobs:
|
||||
|
||||
# 4. 运行
|
||||
set -a && source .env.lite && set +a
|
||||
./WeKnora-lite
|
||||
./Academy-lite
|
||||
# 访问 http://localhost:8080
|
||||
```
|
||||
|
||||
| 文件 | 平台 |
|
||||
|------|------|
|
||||
| `WeKnora-lite_*_linux_amd64.tar.gz` | Linux x86_64 |
|
||||
| `WeKnora-lite_*_linux_arm64.tar.gz` | Linux ARM64 |
|
||||
| `WeKnora-lite_*_darwin_amd64.tar.gz` | macOS Intel |
|
||||
| `WeKnora-lite_*_darwin_arm64.tar.gz` | macOS Apple Silicon |
|
||||
| `Academy-lite_*_linux_amd64.tar.gz` | Linux x86_64 |
|
||||
| `Academy-lite_*_linux_arm64.tar.gz` | Linux ARM64 |
|
||||
| `Academy-lite_*_darwin_amd64.tar.gz` | macOS Intel |
|
||||
| `Academy-lite_*_darwin_arm64.tar.gz` | macOS Apple Silicon |
|
||||
|
||||
---
|
||||
|
||||
@@ -393,11 +393,11 @@ jobs:
|
||||
|
||||
| 文件 | 平台 |
|
||||
|------|------|
|
||||
| `WeKnora-Lite-App_*_macOS_universal.dmg` | macOS (Intel + Apple Silicon) |
|
||||
| `WeKnora-Lite-App_*_macOS_amd64.dmg` | macOS Intel |
|
||||
| `WeKnora-Lite-App_*_macOS_arm64.dmg` | macOS Apple Silicon |
|
||||
| `WeKnora-Lite-App_*_linux_amd64.tar.gz` | Linux x86_64 |
|
||||
| `WeKnora-Lite-App_*_windows_amd64_setup.exe` | Windows x86_64 (安装包) |
|
||||
| `Academy-Lite-App_*_macOS_universal.dmg` | macOS (Intel + Apple Silicon) |
|
||||
| `Academy-Lite-App_*_macOS_amd64.dmg` | macOS Intel |
|
||||
| `Academy-Lite-App_*_macOS_arm64.dmg` | macOS Apple Silicon |
|
||||
| `Academy-Lite-App_*_linux_amd64.tar.gz` | Linux x86_64 |
|
||||
| `Academy-Lite-App_*_windows_amd64_setup.exe` | Windows x86_64 (安装包) |
|
||||
|
||||
详细文档见 [LITE.md](docs/LITE.md)。
|
||||
NOTES
|
||||
@@ -407,11 +407,11 @@ jobs:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
gh release create "${{ steps.ver.outputs.version }}" \
|
||||
--title "WeKnora Lite ${{ steps.ver.outputs.version }}" \
|
||||
--title "Academy Lite ${{ steps.ver.outputs.version }}" \
|
||||
--notes-file notes.md \
|
||||
WeKnora-lite_*.tar.gz \
|
||||
WeKnora-lite_*.tar.gz.sha256 \
|
||||
WeKnora-Lite-App_* || true
|
||||
Academy-lite_*.tar.gz \
|
||||
Academy-lite_*.tar.gz.sha256 \
|
||||
Academy-Lite-App_* || true
|
||||
|
||||
# ── 4. Update Homebrew Formula ──
|
||||
update-homebrew:
|
||||
@@ -443,10 +443,10 @@ jobs:
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add Formula/weknora-lite.rb
|
||||
git add Formula/academy-lite.rb
|
||||
if git diff --cached --quiet; then
|
||||
echo "No changes to Formula"
|
||||
else
|
||||
git commit -m "formula: update weknora-lite to ${{ steps.ver.outputs.version }}"
|
||||
git commit -m "formula: update academy-lite to ${{ steps.ver.outputs.version }}"
|
||||
git push origin main
|
||||
fi
|
||||
+7
-7
@@ -35,17 +35,17 @@ logs/
|
||||
|
||||
# 本机构建产物(不入库)
|
||||
artifacts/
|
||||
WeKnora
|
||||
Academy
|
||||
WeKnora-lite
|
||||
Academy
|
||||
Academy-lite
|
||||
Academy-lite
|
||||
cmd/desktop/build/bin/
|
||||
/models/
|
||||
test/data/mswag.txt
|
||||
data/files/
|
||||
data/weknora.db
|
||||
data/weknora.db-wal
|
||||
data/weknora.db-shm
|
||||
data/academy.db
|
||||
data/academy.db-wal
|
||||
data/academy.db-shm
|
||||
skills-lock.json
|
||||
|
||||
web/
|
||||
@@ -55,7 +55,7 @@ web/
|
||||
/server
|
||||
frontend/.vite
|
||||
frontend/chrome-extension/
|
||||
WeKnora-Chrome-Extension
|
||||
Academy-Chrome-Extension
|
||||
Academy-Chrome-Extension
|
||||
packages/protoc-3.19.4-linux-x86_64.zip
|
||||
|
||||
@@ -69,7 +69,7 @@ fix-docker.sh
|
||||
miniprogram/project.private.config.json
|
||||
|
||||
# Staging dir for the Docker sandbox self-check probe (removed after each run)
|
||||
.weknora-sandbox-check-*
|
||||
.academy-sandbox-check-*
|
||||
.academy-sandbox-check-*
|
||||
|
||||
# Locally built BrowserSkill runtime and extension bundles
|
||||
|
||||
+36
-36
@@ -74,7 +74,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
|
||||
- Helm pins app/frontend/docreader images to appVersion by default, exposes Service-name overrides and rollout strategy, and documents shared-storage requirements (#3669, #4109, #4180).
|
||||
- Build real arm64 sandbox/Cube images; support app/docreader download mirrors (#4073); install CA certificates before BrowserSkill mirror substitution (#4104); fix dev-script exit propagation and MinIO image retrieval.
|
||||
- Make outbound dialing configurable with `WEKNORA_OUTBOUND_DIAL_TIMEOUT` (default 5s), including Compose forwarding (#4122, #4157). Keep existing migration objects tolerated where appropriate (#4164).
|
||||
- Make outbound dialing configurable with `ACADEMY_OUTBOUND_DIAL_TIMEOUT` (default 5s), including Compose forwarding (#4122, #4157). Keep existing migration objects tolerated where appropriate (#4164).
|
||||
- Regenerate Swagger from current handlers, document system model-catalog endpoints, and correct the processing-trace route base path; retain reproducible generation (#3751); clarify frontend proxy configuration, upload folder paths, model copy, retrieval-scope semantics and API quickstart tenant extraction; refresh license notices (#4178).
|
||||
- Refresh website feature/API/deployment documentation, add this release page and real product screenshots, update homepage/navigation and the project version to 0.8.3. Preserve historical release notes.
|
||||
- Add or strengthen regressions for parsing/splitting, SSE, attachments, tool selection, multimodal protocols, connectors, index failures, OAuth, user management and platform configuration; synchronize host-skill and concurrent-schema tests to avoid timing-only failures.
|
||||
@@ -94,7 +94,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
- **NEW**: **Confluence & DingTalk Docs data sources** — Confluence Cloud and Server/Data Center spaces sync published pages incrementally with deletion protection (#3287); DingTalk Docs sync with localized setup (#2313). IMA sync traverses subfolders.
|
||||
- **NEW**: **Bocha and Serply web search** providers (#3036); `country` / `freshness` filters work with Brave and Serply.
|
||||
- **NEW**: **Japanese UI** (`ja-JP`), selectable at runtime or via `DEFAULT_LOCALE` (#3080).
|
||||
- **NEW**: **Per-channel IM reply language** — each IM channel can set its reply locale; unset channels follow `WEKNORA_LANGUAGE` (#3455).
|
||||
- **NEW**: **Per-channel IM reply language** — each IM channel can set its reply locale; unset channels follow `ACADEMY_LANGUAGE` (#3455).
|
||||
- **NEW**: **Knowledge base workflow** — batch download of original files as a ZIP (#3300); configurable sorting for document and resource lists (#3318); documents that stop making progress are flagged as queued or stalled with a `TASK_STALLED` code (#3557); per-upload option to skip summary generation; knowledge base descriptions generated from document profiles (#3370); an upload panel with overall progress, cancel and retry (#3399); FAQ list filter by enabled status (#3157); activity records show the API key name (#3405).
|
||||
- **NEW**: **Whitelist-only outbound mode** — `SSRF_DNS_WHITELIST_ONLY=true` refuses any host outside `SSRF_WHITELIST` before DNS resolution, closing DNS-based exfiltration from offline deployments (#3393).
|
||||
- **NEW**: **Admin user creation UI** — system administrators create accounts from Settings with a one-time password and a copyable account summary (#3034, #3039).
|
||||
@@ -111,7 +111,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
- **IMPROVED**: **Chat UX** — rebuilt Markdown editor for saving answers to a knowledge base (#3467); in-progress status and API-session owner badges in the sidebar; full dates on older message timestamps (#3576); truncated answers are marked instead of silently cut; stored streams replay one segment at a time; the chat stream recovers from an expired access token (#3028).
|
||||
- **IMPROVED**: **Wiki** — whole-page rewrites continue when cut by the completion budget and are refused if still incomplete (#3582); same-title items reuse the existing page across types (#3547); cited chunks include image captions (#3292); ambiguous single-Han auto-links are skipped (#2860); taxonomy embeddings are batched.
|
||||
- **IMPROVED**: **Retrieval & graph** — Milvus supports multilingual BM25 (#3235); keyword-only BM25 scores are bounded before rerank (#3343); Neo4j node search caps seeds and rows (#3550); entity extraction gets a larger output budget (#2859) and uses OCR text of scanned pages (#3092).
|
||||
- **IMPROVED**: **Parsing** — PaddleOCR-VL request timeout is configurable via `WEKNORA_PADDLEOCR_VL_TIMEOUT` (#3537); timed-out converter process groups are killed (#2990); PDFs stay on the builtin parser even when anydoc is linked; inline HTML tables no longer produce oversized chunks (#3404); the OCR prompt no longer includes the knowledge base's image-caption instructions (#3291).
|
||||
- **IMPROVED**: **Parsing** — PaddleOCR-VL request timeout is configurable via `ACADEMY_PADDLEOCR_VL_TIMEOUT` (#3537); timed-out converter process groups are killed (#2990); PDFs stay on the builtin parser even when anydoc is linked; inline HTML tables no longer produce oversized chunks (#3404); the OCR prompt no longer includes the knowledge base's image-caption instructions (#3291).
|
||||
- **IMPROVED**: **Performance** — faster chunk ingestion and batch updates (#3369); fewer redundant sandbox remote calls.
|
||||
- **IMPROVED**: **Storage** — OBS uses virtual-hosted addressing (#3273); object-storage transfers may exceed 30 seconds (#3368); the KS3 client keeps the SSRF redirect policy.
|
||||
- **IMPROVED**: **Frontend** — style consistency pass with shared shells, tokens and unified confirmations (#3376); list title icons and resource cards refined; embedded pages enforce host origin allowlists.
|
||||
@@ -157,11 +157,11 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
|
||||
### New Features
|
||||
|
||||
- **NEW**: **Skill Sandbox Runtime (Docker / E2B / Cube)** — the headline of this release. Agent skills now run in a **session-persistent sandbox**: one sandbox per chat session, with `shell_exec`, file read/write/edit, attachment staging, and generated-file collection all landing in the same workspace. Three backends share one `RemoteSandboxClient` protocol: **Docker** (single-host / self-hosted, talking to the Engine API rather than `docker run --rm`), **E2B** (cloud or any E2B-compatible control plane, including self-hosted), and **CubeSandbox**. Per-workspace configs cover image, CPU/memory, TTL, DNS, templates and snapshots (migrations `000082_tenant_sandbox_config`, `000083_session_sandbox_config`). Admins can set a **network policy** per config (default-deny egress, allow/deny lists, Cube L7 rules, E2B host rules) (#2995). The old **Local host-process backend is removed**. The Docker backend is **opt-in** (`WEKNORA_SANDBOX_DOCKER_ENABLED` or System Settings → Network Security) because a mounted `docker.sock` is host root (#2936). See [Sandbox deployment and troubleshooting](./website-docs/06-development/04-sandbox-deployment.md).
|
||||
- **NEW**: **Skill Sandbox Runtime (Docker / E2B / Cube)** — the headline of this release. Agent skills now run in a **session-persistent sandbox**: one sandbox per chat session, with `shell_exec`, file read/write/edit, attachment staging, and generated-file collection all landing in the same workspace. Three backends share one `RemoteSandboxClient` protocol: **Docker** (single-host / self-hosted, talking to the Engine API rather than `docker run --rm`), **E2B** (cloud or any E2B-compatible control plane, including self-hosted), and **CubeSandbox**. Per-workspace configs cover image, CPU/memory, TTL, DNS, templates and snapshots (migrations `000082_tenant_sandbox_config`, `000083_session_sandbox_config`). Admins can set a **network policy** per config (default-deny egress, allow/deny lists, Cube L7 rules, E2B host rules) (#2995). The old **Local host-process backend is removed**. The Docker backend is **opt-in** (`ACADEMY_SANDBOX_DOCKER_ENABLED` or System Settings → Network Security) because a mounted `docker.sock` is host root (#2936). See [Sandbox deployment and troubleshooting](./website-docs/06-development/04-sandbox-deployment.md).
|
||||
- **NEW**: **Tenant Skill Catalog** — skills are first-class workspace resources, not files dropped next to the process (migrations `000086_tenant_skills`, `000087_skill_install_transcript`, `000088_skill_snapshot_planned_name`, `000090_skill_catalog`). Install from **ClawHub**, **SkillHub / skills.sh**, **GitHub/GitLab URLs**, or a zip upload; each install is a snapshot on the chosen sandbox config, with live circular progress, install transcripts, stop/reinstall, and uninstall that keeps catalog archives. Browse and edit installed skill files from Settings; agents get `write_skill_file` / `edit_skill_file` plus `shell_exec` that no longer requires a skill to be installed. Personal and workspace **skill env vars** inject at execution without ever being read back (migration `000089_env_vars`). `@mention` no longer silently shrinks the skill whitelist.
|
||||
- **NEW**: **Cross-Session Long-Term Memory** — a new memory product (migration `000084_memory`), independent of the Neo4j conversation-memory that 0.7.1 removed. Workspaces opt in; each user can further turn it off. Memories are typed (`profile` / `preference` / `fact` / `task` / `interest`), written either explicitly or by a background extractor, and **inferred items stay pending until the user confirms**. Resident profile/preference blocks ride in every turn; situational facts are recalled lexically and (optionally) semantically; `search_memory` looks up on demand. Document affinity conditions retrieval toward sources the user keeps citing. Settings, items, topics, document affinity, confirm/reject, export and forced consolidation are exposed as `/api/v1/memory/*` (full-access API keys only; the subject is always the caller).
|
||||
- **NEW**: **In-Process anydoc Parser** — Office documents (doc/docx/ppt/pptx and the types anydoc converts) can be parsed **inside the Go app** via `third_party/anydoc-go`, without a round-trip to docreader. When the binding is linked, anydoc is preferred for every type it converts; PPT/PPTX still default to MarkItDown when no engine rule is set. The app image links anydoc by default.
|
||||
- **NEW**: **DeepSeek Harness Plugin** — official npm package [`@wxg-prc-cpg/dsh-weknora`](https://www.npmjs.com/package/@wxg-prc-cpg/dsh-weknora) exposes four read-only tools (`weknora_search`, `weknora_read_document`, `weknora_ask`, `weknora_list_knowledge_bases`) so a DeepSeek Harness coding agent can retrieve from a WeKnora deployment (#2759).
|
||||
- **NEW**: **DeepSeek Harness Plugin** — official npm package [`@wxg-prc-cpg/dsh-academy`](https://www.npmjs.com/package/@wxg-prc-cpg/dsh-academy) exposes four read-only tools (`academy_search`, `academy_read_document`, `academy_ask`, `academy_list_knowledge_bases`) so a DeepSeek Harness coding agent can retrieve from a Academy deployment (#2759).
|
||||
- **NEW**: **GitLab & Tencent IMA Data Sources** — GitLab projects sync as a knowledge source (#2656); Tencent IMA notes sync through the note OpenAPI, with retries on transient failures.
|
||||
- **NEW**: **LiteLLM Model Provider** — LiteLLM is a first-class chat/embedding/rerank provider, so one gateway URL can front many upstream models (#2923).
|
||||
- **NEW**: **Exa & Metaso Web Search** — two new web-search providers join the existing set (#2617).
|
||||
@@ -170,7 +170,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
- **NEW**: **Document Auto-Tagging** — after parse, a chat model may pick matching tags from the knowledge base's existing tag set and attach them incrementally, without creating tags or overwriting manual ones (migration `000080_knowledge_base_auto_tag_config`).
|
||||
- **NEW**: **Context Compaction & Prompt-Cache Markers** — long sandbox turns compact tool history instead of truncating or rewriting files; stable prompt prefixes plus provider cache markers improve cache hit rate on Anthropic/OpenAI-compatible backends. Per-turn LLM token usage is attributed and stored (migration `000085_message_usage`).
|
||||
- **NEW**: **OIDC JWKS Verification & `/auth/oidc/start`** — ID tokens are signature-verified via JWKS (#2799); a direct 302 start endpoint supports login without a pre-rendered SPA handshake.
|
||||
- **NEW**: **Optional Complex Passwords** — registration, self-service change-password and admin reset can require mixed-case, digits and special characters (`WEKNORA_AUTH_COMPLEX_PASSWORD_ENABLED` / system setting) (#2929).
|
||||
- **NEW**: **Optional Complex Passwords** — registration, self-service change-password and admin reset can require mixed-case, digits and special characters (`ACADEMY_AUTH_COMPLEX_PASSWORD_ENABLED` / system setting) (#2929).
|
||||
- **NEW**: **System-Admin User Creation** — platform admins can create users from the console without an invite link (#2722).
|
||||
- **NEW**: **Invitation Auto-Accept & Invite-Only Join** — inviting an already-registered user can auto-accept; in invite-only mode, share links send the visitor through login before joining the workspace.
|
||||
|
||||
@@ -185,7 +185,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
- **IMPROVED**: **Auth / tenancy** — `SwitchTenant` records last-active-tenant preference; self-service change password in the profile; folder drag-and-drop upload preserves directory structure; document download action; editable document summaries; paginated document chunks; FAQ batch actions restored.
|
||||
- **IMPROVED**: **Observability** — sandbox operations emit product-level Langfuse spans; follow-up completions nest under the parent chat trace; prompt-cache markers stay stable across turns.
|
||||
- **IMPROVED**: **Deployment capabilities** — menus and settings hide modules the binary did not register (`GET /system/capabilities`), so Lite / trimmed builds stop advertising missing features (#2674).
|
||||
- **IMPROVED**: **CI** — golangci-lint workflow gates new PR code; path-filtered checks avoid triggering anydoc/unrelated lints; git pre-commit / pre-push hooks; Playwright WebKit for docreader URL tests; dsh-weknora e2e cache.
|
||||
- **IMPROVED**: **CI** — golangci-lint workflow gates new PR code; path-filtered checks avoid triggering anydoc/unrelated lints; git pre-commit / pre-push hooks; Playwright WebKit for docreader URL tests; dsh-academy e2e cache.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -206,7 +206,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
### Breaking Changes
|
||||
|
||||
- **BREAKING**: The **Local host-process sandbox backend is removed**. Existing Local configs must be recreated against Docker (opt-in), E2B, or Cube.
|
||||
- **BREAKING**: The Docker sandbox backend is **off by default**. Enable it in System Settings → Network Security, or set `WEKNORA_SANDBOX_DOCKER_ENABLED=true`.
|
||||
- **BREAKING**: The Docker sandbox backend is **off by default**. Enable it in System Settings → Network Security, or set `ACADEMY_SANDBOX_DOCKER_ENABLED=true`.
|
||||
- **BREAKING**: Complex-password mode, when enabled, rejects registration / password-change payloads that do not mix upper, lower, digit and special characters.
|
||||
|
||||
### Infrastructure & Build
|
||||
@@ -234,7 +234,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
- **NEW**: **Directly Loadable File URLs (`resource_urls=public`)** — chat answers, references, knowledge search, and embed responses can return ready-to-load http(s) URLs for files and images instead of internal `resource://` handles, so third-party apps no longer need a second authenticated call to the `/files` proxy. Opt in per request with `?resource_urls=public` or per deployment with `RESOURCE_URL_MODE=public`. A new `internal/storageurl` package centralizes the rewriting, reusing a live access grant per resource to keep read endpoints from writing on every request. Anonymous embed channels and KB-restricted API keys always stay on `handle`. See [API overview](./website-docs/04-api/01-api-overview.md).
|
||||
- **NEW**: **Feishu Drive Data Source** — a new Feishu Cloud Drive connector joins the existing Feishu wiki connector (#2466). New-format Feishu cloud documents (docx) are now synchronized through the blocks API with per-block-type drill-down (#2087), configurable via the new `E9` docx parsing-mode section in `.env.example`.
|
||||
- **NEW**: **Batch Document Tagging** — select documents in the knowledge base list and apply tags in bulk through a dedicated dialog that pre-selects the tags already common to the selection.
|
||||
- **NEW**: **MCP Server 1.1.x** — the WeKnora MCP server migrated from the removed low-level `Server` decorator API to the high-level `MCPServer` API (mcp 2.x), restoring HTTP (`stateless_http`) and SSE (`/sse/messages/`) transport compatibility, and now publishes as the official PyPI package **`tencent-weknora-mcp`** via Trusted Publishing. Two new tools bring the total to 29: `create_knowledge_from_text` (create a knowledge entry from Markdown text) and `list_shared_knowledge_bases` (shared KBs are also folded into name resolution and tool hints).
|
||||
- **NEW**: **MCP Server 1.1.x** — the Academy MCP server migrated from the removed low-level `Server` decorator API to the high-level `MCPServer` API (mcp 2.x), restoring HTTP (`stateless_http`) and SSE (`/sse/messages/`) transport compatibility, and now publishes as the official PyPI package **`tencent-academy-mcp`** via Trusted Publishing. Two new tools bring the total to 29: `create_knowledge_from_text` (create a knowledge entry from Markdown text) and `list_shared_knowledge_bases` (shared KBs are also folded into name resolution and tool hints).
|
||||
- **NEW**: **AWS S3 Default Credential Chain** — leaving `S3_ACCESS_KEY` and `S3_SECRET_KEY` both empty now falls back to the AWS SDK default credential chain, supporting EC2/ECS/EKS IAM roles, IRSA / Web Identity, environment variables, and shared config files (#2008).
|
||||
- **NEW**: **Local HTML Upload Parsing** — docreader gained a dedicated HTML parser, so `.html` files can be uploaded directly instead of only imported by URL. The supported-extension set is now the single gate for both direct upload and URL import (#2447).
|
||||
- **NEW**: **QQBot Markdown Replies** — QQBot channels reply with markdown formatting like the other IM integrations.
|
||||
@@ -338,7 +338,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
|
||||
### New Features
|
||||
|
||||
- **NEW**: **Scoped Tenant API Keys & Principal Model** — the headline of this release. WeKnora now issues fine-grained, capability-scoped API keys that are first-class principals separate from human users (migrations `000064_principal_model`, `000065_tenant_api_keys`). Each key carries an explicit role plus capability grants (`manage_kbs` covering the full KB lifecycle, `manage_storage_backends`, member/space capabilities, etc.), can be restricted to specific knowledge bases, and updates its `last_used_at` under a throttle. Route-level guards (`DenyAPIKeyPrincipal`, `api_key_gate`) close IDOR/scope gaps, and a new **API Integration Playground** in the web UI lets owners mint, scope, and test keys interactively. MCP OAuth and embed sessions are now scoped per principal so external integrations stay isolated.
|
||||
- **NEW**: **Scoped Tenant API Keys & Principal Model** — the headline of this release. Academy now issues fine-grained, capability-scoped API keys that are first-class principals separate from human users (migrations `000064_principal_model`, `000065_tenant_api_keys`). Each key carries an explicit role plus capability grants (`manage_kbs` covering the full KB lifecycle, `manage_storage_backends`, member/space capabilities, etc.), can be restricted to specific knowledge bases, and updates its `last_used_at` under a throttle. Route-level guards (`DenyAPIKeyPrincipal`, `api_key_gate`) close IDOR/scope gaps, and a new **API Integration Playground** in the web UI lets owners mint, scope, and test keys interactively. MCP OAuth and embed sessions are now scoped per principal so external integrations stay isolated.
|
||||
- **NEW**: **Runtime Task Queue Observability & Worker-Pool Governance** — a system-admin **Runtime Queues** dashboard exposes live queue depth, per-model concurrency stats, failed-task inspection, manual retry, and cursor-paginated task listings. The ingestion pipeline moves from a single aggregate worker pool to guaranteed per-stage pools (core / post-process / enrichment / maintenance) plus a shared elastic pool, with per-model background concurrency governors (`model.max_concurrency`) wrapping chat, embedding, rerank, and VLM calls. Wiki generation runs in its own independently governed pool. See [Async task capacity planning](./website-docs/02-architecture/05-async-tasks.md#capacity-planning).
|
||||
- **NEW**: **Multi-Instance Storage Backends** — each workspace can register multiple object/file storage instances (`local` / `minio` / `cos` / `tos` / `s3` / `oss` / `ks3` / `obs`) and bind different knowledge bases to different instances, with a workspace-level default (migration `000068_storage_backends`). Ships a full CRUD + connectivity-test API and settings UI, credential masking on read, and hardened image-source protection for storage backends. See [Infrastructure API](./website-docs/04-api/02-api-infra.md).
|
||||
- **NEW**: **Session-Scoped Temporary Attachments** — attach images and documents to a chat session for one-off Q&A with asynchronous parsing (migration `000070_temporary_documents`). Enforces a combined image + attachment limit, normalizes temporary attachment IDs, persists attachment content across turns, and adds a chat attachment preview drawer.
|
||||
@@ -347,7 +347,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
- **NEW**: **@Skill / @MCP Mentions with Scoped Agent Runtime** — mention skills and MCP services inline in chat to scope the agent runtime for a single turn, with hardened `@mention` scope resolution and consolidated per-turn scoping across knowledge tools.
|
||||
- **NEW**: **Mid-Conversation MCP OAuth** — MCP services can prompt for and resume OAuth authorization mid-chat, driven by `AuthType` with auto-detection on test, an OAuth skip endpoint, and in-chat OAuth interaction cards aligned with the agent tool timeline.
|
||||
- **NEW**: **QQBot & Lark (Feishu International) IM Integration** — new QQBot instant-messaging platform integration and support for Feishu's international edition (Lark), including region-aware routing and reply-in-thread via the Feishu reply-message API.
|
||||
- **NEW**: **`weknora` CLI v0.10** (BREAKING) — an agent-first CLI refresh: new `model`, `message`, `config`, and `skills` command groups; `doc reparse` / `doc update`; `kb config` / `kb config set`; `session resume` (renamed from `continue`) and `session tool-approval`; agent-first chat and `session ask` output modes; typed SDK errors/enums and KB model config; hardened SSE reliability; schema and exit-code contracts.
|
||||
- **NEW**: **`academy` CLI v0.10** (BREAKING) — an agent-first CLI refresh: new `model`, `message`, `config`, and `skills` command groups; `doc reparse` / `doc update`; `kb config` / `kb config set`; `session resume` (renamed from `continue`) and `session tool-approval`; agent-first chat and `session ask` output modes; typed SDK errors/enums and KB model config; hardened SSE reliability; schema and exit-code contracts.
|
||||
- **NEW**: **Redis TLS Support** — TLS connections to Redis with config surfaced at startup and hardened TLS tests (#1930).
|
||||
- **NEW**: **New Providers** — Requesty added as an OpenAI-compatible model provider; Keenable added as a configurable web search provider.
|
||||
- **NEW**: **Tenantless Provisioning & Gated Self-Service Workspaces** — OIDC/login provisioning can create users without a tenant, with gated self-service workspace creation and a workspace onboarding flow, unified under a shared `default_tenant_mode` policy.
|
||||
@@ -364,7 +364,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
- **IMPROVED**: **Terminology** — user-facing "tenant" labels renamed to "workspace" across the UI and i18n.
|
||||
- **IMPROVED**: **Chat streaming** — unified streaming wait indicators across chat and embed, follow-up suggestion loading and answer-toolbar timing polished, references drawer closed on session switch, and enforced retrieved-image output in answers.
|
||||
- **IMPROVED**: **Frontend resilience** — hardened settings `localStorage` load to prevent white-screen from corrupted state; shared document action menu and card-view components extracted; Wiki badge on KB cards; responsive doc filter bar.
|
||||
- **IMPROVED**: **Infrastructure config** — infrastructure host/port configurable via env vars in docker-compose; remote infrastructure supported via `.env.local`; `WEKNORA_MODEL_MAX_CONCURRENCY` defaulted to 32.
|
||||
- **IMPROVED**: **Infrastructure config** — infrastructure host/port configurable via env vars in docker-compose; remote infrastructure supported via `.env.local`; `ACADEMY_MODEL_MAX_CONCURRENCY` defaulted to 32.
|
||||
- **IMPROVED**: **docreader** — SSRF utility and safe HTTP client added; legacy doc-payload detection; parser routing tests.
|
||||
|
||||
### Bug Fixes
|
||||
@@ -397,7 +397,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
|
||||
### New Features
|
||||
|
||||
- **NEW**: **Website Embed Widget & Channels** — the headline of this release. Publish custom agents to external websites via embed channels with domain allowlists, per-minute / per-day rate limiting, and secure-mode token exchange (`em_…` publish token → short-lived `ems_…` session token). Ships `weknora-widget.js`, a standalone embed chat UI, visitor session management, and a unified **Integrations Center** for IM + embed channel editors with agent rebind and live preview. See [Embed channels](./website-docs/03-features/13-embed-channel.md) and [Embed subdomain deployment](./website-docs/03-features/13-embed-channel.md#embed-subdomain).
|
||||
- **NEW**: **Website Embed Widget & Channels** — the headline of this release. Publish custom agents to external websites via embed channels with domain allowlists, per-minute / per-day rate limiting, and secure-mode token exchange (`em_…` publish token → short-lived `ems_…` session token). Ships `academy-widget.js`, a standalone embed chat UI, visitor session management, and a unified **Integrations Center** for IM + embed channel editors with agent rebind and live preview. See [Embed channels](./website-docs/03-features/13-embed-channel.md) and [Embed subdomain deployment](./website-docs/03-features/13-embed-channel.md#embed-subdomain).
|
||||
- **NEW**: **Chat Experience Overhaul** — unified markdown rendering pipeline with citation popovers, chunk caching, shared resource chips, and `@` mention browsing of recent files; RAG pipeline progress events surfaced in a dedicated timeline component; agent stream display refactor with tool-result rendering, thinking blocks, shimmer streaming tail, and typewriter effect; large tool outputs trimmed via agent-side persistence.
|
||||
- **NEW**: **Document Multi-Tag** — documents can carry multiple tags (`knowledge_tag_ids` many-to-many via migration `000063_knowledge_multi_tags`); tag manage drawer, redesigned tag chips / edit dialog, and unified document tag filter in the KB list.
|
||||
- **NEW**: **Batch Document Reparse** — `POST /knowledge/batch-reparse` re-queues parsing for multiple documents with optional `process_config`; async task UI refreshes after enqueue.
|
||||
@@ -464,10 +464,10 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
|
||||
### New Features
|
||||
|
||||
- **NEW**: **Per-Upload Process Configuration & Upload Confirm Dialog** — the headline of this release. Every file / URL / folder upload can now carry a `process_config` (`KnowledgeProcessOverrides`) that overrides KB defaults for that batch only: parser engine rules, chunking, multimodal (VLM / ASR), question generation, graph extraction, and related flags. The Web UI adds an upload-confirm step so operators can review and tweak settings before enqueueing; the Go client and `weknora doc upload` accept the same JSON payload.
|
||||
- **NEW**: **Per-Upload Process Configuration & Upload Confirm Dialog** — the headline of this release. Every file / URL / folder upload can now carry a `process_config` (`KnowledgeProcessOverrides`) that overrides KB defaults for that batch only: parser engine rules, chunking, multimodal (VLM / ASR), question generation, graph extraction, and related flags. The Web UI adds an upload-confirm step so operators can review and tweak settings before enqueueing; the Go client and `academy doc upload` accept the same JSON payload.
|
||||
- **NEW**: **Document Reparse with Process Config** — `POST /knowledge/:id/reparse` accepts an optional `process_config` body to re-run parsing with new settings while preserving the knowledge record; overrides are persisted on the knowledge metadata and merged with KB defaults via `ResolveProcessConfig`.
|
||||
- **NEW**: **`weknora` CLI v0.9** (BREAKING) — auth/profile model harmonization, resource-command cleanup, and bundled Agent Skills:
|
||||
- **Bundled skills**: `weknora-rag-search` and `weknora-shared` skills ship in-tree with drift-guard parity tests.
|
||||
- **NEW**: **`academy` CLI v0.9** (BREAKING) — auth/profile model harmonization, resource-command cleanup, and bundled Agent Skills:
|
||||
- **Bundled skills**: `academy-rag-search` and `academy-shared` skills ship in-tree with drift-guard parity tests.
|
||||
- **`session stop`**: abort an in-flight agent run from the terminal.
|
||||
- **`--kb` resolver**: accepts KB name or id on `doc delete --all` and `search chunks` / `search docs` (required; no silent project-link fallback).
|
||||
- **Auth/profile**: `auth login` authenticates the active profile (use `profile add --use` first); `auth logout` / `auth refresh` drop `--name` — target another profile with global `--profile`.
|
||||
@@ -523,7 +523,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
- **NEW**: **System Admin & Platform Settings** — system-admin bootstrap/promotion with revocation safeguards, a consolidated single Settings panel merging system admin and settings, a platform audit log with polished audit drawers, and server-side system settings management.
|
||||
- **NEW**: **New-User Onboarding Guide** — an interactive spotlight/tour (`NewUserGuide`) with contextual guides for agent and knowledge-base creation, tenant-model-readiness hints, login hints for new users, and an improved backdrop/hole calculation, integrated into the user menu.
|
||||
- **NEW**: **Settings UI redesign** — model cards with type badges, redesigned vector-store / parser / storage-engine cards, redesigned web-search / MCP provider cards, brand logos replacing monogram badges, regrouped sidebar nav with a header pinned on scroll, and vector-store test moved into the card menu with a toast result.
|
||||
- **NEW**: **`weknora` CLI v0.7 / v0.8** (BREAKING) — agent-first wire contract and command-surface cleanup:
|
||||
- **NEW**: **`academy` CLI v0.7 / v0.8** (BREAKING) — agent-first wire contract and command-surface cleanup:
|
||||
- **Command-surface rename**: `session ask`, `session continue-stream`, `doc fetch`, `doc create`, `doc delete --all`; `context` CRUD replaced by a `profile` cascade (`context` → `profile`); `agent invoke` / `kb empty` removed.
|
||||
- **`--format json` is now the default** with an NDJSON event stream (one JSON event per line) and symmetric envelope infrastructure.
|
||||
- **Agent safety nets**: `--dry-run` with risk metadata and validation parity across 19 mutations; `MCP Tool.Annotations` added to 10 tools (spec 2025-06-18).
|
||||
@@ -600,15 +600,15 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
|
||||
### New Features
|
||||
|
||||
- **NEW**: **Tenant RBAC (Role-Based Access Control)** — the headline of this release (#1303). WeKnora now enforces a per-tenant role matrix on every mutating route, with per-KB resource ownership. Highlights:
|
||||
- **NEW**: **Tenant RBAC (Role-Based Access Control)** — the headline of this release (#1303). Academy now enforces a per-tenant role matrix on every mutating route, with per-KB resource ownership. Highlights:
|
||||
- **4-tier role matrix**: `Owner` (one per tenant; can additionally delete the tenant) ⊃ `Admin` ⊃ `Contributor` (full owner of own resources, read-only on others) ⊃ `Viewer` (read-only). Two exceptions: cross-tenant superuser (`User.CanAccessAllTenants=true`) is implicit Admin in any tenant they switch into; API-Key-synthesized virtual users are pinned Admin in their owning tenant.
|
||||
- **Per-KB resource ownership**: `chunk → knowledge → kb → creator_id`; same chain applies to FAQ entries, generated questions, KB tags and wiki pages. `custom_agents.creator_id` + `custom_agents.runnable_by_viewer` (default true) control agent ownership and viewer-callability.
|
||||
- **Two guard families**: role guards (`Viewer()` / `Contributor()` / `Admin()` / `Owner()`) for tenant-level infra (models, vector stores, IM channels, …) and ownership guards (`OwnedKBOrAdmin()`, `OwnedAgentOrAdmin()`, `OwnedChunkKBOrAdmin()`, …) for resource writes. KB-access guard wired at the route layer for chunk / knowledge / knowledgebase routes (no per-handler helpers).
|
||||
- **Tenant members**: invite / remove / role-change endpoints; new `/leave` endpoint; per-tenant audit log with daily retention sweep (default 90 days, `audit_logs.created_at` indexed); `tenant_members` table now drives membership (lifted from per-user to per-tenant in Plan 3); cross-tenant share managed by source-tenant Admin+.
|
||||
- **Configurable**: `tenant.enable_rbac` (default `true`); `false` enters an "audit-only" grace window. New env knobs `WEKNORA_TENANT_ENABLE_RBAC`, `WEKNORA_TENANT_MAX_PER_USER`. RBAC state logged at startup. See [Authentication and authorization](./website-docs/03-features/01-tenant-auth.md).
|
||||
- **Configurable**: `tenant.enable_rbac` (default `true`); `false` enters an "audit-only" grace window. New env knobs `ACADEMY_TENANT_ENABLE_RBAC`, `ACADEMY_TENANT_MAX_PER_USER`. RBAC state logged at startup. See [Authentication and authorization](./website-docs/03-features/01-tenant-auth.md).
|
||||
- **NEW**: **Tenant Member Management & Multi-Workspace UX** — invite-only gate, member listing UI with role chips, tenant identity surfaces reworked; tenant switcher in the user menu; tenant switch always redirects to KB list and clears tenant-scoped client state; last-active workspace persisted across logins; pending invitations dialog with polling + global invitation bell; rich workspace-aware notifications on login / tenant switch (raw-message handling, styled chips, survives page reload); QuickNav entry for members; "leave workspace" surfaced in i18n.
|
||||
- **NEW**: **Self-Service Workspaces** — any user can create their own tenant (capped per user via env knob); creation dialog with i18n; tenant name + description editable inline; cross-tenant superuser mirrored as Admin role chip in the UI.
|
||||
- **NEW**: **`weknora` CLI v0.3 / v0.4 (GA)** — graduates from preview to GA with comprehensive verb-noun subtree coverage:
|
||||
- **NEW**: **`academy` CLI v0.3 / v0.4 (GA)** — graduates from preview to GA with comprehensive verb-noun subtree coverage:
|
||||
- `agent` subtree: list / view / invoke / check / status / edit / delete / create (full agent CRUD with config rendering).
|
||||
- `chunk` subtree: list / view / delete (with curation rationale).
|
||||
- `session` subtree: list / view / delete.
|
||||
@@ -618,7 +618,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
- `auth`: new `refresh` and `token` verbs; transparent 401 retry transport.
|
||||
- `context` CRUD: add / list / remove / use.
|
||||
- `link` / `unlink` for project-level KB binding.
|
||||
- `mcp serve` — curated stdio MCP server so AI clients (Claude Code, Cursor, …) can drive WeKnora directly; includes MCP `chunk_list` tool.
|
||||
- `mcp serve` — curated stdio MCP server so AI clients (Claude Code, Cursor, …) can drive Academy directly; includes MCP `chunk_list` tool.
|
||||
- **Globals**: `--format`, `--json` field-select, `--jq`, `--paginate`, `--all-pages` (canonical catch-up), `--input`, `--log-level`, `--from-url`, NDJSON output, bare-JSON output path, signal-aware contexts.
|
||||
- **Removed**: envelope infrastructure (errors → stderr); `--dry-run`; `internal/agent` aiclient package; v0.0 scaffolding.
|
||||
- **NEW**: **KB Retrieval Fan-out Across Vector Stores** — a single KB can now bind to multiple vector stores; retrieval engine fans out queries across all bound stores and merges results. KB editor validates bindings on create / copy / delete. Retriever resolution introduces a factory pattern for KB-scoped engine selection.
|
||||
@@ -628,7 +628,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
- **NEW**: **Huawei Cloud OBS** object storage joins Local / MinIO / AWS S3 / Volcengine TOS / Alibaba Cloud OSS / Kingsoft Cloud KS3 / Huawei OBS.
|
||||
- **NEW**: **vLLM URL configuration for MinerU** doc parser.
|
||||
- **NEW**: **Apache Doris compatibility modes** — configurable Doris compat modes with mode-switch guards.
|
||||
- **NEW**: **Docreader image URL whitelist** — trusted URLs can be served as-is without re-uploading into WeKnora storage.
|
||||
- **NEW**: **Docreader image URL whitelist** — trusted URLs can be served as-is without re-uploading into Academy storage.
|
||||
- **NEW**: **Server-Side User Preferences** — per-user font / theme / memory-feature toggle persisted on the server; per-user KB pinning replaces tenant-wide pin model; "Shared by me" label across surfaces.
|
||||
- **NEW**: **User favorites & recents** under the user menu.
|
||||
- **NEW**: **`creator_name` on agents and knowledge bases** for visibility across surfaces.
|
||||
@@ -655,7 +655,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
- **IMPROVED**: `agent` exclude processing docs from prompt.
|
||||
- **IMPROVED**: LLM response — guard against empty `choices` and `message=None`.
|
||||
- **IMPROVED**: Configurable API proxy target for frontend dev environment.
|
||||
- **IMPROVED**: `DISABLE_REGISTRATION` now drives `registration_mode` too; removed redundant `WEKNORA_AUTH_REGISTRATION_MODE` env override.
|
||||
- **IMPROVED**: `DISABLE_REGISTRATION` now drives `registration_mode` too; removed redundant `ACADEMY_AUTH_REGISTRATION_MODE` env override.
|
||||
- **IMPROVED**: Tenant RBAC + per-user tenant cap exposed as env knobs.
|
||||
- **IMPROVED**: Auth — JWT `tenant_id` claim honored in middleware; tenant-scoped client state cleared on tenant change.
|
||||
- **IMPROVED**: gin per-route logs silenced; env config banner emitted at startup.
|
||||
@@ -708,13 +708,13 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
## [0.5.2] - 2026-05-13
|
||||
|
||||
### 🚀 New Features
|
||||
- **NEW**: `weknora` CLI v0.2 — the official command-line client lives under `cli/`. Mirrors the `gh` CLI `<noun> <verb>` convention with 10 top-level commands (`api`, `auth`, `chat`, `context`, `doc`, `doctor`, `kb`, `link`, `search`, `version`). Highlights:
|
||||
- **NEW**: `academy` CLI v0.2 — the official command-line client lives under `cli/`. Mirrors the `gh` CLI `<noun> <verb>` convention with 10 top-level commands (`api`, `auth`, `chat`, `context`, `doc`, `doctor`, `kb`, `link`, `search`, `version`). Highlights:
|
||||
- Hybrid search and streaming RAG chat against any knowledge base.
|
||||
- Project-level binding via `weknora link` writing `.weknora/project.yaml` (vercel/netlify pattern); subcommands auto-resolve `--kb` from the link.
|
||||
- Project-level binding via `academy link` writing `.academy/project.yaml` (vercel/netlify pattern); subcommands auto-resolve `--kb` from the link.
|
||||
- Stable JSON envelope (`{ok, data, error, _meta, dry_run, risk}`) on every `--json` invocation; closed error-code registry enforced by an AST scanner test.
|
||||
- Agent affordance: `--dry-run` for write commands, exit-code 10 + `input.confirmation_required` for non-interactive destructive writes, per-command "AI agents:" guidance auto-shown when CLAUDECODE / CURSOR_AGENT is set. Operational contract in `cli/AGENTS.md`.
|
||||
- Multi-context auth (`login` / `logout` / `list` / `status`), OS keyring + 0600 file fallback for credentials, both API-key and password (JWT) modes.
|
||||
- Health check via `weknora doctor` (4 statuses: ok / warn / fail / skip).
|
||||
- Health check via `academy doctor` (4 statuses: ok / warn / fail / skip).
|
||||
- See `cli/README.md` for install + 5-minute quickstart.
|
||||
- **NEW**: Adaptive 3-tier chunking — documents are now profiled before splitting and routed to one of three strategies: heading-aware (Markdown structure), heuristic (form-feeds, multilingual chapter markers DE/EN/ZH, all-caps titles, visual separators), or recursive (the modernized legacy splitter as a fallback). Auto-strategy is the new default for fresh KBs; existing KBs keep their previous behavior until the user opts in. See [Chunking](./website-docs/03-features/04-chunking.md).
|
||||
- **NEW**: Human-in-the-loop approval for MCP tool calls (#1173) — when an MCP tool is marked sensitive, the agent now pauses and surfaces a `ToolApprovalCard` in the chat UI. Approval state is persisted (so refreshing the page does not lose context), enforced per user, and hardened for concurrent multi-instance deployments. See [MCP integration](./website-docs/03-features/08-mcp.md).
|
||||
@@ -798,7 +798,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
## [0.5.1] - 2026-04-30
|
||||
|
||||
### 🚀 New Features
|
||||
- **NEW**: WeChat Mini Program — added a lightweight mobile client (`miniprogram/`) for configuring WeKnora API access, selecting knowledge bases, importing URLs, and chatting from inside WeChat, extending WeKnora from desktop to mobile.
|
||||
- **NEW**: WeChat Mini Program — added a lightweight mobile client (`miniprogram/`) for configuring Academy API access, selecting knowledge bases, importing URLs, and chatting from inside WeChat, extending Academy from desktop to mobile.
|
||||
- **NEW**: Knowledge Base — document list view with multi-select, floating batch action bar, and batch delete to streamline managing large knowledge bases.
|
||||
- **NEW**: IM — tenant-wide IM Channels Overview entry under the user menu so administrators can inspect every IM channel of the tenant from a single page.
|
||||
- **NEW**: Sessions — keyword search across the conversation list, user-scoped pinning of important sessions, and clear IM-source visibility for chats originating from IM channels.
|
||||
@@ -873,11 +873,11 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
## [0.4.0] - 2026-04-14
|
||||
|
||||
### 🚀 New Features
|
||||
- **NEW**: Cloud Knowledge Assistant — [WeKnora Platform](https://weknora.weixin.qq.com/platform), a cloud-hosted knowledge assistant service for quick onboarding without local deployment
|
||||
- **NEW**: WeKnora Cloud — WeKnora Cloud provider integration, providing hosted LLM models and document parsing capabilities, with credential management, status checks, and UI feedback
|
||||
- **NEW**: Cloud Knowledge Assistant — [Academy Platform](https://weknora.weixin.qq.com/platform), a cloud-hosted knowledge assistant service for quick onboarding without local deployment
|
||||
- **NEW**: Academy Cloud — Academy Cloud provider integration, providing hosted LLM models and document parsing capabilities, with credential management, status checks, and UI feedback
|
||||
- **NEW**: Chrome Extension — browser extension support with menu entry and quick access integration for seamless knowledge capture from web pages
|
||||
- **NEW**: WeChat IM Integration — WeChat channel adapter with QR code login and long-polling message support
|
||||
- **NEW**: ClawHub Skill — WeKnora Skill published on ClawHub platform, enabling document import, hybrid search, and knowledge management via the WeKnora REST API
|
||||
- **NEW**: ClawHub Skill — Academy Skill published on ClawHub platform, enabling document import, hybrid search, and knowledge management via the Academy REST API
|
||||
- **NEW**: Attachment Processing — file attachment support in chat pipeline with enhanced error handling, content formatting, and image/attachment metadata injection in queries
|
||||
- **NEW**: Azure OpenAI Provider — full Azure OpenAI support for chat, VLM, and embedding models with deployment name preservation, configurable dimensions parameter, provider registration with metadata, URL auto-detection, and frontend provider integration with i18n
|
||||
- **NEW**: Alibaba Cloud OSS Storage — object storage support via S3-compatible mode with configuration UI, connectivity test, status reporting, OSS TypeScript types, docreader OssStorage class, factory and container registration, and multi-language i18n (Korean, Russian)
|
||||
@@ -914,7 +914,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
### 🔧 Refactoring
|
||||
- Replaced CryptoService with lightweight utils AES helpers, simplifying encryption logic across the codebase
|
||||
- Optimized OSS storage initialization, URL formatting, and security handling for improved S3 compatibility
|
||||
- Enhanced WeKnora Cloud internationalization and UI feedback for credential management operations
|
||||
- Enhanced Academy Cloud internationalization and UI feedback for credential management operations
|
||||
|
||||
### 📚 Documentation
|
||||
- Added VectorStore CRUD API endpoint documentation with Swagger annotations
|
||||
@@ -938,7 +938,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
- Refined parent-child chunk replacement logic to only apply to text chunks whose parent is a parent_text chunk
|
||||
- Optimized login page rendering performance: removed all backdrop-filter blur, reduced animated elements, added GPU compositing hints and prefers-reduced-motion support
|
||||
- Unified NVIDIA API for both chat and VLM model types
|
||||
- Prompt language fallback now uses WEKNORA_LANGUAGE environment variable instead of hardcoded zh-CN, with language propagated through document and image processing pipelines
|
||||
- Prompt language fallback now uses ACADEMY_LANGUAGE environment variable instead of hardcoded zh-CN, with language propagated through document and image processing pipelines
|
||||
- Fixed enable_thinking for Aliyun Qwen models in streaming mode
|
||||
- Enhanced document processing with metadata extraction and handling
|
||||
- Added header tracking for Markdown tables during chunking to preserve table context
|
||||
@@ -1277,7 +1277,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
- Enhanced KnowledgeQAStream parameters
|
||||
- Support for streaming response types and tool calls
|
||||
- **NEW**: System & Configuration
|
||||
- Added `WEKNORA_VERSION` environment variable support
|
||||
- Added `ACADEMY_VERSION` environment variable support
|
||||
- APK mirror configuration support in Docker
|
||||
- Enhanced chunking separator options
|
||||
- FAQ two-level priority tag filtering
|
||||
@@ -1488,7 +1488,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
- **NEW**: Qdrant Vector Database Support
|
||||
- Full integration with Qdrant as retriever engine
|
||||
- Support for both vector similarity search and full-text keyword search
|
||||
- Dynamic collection creation based on embedding dimensions (e.g., `weknora_embeddings_768`)
|
||||
- Dynamic collection creation based on embedding dimensions (e.g., `academy_embeddings_768`)
|
||||
- Multilingual tokenizer support for Chinese/Japanese/Korean text search
|
||||
- Professional Chinese word segmentation using jieba for keyword queries
|
||||
|
||||
@@ -1737,7 +1737,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
- Improved initialization configuration handling
|
||||
|
||||
### 🛡️ Security Recommendations
|
||||
- Deploy WeKnora services in internal/private network environments
|
||||
- Deploy Academy services in internal/private network environments
|
||||
- Avoid direct exposure to public internet
|
||||
- Configure proper firewall rules and access controls
|
||||
- Regular updates for security patches and improvements
|
||||
@@ -1755,7 +1755,7 @@ Changes since v0.8.2, through upstream main `31c605568` (2026-10-13; 282 commits
|
||||
|
||||
## [0.1.0] - 2025-09-08
|
||||
|
||||
- Initial public release of WeKnora.
|
||||
- Initial public release of Academy.
|
||||
- Web UI for knowledge upload, chat, configuration, and settings.
|
||||
- RAG pipeline with chunking, embedding, retrieval, reranking, and generation.
|
||||
- Initialization wizard for configuring models (LLM, embedding, rerank, retriever).
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class WeknoraLite < Formula
|
||||
class AcademyLite < Formula
|
||||
desc "Knowledge base management system — single-binary Lite edition"
|
||||
homepage "https://github.com/Tencent/WeKnora"
|
||||
version "0.3.6-test"
|
||||
@@ -6,38 +6,38 @@ class WeknoraLite < Formula
|
||||
|
||||
on_macos do
|
||||
on_arm do
|
||||
url "https://github.com/Tencent/WeKnora/releases/download/v#{version}/WeKnora-lite_v#{version}_darwin_arm64.tar.gz"
|
||||
url "https://github.com/Tencent/WeKnora/releases/download/v#{version}/Academy-lite_v#{version}_darwin_arm64.tar.gz"
|
||||
sha256 "1da2d4eef99e5cf8aa7a58501baa059e9e20482e1bd65a36a82321a89926c104"
|
||||
end
|
||||
on_intel do
|
||||
url "https://github.com/Tencent/WeKnora/releases/download/v#{version}/WeKnora-lite_v#{version}_darwin_amd64.tar.gz"
|
||||
url "https://github.com/Tencent/WeKnora/releases/download/v#{version}/Academy-lite_v#{version}_darwin_amd64.tar.gz"
|
||||
sha256 "c187e16ac7671a615f012c82ebd89786e11fcf67cccc773eff175e4bdf7c9c06"
|
||||
end
|
||||
end
|
||||
|
||||
on_linux do
|
||||
on_arm do
|
||||
url "https://github.com/Tencent/WeKnora/releases/download/v#{version}/WeKnora-lite_v#{version}_linux_arm64.tar.gz"
|
||||
url "https://github.com/Tencent/WeKnora/releases/download/v#{version}/Academy-lite_v#{version}_linux_arm64.tar.gz"
|
||||
sha256 "bc4e184da005b60d1e8c037a61c58e643ebdc9bf14470fae6cd6227f52f02f1c"
|
||||
end
|
||||
on_intel do
|
||||
url "https://github.com/Tencent/WeKnora/releases/download/v#{version}/WeKnora-lite_v#{version}_linux_amd64.tar.gz"
|
||||
url "https://github.com/Tencent/WeKnora/releases/download/v#{version}/Academy-lite_v#{version}_linux_amd64.tar.gz"
|
||||
sha256 "cb34c50fb5b05555fca16084ffc7710524ff78badb3b1b82474eb89d21545d6e"
|
||||
end
|
||||
end
|
||||
|
||||
def install
|
||||
libexec.install "WeKnora-lite"
|
||||
libexec.install "Academy-lite"
|
||||
pkgshare.install "web" if File.directory?("web")
|
||||
pkgshare.install "config" if File.directory?("config")
|
||||
pkgshare.install ".env.lite.example"
|
||||
doc.install "README.md"
|
||||
pkgshare.install "migrations" if File.directory?("migrations")
|
||||
|
||||
(bin/"weknora-lite").write <<~SH
|
||||
(bin/"academy-lite").write <<~SH
|
||||
#!/bin/bash
|
||||
CONFIG_DIR="${WEKNORA_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/weknora}"
|
||||
DATA_DIR="${WEKNORA_DATA_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/weknora}"
|
||||
CONFIG_DIR="${ACADEMY_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/academy}"
|
||||
DATA_DIR="${ACADEMY_DATA_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/academy}"
|
||||
|
||||
mkdir -p "$DATA_DIR/files" "$CONFIG_DIR/config" 2>/dev/null
|
||||
|
||||
@@ -51,7 +51,7 @@ class WeknoraLite < Formula
|
||||
|
||||
if [ ! -f "$CONFIG_DIR/.env.lite" ]; then
|
||||
cp "#{pkgshare}/.env.lite.example" "$CONFIG_DIR/.env.lite"
|
||||
sed -i '' "s|DB_PATH=.*|DB_PATH=$DATA_DIR/weknora.db|" "$CONFIG_DIR/.env.lite"
|
||||
sed -i '' "s|DB_PATH=.*|DB_PATH=$DATA_DIR/academy.db|" "$CONFIG_DIR/.env.lite"
|
||||
sed -i '' "s|LOCAL_STORAGE_BASE_DIR=.*|LOCAL_STORAGE_BASE_DIR=$DATA_DIR/files|" "$CONFIG_DIR/.env.lite"
|
||||
rm -f "$CONFIG_DIR/.env.lite-e"
|
||||
echo ""
|
||||
@@ -64,55 +64,55 @@ class WeknoraLite < Formula
|
||||
source "$CONFIG_DIR/.env.lite"
|
||||
set +a
|
||||
|
||||
export DB_PATH="${DB_PATH:-$DATA_DIR/weknora.db}"
|
||||
export DB_PATH="${DB_PATH:-$DATA_DIR/academy.db}"
|
||||
export LOCAL_STORAGE_BASE_DIR="${LOCAL_STORAGE_BASE_DIR:-$DATA_DIR/files}"
|
||||
export WEKNORA_WEB_DIR="${WEKNORA_WEB_DIR:-#{pkgshare}/web}"
|
||||
export ACADEMY_WEB_DIR="${ACADEMY_WEB_DIR:-#{pkgshare}/web}"
|
||||
|
||||
cd "$CONFIG_DIR"
|
||||
exec "#{libexec}/WeKnora-lite" "$@"
|
||||
exec "#{libexec}/Academy-lite" "$@"
|
||||
SH
|
||||
end
|
||||
|
||||
def post_install
|
||||
(var/"weknora").mkpath
|
||||
(var/"academy").mkpath
|
||||
(var/"log").mkpath
|
||||
end
|
||||
|
||||
service do
|
||||
run [bin/"weknora-lite"]
|
||||
run [bin/"academy-lite"]
|
||||
keep_alive true
|
||||
working_dir var/"weknora"
|
||||
log_path var/"log/weknora-lite.log"
|
||||
error_log_path var/"log/weknora-lite.log"
|
||||
working_dir var/"academy"
|
||||
log_path var/"log/academy-lite.log"
|
||||
error_log_path var/"log/academy-lite.log"
|
||||
end
|
||||
|
||||
def caveats
|
||||
<<~EOS
|
||||
前台运行:
|
||||
weknora-lite
|
||||
academy-lite
|
||||
|
||||
后台服务(推荐):
|
||||
brew services start weknora-lite # 启动并开机自启
|
||||
brew services stop weknora-lite # 停止
|
||||
brew services restart weknora-lite # 重启
|
||||
brew services info weknora-lite # 查看状态
|
||||
brew services start academy-lite # 启动并开机自启
|
||||
brew services stop academy-lite # 停止
|
||||
brew services restart academy-lite # 重启
|
||||
brew services info academy-lite # 查看状态
|
||||
|
||||
日志:
|
||||
#{var}/log/weknora-lite.log
|
||||
#{var}/log/academy-lite.log
|
||||
|
||||
首次运行会自动创建配置文件:
|
||||
~/.config/weknora/.env.lite
|
||||
~/.config/academy/.env.lite
|
||||
|
||||
数据存储在:
|
||||
~/.local/share/weknora/
|
||||
~/.local/share/academy/
|
||||
|
||||
如需修改配置(LLM 服务地址、安全密钥等):
|
||||
$EDITOR ~/.config/weknora/.env.lite
|
||||
brew services restart weknora-lite
|
||||
$EDITOR ~/.config/academy/.env.lite
|
||||
brew services restart academy-lite
|
||||
EOS
|
||||
end
|
||||
|
||||
test do
|
||||
assert_predicate bin/"weknora-lite", :executable?
|
||||
assert_predicate bin/"academy-lite", :executable?
|
||||
end
|
||||
end
|
||||
@@ -1,10 +1,10 @@
|
||||
Tencent is pleased to support the open source community by making WeKnora available.
|
||||
Tencent is pleased to support the open source community by making Academy available.
|
||||
|
||||
Copyright (C) 2026 Tencent. All rights reserved.
|
||||
|
||||
The open-source software included in this distribution may have been modified by Tencent (“Tencent Modifications”). All Tencent Modifications are Copyright (C) Tencent.
|
||||
|
||||
WeKnora is licensed under the MIT except for the third-party components listed below.
|
||||
Academy is licensed under the MIT except for the third-party components listed below.
|
||||
|
||||
|
||||
Terms of the MIT:
|
||||
@@ -31,7 +31,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Dependencies and Licenses:
|
||||
|
||||
This open-source project, WeKnora, builds upon the following open-source software components, each of which remains licensed under its original license. Certain software may include modifications made by Tencent (“Tencent Modifications”), which are Copyright (C) Tencent.
|
||||
This open-source project, Academy, builds upon the following open-source software components, each of which remains licensed under its original license. Certain software may include modifications made by Tencent (“Tencent Modifications”), which are Copyright (C) Tencent.
|
||||
|
||||
In case you believe there have been errors in the attribution below, you may submit the concerns to us for review and correction.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Show help
|
||||
help:
|
||||
@echo "WeKnora Makefile 帮助"
|
||||
@echo "Academy Makefile 帮助"
|
||||
@echo ""
|
||||
@echo "基础命令:"
|
||||
@echo " build 构建应用"
|
||||
@@ -73,7 +73,7 @@ help:
|
||||
@echo " package-mac-app 构建并打包 macOS 桌面应用 (.app)"
|
||||
|
||||
# Go related variables
|
||||
BINARY_NAME=WeKnora
|
||||
BINARY_NAME=Academy
|
||||
MAIN_PATH=./cmd/server
|
||||
|
||||
# Docker related variables
|
||||
@@ -289,7 +289,7 @@ build-prod:
|
||||
CGO_LDFLAGS="$$(if [ "$$(uname)" = 'Darwin' ]; then echo '-Wl,-no_warn_duplicate_libraries'; fi)" \
|
||||
BUILD_TIME=$${BUILD_TIME:-unknown}; \
|
||||
GO_VERSION=$${GO_VERSION:-unknown}; \
|
||||
LDFLAGS="-X 'github.com/Tencent/WeKnora/internal/handler.Version=$$VERSION' -X 'github.com/Tencent/WeKnora/internal/handler.Edition=standard' -X 'github.com/Tencent/WeKnora/internal/handler.CommitID=$$COMMIT_ID' -X 'github.com/Tencent/WeKnora/internal/handler.BuildTime=$$BUILD_TIME' -X 'github.com/Tencent/WeKnora/internal/handler.GoVersion=$$GO_VERSION' -X 'google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn'"; \
|
||||
LDFLAGS="-X 'academy/internal/handler.Version=$$VERSION' -X 'academy/internal/handler.Edition=standard' -X 'academy/internal/handler.CommitID=$$COMMIT_ID' -X 'academy/internal/handler.BuildTime=$$BUILD_TIME' -X 'academy/internal/handler.GoVersion=$$GO_VERSION' -X 'google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn'"; \
|
||||
go build -tags "$(GO_BUILD_TAGS)" -ldflags="-w -s $$LDFLAGS" -o $(BINARY_NAME) $(MAIN_PATH)
|
||||
|
||||
# Build Lite version (single binary, SQLite + in-memory queue)
|
||||
@@ -330,14 +330,14 @@ download_spatial:
|
||||
|
||||
clean-db:
|
||||
@echo "Cleaning database..."
|
||||
@if [ $$(docker volume ls -q -f name=weknora_postgres-data) ]; then \
|
||||
docker volume rm weknora_postgres-data; \
|
||||
@if [ $$(docker volume ls -q -f name=academy_postgres-data) ]; then \
|
||||
docker volume rm academy_postgres-data; \
|
||||
fi
|
||||
@if [ $$(docker volume ls -q -f name=weknora_minio_data) ]; then \
|
||||
docker volume rm weknora_minio_data; \
|
||||
@if [ $$(docker volume ls -q -f name=academy_minio_data) ]; then \
|
||||
docker volume rm academy_minio_data; \
|
||||
fi
|
||||
@if [ $$(docker volume ls -q -f name=weknora_redis_data) ]; then \
|
||||
docker volume rm weknora_redis_data; \
|
||||
@if [ $$(docker volume ls -q -f name=academy_redis_data) ]; then \
|
||||
docker volume rm academy_redis_data; \
|
||||
fi
|
||||
|
||||
# Environment check
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<a href="https://weknora.weixin.qq.com">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/images/readme/hero-en-dark.svg">
|
||||
<img src="./docs/images/readme/hero-en-light.svg" alt="WeKnora: find the answers, and put knowledge to work. Tencent's open-source knowledge management framework for Q&A, tasks and wikis." width="100%">
|
||||
<img src="./docs/images/readme/hero-en-light.svg" alt="Academy: find the answers, and put knowledge to work. Tencent's open-source knowledge management framework for Q&A, tasks and wikis." width="100%">
|
||||
</picture>
|
||||
</a>
|
||||
</p>
|
||||
@@ -17,7 +17,7 @@
|
||||
<a href="https://chatbot.weixin.qq.com"><img alt="WeChat Dialog Open Platform" src="https://img.shields.io/badge/WeChat_Dialog-Open_Platform-07c160?style=flat-square&labelColor=101f38&logo=wechat&logoColor=white"></a>
|
||||
<a href="https://chromewebstore.google.com/detail/jpemjbopikggjlmikmclgbmkhhopjdgd"><img alt="Chrome Extension" src="https://img.shields.io/badge/Chrome-extension-4285f4?style=flat-square&labelColor=101f38&logo=googlechrome&logoColor=white"></a>
|
||||
<a href="https://clawhub.ai/lyingbug/weknora"><img alt="ClawHub Skill" src="https://img.shields.io/badge/ClawHub-skill-ff6b35?style=flat-square&labelColor=101f38"></a>
|
||||
<a href="https://www.npmjs.com/package/@wxg-prc-cpg/dsh-weknora"><img alt="npm @wxg-prc-cpg/dsh-weknora" src="https://img.shields.io/npm/v/@wxg-prc-cpg/dsh-weknora?style=flat-square&label=dsh-weknora&labelColor=101f38&color=cb3837&logo=npm&logoColor=white"></a>
|
||||
<a href="https://www.npmjs.com/package/@wxg-prc-cpg/dsh-academy"><img alt="npm @wxg-prc-cpg/dsh-academy" src="https://img.shields.io/npm/v/@wxg-prc-cpg/dsh-academy?style=flat-square&label=dsh-academy&labelColor=101f38&color=cb3837&logo=npm&logoColor=white"></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
## Overview
|
||||
|
||||
[WeKnora](https://weknora.weixin.qq.com) is an open-source, LLM-powered knowledge framework for enterprise document understanding, semantic retrieval and reasoning. It brings a team's documents together so they can be searched, reasoned over and kept up to date.
|
||||
[Academy](https://weknora.weixin.qq.com) is an open-source, LLM-powered knowledge framework for enterprise document understanding, semantic retrieval and reasoning. It brings a team's documents together so they can be searched, reasoned over and kept up to date.
|
||||
|
||||
https://github.com/user-attachments/assets/5722b10d-d04d-49ed-a6cc-635a8c77d91f
|
||||
|
||||
@@ -79,7 +79,7 @@ Beyond the three modes:
|
||||
<img src="./website-docs/homepage/public/docs/_home/brands/tencent-cloud.ico" width="28" height="28" alt=""><br/>
|
||||
<sub>CLOUD</sub><br/>
|
||||
<b>Tencent Cloud Lighthouse</b><br/>
|
||||
Deploy WeKnora from an application template and run it on your own cloud server.<br/><br/>
|
||||
Deploy Academy from an application template and run it on your own cloud server.<br/><br/>
|
||||
<a href="https://mc.tencent.com/s69nKCVz">Deploy on Tencent Cloud →</a>
|
||||
</td>
|
||||
<td width="33%" valign="top">
|
||||
@@ -98,7 +98,7 @@ Requires [Docker](https://www.docker.com/), [Docker Compose](https://docs.docker
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Tencent/WeKnora.git
|
||||
cd WeKnora
|
||||
cd Academy
|
||||
cp .env.example .env # Edit .env as needed, see comments in the file
|
||||
docker compose pull # Pull the latest images
|
||||
docker compose up -d # Start core services
|
||||
@@ -135,11 +135,11 @@ docker compose down # Stop services
|
||||
|
||||
### Upgrading
|
||||
|
||||
If you already have WeKnora running and downloaded a newer release:
|
||||
If you already have Academy running and downloaded a newer release:
|
||||
|
||||
```bash
|
||||
# Set WEKNORA_VERSION in .env to the target release (e.g. 0.8.3), or keep latest
|
||||
docker compose pull # Pull images matching WEKNORA_VERSION
|
||||
# Set ACADEMY_VERSION in .env to the target release (e.g. 0.8.3), or keep latest
|
||||
docker compose pull # Pull images matching ACADEMY_VERSION
|
||||
docker compose up -d # Recreate containers with new images
|
||||
```
|
||||
|
||||
@@ -158,7 +158,7 @@ docker compose up -d # Recreate containers with new images
|
||||
All options, hardware requirements and deployment topologies: [Installation guide](https://weknora.weixin.qq.com/docs/01-getting-started/02-installation).
|
||||
|
||||
> [!WARNING]
|
||||
> WeKnora ships with login authentication, but for production deployments we strongly recommend that you:
|
||||
> Academy ships with login authentication, but for production deployments we strongly recommend that you:
|
||||
> - deploy it in an internal / private network rather than on the public internet;
|
||||
> - avoid exposing the service directly to public networks, to prevent information leakage;
|
||||
> - configure proper firewall rules and access controls for the deployment environment;
|
||||
@@ -196,7 +196,7 @@ Agents can operate the browser on your computer, knowledge bases can be publishe
|
||||
- **Tenant skill catalog**: install from ClawHub / SkillHub / git / zip, with per-sandbox snapshots, live progress, file browse/edit, and personal and workspace env vars.
|
||||
- **Cross-session long-term memory**: profile / preference / fact / task / interest, auto-extracted with user confirmation, plus `search_memory`.
|
||||
- **Parsing and sources**: in-process anydoc office parser; GitLab and Tencent IMA data sources; XMind parsing.
|
||||
- **Ecosystem**: official DeepSeek Harness plugin `@wxg-prc-cpg/dsh-weknora`; LiteLLM; Exa and Metaso web search.
|
||||
- **Ecosystem**: official DeepSeek Harness plugin `@wxg-prc-cpg/dsh-academy`; LiteLLM; Exa and Metaso web search.
|
||||
- **Chat**: chat artifacts, question outline and timestamps; context compaction and provider prompt-cache markers.
|
||||
- **Security**: OIDC JWKS verification, optional complex passwords, document auto-tagging, and broad sandbox/security hardening.
|
||||
|
||||
@@ -207,15 +207,15 @@ Agents can operate the browser on your computer, knowledge bases can be publishe
|
||||
|
||||
- **v0.7.2** — Product documentation site; knowledge base folder tree; chunk editing with revision history; wiki page revisions; directly loadable file URLs (`resource_urls=public`); Feishu Drive data source; batch tagging; MCP Server 1.1 (29 tools); AWS S3 default credential chain.
|
||||
- **v0.7.1** — Yunzhijia IM; Volcengine rerank; Zhipu AI web search; platform-scoped API keys; per-KB activity audit; FAQ filtering, tagging and export; Langfuse OTLP tracing; one-click Markdown export.
|
||||
- **v0.7.0** — Scoped API keys and principal model; task-queue dashboard and worker-pool governance; multiple storage instances per workspace; temporary chat attachments; `@Skill / @MCP` mentions; mid-conversation MCP OAuth; QQBot and Lark IM; Redis TLS; `weknora` CLI v0.10.
|
||||
- **v0.7.0** — Scoped API keys and principal model; task-queue dashboard and worker-pool governance; multiple storage instances per workspace; temporary chat attachments; `@Skill / @MCP` mentions; mid-conversation MCP OAuth; QQBot and Lark IM; Redis TLS; `academy` CLI v0.10.
|
||||
- **v0.6.3** — Website embed widget & Integrations Center (secure-mode token exchange + rate limits); chat experience overhaul (citation popovers, RAG pipeline progress, streaming markdown); document multi-tag & batch reparse; Wiki folders & hierarchy navigation; RSS data source; MCP OAuth2; EPUB / MHTML parsing; agent model-readiness checks; model test debugger; session source filter; workspace deletion UI.
|
||||
- **v0.6.2** — Per-upload process configuration with upload-confirm dialog; document reparse with `process_config`; `weknora` CLI v0.9 (bundled Agent Skills, `session stop`, auth/profile harmonization); KB marquee multi-select; HNSW index for 1024-dim pgvector embeddings; chat resources store refactor; Langfuse-only tracing (Jaeger removed).
|
||||
- **v0.6.1** — Document parsing trace timeline (Langfuse-style span tree with stage-by-stage progress + stop-parse); OpenSearch vector store driver; declarative built-in models via YAML; system admin & consolidated platform settings + audit log; new-user onboarding guide; settings UI redesign; `weknora` CLI v0.7 / v0.8 (agent-first wire contract, NDJSON, `--dry-run`); OpenDataLoader + PaddleOCR-VL parsers; MCP server multi-transport (stdio / SSE / HTTP); per-model thinking-mode config; Tencent LKEAP rerank + native Gemini embeddings + MiniMax-M3.
|
||||
- **v0.6.0** — Workspace RBAC (4-tier role matrix `Owner` / `Admin` / `Contributor` / `Viewer` + per-KB ownership + per-workspace audit log), workspace member management & multi-workspace UX, self-service workspaces; `weknora` CLI v0.4 GA with `mcp serve`; KB retrieval fan-out across vector stores; AES-256-GCM credential encryption + docreader gRPC TLS + Token; Zhipu embedder + Huawei OBS; server-side user preferences; Go 1.26.0. See [Tenants & auth](https://weknora.weixin.qq.com/docs/03-features/01-tenant-auth).
|
||||
- **v0.5.2** — Wiki ingest scales to 40k-document KBs (task queue + DLQ); MCP human-in-the-loop tool approval; Anthropic / Apache Doris / Tencent VectorDB / KS3 / SearXNG backends; adaptive 3-tier chunking with live preview; global ⌘K command palette; Yuque connector + WeChat Mini Program; `weknora` CLI preview.
|
||||
- **v0.6.2** — Per-upload process configuration with upload-confirm dialog; document reparse with `process_config`; `academy` CLI v0.9 (bundled Agent Skills, `session stop`, auth/profile harmonization); KB marquee multi-select; HNSW index for 1024-dim pgvector embeddings; chat resources store refactor; Langfuse-only tracing (Jaeger removed).
|
||||
- **v0.6.1** — Document parsing trace timeline (Langfuse-style span tree with stage-by-stage progress + stop-parse); OpenSearch vector store driver; declarative built-in models via YAML; system admin & consolidated platform settings + audit log; new-user onboarding guide; settings UI redesign; `academy` CLI v0.7 / v0.8 (agent-first wire contract, NDJSON, `--dry-run`); OpenDataLoader + PaddleOCR-VL parsers; MCP server multi-transport (stdio / SSE / HTTP); per-model thinking-mode config; Tencent LKEAP rerank + native Gemini embeddings + MiniMax-M3.
|
||||
- **v0.6.0** — Workspace RBAC (4-tier role matrix `Owner` / `Admin` / `Contributor` / `Viewer` + per-KB ownership + per-workspace audit log), workspace member management & multi-workspace UX, self-service workspaces; `academy` CLI v0.4 GA with `mcp serve`; KB retrieval fan-out across vector stores; AES-256-GCM credential encryption + docreader gRPC TLS + Token; Zhipu embedder + Huawei OBS; server-side user preferences; Go 1.26.0. See [Tenants & auth](https://weknora.weixin.qq.com/docs/03-features/01-tenant-auth).
|
||||
- **v0.5.2** — Wiki ingest scales to 40k-document KBs (task queue + DLQ); MCP human-in-the-loop tool approval; Anthropic / Apache Doris / Tencent VectorDB / KS3 / SearXNG backends; adaptive 3-tier chunking with live preview; global ⌘K command palette; Yuque connector + WeChat Mini Program; `academy` CLI preview.
|
||||
- **v0.5.1** — Knowledge-base batch management; workspace-wide IM channels overview; session search + user-scoped pinning; unified Model / Web Search / MCP settings cards; per-agent LLM timeout; desktop workspace switching.
|
||||
- **v0.5.0** — Wiki Mode GA — agents auto-generate structured, interlinked Markdown wiki pages with a knowledge graph; wiki browser + visual graph in the UI.
|
||||
- **v0.4.0** — WeKnora Cloud (hosted LLM + parsing); Chrome Extension; ClawHub Skill; WeChat IM; attachment processing; Azure OpenAI / Alibaba OSS; Notion connector; Baidu + Ollama web search; VectorStore management.
|
||||
- **v0.4.0** — Academy Cloud (hosted LLM + parsing); Chrome Extension; ClawHub Skill; WeChat IM; attachment processing; Azure OpenAI / Alibaba OSS; Notion connector; Baidu + Ollama web search; VectorStore management.
|
||||
- **v0.3.6** — ASR (audio); Feishu data-source auto-sync; OIDC; IM quote-reply context + thread-based sessions; document summarization; Tavily search; parallel tool calling; agent @mention scope restriction.
|
||||
- **v0.3.5** — Telegram / DingTalk / Mattermost IM; IM slash commands + QA queue; suggested questions; VLM auto-describe MCP tool images; Novita AI; channel tracking.
|
||||
- **v0.3.4** — WeCom / Feishu / Slack IM; multimodal image support; NVIDIA model API; Weaviate; AWS S3; AES-256-GCM API-key encryption; built-in MCP service; hybrid-search optimization; `final_answer` tool.
|
||||
@@ -276,7 +276,7 @@ Full history: [`CHANGELOG.md`](./CHANGELOG.md).
|
||||
|
||||
### Automatic wiki
|
||||
|
||||
**Documents organized into a browsable wiki.** With Wiki enabled, WeKnora extracts people, products and concepts from knowledge-base documents into pages with source citations, organized by directory. The knowledge graph shows how pages relate; pages can be edited directly and every change can be rolled back. [Docs →](https://weknora.weixin.qq.com/docs/03-features/14-wiki)
|
||||
**Documents organized into a browsable wiki.** With Wiki enabled, Academy extracts people, products and concepts from knowledge-base documents into pages with source citations, organized by directory. The knowledge graph shows how pages relate; pages can be edited directly and every change can be rolled back. [Docs →](https://weknora.weixin.qq.com/docs/03-features/14-wiki)
|
||||
|
||||
<a href="./docs/images/readme/spotlight-wiki-light.webp">
|
||||
<picture>
|
||||
@@ -301,7 +301,7 @@ Full history: [`CHANGELOG.md`](./CHANGELOG.md).
|
||||
<a href="./docs/images/readme/architecture-en-light.svg">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/images/readme/architecture-en-dark.svg">
|
||||
<img src="./docs/images/readme/architecture-en-light.svg" alt="WeKnora architecture: clients and channels connect to the WeKnora app, where RAG Q&A, agent reasoning and auto wiki share one knowledge pipeline; the app calls runtime services and stores data in PostgreSQL, Redis and optional stores" width="100%">
|
||||
<img src="./docs/images/readme/architecture-en-light.svg" alt="Academy architecture: clients and channels connect to the Academy app, where RAG Q&A, agent reasoning and auto wiki share one knowledge pipeline; the app calls runtime services and stores data in PostgreSQL, Redis and optional stores" width="100%">
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
@@ -337,31 +337,31 @@ A modular pipeline from document parsing, vectorization and retrieval to LLM inf
|
||||
|
||||
| | Client | What it does |
|
||||
|:-:|--------|--------------|
|
||||
| <img src="./docs/images/readme/icons/terminal.svg" width="22" height="22" alt=""> | [**CLI `weknora`**](./cli/README.md) | Agent-first command line for the full API, with a curated MCP tool surface and bundled Agent Skills |
|
||||
| <img src="./docs/images/readme/icons/terminal.svg" width="22" height="22" alt=""> | [**CLI `academy`**](./cli/README.md) | Agent-first command line for the full API, with a curated MCP tool surface and bundled Agent Skills |
|
||||
| <img src="./docs/images/readme/icons/plug.svg" width="22" height="22" alt=""> | [**Built-in MCP Server**](https://weknora.weixin.qq.com/docs/03-features/08-mcp) | Publishes knowledge bases to Cursor, Claude and other MCP clients over Streamable HTTP; the Python [`mcp-server/`](./mcp-server/MCP_CONFIG.md) is deprecated |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/browserskill.png" width="22" height="22" alt=""> | [**Local Browser (BrowserSkill)**](https://weknora.weixin.qq.com/docs/05-clients/09-local-browser) | Lets agents operate the user's own Chrome / Edge |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/chrome.svg" width="22" height="22" alt=""> | [**Chrome Extension**](https://chromewebstore.google.com/detail/jpemjbopikggjlmikmclgbmkhhopjdgd) | Select text, images, or entire pages in the browser and save them as knowledge entries with one click, without copy-paste or file upload |
|
||||
| <img src="./docs/images/readme/icons/phone.svg" width="22" height="22" alt=""> | [**WeChat Mini Program**](./miniprogram/README.md) | Lightweight mobile client: configure API access, select knowledge bases, import URLs, and ask knowledge chat from WeChat |
|
||||
| <img src="./docs/images/readme/icons/skills.svg" width="22" height="22" alt=""> | [**ClawHub Skill**](https://clawhub.ai/lyingbug/weknora) | A WeKnora skill on ClawHub for document import, hybrid search and knowledge management via the REST API |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/deepseek-color.svg" width="22" height="22" alt=""> | [**DeepSeek Harness plugin**](https://www.npmjs.com/package/@wxg-prc-cpg/dsh-weknora) | Gives `dsh` coding agents four read-only tools: search, read document, ask and list knowledge bases |
|
||||
| <img src="./docs/images/readme/icons/skills.svg" width="22" height="22" alt=""> | [**ClawHub Skill**](https://clawhub.ai/lyingbug/weknora) | A Academy skill on ClawHub for document import, hybrid search and knowledge management via the REST API |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/deepseek-color.svg" width="22" height="22" alt=""> | [**DeepSeek Harness plugin**](https://www.npmjs.com/package/@wxg-prc-cpg/dsh-academy) | Gives `dsh` coding agents four read-only tools: search, read document, ask and list knowledge bases |
|
||||
| <img src="./docs/images/readme/icons/code.svg" width="22" height="22" alt=""> | [**Website Embed Widget**](https://weknora.weixin.qq.com/docs/03-features/13-embed-channel) | Publishes agents on external sites |
|
||||
| <img src="./docs/images/readme/icons/braces.svg" width="22" height="22" alt=""> | [**Go SDK**](https://weknora.weixin.qq.com/docs/05-clients/03-go-sdk) | CRUD for knowledge bases, documents and sessions, plus SSE streaming Q&A |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/wechat-dialog.png" width="22" height="22" alt=""> | [**WeChat Dialog Open Platform**](https://chatbot.weixin.qq.com) | Hosted Q&A built on WeKnora: upload knowledge and publish a Q&A service in WeChat without writing code |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/wechat-dialog.png" width="22" height="22" alt=""> | [**WeChat Dialog Open Platform**](https://chatbot.weixin.qq.com) | Hosted Q&A built on Academy: upload knowledge and publish a Q&A service in WeChat without writing code |
|
||||
|
||||
### Command-Line Interface
|
||||
|
||||
`weknora` is the official CLI for driving the API from a terminal or an AI agent. It is **agent-first**: every command emits a stable JSON envelope by default (with typed error codes mapped to exit codes), and `--format text` renders for humans. It also serves a curated MCP tool surface (`weknora mcp serve`) and ships bundled Agent Skills.
|
||||
`academy` is the official CLI for driving the API from a terminal or an AI agent. It is **agent-first**: every command emits a stable JSON envelope by default (with typed error codes mapped to exit codes), and `--format text` renders for humans. It also serves a curated MCP tool surface (`academy mcp serve`) and ships bundled Agent Skills.
|
||||
|
||||
```bash
|
||||
weknora profile add prod --host https://kb.example.com --use
|
||||
weknora auth login
|
||||
weknora kb list
|
||||
weknora link --kb my-knowledge-base # bind the current directory
|
||||
weknora doc upload notes.md
|
||||
weknora chat "summarise the design doc"
|
||||
academy profile add prod --host https://kb.example.com --use
|
||||
academy auth login
|
||||
academy kb list
|
||||
academy link --kb my-knowledge-base # bind the current directory
|
||||
academy doc upload notes.md
|
||||
academy chat "summarise the design doc"
|
||||
```
|
||||
|
||||
For headless / CI use, set `WEKNORA_API_KEY` + `WEKNORA_HOST` and skip `auth login`; no credentials are written to disk. See [`cli/README.md`](./cli/README.md) for install + 5-minute quickstart and [`cli/AGENTS.md`](./cli/AGENTS.md) for the operational contract AI agents rely on.
|
||||
For headless / CI use, set `ACADEMY_API_KEY` + `ACADEMY_HOST` and skip `auth login`; no credentials are written to disk. See [`cli/README.md`](./cli/README.md) for install + 5-minute quickstart and [`cli/AGENTS.md`](./cli/AGENTS.md) for the operational contract AI agents rely on.
|
||||
|
||||
## Documentation
|
||||
|
||||
|
||||
+30
-30
@@ -2,7 +2,7 @@
|
||||
<a href="https://weknora.weixin.qq.com">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/images/readme/hero-cn-dark.svg">
|
||||
<img src="./docs/images/readme/hero-cn-light.svg" alt="WeKnora:帮你找到答案,并将知识付诸实践。腾讯开源的企业级知识管理框架,汇集团队资料,用于知识问答、任务执行和 Wiki 整理。" width="100%">
|
||||
<img src="./docs/images/readme/hero-cn-light.svg" alt="Academy:帮你找到答案,并将知识付诸实践。腾讯开源的企业级知识管理框架,汇集团队资料,用于知识问答、任务执行和 Wiki 整理。" width="100%">
|
||||
</picture>
|
||||
</a>
|
||||
</p>
|
||||
@@ -17,7 +17,7 @@
|
||||
<a href="https://chatbot.weixin.qq.com"><img alt="微信对话开放平台" src="https://img.shields.io/badge/微信对话-开放平台-07c160?style=flat-square&labelColor=101f38&logo=wechat&logoColor=white"></a>
|
||||
<a href="https://chromewebstore.google.com/detail/jpemjbopikggjlmikmclgbmkhhopjdgd"><img alt="Chrome 插件" src="https://img.shields.io/badge/Chrome-插件-4285f4?style=flat-square&labelColor=101f38&logo=googlechrome&logoColor=white"></a>
|
||||
<a href="https://clawhub.ai/lyingbug/weknora"><img alt="ClawHub Skill" src="https://img.shields.io/badge/ClawHub-skill-ff6b35?style=flat-square&labelColor=101f38"></a>
|
||||
<a href="https://www.npmjs.com/package/@wxg-prc-cpg/dsh-weknora"><img alt="npm @wxg-prc-cpg/dsh-weknora" src="https://img.shields.io/npm/v/@wxg-prc-cpg/dsh-weknora?style=flat-square&label=dsh-weknora&labelColor=101f38&color=cb3837&logo=npm&logoColor=white"></a>
|
||||
<a href="https://www.npmjs.com/package/@wxg-prc-cpg/dsh-academy"><img alt="npm @wxg-prc-cpg/dsh-academy" src="https://img.shields.io/npm/v/@wxg-prc-cpg/dsh-academy?style=flat-square&label=dsh-academy&labelColor=101f38&color=cb3837&logo=npm&logoColor=white"></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
## 项目介绍
|
||||
|
||||
**[WeKnora(维娜拉)](https://weknora.weixin.qq.com)** 是一款开源的、基于大语言模型(LLM)的知识管理框架,面向企业级文档理解、语义检索与智能推理场景。它把团队分散的文档汇集起来,用于检索、推理,并随资料更新持续维护。
|
||||
**[Academy(维娜拉)](https://weknora.weixin.qq.com)** 是一款开源的、基于大语言模型(LLM)的知识管理框架,面向企业级文档理解、语义检索与智能推理场景。它把团队分散的文档汇集起来,用于检索、推理,并随资料更新持续维护。
|
||||
|
||||
https://github.com/user-attachments/assets/5722b10d-d04d-49ed-a6cc-635a8c77d91f
|
||||
|
||||
@@ -79,7 +79,7 @@ https://github.com/user-attachments/assets/5722b10d-d04d-49ed-a6cc-635a8c77d91f
|
||||
<img src="./website-docs/homepage/public/docs/_home/brands/tencent-cloud.ico" width="28" height="28" alt=""><br/>
|
||||
<sub>云端部署</sub><br/>
|
||||
<b>腾讯云轻量应用服务器</b><br/>
|
||||
通过应用模板部署 WeKnora,在自己的云服务器上运行。<br/><br/>
|
||||
通过应用模板部署 Academy,在自己的云服务器上运行。<br/><br/>
|
||||
<a href="https://mc.tencent.com/s69nKCVz">前往腾讯云部署 →</a>
|
||||
</td>
|
||||
<td width="33%" valign="top">
|
||||
@@ -98,7 +98,7 @@ https://github.com/user-attachments/assets/5722b10d-d04d-49ed-a6cc-635a8c77d91f
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Tencent/WeKnora.git
|
||||
cd WeKnora
|
||||
cd Academy
|
||||
cp .env.example .env # 按需编辑 .env,详见文件内注释
|
||||
docker compose pull # 拉取最新镜像
|
||||
docker compose up -d # 启动核心服务
|
||||
@@ -138,8 +138,8 @@ docker compose down # 停止服务
|
||||
若已有部署并下载了更新的 release:
|
||||
|
||||
```bash
|
||||
# 在 .env 中将 WEKNORA_VERSION 设为目标版本(如 0.8.3),或保持 latest
|
||||
docker compose pull # 拉取与 WEKNORA_VERSION 匹配的镜像
|
||||
# 在 .env 中将 ACADEMY_VERSION 设为目标版本(如 0.8.3),或保持 latest
|
||||
docker compose pull # 拉取与 ACADEMY_VERSION 匹配的镜像
|
||||
docker compose up -d # 用新镜像重建容器
|
||||
```
|
||||
|
||||
@@ -158,8 +158,8 @@ docker compose up -d # 用新镜像重建容器
|
||||
全部部署形态、硬件要求与常见拓扑见[安装部署](https://weknora.weixin.qq.com/docs/01-getting-started/02-installation)。
|
||||
|
||||
> [!WARNING]
|
||||
> WeKnora 已提供登录鉴权,但在生产环境部署时,我们强烈建议:
|
||||
> - 将 WeKnora 服务部署在内网 / 私有网络环境中,而非公网环境;
|
||||
> Academy 已提供登录鉴权,但在生产环境部署时,我们强烈建议:
|
||||
> - 将 Academy 服务部署在内网 / 私有网络环境中,而非公网环境;
|
||||
> - 避免将服务直接暴露在公网上,以防止重要信息泄露风险;
|
||||
> - 为部署环境配置适当的防火墙规则和访问控制;
|
||||
> - 定期更新到最新版本以获取安全补丁和改进。
|
||||
@@ -196,7 +196,7 @@ docker compose up -d # 用新镜像重建容器
|
||||
- **空间技能目录**:从 ClawHub / SkillHub / git / zip 安装,按沙箱快照、实时进度、文件浏览/编辑、个人与空间环境变量。
|
||||
- **跨会话长期记忆**:profile / preference / fact / task / interest,自动抽取需确认,`search_memory`。
|
||||
- **解析与数据源**:进程内 anydoc Office 解析;GitLab 与腾讯 IMA 数据源;XMind 解析。
|
||||
- **生态**:官方 DeepSeek Harness 插件 `@wxg-prc-cpg/dsh-weknora`;LiteLLM;Exa 与 Metaso 网络搜索。
|
||||
- **生态**:官方 DeepSeek Harness 插件 `@wxg-prc-cpg/dsh-academy`;LiteLLM;Exa 与 Metaso 网络搜索。
|
||||
- **对话**:对话产物、问题大纲与时间戳;上下文压缩与供应商 Prompt Cache 标记。
|
||||
- **安全**:OIDC JWKS 验签、可选复杂密码、文档自动打标签,以及大范围沙箱/安全加固。
|
||||
|
||||
@@ -207,15 +207,15 @@ docker compose up -d # 用新镜像重建容器
|
||||
|
||||
- **v0.7.2** —— 产品文档站;知识库文件夹树;分块编辑与版本历史;Wiki 页面版本历史;可直接加载的文件链接(`resource_urls=public`);飞书云盘数据源;批量打标签;MCP Server 1.1(29 个工具);AWS S3 默认凭据链。
|
||||
- **v0.7.1** —— 云之家 IM;火山引擎重排序;智谱 AI 网络搜索;平台级 API Key;知识库活动审计;FAQ 筛选、打标签与导出;Langfuse OTLP 追踪;一键导出 Markdown。
|
||||
- **v0.7.0** —— 权限范围 API Key 与 Principal 模型;任务队列面板与 Worker 池治理;每空间多实例存储;对话临时附件;`@Skill / @MCP` 提及;会话内 MCP OAuth;QQBot 与 Lark IM;Redis TLS;`weknora` CLI v0.10。
|
||||
- **v0.7.0** —— 权限范围 API Key 与 Principal 模型;任务队列面板与 Worker 池治理;每空间多实例存储;对话临时附件;`@Skill / @MCP` 提及;会话内 MCP OAuth;QQBot 与 Lark IM;Redis TLS;`academy` CLI v0.10。
|
||||
- **v0.6.3** —— 网站嵌入 Widget 与发布集成中心(安全模式 Token 交换 + 限流);对话体验全面革新(引用浮层、RAG 流水线进度、流式 Markdown);文档多标签与批量重新解析;Wiki 文件夹与层级导航;RSS 数据源;MCP OAuth2;EPUB / MHTML 解析;Agent 模型就绪校验;模型调试器;会话来源筛选;工作区删除 UI。
|
||||
- **v0.6.2** —— 按批次解析配置(`process_config`)+ 上传确认对话框;文档重新解析(reparse)支持覆盖配置;`weknora` CLI v0.9(内置 Agent Skills、`session stop`、auth/profile 统一);知识库框选多选;pgvector 1024 维 HNSW 索引;对话资源 Store 重构;仅保留 Langfuse 追踪(移除 Jaeger)。
|
||||
- **v0.6.1** —— 文档解析追踪时间线(Langfuse 风格 Span 树,逐阶段进度展示 + 解析中止);OpenSearch 向量库驱动;YAML 声明式内置模型配置;系统管理员与统一平台设置 + 审计日志;新用户引导;设置页 UI 重构;`weknora` CLI v0.7 / v0.8(Agent 优先线协议、NDJSON、`--dry-run`);OpenDataLoader 与 PaddleOCR-VL 解析引擎;MCP Server 多传输(stdio / SSE / HTTP);按模型的思考模式配置;腾讯云 LKEAP 重排 + 原生 Gemini Embedding + MiniMax-M3。
|
||||
- **v0.6.0** —— 空间 RBAC(四级角色矩阵 `Owner` / `Admin` / `Contributor` / `Viewer` + 按 KB 归属 + 每空间审计日志)、空间成员管理与多工作区 UX、自助创建工作区;`weknora` CLI v0.4 正式版 + `mcp serve`;KB 检索跨向量库扇出;MCP / 数据源凭据 AES-256-GCM 加密 + docreader gRPC TLS + Token;新增智谱 Embedding 与华为云 OBS;服务端用户偏好;Go 1.26.0。详见[多租户与认证](https://weknora.weixin.qq.com/docs/03-features/01-tenant-auth)。
|
||||
- **v0.5.2** —— Wiki 入库支撑万级文档知识库(任务队列 + 死信队列);MCP 工具人机审批;Anthropic / Apache Doris / 腾讯云 VectorDB / 金山云 KS3 / SearXNG 后端;自适应三层分块 + 实时调试面板;全局 ⌘K 命令面板;语雀连接器 + 微信小程序;`weknora` CLI 早期版本。
|
||||
- **v0.6.2** —— 按批次解析配置(`process_config`)+ 上传确认对话框;文档重新解析(reparse)支持覆盖配置;`academy` CLI v0.9(内置 Agent Skills、`session stop`、auth/profile 统一);知识库框选多选;pgvector 1024 维 HNSW 索引;对话资源 Store 重构;仅保留 Langfuse 追踪(移除 Jaeger)。
|
||||
- **v0.6.1** —— 文档解析追踪时间线(Langfuse 风格 Span 树,逐阶段进度展示 + 解析中止);OpenSearch 向量库驱动;YAML 声明式内置模型配置;系统管理员与统一平台设置 + 审计日志;新用户引导;设置页 UI 重构;`academy` CLI v0.7 / v0.8(Agent 优先线协议、NDJSON、`--dry-run`);OpenDataLoader 与 PaddleOCR-VL 解析引擎;MCP Server 多传输(stdio / SSE / HTTP);按模型的思考模式配置;腾讯云 LKEAP 重排 + 原生 Gemini Embedding + MiniMax-M3。
|
||||
- **v0.6.0** —— 空间 RBAC(四级角色矩阵 `Owner` / `Admin` / `Contributor` / `Viewer` + 按 KB 归属 + 每空间审计日志)、空间成员管理与多工作区 UX、自助创建工作区;`academy` CLI v0.4 正式版 + `mcp serve`;KB 检索跨向量库扇出;MCP / 数据源凭据 AES-256-GCM 加密 + docreader gRPC TLS + Token;新增智谱 Embedding 与华为云 OBS;服务端用户偏好;Go 1.26.0。详见[多租户与认证](https://weknora.weixin.qq.com/docs/03-features/01-tenant-auth)。
|
||||
- **v0.5.2** —— Wiki 入库支撑万级文档知识库(任务队列 + 死信队列);MCP 工具人机审批;Anthropic / Apache Doris / 腾讯云 VectorDB / 金山云 KS3 / SearXNG 后端;自适应三层分块 + 实时调试面板;全局 ⌘K 命令面板;语雀连接器 + 微信小程序;`academy` CLI 早期版本。
|
||||
- **v0.5.1** —— 知识库批量管理;空间级 IM 频道总览;会话搜索 + 用户级置顶;模型 / 网页搜索 / MCP 统一卡片化设置;按 Agent LLM 调用超时;桌面端空间切换。
|
||||
- **v0.5.0** —— Wiki 模式正式版 —— Agent 从原始文档自治生成结构化、相互链接的 Markdown Wiki 页面及知识图谱;Wiki 浏览器 + 可视化图谱。
|
||||
- **v0.4.0** —— WeKnora Cloud(托管模型 + 解析);Chrome 插件;ClawHub Skill;微信 IM;附件处理;Azure OpenAI / 阿里云 OSS;Notion 连接器;百度 + Ollama 网页搜索;VectorStore 管理。
|
||||
- **v0.4.0** —— Academy Cloud(托管模型 + 解析);Chrome 插件;ClawHub Skill;微信 IM;附件处理;Azure OpenAI / 阿里云 OSS;Notion 连接器;百度 + Ollama 网页搜索;VectorStore 管理。
|
||||
- **v0.3.6** —— ASR 语音;飞书数据源自动同步;OIDC;IM 引用回复 + 线程会话;文档自动摘要;Tavily 搜索;并行工具调用;Agent @提及范围限制。
|
||||
- **v0.3.5** —— Telegram / 钉钉 / Mattermost IM;IM 斜杠命令 + QA 队列;推荐问题;VLM 自动描述 MCP 返回图片;Novita AI;来源频道标记。
|
||||
- **v0.3.4** —— 企业微信 / 飞书 / Slack IM;多模态图片;NVIDIA 模型 API;Weaviate;AWS S3;AES-256-GCM API Key 加密;内置 MCP 服务;混合检索优化;`final_answer` 工具。
|
||||
@@ -301,7 +301,7 @@ docker compose up -d # 用新镜像重建容器
|
||||
<a href="./docs/images/readme/architecture-cn-light.svg">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/images/readme/architecture-cn-dark.svg">
|
||||
<img src="./docs/images/readme/architecture-cn-light.svg" alt="WeKnora 架构:客户端与渠道接入 WeKnora 主服务,RAG 问答、Agent 推理与自动 Wiki 共享同一条知识处理流水线;主服务调用运行时服务,数据存放在 PostgreSQL、Redis 及可选存储中" width="100%">
|
||||
<img src="./docs/images/readme/architecture-cn-light.svg" alt="Academy 架构:客户端与渠道接入 Academy 主服务,RAG 问答、Agent 推理与自动 Wiki 共享同一条知识处理流水线;主服务调用运行时服务,数据存放在 PostgreSQL、Redis 及可选存储中" width="100%">
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
@@ -337,31 +337,31 @@ docker compose up -d # 用新镜像重建容器
|
||||
|
||||
| | 客户端 | 用途 |
|
||||
|:-:|--------|------|
|
||||
| <img src="./docs/images/readme/icons/terminal.svg" width="22" height="22" alt=""> | [**命令行 `weknora`**](./cli/README.md) | Agent 优先的命令行,覆盖完整 API,附带精选 MCP 工具面与内置 Agent Skills |
|
||||
| <img src="./docs/images/readme/icons/terminal.svg" width="22" height="22" alt=""> | [**命令行 `academy`**](./cli/README.md) | Agent 优先的命令行,覆盖完整 API,附带精选 MCP 工具面与内置 Agent Skills |
|
||||
| <img src="./docs/images/readme/icons/plug.svg" width="22" height="22" alt=""> | [**内置 MCP Server**](https://weknora.weixin.qq.com/docs/03-features/08-mcp) | 通过 Streamable HTTP 把知识库开放给 Cursor、Claude 等 MCP 客户端;[`mcp-server/`](./mcp-server/MCP_CONFIG.md) 下的 Python 服务已弃用 |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/browserskill.png" width="22" height="22" alt=""> | [**本地浏览器(BrowserSkill)**](https://weknora.weixin.qq.com/docs/05-clients/09-local-browser) | 让智能体操作用户自己的 Chrome / Edge |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/chrome.svg" width="22" height="22" alt=""> | [**Chrome 插件**](https://chromewebstore.google.com/detail/jpemjbopikggjlmikmclgbmkhhopjdgd) | 在浏览器中选中文本、图片或整个页面,一键保存为知识条目,无需复制粘贴或手动上传文件 |
|
||||
| <img src="./docs/images/readme/icons/phone.svg" width="22" height="22" alt=""> | [**微信小程序**](./miniprogram/README.md) | 轻量移动端:配置 WeKnora API、选择知识库、导入 URL,并在微信内向知识库提问 |
|
||||
| <img src="./docs/images/readme/icons/skills.svg" width="22" height="22" alt=""> | [**ClawHub Skill**](https://clawhub.ai/lyingbug/weknora) | 发布在 ClawHub 上的 WeKnora 技能,通过 REST API 导入文档、混合检索与管理知识条目 |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/deepseek-color.svg" width="22" height="22" alt=""> | [**DeepSeek Harness 插件**](https://www.npmjs.com/package/@wxg-prc-cpg/dsh-weknora) | 为 `dsh` 编码 Agent 提供四个只读工具:检索、读取文档、提问、列出知识库 |
|
||||
| <img src="./docs/images/readme/icons/phone.svg" width="22" height="22" alt=""> | [**微信小程序**](./miniprogram/README.md) | 轻量移动端:配置 Academy API、选择知识库、导入 URL,并在微信内向知识库提问 |
|
||||
| <img src="./docs/images/readme/icons/skills.svg" width="22" height="22" alt=""> | [**ClawHub Skill**](https://clawhub.ai/lyingbug/weknora) | 发布在 ClawHub 上的 Academy 技能,通过 REST API 导入文档、混合检索与管理知识条目 |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/deepseek-color.svg" width="22" height="22" alt=""> | [**DeepSeek Harness 插件**](https://www.npmjs.com/package/@wxg-prc-cpg/dsh-academy) | 为 `dsh` 编码 Agent 提供四个只读工具:检索、读取文档、提问、列出知识库 |
|
||||
| <img src="./docs/images/readme/icons/code.svg" width="22" height="22" alt=""> | [**网站嵌入 Widget**](https://weknora.weixin.qq.com/docs/03-features/13-embed-channel) | 将智能体发布到外部站点 |
|
||||
| <img src="./docs/images/readme/icons/braces.svg" width="22" height="22" alt=""> | [**Go SDK**](https://weknora.weixin.qq.com/docs/05-clients/03-go-sdk) | 知识库、文档、会话等资源的 CRUD 与 SSE 流式问答 |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/wechat-dialog.png" width="22" height="22" alt=""> | [**微信对话开放平台**](https://chatbot.weixin.qq.com) | 基于 WeKnora 的托管问答平台,上传知识即可在微信内发布问答服务,无需写代码 |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/wechat-dialog.png" width="22" height="22" alt=""> | [**微信对话开放平台**](https://chatbot.weixin.qq.com) | 基于 Academy 的托管问答平台,上传知识即可在微信内发布问答服务,无需写代码 |
|
||||
|
||||
### 命令行工具
|
||||
|
||||
`weknora` 是官方命令行工具,可在终端或 AI Agent 中驱动 API。它**以 Agent 为先**:每条命令默认输出稳定的 JSON 信封(带类型化错误码并映射到退出码),`--format text` 则面向人类阅读。它还提供精选的 MCP 工具面(`weknora mcp serve`),并内置 Agent Skills。
|
||||
`academy` 是官方命令行工具,可在终端或 AI Agent 中驱动 API。它**以 Agent 为先**:每条命令默认输出稳定的 JSON 信封(带类型化错误码并映射到退出码),`--format text` 则面向人类阅读。它还提供精选的 MCP 工具面(`academy mcp serve`),并内置 Agent Skills。
|
||||
|
||||
```bash
|
||||
weknora profile add prod --host https://kb.example.com --use
|
||||
weknora auth login
|
||||
weknora kb list
|
||||
weknora link --kb my-knowledge-base # 绑定当前目录
|
||||
weknora doc upload notes.md
|
||||
weknora chat "总结一下设计文档"
|
||||
academy profile add prod --host https://kb.example.com --use
|
||||
academy auth login
|
||||
academy kb list
|
||||
academy link --kb my-knowledge-base # 绑定当前目录
|
||||
academy doc upload notes.md
|
||||
academy chat "总结一下设计文档"
|
||||
```
|
||||
|
||||
在无界面 / CI 场景下,设置 `WEKNORA_API_KEY` 与 `WEKNORA_HOST` 即可跳过 `auth login`,不会有凭据写入磁盘。安装与 5 分钟上手见 [`cli/README.md`](./cli/README.md),AI Agent 依赖的操作约定见 [`cli/AGENTS.md`](./cli/AGENTS.md)。
|
||||
在无界面 / CI 场景下,设置 `ACADEMY_API_KEY` 与 `ACADEMY_HOST` 即可跳过 `auth login`,不会有凭据写入磁盘。安装与 5 分钟上手见 [`cli/README.md`](./cli/README.md),AI Agent 依赖的操作约定见 [`cli/AGENTS.md`](./cli/AGENTS.md)。
|
||||
|
||||
## 文档
|
||||
|
||||
|
||||
+29
-29
@@ -2,7 +2,7 @@
|
||||
<a href="https://weknora.weixin.qq.com">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/images/readme/hero-ja-dark.svg">
|
||||
<img src="./docs/images/readme/hero-ja-light.svg" alt="WeKnora:答えを見つけ、知識を実践に活かす。Tencent が公開するオープンソースのエンタープライズ向けナレッジ管理フレームワーク。チームの資料を集約し、Q&A・タスク実行・Wiki 整理に活用します。" width="100%">
|
||||
<img src="./docs/images/readme/hero-ja-light.svg" alt="Academy:答えを見つけ、知識を実践に活かす。Tencent が公開するオープンソースのエンタープライズ向けナレッジ管理フレームワーク。チームの資料を集約し、Q&A・タスク実行・Wiki 整理に活用します。" width="100%">
|
||||
</picture>
|
||||
</a>
|
||||
</p>
|
||||
@@ -17,7 +17,7 @@
|
||||
<a href="https://chatbot.weixin.qq.com"><img alt="WeChat 対話オープンプラットフォーム" src="https://img.shields.io/badge/WeChat_Dialog-Open_Platform-07c160?style=flat-square&labelColor=101f38&logo=wechat&logoColor=white"></a>
|
||||
<a href="https://chromewebstore.google.com/detail/jpemjbopikggjlmikmclgbmkhhopjdgd"><img alt="Chrome 拡張機能" src="https://img.shields.io/badge/Chrome-extension-4285f4?style=flat-square&labelColor=101f38&logo=googlechrome&logoColor=white"></a>
|
||||
<a href="https://clawhub.ai/lyingbug/weknora"><img alt="ClawHub Skill" src="https://img.shields.io/badge/ClawHub-skill-ff6b35?style=flat-square&labelColor=101f38"></a>
|
||||
<a href="https://www.npmjs.com/package/@wxg-prc-cpg/dsh-weknora"><img alt="npm @wxg-prc-cpg/dsh-weknora" src="https://img.shields.io/npm/v/@wxg-prc-cpg/dsh-weknora?style=flat-square&label=dsh-weknora&labelColor=101f38&color=cb3837&logo=npm&logoColor=white"></a>
|
||||
<a href="https://www.npmjs.com/package/@wxg-prc-cpg/dsh-academy"><img alt="npm @wxg-prc-cpg/dsh-academy" src="https://img.shields.io/npm/v/@wxg-prc-cpg/dsh-academy?style=flat-square&label=dsh-academy&labelColor=101f38&color=cb3837&logo=npm&logoColor=white"></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
## プロジェクト紹介
|
||||
|
||||
**[WeKnora(ウィーノラ)](https://weknora.weixin.qq.com)** は、大規模言語モデル(LLM)をベースとしたオープンソースのナレッジフレームワークで、エンタープライズ向けの文書理解、セマンティック検索、推論に対応します。チームに散在する文書を集約し、検索・推論に使えるようにし、資料の更新に合わせて維持します。
|
||||
**[Academy(ウィーノラ)](https://weknora.weixin.qq.com)** は、大規模言語モデル(LLM)をベースとしたオープンソースのナレッジフレームワークで、エンタープライズ向けの文書理解、セマンティック検索、推論に対応します。チームに散在する文書を集約し、検索・推論に使えるようにし、資料の更新に合わせて維持します。
|
||||
|
||||
https://github.com/user-attachments/assets/5722b10d-d04d-49ed-a6cc-635a8c77d91f
|
||||
|
||||
@@ -79,7 +79,7 @@ https://github.com/user-attachments/assets/5722b10d-d04d-49ed-a6cc-635a8c77d91f
|
||||
<img src="./website-docs/homepage/public/docs/_home/brands/tencent-cloud.ico" width="28" height="28" alt=""><br/>
|
||||
<sub>クラウド</sub><br/>
|
||||
<b>Tencent Cloud Lighthouse</b><br/>
|
||||
アプリケーションテンプレートから WeKnora をデプロイし、自分のクラウドサーバーで運用します。<br/><br/>
|
||||
アプリケーションテンプレートから Academy をデプロイし、自分のクラウドサーバーで運用します。<br/><br/>
|
||||
<a href="https://mc.tencent.com/s69nKCVz">Tencent Cloud でデプロイ →</a>
|
||||
</td>
|
||||
<td width="33%" valign="top">
|
||||
@@ -98,7 +98,7 @@ https://github.com/user-attachments/assets/5722b10d-d04d-49ed-a6cc-635a8c77d91f
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Tencent/WeKnora.git
|
||||
cd WeKnora
|
||||
cd Academy
|
||||
cp .env.example .env # 必要に応じて .env を編集(詳細はファイル内のコメント参照)
|
||||
docker compose pull # 最新イメージを取得
|
||||
docker compose up -d # コアサービスを起動
|
||||
@@ -138,8 +138,8 @@ docker compose down # サービスを停止
|
||||
既存のデプロイがあり、新しい release をダウンロードした場合:
|
||||
|
||||
```bash
|
||||
# .env の WEKNORA_VERSION を対象バージョン(例: 0.8.3)に設定、または latest のまま
|
||||
docker compose pull # WEKNORA_VERSION に一致するイメージを取得
|
||||
# .env の ACADEMY_VERSION を対象バージョン(例: 0.8.3)に設定、または latest のまま
|
||||
docker compose pull # ACADEMY_VERSION に一致するイメージを取得
|
||||
docker compose up -d # 新しいイメージでコンテナを再作成
|
||||
```
|
||||
|
||||
@@ -158,8 +158,8 @@ docker compose up -d # 新しいイメージでコンテナを再作成
|
||||
すべてのデプロイ形態、ハードウェア要件、構成例は[インストールガイド](https://weknora.weixin.qq.com/docs/01-getting-started/02-installation)を参照してください。
|
||||
|
||||
> [!WARNING]
|
||||
> WeKnora にはログイン認証がありますが、本番環境でのデプロイでは以下を強く推奨します:
|
||||
> - WeKnora サービスはパブリックインターネットではなく、内部 / プライベートネットワーク環境にデプロイする
|
||||
> Academy にはログイン認証がありますが、本番環境でのデプロイでは以下を強く推奨します:
|
||||
> - Academy サービスはパブリックインターネットではなく、内部 / プライベートネットワーク環境にデプロイする
|
||||
> - 情報漏洩を防ぐため、サービスを直接パブリックネットワークに公開しない
|
||||
> - デプロイ環境に適切なファイアウォールルールとアクセス制御を設定する
|
||||
> - セキュリティパッチと改善のため、定期的に最新バージョンに更新する
|
||||
@@ -196,7 +196,7 @@ docker compose up -d # 新しいイメージでコンテナを再作成
|
||||
- **テナントスキルカタログ**:ClawHub / SkillHub / git / zip からインストール、サンドボックス単位のスナップショット、ライブ進捗、ファイル閲覧 / 編集、個人・ワークスペース環境変数。
|
||||
- **クロスセッション長期メモリ**:profile / preference / fact / task / interest、確認付き自動抽出、`search_memory`。
|
||||
- **解析とデータソース**:プロセス内 anydoc Office パーサー、GitLab と Tencent IMA データソース、XMind 解析。
|
||||
- **エコシステム**:公式 DeepSeek Harness プラグイン `@wxg-prc-cpg/dsh-weknora`、LiteLLM、Exa と Metaso の Web 検索。
|
||||
- **エコシステム**:公式 DeepSeek Harness プラグイン `@wxg-prc-cpg/dsh-academy`、LiteLLM、Exa と Metaso の Web 検索。
|
||||
- **チャット**:チャット成果物、質問アウトライン、タイムスタンプ、コンテキスト圧縮とプロバイダー Prompt Cache マーカー。
|
||||
- **セキュリティ**:OIDC JWKS 検証、任意の複雑パスワード、ドキュメント自動タグ付け、広範なサンドボックス / セキュリティ強化。
|
||||
|
||||
@@ -207,15 +207,15 @@ docker compose up -d # 新しいイメージでコンテナを再作成
|
||||
|
||||
- **v0.7.2** — 製品ドキュメントサイト、ナレッジベースのフォルダーツリー、チャンク編集とバージョン履歴、Wiki ページのバージョン履歴、直接読み込めるファイル URL(`resource_urls=public`)、Feishu クラウドドライブのデータソース、一括タグ付け、MCP Server 1.1(29 ツール)、AWS S3 のデフォルト資格情報チェーン。
|
||||
- **v0.7.1** — Yunzhijia IM、Volcengine リランク、Zhipu AI Web 検索、プラットフォームスコープの API キー、KB 単位のアクティビティ監査、FAQ のフィルター・タグ付け・エクスポート、Langfuse OTLP トレーシング、ワンクリック Markdown エクスポート。
|
||||
- **v0.7.0** — スコープ付き API キーと Principal モデル、タスクキューダッシュボードと Worker プール統治、ワークスペースごとの複数ストレージインスタンス、会話の一時添付、`@Skill / @MCP` メンション、会話中の MCP OAuth、QQBot と Lark IM、Redis TLS、`weknora` CLI v0.10。
|
||||
- **v0.7.0** — スコープ付き API キーと Principal モデル、タスクキューダッシュボードと Worker プール統治、ワークスペースごとの複数ストレージインスタンス、会話の一時添付、`@Skill / @MCP` メンション、会話中の MCP OAuth、QQBot と Lark IM、Redis TLS、`academy` CLI v0.10。
|
||||
- **v0.6.3** — ウェブサイト埋め込み Widget と統合センター(セキュアモード Token 交換 + レート制限);チャット体験の全面刷新(引用ポップオーバー、RAG パイプライン進捗、ストリーミング Markdown);ドキュメント複数タグと一括 reparse;Wiki フォルダーと階層ナビゲーション;RSS データソース;MCP OAuth2;EPUB / MHTML 解析;Agent モデル準備状態チェック;モデルデバッガー;セッションソースフィルター;ワークスペース削除 UI。
|
||||
- **v0.6.2** — アップロード単位の解析設定(`process_config`)+ アップロード確認ダイアログ;reparse 時の設定上書き;`weknora` CLI v0.9(同梱 Agent Skills、`session stop`、auth/profile 統合);KB マーキー複数選択;pgvector 1024 次元 HNSW インデックス;チャットリソース Store 刷新;Langfuse のみのトレーシング(Jaeger 削除)。
|
||||
- **v0.6.1** — ドキュメント解析トレースタイムライン(Langfuse 風の Span ツリー、ステージごとの進捗表示 + 解析中止);OpenSearch ベクター DB ドライバー;YAML 宣言型ビルトインモデル設定;システム管理者と統合プラットフォーム設定 + 監査ログ;新規ユーザーオンボーディングガイド;設定 UI 刷新;`weknora` CLI v0.7 / v0.8(Agent ファースト ワイヤープロトコル、NDJSON、`--dry-run`);OpenDataLoader と PaddleOCR-VL 解析エンジン;MCP サーバーのマルチトランスポート(stdio / SSE / HTTP);モデル単位の思考モード設定;Tencent LKEAP リランク + ネイティブ Gemini Embedding + MiniMax-M3。
|
||||
- **v0.6.0** — テナント RBAC(4 階層ロールマトリクス `Owner` / `Admin` / `Contributor` / `Viewer` + KB 単位の所有 + テナントごとの監査ログ)、テナントメンバー管理とマルチワークスペース UX、セルフサービスでのワークスペース作成;`weknora` CLI v0.4 GA + `mcp serve`;KB 検索の複数ベクター DB ファンアウト;MCP / データソース資格情報の AES-256-GCM 暗号化 + docreader gRPC TLS + Token;Zhipu Embedder と華為雲 OBS の追加;サーバーサイドユーザー設定;Go 1.26.0。詳細は[テナントと認証](https://weknora.weixin.qq.com/docs/03-features/01-tenant-auth)(中国語)を参照。
|
||||
- **v0.5.2** — Wiki インジェストが万件規模 KB に対応(タスクキュー + DLQ);MCP 工具人機審批;Anthropic / Apache Doris / Tencent VectorDB / 金山雲 KS3 / SearXNG バックエンド;適応型 3 段階チャンキング + ライブプレビュー;グローバル ⌘K コマンドパレット;Yuque コネクタ + WeChat ミニプログラム;`weknora` CLI プレビュー版。
|
||||
- **v0.6.2** — アップロード単位の解析設定(`process_config`)+ アップロード確認ダイアログ;reparse 時の設定上書き;`academy` CLI v0.9(同梱 Agent Skills、`session stop`、auth/profile 統合);KB マーキー複数選択;pgvector 1024 次元 HNSW インデックス;チャットリソース Store 刷新;Langfuse のみのトレーシング(Jaeger 削除)。
|
||||
- **v0.6.1** — ドキュメント解析トレースタイムライン(Langfuse 風の Span ツリー、ステージごとの進捗表示 + 解析中止);OpenSearch ベクター DB ドライバー;YAML 宣言型ビルトインモデル設定;システム管理者と統合プラットフォーム設定 + 監査ログ;新規ユーザーオンボーディングガイド;設定 UI 刷新;`academy` CLI v0.7 / v0.8(Agent ファースト ワイヤープロトコル、NDJSON、`--dry-run`);OpenDataLoader と PaddleOCR-VL 解析エンジン;MCP サーバーのマルチトランスポート(stdio / SSE / HTTP);モデル単位の思考モード設定;Tencent LKEAP リランク + ネイティブ Gemini Embedding + MiniMax-M3。
|
||||
- **v0.6.0** — テナント RBAC(4 階層ロールマトリクス `Owner` / `Admin` / `Contributor` / `Viewer` + KB 単位の所有 + テナントごとの監査ログ)、テナントメンバー管理とマルチワークスペース UX、セルフサービスでのワークスペース作成;`academy` CLI v0.4 GA + `mcp serve`;KB 検索の複数ベクター DB ファンアウト;MCP / データソース資格情報の AES-256-GCM 暗号化 + docreader gRPC TLS + Token;Zhipu Embedder と華為雲 OBS の追加;サーバーサイドユーザー設定;Go 1.26.0。詳細は[テナントと認証](https://weknora.weixin.qq.com/docs/03-features/01-tenant-auth)(中国語)を参照。
|
||||
- **v0.5.2** — Wiki インジェストが万件規模 KB に対応(タスクキュー + DLQ);MCP 工具人機審批;Anthropic / Apache Doris / Tencent VectorDB / 金山雲 KS3 / SearXNG バックエンド;適応型 3 段階チャンキング + ライブプレビュー;グローバル ⌘K コマンドパレット;Yuque コネクタ + WeChat ミニプログラム;`academy` CLI プレビュー版。
|
||||
- **v0.5.1** — KB 一括管理;テナント全体の IM チャネル概観;セッション検索 + ユーザー単位ピン留め;モデル / Web 検索 / MCP 統一カード設定;Agent ごとの LLM タイムアウト;デスクトップ版テナント切替。
|
||||
- **v0.5.0** — Wiki モード GA — Agent が原文書から構造化・相互リンクされた Markdown Wiki ページとナレッジグラフを自動生成、Wiki ブラウザと可視化グラフを UI に搭載。
|
||||
- **v0.4.0** — WeKnora Cloud(ホスティング LLM + 解析);Chrome 拡張機能;ClawHub Skill;WeChat IM;添付ファイル処理;Azure OpenAI / Alibaba OSS;Notion コネクタ;Baidu + Ollama Web 検索;VectorStore 管理。
|
||||
- **v0.4.0** — Academy Cloud(ホスティング LLM + 解析);Chrome 拡張機能;ClawHub Skill;WeChat IM;添付ファイル処理;Azure OpenAI / Alibaba OSS;Notion コネクタ;Baidu + Ollama Web 検索;VectorStore 管理。
|
||||
- **v0.3.6** — ASR(音声);Feishu データソース自動同期;OIDC;IM 引用返信 + スレッドベースセッション;ドキュメント自動要約;Tavily 検索;並列ツール呼び出し;Agent @メンション範囲制限。
|
||||
- **v0.3.5** — Telegram / DingTalk / Mattermost IM;IM スラッシュコマンド + QA キュー;推奨質問;VLM による MCP ツール画像自動説明;Novita AI;チャネルトラッキング。
|
||||
- **v0.3.4** — 企業 WeChat / Feishu / Slack IM;マルチモーダル画像;NVIDIA モデル API;Weaviate;AWS S3;AES-256-GCM API キー暗号化;組み込み MCP サービス;ハイブリッド検索最適化;`final_answer` ツール。
|
||||
@@ -301,7 +301,7 @@ docker compose up -d # 新しいイメージでコンテナを再作成
|
||||
<a href="./docs/images/readme/architecture-ja-light.svg">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/images/readme/architecture-ja-dark.svg">
|
||||
<img src="./docs/images/readme/architecture-ja-light.svg" alt="WeKnora アーキテクチャ:クライアントとチャネルが WeKnora アプリに接続し、RAG Q&A・Agent 推論・自動 Wiki が同じナレッジ処理パイプラインを共有。アプリはランタイムサービスを呼び出し、PostgreSQL・Redis と任意のストレージにデータを保存" width="100%">
|
||||
<img src="./docs/images/readme/architecture-ja-light.svg" alt="Academy アーキテクチャ:クライアントとチャネルが Academy アプリに接続し、RAG Q&A・Agent 推論・自動 Wiki が同じナレッジ処理パイプラインを共有。アプリはランタイムサービスを呼び出し、PostgreSQL・Redis と任意のストレージにデータを保存" width="100%">
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
@@ -337,31 +337,31 @@ docker compose up -d # 新しいイメージでコンテナを再作成
|
||||
|
||||
| | クライアント | 用途 |
|
||||
|:-:|------------|------|
|
||||
| <img src="./docs/images/readme/icons/terminal.svg" width="22" height="22" alt=""> | [**CLI `weknora`**](./cli/README.md) | Agent ファーストのコマンドライン。API 全体を扱え、厳選した MCP ツールと同梱の Agent Skills を提供 |
|
||||
| <img src="./docs/images/readme/icons/terminal.svg" width="22" height="22" alt=""> | [**CLI `academy`**](./cli/README.md) | Agent ファーストのコマンドライン。API 全体を扱え、厳選した MCP ツールと同梱の Agent Skills を提供 |
|
||||
| <img src="./docs/images/readme/icons/plug.svg" width="22" height="22" alt=""> | [**組み込み MCP Server**](https://weknora.weixin.qq.com/docs/03-features/08-mcp) | Streamable HTTP でナレッジベースを Cursor、Claude などの MCP クライアントに公開。[`mcp-server/`](./mcp-server/MCP_CONFIG.md) の Python サーバーは非推奨 |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/browserskill.png" width="22" height="22" alt=""> | [**ローカルブラウザ(BrowserSkill)**](https://weknora.weixin.qq.com/docs/05-clients/09-local-browser) | エージェントがユーザー自身の Chrome / Edge を操作 |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/chrome.svg" width="22" height="22" alt=""> | [**Chrome 拡張機能**](https://chromewebstore.google.com/detail/jpemjbopikggjlmikmclgbmkhhopjdgd) | テキスト、画像、ページ全体を選択してワンクリックでナレッジエントリとして保存。コピペやファイルアップロードは不要 |
|
||||
| <img src="./docs/images/readme/icons/phone.svg" width="22" height="22" alt=""> | [**WeChat ミニプログラム**](./miniprogram/README.md) | 軽量なモバイルクライアント。API の設定、ナレッジベースの選択、URL のインポート、WeChat からのナレッジ Q&A |
|
||||
| <img src="./docs/images/readme/icons/skills.svg" width="22" height="22" alt=""> | [**ClawHub Skill**](https://clawhub.ai/lyingbug/weknora) | ClawHub で公開された WeKnora スキル。REST API でドキュメントのインポート、ハイブリッド検索、ナレッジ管理 |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/deepseek-color.svg" width="22" height="22" alt=""> | [**DeepSeek Harness プラグイン**](https://www.npmjs.com/package/@wxg-prc-cpg/dsh-weknora) | `dsh` のコーディングエージェントに 4 つの読み取り専用ツール(検索、ドキュメント読み取り、質問、ナレッジベース一覧)を提供 |
|
||||
| <img src="./docs/images/readme/icons/skills.svg" width="22" height="22" alt=""> | [**ClawHub Skill**](https://clawhub.ai/lyingbug/weknora) | ClawHub で公開された Academy スキル。REST API でドキュメントのインポート、ハイブリッド検索、ナレッジ管理 |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/deepseek-color.svg" width="22" height="22" alt=""> | [**DeepSeek Harness プラグイン**](https://www.npmjs.com/package/@wxg-prc-cpg/dsh-academy) | `dsh` のコーディングエージェントに 4 つの読み取り専用ツール(検索、ドキュメント読み取り、質問、ナレッジベース一覧)を提供 |
|
||||
| <img src="./docs/images/readme/icons/code.svg" width="22" height="22" alt=""> | [**ウェブ埋め込み Widget**](https://weknora.weixin.qq.com/docs/03-features/13-embed-channel) | エージェントを外部サイトに公開 |
|
||||
| <img src="./docs/images/readme/icons/braces.svg" width="22" height="22" alt=""> | [**Go SDK**](https://weknora.weixin.qq.com/docs/05-clients/03-go-sdk) | ナレッジベース・ドキュメント・セッションなどの CRUD と SSE ストリーミング Q&A |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/wechat-dialog.png" width="22" height="22" alt=""> | [**WeChat 対話オープンプラットフォーム**](https://chatbot.weixin.qq.com) | WeKnora をベースにしたホスティング型 Q&A。ナレッジをアップロードするだけで WeChat 内に Q&A サービスを公開 |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/wechat-dialog.png" width="22" height="22" alt=""> | [**WeChat 対話オープンプラットフォーム**](https://chatbot.weixin.qq.com) | Academy をベースにしたホスティング型 Q&A。ナレッジをアップロードするだけで WeChat 内に Q&A サービスを公開 |
|
||||
|
||||
### コマンドラインツール
|
||||
|
||||
`weknora` は、ターミナルや AI エージェントから API を操作するための公式 CLI です。**Agent ファースト**の設計で、すべてのコマンドは既定で安定した JSON エンベロープを出力し(型付きエラーコードは終了コードに対応)、`--format text` で人間向けに表示します。厳選した MCP ツール(`weknora mcp serve`)も提供し、Agent Skills を同梱しています。
|
||||
`academy` は、ターミナルや AI エージェントから API を操作するための公式 CLI です。**Agent ファースト**の設計で、すべてのコマンドは既定で安定した JSON エンベロープを出力し(型付きエラーコードは終了コードに対応)、`--format text` で人間向けに表示します。厳選した MCP ツール(`academy mcp serve`)も提供し、Agent Skills を同梱しています。
|
||||
|
||||
```bash
|
||||
weknora profile add prod --host https://kb.example.com --use
|
||||
weknora auth login
|
||||
weknora kb list
|
||||
weknora link --kb my-knowledge-base # 現在のディレクトリを紐づけ
|
||||
weknora doc upload notes.md
|
||||
weknora chat "設計ドキュメントを要約して"
|
||||
academy profile add prod --host https://kb.example.com --use
|
||||
academy auth login
|
||||
academy kb list
|
||||
academy link --kb my-knowledge-base # 現在のディレクトリを紐づけ
|
||||
academy doc upload notes.md
|
||||
academy chat "設計ドキュメントを要約して"
|
||||
```
|
||||
|
||||
ヘッドレス / CI 環境では `WEKNORA_API_KEY` と `WEKNORA_HOST` を設定すれば `auth login` は不要で、資格情報はディスクに書き込まれません。インストールと 5 分間のクイックスタートは [`cli/README.md`](./cli/README.md)、AI エージェントが依存する運用上の約束は [`cli/AGENTS.md`](./cli/AGENTS.md) を参照してください。
|
||||
ヘッドレス / CI 環境では `ACADEMY_API_KEY` と `ACADEMY_HOST` を設定すれば `auth login` は不要で、資格情報はディスクに書き込まれません。インストールと 5 分間のクイックスタートは [`cli/README.md`](./cli/README.md)、AI エージェントが依存する運用上の約束は [`cli/AGENTS.md`](./cli/AGENTS.md) を参照してください。
|
||||
|
||||
## ドキュメント
|
||||
|
||||
|
||||
+29
-29
@@ -2,7 +2,7 @@
|
||||
<a href="https://weknora.weixin.qq.com">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/images/readme/hero-ko-dark.svg">
|
||||
<img src="./docs/images/readme/hero-ko-light.svg" alt="WeKnora: 답을 찾고, 지식을 실천으로. Tencent가 오픈소스로 공개한 엔터프라이즈 지식 관리 프레임워크입니다. 팀 자료를 모아 Q&A, 작업 실행, Wiki 정리에 활용합니다." width="100%">
|
||||
<img src="./docs/images/readme/hero-ko-light.svg" alt="Academy: 답을 찾고, 지식을 실천으로. Tencent가 오픈소스로 공개한 엔터프라이즈 지식 관리 프레임워크입니다. 팀 자료를 모아 Q&A, 작업 실행, Wiki 정리에 활용합니다." width="100%">
|
||||
</picture>
|
||||
</a>
|
||||
</p>
|
||||
@@ -17,7 +17,7 @@
|
||||
<a href="https://chatbot.weixin.qq.com"><img alt="WeChat 대화 오픈 플랫폼" src="https://img.shields.io/badge/WeChat_Dialog-Open_Platform-07c160?style=flat-square&labelColor=101f38&logo=wechat&logoColor=white"></a>
|
||||
<a href="https://chromewebstore.google.com/detail/jpemjbopikggjlmikmclgbmkhhopjdgd"><img alt="Chrome 확장 프로그램" src="https://img.shields.io/badge/Chrome-extension-4285f4?style=flat-square&labelColor=101f38&logo=googlechrome&logoColor=white"></a>
|
||||
<a href="https://clawhub.ai/lyingbug/weknora"><img alt="ClawHub Skill" src="https://img.shields.io/badge/ClawHub-skill-ff6b35?style=flat-square&labelColor=101f38"></a>
|
||||
<a href="https://www.npmjs.com/package/@wxg-prc-cpg/dsh-weknora"><img alt="npm @wxg-prc-cpg/dsh-weknora" src="https://img.shields.io/npm/v/@wxg-prc-cpg/dsh-weknora?style=flat-square&label=dsh-weknora&labelColor=101f38&color=cb3837&logo=npm&logoColor=white"></a>
|
||||
<a href="https://www.npmjs.com/package/@wxg-prc-cpg/dsh-academy"><img alt="npm @wxg-prc-cpg/dsh-academy" src="https://img.shields.io/npm/v/@wxg-prc-cpg/dsh-academy?style=flat-square&label=dsh-academy&labelColor=101f38&color=cb3837&logo=npm&logoColor=white"></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
## 개요
|
||||
|
||||
[**WeKnora**](https://weknora.weixin.qq.com)는 엔터프라이즈 문서 이해, 시맨틱 검색, 추론을 위한 오픈소스 LLM 기반 지식 프레임워크입니다. 팀에 흩어진 문서를 한데 모아 검색하고 추론에 활용할 수 있게 하며, 자료가 바뀌면 함께 갱신합니다.
|
||||
[**Academy**](https://weknora.weixin.qq.com)는 엔터프라이즈 문서 이해, 시맨틱 검색, 추론을 위한 오픈소스 LLM 기반 지식 프레임워크입니다. 팀에 흩어진 문서를 한데 모아 검색하고 추론에 활용할 수 있게 하며, 자료가 바뀌면 함께 갱신합니다.
|
||||
|
||||
https://github.com/user-attachments/assets/5722b10d-d04d-49ed-a6cc-635a8c77d91f
|
||||
|
||||
@@ -89,7 +89,7 @@ https://github.com/user-attachments/assets/5722b10d-d04d-49ed-a6cc-635a8c77d91f
|
||||
<img src="./website-docs/homepage/public/docs/_home/brands/tencent-cloud.ico" width="28" height="28" alt=""><br/>
|
||||
<sub>클라우드</sub><br/>
|
||||
<b>Tencent Cloud Lighthouse</b><br/>
|
||||
애플리케이션 템플릿으로 WeKnora를 배포하고 자신의 클라우드 서버에서 운영합니다.<br/><br/>
|
||||
애플리케이션 템플릿으로 Academy를 배포하고 자신의 클라우드 서버에서 운영합니다.<br/><br/>
|
||||
<a href="https://mc.tencent.com/s69nKCVz">Tencent Cloud에 배포 →</a>
|
||||
</td>
|
||||
<td width="33%" valign="top">
|
||||
@@ -108,7 +108,7 @@ https://github.com/user-attachments/assets/5722b10d-d04d-49ed-a6cc-635a8c77d91f
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Tencent/WeKnora.git
|
||||
cd WeKnora
|
||||
cd Academy
|
||||
cp .env.example .env # 필요에 따라 .env 편집 (파일 내 주석 참고)
|
||||
docker compose pull # 최신 이미지 가져오기
|
||||
docker compose up -d # 코어 서비스 시작
|
||||
@@ -148,8 +148,8 @@ docker compose down # 서비스 중지
|
||||
기존 배포가 있고 새 release를 다운로드한 경우:
|
||||
|
||||
```bash
|
||||
# .env에서 WEKNORA_VERSION을 대상 버전(예: 0.8.3)으로 설정하거나 latest 유지
|
||||
docker compose pull # WEKNORA_VERSION에 맞는 이미지 가져오기
|
||||
# .env에서 ACADEMY_VERSION을 대상 버전(예: 0.8.3)으로 설정하거나 latest 유지
|
||||
docker compose pull # ACADEMY_VERSION에 맞는 이미지 가져오기
|
||||
docker compose up -d # 새 이미지로 컨테이너 재생성
|
||||
```
|
||||
|
||||
@@ -168,8 +168,8 @@ docker compose up -d # 새 이미지로 컨테이너 재생성
|
||||
모든 배포 형태, 하드웨어 요구 사항, 배포 토폴로지는 [설치 가이드](https://weknora.weixin.qq.com/docs/01-getting-started/02-installation)를 참고하세요.
|
||||
|
||||
> [!WARNING]
|
||||
> WeKnora는 로그인 인증을 제공하지만, 운영 환경 배포 시 아래 사항을 강력히 권장합니다.
|
||||
> - WeKnora 서비스를 공용 인터넷이 아닌 내부 / 사설 네트워크 환경에 배포
|
||||
> Academy는 로그인 인증을 제공하지만, 운영 환경 배포 시 아래 사항을 강력히 권장합니다.
|
||||
> - Academy 서비스를 공용 인터넷이 아닌 내부 / 사설 네트워크 환경에 배포
|
||||
> - 정보 유출 방지를 위해 서비스를 공용 네트워크에 직접 노출하지 않기
|
||||
> - 배포 환경에 적절한 방화벽 규칙 및 접근 제어 구성
|
||||
> - 보안 패치와 개선 사항 적용을 위해 최신 버전으로 정기 업데이트
|
||||
@@ -206,7 +206,7 @@ docker compose up -d # 새 이미지로 컨테이너 재생성
|
||||
- **테넌트 스킬 카탈로그**: ClawHub / SkillHub / git / zip에서 설치, 샌드박스별 스냅샷, 실시간 진행 상황, 파일 탐색 / 편집, 개인·워크스페이스 환경 변수.
|
||||
- **크로스 세션 장기 메모리**: profile / preference / fact / task / interest, 확인 기반 자동 추출, `search_memory`.
|
||||
- **파싱과 데이터 소스**: 프로세스 내 anydoc Office 파서, GitLab 및 Tencent IMA 데이터 소스, XMind 파싱.
|
||||
- **생태계**: 공식 DeepSeek Harness 플러그인 `@wxg-prc-cpg/dsh-weknora`, LiteLLM, Exa 및 Metaso 웹 검색.
|
||||
- **생태계**: 공식 DeepSeek Harness 플러그인 `@wxg-prc-cpg/dsh-academy`, LiteLLM, Exa 및 Metaso 웹 검색.
|
||||
- **채팅**: 채팅 산출물, 질문 개요, 타임스탬프, 컨텍스트 압축과 프로바이더 Prompt Cache 마커.
|
||||
- **보안**: OIDC JWKS 검증, 선택적 복잡 비밀번호, 문서 자동 태깅, 광범위한 샌드박스 / 보안 강화.
|
||||
|
||||
@@ -217,15 +217,15 @@ docker compose up -d # 새 이미지로 컨테이너 재생성
|
||||
|
||||
- **v0.7.2** — 제품 문서 사이트, 지식베이스 폴더 트리, 청크 편집 및 버전 이력, Wiki 페이지 버전 이력, 바로 로드 가능한 파일 URL(`resource_urls=public`), Feishu 클라우드 드라이브 데이터 소스, 일괄 태깅, MCP Server 1.1(도구 29개), AWS S3 기본 자격 증명 체인.
|
||||
- **v0.7.1** — Yunzhijia IM, Volcengine 리랭크, Zhipu AI 웹 검색, 플랫폼 범위 API 키, KB 단위 활동 감사, FAQ 필터·태깅·내보내기, Langfuse OTLP 추적, 원클릭 Markdown 내보내기.
|
||||
- **v0.7.0** — 범위 지정 API 키와 Principal 모델, 작업 큐 대시보드와 Worker 풀 거버넌스, 워크스페이스당 여러 스토리지 인스턴스, 대화 임시 첨부, `@Skill / @MCP` 멘션, 대화 중 MCP OAuth, QQBot과 Lark IM, Redis TLS, `weknora` CLI v0.10.
|
||||
- **v0.7.0** — 범위 지정 API 키와 Principal 모델, 작업 큐 대시보드와 Worker 풀 거버넌스, 워크스페이스당 여러 스토리지 인스턴스, 대화 임시 첨부, `@Skill / @MCP` 멘션, 대화 중 MCP OAuth, QQBot과 Lark IM, Redis TLS, `academy` CLI v0.10.
|
||||
- **v0.6.3** — 웹사이트 임베드 Widget 및 통합 센터(보안 모드 Token 교환 + 속도 제한); 채팅 경험 전면 개편(인용 팝오버, RAG 파이프라인 진행, 스트리밍 Markdown); 문서 다중 태그 및 일괄 reparse; Wiki 폴더 및 계층 탐색; RSS 데이터 소스; MCP OAuth2; EPUB / MHTML 파싱; Agent 모델 준비 상태 검사; 모델 디버거; 세션 소스 필터; 워크스페이스 삭제 UI.
|
||||
- **v0.6.2** — 업로드 단위 파싱 설정(`process_config`) + 업로드 확인 대화상자; reparse 시 설정 덮어쓰기; `weknora` CLI v0.9(번들 Agent Skills, `session stop`, auth/profile 통합); KB 마키 선택 다중 선택; pgvector 1024차원 HNSW 인덱스; 채팅 리소스 Store 리팩터; Langfuse 단일 추적(Jaeger 제거).
|
||||
- **v0.6.1** — 문서 파싱 추적 타임라인(Langfuse 스타일 Span 트리, 단계별 진행 표시 + 파싱 중단); OpenSearch 벡터 저장소 드라이버; YAML 선언형 내장 모델 구성; 시스템 관리자와 통합 플랫폼 설정 + 감사 로그; 신규 사용자 온보딩 가이드; 설정 UI 리디자인; `weknora` CLI v0.7 / v0.8(Agent 우선 와이어 프로토콜, NDJSON, `--dry-run`); OpenDataLoader 및 PaddleOCR-VL 파싱 엔진; MCP 서버 멀티 트랜스포트(stdio / SSE / HTTP); 모델별 사고 모드 설정; Tencent LKEAP 리랭크 + 네이티브 Gemini 임베딩 + MiniMax-M3.
|
||||
- **v0.6.0** — 테넌트 RBAC(4단계 역할 매트릭스 `Owner` / `Admin` / `Contributor` / `Viewer` + KB 단위 소유 + 테넌트별 감사 로그), 테넌트 멤버 관리와 멀티 워크스페이스 UX, 셀프 서비스 워크스페이스 생성; `weknora` CLI v0.4 GA + `mcp serve`; 여러 벡터 저장소에 걸친 KB 검색 팬아웃; MCP / 데이터 소스 자격 증명 AES-256-GCM 암호화 + docreader gRPC TLS + Token; Zhipu 임베더와 화웨이 클라우드 OBS 추가; 서버 사이드 사용자 환경설정; Go 1.26.0. 자세한 내용은 [테넌트와 인증](https://weknora.weixin.qq.com/docs/03-features/01-tenant-auth)(중국어) 참고.
|
||||
- **v0.5.2** — Wiki 인제스트가 만 건 규모 KB 지원(작업 큐 + DLQ); MCP 휴먼인더루프 도구 승인; Anthropic / Apache Doris / Tencent VectorDB / Kingsoft Cloud KS3 / SearXNG 백엔드; 적응형 3단계 청킹 + 라이브 미리보기; 글로벌 ⌘K 명령 팔레트; Yuque 커넥터 + WeChat 미니프로그램; `weknora` CLI 프리뷰.
|
||||
- **v0.6.2** — 업로드 단위 파싱 설정(`process_config`) + 업로드 확인 대화상자; reparse 시 설정 덮어쓰기; `academy` CLI v0.9(번들 Agent Skills, `session stop`, auth/profile 통합); KB 마키 선택 다중 선택; pgvector 1024차원 HNSW 인덱스; 채팅 리소스 Store 리팩터; Langfuse 단일 추적(Jaeger 제거).
|
||||
- **v0.6.1** — 문서 파싱 추적 타임라인(Langfuse 스타일 Span 트리, 단계별 진행 표시 + 파싱 중단); OpenSearch 벡터 저장소 드라이버; YAML 선언형 내장 모델 구성; 시스템 관리자와 통합 플랫폼 설정 + 감사 로그; 신규 사용자 온보딩 가이드; 설정 UI 리디자인; `academy` CLI v0.7 / v0.8(Agent 우선 와이어 프로토콜, NDJSON, `--dry-run`); OpenDataLoader 및 PaddleOCR-VL 파싱 엔진; MCP 서버 멀티 트랜스포트(stdio / SSE / HTTP); 모델별 사고 모드 설정; Tencent LKEAP 리랭크 + 네이티브 Gemini 임베딩 + MiniMax-M3.
|
||||
- **v0.6.0** — 테넌트 RBAC(4단계 역할 매트릭스 `Owner` / `Admin` / `Contributor` / `Viewer` + KB 단위 소유 + 테넌트별 감사 로그), 테넌트 멤버 관리와 멀티 워크스페이스 UX, 셀프 서비스 워크스페이스 생성; `academy` CLI v0.4 GA + `mcp serve`; 여러 벡터 저장소에 걸친 KB 검색 팬아웃; MCP / 데이터 소스 자격 증명 AES-256-GCM 암호화 + docreader gRPC TLS + Token; Zhipu 임베더와 화웨이 클라우드 OBS 추가; 서버 사이드 사용자 환경설정; Go 1.26.0. 자세한 내용은 [테넌트와 인증](https://weknora.weixin.qq.com/docs/03-features/01-tenant-auth)(중국어) 참고.
|
||||
- **v0.5.2** — Wiki 인제스트가 만 건 규모 KB 지원(작업 큐 + DLQ); MCP 휴먼인더루프 도구 승인; Anthropic / Apache Doris / Tencent VectorDB / Kingsoft Cloud KS3 / SearXNG 백엔드; 적응형 3단계 청킹 + 라이브 미리보기; 글로벌 ⌘K 명령 팔레트; Yuque 커넥터 + WeChat 미니프로그램; `academy` CLI 프리뷰.
|
||||
- **v0.5.1** — 지식베이스 일괄 관리; 테넌트 전체 IM 채널 개요; 세션 검색 + 사용자 단위 핀; 모델 / 웹 검색 / MCP 통일 카드 설정; Agent별 LLM 타임아웃; 데스크탑 테넌트 전환.
|
||||
- **v0.5.0** — Wiki 모드 GA — Agent가 원본 문서에서 구조화·상호 연결된 Markdown Wiki 페이지와 지식 그래프 자동 생성, Wiki 브라우저 및 시각화 그래프를 UI에 탑재.
|
||||
- **v0.4.0** — WeKnora Cloud(호스팅 LLM + 파싱); Chrome 확장 프로그램; ClawHub Skill; WeChat IM; 첨부 처리; Azure OpenAI / Alibaba OSS; Notion 커넥터; Baidu + Ollama 웹 검색; VectorStore 관리.
|
||||
- **v0.4.0** — Academy Cloud(호스팅 LLM + 파싱); Chrome 확장 프로그램; ClawHub Skill; WeChat IM; 첨부 처리; Azure OpenAI / Alibaba OSS; Notion 커넥터; Baidu + Ollama 웹 검색; VectorStore 관리.
|
||||
- **v0.3.6** — ASR(음성); Feishu 데이터 소스 자동 동기화; OIDC; IM 인용 회신 + 스레드 기반 세션; 문서 자동 요약; Tavily 검색; 병렬 도구 호출; Agent @멘션 범위 제한.
|
||||
- **v0.3.5** — Telegram / DingTalk / Mattermost IM; IM 슬래시 커맨드 + QA 큐; 추천 질문; VLM에 의한 MCP 도구 이미지 자동 설명; Novita AI; 채널 추적.
|
||||
- **v0.3.4** — 기업 WeChat / Feishu / Slack IM; 멀티모달 이미지; NVIDIA 모델 API; Weaviate; AWS S3; AES-256-GCM API 키 암호화; 내장 MCP 서비스; 하이브리드 검색 최적화; `final_answer` 도구.
|
||||
@@ -311,7 +311,7 @@ docker compose up -d # 새 이미지로 컨테이너 재생성
|
||||
<a href="./docs/images/readme/architecture-ko-light.svg">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./docs/images/readme/architecture-ko-dark.svg">
|
||||
<img src="./docs/images/readme/architecture-ko-light.svg" alt="WeKnora 아키텍처: 클라이언트와 채널이 WeKnora 앱에 연결되고, RAG Q&A·Agent 추론·자동 Wiki가 같은 지식 처리 파이프라인을 공유. 앱은 런타임 서비스를 호출하고 PostgreSQL·Redis와 선택적 스토리지에 데이터를 저장" width="100%">
|
||||
<img src="./docs/images/readme/architecture-ko-light.svg" alt="Academy 아키텍처: 클라이언트와 채널이 Academy 앱에 연결되고, RAG Q&A·Agent 추론·자동 Wiki가 같은 지식 처리 파이프라인을 공유. 앱은 런타임 서비스를 호출하고 PostgreSQL·Redis와 선택적 스토리지에 데이터를 저장" width="100%">
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
@@ -347,31 +347,31 @@ docker compose up -d # 새 이미지로 컨테이너 재생성
|
||||
|
||||
| | 클라이언트 | 용도 |
|
||||
|:-:|----------|------|
|
||||
| <img src="./docs/images/readme/icons/terminal.svg" width="22" height="22" alt=""> | [**CLI `weknora`**](./cli/README.md) | Agent 우선 명령줄 도구. 전체 API를 다루며 엄선한 MCP 도구와 내장 Agent Skills 제공 |
|
||||
| <img src="./docs/images/readme/icons/terminal.svg" width="22" height="22" alt=""> | [**CLI `academy`**](./cli/README.md) | Agent 우선 명령줄 도구. 전체 API를 다루며 엄선한 MCP 도구와 내장 Agent Skills 제공 |
|
||||
| <img src="./docs/images/readme/icons/plug.svg" width="22" height="22" alt=""> | [**내장 MCP Server**](https://weknora.weixin.qq.com/docs/03-features/08-mcp) | Streamable HTTP로 지식베이스를 Cursor, Claude 등 MCP 클라이언트에 공개. [`mcp-server/`](./mcp-server/MCP_CONFIG.md)의 Python 서버는 지원 중단 |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/browserskill.png" width="22" height="22" alt=""> | [**로컬 브라우저(BrowserSkill)**](https://weknora.weixin.qq.com/docs/05-clients/09-local-browser) | 에이전트가 사용자 자신의 Chrome / Edge를 조작 |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/chrome.svg" width="22" height="22" alt=""> | [**Chrome 확장 프로그램**](https://chromewebstore.google.com/detail/jpemjbopikggjlmikmclgbmkhhopjdgd) | 텍스트, 이미지 또는 전체 페이지를 선택해 원클릭으로 지식 항목으로 저장. 복사/붙여넣기나 파일 업로드 불필요 |
|
||||
| <img src="./docs/images/readme/icons/phone.svg" width="22" height="22" alt=""> | [**WeChat 미니 프로그램**](./miniprogram/README.md) | 경량 모바일 클라이언트. API 설정, 지식베이스 선택, URL 임포트, WeChat에서 지식 Q&A |
|
||||
| <img src="./docs/images/readme/icons/skills.svg" width="22" height="22" alt=""> | [**ClawHub Skill**](https://clawhub.ai/lyingbug/weknora) | ClawHub에 게시된 WeKnora 스킬. REST API로 문서 임포트, 하이브리드 검색, 지식 관리 |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/deepseek-color.svg" width="22" height="22" alt=""> | [**DeepSeek Harness 플러그인**](https://www.npmjs.com/package/@wxg-prc-cpg/dsh-weknora) | `dsh` 코딩 에이전트에 읽기 전용 도구 4개(검색, 문서 읽기, 질문, 지식베이스 목록) 제공 |
|
||||
| <img src="./docs/images/readme/icons/skills.svg" width="22" height="22" alt=""> | [**ClawHub Skill**](https://clawhub.ai/lyingbug/weknora) | ClawHub에 게시된 Academy 스킬. REST API로 문서 임포트, 하이브리드 검색, 지식 관리 |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/deepseek-color.svg" width="22" height="22" alt=""> | [**DeepSeek Harness 플러그인**](https://www.npmjs.com/package/@wxg-prc-cpg/dsh-academy) | `dsh` 코딩 에이전트에 읽기 전용 도구 4개(검색, 문서 읽기, 질문, 지식베이스 목록) 제공 |
|
||||
| <img src="./docs/images/readme/icons/code.svg" width="22" height="22" alt=""> | [**웹사이트 임베드 Widget**](https://weknora.weixin.qq.com/docs/03-features/13-embed-channel) | 에이전트를 외부 사이트에 게시 |
|
||||
| <img src="./docs/images/readme/icons/braces.svg" width="22" height="22" alt=""> | [**Go SDK**](https://weknora.weixin.qq.com/docs/05-clients/03-go-sdk) | 지식베이스·문서·세션 등의 CRUD와 SSE 스트리밍 Q&A |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/wechat-dialog.png" width="22" height="22" alt=""> | [**WeChat 대화 오픈 플랫폼**](https://chatbot.weixin.qq.com) | WeKnora 기반 호스팅 Q&A. 지식을 업로드하면 코드 없이 WeChat에 Q&A 서비스 게시 |
|
||||
| <img src="./website-docs/homepage/public/docs/_home/brands/wechat-dialog.png" width="22" height="22" alt=""> | [**WeChat 대화 오픈 플랫폼**](https://chatbot.weixin.qq.com) | Academy 기반 호스팅 Q&A. 지식을 업로드하면 코드 없이 WeChat에 Q&A 서비스 게시 |
|
||||
|
||||
### 명령줄 도구
|
||||
|
||||
`weknora`는 터미널이나 AI 에이전트에서 API를 다루기 위한 공식 CLI입니다. **Agent 우선**으로 설계되어 모든 명령이 기본적으로 안정적인 JSON 엔벨로프를 출력하고(타입이 지정된 오류 코드는 종료 코드에 매핑), `--format text`로 사람이 읽기 좋은 형태로 표시합니다. 엄선한 MCP 도구(`weknora mcp serve`)를 제공하며 Agent Skills를 내장하고 있습니다.
|
||||
`academy`는 터미널이나 AI 에이전트에서 API를 다루기 위한 공식 CLI입니다. **Agent 우선**으로 설계되어 모든 명령이 기본적으로 안정적인 JSON 엔벨로프를 출력하고(타입이 지정된 오류 코드는 종료 코드에 매핑), `--format text`로 사람이 읽기 좋은 형태로 표시합니다. 엄선한 MCP 도구(`academy mcp serve`)를 제공하며 Agent Skills를 내장하고 있습니다.
|
||||
|
||||
```bash
|
||||
weknora profile add prod --host https://kb.example.com --use
|
||||
weknora auth login
|
||||
weknora kb list
|
||||
weknora link --kb my-knowledge-base # 현재 디렉터리 연결
|
||||
weknora doc upload notes.md
|
||||
weknora chat "설계 문서를 요약해 줘"
|
||||
academy profile add prod --host https://kb.example.com --use
|
||||
academy auth login
|
||||
academy kb list
|
||||
academy link --kb my-knowledge-base # 현재 디렉터리 연결
|
||||
academy doc upload notes.md
|
||||
academy chat "설계 문서를 요약해 줘"
|
||||
```
|
||||
|
||||
헤드리스 / CI 환경에서는 `WEKNORA_API_KEY`와 `WEKNORA_HOST`를 설정하면 `auth login` 없이 사용할 수 있으며, 자격 증명이 디스크에 기록되지 않습니다. 설치와 5분 빠른 시작은 [`cli/README.md`](./cli/README.md), AI 에이전트가 의존하는 운영 규약은 [`cli/AGENTS.md`](./cli/AGENTS.md)를 참고하세요.
|
||||
헤드리스 / CI 환경에서는 `ACADEMY_API_KEY`와 `ACADEMY_HOST`를 설정하면 `auth login` 없이 사용할 수 있으며, 자격 증명이 디스크에 기록되지 않습니다. 설치와 5분 빠른 시작은 [`cli/README.md`](./cli/README.md), AI 에이전트가 의존하는 운영 규약은 [`cli/AGENTS.md`](./cli/AGENTS.md)를 참고하세요.
|
||||
|
||||
## 문서
|
||||
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
The WeKnora team takes security vulnerabilities seriously.
|
||||
The Academy team takes security vulnerabilities seriously.
|
||||
We appreciate your efforts to responsibly disclose any security issues you discover.
|
||||
|
||||
⚠️ **Please do NOT report security vulnerabilities through public GitHub issues.**
|
||||
@@ -43,4 +43,4 @@ We aim to:
|
||||
|
||||
We kindly ask reporters to follow responsible disclosure practices and allow us reasonable time to address the issue before any public disclosure.
|
||||
|
||||
Thank you for helping keep **WeKnora** and its users secure.
|
||||
Thank you for helping keep **Academy** and its users secure.
|
||||
@@ -1,7 +1,7 @@
|
||||
# Third-party notices and corresponding source
|
||||
|
||||
This file supplements the third-party notices in `LICENSE`. The MIT license
|
||||
for WeKnora's own code does not replace the licenses of third-party components.
|
||||
for Academy's own code does not replace the licenses of third-party components.
|
||||
Keep this file, `LICENSE`, and the `licenses/` directory with redistributed
|
||||
backend and desktop packages. `scripts/copy-licenses.sh` adds checksum-verified
|
||||
source archives at packaging time; they are not stored in this Git repository.
|
||||
@@ -17,7 +17,7 @@ Windows installers place them next to the installed executable.
|
||||
[`licenses/go-sql-driver-mysql-MPL-2.0.txt`](licenses/go-sql-driver-mysql-MPL-2.0.txt).
|
||||
- Copyright: The Go-MySQL-Driver Authors; the original per-file notices and
|
||||
`AUTHORS` are preserved in the accompanying source archive.
|
||||
- Modifications by WeKnora: none. Dialer configuration is in separate WeKnora files.
|
||||
- Modifications by Academy: none. Dialer configuration is in separate Academy files.
|
||||
- Corresponding source, available under MPL-2.0, is included in binary releases
|
||||
as `licenses/sources/mysql-v1.10.0.zip`. Source repository users can obtain it from the
|
||||
[Go module proxy](https://proxy.golang.org/github.com/go-sql-driver/mysql/@v/v1.10.0.zip)
|
||||
@@ -33,7 +33,7 @@ Windows installers place them next to the installed executable.
|
||||
[`licenses/go-m1cpu-MPL-2.0.txt`](licenses/go-m1cpu-MPL-2.0.txt).
|
||||
- Attribution: the go-m1cpu project and its contributors. The complete original
|
||||
source and notices are preserved in the accompanying archive.
|
||||
- Modifications by WeKnora: none.
|
||||
- Modifications by Academy: none.
|
||||
- Corresponding source, available under MPL-2.0, is included in binary releases
|
||||
as `licenses/sources/go-m1cpu-v0.1.6.zip`. Source repository users can obtain it from the
|
||||
[Go module proxy](https://proxy.golang.org/github.com/shoenig/go-m1cpu/@v/v0.1.6.zip)
|
||||
@@ -47,8 +47,8 @@ Windows installers place them next to the installed executable.
|
||||
- License: Apache-2.0, reproduced in
|
||||
[`licenses/OpenCC-Apache-2.0.txt`](licenses/OpenCC-Apache-2.0.txt).
|
||||
- Source: [versioned dictionary directory](https://github.com/longbridgeapp/opencc/tree/v0.3.13/dictionary)
|
||||
and the two text files distributed with WeKnora's source.
|
||||
- Only dictionary data is retained. WeKnora uses its own standard-library lookup
|
||||
and the two text files distributed with Academy's source.
|
||||
- Only dictionary data is retained. Academy uses its own standard-library lookup
|
||||
implementation; the upstream Go converter, `liuzl/da`, and GPL-licensed
|
||||
`cedar-go` code are not included.
|
||||
|
||||
@@ -99,7 +99,7 @@ than in `licenses/sources/modules.tsv`, which records Go modules only
|
||||
are distributed under Apache-2.0 as well, and their provenance and
|
||||
redistribution terms are recorded in
|
||||
[`licenses/rapidocr-MODEL_LICENSES.md`](licenses/rapidocr-MODEL_LICENSES.md).
|
||||
- Modifications by WeKnora: none. The integration calls the published API and
|
||||
- Modifications by Academy: none. The integration calls the published API and
|
||||
adds no changes to the component.
|
||||
- Corresponding source: [PyPI](https://pypi.org/project/rapidocr/3.10.0/) and
|
||||
[upstream repository](https://github.com/RapidAI/RapidOCR).
|
||||
@@ -111,7 +111,7 @@ than in `licenses/sources/modules.tsv`, which records Go modules only
|
||||
- License: MIT License, reproduced in
|
||||
[`licenses/onnxruntime-MIT.txt`](licenses/onnxruntime-MIT.txt).
|
||||
- Copyright: Microsoft Corporation.
|
||||
- Modifications by WeKnora: none.
|
||||
- Modifications by Academy: none.
|
||||
- Corresponding source: [PyPI](https://pypi.org/project/onnxruntime/1.23.2/) and
|
||||
[upstream repository](https://github.com/microsoft/onnxruntime).
|
||||
|
||||
@@ -127,7 +127,7 @@ than in `licenses/sources/modules.tsv`, which records Go modules only
|
||||
[`licenses/opencv-python-headless-THIRD-PARTY.txt`](licenses/opencv-python-headless-THIRD-PARTY.txt).
|
||||
- Copyright: The OpenCV Foundation and contributors (see the notice file for
|
||||
the per-component attributions it carries).
|
||||
- Modifications by WeKnora: none.
|
||||
- Modifications by Academy: none.
|
||||
- Corresponding source: [PyPI](https://pypi.org/project/opencv-python-headless/5.0.0.93/)
|
||||
and [upstream repository](https://github.com/opencv/opencv-python).
|
||||
|
||||
@@ -138,6 +138,6 @@ than in `licenses/sources/modules.tsv`, which records Go modules only
|
||||
- License: BSD 3-Clause License, reproduced in
|
||||
[`licenses/numpy-BSD-3-Clause.txt`](licenses/numpy-BSD-3-Clause.txt).
|
||||
- Copyright: The NumPy Developers.
|
||||
- Modifications by WeKnora: none.
|
||||
- Modifications by Academy: none.
|
||||
- Corresponding source: [PyPI](https://pypi.org/project/numpy/2.3.4/) and
|
||||
[upstream repository](https://github.com/numpy/numpy).
|
||||
+56
-56
@@ -1,8 +1,8 @@
|
||||
# AGENTS.md
|
||||
|
||||
This is the WeKnora CLI (`weknora`), a command-line client for the WeKnora RAG server. The module path is `github.com/Tencent/WeKnora/cli`.
|
||||
This is the Academy CLI (`academy`), a command-line client for the Academy RAG server. The module path is `github.com/Tencent/WeKnora/cli`.
|
||||
|
||||
The wire contract for AI agents *consuming* `weknora` output (JSON shape, exit codes, error format) is documented below and in [README.md](README.md). Read this file if you're integrating with the CLI binary — build / test / architecture details follow the wire contract sections.
|
||||
The wire contract for AI agents *consuming* `academy` output (JSON shape, exit codes, error format) is documented below and in [README.md](README.md). Read this file if you're integrating with the CLI binary — build / test / architecture details follow the wire contract sections.
|
||||
|
||||
## Wire contract for AI agents
|
||||
|
||||
@@ -55,8 +55,8 @@ Errors emit an error envelope on stderr (`--format json`) or prose
|
||||
"error": {
|
||||
"type": "auth.unauthenticated",
|
||||
"message": "fetch current user: HTTP error 401",
|
||||
"hint": "run `weknora auth login`",
|
||||
"retry_argv": ["weknora", "auth", "login"],
|
||||
"hint": "run `academy auth login`",
|
||||
"retry_argv": ["academy", "auth", "login"],
|
||||
"retry_after_seconds": 0,
|
||||
"risk": {"level": "destructive", "action": "noun.verb"},
|
||||
"detail": {}
|
||||
@@ -125,21 +125,21 @@ Make errors structured, actionable, and specific.
|
||||
|
||||
| Variable | Purpose |
|
||||
|---|---|
|
||||
| `WEKNORA_PROFILE` | Active profile name. Equivalent to the global `--profile <name>` flag; overridden by `--profile`. Useful in CI scripts that cannot pass global flags. |
|
||||
| `WEKNORA_FORMAT` | Default `--format` value (`text \| json \| ndjson`). Overridden by explicit `--format`. Invalid values ignored silently. |
|
||||
| `WEKNORA_KB_ID` | Default KB ID for commands that accept `--kb`. Overridden by `--kb`. |
|
||||
| `WEKNORA_LOG_LEVEL` | SDK debug log level (`error \| warn \| info \| debug`). Overridden by `--log-level`. |
|
||||
| `WEKNORA_AGENT_HELP` | Set to `1` to emit structured JSON agent-help (machine-readable) instead of human help text when `--help` is invoked. |
|
||||
| `ACADEMY_PROFILE` | Active profile name. Equivalent to the global `--profile <name>` flag; overridden by `--profile`. Useful in CI scripts that cannot pass global flags. |
|
||||
| `ACADEMY_FORMAT` | Default `--format` value (`text \| json \| ndjson`). Overridden by explicit `--format`. Invalid values ignored silently. |
|
||||
| `ACADEMY_KB_ID` | Default KB ID for commands that accept `--kb`. Overridden by `--kb`. |
|
||||
| `ACADEMY_LOG_LEVEL` | SDK debug log level (`error \| warn \| info \| debug`). Overridden by `--log-level`. |
|
||||
| `ACADEMY_AGENT_HELP` | Set to `1` to emit structured JSON agent-help (machine-readable) instead of human help text when `--help` is invoked. |
|
||||
|
||||
> **Note for agents — machine-readable version and help:** The `--version` flag
|
||||
> and `--help` flag on the root command bypass `--format json` and always emit
|
||||
> prose (cobra built-in paths). For machine-readable output use the `version`
|
||||
> subcommand (`weknora version --format json`) or `WEKNORA_AGENT_HELP=1
|
||||
> weknora <cmd> --help`. Planned fix for v0.8.
|
||||
> subcommand (`academy version --format json`) or `ACADEMY_AGENT_HELP=1
|
||||
> academy <cmd> --help`. Planned fix for v0.8.
|
||||
|
||||
## Design decisions worth flagging
|
||||
|
||||
Five design decisions readers may want context on: where WeKnora picks an
|
||||
Five design decisions readers may want context on: where Academy picks an
|
||||
opinionated default, what the trade-off is, and what mainstream practice it
|
||||
is or isn't aligned with.
|
||||
|
||||
@@ -147,28 +147,28 @@ is or isn't aligned with.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| **WeKnora** | success envelope → stdout; error envelope → stderr |
|
||||
| **Rationale** | `weknora ... --format json \| jq '.data[]'` must not mix error objects into the data stream. Channel split lets pipeline consumers suppress errors with `2>/dev/null` and still get clean JSON on stdout. |
|
||||
| **Academy** | success envelope → stdout; error envelope → stderr |
|
||||
| **Rationale** | `academy ... --format json \| jq '.data[]'` must not mix error objects into the data stream. Channel split lets pipeline consumers suppress errors with `2>/dev/null` and still get clean JSON on stdout. |
|
||||
|
||||
### 2. `weknora api DELETE` triggers exit-10 confirmation
|
||||
### 2. `academy api DELETE` triggers exit-10 confirmation
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| **WeKnora** | DELETE triggers exit-10 (`input.confirmation_required`); user bypasses with `-y/--yes` |
|
||||
| **Academy** | DELETE triggers exit-10 (`input.confirmation_required`); user bypasses with `-y/--yes` |
|
||||
| **Rationale** | DELETE is irreversible. Most raw-API CLI commands rely on restricted credentials for safety, but self-hosted deployments may not have restricted-credential infrastructure available. Defensive default because agents are common consumers. |
|
||||
|
||||
### 3. `retry_argv` distinct from `hint`
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| **WeKnora** | two separate fields: `retry_argv` (suggested next argv as a string array, directly executable for non-destructive errors; informational only on exit-10) + `hint` (prose) |
|
||||
| **Academy** | two separate fields: `retry_argv` (suggested next argv as a string array, directly executable for non-destructive errors; informational only on exit-10) + `hint` (prose) |
|
||||
| **Rationale** | Agents don't regex-extract argv from prose — known fragility. Trade-off: one extra envelope field. On exit-10, the user must approve the destructive write; agents surface `retry_argv` for human review, not auto-execution. |
|
||||
|
||||
### 4. NDJSON event stream has no envelope wrapping
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| **WeKnora** | streaming commands (`chat`, `session ask`) emit bare `{type:...}` per line; no envelope |
|
||||
| **Academy** | streaming commands (`chat`, `session ask`) emit bare `{type:...}` per line; no envelope |
|
||||
| **Rationale** | This matches established practice across NDJSON-emitting CLIs and webhook protocols. A streaming envelope requires unwrap before dispatch — net burden with no benefit. |
|
||||
|
||||
### 5. No `schema_version` field in payload
|
||||
@@ -176,8 +176,8 @@ is or isn't aligned with.
|
||||
| | |
|
||||
|---|---|
|
||||
| **Mainstream** | some APIs (Anthropic / OpenAI) embed a `version` field in payload |
|
||||
| **WeKnora** | version identity via CLI binary semver + CHANGELOG `### BREAKING` + skill `tested_against` + CI parity tests |
|
||||
| **Rationale** | Mainstream CLIs don't embed version in payload. Agents have complete version awareness via `weknora --version` and skill version binding. |
|
||||
| **Academy** | version identity via CLI binary semver + CHANGELOG `### BREAKING` + skill `tested_against` + CI parity tests |
|
||||
| **Rationale** | Mainstream CLIs don't embed version in payload. Agents have complete version awareness via `academy --version` and skill version binding. |
|
||||
|
||||
## Pre-1.0 breaking policy
|
||||
|
||||
@@ -193,7 +193,7 @@ For agents: pin the CLI version in your skill's `tested_against` field; bump
|
||||
## Build, Test, and Lint
|
||||
|
||||
```bash
|
||||
go build -o weknora . # build (from cli/)
|
||||
go build -o academy . # build (from cli/)
|
||||
go test -count=1 ./... # unit + contract tests
|
||||
go test -run TestFoo ./internal/format/ # single test
|
||||
go test ./acceptance/contract/ -args -update # refresh wire goldens
|
||||
@@ -221,7 +221,7 @@ Key packages:
|
||||
|
||||
## Command Structure
|
||||
|
||||
A command `weknora foo bar` lives in `cmd/foo/bar.go` with `bar_test.go`.
|
||||
A command `academy foo bar` lives in `cmd/foo/bar.go` with `bar_test.go`.
|
||||
|
||||
### Canonical Examples
|
||||
|
||||
@@ -248,12 +248,12 @@ Key rules:
|
||||
|
||||
### Command Examples and Help Text
|
||||
|
||||
Use a Go raw string with `weknora` as the example prefix. Keep one-line `Short` ≤ 70 chars; `Long` may run multi-paragraph; `Example` always includes `weknora` so copy-paste works:
|
||||
Use a Go raw string with `academy` as the example prefix. Keep one-line `Short` ≤ 70 chars; `Long` may run multi-paragraph; `Example` always includes `academy` so copy-paste works:
|
||||
|
||||
```go
|
||||
Example: ` weknora kb view <id>
|
||||
weknora kb view kb_abc --format json
|
||||
weknora kb view kb_abc --format json --jq '{id, name}'`,
|
||||
Example: ` academy kb view <id>
|
||||
academy kb view kb_abc --format json
|
||||
academy kb view kb_abc --format json --jq '{id, name}'`,
|
||||
```
|
||||
|
||||
### JSON Output
|
||||
@@ -359,10 +359,10 @@ User-facing exit-code mapping lives in [README.md "Exit codes"](README.md#exit-c
|
||||
|
||||
## Error code reference
|
||||
|
||||
> **Audience:** AI agents and scripted callers parsing `weknora` stderr.
|
||||
> **Audience:** AI agents and scripted callers parsing `academy` stderr.
|
||||
> Code authors writing new error sites — see [`## Error Handling`](#error-handling) above.
|
||||
|
||||
When `weknora` exits non-zero, stderr carries a structured triplet:
|
||||
When `academy` exits non-zero, stderr carries a structured triplet:
|
||||
|
||||
```
|
||||
<code>: <message>
|
||||
@@ -378,35 +378,35 @@ Agents parse the first colon to extract the typed code. The exit code class (see
|
||||
|
||||
| Code | Exit | Retryable | Default hint |
|
||||
|---|---|---|---|
|
||||
| `auth.unauthenticated` | 3 | no (run `auth login`) | run `weknora auth login` |
|
||||
| `auth.token_expired` | 3 | yes (after refresh) | your session expired; run `weknora auth login` to re-authenticate |
|
||||
| `auth.bad_credential` | 3 | no (re-login) | run `weknora auth login` |
|
||||
| `auth.unauthenticated` | 3 | no (run `auth login`) | run `academy auth login` |
|
||||
| `auth.token_expired` | 3 | yes (after refresh) | your session expired; run `academy auth login` to re-authenticate |
|
||||
| `auth.bad_credential` | 3 | no (re-login) | run `academy auth login` |
|
||||
| `auth.forbidden` | 3 | no | active profile lacks permission for this resource |
|
||||
| `auth.cross_tenant_blocked` | 3 | no | verify tenant context with `weknora auth status` |
|
||||
| `auth.tenant_mismatch` | 3 | no | verify tenant context with `weknora auth status` |
|
||||
| `input.invalid_argument` | 5 | no | see `weknora <command> --help` for valid usage |
|
||||
| `input.missing_flag` | 5 | no | see `weknora <command> --help` for valid usage |
|
||||
| `auth.cross_tenant_blocked` | 3 | no | verify tenant context with `academy auth status` |
|
||||
| `auth.tenant_mismatch` | 3 | no | verify tenant context with `academy auth status` |
|
||||
| `input.invalid_argument` | 5 | no | see `academy <command> --help` for valid usage |
|
||||
| `input.missing_flag` | 5 | no | see `academy <command> --help` for valid usage |
|
||||
| `input.confirmation_required` | 10 | **NO automatic retry** | high-risk write - re-run with `-y/--yes` after the user explicitly approves |
|
||||
| `input.unknown_subcommand` | 5 | no | invocation reached a command path with no matching subcommand. Detail includes `available` list; retry with `<path> --help`. |
|
||||
| `resource.not_found` | 4 | no | verify the resource ID and try again |
|
||||
| `resource.already_exists` | 1 | no | use a different name or fetch the existing resource |
|
||||
| `resource.locked` | 1 | maybe (transient lock) | (no canonical hint; check resource state) |
|
||||
| `server.error` | 7 | yes (with backoff for 5xx) | (no canonical hint) |
|
||||
| `server.timeout` | 7 | yes (with backoff) | request timed out; retry, or run `weknora doctor` to check connectivity |
|
||||
| `server.timeout` | 7 | yes (with backoff) | request timed out; retry, or run `academy doctor` to check connectivity |
|
||||
| `server.rate_limited` | 6 | yes (back off, then retry) | rate-limited; retry after a few seconds |
|
||||
| `server.session_create_failed` | 1 | yes (with backoff) | could not create a chat session; pass `--session` to reuse an existing session |
|
||||
| `server.incompatible_version` | 7 | no (upgrade required) | run `weknora doctor` to see version skew details |
|
||||
| `network.error` | 7 | yes (with backoff) | check base URL reachability with `weknora doctor` |
|
||||
| `server.incompatible_version` | 7 | no (upgrade required) | run `academy doctor` to see version skew details |
|
||||
| `network.error` | 7 | yes (with backoff) | check base URL reachability with `academy doctor` |
|
||||
| `operation.timeout` | 124 | yes (raise `--timeout`) | wait timed out; raise `--timeout` or check the underlying job |
|
||||
| `operation.failed` | 1 | no (target reached terminal failure) | one or more targets reached a terminal failure (e.g. doc parse_status=failed) |
|
||||
| `operation.cancelled` | 1 (main overrides to 130) | no | command interrupted by SIGINT / SIGTERM. The typed code maps to exit 1, but `main` raises the exit to 130 when the root context was signal-cancelled so the user-visible exit follows Unix signal convention. |
|
||||
| `local.config_corrupt` | 1 | no (manual fix) | remove `~/.config/weknora/config.yaml` and re-run `weknora auth login` |
|
||||
| `local.profile_not_found` | 1 | no | (no canonical hint; check `weknora profile list`) |
|
||||
| `local.file_io` | 1 | no | check file permissions under `$XDG_CONFIG_HOME/weknora/` |
|
||||
| `local.kb_id_required` | 1 | no | run `weknora link` to bind this directory to a knowledge base, or pass `--kb` |
|
||||
| `local.kb_not_found` | 1 | no | list available with `weknora kb list` |
|
||||
| `local.config_corrupt` | 1 | no (manual fix) | remove `~/.config/academy/config.yaml` and re-run `academy auth login` |
|
||||
| `local.profile_not_found` | 1 | no | (no canonical hint; check `academy profile list`) |
|
||||
| `local.file_io` | 1 | no | check file permissions under `$XDG_CONFIG_HOME/academy/` |
|
||||
| `local.kb_id_required` | 1 | no | run `academy link` to bind this directory to a knowledge base, or pass `--kb` |
|
||||
| `local.kb_not_found` | 1 | no | list available with `academy kb list` |
|
||||
| `local.keychain_denied` | 1 | no (system-level) | verify keyring access; falls back to file storage |
|
||||
| `local.project_link_corrupt` | 1 | no | remove `.weknora/project.yaml` and run `weknora link` again |
|
||||
| `local.project_link_corrupt` | 1 | no | remove `.academy/project.yaml` and run `academy link` again |
|
||||
| `local.sse_stream_aborted` | 1 | yes (rerun chat / session ask) | the streaming answer was cut off mid-flight; retry, or pass `--format json` to buffer the full response |
|
||||
| `local.unimplemented` | 1 | no | (planned in a future release) |
|
||||
| `local.upload_file_not_found` | 1 | no | verify the path is correct and readable |
|
||||
@@ -420,7 +420,7 @@ Agents parse the first colon to extract the typed code. The exit code class (see
|
||||
For common retry patterns, AI agents can hardcode:
|
||||
|
||||
- `network.*` → retry with exponential backoff
|
||||
- `auth.token_expired` → run `weknora auth refresh`, then retry once
|
||||
- `auth.token_expired` → run `academy auth refresh`, then retry once
|
||||
- `server.rate_limited` → back off (Retry-After if present) then retry
|
||||
- `operation.timeout` → raise `--timeout` and retry, or surface to user
|
||||
- `input.confirmation_required` → **NEVER** auto-pass `-y` without explicit user authorization
|
||||
@@ -457,7 +457,7 @@ auto-retry this exit code — every exit 10 is a user-in-the-loop decision.
|
||||
|
||||
## Stream recovery
|
||||
|
||||
The `weknora session resume <session-id> --message <msg-id>` command resumes an SSE event stream for an existing assistant message. Use cases: network-blip recovery, long-running agent invocation polling, completed-stream inspection.
|
||||
The `academy session resume <session-id> --message <msg-id>` command resumes an SSE event stream for an existing assistant message. Use cases: network-blip recovery, long-running agent invocation polling, completed-stream inspection.
|
||||
|
||||
### Server semantics: replay-from-0, not cursor-resume
|
||||
|
||||
@@ -476,11 +476,11 @@ The server **replays all stored events from the start** of the assistant message
|
||||
| `STREAM_MANAGER_TYPE=redis` | **1 hour** (server-side; not configurable from the CLI) |
|
||||
| `STREAM_MANAGER_TYPE=memory` (default) | **Process lifetime** (server restart = data loss; no explicit cleanup logic) |
|
||||
|
||||
After TTL, `weknora session resume` returns the typed error `local.sse_stream_aborted`, which maps to exit code 1 per the Error code reference.
|
||||
After TTL, `academy session resume` returns the typed error `local.sse_stream_aborted`, which maps to exit code 1 per the Error code reference.
|
||||
|
||||
## Dry-run contract
|
||||
|
||||
The `--dry-run` flag is available on every mutation cobra command (`kb create/edit/delete`, `agent create/edit/delete`, `doc create/upload/fetch/delete`, `chunk delete`, `session delete`, `auth refresh/logout`, `link/unlink`, `profile add/remove`) and on `weknora api` (POST/PUT/PATCH/DELETE only; GET rejected with FlagError exit 2).
|
||||
The `--dry-run` flag is available on every mutation cobra command (`kb create/edit/delete`, `agent create/edit/delete`, `doc create/upload/fetch/delete`, `chunk delete`, `session delete`, `auth refresh/logout`, `link/unlink`, `profile add/remove`) and on `academy api` (POST/PUT/PATCH/DELETE only; GET rejected with FlagError exit 2).
|
||||
|
||||
### Envelope shape on dry-run
|
||||
|
||||
@@ -498,7 +498,7 @@ Success envelope (exit 0) with `data` field omitted (omitempty) and `meta.dry_ru
|
||||
|
||||
### Side effects suppressed
|
||||
|
||||
The dry-run path is **offline** — no SDK calls, no Factory.Client() init, no ResolveKB network query, no writes (keyring / `.weknora/project.yaml` / files). Works without active profile or network access.
|
||||
The dry-run path is **offline** — no SDK calls, no Factory.Client() init, no ResolveKB network query, no writes (keyring / `.academy/project.yaml` / files). Works without active profile or network access.
|
||||
|
||||
### Interactions
|
||||
|
||||
@@ -517,7 +517,7 @@ The dry-run path is **offline** — no SDK calls, no Factory.Client() init, no R
|
||||
`session ask` and `chat` do NOT support `--dry-run` (streaming and dry-run have a semantic mismatch). For prompt-formation preview, use:
|
||||
|
||||
```bash
|
||||
echo '{"query":"...","kb":"..."}' | weknora api -X POST /api/v1/sessions/<id>/agent-qa --input - --dry-run
|
||||
echo '{"query":"...","kb":"..."}' | academy api -X POST /api/v1/sessions/<id>/agent-qa --input - --dry-run
|
||||
```
|
||||
|
||||
## Risk metadata
|
||||
@@ -526,15 +526,15 @@ Agents see the same `risk.action` string (in the form `noun.verb`) on three inde
|
||||
|
||||
1. **Error envelope** — `envelope.error.risk.action` on an exit-10 confirmation-required error, so the agent can decide whether to escalate to the user. 11 unique values: `kb.delete`, `kb.edit`, `agent.delete`, `agent.edit`, `doc.delete`, `doc.delete_all`, `session.delete`, `chunk.delete`, `profile.remove`, `auth.logout`, `api.delete`.
|
||||
|
||||
2. **Help text** — a `Risk: <action> (destructive)` line prepended to the top of `--help` output on the 9 destructive cobra commands. `weknora api` is intentionally excluded: it is a generic HTTP passthrough whose risk depends on the method, so a static Risk: line would mislead for non-DELETE methods.
|
||||
2. **Help text** — a `Risk: <action> (destructive)` line prepended to the top of `--help` output on the 9 destructive cobra commands. `academy api` is intentionally excluded: it is a generic HTTP passthrough whose risk depends on the method, so a static Risk: line would mislead for non-DELETE methods.
|
||||
|
||||
3. **MCP tool annotations** — `Tool.Annotations.destructiveHint` / `readOnlyHint` / `idempotentHint` / `openWorldHint` on every tool returned by `weknora mcp serve`.
|
||||
3. **MCP tool annotations** — `Tool.Annotations.destructiveHint` / `readOnlyHint` / `idempotentHint` / `openWorldHint` on every tool returned by `academy mcp serve`.
|
||||
|
||||
The three surfaces do not auto-sync: each is wired separately so agents that only consume one surface still get the signal, but contributors adding a new destructive command must touch all three.
|
||||
|
||||
## MCP Tool Surface
|
||||
|
||||
WeKnora's MCP server exposes a curated read-only tool surface. Many MCP servers in the wild ship write / mutation operations on by default and rely on credential-scope or sandbox restrictions for safety. WeKnora opts for curation instead: the server side doesn't yet enforce per-token scope, so an agent holding a user's token has full write access. Until server-side scope ships, the CLI keeps mutation tools out of the MCP surface as a belt-and-braces second line of defense. When server scope arrives this stance can loosen.
|
||||
Academy's MCP server exposes a curated read-only tool surface. Many MCP servers in the wild ship write / mutation operations on by default and rely on credential-scope or sandbox restrictions for safety. Academy opts for curation instead: the server side doesn't yet enforce per-token scope, so an agent holding a user's token has full write access. Until server-side scope ships, the CLI keeps mutation tools out of the MCP surface as a belt-and-braces second line of defense. When server scope arrives this stance can loosen.
|
||||
|
||||
The curated 10 tools (`cli/internal/mcp/tools.go`):
|
||||
|
||||
@@ -562,7 +562,7 @@ Before specifying any CLI command, do this in order:
|
||||
3. For each field, decide: hot-path flag / config-file only / hidden / never-expose.
|
||||
4. Cross-check pagination signatures: an SDK `(ctx, id, page, pageSize)` shape demands `--limit` + `--all-pages` + `--page-size` on the CLI side.
|
||||
5. ONLY THEN consult mainstream CLI conventions to choose flag names, positionals, mutex, and confirm semantics.
|
||||
6. Decide which fields are "top use case" (flag) / "advanced" (`--config-file` or escape hatch via `weknora api`). Don't try to flag-cover every SDK field — mature CLIs that curate ship a tighter surface; CLIs that 1:1 mirror their API pay the UX cost.
|
||||
6. Decide which fields are "top use case" (flag) / "advanced" (`--config-file` or escape hatch via `academy api`). Don't try to flag-cover every SDK field — mature CLIs that curate ship a tighter surface; CLIs that 1:1 mirror their API pay the UX cost.
|
||||
|
||||
Rationale: earlier drafts produced three categories of schema errors — fields that didn't exist on the underlying SDK, wrong field counts in user-facing docs, and missing pagination flags — that all stemmed from "design from convention, not from SDK." The fix is canonical: the SDK schema is the ground truth; convention decides names and shapes around that ground truth.
|
||||
|
||||
@@ -581,12 +581,12 @@ Reasons hard-required-flags is the v0.5+ default:
|
||||
|
||||
- Admin / debug commands have no natural human-interactive prompt to lean on.
|
||||
- Agent-friendly: MCP callers do not stall waiting for stdin prompts.
|
||||
- Consistent with every existing non-auth WeKnora command.
|
||||
- Consistent with every existing non-auth Academy command.
|
||||
|
||||
- **Agent help blob**: Commands MAY call
|
||||
`cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{...})` to expose a stable
|
||||
JSON used_for / required_flags / examples / output / warnings shape.
|
||||
Activated by `WEKNORA_AGENT_HELP=1` at `--help` time. Warnings are
|
||||
Activated by `ACADEMY_AGENT_HELP=1` at `--help` time. Warnings are
|
||||
always rendered in human help (stderr, not env-gated). Applied to
|
||||
`chat`, `kb list`, `session ask`, and all destructive commands.
|
||||
Extending to another command requires touching only that command's `NewCmd`.
|
||||
|
||||
+74
-74
@@ -1,11 +1,11 @@
|
||||
# Changelog — `weknora` CLI
|
||||
# Changelog — `academy` CLI
|
||||
|
||||
All notable changes to the `weknora` CLI (the binary under `cli/` in this
|
||||
All notable changes to the `academy` CLI (the binary under `cli/` in this
|
||||
repository) will be documented in this file.
|
||||
|
||||
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and the CLI follows [Semantic Versioning](https://semver.org/) independently
|
||||
of the WeKnora server / frontend release cadence.
|
||||
of the Academy server / frontend release cadence.
|
||||
|
||||
CLI history before v0.3 is recorded in the project root
|
||||
[CHANGELOG.md](../CHANGELOG.md) under the release that introduced the CLI.
|
||||
@@ -38,8 +38,8 @@ CLI history before v0.3 is recorded in the project root
|
||||
embedding model is bound); `kb create` hints the fix when it is false.
|
||||
- `model create` / `model update` / `model delete` (`update` rotates key /
|
||||
base-url in place, preserving the id).
|
||||
- Stateless env-credential auth: `WEKNORA_API_KEY` / `WEKNORA_TOKEN` +
|
||||
`WEKNORA_HOST`, a zero-disk path for headless / agent use. `auth logout` now
|
||||
- Stateless env-credential auth: `ACADEMY_API_KEY` / `ACADEMY_TOKEN` +
|
||||
`ACADEMY_HOST`, a zero-disk path for headless / agent use. `auth logout` now
|
||||
keeps the profile registered (use `profile remove` to delete it entirely).
|
||||
- `meta.total_count` on paginated list / search output (full result size before
|
||||
client-side `--limit` truncation).
|
||||
@@ -70,7 +70,7 @@ CLI history before v0.3 is recorded in the project root
|
||||
### v0.9 — auth/profile model harmonization + flag cleanup
|
||||
|
||||
#### Added
|
||||
- `weknora session stop <session-id>` command to abort an in-flight agent run.
|
||||
- `academy session stop <session-id>` command to abort an in-flight agent run.
|
||||
- `profile add --use`: switch to the newly-added profile immediately (instead of only auto-selecting the first profile added).
|
||||
- `-L` shorthand on `session view` (alias for `--limit`).
|
||||
- `doc download --format json` now emits a success envelope (was bare).
|
||||
@@ -83,7 +83,7 @@ CLI history before v0.3 is recorded in the project root
|
||||
- **`--kb` now accepts a knowledge-base name *or* id** on `doc delete --all` and `search chunks` / `search docs`; it stays required (no silent project-link fallback on these commands).
|
||||
- **`agent create --kb` renamed to `--attach-kb`** to disambiguate from the global `--kb` scope flag.
|
||||
- **MCP tool `agent_invoke` renamed to `session_ask`** (clean rename — external MCP clients must update cached tool schemas).
|
||||
- **`auth login` drops `--host` and `--name`.** It authenticates the active profile; create it first with `weknora profile add <name> --host <h> --use`. Target a non-active profile with the global `weknora --profile <name> auth login`.
|
||||
- **`auth login` drops `--host` and `--name`.** It authenticates the active profile; create it first with `academy profile add <name> --host <h> --use`. Target a non-active profile with the global `academy --profile <name> auth login`.
|
||||
- **`auth logout` and `auth refresh` drop `--name`.** They act on the active profile; target another with the global `--profile <name>`.
|
||||
|
||||
#### Removed
|
||||
@@ -94,9 +94,9 @@ CLI history before v0.3 is recorded in the project root
|
||||
### v0.8 — Agent safety nets + MCP annotations
|
||||
|
||||
#### Added
|
||||
- `--dry-run` flag on every mutation cobra command (`kb create/edit/delete`, `agent create/edit/delete`, `doc create/upload/fetch/delete`, `chunk delete`, `session delete`, `auth refresh/logout`, `link/unlink`, `profile add/remove`) and on `weknora api` (POST/PUT/PATCH/DELETE only; GET returns FlagError exit 2).
|
||||
- `--dry-run` flag on every mutation cobra command (`kb create/edit/delete`, `agent create/edit/delete`, `doc create/upload/fetch/delete`, `chunk delete`, `session delete`, `auth refresh/logout`, `link/unlink`, `profile add/remove`) and on `academy api` (POST/PUT/PATCH/DELETE only; GET returns FlagError exit 2).
|
||||
- envelope `meta.dry_run: true` + `meta.plan: {action, args | method+path+body}` open-map fields (omitempty in non-dry-run envelopes).
|
||||
- `weknora session continue-stream <session-id> --message <msg-id>` command for SSE event stream replay/recovery.
|
||||
- `academy session continue-stream <session-id> --message <msg-id>` command for SSE event stream replay/recovery.
|
||||
- MCP `Tool.Annotations` on all 10 MCP serve tools (`destructiveHint` / `readOnlyHint` / `idempotentHint` / `openWorldHint` + `Title`) per MCP spec 2025-06-18.
|
||||
- `cli/internal/cmdutil/risk.go`: `SetRisk(cmd, action)` helper + `RiskDestructive` const + `GetRisk(cmd)` reader.
|
||||
- Help output "Risk: <action> (<level>)" line at top of 9 destructive commands' `--help` (via modified `SetAgentHelp` wrapper).
|
||||
@@ -104,7 +104,7 @@ CLI history before v0.3 is recorded in the project root
|
||||
- `cli/README.md` sections: Dry-run preview / Resuming streams.
|
||||
|
||||
#### Changed
|
||||
- `SetAgentHelp` wrapper in `cli/internal/cmdutil/agenthelp.go` now prepends "Risk:" line in default (non-JSON) help branch when `cmd.Annotations["risk.action"]` is set. WEKNORA_AGENT_HELP=1 JSON path unchanged.
|
||||
- `SetAgentHelp` wrapper in `cli/internal/cmdutil/agenthelp.go` now prepends "Risk:" line in default (non-JSON) help branch when `cmd.Annotations["risk.action"]` is set. ACADEMY_AGENT_HELP=1 JSON path unchanged.
|
||||
- 9 destructive commands' `SetAgentHelp` Warnings standardized: line 1 is a verbatim exit-10 / `-y` reminder; line 2 carries per-command destructive context.
|
||||
- `cli/cmd/api/api.go` now has `SetAgentHelp` with runtime exit-10 note for `-X DELETE/PUT/PATCH`.
|
||||
- `cli/cmd/doc/delete.go` Warnings adds a 3rd line describing `--all` blast radius.
|
||||
@@ -134,7 +134,7 @@ CLI history before v0.3 is recorded in the project root
|
||||
- v0.7: always json; TTY only affects indent (compact in pipe). Enum
|
||||
`text | json | ndjson` unchanged.
|
||||
- Migration: humans on a TTY pass `--format text` (or set
|
||||
`WEKNORA_FORMAT=text` env) for the prior auto-text behavior.
|
||||
`ACADEMY_FORMAT=text` env) for the prior auto-text behavior.
|
||||
- **`chat` / `session ask` default to NDJSON event-stream (SDK passthrough).**
|
||||
- v0.6: TTY rendered a live SSE animation; `--format json` produced a buffered
|
||||
object; NDJSON was opt-in.
|
||||
@@ -144,47 +144,47 @@ CLI history before v0.3 is recorded in the project root
|
||||
`tool_call` / `tool_result` / `references` / `thinking` / `reflection` /
|
||||
`error` / `complete` for chat; agent vocab is a subset).
|
||||
- For prose rendering: `--format text`.
|
||||
- **`weknora context` command group renamed to `weknora profile`.**
|
||||
- **`academy context` command group renamed to `academy profile`.**
|
||||
- Subcommands `context list/add/remove/use` → `profile list/add/remove/use`.
|
||||
- Global flag `--context` → `--profile`.
|
||||
- On-disk config `~/.config/weknora/config.yaml` keys `current_context:` /
|
||||
- On-disk config `~/.config/academy/config.yaml` keys `current_context:` /
|
||||
`contexts:` → `current_profile:` / `profiles:` (no backwards-compat
|
||||
alias; delete the file or rename the keys by hand to migrate).
|
||||
- Binding file `.weknora/project.yaml` field `context:` → `profile:`
|
||||
(re-run `weknora link` to regenerate).
|
||||
- Binding file `.academy/project.yaml` field `context:` → `profile:`
|
||||
(re-run `academy link` to regenerate).
|
||||
- `profile use` JSON fields `current_context` / `previous_context` →
|
||||
`current_profile` / `previous_profile`.
|
||||
- `weknora link` JSON field `context` → `profile`.
|
||||
- `academy link` JSON field `context` → `profile`.
|
||||
- Rationale: `context` collided with LLM "context window" / RAG "context" /
|
||||
Go `context.Context`. Mainstream multi-credential CLIs (AWS, Stripe,
|
||||
OpenAI, Anthropic) settle on `profile` as the term of art.
|
||||
- **`weknora agent invoke` removed; use `weknora session ask --agent <id>`.**
|
||||
- **`academy agent invoke` removed; use `academy session ask --agent <id>`.**
|
||||
- Server route is `POST /sessions/{session_id}/agent-qa` — session-anchored.
|
||||
- `weknora agent` keeps CRUD only (list / view / create / edit / delete /
|
||||
- `academy agent` keeps CRUD only (list / view / create / edit / delete /
|
||||
status / check).
|
||||
- Migration: `weknora agent invoke ag_x "Q"` →
|
||||
`weknora session ask --agent ag_x "Q"` (auto-creates session if none given).
|
||||
- **`weknora doc upload` split into three commands.**
|
||||
- `weknora doc upload <file>` — local file only.
|
||||
- `weknora doc fetch <url>` — server-side remote fetch (was `upload --from-url`).
|
||||
- `weknora doc create --text "..."` — direct text knowledge.
|
||||
- Migration: `academy agent invoke ag_x "Q"` →
|
||||
`academy session ask --agent ag_x "Q"` (auto-creates session if none given).
|
||||
- **`academy doc upload` split into three commands.**
|
||||
- `academy doc upload <file>` — local file only.
|
||||
- `academy doc fetch <url>` — server-side remote fetch (was `upload --from-url`).
|
||||
- `academy doc create --text "..."` — direct text knowledge.
|
||||
- URL-only flags (`--title`, `--file-type`, `--tag-id`) moved to `doc fetch`.
|
||||
- Rationale: `upload --from-url` mixed semantics ("send out" vs "pull in");
|
||||
the three-verb split matches the server's three endpoints and gives each
|
||||
one a single unambiguous shape.
|
||||
- **`weknora kb empty` removed; use `weknora doc delete --all --kb=<id>`.**
|
||||
- **`academy kb empty` removed; use `academy doc delete --all --kb=<id>`.**
|
||||
- Atomic server `ClearKnowledgeBaseContents` (no list-then-delete race).
|
||||
- Same exit-10 `-y/--yes` guard as `kb delete`.
|
||||
- Migration: `weknora kb empty kb_x -y` →
|
||||
`weknora doc delete --all --kb=kb_x -y`.
|
||||
- **`weknora api -d/--data` flag removed; use `--input <file>` or `--input -`
|
||||
- Migration: `academy kb empty kb_x -y` →
|
||||
`academy doc delete --all --kb=kb_x -y`.
|
||||
- **`academy api -d/--data` flag removed; use `--input <file>` or `--input -`
|
||||
(stdin).**
|
||||
- `weknora api` now accepts any non-empty HTTP method (whitelist removed)
|
||||
- `academy api` now accepts any non-empty HTTP method (whitelist removed)
|
||||
so the escape hatch can hit endpoints the CLI doesn't natively model.
|
||||
- Migration: `weknora api -d '{"foo":1}' /endpoint` →
|
||||
`echo '{"foo":1}' | weknora api --input - /endpoint`.
|
||||
- Migration: `academy api -d '{"foo":1}' /endpoint` →
|
||||
`echo '{"foo":1}' | academy api --input - /endpoint`.
|
||||
- **Batch operations envelope shape — per-item `ok` pattern.**
|
||||
- `weknora doc delete id1,id2,id3` and similar multi-id mutations now emit:
|
||||
- `academy doc delete id1,id2,id3` and similar multi-id mutations now emit:
|
||||
`{ok, data:[{id, ok, result?|error?}, ...], meta:{count, successes, failures}}`.
|
||||
- Top-level `ok` = AND-aggregate of per-item `ok` (false on partial failure).
|
||||
- All-fail stays in batch shape (not error envelope) — agents can iterate
|
||||
@@ -197,24 +197,24 @@ CLI history before v0.3 is recorded in the project root
|
||||
- **Unknown subcommand emits typed envelope.**
|
||||
- `input.unknown_subcommand` with `detail.{unknown, command_path, available[]}`
|
||||
+ `retry_command: "<parent> --help"`. Replaces v0.6's free-form
|
||||
`"unknown command \"x\" for \"weknora\""` prose.
|
||||
- **`weknora chat` requires the query as a single quoted argument.**
|
||||
- v0.6: `MinimumNArgs(1)` silently joined `weknora chat hello world` into
|
||||
`"unknown command \"x\" for \"academy\""` prose.
|
||||
- **`academy chat` requires the query as a single quoted argument.**
|
||||
- v0.6: `MinimumNArgs(1)` silently joined `academy chat hello world` into
|
||||
`"hello world"`.
|
||||
- v0.7: `ExactArgs(1)` rejects multi-arg with exit 2; matches
|
||||
`weknora session ask`. Quote the query: `weknora chat "hello world"`.
|
||||
`academy session ask`. Quote the query: `academy chat "hello world"`.
|
||||
|
||||
#### Added
|
||||
- **`WEKNORA_PROFILE` env var** selects the active profile for a single
|
||||
- **`ACADEMY_PROFILE` env var** selects the active profile for a single
|
||||
invocation (equivalent to `--profile <name>` global flag). Overridden by
|
||||
explicit `--profile`. Useful for CI scripts that cannot pass global flags.
|
||||
- **`WEKNORA_FORMAT` env var** sets the default `--format`. Values:
|
||||
- **`ACADEMY_FORMAT` env var** sets the default `--format`. Values:
|
||||
`text | json | ndjson`. Overridden by explicit `--format`. Invalid values
|
||||
ignored.
|
||||
- **`error.retry_command`** — directly-executable retry argv, distinct from
|
||||
prose `hint`. Agents read `retry_command` without regex-parsing `hint`.
|
||||
- **`error.retry_after_seconds`** — `server.rate_limited` / `server.timeout`
|
||||
surface server `Retry-After` header verbatim. CLI-direct (`weknora api`)
|
||||
surface server `Retry-After` header verbatim. CLI-direct (`academy api`)
|
||||
parses HTTP `Retry-After` headers; SDK-mediated paths will gain coverage
|
||||
as the SDK exposes typed transport errors.
|
||||
- **`error.risk.{level, action}`** — destructive writes carry
|
||||
@@ -227,11 +227,11 @@ CLI history before v0.3 is recorded in the project root
|
||||
- **`meta.count` / `meta.has_more`** on list commands. `meta.next_cursor` /
|
||||
`meta.total_count` / `meta.request_id` reserved — populated when the SDK
|
||||
exposes them (planned for v0.8).
|
||||
- **`weknora doc fetch <url>`** — new command (see split above).
|
||||
- **`weknora doc create --text "..."`** — new command (see split above).
|
||||
- **`weknora session ask --agent <id> "..."`** — new command (replaces
|
||||
- **`academy doc fetch <url>`** — new command (see split above).
|
||||
- **`academy doc create --text "..."`** — new command (see split above).
|
||||
- **`academy session ask --agent <id> "..."`** — new command (replaces
|
||||
`agent invoke`).
|
||||
- **`weknora doc delete --all --kb=<id>`** — new mode of `doc delete`
|
||||
- **`academy doc delete --all --kb=<id>`** — new mode of `doc delete`
|
||||
(replaces `kb empty`).
|
||||
- **NDJSON `init` event** at stream head for `chat` / `session ask` —
|
||||
carries `session_id` + optional `kb_id` / `agent_id` / `model` / `profile`.
|
||||
@@ -266,7 +266,7 @@ CLI history before v0.3 is recorded in the project root
|
||||
- **`--no-stream` flag removed** on `chat` / `agent invoke` → use
|
||||
**`--format json`** to buffer the full answer before printing. The bare
|
||||
text-accumulate use case (TTY but no streaming) is dropped.
|
||||
- **`WEKNORA_SDK_DEBUG=1` env removed** → use **`WEKNORA_LOG_LEVEL=debug`**.
|
||||
- **`ACADEMY_SDK_DEBUG=1` env removed** → use **`ACADEMY_LOG_LEVEL=debug`**.
|
||||
- **`kb create --name <name>` flag removed** → use positional
|
||||
**`kb create <name>`** (consistent with `agent create <name>`).
|
||||
|
||||
@@ -278,13 +278,13 @@ CLI history before v0.3 is recorded in the project root
|
||||
flag to a persistent global and made the default always `json`).
|
||||
- **`--jq '<expr>'`** flag pairs with `--format json|ndjson` to filter or
|
||||
project the JSON output via a jq expression.
|
||||
- **`weknora doc wait <id> [<id>...]`** — block until every document reaches a
|
||||
- **`academy doc wait <id> [<id>...]`** — block until every document reaches a
|
||||
terminal `parse_status`. Always wait-all — use shell composition
|
||||
(`wait id1 && wait id2`) for fail-fast.
|
||||
- `--timeout DURATION` (default 10m; exit 124 on hit)
|
||||
- `--interval DURATION` (default 2s; exponential backoff to 15s + jitter)
|
||||
- Multi-id concurrent (max 5 parallel); exit code priority 1 > 124 > 0
|
||||
- **`--log-level error|warn|info|debug`** persistent flag + `WEKNORA_LOG_LEVEL`
|
||||
- **`--log-level error|warn|info|debug`** persistent flag + `ACADEMY_LOG_LEVEL`
|
||||
env. Wires into the SDK's debug logger via the additive
|
||||
`client.SetDebugLevel(level string)` function.
|
||||
- **`kb create --storage-provider <local|minio|cos|tos|s3|oss|ks3>`** —
|
||||
@@ -292,25 +292,25 @@ CLI history before v0.3 is recorded in the project root
|
||||
(server only accepts it on create, not update). Required on self-hosted
|
||||
deployments where the server-side default doesn't pre-populate a
|
||||
provider — without it, subsequent `doc upload` returns `kb not found`.
|
||||
- **`weknora kb status <id>`** — fast health snapshot (1 HTTP). Returns
|
||||
- **`academy kb status <id>`** — fast health snapshot (1 HTTP). Returns
|
||||
reachable / counts / is_processing.
|
||||
- **`weknora kb check <id>`** — deep verification: status fields + `failed_count`
|
||||
- **`academy kb check <id>`** — deep verification: status fields + `failed_count`
|
||||
aggregated via doc list page-walk (1 + N HTTP). The verb split between
|
||||
`status` (read state cheaply) and `check` (actively verify) communicates
|
||||
cost to the caller.
|
||||
- **`weknora agent status <id>`** — fast health snapshot (1 HTTP):
|
||||
- **`academy agent status <id>`** — fast health snapshot (1 HTTP):
|
||||
reachable / model_id.
|
||||
- **`weknora agent check <id>`** — deep verification: status fields +
|
||||
- **`academy agent check <id>`** — deep verification: status fields +
|
||||
`kb_scope_all_reachable` from probing each KB in scope (1 + N HTTP). Same
|
||||
status/check verb split as kb status/check.
|
||||
- **`weknora doc delete <doc-id> [<doc-id>...]`** — positional multi-id.
|
||||
- **`academy doc delete <doc-id> [<doc-id>...]`** — positional multi-id.
|
||||
Default keep-going on failure. Single `-y/--yes` confirms the entire
|
||||
batch; non-TTY without `-y` still exits 10.
|
||||
- **`weknora session delete <session-id> [<session-id>...]`** — positional
|
||||
- **`academy session delete <session-id> [<session-id>...]`** — positional
|
||||
multi-id with the same keep-going semantics as `doc delete`.
|
||||
- **`weknora chunk delete <chunk-id> [<chunk-id>...] --doc <doc-id>`** — positional
|
||||
- **`academy chunk delete <chunk-id> [<chunk-id>...] --doc <doc-id>`** — positional
|
||||
multi-id, all chunks share the same `--doc` parent (server route requires it).
|
||||
- **`weknora api <path> --paginate`** — follows weknora's offset-based
|
||||
- **`academy api <path> --paginate`** — follows academy's offset-based
|
||||
pagination (`?page=N&page_size=M`) and merges all pages into a single
|
||||
`{data, total}` JSON response.
|
||||
- **MCP `chat` and `agent_invoke` tools** output schemas extended with
|
||||
@@ -319,7 +319,7 @@ CLI history before v0.3 is recorded in the project root
|
||||
no standard partial-response).
|
||||
- **`SetAgentHelp` pattern** — `cmdutil.SetAgentHelp(cmd, AgentHelp{...})`
|
||||
exposes a stable JSON used_for / required_flags / examples / output
|
||||
shape, activated by `WEKNORA_AGENT_HELP=1` at `--help` time. Applied
|
||||
shape, activated by `ACADEMY_AGENT_HELP=1` at `--help` time. Applied
|
||||
to `chat` and `kb list` as proof-of-pattern; extending to another
|
||||
command requires touching only that command's `NewCmd`.
|
||||
- **`cli/AGENTS.md`** gains an "Error code reference" section (35 typed
|
||||
@@ -392,40 +392,40 @@ CLI history before v0.3 is recorded in the project root
|
||||
### v0.5 — agent CRUD, chunk subtree, MCP chunk_list, audit-driven cleanup
|
||||
|
||||
#### Added
|
||||
- `weknora agent create <name> --model <id>` / `agent edit <id>` /
|
||||
- `academy agent create <name> --model <id>` / `agent edit <id>` /
|
||||
`agent delete <id>` — hybrid surface (hot-path flags for the common
|
||||
fields + `--config-file` YAML/JSON for the long tail +
|
||||
`--generate-skeleton` template emit). `--from <agent-id>` copies
|
||||
from an existing agent.
|
||||
- `weknora chunk list --doc <doc-id>` / `chunk view <chunk-id>` /
|
||||
- `academy chunk list --doc <doc-id>` / `chunk view <chunk-id>` /
|
||||
`chunk delete <chunk-id> --doc <doc-id>` — new subtree for RAG retrieval
|
||||
debug. Paginated with v0.4 `--limit` / `--page-size` / `--all-pages` canon.
|
||||
- `weknora mcp serve` adds `chunk_list` as the 10th curated tool.
|
||||
- `weknora agent view <id>` human output now renders all 34 AgentConfig
|
||||
- `academy mcp serve` adds `chunk_list` as the 10th curated tool.
|
||||
- `academy agent view <id>` human output now renders all 34 AgentConfig
|
||||
fields (previously 7), grouped into 10 presentation sections.
|
||||
- `--all-pages` / `--page-size` on `search docs` and `search sessions`
|
||||
(catching up with `session list` / `doc list` canon from v0.3+v0.4).
|
||||
- `weknora doc list` gains `--keyword` / `--file-type` / `--source` /
|
||||
- `academy doc list` gains `--keyword` / `--file-type` / `--source` /
|
||||
`--tag-id` / `--start-time` / `--end-time` (RFC3339) — matches the
|
||||
SDK's `KnowledgeListFilter` surface. Time flags reject malformed
|
||||
input with `input.invalid_argument`.
|
||||
- MCP `doc_list` tool gains the same 6 filter fields (`keyword`,
|
||||
`file_type`, `source`, `tag_id`, `start_time`, `end_time`) so agents
|
||||
have parity with the CLI.
|
||||
- `weknora session view --full` (with `--limit`, default 50, bounds
|
||||
- `academy session view --full` (with `--limit`, default 50, bounds
|
||||
1..1000) loads chat history via `LoadMessages` and renders messages
|
||||
inline after session metadata. JSON mode projects messages into a
|
||||
`messages` array. `--limit` without `--full` errors with
|
||||
`input.invalid_argument`.
|
||||
- `weknora kb view` human render now includes `TYPE`, `PINNED` (badge,
|
||||
- `academy kb view` human render now includes `TYPE`, `PINNED` (badge,
|
||||
only when set), `TEMPORARY` (badge), `PROCESSING` (with doc count,
|
||||
only when active), `SUMMARY MODEL`, and `CREATED`. Nested config
|
||||
structs stay JSON-only.
|
||||
- `weknora doc view` human render expands to include `TITLE` (when
|
||||
- `academy doc view` human render expands to include `TITLE` (when
|
||||
distinct from filename), `DESC`, `SOURCE`, `CHANNEL`, `TAG`,
|
||||
`STORAGE` (human-readable bytes), `SUMMARY`, `ENABLED`, and `HASH`
|
||||
(12-char prefix). All omit-empty.
|
||||
- `weknora doc upload` gains `--enable-multimodel` (tri-state:
|
||||
- `academy doc upload` gains `--enable-multimodel` (tri-state:
|
||||
unset/true/false), repeatable `--metadata key=value`, and
|
||||
`--channel` flags. `--enable-multimodel` and `--channel` apply to
|
||||
file / `--recursive` / `--from-url`; `--metadata` is file /
|
||||
@@ -454,14 +454,14 @@ CLI history before v0.3 is recorded in the project root
|
||||
symmetric `ErrDuplicateURL` correctly.
|
||||
|
||||
#### Breaking changes
|
||||
- `weknora search docs` now applies the keyword filter server-side via
|
||||
- `academy search docs` now applies the keyword filter server-side via
|
||||
`ListKnowledgeWithFilter` (was: page through every doc and
|
||||
substring-match client-side). Smaller wire payload on large KBs.
|
||||
**The match is now case-sensitive** (server uses `LIKE %keyword%`),
|
||||
whereas the previous client-side path lowered both sides. Callers
|
||||
that relied on case-insensitive matching (e.g. `search docs Q3`
|
||||
finding `q3 retro`) must lower-case the query themselves, or fall
|
||||
back to `weknora api` with a custom filter.
|
||||
back to `academy api` with a custom filter.
|
||||
|
||||
#### Changed
|
||||
- `cli/AGENTS.md` MCP curation rationale rewritten: curated read-only
|
||||
@@ -473,7 +473,7 @@ CLI history before v0.3 is recorded in the project root
|
||||
section includes a step reminding contributors to decide
|
||||
flag-vs-escape-hatch per field rather than trying to flag-mirror
|
||||
every SDK capability.
|
||||
- `cli/README.md` now documents the `weknora api` raw HTTP passthrough
|
||||
- `cli/README.md` now documents the `academy api` raw HTTP passthrough
|
||||
as the canonical escape hatch for deep KB config, per-request `chat`
|
||||
/ `agent invoke` overrides, and operations without a CLI verb.
|
||||
|
||||
@@ -494,15 +494,15 @@ CLI history before v0.3 is recorded in the project root
|
||||
tool descriptions.
|
||||
|
||||
#### Added
|
||||
- `weknora mcp serve` — curated read-only stdio MCP server exposing 9
|
||||
- `academy mcp serve` — curated read-only stdio MCP server exposing 9
|
||||
tools (`kb_list`, `kb_view`, `doc_list`, `doc_view`, `doc_download`,
|
||||
`search_chunks`, `chat`, `agent_list`, `agent_invoke`). Destructive
|
||||
verbs are intentionally excluded.
|
||||
- `weknora agent list` / `agent view` / `agent invoke` — manage and
|
||||
call WeKnora's server-side Custom Agent resources.
|
||||
- `weknora auth token` — print the active credential to `stdout` for
|
||||
- `academy agent list` / `agent view` / `agent invoke` — manage and
|
||||
call Academy's server-side Custom Agent resources.
|
||||
- `academy auth token` — print the active credential to `stdout` for
|
||||
scripting (raw secret by default; `--json` emits `{token, mode, context}`).
|
||||
- `weknora doc upload --from-url` — ingest a remote URL.
|
||||
- `academy doc upload --from-url` — ingest a remote URL.
|
||||
- `--json=fields,...` field projection and `--jq <expr>` filtering on
|
||||
every command that emits JSON.
|
||||
- `--limit` and `--all-pages` on list / search commands for bounded
|
||||
@@ -515,7 +515,7 @@ CLI history before v0.3 is recorded in the project root
|
||||
- `auth login --with-token` validates the supplied key against
|
||||
`/auth/me` before persisting, and prints an advisory if the keyring
|
||||
is unavailable and credentials fall back to a 0600 file under
|
||||
`$XDG_CONFIG_HOME/weknora/secrets/`.
|
||||
`$XDG_CONFIG_HOME/academy/secrets/`.
|
||||
- AGENTS.md rewritten as a developer guide (~170 lines, 6 H2 sections).
|
||||
|
||||
### v0.3 — extended management surface and a `session` subtree
|
||||
@@ -556,7 +556,7 @@ CLI history before v0.3 is recorded in the project root
|
||||
management.
|
||||
- `api --input FILE` / `api --input -` — body source for raw HTTP
|
||||
passthrough (file or stdin); mutually exclusive with `--data`.
|
||||
- `unlink` — remove the cwd's `.weknora/project.yaml` so subsequent
|
||||
- `unlink` — remove the cwd's `.academy/project.yaml` so subsequent
|
||||
commands stop auto-resolving `--kb` from it. Walks up from cwd so a
|
||||
user in a subdirectory can unlink without cd-ing to the project root.
|
||||
- Completion smoke test guards against cobra bumps silently breaking
|
||||
|
||||
+4
-4
@@ -1,16 +1,16 @@
|
||||
# Makefile for the WeKnora CLI (cli/ Go module).
|
||||
# Makefile for the Academy CLI (cli/ Go module).
|
||||
#
|
||||
# Usage:
|
||||
# make build compile to ./bin/weknora with version metadata
|
||||
# make build compile to ./bin/academy with version metadata
|
||||
# make test go test ./...
|
||||
# make test-coverage same with coverage report
|
||||
# make lint go vet (golangci-lint planned)
|
||||
# make tidy go mod tidy
|
||||
# make clean remove ./bin
|
||||
|
||||
BINARY := weknora
|
||||
BINARY := academy
|
||||
BUILD_DIR := bin
|
||||
PKG := github.com/Tencent/WeKnora/cli
|
||||
PKG := academy/cli
|
||||
|
||||
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
|
||||
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo none)
|
||||
|
||||
+95
-95
@@ -1,18 +1,18 @@
|
||||
# weknora — WeKnora CLI
|
||||
# academy — Academy CLI
|
||||
|
||||
A command-line interface for the WeKnora RAG knowledge-base server. Lets you
|
||||
A command-line interface for the Academy RAG knowledge-base server. Lets you
|
||||
authenticate, manage knowledge bases and documents, run hybrid search, and
|
||||
ask streaming RAG questions from your terminal or from an AI agent.
|
||||
|
||||
```bash
|
||||
$ weknora --help
|
||||
Command-line client for the WeKnora RAG server. Manage knowledge bases
|
||||
$ academy --help
|
||||
Command-line client for the Academy RAG server. Manage knowledge bases
|
||||
and documents, run hybrid search, chat with grounded answers, or expose
|
||||
a curated read-only MCP tool surface for AI agents.
|
||||
|
||||
Available Commands:
|
||||
agent Manage custom agents (CRUD + status/check)
|
||||
api Make a raw API request to the WeKnora server
|
||||
api Make a raw API request to the Academy server
|
||||
auth Manage authentication credentials and profiles
|
||||
chat Ask a streaming RAG question against a knowledge base
|
||||
chunk Manage document chunks (RAG retrieval debug)
|
||||
@@ -24,7 +24,7 @@ Available Commands:
|
||||
help Help about any command
|
||||
kb Manage knowledge bases
|
||||
link Bind the current directory to a knowledge base
|
||||
mcp Run weknora as a Model Context Protocol server
|
||||
mcp Run academy as a Model Context Protocol server
|
||||
message Inspect and manage messages inside chat sessions
|
||||
model Manage models (list / view / create / update / delete)
|
||||
profile Manage CLI profiles (named connection targets)
|
||||
@@ -49,9 +49,9 @@ Requires Go 1.26+.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Tencent/WeKnora.git
|
||||
cd WeKnora/cli
|
||||
go build -o weknora .
|
||||
sudo mv weknora /usr/local/bin/ # or anywhere on $PATH
|
||||
cd Academy/cli
|
||||
go build -o academy .
|
||||
sudo mv academy /usr/local/bin/ # or anywhere on $PATH
|
||||
```
|
||||
|
||||
### Pre-built binaries
|
||||
@@ -65,77 +65,77 @@ until then, use the from-source build above.
|
||||
## 5-minute quickstart
|
||||
|
||||
```bash
|
||||
# 1. Register your WeKnora server as a profile and make it active
|
||||
weknora profile add prod --host https://kb.example.com --use
|
||||
# 1. Register your Academy server as a profile and make it active
|
||||
academy profile add prod --host https://kb.example.com --use
|
||||
|
||||
# 2. Authenticate the active profile (interactive password prompt)
|
||||
weknora auth login
|
||||
academy auth login
|
||||
|
||||
# 2b. Or pipe an API key from stdin (for CI / AI agents)
|
||||
echo "sk-..." | weknora auth login --with-token
|
||||
echo "sk-..." | academy auth login --with-token
|
||||
|
||||
# 3. List knowledge bases
|
||||
weknora kb list
|
||||
academy kb list
|
||||
|
||||
# 4. Bind this directory to a knowledge base — subsequent commands auto-resolve --kb
|
||||
weknora link --kb my-knowledge-base
|
||||
academy link --kb my-knowledge-base
|
||||
|
||||
# 5. Upload a document, then block until parsing finishes
|
||||
weknora doc upload notes.md
|
||||
weknora doc wait doc_abc # exit 0 completed, 1 failed, 124 --timeout, 130 ^C
|
||||
weknora doc reparse doc_abc # re-trigger parsing if it failed, then wait again
|
||||
academy doc upload notes.md
|
||||
academy doc wait doc_abc # exit 0 completed, 1 failed, 124 --timeout, 130 ^C
|
||||
academy doc reparse doc_abc # re-trigger parsing if it failed, then wait again
|
||||
|
||||
# 6. Search
|
||||
weknora search chunks "what is reciprocal rank fusion?"
|
||||
academy search chunks "what is reciprocal rank fusion?"
|
||||
|
||||
# 7. Ask the LLM (streams to terminal)
|
||||
weknora chat "summarise the design doc"
|
||||
academy chat "summarise the design doc"
|
||||
|
||||
# 8. Manage custom agents and run them (see `weknora agent --help` / `weknora session --help`)
|
||||
weknora model list # discover a model id for --model
|
||||
weknora agent list
|
||||
weknora session ask --agent ag_abc "what's our q4 retention plan?"
|
||||
# 8. Manage custom agents and run them (see `academy agent --help` / `academy session --help`)
|
||||
academy model list # discover a model id for --model
|
||||
academy agent list
|
||||
academy session ask --agent ag_abc "what's our q4 retention plan?"
|
||||
|
||||
# 9. Inspect a document's chunks for RAG retrieval debug
|
||||
weknora chunk list --doc doc_xyz
|
||||
academy chunk list --doc doc_xyz
|
||||
|
||||
# 10. Inspect messages in a session / search across sessions
|
||||
weknora message list --session sess_abc
|
||||
weknora message search "retry policy" # cross-session Q&A retrieval
|
||||
academy message list --session sess_abc
|
||||
academy message search "retry policy" # cross-session Q&A retrieval
|
||||
|
||||
# 11. Resolve a pending tool approval (agent run blocked on approval event)
|
||||
weknora session tool-approval resolve pend_xxx -y # approve (after user go-ahead)
|
||||
weknora session resume sess_abc --message msg_xyz # resume the blocked stream
|
||||
academy session tool-approval resolve pend_xxx -y # approve (after user go-ahead)
|
||||
academy session resume sess_abc --message msg_xyz # resume the blocked stream
|
||||
|
||||
# 12. Health & verification verbs
|
||||
weknora kb status kb_abc # fast snapshot: reachable / counts / processing flag (1 HTTP)
|
||||
weknora kb check kb_abc # deep verify: also aggregates failed_count via doc list (1+N HTTP)
|
||||
weknora agent status ag_abc # fast: reachable / model_id
|
||||
weknora agent check ag_abc # deep: probes every KB in the agent's scope
|
||||
academy kb status kb_abc # fast snapshot: reachable / counts / processing flag (1 HTTP)
|
||||
academy kb check kb_abc # deep verify: also aggregates failed_count via doc list (1+N HTTP)
|
||||
academy agent status ag_abc # fast: reachable / model_id
|
||||
academy agent check ag_abc # deep: probes every KB in the agent's scope
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Agent quick start
|
||||
|
||||
For AI agents (any MCP-capable host) integrating WeKnora:
|
||||
For AI agents (any MCP-capable host) integrating Academy:
|
||||
|
||||
1. Install: build from source (see [Install](#install))
|
||||
2. Authenticate. In a sandbox / CI, the **stateless** path needs no `auth login`
|
||||
and writes nothing to disk — just set two env vars:
|
||||
```bash
|
||||
export WEKNORA_API_KEY="sk-…" # or WEKNORA_TOKEN for a bearer JWT
|
||||
export WEKNORA_HOST="https://kb.example.com"
|
||||
weknora kb list # already authenticated
|
||||
export ACADEMY_API_KEY="sk-…" # or ACADEMY_TOKEN for a bearer JWT
|
||||
export ACADEMY_HOST="https://kb.example.com"
|
||||
academy kb list # already authenticated
|
||||
```
|
||||
Or, for a persisted local profile:
|
||||
```bash
|
||||
weknora profile add prod --host <server-url> --use
|
||||
weknora auth login
|
||||
academy profile add prod --host <server-url> --use
|
||||
academy auth login
|
||||
```
|
||||
3. Register MCP in the host's MCP config:
|
||||
```json
|
||||
{"mcpServers": {"weknora": {"command": "weknora", "args": ["mcp", "serve"]}}}
|
||||
{"mcpServers": {"academy": {"command": "academy", "args": ["mcp", "serve"]}}}
|
||||
```
|
||||
4. Read the [wire contract](AGENTS.md#wire-contract-for-ai-agents) before
|
||||
parsing `--format json` output.
|
||||
@@ -143,21 +143,21 @@ For AI agents (any MCP-capable host) integrating WeKnora:
|
||||
any destructive call.
|
||||
|
||||
**Bundled Agent Skills.** This CLI ships [Agent Skills](https://agentskills.io/specification)
|
||||
under [`skills/`](skills/) that teach an agent to drive WeKnora without trial and error:
|
||||
under [`skills/`](skills/) that teach an agent to drive Academy without trial and error:
|
||||
|
||||
- [`weknora-shared`](skills/weknora-shared/SKILL.md) — **read first**: auth/profile
|
||||
- [`academy-shared`](skills/academy-shared/SKILL.md) — **read first**: auth/profile
|
||||
sequence, `--kb` resolution, the JSON-envelope + exit-code contract, the exit-10
|
||||
protocol, `--dry-run`, and CLI-vs-MCP selection.
|
||||
- [`weknora-rag-search`](skills/weknora-rag-search/SKILL.md) — when to use `chat`
|
||||
- [`academy-rag-search`](skills/academy-rag-search/SKILL.md) — when to use `chat`
|
||||
vs `session ask` vs `search chunks`, plus retrieval gotchas.
|
||||
|
||||
Install them with the CLI (the skills are embedded in the binary, no checkout
|
||||
needed):
|
||||
|
||||
```bash
|
||||
weknora skills install # writes to ~/.claude/skills
|
||||
weknora skills install --dir <agent-skills-dir> --force # other agents / overwrite
|
||||
weknora skills list --format json # what would be installed
|
||||
academy skills install # writes to ~/.claude/skills
|
||||
academy skills install --dir <agent-skills-dir> --force # other agents / overwrite
|
||||
academy skills list --format json # what would be installed
|
||||
```
|
||||
|
||||
Existing files are left untouched without `--force`; `--dry-run` previews the
|
||||
@@ -174,27 +174,27 @@ on the *active* profile (override per-invocation with the global `--profile`
|
||||
flag). Create a profile first, then authenticate it:
|
||||
|
||||
```bash
|
||||
weknora profile add prod --host https://prod.example.com --use # add + switch
|
||||
weknora auth login # authenticate active (prod)
|
||||
academy profile add prod --host https://prod.example.com --use # add + switch
|
||||
academy auth login # authenticate active (prod)
|
||||
|
||||
weknora profile add staging --host https://staging.example.com # add (stays inactive)
|
||||
echo "sk-..." | weknora --profile staging auth login --with-token # authenticate staging
|
||||
academy profile add staging --host https://staging.example.com # add (stays inactive)
|
||||
echo "sk-..." | academy --profile staging auth login --with-token # authenticate staging
|
||||
|
||||
weknora auth list
|
||||
weknora profile use prod # switch back
|
||||
academy auth list
|
||||
academy profile use prod # switch back
|
||||
```
|
||||
|
||||
Credentials are persisted to your OS keyring (Keychain on macOS, libsecret on
|
||||
Linux, Wincred on Windows) when available, otherwise to a 0600-mode file
|
||||
under `$XDG_CONFIG_HOME/weknora/secrets/`. The active profile lives in
|
||||
`~/.config/weknora/config.yaml`.
|
||||
under `$XDG_CONFIG_HOME/academy/secrets/`. The active profile lives in
|
||||
`~/.config/academy/config.yaml`.
|
||||
|
||||
To remove a profile's stored credentials:
|
||||
|
||||
```bash
|
||||
weknora auth logout # active profile
|
||||
weknora --profile staging auth logout # specific profile
|
||||
weknora auth logout --all
|
||||
academy auth logout # active profile
|
||||
academy --profile staging auth logout # specific profile
|
||||
academy auth logout --all
|
||||
```
|
||||
|
||||
---
|
||||
@@ -203,7 +203,7 @@ weknora auth logout --all
|
||||
|
||||
Designed to be AI-agent-first. Stable across minor releases; breaking
|
||||
changes announced in the changelog and the corresponding
|
||||
`weknora --version` bump. This section is the human overview; the complete,
|
||||
`academy --version` bump. This section is the human overview; the complete,
|
||||
authoritative contract (envelope field stability, error taxonomy, streaming,
|
||||
confirmation and dry-run protocols) lives in **[AGENTS.md](AGENTS.md)**.
|
||||
|
||||
@@ -222,16 +222,16 @@ symmetric envelope `{ok, data, meta?}` — `data` is an array for `list` /
|
||||
against the whole envelope, so reach into list items with `.data[]`:
|
||||
|
||||
```bash
|
||||
weknora kb list --format json # {"ok":true,"data":[{"id":"kb_x",…}],"meta":{"count":1,…}}
|
||||
weknora kb view kb_x --format json # {"ok":true,"data":{"id":"kb_x","name":"Eng",…}}
|
||||
weknora kb list --format json --jq '.data[] | {id, name}' # project listed fields out of each item
|
||||
weknora kb list --format json --jq '.data[].id' # ids only
|
||||
weknora kb list --format json --jq '.meta.count' # number returned
|
||||
academy kb list --format json # {"ok":true,"data":[{"id":"kb_x",…}],"meta":{"count":1,…}}
|
||||
academy kb view kb_x --format json # {"ok":true,"data":{"id":"kb_x","name":"Eng",…}}
|
||||
academy kb list --format json --jq '.data[] | {id, name}' # project listed fields out of each item
|
||||
academy kb list --format json --jq '.data[].id' # ids only
|
||||
academy kb list --format json --jq '.meta.count' # number returned
|
||||
```
|
||||
|
||||
`--format ndjson` is also accepted for streaming list commands; each
|
||||
element is emitted as its own JSON line. `--format json` is the default
|
||||
regardless of TTY — running `weknora kb list | jq` works without an
|
||||
regardless of TTY — running `academy kb list | jq` works without an
|
||||
explicit flag. Use `--format text` for human-readable output.
|
||||
|
||||
### Errors
|
||||
@@ -248,7 +248,7 @@ Example:
|
||||
|
||||
```
|
||||
auth.unauthenticated: fetch current user: HTTP error 401: ...
|
||||
hint: run `weknora auth login`
|
||||
hint: run `academy auth login`
|
||||
```
|
||||
|
||||
Under `--format json` the same failure is the typed error envelope on stderr
|
||||
@@ -262,7 +262,7 @@ taxonomy.
|
||||
|---|---|---|
|
||||
| `0` | success | continue |
|
||||
| `1` | typed `local.*` / `operation.failed` / unclassified | read stderr, decide retry/abort |
|
||||
| `2` | flag / argument validation error | re-check `weknora <cmd> --help` |
|
||||
| `2` | flag / argument validation error | re-check `academy <cmd> --help` |
|
||||
| `3` | `auth.*` (token missing / expired / forbidden) | re-auth, then retry |
|
||||
| `4` | `resource.not_found` | verify the resource id |
|
||||
| `5` | `input.*` (other than `confirmation_required`) | adjust args, retry |
|
||||
@@ -272,7 +272,7 @@ taxonomy.
|
||||
| `124` | `operation.timeout` (e.g. `doc wait --timeout` reached) | raise `--timeout` or check the underlying job |
|
||||
| `130` | cancelled by signal — typed `operation.cancelled` errors exit 1; `main.go` promotes the process exit to 130 when the root context was signal-cancelled (SIGINT / SIGTERM) | stop, do not retry |
|
||||
|
||||
Run `weknora exit-codes` for the machine-readable matrix (JSON); `weknora help exit-codes` for the human-readable table.
|
||||
Run `academy exit-codes` for the machine-readable matrix (JSON); `academy help exit-codes` for the human-readable table.
|
||||
|
||||
**Exit 10** is the wire-level signal for "destructive write needs
|
||||
explicit confirmation". Pass `-y/--yes` on `kb delete` /
|
||||
@@ -290,10 +290,10 @@ is the guard against unintended writes.
|
||||
the unmodified raw stream.
|
||||
- `--format json` composes with the global `--profile <name>` for
|
||||
single-shot profile overrides without disk writes.
|
||||
- `weknora mcp serve` exposes a curated read-only tool surface over
|
||||
- `academy mcp serve` exposes a curated read-only tool surface over
|
||||
stdio MCP for any MCP-compatible client.
|
||||
- `weknora schema` enumerates every command with its `used_for`, and
|
||||
`weknora schema <cmd path>` (e.g. `weknora schema doc update`) prints that
|
||||
- `academy schema` enumerates every command with its `used_for`, and
|
||||
`academy schema <cmd path>` (e.g. `academy schema doc update`) prints that
|
||||
command's full contract — `used_for`, `required_flags`, `examples`,
|
||||
`output`, `warnings`, `risk`, and local `flags` — as the standard envelope,
|
||||
so an agent can discover the surface without scraping `--help` prose.
|
||||
@@ -302,27 +302,27 @@ is the guard against unintended writes.
|
||||
|
||||
## Advanced operations not exposed as flags
|
||||
|
||||
WeKnora CLI exposes top use cases as polished commands; deep
|
||||
Academy CLI exposes top use cases as polished commands; deep
|
||||
configuration goes through the raw HTTP passthrough. CLI flag coverage
|
||||
targets common workflows, not 1:1 API parity. Examples of deep
|
||||
operations that intentionally go through `weknora api`:
|
||||
operations that intentionally go through `academy api`:
|
||||
|
||||
- **Tuning a KB's nested config** — chunking strategy, summary model,
|
||||
multimodal extraction defaults, FAQ thresholds, VLM model. Use
|
||||
`weknora api PUT /api/v1/knowledge-bases/<id> --input -` with a JSON
|
||||
`academy api PUT /api/v1/knowledge-bases/<id> --input -` with a JSON
|
||||
body matching the server's `UpdateKnowledgeBaseRequest`. (Note: the
|
||||
storage provider is set once at create time via
|
||||
`kb create --storage-provider <name>` and is not updatable.)
|
||||
- **Per-request `chat` parameters** — multi-KB scope, summary model
|
||||
override, image attachments, web search toggle. Use `weknora api POST
|
||||
override, image attachments, web search toggle. Use `academy api POST
|
||||
/api/v1/knowledge-chat/<session-id> --input -`.
|
||||
- **Per-request `session ask --agent` overrides** — same shape via
|
||||
`weknora api POST /api/v1/agent-chat/<session-id> --input -`.
|
||||
`academy api POST /api/v1/agent-chat/<session-id> --input -`.
|
||||
- **Operations without a CLI verb** — register / change-password /
|
||||
OIDC flows, organization / sharing endpoints, tenant management.
|
||||
|
||||
`weknora api --help` documents the raw passthrough. Run
|
||||
`weknora doctor` first to verify auth and base URL.
|
||||
`academy api --help` documents the raw passthrough. Run
|
||||
`academy doctor` first to verify auth and base URL.
|
||||
|
||||
---
|
||||
|
||||
@@ -332,7 +332,7 @@ Add `--dry-run` to any mutation command to preview the would-be action without e
|
||||
|
||||
```bash
|
||||
# Preview a kb create without actually creating
|
||||
weknora kb create --name "test-kb" --description "for review" --dry-run
|
||||
academy kb create --name "test-kb" --description "for review" --dry-run
|
||||
|
||||
# Output (single line; pretty-printed here for readability):
|
||||
# {
|
||||
@@ -353,32 +353,32 @@ dry-run is **offline**: no network calls, no file IO, no credential touches. Wor
|
||||
For destructive commands, dry-run does NOT trigger the exit-10 confirmation flow:
|
||||
|
||||
```bash
|
||||
weknora kb delete kb_xxxx --dry-run # exit 0, no prompt
|
||||
weknora kb delete kb_xxxx # exit 10, prompts for -y
|
||||
academy kb delete kb_xxxx --dry-run # exit 0, no prompt
|
||||
academy kb delete kb_xxxx # exit 10, prompts for -y
|
||||
```
|
||||
|
||||
For the `api` command, dry-run requires explicit write method (POST/PUT/PATCH/DELETE); GET returns FlagError:
|
||||
|
||||
```bash
|
||||
echo '{"name":"foo"}' | weknora api -X POST /api/v1/knowledge-bases --input - --dry-run # OK
|
||||
weknora api /api/v1/knowledge-bases --dry-run # exit 2: requires explicit -X
|
||||
echo '{"name":"foo"}' | academy api -X POST /api/v1/knowledge-bases --input - --dry-run # OK
|
||||
academy api /api/v1/knowledge-bases --dry-run # exit 2: requires explicit -X
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Resuming streams
|
||||
|
||||
The `weknora session resume` command resumes an SSE event stream for an existing assistant message. Useful for network-blip recovery or polling long-running agent invocations:
|
||||
The `academy session resume` command resumes an SSE event stream for an existing assistant message. Useful for network-blip recovery or polling long-running agent invocations:
|
||||
|
||||
```bash
|
||||
# Original streaming call captures session_id + message_id from init event:
|
||||
weknora session ask "..." --agent ag_xxxx --format ndjson | tee /tmp/stream.ndjson
|
||||
academy session ask "..." --agent ag_xxxx --format ndjson | tee /tmp/stream.ndjson
|
||||
# {"type":"init","session_id":"sess_abc","message_id":"msg_xyz"}
|
||||
# ... events flow ...
|
||||
# [network blip]
|
||||
|
||||
# Resume the same stream:
|
||||
weknora session resume sess_abc --message msg_xyz
|
||||
academy session resume sess_abc --message msg_xyz
|
||||
# Server REPLAYS all stored events from the start, then tails new ones.
|
||||
# Agent must dedupe (by message_id or event hash) to avoid double-processing.
|
||||
```
|
||||
@@ -390,10 +390,10 @@ An agent run may pause the stream on a tool-approval event until a human approve
|
||||
```bash
|
||||
# 1. Stream pauses with a tool-approval event carrying a pending_id.
|
||||
# 2. Surface the pending tool call to the user; get explicit go-ahead.
|
||||
weknora session tool-approval resolve pend_xxx -y # approve
|
||||
# weknora session tool-approval resolve pend_xxx --reject --reason "..." -y # reject
|
||||
academy session tool-approval resolve pend_xxx -y # approve
|
||||
# academy session tool-approval resolve pend_xxx --reject --reason "..." -y # reject
|
||||
# 3. Resume the stream — server replays + tails from where the run was blocked.
|
||||
weknora session resume sess_abc --message msg_xyz
|
||||
academy session resume sess_abc --message msg_xyz
|
||||
```
|
||||
|
||||
Pass `--modified-args '{"key":"value"}'` to replace tool arguments on approve (must be a non-empty JSON object). Never auto-pass `-y` — the approval is the exit-10 human-in-the-loop gate.
|
||||
@@ -406,7 +406,7 @@ See `cli/AGENTS.md` "Stream recovery" section for the full agent contract.
|
||||
|
||||
## Health check
|
||||
|
||||
Run `weknora doctor` for a 4-status diagnostic (OK / warn / fail /
|
||||
Run `academy doctor` for a 4-status diagnostic (OK / warn / fail /
|
||||
skip) covering base URL reachability, authentication, server-CLI
|
||||
version skew, and credential storage backend. Add `--format json` for
|
||||
machine-readable output, `--offline` to skip network checks.
|
||||
@@ -416,12 +416,12 @@ a fast vs deep choice:
|
||||
|
||||
| Verb | Cost | Use |
|
||||
|---|---|---|
|
||||
| `weknora kb status <kb-id>` | 1 HTTP | live counts / processing flag |
|
||||
| `weknora kb check <kb-id>` | 1+N HTTP | adds `failed_count` via doc-list page-walk |
|
||||
| `weknora agent status <agent-id>` | 1 HTTP | reachable / model_id |
|
||||
| `weknora agent check <agent-id>` | 1+N HTTP | also probes every KB in the agent's scope |
|
||||
| `academy kb status <kb-id>` | 1 HTTP | live counts / processing flag |
|
||||
| `academy kb check <kb-id>` | 1+N HTTP | adds `failed_count` via doc-list page-walk |
|
||||
| `academy agent status <agent-id>` | 1 HTTP | reachable / model_id |
|
||||
| `academy agent check <agent-id>` | 1+N HTTP | also probes every KB in the agent's scope |
|
||||
|
||||
`weknora doc wait <doc-id> [<doc-id>...]` blocks until each document
|
||||
`academy doc wait <doc-id> [<doc-id>...]` blocks until each document
|
||||
reaches a terminal `parse_status` (completed or failed). Exit codes:
|
||||
0 (all completed), 1 (any failed), 124 (`--timeout` reached), 130
|
||||
(Ctrl-C / SIGTERM). Multi-target is polled concurrently (max 5 in
|
||||
@@ -435,7 +435,7 @@ flight; pipe through `xargs -P` for more).
|
||||
# Run unit + contract tests
|
||||
go test ./...
|
||||
|
||||
# Run the real-server e2e suite (requires WEKNORA_E2E_HOST + token env vars)
|
||||
# Run the real-server e2e suite (requires ACADEMY_E2E_HOST + token env vars)
|
||||
go test -tags acceptance_e2e ./acceptance/e2e/...
|
||||
|
||||
# Static analysis
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"academy/cli/internal/cmdutil"
|
||||
)
|
||||
|
||||
// TestAllReferencedCodesAreRegistered scans cli/cmd/ for every literal use of
|
||||
|
||||
@@ -10,12 +10,12 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/cmd"
|
||||
"github.com/Tencent/WeKnora/cli/cmd/doctor"
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/secrets"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/cmd"
|
||||
"academy/cli/cmd/doctor"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/secrets"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// TestMain pins the doctor credential-storage outcome for the whole suite.
|
||||
@@ -40,7 +40,7 @@ var update = flag.Bool("update", false, "update golden files")
|
||||
// newTestFactory builds a Factory whose Client returns mockClient.
|
||||
// Caller must NOT use t.Parallel() - see iostreams.SetForTest contract.
|
||||
//
|
||||
// WEKNORA_BASE_URL is set when mockServer is non-nil. buildClient does not
|
||||
// ACADEMY_BASE_URL is set when mockServer is non-nil. buildClient does not
|
||||
// currently honor this env var (it reads from config.Host); commands that
|
||||
// need the mock URL rely on the mockClient injection above. The env is set
|
||||
// anyway for any direct net/http callers (e.g. doctor's HEAD /health).
|
||||
@@ -49,7 +49,7 @@ func newTestFactory(t *testing.T, mockServer *httptest.Server, mockClient *sdk.C
|
||||
t.Setenv("XDG_CONFIG_HOME", t.TempDir())
|
||||
t.Setenv("XDG_CACHE_HOME", t.TempDir())
|
||||
if mockServer != nil {
|
||||
t.Setenv("WEKNORA_BASE_URL", mockServer.URL)
|
||||
t.Setenv("ACADEMY_BASE_URL", mockServer.URL)
|
||||
}
|
||||
f := cmdutil.New()
|
||||
if mockClient != nil {
|
||||
|
||||
@@ -40,8 +40,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/config"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/config"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// wireCase declares one row in the contract matrix. Optional fields:
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
// Sub-packages:
|
||||
//
|
||||
// contract/ - envelope JSON shape golden + error.code registry consistency
|
||||
// e2e/ - real WeKnora server blackbox tests (testscript-style)
|
||||
// e2e/ - real Academy server blackbox tests (testscript-style)
|
||||
package acceptance
|
||||
@@ -1,6 +1,6 @@
|
||||
//go:build acceptance_e2e
|
||||
|
||||
// Package e2e_test drives the WeKnora CLI binary against a real running
|
||||
// Package e2e_test drives the Academy CLI binary against a real running
|
||||
// server to validate the RAG closing loop end-to-end.
|
||||
//
|
||||
// Build tag isolation: //go:build acceptance_e2e excludes this file from
|
||||
@@ -8,11 +8,11 @@
|
||||
// requested. To run:
|
||||
//
|
||||
// cd cli
|
||||
// WEKNORA_E2E_HOST=https://kb.example.com \
|
||||
// WEKNORA_E2E_TOKEN=eyJhbGc... \
|
||||
// ACADEMY_E2E_HOST=https://kb.example.com \
|
||||
// ACADEMY_E2E_TOKEN=eyJhbGc... \
|
||||
// go test -tags=acceptance_e2e -v ./acceptance/e2e/...
|
||||
//
|
||||
// Optional WEKNORA_E2E_KB_NAME_PREFIX customizes the throwaway KB name (default
|
||||
// Optional ACADEMY_E2E_KB_NAME_PREFIX customizes the throwaway KB name (default
|
||||
// "cli-e2e-"). Cleanup runs even on test failure via t.Cleanup so the server
|
||||
// doesn't accumulate test debris.
|
||||
package e2e_test
|
||||
@@ -34,14 +34,14 @@ import (
|
||||
// step parses the CLI's bare JSON to extract IDs for the next step -
|
||||
// validating both functional behavior and wire-contract stability.
|
||||
func TestRAGFullLoop(t *testing.T) {
|
||||
host := mustEnv(t, "WEKNORA_E2E_HOST")
|
||||
token := mustEnv(t, "WEKNORA_E2E_TOKEN")
|
||||
prefix := envOr("WEKNORA_E2E_KB_NAME_PREFIX", "cli-e2e-")
|
||||
host := mustEnv(t, "ACADEMY_E2E_HOST")
|
||||
token := mustEnv(t, "ACADEMY_E2E_TOKEN")
|
||||
prefix := envOr("ACADEMY_E2E_KB_NAME_PREFIX", "cli-e2e-")
|
||||
|
||||
bin := buildBinary(t)
|
||||
xdg := t.TempDir()
|
||||
|
||||
// Inject host + token as WEKNORA_HOST / WEKNORA_TOKEN env vars. The
|
||||
// Inject host + token as ACADEMY_HOST / ACADEMY_TOKEN env vars. The
|
||||
// CLI's env-credential path (buildClientFromEnv) takes precedence
|
||||
// over profile config, so this bypasses the secrets-store dance
|
||||
// entirely — no keychain access, no file:// ref plumbing. This is
|
||||
@@ -49,18 +49,18 @@ func TestRAGFullLoop(t *testing.T) {
|
||||
env := append(os.Environ(),
|
||||
"XDG_CONFIG_HOME="+xdg,
|
||||
"XDG_CACHE_HOME="+filepath.Join(xdg, "cache"),
|
||||
"WEKNORA_HOST="+host,
|
||||
"WEKNORA_TOKEN="+token,
|
||||
"ACADEMY_HOST="+host,
|
||||
"ACADEMY_TOKEN="+token,
|
||||
// SDK debug off - explicit so the CI run isn't noisy.
|
||||
"WEKNORA_LOG_LEVEL=error",
|
||||
"ACADEMY_LOG_LEVEL=error",
|
||||
)
|
||||
|
||||
// 1. kb create → KnowledgeBase object (envelope-wrapped: {ok, data})
|
||||
// The CLI now requires explicit model binding so uploaded docs are
|
||||
// immediately searchable. Use the server's builtin model IDs (they
|
||||
// exist on every deployment that configures builtin_models.yaml).
|
||||
embeddingModel := envOr("WEKNORA_E2E_EMBEDDING_MODEL", "Qwen/Qwen3-Embedding-8B")
|
||||
chatModel := envOr("WEKNORA_E2E_CHAT_MODEL", "deepseek-ai/DeepSeek-V3.2")
|
||||
embeddingModel := envOr("ACADEMY_E2E_EMBEDDING_MODEL", "Qwen/Qwen3-Embedding-8B")
|
||||
chatModel := envOr("ACADEMY_E2E_CHAT_MODEL", "deepseek-ai/DeepSeek-V3.2")
|
||||
kbName := prefix + fmt.Sprintf("%d", time.Now().UnixNano())
|
||||
var created struct {
|
||||
OK bool `json:"ok"`
|
||||
@@ -174,7 +174,7 @@ func envOr(key, fallback string) string {
|
||||
func buildBinary(t *testing.T) string {
|
||||
t.Helper()
|
||||
dir := t.TempDir()
|
||||
out := filepath.Join(dir, "weknora")
|
||||
out := filepath.Join(dir, "academy")
|
||||
// Repo layout: this test sits at cli/acceptance/e2e/, so cli/ is two levels up.
|
||||
cmd := exec.Command("go", "build", "-o", out, ".")
|
||||
cmd.Dir = filepath.Join("..", "..")
|
||||
@@ -191,13 +191,13 @@ func buildBinary(t *testing.T) string {
|
||||
// window.
|
||||
func writeSampleDoc(t *testing.T) string {
|
||||
t.Helper()
|
||||
content := `WeKnora E2E Sample Document
|
||||
content := `Academy E2E Sample Document
|
||||
|
||||
This sample document is used by the WeKnora CLI acceptance test suite to
|
||||
This sample document is used by the Academy CLI acceptance test suite to
|
||||
validate the end-to-end retrieval-augmented generation pipeline.
|
||||
|
||||
向量检索的核心思想是把文本通过 embedding 模型映射到高维向量空间,然后通过余弦相似度
|
||||
等度量找出语义最接近的内容片段。WeKnora 支持 vector + keyword 的混合检索模式。
|
||||
等度量找出语义最接近的内容片段。Academy 支持 vector + keyword 的混合检索模式。
|
||||
|
||||
The hybrid search mode combines vector similarity (semantic) with keyword
|
||||
matching (lexical) to balance recall and precision.
|
||||
@@ -211,7 +211,7 @@ matching (lexical) to balance recall and precision.
|
||||
}
|
||||
|
||||
// waitDocReady polls `doc list` until the uploaded document's status indicates
|
||||
// indexing is complete. WeKnora server uses a few status values across versions
|
||||
// indexing is complete. Academy server uses a few status values across versions
|
||||
// ("ready", "completed", "ok") - accept any non-pending/non-processing/non-failed
|
||||
// state so we don't break on a server-side rename. Failed status fails the test
|
||||
// fast.
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"ok":true,"data":{"summary":{"all_passed":false,"passed":1,"failed":1,"skipped":2},"checks":[{"name":"base_url_reachable","status":"fail","details":"server returned 500","hint":"verify the host configured for the active profile (run `weknora profile list` / `weknora profile add <n> --host=...`) and network reachability"},{"name":"auth_credential","status":"skip","details":"prereq failed: base_url_reachable"},{"name":"server_version","status":"skip","details":"prereq failed: auth_credential"},{"name":"credential_storage","status":"ok","details":"keyring or file storage available"}]}}
|
||||
{"ok":true,"data":{"summary":{"all_passed":false,"passed":1,"failed":1,"skipped":2},"checks":[{"name":"base_url_reachable","status":"fail","details":"server returned 500","hint":"verify the host configured for the active profile (run `academy profile list` / `academy profile add <n> --host=...`) and network reachability"},{"name":"auth_credential","status":"skip","details":"prereq failed: base_url_reachable"},{"name":"server_version","status":"skip","details":"prereq failed: auth_credential"},{"name":"credential_storage","status":"ok","details":"keyring or file storage available"}]}}
|
||||
@@ -1,21 +1,21 @@
|
||||
// Package agentcmd holds the `weknora agent` command tree:
|
||||
// Package agentcmd holds the `academy agent` command tree:
|
||||
// list / view / create / update / delete / status / check. The directory is
|
||||
// named `agent/` to match the cobra subcommand; the Go package is `agentcmd`
|
||||
// to avoid colliding with cobra's *cobra.Command identifier.
|
||||
//
|
||||
// "agent" in this subtree refers to WeKnora's user-defined Custom
|
||||
// "agent" in this subtree refers to Academy's user-defined Custom
|
||||
// Agents (server resource: GET/POST /agents/...) and handles CRUD
|
||||
// operations only. Agent invocation has moved to `weknora session ask
|
||||
// operations only. Agent invocation has moved to `academy session ask
|
||||
// --agent <id>` (see cli/cmd/session/ask.go).
|
||||
package agentcmd
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"academy/cli/internal/cmdutil"
|
||||
)
|
||||
|
||||
// NewCmd builds the `weknora agent` parent and registers leaves. Called
|
||||
// NewCmd builds the `academy agent` parent and registers leaves. Called
|
||||
// from cli/cmd/root.go.
|
||||
func NewCmd(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
@@ -23,7 +23,7 @@ func NewCmd(f *cmdutil.Factory) *cobra.Command {
|
||||
Short: "Manage custom agents (CRUD + status/check)",
|
||||
Long: `Custom Agents bundle a system prompt, model, tool allow-list, and KB
|
||||
scope into an addressable resource. Create, update, list, view, check,
|
||||
or delete agents. To invoke an agent, use: weknora session ask --agent <id>`,
|
||||
or delete agents. To invoke an agent, use: academy session ask --agent <id>`,
|
||||
}
|
||||
cmd.AddCommand(NewCmdList(f))
|
||||
cmd.AddCommand(NewCmdView(f))
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// AgentCheckResult is the deep-verification response for `agent check <id>`.
|
||||
@@ -32,7 +32,7 @@ type AgentCheckService interface {
|
||||
|
||||
var agentCheckFields = []string{"id", "reachable", "model_id", "kb_scope_all_reachable"}
|
||||
|
||||
// NewCmdCheck builds `weknora agent check <id>`.
|
||||
// NewCmdCheck builds `academy agent check <id>`.
|
||||
func NewCmdCheck(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "check <agent-id>",
|
||||
@@ -44,11 +44,11 @@ Performs 1 + N HTTP calls:
|
||||
N GET /kb/{kb_id} for each id in agent.config.knowledge_bases
|
||||
— sets kb_scope_all_reachable = true iff every probe succeeds
|
||||
|
||||
Use 'weknora agent status <id>' for a fast read-only health snapshot
|
||||
Use 'academy agent status <id>' for a fast read-only health snapshot
|
||||
(1 HTTP call, no KB probing). Use 'agent check' when you need to verify
|
||||
the agent's downstream dependencies are all reachable.`,
|
||||
Example: ` weknora agent check ag_abc
|
||||
weknora agent check ag_abc --format json`,
|
||||
Example: ` academy agent check ag_abc
|
||||
academy agent check ag_abc --format json`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(c *cobra.Command, args []string) error {
|
||||
fopts, err := cmdutil.CheckFormatFlag(c)
|
||||
@@ -71,7 +71,7 @@ the agent's downstream dependencies are all reachable.`,
|
||||
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
|
||||
UsedFor: "verify a custom agent end-to-end: status plus kb_scope reachability",
|
||||
RequiredFlags: []string{"<agent-id> (positional)"},
|
||||
Examples: []string{"weknora agent check agent_abc"},
|
||||
Examples: []string{"academy agent check agent_abc"},
|
||||
Output: "envelope.data is {id, reachable, ...} with kb_scope reachability folded in",
|
||||
})
|
||||
return cmd
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
type fakeAgentCheckSvc struct {
|
||||
|
||||
+13
-13
@@ -9,9 +9,9 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// CreateService is the narrow SDK surface this command depends on.
|
||||
@@ -58,16 +58,16 @@ type createFlagSet struct {
|
||||
kbsSet bool
|
||||
}
|
||||
|
||||
const agentCreateExample = ` weknora agent create "Support Bot" --model <model-id>
|
||||
weknora agent create "Code Reviewer" --model <model-id> --system-prompt-file ./prompt.md --attach-kb kb_eng --attach-kb kb_arch
|
||||
weknora agent create "From Template" --model <model-id> --from ag_existing
|
||||
weknora agent create --generate-skeleton > my-agent.yaml
|
||||
weknora agent create "Tuned" --model <model-id> --config-file ./my-agent.yaml`
|
||||
const agentCreateExample = ` academy agent create "Support Bot" --model <model-id>
|
||||
academy agent create "Code Reviewer" --model <model-id> --system-prompt-file ./prompt.md --attach-kb kb_eng --attach-kb kb_arch
|
||||
academy agent create "From Template" --model <model-id> --from ag_existing
|
||||
academy agent create --generate-skeleton > my-agent.yaml
|
||||
academy agent create "Tuned" --model <model-id> --config-file ./my-agent.yaml`
|
||||
|
||||
const agentCreateLong = `Create a new custom agent.
|
||||
|
||||
--model is required (an agent without a model cannot invoke); discover a
|
||||
valid model id with 'weknora model list'. The 7
|
||||
valid model id with 'academy model list'. The 7
|
||||
optional hot-path flags cover the most frequently set AgentConfig fields;
|
||||
for the remaining 27 use --config-file with a YAML or JSON document
|
||||
matching the AgentConfig schema (run --generate-skeleton to get a
|
||||
@@ -84,7 +84,7 @@ AI agents: writes a new resource server-side. Failure surfaces as a
|
||||
typed code on stderr: input.invalid_argument (bad flags, bad file, or
|
||||
bad model), resource.not_found (--from <missing>), auth.unauthenticated.`
|
||||
|
||||
// NewCmdCreate builds `weknora agent create <name> --model <id>`.
|
||||
// NewCmdCreate builds `academy agent create <name> --model <id>`.
|
||||
func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
opts := &CreateOptions{}
|
||||
var systemPromptFile, configFile string
|
||||
@@ -222,9 +222,9 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
UsedFor: "Create a new custom agent. --model is required and accepts a model id or name; --attach-kb (repeatable) accepts KB ids or names. Emits the created Agent object.",
|
||||
RequiredFlags: []string{"<name> (positional)", "--model"},
|
||||
Examples: []string{
|
||||
`weknora agent create "Support Bot" --model gpt-4o`,
|
||||
`weknora agent create "Support Bot" --model gpt-4o --attach-kb kb_eng --system-prompt "You are a support assistant."`,
|
||||
`weknora agent create --generate-skeleton # print a blank config to fill in (no --model needed)`,
|
||||
`academy agent create "Support Bot" --model gpt-4o`,
|
||||
`academy agent create "Support Bot" --model gpt-4o --attach-kb kb_eng --system-prompt "You are a support assistant."`,
|
||||
`academy agent create --generate-skeleton # print a blank config to fill in (no --model needed)`,
|
||||
},
|
||||
Output: "envelope.data is the created Agent object with id, name, config",
|
||||
})
|
||||
|
||||
@@ -11,9 +11,9 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// fakeCreateSvc records all three SDK methods this command may invoke.
|
||||
|
||||
+10
-10
@@ -6,9 +6,9 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/prompt"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/prompt"
|
||||
)
|
||||
|
||||
// agentDeleteFields enumerates the JSON discovery fields for `agent delete`.
|
||||
@@ -51,11 +51,11 @@ and writes input.confirmation_required to stderr. NEVER auto-pass -y
|
||||
without the user's explicit go-ahead — the exit-10 protocol exists
|
||||
exactly to guard against unintended deletes.`
|
||||
|
||||
const agentDeleteExample = ` weknora agent delete ag_abc # interactive confirm
|
||||
weknora agent delete ag_abc -y # no prompt
|
||||
weknora agent delete ag_abc -y --format json # bare {id, deleted:true} JSON`
|
||||
const agentDeleteExample = ` academy agent delete ag_abc # interactive confirm
|
||||
academy agent delete ag_abc -y # no prompt
|
||||
academy agent delete ag_abc -y --format json # bare {id, deleted:true} JSON`
|
||||
|
||||
// NewCmdDelete builds `weknora agent delete <agent-id>`.
|
||||
// NewCmdDelete builds `academy agent delete <agent-id>`.
|
||||
func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
|
||||
opts := &DeleteOptions{}
|
||||
cmd := &cobra.Command{
|
||||
@@ -95,8 +95,8 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
|
||||
RequiredFlags: []string{"<agent-id> (positional)"},
|
||||
Output: "envelope.data is {id, deleted:true}",
|
||||
Examples: []string{
|
||||
"weknora agent delete ag_abc -y",
|
||||
"weknora agent delete ag_abc -y --format json",
|
||||
"academy agent delete ag_abc -y",
|
||||
"academy agent delete ag_abc -y --format json",
|
||||
},
|
||||
Warnings: []string{
|
||||
"Requires explicit user approval (exit 10 / input.confirmation_required); never auto-add -y.",
|
||||
@@ -107,7 +107,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
|
||||
}
|
||||
|
||||
func runDelete(ctx context.Context, opts *DeleteOptions, fopts *cmdutil.FormatOptions, svc DeleteService, p prompt.Prompter) error {
|
||||
if err := cmdutil.ConfirmDestructive(p, opts.Yes, fopts.WantsJSON(), "delete", "agent", opts.AgentID, "agent.delete", []string{"weknora", "agent", "delete", opts.AgentID, "-y"}); err != nil {
|
||||
if err := cmdutil.ConfirmDestructive(p, opts.Yes, fopts.WantsJSON(), "delete", "agent", opts.AgentID, "agent.delete", []string{"academy", "agent", "delete", opts.AgentID, "-y"}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := svc.DeleteAgent(ctx, opts.AgentID); err != nil {
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/testutil"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/testutil"
|
||||
)
|
||||
|
||||
type fakeDeleteSvc struct {
|
||||
|
||||
+13
-13
@@ -9,9 +9,9 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// EditService is the narrow SDK surface this command depends on. The fetch
|
||||
@@ -92,13 +92,13 @@ with input.confirmation_required. Surface the prompt to the user and only
|
||||
retry with -y after explicit approval. Other failure codes: resource.not_found
|
||||
(agent id or KB id), auth.forbidden, input.invalid_argument (no flags, bad file).`
|
||||
|
||||
const agentEditExample = ` weknora agent update ag_abc --name "Renamed" -y
|
||||
weknora agent update ag_abc --description "" -y # clear description
|
||||
weknora agent update ag_abc --add-kb kb_new --remove-kb kb_old -y
|
||||
weknora agent update ag_abc --system-prompt-file ./prompt.md -y
|
||||
weknora agent update ag_abc --config-file ./tuned.yaml --temperature 0.9 -y`
|
||||
const agentEditExample = ` academy agent update ag_abc --name "Renamed" -y
|
||||
academy agent update ag_abc --description "" -y # clear description
|
||||
academy agent update ag_abc --add-kb kb_new --remove-kb kb_old -y
|
||||
academy agent update ag_abc --system-prompt-file ./prompt.md -y
|
||||
academy agent update ag_abc --config-file ./tuned.yaml --temperature 0.9 -y`
|
||||
|
||||
// NewCmdEdit builds `weknora agent update <agent-id>`.
|
||||
// NewCmdEdit builds `academy agent update <agent-id>`.
|
||||
func NewCmdEdit(f *cmdutil.Factory) *cobra.Command {
|
||||
opts := &EditOptions{}
|
||||
var systemPromptFile, configFile string
|
||||
@@ -219,7 +219,7 @@ func NewCmdEdit(f *cmdutil.Factory) *cobra.Command {
|
||||
// Build the retry command from the flags the user actually passed.
|
||||
// Include list-shaped and file-path flags so exit-10 retry_argv reproduces
|
||||
// the original update (BuildRetryArgv expands StringSlice as repeats).
|
||||
retryCmd := cmdutil.BuildRetryArgv(cmd, []string{"weknora", "agent", "update", opts.AgentID},
|
||||
retryCmd := cmdutil.BuildRetryArgv(cmd, []string{"academy", "agent", "update", opts.AgentID},
|
||||
"name", "description", "model", "system-prompt", "system-prompt-file",
|
||||
"agent-mode", "rerank-model", "temperature", "add-kb", "remove-kb",
|
||||
"kb-selection-mode", "config-file", "format")
|
||||
@@ -272,9 +272,9 @@ func NewCmdEdit(f *cmdutil.Factory) *cobra.Command {
|
||||
UsedFor: "surgically update a custom agent's configuration",
|
||||
RequiredFlags: []string{"<agent-id> (positional)", "at least one update flag (--name, --add-kb, etc.)"},
|
||||
Examples: []string{
|
||||
"weknora agent update ag_abc --name \"Renamed\"",
|
||||
"weknora agent update ag_abc --add-kb kb_new --remove-kb kb_old",
|
||||
"weknora agent update ag_abc --config-file ./tuned.yaml",
|
||||
"academy agent update ag_abc --name \"Renamed\"",
|
||||
"academy agent update ag_abc --add-kb kb_new --remove-kb kb_old",
|
||||
"academy agent update ag_abc --config-file ./tuned.yaml",
|
||||
},
|
||||
Output: "envelope.data is the updated Agent object (id, name, config) after the update is applied",
|
||||
Warnings: []string{
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/prompt"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/prompt"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// agentDryRunFactory builds a Factory whose Client closure panics if invoked —
|
||||
|
||||
@@ -12,10 +12,10 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/prompt"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/prompt"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// fakeEditSvc scripts GetAgent (fetch baseline) + UpdateAgent (apply
|
||||
@@ -292,11 +292,11 @@ func TestEdit_SystemPromptFile(t *testing.T) {
|
||||
assert.Equal(t, "new prompt", svc.updateReq.Config.SystemPrompt)
|
||||
}
|
||||
|
||||
// withRootHarnessAgent wraps `weknora agent update ...` under a synthetic root
|
||||
// withRootHarnessAgent wraps `academy agent update ...` under a synthetic root
|
||||
// cmd that registers the global persistent flags (mirrors addGlobalFlags in
|
||||
// cmd/root.go).
|
||||
func withRootHarnessAgent(edit *cobra.Command, args ...string) *cobra.Command {
|
||||
root := &cobra.Command{Use: "weknora"}
|
||||
root := &cobra.Command{Use: "academy"}
|
||||
pf := root.PersistentFlags()
|
||||
pf.BoolP("yes", "y", false, "")
|
||||
pf.String("format", "", "Output format: text | json | ndjson")
|
||||
@@ -352,7 +352,7 @@ func TestAgentEdit_RetryArgvPreservesAddKB(t *testing.T) {
|
||||
assert.Equal(t, cmdutil.CodeInputConfirmationRequired, ce.Code)
|
||||
// pflag Visit is lexicographical among changed flags.
|
||||
assert.Equal(t, []string{
|
||||
"weknora", "agent", "update", "ag_abc",
|
||||
"academy", "agent", "update", "ag_abc",
|
||||
"--add-kb", "kb_new",
|
||||
"--format", "json",
|
||||
"--remove-kb", "kb_old",
|
||||
|
||||
@@ -9,11 +9,11 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/output"
|
||||
"github.com/Tencent/WeKnora/cli/internal/text"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/output"
|
||||
"academy/cli/internal/text"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// agentListFields enumerates the fields surfaced for `--format json` discovery
|
||||
@@ -38,7 +38,7 @@ type ListOptions struct {
|
||||
Limit int
|
||||
}
|
||||
|
||||
// NewCmdList builds `weknora agent list`.
|
||||
// NewCmdList builds `academy agent list`.
|
||||
func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
opts := &ListOptions{}
|
||||
cmd := &cobra.Command{
|
||||
@@ -67,7 +67,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
cmdutil.AddFormatFlag(cmd, agentListFields...)
|
||||
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
|
||||
UsedFor: "List custom agents visible to the active tenant. The SDK returns all agents in one call (no server-side pagination); meta.count reflects the full tenant set, --limit caps client-side.",
|
||||
Examples: []string{"weknora agent list --format json", "weknora agent list --limit 10 --format json"},
|
||||
Examples: []string{"academy agent list --format json", "academy agent list --limit 10 --format json"},
|
||||
Output: "envelope.data is an array of Agent objects with id, name, is_builtin; meta.total_count is the full tenant set and meta.has_more=true means --limit truncated it (raise --limit to get the rest)",
|
||||
})
|
||||
return cmd
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
type fakeListSvc struct {
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// AgentStatusResult is the shallow health snapshot for `agent status <id>`.
|
||||
@@ -41,11 +41,11 @@ func NewCmdStatus(f *cmdutil.Factory) *cobra.Command {
|
||||
|
||||
Returns: reachable / model_id.
|
||||
|
||||
For downstream KB reachability verification use 'weknora agent check <id>'
|
||||
For downstream KB reachability verification use 'academy agent check <id>'
|
||||
(active verification, 1 + N HTTP). For full agent config / metadata use
|
||||
'weknora agent view <id>'.`,
|
||||
Example: ` weknora agent status ag_abc
|
||||
weknora agent status ag_abc --format json`,
|
||||
'academy agent view <id>'.`,
|
||||
Example: ` academy agent status ag_abc
|
||||
academy agent status ag_abc --format json`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(c *cobra.Command, args []string) error {
|
||||
fopts, err := cmdutil.CheckFormatFlag(c)
|
||||
@@ -68,7 +68,7 @@ For downstream KB reachability verification use 'weknora agent check <id>'
|
||||
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
|
||||
UsedFor: "shallow health probe of a custom agent: reachability without kb_scope verification",
|
||||
RequiredFlags: []string{"<agent-id> (positional)"},
|
||||
Examples: []string{"weknora agent status agent_abc"},
|
||||
Examples: []string{"academy agent status agent_abc"},
|
||||
Output: "envelope.data is {id, reachable, ...}; use `agent check` for deep kb_scope verification",
|
||||
})
|
||||
return cmd
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
type fakeAgentStatusSvc struct {
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/text"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/text"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// promptPreviewWidth caps inline KV row prompt previews. Multi-line prompts
|
||||
@@ -34,7 +34,7 @@ type ViewService interface {
|
||||
GetAgent(ctx context.Context, agentID string) (*sdk.Agent, error)
|
||||
}
|
||||
|
||||
// NewCmdView builds `weknora agent view <agent-id>`.
|
||||
// NewCmdView builds `academy agent view <agent-id>`.
|
||||
func NewCmdView(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "view <agent-id>",
|
||||
@@ -46,9 +46,9 @@ fields are omitted; sections with no set fields are suppressed entirely.
|
||||
|
||||
Pass --format json for the bare SDK Agent object (config nested, not flattened).
|
||||
Use --jq to project specific fields or reach into nested config.`,
|
||||
Example: ` weknora agent view ag_abc
|
||||
weknora agent view ag_abc --format json --jq '{id, name, config}' # top-level projection
|
||||
weknora agent view ag_abc --format json --jq '.config.system_prompt'`,
|
||||
Example: ` academy agent view ag_abc
|
||||
academy agent view ag_abc --format json --jq '{id, name, config}' # top-level projection
|
||||
academy agent view ag_abc --format json --jq '.config.system_prompt'`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(c *cobra.Command, args []string) error {
|
||||
fopts, err := cmdutil.CheckFormatFlag(c)
|
||||
@@ -67,7 +67,7 @@ Use --jq to project specific fields or reach into nested config.`,
|
||||
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
|
||||
UsedFor: "fetch one custom agent's full configuration by id",
|
||||
RequiredFlags: []string{"<agent-id> (positional)"},
|
||||
Examples: []string{"weknora agent view agent_abc"},
|
||||
Examples: []string{"academy agent view agent_abc"},
|
||||
Output: "envelope.data is the custom agent (id, name, description, is_builtin, and a nested config object holding model/kb_scope/...)",
|
||||
})
|
||||
return cmd
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
type fakeViewSvc struct {
|
||||
|
||||
@@ -8,19 +8,19 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"academy/cli/internal/cmdutil"
|
||||
)
|
||||
|
||||
// TestEveryLeafCommandHasAgentHelp enforces the agent-first contract: every
|
||||
// leaf (runnable, no subcommands) command must emit a structured AgentHelp JSON
|
||||
// blob under WEKNORA_AGENT_HELP=1, so an agent never has to scrape human prose.
|
||||
// blob under ACADEMY_AGENT_HELP=1, so an agent never has to scrape human prose.
|
||||
// Drift guard in the spirit of the K6/K7 skill-parity tests: a new leaf command
|
||||
// added without SetAgentHelp fails CI here.
|
||||
//
|
||||
// Exemptions: cobra's generated `completion`/`help` subtrees carry no
|
||||
// domain semantics worth a machine blob.
|
||||
func TestEveryLeafCommandHasAgentHelp(t *testing.T) {
|
||||
t.Setenv("WEKNORA_AGENT_HELP", "1")
|
||||
t.Setenv("ACADEMY_AGENT_HELP", "1")
|
||||
root := NewRootCmd(cmdutil.New())
|
||||
|
||||
var missing []string
|
||||
@@ -44,7 +44,7 @@ func TestEveryLeafCommandHasAgentHelp(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// renderAgentHelp runs a leaf's help under WEKNORA_AGENT_HELP=1 and decodes the
|
||||
// renderAgentHelp runs a leaf's help under ACADEMY_AGENT_HELP=1 and decodes the
|
||||
// machine blob (used_for / output / examples) an agent would read.
|
||||
func renderAgentHelp(t *testing.T, c *cobra.Command) struct {
|
||||
UsedFor string `json:"used_for"`
|
||||
@@ -71,7 +71,7 @@ func renderAgentHelp(t *testing.T, c *cobra.Command) struct {
|
||||
// envelope (e.g. deletes emit {id, deleted:true}); an empty Output is a contract
|
||||
// gap, not a valid state. Sibling drift guard to the agent-help test above.
|
||||
func TestEveryLeafCommandDeclaresOutput(t *testing.T) {
|
||||
t.Setenv("WEKNORA_AGENT_HELP", "1")
|
||||
t.Setenv("ACADEMY_AGENT_HELP", "1")
|
||||
root := NewRootCmd(cmdutil.New())
|
||||
|
||||
var missing []string
|
||||
@@ -91,7 +91,7 @@ func TestEveryLeafCommandDeclaresOutput(t *testing.T) {
|
||||
// TestEveryLeafCommandHasExample enforces that every leaf ships at least one
|
||||
// runnable example — agents learn invocation shape from examples, not prose.
|
||||
func TestEveryLeafCommandHasExample(t *testing.T) {
|
||||
t.Setenv("WEKNORA_AGENT_HELP", "1")
|
||||
t.Setenv("ACADEMY_AGENT_HELP", "1")
|
||||
root := NewRootCmd(cmdutil.New())
|
||||
|
||||
var missing []string
|
||||
|
||||
+22
-22
@@ -1,4 +1,4 @@
|
||||
// Package api implements the `weknora api` raw HTTP passthrough command.
|
||||
// Package api implements the `academy api` raw HTTP passthrough command.
|
||||
//
|
||||
// Shape: one positional (path) + `-X/--method` flag, default GET (auto-
|
||||
// promoted to POST when a body is supplied via -d/--input). Text mode writes
|
||||
@@ -22,9 +22,9 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// apiFields is intentionally a marker - api wraps arbitrary HTTP responses
|
||||
@@ -50,12 +50,12 @@ type Service interface {
|
||||
Raw(ctx context.Context, method, path string, body any) (*http.Response, error)
|
||||
}
|
||||
|
||||
// NewCmd returns the `weknora api` command.
|
||||
// NewCmd returns the `academy api` command.
|
||||
func NewCmd(f *cmdutil.Factory) *cobra.Command {
|
||||
opts := &Options{}
|
||||
cmd := &cobra.Command{
|
||||
Use: "api <path>",
|
||||
Short: "Make a raw API request to the WeKnora server",
|
||||
Short: "Make a raw API request to the Academy server",
|
||||
Long: `Raw HTTP API access. JSON body via -d/--data (inline) or --input <file>/- (stdin).
|
||||
|
||||
The default method is GET; supplying a body (-d or --input) auto-promotes it
|
||||
@@ -71,11 +71,11 @@ With --paginate, text mode writes the merged {data, total} JSON object with a
|
||||
trailing newline and no envelope.
|
||||
|
||||
Examples:
|
||||
weknora api /api/v1/knowledge-bases # GET
|
||||
weknora api /api/v1/knowledge-bases -d '{"name":"foo"}' # POST (auto)
|
||||
weknora api /api/v1/knowledge-bases -F name=foo -F enabled=true # POST, typed body
|
||||
echo '{"name":"foo"}' | weknora api /api/v1/knowledge-bases --input - # POST via stdin
|
||||
weknora api /api/v1/knowledge-bases/kb_xxx -X DELETE`,
|
||||
academy api /api/v1/knowledge-bases # GET
|
||||
academy api /api/v1/knowledge-bases -d '{"name":"foo"}' # POST (auto)
|
||||
academy api /api/v1/knowledge-bases -F name=foo -F enabled=true # POST, typed body
|
||||
echo '{"name":"foo"}' | academy api /api/v1/knowledge-bases --input - # POST via stdin
|
||||
academy api /api/v1/knowledge-bases/kb_xxx -X DELETE`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(c *cobra.Command, args []string) error {
|
||||
opts.Yes, _ = c.Flags().GetBool("yes")
|
||||
@@ -122,8 +122,8 @@ Examples:
|
||||
}
|
||||
}
|
||||
method := resolveMethod(opts)
|
||||
// Escape-hatch DELETE through `weknora api` is just as destructive
|
||||
// as `weknora kb delete` - exit-10 destructive protocol must apply
|
||||
// Escape-hatch DELETE through `academy api` is just as destructive
|
||||
// as `academy kb delete` - exit-10 destructive protocol must apply
|
||||
// (cli/README.md). PUT/PATCH mutate server state like a typed
|
||||
// `kb/agent/doc update`, so they get the same exit-10 WRITE gate;
|
||||
// without it the raw escape hatch bypassed the "an agent cannot
|
||||
@@ -131,7 +131,7 @@ Examples:
|
||||
// `create` (also ungated). GET/HEAD are reads.
|
||||
switch method {
|
||||
case http.MethodDelete:
|
||||
if err := cmdutil.ConfirmDestructive(f.Prompter(), opts.Yes, fopts.WantsJSON(), "delete", "endpoint", args[0], "api.delete", []string{"weknora", "api", "-X", "DELETE", args[0], "-y"}); err != nil {
|
||||
if err := cmdutil.ConfirmDestructive(f.Prompter(), opts.Yes, fopts.WantsJSON(), "delete", "endpoint", args[0], "api.delete", []string{"academy", "api", "-X", "DELETE", args[0], "-y"}); err != nil {
|
||||
return err
|
||||
}
|
||||
case http.MethodPut, http.MethodPatch:
|
||||
@@ -155,14 +155,14 @@ Examples:
|
||||
cmdutil.AddFormatFlag(cmd, apiFields...)
|
||||
cmdutil.AddDryRunFlag(cmd, &opts.DryRun)
|
||||
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
|
||||
UsedFor: "raw HTTP passthrough to weknora-server API endpoints when typed subcommands are insufficient",
|
||||
UsedFor: "raw HTTP passthrough to academy-server API endpoints when typed subcommands are insufficient",
|
||||
RequiredFlags: []string{"path (positional)"},
|
||||
Examples: []string{
|
||||
"weknora api /api/v1/knowledge-bases",
|
||||
"weknora api /api/v1/knowledge-bases -d '{\"name\":\"foo\"}'",
|
||||
"weknora api -X POST /api/v1/knowledge-bases -F name=\"Eng Docs\" -F enabled=true",
|
||||
"weknora api -X DELETE /api/v1/knowledge-bases/kb_x -y",
|
||||
"echo '{\"name\":\"foo\"}' | weknora api /api/v1/knowledge-bases --input -",
|
||||
"academy api /api/v1/knowledge-bases",
|
||||
"academy api /api/v1/knowledge-bases -d '{\"name\":\"foo\"}'",
|
||||
"academy api -X POST /api/v1/knowledge-bases -F name=\"Eng Docs\" -F enabled=true",
|
||||
"academy api -X DELETE /api/v1/knowledge-bases/kb_x -y",
|
||||
"echo '{\"name\":\"foo\"}' | academy api /api/v1/knowledge-bases --input -",
|
||||
},
|
||||
Output: "text mode: the raw server response body on stdout. " +
|
||||
"json mode (default): the parsed server response is placed directly under envelope.data - " +
|
||||
@@ -311,11 +311,11 @@ func resolveMethod(opts *Options) string {
|
||||
return "GET"
|
||||
}
|
||||
|
||||
// apiRetryArgv reconstructs a directly-executable `weknora api` argv (with -y)
|
||||
// apiRetryArgv reconstructs a directly-executable `academy api` argv (with -y)
|
||||
// for the write-confirmation gate, preserving the method, path and body flags
|
||||
// the caller passed so an agent can re-run the exact mutation after approval.
|
||||
func apiRetryArgv(opts *Options, method, path string) []string {
|
||||
argv := []string{"weknora", "api", "-X", method, path}
|
||||
argv := []string{"academy", "api", "-X", method, path}
|
||||
switch {
|
||||
case opts.Data != "":
|
||||
argv = append(argv, "-d", opts.Data)
|
||||
|
||||
@@ -9,10 +9,10 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/prompt"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/prompt"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// apiDryRunFactory builds a Factory whose Client closure panics if invoked —
|
||||
|
||||
@@ -19,10 +19,10 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/prompt"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/prompt"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// fakeAPISvc is a test double for Service that delegates each call to a
|
||||
@@ -306,12 +306,12 @@ func TestAPI_PathWithoutSlash(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// withRootHarness wraps `weknora api ...` under a synthetic root cmd that
|
||||
// withRootHarness wraps `academy api ...` under a synthetic root cmd that
|
||||
// registers the global persistent flags (mirrors addGlobalFlags in
|
||||
// cmd/root.go). Required because api's NewCmd doesn't register --yes /
|
||||
// --format / --jq itself — it inherits them from root in production.
|
||||
func withRootHarness(api *cobra.Command, args ...string) *cobra.Command {
|
||||
root := &cobra.Command{Use: "weknora"}
|
||||
root := &cobra.Command{Use: "academy"}
|
||||
pf := root.PersistentFlags()
|
||||
pf.BoolP("yes", "y", false, "")
|
||||
pf.String("format", "", "")
|
||||
@@ -325,7 +325,7 @@ func withRootHarness(api *cobra.Command, args ...string) *cobra.Command {
|
||||
}
|
||||
|
||||
// TestAPI_DELETE_RequiresConfirmation pins the exit-10 protocol on the
|
||||
// escape-hatch DELETE path: agent invokes `weknora api DELETE /...` without
|
||||
// escape-hatch DELETE path: agent invokes `academy api DELETE /...` without
|
||||
// -y/--yes, must get input.confirmation_required + exit 10. Confirmation is
|
||||
// enforced in NewCmd.RunE (not runAPI), so the test drives the cobra cmd.
|
||||
func TestAPI_DELETE_RequiresConfirmation(t *testing.T) {
|
||||
@@ -659,7 +659,7 @@ func TestAPI_PaginateServerCapsPageSize(t *testing.T) {
|
||||
}
|
||||
|
||||
// TestAPI_PUT_RequiresConfirmation pins the exit-10 write gate on the
|
||||
// escape-hatch PUT path: `weknora api -X PUT /...` mutates server state the
|
||||
// escape-hatch PUT path: `academy api -X PUT /...` mutates server state the
|
||||
// same way a typed `kb update` does, so it must require -y (exit 10) rather
|
||||
// than silently writing. Regression: only DELETE was gated, letting an agent
|
||||
// bypass the write-confirmation protocol via raw PUT/PATCH.
|
||||
|
||||
@@ -15,10 +15,10 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/cmd"
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/cmd"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
func TestAPI_PaginateFormats(t *testing.T) {
|
||||
@@ -110,8 +110,8 @@ func TestAPI_PaginateFormats(t *testing.T) {
|
||||
}
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Setenv("WEKNORA_FORMAT", tc.env)
|
||||
t.Setenv("WEKNORA_PROFILE", "")
|
||||
t.Setenv("ACADEMY_FORMAT", tc.env)
|
||||
t.Setenv("ACADEMY_PROFILE", "")
|
||||
out, errOut := iostreams.SetForTest(t)
|
||||
if tc.tty {
|
||||
out, errOut = iostreams.SetForTestWithTTY(t)
|
||||
@@ -209,7 +209,7 @@ func (w *paginationFailWriter) Write(p []byte) (int, error) {
|
||||
func TestAPI_PaginateTextWriteError(t *testing.T) {
|
||||
for _, tail := range []bool{false, true} {
|
||||
t.Run(strconv.FormatBool(tail), func(t *testing.T) {
|
||||
t.Setenv("WEKNORA_PROFILE", "")
|
||||
t.Setenv("ACADEMY_PROFILE", "")
|
||||
iostreams.SetForTest(t)
|
||||
sentinel := errors.New("synthetic output failure")
|
||||
out := &paginationFailWriter{err: sentinel, tail: tail}
|
||||
|
||||
@@ -5,7 +5,7 @@ package auth
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"academy/cli/internal/cmdutil"
|
||||
)
|
||||
|
||||
// Credential-mode tokens used in the JSON output of auth list / login /
|
||||
@@ -34,7 +34,7 @@ func modeFromRefs(apiKeyRef, tokenRef string) string {
|
||||
}
|
||||
}
|
||||
|
||||
// NewCmdAuth builds the `weknora auth` command tree and registers its
|
||||
// NewCmdAuth builds the `academy auth` command tree and registers its
|
||||
// subcommands. Called from cli/cmd/root.go.
|
||||
func NewCmdAuth(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
|
||||
@@ -9,13 +9,13 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/config"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/prompt"
|
||||
"github.com/Tencent/WeKnora/cli/internal/secrets"
|
||||
"github.com/Tencent/WeKnora/cli/internal/testutil"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/config"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/prompt"
|
||||
"academy/cli/internal/secrets"
|
||||
"academy/cli/internal/testutil"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
func TestNewCmdAuth_TreeShape(t *testing.T) {
|
||||
|
||||
@@ -14,12 +14,12 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/config"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/prompt"
|
||||
"github.com/Tencent/WeKnora/cli/internal/secrets"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/config"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/prompt"
|
||||
"academy/cli/internal/secrets"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// authDryRunFactory builds a Factory whose Client closure panics if invoked —
|
||||
@@ -44,7 +44,7 @@ func authDryRunFactory(t *testing.T, cfg *config.Config) *cmdutil.Factory {
|
||||
// withRootHarnessAuth wraps an auth subcommand under a synthetic root cmd
|
||||
// that registers the global persistent flags.
|
||||
func withRootHarnessAuth(sub *cobra.Command, args ...string) *cobra.Command {
|
||||
root := &cobra.Command{Use: "weknora"}
|
||||
root := &cobra.Command{Use: "academy"}
|
||||
pf := root.PersistentFlags()
|
||||
pf.BoolP("yes", "y", false, "")
|
||||
pf.String("format", "", "")
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/format"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/output"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/format"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/output"
|
||||
)
|
||||
|
||||
type ListOptions struct{}
|
||||
@@ -29,9 +29,9 @@ type listEntry struct {
|
||||
Current bool `json:"current"`
|
||||
}
|
||||
|
||||
// NewCmdList builds `weknora auth list`. Per-host enumeration: render one
|
||||
// NewCmdList builds `academy auth list`. Per-host enumeration: render one
|
||||
// row per registered profile, marking the active one. Reads only
|
||||
// ~/.config/weknora/config.yaml - no network, no keyring touch.
|
||||
// ~/.config/academy/config.yaml - no network, no keyring touch.
|
||||
func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "list",
|
||||
@@ -50,7 +50,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
cmdutil.AddFormatFlag(cmd, authListFields...)
|
||||
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
|
||||
UsedFor: "list configured profiles and their credential mode (bearer / api-key)",
|
||||
Examples: []string{"weknora auth list", "weknora auth list --jq '.data[].name'"},
|
||||
Examples: []string{"academy auth list", "academy auth list --jq '.data[].name'"},
|
||||
Output: "envelope.data is an array of profiles with name, host, mode, and which is active",
|
||||
})
|
||||
return cmd
|
||||
@@ -78,7 +78,7 @@ func runList(fopts *cmdutil.FormatOptions, f *cmdutil.Factory) error {
|
||||
return fopts.Emit(iostreams.IO.Out, entries, meta)
|
||||
}
|
||||
if len(entries) == 0 {
|
||||
fmt.Fprintln(iostreams.IO.Out, "No profiles configured. Run `weknora auth login` to create one.")
|
||||
fmt.Fprintln(iostreams.IO.Out, "No profiles configured. Run `academy auth login` to create one.")
|
||||
return nil
|
||||
}
|
||||
tw := tabwriter.NewWriter(iostreams.IO.Out, 0, 0, 2, ' ', 0)
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/config"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/config"
|
||||
"academy/cli/internal/iostreams"
|
||||
)
|
||||
|
||||
func newListFactory(cfg *config.Config) *cmdutil.Factory {
|
||||
|
||||
+18
-18
@@ -8,11 +8,11 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/config"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/secrets"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/config"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/secrets"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// authLoginFields enumerates the fields surfaced for `--format json` discovery on
|
||||
@@ -26,7 +26,7 @@ var authLoginFields = []string{
|
||||
// LoginOptions is the configuration captured from flags + prompts. Host and
|
||||
// Profile are resolved from the active profile in config (not from flags) -
|
||||
// `auth login` authenticates the already-existing active profile, created
|
||||
// beforehand with `weknora profile add <name> --host <h> --use`.
|
||||
// beforehand with `academy profile add <name> --host <h> --use`.
|
||||
type LoginOptions struct {
|
||||
Host string // resolved from the active profile's Host in config
|
||||
Profile string // resolved active profile name (honors global --profile)
|
||||
@@ -65,22 +65,22 @@ var defaultAPIKeyValidator apiKeyValidator = func(ctx context.Context, host, api
|
||||
return resp.Data.User, nil
|
||||
}
|
||||
|
||||
// NewCmdLogin builds the `weknora auth login` command. runF is the testable
|
||||
// NewCmdLogin builds the `academy auth login` command. runF is the testable
|
||||
// entrypoint (left nil for production; see cli/cmd/auth/login_test.go).
|
||||
func NewCmdLogin(f *cmdutil.Factory, runF func(context.Context, *LoginOptions, *cmdutil.FormatOptions, *cmdutil.Factory, LoginService) error) *cobra.Command {
|
||||
opts := &LoginOptions{}
|
||||
cmd := &cobra.Command{
|
||||
Use: "login",
|
||||
Short: "Authenticate the active profile against its WeKnora server",
|
||||
Short: "Authenticate the active profile against its Academy server",
|
||||
Long: `Authenticate the active profile by email + password (interactive prompt) or
|
||||
pipe an API key with --with-token.
|
||||
|
||||
` + "`auth login`" + ` operates on the active profile (override with the global
|
||||
--profile flag). Create the profile first with
|
||||
` + "`weknora profile add <name> --host <h> --use`" + `, then run ` + "`weknora auth login`" + `.
|
||||
` + "`academy profile add <name> --host <h> --use`" + `, then run ` + "`academy auth login`" + `.
|
||||
|
||||
Credentials are persisted to the OS keyring when available; otherwise to a
|
||||
0600 file under $XDG_CONFIG_HOME/weknora/secrets.`,
|
||||
0600 file under $XDG_CONFIG_HOME/academy/secrets.`,
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(c *cobra.Command, args []string) error {
|
||||
fopts, err := cmdutil.CheckFormatFlag(c)
|
||||
@@ -103,10 +103,10 @@ Credentials are persisted to the OS keyring when available; otherwise to a
|
||||
cmdutil.AddFormatFlag(cmd, authLoginFields...)
|
||||
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
|
||||
UsedFor: "authenticate the active profile; --with-token reads an API key from stdin (non-interactive)",
|
||||
Examples: []string{`echo "$WEKNORA_API_KEY" | weknora auth login --with-token`},
|
||||
Examples: []string{`echo "$ACADEMY_API_KEY" | academy auth login --with-token`},
|
||||
Output: "envelope.data is {profile, host, mode, email, tenant_id} on success (email matches `auth status`)",
|
||||
Warnings: []string{
|
||||
"a profile must exist and be active first (`weknora profile add <n> --host <url> --use`)",
|
||||
"a profile must exist and be active first (`academy profile add <n> --host <url> --use`)",
|
||||
"password login is interactive-only (no flags) — agents must use --with-token with the key piped to stdin",
|
||||
},
|
||||
})
|
||||
@@ -119,7 +119,7 @@ Credentials are persisted to the OS keyring when available; otherwise to a
|
||||
// add`'s job. Returns typed errors when no active profile is configured or
|
||||
// the profile lacks a host.
|
||||
func resolveActiveProfile(f *cmdutil.Factory) (name, host string, err error) {
|
||||
// f.Config() already folds the global --profile / WEKNORA_PROFILE override
|
||||
// f.Config() already folds the global --profile / ACADEMY_PROFILE override
|
||||
// into cfg.CurrentProfile (same source f.ActiveProfile reads), so one load
|
||||
// resolves the active profile — matches logout/refresh.
|
||||
cfg, err := f.Config()
|
||||
@@ -128,10 +128,10 @@ func resolveActiveProfile(f *cmdutil.Factory) (name, host string, err error) {
|
||||
}
|
||||
active := cfg.CurrentProfile
|
||||
if active == "" {
|
||||
msg := "no active profile; run `weknora profile add <name> --host <h> --use` first"
|
||||
msg := "no active profile; run `academy profile add <name> --host <h> --use` first"
|
||||
if envActive, kind := cmdutil.EnvCredential(); envActive {
|
||||
msg = "no active profile to log in — you are already authenticated this session via " + kind +
|
||||
"; `auth login` only persists a named profile, so run `weknora profile add <name> --host <h> --use` first if you want one"
|
||||
"; `auth login` only persists a named profile, so run `academy profile add <name> --host <h> --use` first if you want one"
|
||||
}
|
||||
return "", "", cmdutil.NewError(cmdutil.CodeAuthUnauthenticated, msg)
|
||||
}
|
||||
@@ -197,7 +197,7 @@ func runLogin(ctx context.Context, opts *LoginOptions, fopts *cmdutil.FormatOpti
|
||||
// Transport errors (connection refused, DNS failure) must not be
|
||||
// surfaced as auth.bad_credential — the key may be fine but the
|
||||
// host is unreachable. Classify via WrapHTTP so network errors
|
||||
// get CodeNetworkError and the hint points at `weknora doctor`.
|
||||
// get CodeNetworkError and the hint points at `academy doctor`.
|
||||
if cmdutil.ClassifyHTTPError(err) == cmdutil.CodeNetworkError {
|
||||
return cmdutil.Wrapf(cmdutil.CodeNetworkError, err, "validate API key: check host reachability")
|
||||
}
|
||||
@@ -381,8 +381,8 @@ func warnOnFileFallback(store secrets.Store) {
|
||||
if _, isFile := store.(*secrets.FileStore); !isFile {
|
||||
return
|
||||
}
|
||||
fmt.Fprintln(iostreams.IO.Err, "warning: OS keychain unavailable - credentials will be saved to a 0600 file under $XDG_CONFIG_HOME/weknora/secrets/.")
|
||||
fmt.Fprintln(iostreams.IO.Err, " install / unlock the keyring (or use `weknora doctor` to inspect) for OS-backed storage.")
|
||||
fmt.Fprintln(iostreams.IO.Err, "warning: OS keychain unavailable - credentials will be saved to a 0600 file under $XDG_CONFIG_HOME/academy/secrets/.")
|
||||
fmt.Fprintln(iostreams.IO.Err, " install / unlock the keyring (or use `academy doctor` to inspect) for OS-backed storage.")
|
||||
}
|
||||
|
||||
// readStdinTrimmed reads all of r and returns the result with surrounding
|
||||
|
||||
@@ -10,13 +10,13 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/config"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/prompt"
|
||||
"github.com/Tencent/WeKnora/cli/internal/secrets"
|
||||
"github.com/Tencent/WeKnora/cli/internal/testutil"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/config"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/prompt"
|
||||
"academy/cli/internal/secrets"
|
||||
"academy/cli/internal/testutil"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// fakeLoginService captures the email/password it received.
|
||||
|
||||
+14
-14
@@ -6,10 +6,10 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/config"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/secrets"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/config"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/secrets"
|
||||
)
|
||||
|
||||
type LogoutOptions struct {
|
||||
@@ -28,7 +28,7 @@ type logoutResult struct {
|
||||
Removed []string `json:"removed"`
|
||||
}
|
||||
|
||||
// NewCmdLogout builds `weknora auth logout`. Clears stored credentials
|
||||
// NewCmdLogout builds `academy auth logout`. Clears stored credentials
|
||||
// (keyring + file fallback) and removes the profile entry from config.yaml.
|
||||
// No server-side revocation - local-only credential clear.
|
||||
func NewCmdLogout(f *cmdutil.Factory) *cobra.Command {
|
||||
@@ -37,14 +37,14 @@ func NewCmdLogout(f *cmdutil.Factory) *cobra.Command {
|
||||
Use: "logout",
|
||||
Short: "Remove stored credentials for a profile",
|
||||
Long: `Clear keyring + file-fallback secrets for one profile (or all of
|
||||
them with --all) and drop the profile entry from ~/.config/weknora/config.yaml.
|
||||
them with --all) and drop the profile entry from ~/.config/academy/config.yaml.
|
||||
|
||||
Note: this does NOT revoke the credential server-side - for API keys, you
|
||||
must rotate them in the server UI; for JWT, the token will continue to be
|
||||
accepted until it expires.`,
|
||||
Example: ` weknora auth logout # active profile
|
||||
weknora --profile staging auth logout # specific profile
|
||||
weknora auth logout --all`,
|
||||
Example: ` academy auth logout # active profile
|
||||
academy --profile staging auth logout # specific profile
|
||||
academy auth logout --all`,
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(c *cobra.Command, _ []string) error {
|
||||
fopts, err := cmdutil.CheckFormatFlag(c)
|
||||
@@ -92,9 +92,9 @@ accepted until it expires.`,
|
||||
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
|
||||
UsedFor: "clear stored credentials for the active profile (or --all); the profile itself stays registered (host preserved) so `auth login` can re-auth it — use `profile remove` to delete the profile entirely",
|
||||
Examples: []string{
|
||||
"weknora auth logout",
|
||||
"weknora --profile staging auth logout",
|
||||
"weknora auth logout --all",
|
||||
"academy auth logout",
|
||||
"academy --profile staging auth logout",
|
||||
"academy auth logout --all",
|
||||
},
|
||||
Output: "envelope.data is {removed: [profile names cleared]}",
|
||||
Warnings: []string{
|
||||
@@ -125,9 +125,9 @@ func runLogout(opts *LogoutOptions, fopts *cmdutil.FormatOptions, f *cmdutil.Fac
|
||||
|
||||
// Destructive-write protocol: confirm before clearing credentials.
|
||||
scope := fmt.Sprintf("%d profile(s) [%s]", len(targets), strings.Join(targets, ", "))
|
||||
retryCmd := []string{"weknora", "auth", "logout", "-y"}
|
||||
retryCmd := []string{"academy", "auth", "logout", "-y"}
|
||||
if opts.All {
|
||||
retryCmd = []string{"weknora", "auth", "logout", "--all", "-y"}
|
||||
retryCmd = []string{"academy", "auth", "logout", "--all", "-y"}
|
||||
}
|
||||
if err := cmdutil.ConfirmDestructive(f.Prompter(), opts.Yes, fopts.WantsJSON(), "delete", "auth credentials", scope, "auth.logout", retryCmd); err != nil {
|
||||
return err
|
||||
|
||||
@@ -6,11 +6,11 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/config"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/prompt"
|
||||
"github.com/Tencent/WeKnora/cli/internal/secrets"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/config"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/prompt"
|
||||
"academy/cli/internal/secrets"
|
||||
)
|
||||
|
||||
// newLogoutFactory builds a Factory whose Config closure mutates the supplied
|
||||
|
||||
+16
-16
@@ -6,9 +6,9 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
type RefreshOptions struct {
|
||||
@@ -22,12 +22,12 @@ var authRefreshFields = []string{"profile"}
|
||||
// refreshResult is the typed payload emitted under data on success. Token
|
||||
// values are intentionally NOT included - emitting them would leak secrets
|
||||
// into stdout / agent transcripts. Agents needing to verify the new token
|
||||
// can re-run `weknora auth status` (live API check).
|
||||
// can re-run `academy auth status` (live API check).
|
||||
type refreshResult struct {
|
||||
Profile string `json:"profile"`
|
||||
}
|
||||
|
||||
// NewCmdRefresh builds `weknora auth refresh`. Renews the JWT access
|
||||
// NewCmdRefresh builds `academy auth refresh`. Renews the JWT access
|
||||
// token by spending the stored refresh_token via POST /auth/refresh -
|
||||
// the standard OAuth refresh-token grant.
|
||||
//
|
||||
@@ -38,14 +38,14 @@ func NewCmdRefresh(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "refresh",
|
||||
Short: "Renew the JWT access token using the stored refresh token",
|
||||
Long: `Reads the refresh token previously stored by ` + "`weknora auth login`" + ` and
|
||||
Long: `Reads the refresh token previously stored by ` + "`academy auth login`" + ` and
|
||||
exchanges it for a new access + refresh token pair via POST /api/v1/auth/refresh.
|
||||
Both new tokens replace the existing entries in the OS keyring.
|
||||
|
||||
API-key profiles are rejected with input.invalid_argument - they have no
|
||||
refresh semantic. Rotate the key in the server UI instead.`,
|
||||
Example: ` weknora auth refresh # refresh the active profile
|
||||
weknora --profile staging auth refresh # refresh a specific profile`,
|
||||
Example: ` academy auth refresh # refresh the active profile
|
||||
academy --profile staging auth refresh # refresh a specific profile`,
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(c *cobra.Command, _ []string) error {
|
||||
fopts, err := cmdutil.CheckFormatFlag(c)
|
||||
@@ -67,7 +67,7 @@ refresh semantic. Rotate the key in the server UI instead.`,
|
||||
"authenticated via "+kind+" (stateless env credential): there is no stored JWT to refresh — env credentials are supplied fresh each call, so no refresh is needed")
|
||||
}
|
||||
return cmdutil.NewError(cmdutil.CodeAuthUnauthenticated,
|
||||
"no active profile configured; run `weknora auth login` to set one up")
|
||||
"no active profile configured; run `academy auth login` to set one up")
|
||||
}
|
||||
prof, ok := cfg.Profiles[name]
|
||||
if !ok {
|
||||
@@ -79,9 +79,9 @@ refresh semantic. Rotate the key in the server UI instead.`,
|
||||
fmt.Sprintf("profile %q has no host", name))
|
||||
}
|
||||
if prof.RefreshRef == "" {
|
||||
hint := "api-key profiles can't be refreshed - rotate the key in the server UI and run `weknora auth login --with-token`"
|
||||
hint := "api-key profiles can't be refreshed - rotate the key in the server UI and run `academy auth login --with-token`"
|
||||
if prof.APIKeyRef == "" {
|
||||
hint = "no refresh token stored - run `weknora auth login` to authenticate"
|
||||
hint = "no refresh token stored - run `academy auth login` to authenticate"
|
||||
}
|
||||
return &cmdutil.Error{
|
||||
Code: cmdutil.CodeInputInvalidArgument,
|
||||
@@ -104,8 +104,8 @@ refresh semantic. Rotate the key in the server UI instead.`,
|
||||
UsedFor: "Renew the JWT access token for the active profile (override with the global --profile) using the stored refresh token. API-key profiles are rejected.",
|
||||
Output: "envelope.data has profile name that was refreshed",
|
||||
Examples: []string{
|
||||
"weknora auth refresh",
|
||||
"weknora --profile staging auth refresh",
|
||||
"academy auth refresh",
|
||||
"academy --profile staging auth refresh",
|
||||
},
|
||||
})
|
||||
return cmd
|
||||
@@ -130,7 +130,7 @@ func runRefresh(ctx context.Context, opts *RefreshOptions, fopts *cmdutil.Format
|
||||
"authenticated via "+kind+" (stateless env credential): there is no stored JWT to refresh — env credentials are supplied fresh each call, so no refresh is needed")
|
||||
}
|
||||
return cmdutil.NewError(cmdutil.CodeAuthUnauthenticated,
|
||||
"no active profile configured; run `weknora auth login` to set one up")
|
||||
"no active profile configured; run `academy auth login` to set one up")
|
||||
}
|
||||
c, ok := cfg.Profiles[name]
|
||||
if !ok {
|
||||
@@ -142,9 +142,9 @@ func runRefresh(ctx context.Context, opts *RefreshOptions, fopts *cmdutil.Format
|
||||
fmt.Sprintf("profile %q has no host", name))
|
||||
}
|
||||
if c.RefreshRef == "" {
|
||||
hint := "api-key profiles can't be refreshed - rotate the key in the server UI and run `weknora auth login --with-token`"
|
||||
hint := "api-key profiles can't be refreshed - rotate the key in the server UI and run `academy auth login --with-token`"
|
||||
if c.APIKeyRef == "" {
|
||||
hint = "no refresh token stored - run `weknora auth login` to authenticate"
|
||||
hint = "no refresh token stored - run `academy auth login` to authenticate"
|
||||
}
|
||||
return &cmdutil.Error{
|
||||
Code: cmdutil.CodeInputInvalidArgument,
|
||||
|
||||
@@ -10,13 +10,13 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/config"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/prompt"
|
||||
"github.com/Tencent/WeKnora/cli/internal/secrets"
|
||||
"github.com/Tencent/WeKnora/cli/internal/testutil"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/config"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/prompt"
|
||||
"academy/cli/internal/secrets"
|
||||
"academy/cli/internal/testutil"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// fakeRefreshService scripts a RefreshToken response.
|
||||
|
||||
+10
-10
@@ -8,9 +8,9 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// authStatusFields enumerates the fields surfaced for `--format json` discovery
|
||||
@@ -42,7 +42,7 @@ type statusResult struct {
|
||||
TenantName string `json:"tenant_name,omitempty"`
|
||||
}
|
||||
|
||||
// NewCmdStatus builds the `weknora auth status` command.
|
||||
// NewCmdStatus builds the `academy auth status` command.
|
||||
func NewCmdStatus(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "status",
|
||||
@@ -51,7 +51,7 @@ func NewCmdStatus(f *cmdutil.Factory) *cobra.Command {
|
||||
and tenant the server resolves the credential to.
|
||||
|
||||
Exits with auth.unauthenticated when the token is invalid or missing - run
|
||||
` + "`weknora auth login`" + ` (or ` + "`auth refresh`" + ` for JWT profiles) to recover.
|
||||
` + "`academy auth login`" + ` (or ` + "`auth refresh`" + ` for JWT profiles) to recover.
|
||||
For JWT profiles the SDK transparently refreshes on 401, so this command
|
||||
usually only surfaces a hard auth failure.`,
|
||||
Args: cobra.NoArgs,
|
||||
@@ -71,7 +71,7 @@ usually only surfaces a hard auth failure.`,
|
||||
cmdutil.AddFormatFlag(cmd, authStatusFields...)
|
||||
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
|
||||
UsedFor: "show the active profile, the authenticated principal, and token state",
|
||||
Examples: []string{"weknora auth status", "weknora auth status --jq .data.tenant_id"},
|
||||
Examples: []string{"academy auth status", "academy auth status --jq .data.tenant_id"},
|
||||
Output: "envelope.data is {profile, host, auth_source, user_id, username, email, tenant_id, tenant_name, ...}; auth_source is 'profile + keyring' or a stateless env credential; exit 3 if unauthenticated",
|
||||
})
|
||||
return cmd
|
||||
@@ -79,7 +79,7 @@ usually only surfaces a hard auth failure.`,
|
||||
|
||||
func runStatus(ctx context.Context, fopts *cmdutil.FormatOptions, f *cmdutil.Factory, svc StatusService) error {
|
||||
if svc == nil {
|
||||
return cmdutil.NewError(cmdutil.CodeAuthUnauthenticated, "no SDK client available; run `weknora auth login`")
|
||||
return cmdutil.NewError(cmdutil.CodeAuthUnauthenticated, "no SDK client available; run `academy auth login`")
|
||||
}
|
||||
resp, err := svc.GetCurrentUser(ctx)
|
||||
if err != nil {
|
||||
@@ -94,8 +94,8 @@ func runStatus(ctx context.Context, fopts *cmdutil.FormatOptions, f *cmdutil.Fac
|
||||
}
|
||||
|
||||
// Effective host + auth source. Stateless env credentials
|
||||
// (WEKNORA_TOKEN/WEKNORA_API_KEY) override the profile + keyring for the
|
||||
// client, so report the host they authenticate against (WEKNORA_HOST) and
|
||||
// (ACADEMY_TOKEN/ACADEMY_API_KEY) override the profile + keyring for the
|
||||
// client, so report the host they authenticate against (ACADEMY_HOST) and
|
||||
// that they are in effect — not the bypassed config profile's host.
|
||||
host := ""
|
||||
if c, ok := cfg.Profiles[cfg.CurrentProfile]; ok {
|
||||
@@ -104,7 +104,7 @@ func runStatus(ctx context.Context, fopts *cmdutil.FormatOptions, f *cmdutil.Fac
|
||||
authSource := "profile + keyring"
|
||||
if active, kind := cmdutil.EnvCredential(); active {
|
||||
authSource = kind + " env (stateless)"
|
||||
if h := strings.TrimSpace(os.Getenv("WEKNORA_HOST")); h != "" {
|
||||
if h := strings.TrimSpace(os.Getenv("ACADEMY_HOST")); h != "" {
|
||||
host = h
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/config"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/config"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -9,12 +9,12 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/config"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/prompt"
|
||||
"github.com/Tencent/WeKnora/cli/internal/testutil"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/config"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/prompt"
|
||||
"academy/cli/internal/testutil"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
type fakeStatusService struct {
|
||||
|
||||
+21
-21
@@ -6,8 +6,8 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
)
|
||||
|
||||
// authTokenFields lists fields surfaced in `--help` as a hint for `--jq`
|
||||
@@ -20,12 +20,12 @@ type tokenResult struct {
|
||||
Profile string `json:"profile"`
|
||||
}
|
||||
|
||||
// NewCmdToken builds `weknora auth token`. Prints the active profile's
|
||||
// NewCmdToken builds `academy auth token`. Prints the active profile's
|
||||
// credential to stdout for use in shell pipelines, e.g.
|
||||
//
|
||||
// WEKNORA_TOKEN=$(weknora auth token)
|
||||
// curl -H "Authorization: Bearer $WEKNORA_TOKEN" ... # JWT mode
|
||||
// curl -H "X-API-Key: $WEKNORA_TOKEN" ... # api-key mode
|
||||
// ACADEMY_TOKEN=$(academy auth token)
|
||||
// curl -H "Authorization: Bearer $ACADEMY_TOKEN" ... # JWT mode
|
||||
// curl -H "X-API-Key: $ACADEMY_TOKEN" ... # api-key mode
|
||||
//
|
||||
// The user is responsible for constructing the appropriate header -
|
||||
// `auth list` shows which mode each profile uses.
|
||||
@@ -40,26 +40,26 @@ func NewCmdToken(f *cmdutil.Factory) *cobra.Command {
|
||||
newline, suitable for shell command substitution.
|
||||
|
||||
The credential is the long-lived API key (mode: api-key) or the access JWT
|
||||
(mode: bearer), depending on how the profile was created. Run ` + "`weknora auth list`" + `
|
||||
(mode: bearer), depending on how the profile was created. Run ` + "`academy auth list`" + `
|
||||
to see which mode each profile uses, and construct the matching HTTP header:
|
||||
|
||||
Authorization: Bearer <token> # bearer mode
|
||||
X-API-Key: <token> # api-key mode
|
||||
|
||||
` + "`--profile <name>`" + ` (global flag) selects a non-active profile to read from.`,
|
||||
Example: ` WEKNORA_TOKEN=$(weknora auth token)
|
||||
weknora auth token --profile staging
|
||||
weknora auth token --format json`,
|
||||
Example: ` ACADEMY_TOKEN=$(academy auth token)
|
||||
academy auth token --profile staging
|
||||
academy auth token --format json`,
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(c *cobra.Command, _ []string) error {
|
||||
fopts, err := cmdutil.CheckFormatFlag(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// `auth token` is a scalar scripting helper (WEKNORA_TOKEN=$(...)),
|
||||
// `auth token` is a scalar scripting helper (ACADEMY_TOKEN=$(...)),
|
||||
// so it defaults to the raw token — overriding the global json
|
||||
// default, the same way `doc download` streams raw bytes. Explicit
|
||||
// --format json / WEKNORA_FORMAT=json still emit the
|
||||
// --format json / ACADEMY_FORMAT=json still emit the
|
||||
// {token,mode,profile} envelope.
|
||||
fopts.FromEnv()
|
||||
if fopts.Mode == "" {
|
||||
@@ -78,9 +78,9 @@ to see which mode each profile uses, and construct the matching HTTP header:
|
||||
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
|
||||
UsedFor: "print the active profile's raw credential to stdout for shell capture",
|
||||
Examples: []string{
|
||||
"WEKNORA_TOKEN=$(weknora auth token)",
|
||||
"weknora auth token --profile staging",
|
||||
"weknora auth token --format json",
|
||||
"ACADEMY_TOKEN=$(academy auth token)",
|
||||
"academy auth token --profile staging",
|
||||
"academy auth token --format json",
|
||||
},
|
||||
Output: "raw token on stdout (no envelope, no trailing newline) by default; --format json emits {token, mode, profile}",
|
||||
Warnings: []string{
|
||||
@@ -96,7 +96,7 @@ func runToken(f *cmdutil.Factory, fopts *cmdutil.FormatOptions) error {
|
||||
// erroring on the absence of a stored profile.
|
||||
if active, kind := cmdutil.EnvCredential(); active {
|
||||
mode := ModeBearer
|
||||
if kind == "WEKNORA_API_KEY" {
|
||||
if kind == "ACADEMY_API_KEY" {
|
||||
mode = ModeAPIKey
|
||||
}
|
||||
return emitToken(fopts, os.Getenv(kind), mode, "(env)")
|
||||
@@ -143,12 +143,12 @@ func runToken(f *cmdutil.Factory, fopts *cmdutil.FormatOptions) error {
|
||||
token, mode = v, ModeAPIKey
|
||||
default:
|
||||
return cmdutil.NewError(cmdutil.CodeAuthUnauthenticated,
|
||||
fmt.Sprintf("profile %q has no stored credential; run `weknora auth login`", profileName))
|
||||
fmt.Sprintf("profile %q has no stored credential; run `academy auth login`", profileName))
|
||||
}
|
||||
|
||||
if token == "" {
|
||||
return cmdutil.NewError(cmdutil.CodeAuthUnauthenticated,
|
||||
fmt.Sprintf("profile %q credential is empty in keyring; run `weknora auth login`", profileName))
|
||||
fmt.Sprintf("profile %q credential is empty in keyring; run `academy auth login`", profileName))
|
||||
}
|
||||
|
||||
return emitToken(fopts, token, mode, profileName)
|
||||
@@ -156,7 +156,7 @@ func runToken(f *cmdutil.Factory, fopts *cmdutil.FormatOptions) error {
|
||||
|
||||
// emitToken renders a resolved credential: the {token, mode, profile} envelope
|
||||
// under --format json, else the raw token on stdout (no trailing newline, for
|
||||
// clean $(weknora auth token) capture) with a TTY-only leak hint on stderr.
|
||||
// clean $(academy auth token) capture) with a TTY-only leak hint on stderr.
|
||||
func emitToken(fopts *cmdutil.FormatOptions, token, mode, profile string) error {
|
||||
if token == "" {
|
||||
return cmdutil.NewError(cmdutil.CodeAuthUnauthenticated, "active credential is empty")
|
||||
@@ -165,7 +165,7 @@ func emitToken(fopts *cmdutil.FormatOptions, token, mode, profile string) error
|
||||
return fopts.Emit(iostreams.IO.Out, tokenResult{Token: token, Mode: mode, Profile: profile}, nil)
|
||||
}
|
||||
|
||||
// No trailing newline - clean $(weknora auth token) substitution.
|
||||
// No trailing newline - clean $(academy auth token) substitution.
|
||||
fmt.Fprint(iostreams.IO.Out, token)
|
||||
// Defensive hint to stderr when stdout is an interactive terminal:
|
||||
// the user likely didn't mean to display the secret on screen.
|
||||
@@ -174,7 +174,7 @@ func emitToken(fopts *cmdutil.FormatOptions, token, mode, profile string) error
|
||||
// recourse on leak - bearer tokens self-expire via refresh.
|
||||
if iostreams.IO.IsStdoutTTY() {
|
||||
fmt.Fprintln(iostreams.IO.Err)
|
||||
fmt.Fprintln(iostreams.IO.Err, "hint: pipe to $(weknora auth token) to capture; this terminal scrollback now contains the secret")
|
||||
fmt.Fprintln(iostreams.IO.Err, "hint: pipe to $(academy auth token) to capture; this terminal scrollback now contains the secret")
|
||||
if mode == ModeAPIKey {
|
||||
fmt.Fprintln(iostreams.IO.Err, "note: api-key credentials are long-lived - rotate via your auth provider if exposed (no `auth refresh` path)")
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/config"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/secrets"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/config"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/secrets"
|
||||
)
|
||||
|
||||
// tokenTestFactory wires a config + in-memory secrets store the same way
|
||||
@@ -24,8 +24,8 @@ func tokenTestFactory(t *testing.T, cfg *config.Config, store *secrets.MemStore)
|
||||
}
|
||||
|
||||
// TestAuthToken_DefaultIsRawToken locks the scripting contract: with no
|
||||
// explicit --format, `weknora auth token` emits the raw token (so
|
||||
// WEKNORA_TOKEN=$(weknora auth token) works), NOT the JSON envelope — even
|
||||
// explicit --format, `academy auth token` emits the raw token (so
|
||||
// ACADEMY_TOKEN=$(academy auth token) works), NOT the JSON envelope — even
|
||||
// though the global --format default is json. Explicit --format json still
|
||||
// emits the {token,mode,profile} envelope (covered by the JSON test below).
|
||||
func TestAuthToken_DefaultIsRawToken(t *testing.T) {
|
||||
|
||||
+14
-14
@@ -1,4 +1,4 @@
|
||||
// Package chat implements `weknora chat <text>` - the streaming RAG answer
|
||||
// Package chat implements `academy chat <text>` - the streaming RAG answer
|
||||
// entry point.
|
||||
//
|
||||
// Three output modes share a single SDK call:
|
||||
@@ -28,11 +28,11 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/output"
|
||||
"github.com/Tencent/WeKnora/cli/internal/sse"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/output"
|
||||
"academy/cli/internal/sse"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// chatFields enumerates the fields surfaced for `--jq` projection discovery
|
||||
@@ -64,13 +64,13 @@ type ChatService interface {
|
||||
KnowledgeQAStream(ctx context.Context, sessionID string, req *sdk.KnowledgeQARequest, cb func(*sdk.StreamResponse) error, opts ...sdk.ResourceURLOptions) error
|
||||
}
|
||||
|
||||
// NewCmd builds `weknora chat <text>`.
|
||||
// NewCmd builds `academy chat <text>`.
|
||||
func NewCmd(f *cmdutil.Factory) *cobra.Command {
|
||||
opts := &Options{}
|
||||
cmd := &cobra.Command{
|
||||
Use: `chat "<text>"`,
|
||||
Short: "Ask a streaming RAG question against a knowledge base",
|
||||
Long: `Send a query to the WeKnora knowledge-chat endpoint and stream the
|
||||
Long: `Send a query to the Academy knowledge-chat endpoint and stream the
|
||||
answer back. By default a fresh session is created on first invocation; pass
|
||||
--session to continue an existing conversation.
|
||||
|
||||
@@ -83,9 +83,9 @@ Modes:
|
||||
Pass --reference to include bounded kb_id/chunk_id reference indexes. Pass
|
||||
--verbose to include reasoning, tool activity, and lifecycle frames. Combine
|
||||
both flags for the complete projected stream.`,
|
||||
Example: ` weknora chat "What is RRF?" --kb a32a63ff-fb36-4874-bcaa-30f48570a694
|
||||
weknora chat "Summarise this design doc" --kb my-kb --format json
|
||||
weknora chat "Continue?" --session sess_abc`,
|
||||
Example: ` academy chat "What is RRF?" --kb a32a63ff-fb36-4874-bcaa-30f48570a694
|
||||
academy chat "Summarise this design doc" --kb my-kb --format json
|
||||
academy chat "Continue?" --session sess_abc`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(c *cobra.Command, args []string) error {
|
||||
opts.Query = strings.TrimSpace(args[0])
|
||||
@@ -118,8 +118,8 @@ both flags for the complete projected stream.`,
|
||||
UsedFor: "Ask a RAG question against a knowledge base. Default JSON returns a bounded answer-event projection. --reference adds indexed citations; --verbose adds reasoning, tools, and lifecycle events. --format ndjson streams raw SDK events; --format text renders the selected events live.",
|
||||
RequiredFlags: []string{"<text> (positional)", "--kb"},
|
||||
Examples: []string{
|
||||
`weknora chat "What is RRF?" --kb kb_abc`,
|
||||
`weknora chat "What is RRF?" --kb kb_abc --jq '[.data.events[].content] | join("")'`,
|
||||
`academy chat "What is RRF?" --kb kb_abc`,
|
||||
`academy chat "What is RRF?" --kb kb_abc --jq '[.data.events[].content] | join("")'`,
|
||||
},
|
||||
Output: "Default --format json: {ok,data:{events:[answer...],session_id,kb_id,query}}. --reference adds kb_id/chunk_id reference events; --verbose adds execution events. --format ndjson remains raw.",
|
||||
})
|
||||
@@ -146,7 +146,7 @@ func runChat(ctx context.Context, opts *Options, fopts *cmdutil.FormatOptions, s
|
||||
sessionID := opts.SessionID
|
||||
autoCreated := false
|
||||
if sessionID == "" {
|
||||
sess, err := svc.CreateSession(ctx, &sdk.CreateSessionRequest{Title: "weknora chat"})
|
||||
sess, err := svc.CreateSession(ctx, &sdk.CreateSessionRequest{Title: "academy chat"})
|
||||
if err != nil {
|
||||
// Ctrl-C during session creation: classify as cancelled so the
|
||||
// hint nudges the user toward retry-with-signal-clean, not
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/sse"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/sse"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// fakeChatService implements ChatService for unit tests. Tests configure the
|
||||
|
||||
@@ -11,7 +11,7 @@ package chunkcmd
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"academy/cli/internal/cmdutil"
|
||||
)
|
||||
|
||||
const chunkLong = `Manage and inspect document chunks.
|
||||
|
||||
+13
-13
@@ -6,9 +6,9 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/prompt"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/prompt"
|
||||
)
|
||||
|
||||
// chunkDeleteFields enumerates the JSON discovery fields for `chunk delete`.
|
||||
@@ -62,12 +62,12 @@ and writes input.confirmation_required to stderr. NEVER auto-pass -y
|
||||
without the user's explicit go-ahead — the exit-10 protocol exists
|
||||
exactly to guard against unintended deletes.`
|
||||
|
||||
const chunkDeleteExample = ` weknora chunk delete chunk_abc --doc doc_xyz # interactive confirm
|
||||
weknora chunk delete chunk_abc --doc doc_xyz -y # no prompt
|
||||
weknora chunk delete chunk_abc --doc doc_xyz -y --format json # bare {id, deleted:true} JSON
|
||||
weknora chunk delete c1 c2 c3 --doc doc_xyz -y # delete 3 chunks under same doc, keep-going`
|
||||
const chunkDeleteExample = ` academy chunk delete chunk_abc --doc doc_xyz # interactive confirm
|
||||
academy chunk delete chunk_abc --doc doc_xyz -y # no prompt
|
||||
academy chunk delete chunk_abc --doc doc_xyz -y --format json # bare {id, deleted:true} JSON
|
||||
academy chunk delete c1 c2 c3 --doc doc_xyz -y # delete 3 chunks under same doc, keep-going`
|
||||
|
||||
// NewCmdDelete builds `weknora chunk delete <chunk-id> [<chunk-id>...] --doc <doc-id>`.
|
||||
// NewCmdDelete builds `academy chunk delete <chunk-id> [<chunk-id>...] --doc <doc-id>`.
|
||||
func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
|
||||
opts := &DeleteOptions{}
|
||||
cmd := &cobra.Command{
|
||||
@@ -100,7 +100,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
|
||||
opts.ChunkID = args[0]
|
||||
return runDelete(c.Context(), opts, fopts, cli, f.Prompter())
|
||||
}
|
||||
batchRetry := append([]string{"weknora", "chunk", "delete"}, args...)
|
||||
batchRetry := append([]string{"academy", "chunk", "delete"}, args...)
|
||||
batchRetry = append(batchRetry, "--doc", opts.DocID, "-y")
|
||||
if err := cmdutil.ConfirmDestructiveBatch(f.Prompter(), opts.Yes, fopts.WantsJSON(), "delete", "chunk", len(args), "chunk.delete", batchRetry); err != nil {
|
||||
return err
|
||||
@@ -132,9 +132,9 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
|
||||
UsedFor: "permanently delete one or more chunks from a document",
|
||||
RequiredFlags: []string{"<chunk-id>... (positional, at least one)", "--doc <doc-id>"},
|
||||
Examples: []string{
|
||||
"weknora chunk delete chunk_abc --doc doc_xyz -y",
|
||||
"weknora chunk delete c1 c2 c3 --doc doc_xyz -y",
|
||||
"weknora chunk delete chunk_abc --doc doc_xyz -y --format json",
|
||||
"academy chunk delete chunk_abc --doc doc_xyz -y",
|
||||
"academy chunk delete c1 c2 c3 --doc doc_xyz -y",
|
||||
"academy chunk delete chunk_abc --doc doc_xyz -y --format json",
|
||||
},
|
||||
Output: "envelope.data shape depends on the form: a single chunk id -> {id, deleted:true}; multiple ids -> batch envelope (top-level status success|partial|error, ok=(failures==0), data per-item [{id, ok, error?}], meta.successes/failures — read data[].ok per id).",
|
||||
Warnings: []string{
|
||||
@@ -146,7 +146,7 @@ func NewCmdDelete(f *cmdutil.Factory) *cobra.Command {
|
||||
}
|
||||
|
||||
func runDelete(ctx context.Context, opts *DeleteOptions, fopts *cmdutil.FormatOptions, svc DeleteService, p prompt.Prompter) error {
|
||||
if err := cmdutil.ConfirmDestructive(p, opts.Yes, fopts.WantsJSON(), "delete", "chunk", opts.ChunkID, "chunk.delete", []string{"weknora", "chunk", "delete", opts.ChunkID, "--doc", opts.DocID, "-y"}); err != nil {
|
||||
if err := cmdutil.ConfirmDestructive(p, opts.Yes, fopts.WantsJSON(), "delete", "chunk", opts.ChunkID, "chunk.delete", []string{"academy", "chunk", "delete", opts.ChunkID, "--doc", opts.DocID, "-y"}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := svc.DeleteChunk(ctx, opts.DocID, opts.ChunkID); err != nil {
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/testutil"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/testutil"
|
||||
)
|
||||
|
||||
type fakeChunkDeleteSvc struct {
|
||||
|
||||
+10
-10
@@ -8,11 +8,11 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/output"
|
||||
"github.com/Tencent/WeKnora/cli/internal/text"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/output"
|
||||
"academy/cli/internal/text"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -72,11 +72,11 @@ AI agents: prefer 'search chunks' for retrieval tasks. Use 'chunk list'
|
||||
only when you need to enumerate / verify the chunking output of a
|
||||
specific document.`
|
||||
|
||||
const chunkListExample = ` weknora chunk list --doc doc_abc
|
||||
weknora chunk list --doc doc_abc --all-pages --page-size 100
|
||||
weknora chunk list --doc doc_abc --format json | jq '.[] | {id, chunk_index}'`
|
||||
const chunkListExample = ` academy chunk list --doc doc_abc
|
||||
academy chunk list --doc doc_abc --all-pages --page-size 100
|
||||
academy chunk list --doc doc_abc --format json | jq '.[] | {id, chunk_index}'`
|
||||
|
||||
// NewCmdList builds `weknora chunk list --doc <doc-id>`.
|
||||
// NewCmdList builds `academy chunk list --doc <doc-id>`.
|
||||
func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
opts := &ListOptions{}
|
||||
cmd := &cobra.Command{
|
||||
@@ -114,7 +114,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
|
||||
UsedFor: "List chunks of a specific document in stored order (admin/debug). Results come with meta.count; use --limit (1..10000) and --all-pages to paginate. Prefer 'search chunks' for RAG retrieval.",
|
||||
RequiredFlags: []string{"--doc"},
|
||||
Examples: []string{"weknora chunk list --doc doc_abc --format json", "weknora chunk list --doc doc_abc --all-pages --format json"},
|
||||
Examples: []string{"academy chunk list --doc doc_abc --format json", "academy chunk list --doc doc_abc --all-pages --format json"},
|
||||
Output: "envelope.data is an array of Chunk objects with id, chunk_index, content, is_enabled; meta.count is the returned count, meta.total_count the document's full chunk count, meta.has_more true when --limit truncated",
|
||||
})
|
||||
return cmd
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
type listCall struct {
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// chunkViewFields enumerates the 23 SDK Chunk fields surfaced for `--format json`
|
||||
@@ -37,7 +37,7 @@ const chunkViewLong = `Show a single chunk with all SDK fields.
|
||||
|
||||
Text output is a key-value block; pass --format json for the bare 23-field SDK
|
||||
Chunk object. Content renders verbatim regardless of size — pipe to
|
||||
less or use --format json for large chunks. WeKnora chunks are typically bounded
|
||||
less or use --format json for large chunks. Academy chunks are typically bounded
|
||||
by the ingest pipeline (~1000 tokens / a few KB), so unconditional full
|
||||
rendering is reasonable.
|
||||
|
||||
@@ -53,11 +53,11 @@ invoke citation) is sufficient for view.
|
||||
Typed exit codes:
|
||||
resource.not_found no chunk with the given id (exit 4)`
|
||||
|
||||
const chunkViewExample = ` weknora chunk view chunk_abc
|
||||
weknora chunk view chunk_abc --format json | jq '.content'
|
||||
weknora chunk view chunk_abc --format json --jq '{id, chunk_index, is_enabled}'`
|
||||
const chunkViewExample = ` academy chunk view chunk_abc
|
||||
academy chunk view chunk_abc --format json | jq '.content'
|
||||
academy chunk view chunk_abc --format json --jq '{id, chunk_index, is_enabled}'`
|
||||
|
||||
// NewCmdView builds `weknora chunk view <chunk-id>`.
|
||||
// NewCmdView builds `academy chunk view <chunk-id>`.
|
||||
func NewCmdView(f *cmdutil.Factory) *cobra.Command {
|
||||
opts := &ViewOptions{}
|
||||
cmd := &cobra.Command{
|
||||
@@ -85,7 +85,7 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
|
||||
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
|
||||
UsedFor: "fetch one chunk's fields and content by id (scope-less; no --doc needed)",
|
||||
RequiredFlags: []string{"<chunk-id> (positional)"},
|
||||
Examples: []string{"weknora chunk view chunk_abc"},
|
||||
Examples: []string{"academy chunk view chunk_abc"},
|
||||
Output: "envelope.data is the chunk object (id, content, knowledge_id, ...)",
|
||||
})
|
||||
return cmd
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
type fakeViewSvc struct {
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"academy/cli/internal/cmdutil"
|
||||
)
|
||||
|
||||
// TestCompletion_AllShells smoke-tests cobra's auto-registered completion
|
||||
@@ -21,7 +21,7 @@ func TestCompletion_AllShells(t *testing.T) {
|
||||
}{
|
||||
{"bash", "bash completion", 1024},
|
||||
{"zsh", "#compdef", 1024},
|
||||
{"fish", "complete -c weknora", 1024},
|
||||
{"fish", "complete -c academy", 1024},
|
||||
{"powershell", "Register-ArgumentCompleter", 1024},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Package configcmd holds the `weknora config` command tree.
|
||||
// Package configcmd holds the `academy config` command tree.
|
||||
//
|
||||
// Currently a single read-only `view` subcommand that prints the resolved
|
||||
// CLI configuration and its resolution chain. No mutation, no network.
|
||||
@@ -11,10 +11,10 @@ package configcmd
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"academy/cli/internal/cmdutil"
|
||||
)
|
||||
|
||||
// NewCmd builds the `weknora config` parent command.
|
||||
// NewCmd builds the `academy config` parent command.
|
||||
func NewCmd(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "config",
|
||||
|
||||
+24
-24
@@ -8,13 +8,13 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/config"
|
||||
"github.com/Tencent/WeKnora/cli/internal/format"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/projectlink"
|
||||
"github.com/Tencent/WeKnora/cli/internal/secrets"
|
||||
"github.com/Tencent/WeKnora/cli/internal/xdg"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/config"
|
||||
"academy/cli/internal/format"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/projectlink"
|
||||
"academy/cli/internal/secrets"
|
||||
"academy/cli/internal/xdg"
|
||||
)
|
||||
|
||||
// viewFields enumerates the fields surfaced for `--format json` discovery on
|
||||
@@ -46,7 +46,7 @@ type viewData struct {
|
||||
ProjectLink string `json:"project_link"`
|
||||
}
|
||||
|
||||
// NewCmdView builds `weknora config view`. Read-only inspection of the
|
||||
// NewCmdView builds `academy config view`. Read-only inspection of the
|
||||
// resolved config and resolution chain. Never builds the SDK client and
|
||||
// never issues a network request: KB resolution uses ResolveKBLocal, secrets
|
||||
// storage is detected from the store type, and everything else is read from
|
||||
@@ -77,11 +77,11 @@ even when no profile or KB is configured (sources report "(none)" /
|
||||
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
|
||||
UsedFor: "inspect the resolved CLI config and resolution chain (active profile, host, kb, log level, default format, file paths) without mutating or hitting the network",
|
||||
Examples: []string{
|
||||
"weknora config view",
|
||||
"weknora config view --format json",
|
||||
"weknora config view --jq '.data.active_profile'",
|
||||
"academy config view",
|
||||
"academy config view --format json",
|
||||
"academy config view --jq '.data.active_profile'",
|
||||
},
|
||||
Output: "envelope.data is {active_profile, profile_source, auth_source, host, kb_id, kb_source, log_level, log_level_source, format_default, config_file, cache_dir, secrets, project_link}. auth_source reports whether the active credential is the profile+keyring or a stateless WEKNORA_TOKEN/WEKNORA_API_KEY env override.",
|
||||
Output: "envelope.data is {active_profile, profile_source, auth_source, host, kb_id, kb_source, log_level, log_level_source, format_default, config_file, cache_dir, secrets, project_link}. auth_source reports whether the active credential is the profile+keyring or a stateless ACADEMY_TOKEN/ACADEMY_API_KEY env override.",
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
@@ -129,14 +129,14 @@ func resolveView(cmd *cobra.Command, f *cmdutil.Factory) viewData {
|
||||
}
|
||||
}
|
||||
|
||||
// Auth source: stateless env credentials (WEKNORA_TOKEN/WEKNORA_API_KEY)
|
||||
// Auth source: stateless env credentials (ACADEMY_TOKEN/ACADEMY_API_KEY)
|
||||
// override the profile + keyring for the actual client, so report that —
|
||||
// otherwise host/profile above would silently describe a profile the env
|
||||
// credential bypassed. WEKNORA_HOST (when set) is the host that env cred
|
||||
// credential bypassed. ACADEMY_HOST (when set) is the host that env cred
|
||||
// authenticates against.
|
||||
if active, kind := cmdutil.EnvCredential(); active {
|
||||
d.AuthSource = kind + " env (stateless; bypasses profile + keyring)"
|
||||
if h := strings.TrimSpace(os.Getenv("WEKNORA_HOST")); h != "" {
|
||||
if h := strings.TrimSpace(os.Getenv("ACADEMY_HOST")); h != "" {
|
||||
d.Host = h
|
||||
}
|
||||
} else if d.ActiveProfile != "" {
|
||||
@@ -173,8 +173,8 @@ func resolveProfile(f *cmdutil.Factory) (name, source string) {
|
||||
if f.ProfileOverride != "" {
|
||||
return f.ProfileOverride, "--profile flag"
|
||||
}
|
||||
if v := os.Getenv("WEKNORA_PROFILE"); v != "" {
|
||||
return v, "WEKNORA_PROFILE env"
|
||||
if v := os.Getenv("ACADEMY_PROFILE"); v != "" {
|
||||
return v, "ACADEMY_PROFILE env"
|
||||
}
|
||||
if f.Config != nil {
|
||||
if cfg, err := f.Config(); err == nil && cfg != nil && cfg.CurrentProfile != "" {
|
||||
@@ -196,8 +196,8 @@ func resolveKB(cmd *cobra.Command, f *cmdutil.Factory) (id, source string) {
|
||||
if v, _ := cmd.Flags().GetString("kb"); v != "" {
|
||||
return id, "--kb flag"
|
||||
}
|
||||
if v := os.Getenv("WEKNORA_KB_ID"); v != "" {
|
||||
return id, "WEKNORA_KB_ID env"
|
||||
if v := os.Getenv("ACADEMY_KB_ID"); v != "" {
|
||||
return id, "ACADEMY_KB_ID env"
|
||||
}
|
||||
if cwd, werr := os.Getwd(); werr == nil {
|
||||
if path, found, derr := projectlink.Discover(cwd); derr == nil && found {
|
||||
@@ -216,14 +216,14 @@ func resolveLogLevel(cmd *cobra.Command) (level, source string) {
|
||||
return level, "--log-level flag"
|
||||
}
|
||||
}
|
||||
if v := os.Getenv("WEKNORA_LOG_LEVEL"); v != "" && cmdutil.IsValidLogLevel(v) {
|
||||
return level, "WEKNORA_LOG_LEVEL env"
|
||||
if v := os.Getenv("ACADEMY_LOG_LEVEL"); v != "" && cmdutil.IsValidLogLevel(v) {
|
||||
return level, "ACADEMY_LOG_LEVEL env"
|
||||
}
|
||||
return level, "default"
|
||||
}
|
||||
|
||||
// resolveFormatDefault reports the configured default output format: the
|
||||
// config.yaml defaults.format value, else WEKNORA_FORMAT, else the hard
|
||||
// config.yaml defaults.format value, else ACADEMY_FORMAT, else the hard
|
||||
// default. This is the *default* used when --format is unset — not the
|
||||
// per-invocation --format flag value.
|
||||
func resolveFormatDefault() string {
|
||||
@@ -231,7 +231,7 @@ func resolveFormatDefault() string {
|
||||
if err == nil && cfg != nil && cfg.Defaults.Format != "" {
|
||||
return cfg.Defaults.Format
|
||||
}
|
||||
if v := os.Getenv("WEKNORA_FORMAT"); v == "text" || v == "json" || v == "ndjson" {
|
||||
if v := os.Getenv("ACADEMY_FORMAT"); v == "text" || v == "json" || v == "ndjson" {
|
||||
return v
|
||||
}
|
||||
return string(cmdutil.DefaultFormatMode)
|
||||
@@ -261,7 +261,7 @@ func resolveSecrets(f *cmdutil.Factory) string {
|
||||
return "file"
|
||||
}
|
||||
|
||||
// resolveProjectLink reports the discovered .weknora/project.yaml path or
|
||||
// resolveProjectLink reports the discovered .academy/project.yaml path or
|
||||
// "(none)". Walks up from cwd like ResolveKBLocal does.
|
||||
func resolveProjectLink() string {
|
||||
cwd, err := os.Getwd()
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/config"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/config"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
type viewEnvelope struct {
|
||||
@@ -101,7 +101,7 @@ func networkFreeFactory(t *testing.T) *cmdutil.Factory {
|
||||
return f
|
||||
}
|
||||
|
||||
// TestConfigView_EnvCredentialSurfaced: when WEKNORA_API_KEY + WEKNORA_HOST are
|
||||
// TestConfigView_EnvCredentialSurfaced: when ACADEMY_API_KEY + ACADEMY_HOST are
|
||||
// set, config view reports the env override (auth_source + the env host), not
|
||||
// the bypassed config profile's host.
|
||||
func TestConfigView_EnvCredentialSurfaced(t *testing.T) {
|
||||
@@ -111,10 +111,10 @@ func TestConfigView_EnvCredentialSurfaced(t *testing.T) {
|
||||
Profiles: map[string]config.Profile{"prod": {Host: "https://configured.example.com"}},
|
||||
}
|
||||
require.NoError(t, config.Save(cfg))
|
||||
t.Setenv("WEKNORA_API_KEY", "sk-test")
|
||||
t.Setenv("WEKNORA_HOST", "https://env-override.example.com")
|
||||
t.Setenv("ACADEMY_API_KEY", "sk-test")
|
||||
t.Setenv("ACADEMY_HOST", "https://env-override.example.com")
|
||||
|
||||
env := runViewJSON(t, networkFreeFactory(t))
|
||||
assert.Contains(t, env.Data.AuthSource, "WEKNORA_API_KEY env")
|
||||
assert.Contains(t, env.Data.AuthSource, "ACADEMY_API_KEY env")
|
||||
assert.Equal(t, "https://env-override.example.com", env.Data.Host, "host must be the env override, not the profile host")
|
||||
}
|
||||
+15
-15
@@ -1,4 +1,4 @@
|
||||
// Package doc — create.go implements `weknora doc create --text "..."`.
|
||||
// Package doc — create.go implements `academy doc create --text "..."`.
|
||||
// Allows creating a knowledge entry directly from inline text content without
|
||||
// uploading a file or fetching a remote URL.
|
||||
package doc
|
||||
@@ -10,10 +10,10 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/output"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/output"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// docCreateFields enumerates the fields surfaced for `--format json` discovery
|
||||
@@ -43,7 +43,7 @@ type CreateService interface {
|
||||
) (*sdk.Knowledge, error)
|
||||
}
|
||||
|
||||
// NewCmdCreate builds `weknora doc create --text "..."`.
|
||||
// NewCmdCreate builds `academy doc create --text "..."`.
|
||||
func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
opts := &CreateOptions{}
|
||||
cmd := &cobra.Command{
|
||||
@@ -52,15 +52,15 @@ func NewCmdCreate(f *cmdutil.Factory) *cobra.Command {
|
||||
Long: `Create a new knowledge entry by passing Markdown content directly via --text.
|
||||
Useful for short snippets, agent-generated content, or structured notes that
|
||||
don't require a file upload or remote URL. KB resolution follows the standard
|
||||
4-level chain: --kb flag > WEKNORA_KB_ID env > .weknora/project.yaml > error.
|
||||
4-level chain: --kb flag > ACADEMY_KB_ID env > .academy/project.yaml > error.
|
||||
|
||||
--text <content> Document text in Markdown format (required).
|
||||
--title <title> Display title stored with the entry (matches doc update --title).
|
||||
--tag-id <id> Associate the new entry with a tag.
|
||||
--channel <name> Override the ingestion-channel tag (default "api").`,
|
||||
Example: ` weknora doc create --text "# Meeting Notes\n\nAction items: ..."
|
||||
weknora doc create --text "$(cat notes.md)" --title "Sprint Notes" --kb my-kb
|
||||
weknora doc create --text "API usage guide" --title "API Guide" --tag-id tag_abc`,
|
||||
Example: ` academy doc create --text "# Meeting Notes\n\nAction items: ..."
|
||||
academy doc create --text "$(cat notes.md)" --title "Sprint Notes" --kb my-kb
|
||||
academy doc create --text "API usage guide" --title "API Guide" --tag-id tag_abc`,
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(c *cobra.Command, _ []string) error {
|
||||
fopts, err := cmdutil.CheckFormatFlag(c)
|
||||
@@ -108,11 +108,11 @@ don't require a file upload or remote URL. KB resolution follows the standard
|
||||
cmdutil.AddFormatFlag(cmd, docCreateFields...)
|
||||
cmdutil.AddDryRunFlag(cmd, &opts.DryRun)
|
||||
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
|
||||
UsedFor: "Create a knowledge entry from inline Markdown text. KB resolved via --kb flag, WEKNORA_KB_ID env, or project link. Emits the created Knowledge object with its id.",
|
||||
RequiredFlags: []string{"--text", "--kb (or WEKNORA_KB_ID / project link)"},
|
||||
UsedFor: "Create a knowledge entry from inline Markdown text. KB resolved via --kb flag, ACADEMY_KB_ID env, or project link. Emits the created Knowledge object with its id.",
|
||||
RequiredFlags: []string{"--text", "--kb (or ACADEMY_KB_ID / project link)"},
|
||||
Examples: []string{
|
||||
`weknora doc create --kb kb_eng --text "# Runbook\n\nRestart steps: ..."`,
|
||||
`weknora doc create --kb kb_eng --text "$(cat notes.md)" --title "Sprint Notes"`,
|
||||
`academy doc create --kb kb_eng --text "# Runbook\n\nRestart steps: ..."`,
|
||||
`academy doc create --kb kb_eng --text "$(cat notes.md)" --title "Sprint Notes"`,
|
||||
},
|
||||
Output: "envelope.data is the created Knowledge object with id, knowledge_base_id, title, parse_status",
|
||||
})
|
||||
@@ -143,7 +143,7 @@ func runCreate(ctx context.Context, opts *CreateOptions, fopts *cmdutil.FormatOp
|
||||
// timeout or `search` into empty results.
|
||||
var meta *output.Meta
|
||||
if k.ParseStatus == "draft" {
|
||||
meta = &output.Meta{Hint: "document created in parse_status=draft (not yet indexed) — run `weknora doc reparse " + k.ID + "` to parse & make it searchable"}
|
||||
meta = &output.Meta{Hint: "document created in parse_status=draft (not yet indexed) — run `academy doc reparse " + k.ID + "` to parse & make it searchable"}
|
||||
}
|
||||
if fopts.WantsJSON() {
|
||||
return fopts.Emit(iostreams.IO.Out, k, meta)
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// fakeCreateSvc captures call arguments and returns canned responses.
|
||||
@@ -151,12 +151,12 @@ func TestCreate_EmptyText_RejectsBeforeSDK(t *testing.T) {
|
||||
assert.Nil(t, svc.got.req, "SDK must not be called when --text is empty")
|
||||
}
|
||||
|
||||
// TestCreate_AgentHelp_EmitsUsedFor verifies that when WEKNORA_AGENT_HELP=1
|
||||
// TestCreate_AgentHelp_EmitsUsedFor verifies that when ACADEMY_AGENT_HELP=1
|
||||
// the `doc create --help` path emits a JSON blob containing "used_for".
|
||||
// This is the representative test for 3.2; the mechanism is covered by
|
||||
// internal/cmdutil/agenthelp_test.go — we test the wiring here.
|
||||
func TestCreate_AgentHelp_EmitsUsedFor(t *testing.T) {
|
||||
t.Setenv("WEKNORA_AGENT_HELP", "1")
|
||||
t.Setenv("ACADEMY_AGENT_HELP", "1")
|
||||
_, _ = iostreams.SetForTest(t)
|
||||
|
||||
f := &cmdutil.Factory{}
|
||||
|
||||
+19
-19
@@ -6,11 +6,11 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
sdk "academy/client"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/prompt"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/prompt"
|
||||
)
|
||||
|
||||
// docDeleteFields enumerates the fields surfaced for `--format json` discovery
|
||||
@@ -42,7 +42,7 @@ type deleteResult struct {
|
||||
Deleted bool `json:"deleted"`
|
||||
}
|
||||
|
||||
// NewCmdDelete builds `weknora doc delete`. Single-id keeps the simpler
|
||||
// NewCmdDelete builds `academy doc delete`. Single-id keeps the simpler
|
||||
// code path (one confirm prompt, exit 0/1); multi-id uses keep-going
|
||||
// semantics (one -y confirms all, failures collected, exit 1 if any fail);
|
||||
// --all --kb=<id> atomically clears every document in a knowledge base.
|
||||
@@ -71,13 +71,13 @@ All-in-KB (--all --kb=<kb-id>):
|
||||
AI agents: This is a high-risk write. Without -y/--yes the CLI exits 10
|
||||
and writes input.confirmation_required to stderr. NEVER auto-pass -y
|
||||
without the user's explicit go-ahead.`,
|
||||
Example: ` weknora doc delete doc_abc # interactive confirm
|
||||
weknora doc delete doc_abc -y # no prompt
|
||||
weknora doc delete doc_abc -y --format json # bare {id, deleted:true} JSON
|
||||
weknora doc delete doc_a doc_b doc_c -y # delete 3, keep-going
|
||||
weknora doc delete doc_a doc_b --format json # multi-id JSON output
|
||||
weknora doc delete --all --kb=kb_x -y # clear all docs in kb_x
|
||||
weknora doc delete --all --kb=kb_x -y --format json # agent-friendly`,
|
||||
Example: ` academy doc delete doc_abc # interactive confirm
|
||||
academy doc delete doc_abc -y # no prompt
|
||||
academy doc delete doc_abc -y --format json # bare {id, deleted:true} JSON
|
||||
academy doc delete doc_a doc_b doc_c -y # delete 3, keep-going
|
||||
academy doc delete doc_a doc_b --format json # multi-id JSON output
|
||||
academy doc delete --all --kb=kb_x -y # clear all docs in kb_x
|
||||
academy doc delete --all --kb=kb_x -y --format json # agent-friendly`,
|
||||
Args: cobra.ArbitraryArgs,
|
||||
RunE: func(c *cobra.Command, args []string) error {
|
||||
fopts, err := cmdutil.CheckFormatFlag(c)
|
||||
@@ -94,7 +94,7 @@ without the user's explicit go-ahead.`,
|
||||
if opts.KB == "" {
|
||||
return cmdutil.NewError(cmdutil.CodeInputInvalidArgument, "--all requires --kb=<id>").
|
||||
WithHint("specify --kb=<uuid-or-name> to scope the delete-all operation").
|
||||
WithRetryArgv([]string{"weknora", "doc", "delete", "--all", "--kb=<kb-id>", "-y"})
|
||||
WithRetryArgv([]string{"academy", "doc", "delete", "--all", "--kb=<kb-id>", "-y"})
|
||||
}
|
||||
if len(args) > 0 {
|
||||
return cmdutil.NewFlagError(fmt.Errorf("--all is exclusive with positional doc ids"))
|
||||
@@ -137,7 +137,7 @@ without the user's explicit go-ahead.`,
|
||||
if len(args) == 1 {
|
||||
return runDelete(c.Context(), opts, fopts, cli, f.Prompter(), args[0])
|
||||
}
|
||||
batchRetry := append([]string{"weknora", "doc", "delete"}, args...)
|
||||
batchRetry := append([]string{"academy", "doc", "delete"}, args...)
|
||||
batchRetry = append(batchRetry, "-y")
|
||||
if err := cmdutil.ConfirmDestructiveBatch(f.Prompter(), opts.Yes, fopts.WantsJSON(), "delete", "document", len(args), "doc.delete", batchRetry); err != nil {
|
||||
return err
|
||||
@@ -168,9 +168,9 @@ without the user's explicit go-ahead.`,
|
||||
UsedFor: "permanently delete one or more documents from a knowledge base",
|
||||
RequiredFlags: []string{"<doc-id>... (positional) | --all --kb=<uuid-or-name>"},
|
||||
Examples: []string{
|
||||
"weknora doc delete doc_abc -y",
|
||||
"weknora doc delete doc_a doc_b doc_c -y",
|
||||
"weknora doc delete --all --kb=kb_x -y --format json",
|
||||
"academy doc delete doc_abc -y",
|
||||
"academy doc delete doc_a doc_b doc_c -y",
|
||||
"academy doc delete --all --kb=kb_x -y --format json",
|
||||
},
|
||||
Output: "envelope.data shape depends on the form: a single doc id -> {id, deleted:true}; multiple doc ids -> batch envelope (top-level status success|partial|error, ok=(failures==0), data per-item [{id, ok, error?}], meta.successes/failures — read data[].ok per id, ok:true overall does not survive a partial failure / exit 1); --all --kb -> {kb_id, deleted_count}.",
|
||||
Warnings: []string{
|
||||
@@ -183,7 +183,7 @@ without the user's explicit go-ahead.`,
|
||||
}
|
||||
|
||||
func runDelete(ctx context.Context, opts *DeleteOptions, fopts *cmdutil.FormatOptions, svc DeleteService, p prompt.Prompter, id string) error {
|
||||
if err := cmdutil.ConfirmDestructive(p, opts.Yes, fopts.WantsJSON(), "delete", "document", id, "doc.delete", []string{"weknora", "doc", "delete", id, "-y"}); err != nil {
|
||||
if err := cmdutil.ConfirmDestructive(p, opts.Yes, fopts.WantsJSON(), "delete", "document", id, "doc.delete", []string{"academy", "doc", "delete", id, "-y"}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ func runDelete(ctx context.Context, opts *DeleteOptions, fopts *cmdutil.FormatOp
|
||||
// CodeInputConfirmationRequired (exit 10) with risk metadata so agents can
|
||||
// surface the risk to the user before re-invoking with -y.
|
||||
func runDeleteAll(ctx context.Context, opts *DeleteOptions, fopts *cmdutil.FormatOptions, svc AllService, p prompt.Prompter) error {
|
||||
if err := cmdutil.ConfirmDestructive(p, opts.Yes, fopts.WantsJSON(), "delete", "all docs in KB", opts.KB, "doc.delete_all", []string{"weknora", "doc", "delete", "--all", "--kb=" + opts.KB, "-y"}); err != nil {
|
||||
if err := cmdutil.ConfirmDestructive(p, opts.Yes, fopts.WantsJSON(), "delete", "all docs in KB", opts.KB, "doc.delete_all", []string{"academy", "doc", "delete", "--all", "--kb=" + opts.KB, "-y"}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
sdk "academy/client"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/config"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/prompt"
|
||||
"github.com/Tencent/WeKnora/cli/internal/testutil"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/config"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/prompt"
|
||||
"academy/cli/internal/testutil"
|
||||
)
|
||||
|
||||
// fakeAllSvc implements AllService for --all mode tests.
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
// Package doc implements the `weknora doc` subtree (list / view / upload /
|
||||
// Package doc implements the `academy doc` subtree (list / view / upload /
|
||||
// fetch / create / download / delete / wait). Upload supports --recursive /
|
||||
// --glob for bulk ingestion from local files. Fetch ingests a remote URL.
|
||||
// Create adds a knowledge entry from inline text content.
|
||||
@@ -12,10 +12,10 @@ package doc
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"academy/cli/internal/cmdutil"
|
||||
)
|
||||
|
||||
// NewCmd builds the `weknora doc` parent command.
|
||||
// NewCmd builds the `academy doc` parent command.
|
||||
func NewCmd(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "doc",
|
||||
|
||||
+10
-10
@@ -10,8 +10,8 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
)
|
||||
|
||||
// downloadFields enumerates the fields surfaced for `--format json` discovery on
|
||||
@@ -38,7 +38,7 @@ type DownloadService interface {
|
||||
OpenKnowledgeFile(ctx context.Context, knowledgeID string) (string, io.ReadCloser, error)
|
||||
}
|
||||
|
||||
// NewCmdDownload builds `weknora doc download <id>`. Positional id, output
|
||||
// NewCmdDownload builds `academy doc download <id>`. Positional id, output
|
||||
// flag, `-` sentinel for stdout. Flags: `-O, --output <file>` for
|
||||
// destination, `--clobber` for overwrite control.
|
||||
func NewCmdDownload(f *cmdutil.Factory) *cobra.Command {
|
||||
@@ -58,11 +58,11 @@ With --format json, on success emits a JSON envelope whose data has
|
||||
path, bytes, and filename fields. When output is stdout (--output -),
|
||||
the JSON envelope is suppressed because the raw bytes already occupy
|
||||
stdout.`,
|
||||
Example: ` weknora doc download doc_abc # writes ./<server-name>
|
||||
weknora doc download doc_abc -O report.pdf
|
||||
weknora doc download doc_abc --output - # stream to stdout (binary safe)
|
||||
weknora doc download doc_abc -O report.pdf --clobber
|
||||
weknora doc download doc_abc -O report.pdf --format json # JSON envelope`,
|
||||
Example: ` academy doc download doc_abc # writes ./<server-name>
|
||||
academy doc download doc_abc -O report.pdf
|
||||
academy doc download doc_abc --output - # stream to stdout (binary safe)
|
||||
academy doc download doc_abc -O report.pdf --clobber
|
||||
academy doc download doc_abc -O report.pdf --format json # JSON envelope`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(c *cobra.Command, args []string) error {
|
||||
fopts, err := cmdutil.CheckFormatFlag(c)
|
||||
@@ -86,8 +86,8 @@ stdout.`,
|
||||
RequiredFlags: []string{"<doc-id> (positional)"},
|
||||
Output: "with --format json (file output): envelope.data has path, bytes, filename; suppressed with --output - (raw bytes to stdout)",
|
||||
Examples: []string{
|
||||
"weknora doc download doc_abc --output ./manual.pdf",
|
||||
"weknora doc download doc_abc --output - > manual.pdf",
|
||||
"academy doc download doc_abc --output ./manual.pdf",
|
||||
"academy doc download doc_abc --output - > manual.pdf",
|
||||
},
|
||||
})
|
||||
return cmd
|
||||
|
||||
@@ -13,8 +13,8 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
)
|
||||
|
||||
// fakeDownloadSvc scripts an OpenKnowledgeFile response. The fake returns
|
||||
|
||||
@@ -15,10 +15,10 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/prompt"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/prompt"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// docDryRunFactory builds a Factory whose Client closure panics if invoked —
|
||||
@@ -43,7 +43,7 @@ func docDryRunFactory(t *testing.T) *cmdutil.Factory {
|
||||
// registers the global persistent flags (mirrors addGlobalFlags in
|
||||
// cmd/root.go).
|
||||
func withRootHarnessDoc(sub *cobra.Command, args ...string) *cobra.Command {
|
||||
root := &cobra.Command{Use: "weknora"}
|
||||
root := &cobra.Command{Use: "academy"}
|
||||
pf := root.PersistentFlags()
|
||||
pf.BoolP("yes", "y", false, "")
|
||||
pf.String("format", "", "")
|
||||
|
||||
+13
-13
@@ -1,4 +1,4 @@
|
||||
// Package doc — fetch.go implements `weknora doc fetch <url>`.
|
||||
// Package doc — fetch.go implements `academy doc fetch <url>`.
|
||||
package doc
|
||||
|
||||
import (
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// docFetchFields enumerates the fields surfaced for `--format json` discovery
|
||||
@@ -45,7 +45,7 @@ type FetchService interface {
|
||||
) (*sdk.Knowledge, error)
|
||||
}
|
||||
|
||||
// NewCmdFetch builds `weknora doc fetch <url>`.
|
||||
// NewCmdFetch builds `academy doc fetch <url>`.
|
||||
func NewCmdFetch(f *cmdutil.Factory) *cobra.Command {
|
||||
opts := &FetchOptions{}
|
||||
cmd := &cobra.Command{
|
||||
@@ -53,7 +53,7 @@ func NewCmdFetch(f *cmdutil.Factory) *cobra.Command {
|
||||
Short: "Fetch a remote document into a knowledge base",
|
||||
Long: `Server fetches the document at the given URL and ingests it into the resolved
|
||||
knowledge base. KB resolution follows the standard 4-level chain:
|
||||
--kb flag > WEKNORA_KB_ID env > .weknora/project.yaml > error.
|
||||
--kb flag > ACADEMY_KB_ID env > .academy/project.yaml > error.
|
||||
|
||||
When the URL has a known file extension (.pdf, .docx, .md, .txt) the server
|
||||
automatically switches from web-page-crawl mode to file-download mode. Pass
|
||||
@@ -71,10 +71,10 @@ Server-side ingestion knobs:
|
||||
--enable-multimodel Toggle multimodal extraction (image-in-PDF → text).
|
||||
Unset ⇒ server default; pass true or false to override.
|
||||
--channel <name> Override the ingestion-channel tag (default "api").`,
|
||||
Example: ` weknora doc fetch https://example.com/whitepaper.pdf
|
||||
weknora doc fetch https://example.com/no-ext --file-type pdf --title "Whitepaper"
|
||||
weknora doc fetch https://example.com/article.html --name "Q3 Article" --tag-id tag_abc
|
||||
weknora doc fetch https://example.com/report.pdf --kb my-kb --enable-multimodel`,
|
||||
Example: ` academy doc fetch https://example.com/whitepaper.pdf
|
||||
academy doc fetch https://example.com/no-ext --file-type pdf --title "Whitepaper"
|
||||
academy doc fetch https://example.com/article.html --name "Q3 Article" --tag-id tag_abc
|
||||
academy doc fetch https://example.com/report.pdf --kb my-kb --enable-multimodel`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(c *cobra.Command, args []string) error {
|
||||
opts.URL = args[0]
|
||||
@@ -135,10 +135,10 @@ Server-side ingestion knobs:
|
||||
cmdutil.AddFormatFlag(cmd, docFetchFields...)
|
||||
cmdutil.AddDryRunFlag(cmd, &opts.DryRun)
|
||||
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
|
||||
UsedFor: "Ingest a remote URL into the resolved knowledge base. KB resolved via --kb flag, WEKNORA_KB_ID env, or project link. Emits the created Knowledge object with its id.",
|
||||
RequiredFlags: []string{"<url> (positional)", "--kb (or WEKNORA_KB_ID / project link)"},
|
||||
UsedFor: "Ingest a remote URL into the resolved knowledge base. KB resolved via --kb flag, ACADEMY_KB_ID env, or project link. Emits the created Knowledge object with its id.",
|
||||
RequiredFlags: []string{"<url> (positional)", "--kb (or ACADEMY_KB_ID / project link)"},
|
||||
Examples: []string{
|
||||
`weknora doc fetch https://example.com/whitepaper.pdf --kb kb_eng`,
|
||||
`academy doc fetch https://example.com/whitepaper.pdf --kb kb_eng`,
|
||||
},
|
||||
Output: "envelope.data is the created Knowledge object with id, knowledge_base_id, source, parse_status",
|
||||
})
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// fakeFetchSvc captures call arguments and returns canned responses.
|
||||
|
||||
+13
-13
@@ -9,11 +9,11 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/output"
|
||||
"github.com/Tencent/WeKnora/cli/internal/text"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/output"
|
||||
"academy/cli/internal/text"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// docListFields enumerates the fields surfaced for `--format json` discovery on
|
||||
@@ -58,7 +58,7 @@ type ListService interface {
|
||||
ListKnowledgeWithFilter(ctx context.Context, kbID string, page, pageSize int, filter sdk.KnowledgeListFilter) ([]sdk.Knowledge, int64, error)
|
||||
}
|
||||
|
||||
// NewCmdList builds `weknora doc list`.
|
||||
// NewCmdList builds `academy doc list`.
|
||||
func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
opts := &ListOptions{}
|
||||
cmd := &cobra.Command{
|
||||
@@ -66,15 +66,15 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
Short: "List documents in a knowledge base",
|
||||
Long: `Lists documents (uploaded files / web pages / inline text) in the
|
||||
resolved knowledge base. KB resolution follows the standard 4-level chain:
|
||||
--kb flag > WEKNORA_KB_ID env > .weknora/project.yaml > error. The --kb
|
||||
--kb flag > ACADEMY_KB_ID env > .academy/project.yaml > error. The --kb
|
||||
flag accepts either a KB UUID (passed through) or a name (resolved via list).
|
||||
|
||||
Default sort is updated_at desc so the most recent uploads surface first;
|
||||
backend storage order is not guaranteed and varies between deployments.`,
|
||||
Example: ` weknora doc list # uses project link / env
|
||||
weknora doc list --kb a32a63ff-fb36-4874-bcaa-30f48570a694 # explicit UUID
|
||||
weknora doc list --kb my-kb # resolved by name
|
||||
weknora doc list --all-pages --format json # walk every page`,
|
||||
Example: ` academy doc list # uses project link / env
|
||||
academy doc list --kb a32a63ff-fb36-4874-bcaa-30f48570a694 # explicit UUID
|
||||
academy doc list --kb my-kb # resolved by name
|
||||
academy doc list --all-pages --format json # walk every page`,
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(c *cobra.Command, _ []string) error {
|
||||
fopts, err := cmdutil.CheckFormatFlag(c)
|
||||
@@ -115,7 +115,7 @@ backend storage order is not guaranteed and varies between deployments.`,
|
||||
cmdutil.AddFormatFlag(cmd, docListFields...)
|
||||
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
|
||||
UsedFor: "List documents in the resolved knowledge base. Results come with meta.count; use --limit to cap, --all-pages to walk every server page, --status/--keyword to filter server-side.",
|
||||
Examples: []string{"weknora doc list --format json", "weknora doc list --all-pages --limit 200 --format json"},
|
||||
Examples: []string{"academy doc list --format json", "academy doc list --all-pages --limit 200 --format json"},
|
||||
Output: "envelope.data is an array of Knowledge objects with id, title, file_name, parse_status; meta.count is the returned count; meta.total_count is the server-side total before client-side --limit truncation; meta.has_more=true when --limit truncated",
|
||||
})
|
||||
return cmd
|
||||
@@ -209,7 +209,7 @@ func runList(ctx context.Context, opts *ListOptions, fopts *cmdutil.FormatOption
|
||||
}
|
||||
// Default sort: updated_at desc. Server return order is not guaranteed,
|
||||
// so client-side sort makes output deterministic regardless of backend
|
||||
// storage choices. Mirrors `weknora kb list`.
|
||||
// storage choices. Mirrors `academy kb list`.
|
||||
sort.Slice(items, func(i, j int) bool {
|
||||
return items[i].UpdatedAt.After(items[j].UpdatedAt)
|
||||
})
|
||||
|
||||
Loaded 100 of 3136 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user