Skip to content

CLI ​

CLI 的本质是把 WinNexo 能力变成 Unix Pipe 上的一个命令,可以接进任何工作流。

CLI 命令参考 ​

基于 winnexo --help 及各命令 --help 输出整理,涵盖所有命令和子命令。Agent 调用时务必加 --json 以获取结构化可解析的响应。

全局选项 ​

选项说明
-v, --version显示版本号
--jsonJSON 格式输出(适用于 AI 代理消费,直接透传 API 原始响应)
--verbose启用详细输出(含错误堆栈)
--server-domain <url>WinNexo API 端点 URL(覆盖配置文件)
--user-token <token>认证令牌(覆盖配置文件)
--tenant-id <id>租户 ID(覆盖配置文件,对应请求头 x-tenant-id)

命令总览 ​

共 19 个命令,按能力域分组。

系统与实例(2 个) ​

命令说明子命令数
health检查 API 连接和认证状态—
instance实例信息1

会话(3 个) ​

命令说明子命令数
chat与 AI 进行对话(流式/非流式、附件、多轮)—
chat-session管理聊天会话5
file文件管理(上传聊天附件)1

快捷技能(1 个) ​

命令说明子命令数
skill管理 AI 技能4

我的资源(3 个) ​

命令说明子命令数
personal-directory个人目录管理5
source管理数据源(含个人资源创建)13
output产出查询与保存2

企业知识库(1 个) ​

命令说明子命令数
knowledge-base管理知识库(含企业知识库分类管理与资源上传)17

定时任务(1 个) ​

命令说明子命令数
scheduled-task管理定时任务7

主对象数据(1 个) ​

命令说明子命令数
object主对象数据查询与收藏2

用户、Credit 与账单(2 个) ​

命令说明子命令数
user当前用户信息与积分3
billingCredit 消耗账单查询1

用户与权限管理(2 个) ​

命令说明子命令数
tenant-user租户用户管理(管理员)6
user-token用户 API Token 自助管理4

组织同步(1 个) ​

命令说明子命令数
org-sync组织架构同步4

配置与交互(2 个) ​

命令说明子命令数
config管理 CLI 配置3
repl进入交互式命令行—

命令详情 ​

health — 检查 API 连接和认证状态 ​

验证 API 端点是否可达以及认证凭证是否有效。成功时返回当前身份信息。

bash
winnexo health
winnexo --json health

响应字段:

字段类型说明
callerTypestring调用方类型:user / aliyun_main / aliyun_ram / service
authSourcestring认证来源:bearer / aliyun_gateway
tenantIdnumber生效租户 ID
userIdnumber | null平台用户 ID
digitalEmployeeNamestring | null当前生效的数字员工名

chat — 发送聊天消息 ​

启动与 WinNexo AI 的对话交互。消息正文作为位置参数传入,默认流式输出;支持附件与多轮续聊。

bash
winnexo chat <message> [选项] --json
选项缩写必需默认值说明
<message>是消息正文(位置参数)
--session-id <id>-s否会话 ID(不提供则创建新会话)
--digital-employee-name <name>-e否环境变量数字员工名称
--content-type <type>否Text消息类型:Text / Markdown
--file <fileIds>否附件文件 ID(逗号分隔多个)
--no-stream否默认流式禁用流式输出
--reuse-last-session否false复用该数字员工下最近一个会话
流式模式(默认) ​

实时输出 AI 回复的内容片段,适合交互场景。

bash
winnexo chat "你好"
winnexo chat "分析一下本月销售趋势" -e customer --json

JSON 模式响应:

json
{"content": "完整的AI回复内容", "sessionId": "sess-abc123"}

非 JSON 模式直接在终端实时输出内容。

非流式模式 ​

等待完整回复后一次性返回,适合程序化调用。响应兼容两种格式:

bash
winnexo chat "生成季度总结" --no-stream --json

格式一(OpenAI 兼容):

json
{
  "Code": "200",
  "choices": [{"message": {"content": "AI完整回复"}}],
  "session": {"id": "sess-abc123"}
}

格式二(旧版平台):

json
{
  "Code": "200",
  "messages": [{"role": "assistant", "content": "AI完整回复"}],
  "session": {"id": "sess-abc123"}
}
附件对话与多轮对话 ​
bash
# 1. 上传文件获取 fileId
winnexo file upload --file ./report.pdf --json
# → {"Code": "200", "fileRecordId": "file-001"}

# 2. 带附件聊天(多个附件用逗号分隔)
winnexo chat "帮我总结这份报告的要点" --file file-001 --json
winnexo chat "对比这两份数据" --file file-001,file-002 --json

# 3. 多轮对话:首轮自动建会话,后续传 sessionId 续聊
winnexo chat "帮我查一下最近的客户数据" --json
winnexo chat "再按区域分组看看" --session-id sess-abc123 --json

chat-session — 管理聊天会话 ​

对聊天会话进行增删改查操作。

子命令说明
list [options]列出聊天会话
get [options]获取会话详情
update [options]更新会话信息
delete [options]删除会话
stop [options]停止正在生成的消息
chat-session list ​

列出聊天会话,支持关键词与数字员工过滤、分页。

bash
winnexo chat-session list --json
winnexo chat-session list --page 2 --page-size 10 --json
winnexo chat-session list --keyword "需求" --json
winnexo chat-session list --digital-employee-name customer --json
选项缩写必需默认值说明
--page <num>-p否1页码
--page-size <num>否20每页数量
--keyword <text>-k否搜索关键词
--digital-employee-name <name>-e否按数字员工过滤

响应:

json
{
  "Code": "200",
  "total": 15,
  "page": 1,
  "pageSize": 20,
  "data": [
    {
      "id": "sess-001",
      "title": "销售分析对话",
      "operating_object_name": "customer",
      "is_expired": false,
      "updated_at": 1716220800
    }
  ]
}
chat-session get ​

获取会话详情与最近若干条消息。

bash
winnexo chat-session get --session-id abc123 --json
winnexo chat-session get -s abc123 --limit 5 --json
选项缩写必需默认值说明
--session-id <id>-s是会话 ID
--limit <num>-l否10返回最近消息数量(0~20)

响应:

json
{
  "Code": "200",
  "session": {"id": "sess-001", "title": "销售分析对话", "is_expired": false, "created_at": 1716220800},
  "messages": [
    {"role": "user", "content": "分析销售数据", "status": "completed"},
    {"role": "assistant", "content": "根据数据...", "status": "completed"}
  ]
}
chat-session update ​

更新会话标题或模型。

bash
winnexo chat-session update --session-id abc123 --title "新标题" --json
winnexo chat-session update --session-id abc123 --model model_max --json
winnexo chat-session update -s abc123 -t "新标题" -m model_flash --json
选项缩写必需说明
--session-id <id>-s是会话 ID
--title <title>-t否新标题
--model <model>-m否抽象模型名:model_flash / model_plus / model_max
chat-session delete ​

删除会话。

bash
winnexo chat-session delete --session-id abc123 --json
选项缩写必需说明
--session-id <id>-s是会话 ID

响应:

json
{"Code": "200", "hardDelete": true}
chat-session stop ​

停止正在生成的消息。

bash
winnexo chat-session stop --session-id abc123 --json
winnexo chat-session stop -s abc123 --reason "不需要了" --json
选项缩写必需说明
--session-id <id>-s是会话 ID
--reason <text>否停止原因

file — 文件管理 ​

管理聊天中使用的文件。file upload 用于聊天附件(通过 chat --file 引用),与 source create-* 系列创建个人资源是不同场景。

子命令说明
upload [options]上传文件用于聊天
file upload ​

上传本地文件,获取 fileRecordId 供 chat --file 引用。

bash
winnexo file upload --file ./report.pdf --json
winnexo file upload -f ./data.csv -o customer --json
选项缩写必需说明
--file <path>-f是本地文件路径
--operating-object-name <name>-o否数字员工名称(CLI 自动解析)

响应:

json
{"Code": "200", "fileRecordId": "file-001", "fileName": "report.pdf"}

fileRecordId 用于 chat --file 参数引用。file upload 仅用于聊天附件,不会创建个人资源;如需保存为个人资源,走 source get-upload-signature + source create-file 流程。


skill — 管理 AI 技能 ​

查询和执行 AI 技能。技能是预定义的 AI 能力,可接收参数、异步执行并返回结果。

子命令说明
list [options]列出可用技能
get [options]获取技能详情(含参数 schema)
run [options]提交技能执行任务
run-result [options]查询技能执行结果
skill list ​

列出可用技能,支持关键词、类型、标签、绑定状态过滤。

bash
winnexo skill list --json
winnexo skill list --keyword "报表" --json
winnexo skill list --filter-type CUSTOM --json
winnexo skill list --tags "报表,日报" --json
winnexo skill list --filter-type ALL_WITH_DRAFTS --json
winnexo skill list -o customer --bind-status BOUND --json
选项缩写必需默认值说明
--page <num>-p否1页码
--page-size <num>否20每页数量
--keyword <text>-k否关键词搜索(匹配名称或描述)
--filter-type <type>否ALL过滤类型:ALL / BUILTIN / CUSTOM / DRAFT / ALL_WITH_DRAFTS
--tags <tags>否按标签筛选,逗号分隔,任一命中即匹配
--operating-object-name <name>-o否数字员工名称(需与 --bind-status 同时传入)
--bind-status <status>否绑定状态:BOUND / UNBOUND

响应:

json
{
  "Code": "200",
  "total": 10,
  "items": [
    {
      "skillCode": "daily_report",
      "name": "日报技能",
      "description": "生成每日销售日报",
      "executeMode": "async",
      "status": "published",
      "sourceType": "CUSTOM",
      "tags": ["报表", "日报"],
      "globalAccess": true,
      "hasDraftChanges": false,
      "versionNumber": "1.0.0",
      "createdTime": "2026-01-01T00:00:00Z",
      "updatedTime": "2026-05-01T00:00:00Z"
    }
  ]
}
skill get ​

获取技能详情,含参数 schema。必须提供 --skill-code 或 --skill-name 之一。

bash
winnexo skill get --skill-code daily_report --json
winnexo skill get --skill-name "日报技能" --view-mode draft --json
选项缩写必需默认值说明
--skill-code <code>二选一技能编码(全局唯一,优先级高于 skillName)
--skill-name <name>二选一技能名称(未传 skillCode 时使用,租户内唯一)
--view-mode <mode>否published查看模式:published / draft
--include-skill-files否false包含完整文件树

响应:

json
{
  "Code": "200",
  "skillCode": "daily_report",
  "name": "日报技能",
  "description": "生成每日销售日报",
  "sourceType": "CUSTOM",
  "status": "published",
  "versionNumber": "1.0.0",
  "executeMode": "async",
  "arguments": [
    {"name": "date", "type": "string", "required": true, "default": null, "description": "日报日期,格式 YYYY-MM-DD"},
    {"name": "includeChart", "type": "boolean", "required": false, "default": true, "description": "是否包含图表"}
  ]
}

arguments[] 为技能参数定义,run 时需按此 schema 传入。

skill run ​

提交技能执行任务(异步)。必须提供 --skill-code 或 --skill-name 之一。

bash
winnexo skill run --skill-code daily_report --arguments '{"date": "2026-06-15", "includeChart": true}' --json
winnexo skill run --skill-name "日报技能" --arguments '{"date": "2026-06-15"}' --json
winnexo skill run --skill-code daily_report --arguments '{"date": "2026-06-15"}' --client-token "unique-request-id-001" --json
选项缩写必需说明
--skill-code <code>二选一技能编码
--skill-name <name>二选一技能名称
--arguments <json>是技能参数(JSON 格式,schema 由 skill get 定义)
--client-token <token>否幂等 Token(重复提交时防止重复执行)

响应:

json
{"Code": "200", "runId": "run-abc123", "skillCode": "daily_report", "status": "Running", "createdAt": "2026-06-15T10:00:00Z"}

技能为异步执行,提交后使用 run-result 轮询结果(建议间隔 3-5 秒)。

skill run-result ​

查询技能执行结果。状态流转:Running → Succeeded / Failed / Cancelled。

bash
winnexo skill run-result --run-id run-abc123 --json
winnexo skill run-result --run-id run-abc123 --include-logs --json
选项缩写必需说明
--run-id <id>是执行 ID(由 skill run 返回)
--include-logs否附带执行日志(排查问题时建议开启)

Running 状态响应:

json
{"Code": "200", "runId": "run-abc123", "status": "Running", "progress": 45, "progressMessage": "正在生成图表..."}

Succeeded 状态响应:

json
{"Code": "200", "runId": "run-abc123", "status": "Succeeded", "result": {"content": "日报内容..."}}

Failed 状态响应:

json
{"Code": "200", "runId": "run-abc123", "status": "Failed", "errorCode": "TIMEOUT", "errorMessage": "执行超时"}

加 --include-logs 时响应额外返回 logs[](含 level/time/message)。


scheduled-task — 管理定时任务 ​

管理定时任务的创建、更新、查询及执行记录追踪。

子命令说明
list [options]查询定时任务列表
understand [options]解析自然语言任务意图(创建前必须先调用)
create [options]创建定时任务
update [options]更新定时任务
execute [options]立即执行定时任务
execution-records按数字员工查询执行记录
execution-detail [options]获取单次执行详情

公共数据结构 · SegmentItem(富文本消息段) — --segments 和 --description 字段为 SegmentItem 数组:

字段类型说明
typestring必填。text / web_search / mention / skill
contentstring文本内容,type=text 时必填
enabledboolean功能开关,type=web_search 时可选
namestring对象或技能名称
objectIdstring对象 ID,type=mention 时有值
objectTypestring对象类型,type=mention 时有值
skillCodestring技能编码,type=skill 时有值

公共数据结构 · TriggerConfig(触发配置) — --trigger-config 字段:

字段类型说明
triggerModestring必填。manual(手动)/ scheduled(定时)
cronstringCron 表达式,定时模式必填,如 "00 09 * * *"

timezone 和 language 由服务端自动注入,无需传入。

公共数据结构 · TaskDetail(任务详情) — --task-detail 字段,由 understand 命令返回后原样回传:

字段类型说明
taskUnderstandstringLLM 润色后的任务理解描述
relatedSemanticsarray语义实体列表(entity/attributes)
relatedObjectsarray相关对象列表(name/objectId/objectType/mentionType)
relatedSkillsarray相关技能列表(name/displayName/skillCode/sourceIds)
scheduled-task list ​

查询定时任务列表。

bash
winnexo scheduled-task list --json
winnexo scheduled-task list -k "日报" --page 1 --page-size 20 --json
选项缩写必需默认值说明
--page <num>-p否1页码
--page-size <num>否20每页数量
--keyword <text>-k否任务名模糊搜索
--digital-employee-name <name>否按数字员工过滤(自动解析)

响应:

json
{
  "Code": "200",
  "items": [
    {"taskId": "task-001", "name": "每日日报", "triggerType": "cron", "executionCount": 10, "isOpen": true, "gmtCreate": "2026-05-01T10:00:00Z"}
  ],
  "total": 1,
  "page": 1,
  "pageSize": 20,
  "hasMore": false
}
scheduled-task understand ​

创建任务前必须先调用,获取 LLM 解析后的结构化任务信息。

bash
winnexo scheduled-task understand --user-input "每天早上9点发送销售日报" --json
选项缩写必需说明
--user-input <text>是自然语言任务描述
--digital-employee-name <name>否数字员工名称(自动解析)
--segments <json>否附加富文本段

响应字段:

字段类型说明
taskUnderstandstringLLM 润色后的任务理解描述
relatedSemanticsarray语义实体列表(entity/attributes)
relatedObjectsarray相关对象列表(name/objectId/objectType/mentionType)
relatedSkillsarray相关技能列表(skillCode/displayName/name/sourceIds)
json
{
  "Code": "200",
  "taskUnderstand": "每天早上9点发送销售日报",
  "relatedSemantics": [{"entity": "订单", "attributes": "订单号,金额"}],
  "relatedObjects": [{"name": "领克汽车", "objectId": "obj-001", "objectType": "company", "mentionType": "objects"}],
  "relatedSkills": [{"skillCode": "daily_report", "displayName": "日报技能", "name": "daily_report", "sourceIds": []}]
}

响应字段与 TaskDetail 字段一一对应,创建时直接提取原样回传。

scheduled-task create ​

创建定时任务。

bash
winnexo scheduled-task create \
  --name "每日销售日报" \
  --description '[{"type":"text","content":"每天9点发送销售日报"},{"type":"web_search","enabled":true}]' \
  --trigger-config '{"triggerMode":"scheduled","cron":"00 09 * * *"}' \
  --task-detail '{"taskUnderstand":"每天早上9点发送销售日报","relatedSemantics":[],"relatedObjects":[],"relatedSkills":[]}' \
  --json

# 手动触发 + 创建后关闭
winnexo scheduled-task create --name "手动任务" \
  --trigger-config '{"triggerMode":"manual"}' --no-is-open --json
选项缩写必需说明
--name <name>-n是任务名称(最多50字)
--digital-employee-name <name>否数字员工名称(自动解析)
--description <json>否任务描述,SegmentItem 数组(展示给用户)
--segments <json>否发送给 AI 的富文本消息段
--trigger-config <json>否TriggerConfig 对象
--task-detail <json>否TaskDetail 对象(来自 understand)
--no-is-open否创建后关闭任务(默认创建后自动开启)

响应:

json
{"Code": "200", "taskId": "task-new-001"}
scheduled-task update ​

更新定时任务。

bash
# 修改 cron
winnexo scheduled-task update --task-id task-001 \
  --trigger-config '{"triggerMode":"scheduled","cron":"00 10 * * *"}' --json

# 开启/关闭
winnexo scheduled-task update --task-id task-001 --is-open --json
winnexo scheduled-task update --task-id task-001 --no-is-open --json
选项必需说明
--task-id <id>是任务 ID
--name <name>否新任务名称
--description <json>否新任务描述
--segments <json>否新消息段
--trigger-config <json>否新触发配置
--task-detail <json>否新任务详情
--is-open否开启任务
--no-is-open否关闭任务
scheduled-task execute ​

手动触发一个已创建的定时任务,无需等待 Cron 调度。

bash
winnexo scheduled-task execute --task-id task-001 --json
选项必需说明
--task-id <id>是任务 ID

响应:

json
{
  "Code": "200",
  "executionId": "exec-manual-001",
  "taskExecution": {
    "taskId": "task-001",
    "executionId": "exec-manual-001",
    "taskUnderstand": "手动执行的任务理解",
    "operatingObjectName": "小助手",
    "skillCodes": ["daily_report"],
    "enableWebSearch": false,
    "tenantId": "tenant-001",
    "userId": "user-001",
    "taskName": "手动测试任务",
    "model": "model_plus"
  }
}

返回的 taskExecution 对象可透传给 Chat 链路作为执行元数据。

scheduled-task execution-records ​

按数字员工查询执行记录(不支持 --page-size 参数)。

bash
winnexo scheduled-task execution-records --json

响应:

json
{
  "Code": "200",
  "tasks": [
    {"taskId": "task-001", "name": "每日日报", "triggerType": "cron", "timeline": [{"status": "SUCCESS", "startedAt": "2026-06-15T09:00:00Z"}]}
  ]
}
scheduled-task execution-detail ​

获取单次执行详情。

bash
winnexo scheduled-task execution-detail --execution-id exec-001 --json
选项必需说明
--execution-id <id>是执行 ID

响应字段:

字段类型说明
executionIdstring执行 ID
taskIdstring任务 ID
statusstring执行状态(如 SUCCESS)
triggerTypestring触发类型(cron / manual)
digitalEmployeeNamestring数字员工名
startedAtstring开始时间
completedAtstring完成时间
errorMessagestring | null错误信息

object — 主对象数据查询与收藏 ​

查询主对象数据并管理收藏状态。

子命令说明
query [options]查询主对象数据
toggle-favorite [options]批量切换收藏状态
object query ​

查询主对象数据。

bash
winnexo object query --json
winnexo object query --keyword "张三" --json
winnexo object query --only-favorites --json
winnexo object query --keyword "领克" --page 1 --page-size 50 --json
选项缩写必需默认值说明
--operating-object-name <name>-o否环境变量数字员工名称(业务必填)
--page <num>-p否1页码
--page-size <num>否20每页数量
--keyword <text>-k否关键词搜索
--only-favorites否仅返回已收藏数据

响应:

json
{
  "Code": "200",
  "total": 100,
  "items": [
    {"id": "obj-001", "object_id": "1513075685394636800", "name": "张三", "company": "示例企业"}
  ]
}

items 中的字段结构取决于具体主对象类型,内容动态。

object toggle-favorite ​

批量切换收藏状态。

bash
# 批量收藏
winnexo object toggle-favorite \
  --object-type customer \
  --object-ids 1513075685394636800,1513075687542120448 \
  --action add --json

# 取消收藏
winnexo object toggle-favorite \
  --object-type customer \
  --object-ids 1513075685394636800 \
  --action remove --json
选项必需说明
--object-type <type>是对象类型(必须小写,如 customer)
--object-ids <ids>是对象 ID 列表(逗号分隔,最多 200 个)
--action <action>是add(收藏)或 remove(取消收藏)
--operating-object-name <name>否CLI 自动解析,无需手动传入

响应:

json
{
  "Code": "200",
  "results": [
    {"objectId": "1513075685394636800", "isFavorited": true, "success": true, "message": null}
  ],
  "favoriteCount": 5
}

output — 产出查询与保存 ​

产出(Output)是数字员工在聊天会话中生成的结构化内容(PPT、文档、图片、幻灯片等)。

子命令说明
list [options]查询产出列表
save [options]将产出明细批量保存为个人资源
output list ​

查询当前用户的产出列表,支持关键词/类型/数字员工过滤和分页。

bash
winnexo output list --json
winnexo output list --keyword "季度报告" --json
winnexo output list --item-type ppt --json
winnexo output list --shared-only --json
winnexo output list --keyword "报告" --item-type document --page 2 --page-size 10 --json
选项缩写必需默认值说明
--page <num>-p否1页码
--page-size <num>否20每页数量
--keyword <text>-k否关键词搜索(匹配产出标题或明细名称)
--operating-object-name <name>-o否按数字员工名称过滤(CLI 自动解析)
--item-type <type>否产出明细类型过滤
--shared-only否仅展示已开启分享的产出

--item-type 可选值:ppt / html / document / picture / slides / video / audio / email / others。

响应:

json
{
  "Code": "200",
  "Message": "success",
  "items": [
    {
      "outputId": "out-001",
      "outputType": "conversation",
      "outputTypeDisplayName": "对话产出",
      "operatingObjectName": "customer",
      "name": "Q4 销售分析报告",
      "outputItems": [
        {"itemId": "item-001", "itemType": "ppt", "name": "销售分析.pptx", "gmtCreate": "2026-05-20T10:00:00Z", "gmtModified": "2026-05-20T10:00:00Z"}
      ],
      "gmtCreate": "2026-05-20T10:00:00Z",
      "gmtModified": "2026-05-20T10:00:00Z"
    }
  ],
  "total": 1,
  "page": 1,
  "pageSize": 20
}

items[].outputItems[].itemId 为产出明细 ID,用于 output save 的 --item-ids。

output save ​

将产出明细批量保存为当前用户的个人资源。

bash
winnexo output save --item-ids item-001 --mode link --json
winnexo output save --item-ids item-001,item-002,item-003 --mode copy --json
winnexo output save --item-ids item-001 --mode link --directory-id dir-123 --json
选项必需说明
--item-ids <ids>是产出明细 ID 列表,逗号分隔,单批最多 50 条
--mode <mode>是保存方式:link(链接,幂等)/ copy(复制快照)
--directory-id <id>否目标个人目录 ID;不传使用默认目录
  • link — 创建指向原始产出的链接,幂等操作,资源随原始产出更新
  • copy — 创建产出内容的独立快照,不随原始产出变化

响应:

json
{
  "Code": "200",
  "Message": "success",
  "results": [
    {"itemId": "item-001", "success": true, "sourceId": "resource-abc"},
    {"itemId": "item-002", "success": false, "errorCode": "NOT_FOUND", "errorMessage": "产出明细不存在"}
  ]
}

参数校验规则:

校验退出码错误信息
--mode 不是 link 或 copy2--mode 必须是 link 或 copy
--item-ids 过滤后为空2--item-ids 不能为空
--item-ids 超过 50 条2--item-ids 单批最多 50 条

personal-directory — 个人目录管理 ​

个人目录(Personal Directory)是数字员工下的文件组织结构,支持创建文件夹分类管理个人资源。

子命令说明
create [options]在个人资源下创建目录(文件夹)
list [options]下钻查询个人目录内容(子目录与资源列表)
update [options]更新个人目录基础信息
move-resource [options]在个人目录间移动资源
retry-failed [options]重试目录下所有失败数据源
personal-directory create ​

在个人资源下创建目录。

bash
winnexo personal-directory create --name "项目资料" --json
winnexo personal-directory create --name "周报" --parent-directory-id dir_abc123 --json
winnexo personal-directory create --name "客户资料" --description "存放所有客户相关的文档和报告" --json
选项缩写必需说明
--operating-object-name <name>-o自动数字员工名称(CLI 自动解析,无需手动传入)
--name <name>-n是目录名称
--parent-directory-id <id>否父目录 ID;不传则创建在默认根目录下
--description <text>否目录描述

响应:

json
{
  "Code": "200",
  "directoryId": "dir_9334a4f03093",
  "name": "项目资料",
  "path": "/",
  "description": null,
  "parentDirectoryId": null,
  "operatingObjectName": "customer",
  "directoryKind": "normal",
  "gmtCreate": 1779354812,
  "gmtModified": 1779354812
}

directoryKind 取值:normal(普通目录)、aliding_kb_root(阿里钉知识库根目录)。

personal-directory list ​

下钻查询个人目录内容。

bash
winnexo personal-directory list --directory-id root --json
winnexo personal-directory list --directory-id dir_abc123 --json
winnexo personal-directory list --directory-id root --source-types '["FILE","VOICE_MEETING"]' --json
winnexo personal-directory list --directory-id root --page 2 --page-size 10 --sort-field gmtCreate --sort-order desc --json
选项缩写必需默认值说明
--operating-object-name <name>-o自动数字员工名称(CLI 自动解析)
--directory-id <id>-d是目录 ID;传 "root" 返回根目录内容
--page <num>-p否1页码
--page-size <num>否20每页数量
--sort-field <field>否name排序字段(name/gmtCreate/gmtModified)
--sort-order <order>否asc排序方向(asc/desc)
--source-types <json>否资源类型过滤,JSON 数组字符串

--source-types 可选值:FILE / OUTPUT / VOICE_MEETING / ONLINE_DOC / ALI_DING。

响应:

json
{
  "Code": "200",
  "items": [
    {"itemType": "directory", "itemId": "dir_2caa0a60bb69", "name": "文件夹", "sourceType": null, "sourceStatus": null, "directoryKind": "normal"},
    {"itemType": "resource", "itemId": "219801", "name": "report.pdf", "sourceType": "FILE", "sourceStatus": "READY", "directoryKind": ""}
  ],
  "total": 19,
  "page": 1,
  "pageSize": 20
}

items[].itemType 为 directory(子目录)或 resource(资源);子目录的 itemId 即其 directoryId,可直接作为 --directory-id 继续下钻。

personal-directory update ​

更新个人目录基础信息。

bash
winnexo personal-directory update --directory-id dir_abc123 --name "新名称" --json
winnexo personal-directory update --directory-id dir_abc123 --description "新的描述信息" --json
选项缩写必需说明
--directory-id <id>-d是目录唯一标识
--name <name>-n否新目录名称
--description <text>否新目录描述
--parent-id <id>否新父目录主键 ID
--path <path>否新目录路径(会级联更新子目录)

响应:

json
{"Code": "200", "success": true, "directoryId": "dir_abc123"}
personal-directory move-resource ​

在个人目录间移动资源。

bash
winnexo personal-directory move-resource \
  --source-directory-id dir_abc \
  --target-directory-id dir_xyz \
  --source-id src-001 --json
选项缩写必需说明
--source-directory-id <id>是源目录 ID(资源当前所在目录)
--target-directory-id <id>是目标目录 ID(资源移动到的目录)
--source-id <id>-s是待移动的资源 ID

响应:

json
{"Code": "200", "success": true, "sourceId": "src-001", "sourceDirectoryId": "dir_abc", "targetDirectoryId": "dir_xyz"}
personal-directory retry-failed ​

重试目录下所有失败数据源(递归包含子目录)。

bash
winnexo personal-directory retry-failed --directory-id dir_abc123 --json
选项缩写必需说明
--directory-id <id>-d是目录 ID(递归包含子目录下的失败资源)

响应:

json
{
  "Code": "200",
  "directoryId": "dir_abc123",
  "failedCount": 5,
  "enqueuedCount": 4,
  "skippedCount": 1,
  "enqueuedIds": ["src-001", "src-002", "src-003", "src-004"],
  "failedSources": [
    {"sourceId": "src-001", "name": "报告.pdf", "sourceType": "FILE"}
  ]
}

source — 管理数据源(含个人资源创建) ​

获取资源详情、上传各类个人资源(文本/文件/在线文档/会议)、重命名、绑定对象与预览。

子命令说明
get [options]获取资源详情
get-upload-signature [options]获取 OSS 直传签名
create-text [options]上传纯文本资源
create-file [options]上传文件资源
create-aliding-doc [options]上传阿里钉在线文档
create-aliding-kb [options]创建阿里钉整体知识库
create-aliding-meeting [options]上传阿里钉会议
create-dingtalk-meeting [options]上传钉钉会议
create-feishu-minute [options]上传飞书妙记
create-voice-meeting [options]上传离线会议
rename [options]重命名数据源
replace-bindings [options]全量替换数据源对象绑定
preview [options]预览个人知识库知识内容
source get ​

获取资源详情。

bash
winnexo source get --source-id src-001 --json
winnexo source get --source-id src-001 --include-details --json
选项必需说明
--source-id <id>是资源 ID
--include-details否包含详细配置(settings/notes/structuredTables/unstructuredDocs)

响应:

json
{
  "Code": "200",
  "sourceId": "src-001",
  "name": "客户报告",
  "sourceType": "FILE",
  "sourceKind": "normal",
  "status": "READY",
  "scope": "PERSONAL",
  "operatingObjectName": "customer",
  "gmtCreate": "2026-05-20T10:00:00Z"
}
source get-upload-signature ​

获取预签名 URL,客户端可直接 PUT 上传文件到 OSS。

bash
winnexo source get-upload-signature --filename report.pdf --json
选项必需说明
--filename <name>是文件名(含后缀,如 report.pdf)
--operating-object-name <name>否数字员工名称
--expires <seconds>否签名过期时间(秒),范围 60-86400,默认 3600
--content-type <type>否文件 Content-Type(不传自动推断)
--scope <scope>否资源归属:source(个人)/ knowledge(企业知识库)

响应:

json
{
  "Code": "200",
  "uploadSignatureUrl": "https://oss-bucket.aliyuncs.com/path?Signature=...",
  "method": "PUT",
  "objectName": "uploads/2026/06/file.pdf",
  "fileUrl": "https://oss-bucket.aliyuncs.com/uploads/2026/06/file.pdf",
  "filePublicUrl": "https://oss-bucket.aliyuncs.com/uploads/2026/06/file.pdf?sign=...",
  "fileRecordId": "record-001",
  "expiresIn": 3600,
  "contentType": "application/pdf"
}

上传流程:get-upload-signature 获取签名 → 用返回的 uploadSignatureUrl PUT 上传 → 用 fileUrl/filePath 调 source create-file 创建资源。

source create-text ​

上传纯文本资源。

bash
winnexo source create-text -o customer -n "会议纪要" --text-content "今日讨论了Q3规划..." --json
选项缩写必需说明
--operating-object-name <name>-o是数字员工名称
--name <name>-n是资源显示名称
--text-content <text>是纯文本正文
--directory-id <id>否目标个人目录 ID
--description <text>否资源描述
source create-file ​

上传文件资源。

bash
winnexo source create-file -o customer -n "报告" \
  --file-path "uploads/2026/06/file.pdf" --file-record-id record-001 --json
选项缩写必需说明
--operating-object-name <name>-o是数字员工名称
--name <name>-n是资源显示名称
--file-path <path>是文件 OSS 持久化地址
--file-public-url <url>否文件公开访问 URL(带签名)
--file-name <name>否原始文件名(含后缀)
--file-ext <ext>否文件后缀名(如 pdf、docx)
--file-record-id <id>否文件记录 ID
--directory-id <id>否目标个人目录 ID
--description <text>否资源描述
source create-aliding-doc ​

上传阿里钉在线文档。

bash
winnexo source create-aliding-doc -o customer -n "产品设计文档" \
  --file-public-url "https://alidocs.dingtalk.com/i/nodes/xxx" --json
选项缩写必需说明
--operating-object-name <name>-o是数字员工名称
--name <name>-n是资源显示名称(建议传钉钉文档标题)
--file-public-url <url>是阿里钉在线文档可公开访问 URL
--directory-id <id>否目标个人目录 ID
--description <text>否资源描述
source create-aliding-kb ​

创建阿里钉整体知识库。

bash
winnexo source create-aliding-kb -o customer \
  --kb-url "https://alidocs.dingtalk.com/i/nodes/xxx" --sync-enabled --sync-cron "0 0 * * *" --json
选项缩写必需说明
--operating-object-name <name>-o是数字员工名称
--kb-url <url>是阿里钉知识库的可公开访问 URL
--kb-name <name>否知识库显示名称;不传时由后台回填
--directory-id <id>否目标个人目录 ID
--object-bindings <json>否对象绑定列表 JSON 数组
--sync-enabled否启用定时同步
--sync-cron <cron>否cron 表达式(--sync-enabled 时必填)

创建后返回 status=RUNNING,后台异步同步知识库目录树;可通过 personal-directory list 轮询状态。

source create-aliding-meeting ​

上传阿里钉会议。

bash
winnexo source create-aliding-meeting -o customer -n "周会记录" \
  --oss-url "https://oss.example.com/audio.mp3" --shanji-url "https://shanji.example.com/xxx" --json
选项缩写必需说明
--operating-object-name <name>-o是数字员工名称
--name <name>-n是资源显示名称
--oss-url <url>是公开的音视频 OSS 地址
--shanji-url <url>是原始的闪记链接
--directory-id <id>否目标个人目录 ID
--description <text>否资源描述
--notes <text>否会议笔记内容(可选),会参与辅助分析
source create-dingtalk-meeting ​

上传钉钉会议。

bash
winnexo source create-dingtalk-meeting -o customer -n "钉钉周会" --room-code 123456789 --json
选项缩写必需说明
--operating-object-name <name>-o是数字员工名称
--name <name>-n是资源显示名称
--room-code <code>是钉钉会议号
--credential-id <id>否凭证 ID(不传用系统默认)
--directory-id <id>否目标个人目录 ID
--description <text>否资源描述
--notes <text>否会议笔记内容(可选),会参与辅助分析
source create-feishu-minute ​

上传飞书妙记。

bash
winnexo source create-feishu-minute -o customer -n "飞书妙记" \
  --minute-token abc123token --credential-id cred-001 --json
选项缩写必需说明
--operating-object-name <name>-o是数字员工名称
--name <name>-n是资源显示名称
--minute-token <token>是飞书妙记 token(唯一标识符)
--credential-id <id>是凭证 ID
--directory-id <id>否目标个人目录 ID
--description <text>否资源描述
source create-voice-meeting ​

上传离线会议。

bash
winnexo source create-voice-meeting -o customer -n "离线录音" \
  --file-url "https://oss.example.com/meeting.mp3" --json
选项缩写必需说明
--operating-object-name <name>-o是数字员工名称
--name <name>-n是资源显示名称
--file-url <url>是离线会议音频文件 URL
--directory-id <id>否目标个人目录 ID
--description <text>否资源描述
source rename ​

重命名数据源。

bash
winnexo source rename --source-id src-001 --new-name "新名称" --json
选项缩写必需说明
--source-id <id>-s是数据源 ID
--new-name <name>-n是新的数据源名称

响应:

json
{"Code": "200", "sourceId": "src-001", "name": "新名称", "status": "READY", "gmtModified": "2026-06-15T10:00:00Z"}
source replace-bindings ​

全量替换数据源对象绑定。

bash
# 替换绑定
winnexo source replace-bindings --source-id src-001 \
  --object-bindings '[{"objectType":"customer","objectId":"c1"}]' --json

# 清空所有绑定
winnexo source replace-bindings --source-id src-001 --object-bindings '[]' --json
选项缩写必需说明
--source-id <id>-s是数据源 ID
--object-bindings <json>是JSON 数组,每项含 objectType/objectId;传 [] 清空绑定
source preview ​

预览个人知识库中的知识内容,仅允许预览本人资源。

bash
winnexo source preview --source-id src-001 --json
选项必需说明
--source-id <id>是知识 ID(数据源唯一标识)

响应:

json
{
  "Code": "200",
  "previewType": "OSS_IMM",
  "previewUrl": "https://example.com/preview/doc.pdf",
  "content": null,
  "fileName": "报告.pdf",
  "fileExt": "pdf",
  "publicUrl": "https://oss-bucket.aliyuncs.com/uploads/report.pdf?sign=..."
}

关键字段:previewType(OSS_IMM / IMAGE / AUDIO / VIDEO / HTML / DING_TALK / VOICE_MEETING / CONTENT)、previewUrl(非 CONTENT 类型的预览链接)、content(CONTENT 类型的文本内容)、publicUrl(文件公开访问 URL)。

所有 create-* 资源创建命令均为异步,初始状态多为 PENDING,后台处理后转 READY 或 FAILED,可通过 source get --source-id <id> 轮询状态。


knowledge-base — 管理知识库 ​

管理企业知识库的查询、分类管理与资源上传。

子命令说明
list [options]后台查询企业知识库(管理员视图,无权限过滤)
visible-list [options]查询数字员工可见知识库列表(USE 权限过滤)
visible-contents [options]下钻查询可见知识库内容
submit-source [options]提交个人资源到企业知识库
create-aliding [options]创建阿里钉整体知识库到个人资源
move-resource [options]在企业知识库目录间移动资源
rename-source [options]重命名企业知识库数据源
retry-failed [options]重试目录下所有失败数据源
update-source-tags [options]更新数据源标签
create-directory [options]创建企业知识库分类
update-directory [options]修改企业知识库分类
list-directories [options]获取企业知识库分类列表
get-source [options]获取企业知识库知识详情
preview-source [options]预览企业知识库知识内容
create-text [options]上传纯文本到企业知识库
create-file [options]上传文件到企业知识库
create-aliding-doc [options]上传阿里钉在线文档到企业知识库
knowledge-base list ​

后台查询企业知识库,管理员视图,无权限过滤,可下钻目录。

bash
winnexo knowledge-base list --json
winnexo knowledge-base list --keyword "产品" --json
winnexo knowledge-base list --directory-id kb-dir-001 --json
winnexo knowledge-base list --directory-id kb-dir-001 --source-types '["FILE"]' --json
选项缩写必需默认值说明
--directory-id <id>-d否目录 ID;空或 root 返回 KB 列表,非空时下钻
--page <num>-p否1页码
--page-size <num>否20每页数量
--sort-field <field>否name排序字段:name/gmtCreate/gmtModified
--sort-order <order>否asc排序方向:asc/desc
--keyword <text>-k否搜索关键词(仅 KB 列表时生效)
--source-types <json>否资源类型过滤,JSON 数组,如 '["FILE","VOICE_MEETING"]'

响应:

json
{
  "Code": "200",
  "total": 5,
  "items": [
    {"itemType": "directory", "itemId": "kb-dir-001", "name": "产品知识库", "sourceType": null, "sourceStatus": null, "creatorName": "管理员", "gmtCreate": "2026-01-01T00:00:00Z"},
    {"itemType": "resource", "itemId": "src-001", "name": "产品手册.pdf", "sourceType": "FILE", "sourceStatus": "READY", "creatorName": "张三", "gmtCreate": "2026-05-20T10:00:00Z"}
  ]
}
knowledge-base visible-list ​

按 USE 权限过滤,返回数字员工能访问的知识库列表。

bash
winnexo knowledge-base visible-list -o customer --json
选项缩写必需说明
--operating-object-name <name>-o是数字员工名称

响应:

json
{
  "Code": "200",
  "total": 3,
  "items": [
    {"directoryId": "kb-001", "name": "客户知识库", "creatorName": "管理员", "sourceReadyCount": 25, "sourceTotalCount": 30, "gmtCreate": "2026-01-01T00:00:00Z"}
  ]
}

directoryId 用于 visible-contents 下钻;sourceReadyCount/sourceTotalCount 为已就绪/总资源数。

knowledge-base visible-contents ​

下钻查询可见知识库内容。

bash
winnexo knowledge-base visible-contents -o customer -d kb-001 --json
winnexo knowledge-base visible-contents -o customer -d kb-001 --source-types '["FILE","ONLINE_DOC"]' --page 2 --page-size 50 --json
选项缩写必需默认值说明
--operating-object-name <name>-o是数字员工名称
--directory-id <id>-d是知识库目录 ID
--page <num>-p否1页码
--page-size <num>否20每页数量
--sort-field <field>否name排序字段
--sort-order <order>否asc排序方向
--source-types <json>否资源类型过滤

响应(结构同 list):

json
{
  "Code": "200",
  "total": 25,
  "items": [
    {"itemType": "directory", "itemId": "sub-dir-001", "name": "子目录", "sourceType": null, "sourceStatus": null},
    {"itemType": "resource", "itemId": "src-002", "name": "FAQ文档.pdf", "sourceType": "FILE", "sourceStatus": "READY"}
  ]
}
knowledge-base submit-source ​

将个人资源(sourceId)提交到企业知识库目录。

bash
winnexo knowledge-base submit-source --source-id src-001 --target-directory-id kb-dir-002 --json
选项缩写必需说明
--source-id <id>-s是个人资源 ID
--target-directory-id <id>-t是目标企业知识库目录 ID

响应:

json
{"Code": "200", "sourceId": "src-001", "scope": "KNOWLEDGE", "targetDirectoryId": "kb-dir-002"}
knowledge-base create-aliding ​

从阿里钉知识库 URL 创建整体知识库到个人资源,后台异步同步内容。

bash
winnexo knowledge-base create-aliding -o customer --kb-url "https://alidocs.dingtalk.com/i/nodes/xxx" --json
winnexo knowledge-base create-aliding -o customer \
  --kb-url "https://alidocs.dingtalk.com/i/nodes/xxx" --kb-name "产品文档库" \
  --sync-config '{"enabled":true,"cron":"0 0 * * *"}' --json
选项缩写必需说明
--operating-object-name <name>-o是数字员工名称
--kb-url <url>是阿里钉知识库可公开访问 URL
--kb-name <name>否显示名称(不传由后台从远程拉取)
--directory-id <id>否目标个人目录 ID
--object-bindings <json>否JSON 数组,对象绑定列表,如 [{"objectType":"CUSTOMER","objectId":"c1"}]
--sync-config <json>否JSON 对象,定时同步配置,如 {"enabled":true,"cron":"0 0 * * *"}

响应:

json
{
  "Code": "200",
  "directoryId": "dir-aliding-001",
  "name": "产品文档库",
  "status": "RUNNING",
  "kbUrl": "https://alidocs.dingtalk.com/i/nodes/xxx",
  "operatingObjectName": "customer",
  "gmtCreate": "2026-06-15T10:00:00Z"
}

初始状态为 RUNNING,后台同步完成后转 READY 或 FAILED。可通过 personal-directory list 轮询状态。

knowledge-base move-resource ​

在企业知识库目录间移动资源。

bash
winnexo knowledge-base move-resource \
  --source-directory-id kb-dir-001 --target-directory-id kb-dir-002 \
  --source-id src-001 --knowledge-id kb-001 --json
选项缩写必需说明
--source-directory-id <id>是源目录 ID
--target-directory-id <id>是目标目录 ID
--source-id <id>-s是待移动的资源 ID
--knowledge-id <id>-k是目标知识库 ID
knowledge-base rename-source ​

重命名企业知识库数据源。

bash
winnexo knowledge-base rename-source --source-id src-001 --new-name "新名称" --json
选项缩写必需说明
--source-id <id>-s是数据源 ID
--new-name <name>-n是新名称

响应:

json
{"Code": "200", "sourceId": "src-001", "name": "新名称", "status": "READY", "gmtModified": "2026-06-15T10:00:00Z"}
knowledge-base retry-failed ​

重试目录下所有失败数据源(递归含子目录)。

bash
winnexo knowledge-base retry-failed --directory-id kb-dir-001 --json
选项缩写必需说明
--directory-id <id>-d是企业知识库目录 ID(递归含子目录)

响应:

json
{"Code": "200", "directoryId": "kb-dir-001", "failedCount": 3, "enqueuedCount": 2, "skippedCount": 1}
knowledge-base update-source-tags ​

更新数据源标签。

bash
winnexo knowledge-base update-source-tags --source-id src-001 --source-tags '["FAQ","重要"]' --json
选项缩写必需说明
--source-id <id>-s是数据源 ID
--source-tags <json>否JSON 字符串列表,如 '["tagA","tagB"]';传空清空标签
knowledge-base create-directory ​

创建企业知识库分类。

bash
winnexo knowledge-base create-directory --name "产品文档" --json
选项缩写必需说明
--name <name>-n是分类名称
--parent-directory-id <id>否父分类 ID;不传则在根目录下创建
--description <text>否分类描述

响应:

json
{"Code": "200", "directoryId": "kb-dir-new", "name": "产品文档", "path": "/产品文档", "directoryKind": "normal", "gmtCreate": 1718438400}
knowledge-base update-directory ​

修改企业知识库分类。

bash
winnexo knowledge-base update-directory --directory-id kb-dir-001 --name "新分类名" --json
选项缩写必需说明
--directory-id <id>-d是待修改的分类 ID
--name <name>-n否新分类名称
--description <text>否新分类描述
--parent-directory-id <id>否新父分类 ID

响应:

json
{"Code": "200", "success": true, "directoryId": "kb-dir-001"}
knowledge-base list-directories ​

获取企业知识库分类列表。

bash
winnexo knowledge-base list-directories --json
winnexo knowledge-base list-directories --directory-id kb-dir-001 --sort-field name --sort-order asc --json
选项缩写必需默认值说明
--directory-id <id>-d否父分类 ID;不传返回根目录分类树
--sort-field <field>否gmt_create排序字段
--sort-order <order>否desc排序方向
knowledge-base get-source ​

获取企业知识库知识详情。

bash
winnexo knowledge-base get-source --source-id src-001 --json
选项缩写必需说明
--source-id <id>-s是知识 ID

响应:

json
{
  "Code": "200",
  "sourceId": "src-001",
  "sourceType": "FILE",
  "name": "产品手册.pdf",
  "status": "READY",
  "sourceKind": "normal",
  "sourceTags": "[\"FAQ\"]",
  "directoryId": "kb-dir-001",
  "directoryPath": "/产品文档",
  "gmtCreate": 1718438400,
  "gmtModified": 1718524800
}
knowledge-base preview-source ​

预览企业知识库中的知识内容,需要知识库查看权限(DEVELOPMENT_KB_VIEW)。

bash
winnexo knowledge-base preview-source --source-id src-001 --json
选项缩写必需说明
--source-id <id>-s是知识 ID(数据源唯一标识)

响应:

json
{
  "Code": "200",
  "previewType": "CONTENT",
  "previewUrl": null,
  "content": "这是知识的完整文本内容...",
  "fileName": "FAQ.md",
  "fileExt": "md",
  "publicUrl": "https://oss-bucket.aliyuncs.com/uploads/faq.md?sign=..."
}

关键字段:previewType(OSS_IMM / IMAGE / AUDIO / VIDEO / HTML / DING_TALK / VOICE_MEETING / CONTENT)、previewUrl(非 CONTENT 类型的预览链接)、content(CONTENT 类型的文本内容)、fileName、fileExt、publicUrl(文件公开访问 URL)。

knowledge-base create-text ​

上传纯文本到企业知识库。

bash
winnexo knowledge-base create-text -n "FAQ" --text-content "常见问题解答..." --json
选项缩写必需说明
--name <name>-n是资源显示名称
--text-content <text>是纯文本正文
--operating-object-name <name>-o否数字员工名称
--directory-id <id>-d否目标目录 ID
--description <text>否资源描述
--knowledge-id <id>否知识库 ID
--source-tags <json>否资源标签 JSON 字符串列表
knowledge-base create-file ​

上传文件到企业知识库。

bash
winnexo knowledge-base create-file -n "产品手册.pdf" --file-path "uploads/2026/06/manual.pdf" --directory-id kb-dir-001 --json
选项缩写必需说明
--name <name>-n是资源显示名称
--file-path <path>是文件 OSS 持久化地址
--operating-object-name <name>-o否数字员工名称
--file-public-url <url>否文件公开访问 URL
--file-name <name>否原始文件名(含后缀)
--file-ext <ext>否文件后缀名
--file-record-id <id>否文件记录 ID
--directory-id <id>-d否目标目录 ID
--description <text>否资源描述
--knowledge-id <id>否知识库 ID
--source-tags <json>否资源标签 JSON 字符串列表
knowledge-base create-aliding-doc ​

上传阿里钉在线文档到企业知识库。

bash
winnexo knowledge-base create-aliding-doc -n "产品设计" --file-public-url "https://alidocs.dingtalk.com/i/nodes/xxx" --json
选项缩写必需说明
--name <name>-n是资源显示名称
--file-public-url <url>是阿里钉在线文档可公开访问 URL
--operating-object-name <name>-o否数字员工名称
--directory-id <id>-d否目标目录 ID
--description <text>否资源描述
--knowledge-id <id>否知识库 ID
--source-tags <json>否资源标签 JSON 字符串列表

user — 当前用户信息与积分 ​

管理当前登录用户自身的信息与积分(管理租户下其他用户请用 tenant-user)。

子命令说明
get获取当前用户信息
update [options]更新用户信息
credits查询积分用量
user get ​

获取当前用户信息。

bash
winnexo user get --json

响应:

json
{
  "Code": "200",
  "userId": 12345,
  "name": "张三",
  "userCode": "user_abc",
  "tenantId": 100,
  "tenantName": "示例企业",
  "tenantList": [{"tenantId": 100, "tenantName": "示例企业"}],
  "isAdmin": false,
  "isSystemTenant": false,
  "languagePreference": "zh-CN",
  "profileRole": "产品经理",
  "profileRoleInfo": null,
  "avatar": null,
  "offering": null,
  "parsedOffering": null,
  "selfIntroduction": null
}
user update ​

更新用户信息。至少提供一个选项,否则以参数错误(exit 2)退出。

bash
winnexo user update --name "李四" --json
winnexo user update --language-preference zh-CN --profile-role-info "产品经理" --json
选项缩写必需说明
--name <name>-n否显示名称
--avatar <url>否头像 URL
--language-preference <lang>否语言偏好(zh-CN / en-US)
--profile-role-info <text>否用户角色描述(最多100字符)
--offering <text>否能力/服务描述(最多1000字符)
--self-introduction <text>否自我介绍(最多1000字符)

响应:

json
{"Code": "200", "success": true, "message": "User information updated successfully", "user": {"userId": 12345, "name": "李四", "userCode": "user_abc", "tenantId": 100, "tenantName": "示例企业", "isAdmin": false, "isSystemTenant": false, "languagePreference": "zh-CN", "profileRole": "产品经理"}}

更新成功后返回完整用户信息(user 字段),包含所有字段当前值。

user credits ​

查询积分用量。

bash
winnexo user credits --json

响应字段:

字段类型说明
creditLimitnumber正式额度上限
usedCreditsnumber已使用正式额度
remainingCreditsnumber剩余正式额度
shadowCreditLimitnumber影子额度上限(不实际扣费的试用额度)
shadowUsedCreditsnumber已使用影子额度
shadowRemainingCreditsnumber剩余影子额度
json
{"Code": "200", "creditLimit": 10000, "usedCredits": 3500, "remainingCredits": 6500, "shadowCreditLimit": 5000, "shadowUsedCredits": 1000, "shadowRemainingCredits": 4000}

instance — 实例信息 ​

查询实例信息。

子命令说明
expire-time查询实例到期时间
instance expire-time ​

查询实例到期时间。

bash
winnexo instance expire-time --json

响应:

json
{"Code": "200", "expireTime": "2027-01-01T00:00:00Z", "instanceId": "inst-001", "instanceName": "企业版实例"}

billing — Credit 账单查询 ​

账单(Billing)记录了平台上每次操作消耗的 credit 明细。

子命令说明
list [options]分页查询账单列表
billing list ​

分页查询账单列表,支持按用户、操作类型、状态、时间范围、业务来源等条件筛选。

bash
winnexo billing list --json
winnexo billing list --page 2 --page-size 50 --no-ignore-zero --json
winnexo billing list --start-time 2026-05-01T00:00:00Z --end-time 2026-05-31T23:59:59Z --json
winnexo billing list --operation CHAT --status COMPLETED --json
winnexo billing list --biz-type CONVERSATION --biz-id biz-001 --json
winnexo billing list --user-id 42 --status COMPLETED --page-size 100 --json
选项缩写必需默认值说明
--page <num>-p否1页码
--page-size <num>否20每页条数
--user-id <id>否按用户 ID 过滤(整数)
--operation <type>否按操作类型过滤
--status <status>否按状态过滤
--start-time <datetime>否开始时间(ISO 8601,如 2026-01-01T00:00:00Z)
--end-time <datetime>否结束时间(ISO 8601,如 2026-12-31T23:59:59Z)
--biz-type <type>否按业务来源类型过滤
--biz-id <id>否按业务来源 ID 过滤
--no-ignore-zero否显示所有账单(含 credit=0 的记录),默认过滤 credit=0

响应:

json
{
  "Code": "200",
  "Message": "success",
  "list": [
    {
      "billingId": "bill-001",
      "tenantId": 1,
      "userId": 42,
      "operation": "CHAT",
      "operationDisplayName": "AI对话",
      "status": "COMPLETED",
      "statusDisplayName": "已完成",
      "isShadow": false,
      "totalCreditCost": "1.5",
      "costSource": ["quota-001"],
      "costSourceDisplayName": ["标准版"],
      "bizType": "CONVERSATION",
      "bizId": "biz-001",
      "startTime": "2026-05-20T10:00:00Z",
      "endTime": "2026-05-20T10:01:00Z"
    }
  ],
  "total": 100,
  "page": 1,
  "pageSize": 20
}

totalCreditCost 为字符串格式小数(如 "1.5"),便于精确计算;isShadow 为 true 表示影子账单(不实际扣费)。默认过滤 credit=0 的账单,--no-ignore-zero 可关闭过滤。


config — 管理 CLI 配置 ​

管理存储在 ~/.winnexo/config.json 中的配置项。

子命令说明
set <key> <value>设置配置值
get <key>获取配置值
list列出所有配置
config set ​

设置配置值。

bash
winnexo config set server_domain https://api.winnexo.com
winnexo config set user_token wn_xxxxxxxxxxxx
config get ​

获取配置值。

bash
winnexo config get server_domain
config list ​

列出所有配置。

bash
winnexo config list

repl — 进入交互式命令行 ​

进入 REPL 交互模式,直接输入文本即发送消息(流式输出),首次输入自动创建会话。

bash
winnexo repl

内置命令:

命令说明
/help显示帮助信息
/status查看当前会话状态(会话 ID、数字员工、消息数)
/new开启新会话(清空当前 sessionId)
/clear清屏
/e <name>设置数字员工(别名:/employee、/digital-employee-name)
/exit退出 REPL(别名:/quit,或按 Ctrl+D)

Agent 调用不应使用 repl,应直接用 chat 命令配合 --json。


org-sync — 组织架构同步 ​

枚举同步配置、注册自定义组织、推送部门树与成员关系、查询同步任务结果。

子命令说明
list-configs枚举可用同步配置(saml/oauth2/wecom/custom)
create-custom [options]注册纯自定义组织
sync [options]推送部门树 + 成员关系(异步任务)
query [options]查询同步任务结果
org-sync list-configs ​

枚举可用同步配置,涵盖 wecom / saml / oauth2 / custom 四种平台类型。

bash
winnexo org-sync list-configs --json

响应:

json
{
  "Code": "200",
  "configs": [
    {"platformType": "saml", "corpId": "https://idp.example.com", "corpName": "Example SAML", "ssoSettingsId": "sso-001", "ssoSettingsName": "Example SSO"},
    {"platformType": "custom", "corpId": "my-org", "corpName": "My Organization", "ssoSettingsId": null, "ssoSettingsName": null}
  ]
}
org-sync create-custom ​

注册纯自定义组织。注意:自定义组织仅支持部门树同步,不支持成员关系同步。

bash
winnexo org-sync create-custom --corp-id my-org --corp-name "My Organization" --json
选项必需说明
--corp-id <id>是自定义组织标识(格式:^[a-z0-9][a-z0-9\-]{2,63}$)
--corp-name <name>否组织展示名称(不传则与 corpId 相同)

响应:

json
{"Code": "200", "corpId": "my-org", "corpName": "My Organization", "platformType": "custom"}
org-sync sync ​

接收部门树和成员关系数据,创建异步同步任务。返回 taskId 供 query 轮询。

bash
winnexo org-sync sync --platform-type custom --corp-id my-org \
  --departments '[{"deptId":"root","deptName":"总公司","parentDeptId":null,"order":0},{"deptId":"dev","deptName":"研发部","parentDeptId":"root","order":1}]' --json

# 同步成员关系(SAML/OAuth2 场景)
winnexo org-sync sync --platform-type saml --corp-id "https://idp.example.com" --sync-members \
  --departments '[{"deptId":"root","deptName":"Root"}]' \
  --members '[{"deptId":"root","accountId":"user@example.com","name":"Alice"}]' --json
选项必需说明
--platform-type <type>是平台类型:saml / oauth2 / custom
--corp-id <id>是企业标识(须与 list-configs 返回的 corpId 一致)
--departments <json>是部门列表 JSON
--sso-settings-id <id>否SSO 配置 ID(SAML/OAuth2 可选,不传时自动推导)
--sync-members否是否同步成员关系(custom 模式不支持)
--members <json>否成员列表 JSON(syncMembers=true 时必须提供)

部门数据结构:

字段类型说明
deptIdstring部门 ID(外部标识,客户端保证唯一)
deptNamestring部门名称
parentDeptIdstring?父部门 ID(null 表示根部门)
ordernumber排序号(越小越靠前,默认 0)

成员数据结构:

字段类型说明
deptIdstring所属部门 ID
accountIdstring用户标识
namestring?用户姓名(可选)

响应:

json
{"Code": "200", "taskId": 12345, "status": "PENDING"}
org-sync query ​

根据 taskId 查询组织同步任务的执行状态和结果。状态流转:PENDING → RUNNING → COMPLETED / FAILED / TIMEOUT / CANCELED。建议轮询间隔 3-5 秒。

bash
winnexo org-sync query --task-id 12345 --json
选项必需说明
--task-id <id>是同步任务 ID(由 sync 命令返回)

响应:

json
{
  "Code": "200",
  "taskId": 12345,
  "status": "COMPLETED",
  "platformType": "custom",
  "corpId": "my-org",
  "submittedAt": "2026-07-02T10:00:00Z",
  "startedAt": "2026-07-02T10:00:01Z",
  "completedAt": "2026-07-02T10:00:15Z",
  "durationSeconds": 14,
  "summary": "同步完成",
  "errorMessage": null,
  "deptStats": {"totalExternal": 2, "created": 2, "renamed": 0, "moved": 0, "deleted": 0, "skipped": 0},
  "memberStats": null
}

custom 模式不支持成员同步;部门+成员总数上限 50000 条。


tenant-user — 租户用户管理(管理员) ​

管理当前租户下任意用户(管理员操作)。与 user(管理自身)区分。

子命令说明
create [options]创建用户并加入当前租户
update [options]修改用户信息(含启停用、角色变更、用户组调整)
remove [options]从当前租户移除用户(保留用户主体)
get [options]查询用户详情
list [options]分页查询租户成员列表
reset-password [options]管理员重置用户密码

系统角色说明:

角色 Code说明
SUPER_ADMIN超级管理员
SYSTEM_ADMIN系统管理员
SEMANTIC_ADMIN语义管理员
SKILL_ADMIN技能管理员
KB_ADMIN知识库管理员
AGENT_ADMIN数字员工管理员
APPLICATION_USER普通应用用户(默认角色)
tenant-user create ​

创建用户并加入当前租户。如果用户已存在(同 accountId),则将其加入当前租户。

bash
winnexo tenant-user create -a user001 -n "张三" --json
winnexo tenant-user create -a user001 -n "张三" -r '["APPLICATION_USER","SEMANTIC_ADMIN"]' --json
winnexo tenant-user create -a user001 -n "张三" -p '<rsa_encrypted_password>' --json
选项缩写必需说明
--account-id <id>-a是WINNEXO 登录账号(唯一标识)
--display-name <name>-n是用户显示名称(租户内唯一)
--role-codes <json>-r否系统角色 code 列表 JSON,不传默认 APPLICATION_USER
--password-encrypted <cipher>-p否RSA-OAEP-SHA256 加密密码密文;不传使用系统默认密码

响应字段:

字段类型说明
userIdnumber平台用户 ID
accountIdstring登录账号
displayNamestring显示名称
isNewUserboolean是否新创建(false 表示已有用户加入租户)
isDefaultPasswordboolean是否使用系统默认密码
tenant-user update ​

修改用户信息。所有修改字段均为可选,不传表示不修改。roleCodes 和 userGroupIds 为全量替换语义。

bash
winnexo tenant-user update -u 123 --active false --json
winnexo tenant-user update -u 123 -n "新名称" -r '["APPLICATION_USER"]' --json
winnexo tenant-user update -u 123 -g '["group1","group2"]' --json
选项缩写必需说明
--user-id <id>-u是目标用户 ID
--display-name <name>-n否新显示名称
--role-codes <json>-r否新角色列表 JSON(全量替换)
--active <bool>否启用/停用(true/false)
--user-group-ids <json>-g否新用户组 ID 列表 JSON(全量替换)

停用用户时受"最后超管保护"约束:不允许停用租户最后一个超级管理员。

tenant-user remove ​

从当前租户移除用户。用户主体保留,仅移除租户关联(角色、用户组、授权)。

bash
winnexo tenant-user remove -u 123 --json
选项缩写必需说明
--user-id <id>-u是要移除的用户 ID
tenant-user get ​

查询用户详情,支持按 userId 或 accountId 查询。

bash
winnexo tenant-user get -u 123 --json
winnexo tenant-user get -a user001 --json
选项缩写必需说明
--user-id <id>-u二选一用户 ID
--account-id <id>-a二选一WINNEXO 登录账号

响应字段:

字段类型说明
userIdnumber用户 ID
accountIdstring登录账号
displayNamestring显示名称
isActiveboolean启用/停用状态
roleCodesstring[]系统角色 code 列表
userGroupIdsstring[]用户组 ID 列表
gmtCreatestring | null加入租户时间
lastLoginTimestring | null最后登录时间
tenant-user list ​

分页查询租户成员列表,支持关键词搜索、状态筛选和角色筛选。

bash
winnexo tenant-user list --json
winnexo tenant-user list -k "张" --active true --json
winnexo tenant-user list -r '["APPLICATION_USER"]' --json
winnexo tenant-user list -p 2 --page-size 50 --json
选项缩写必需默认值说明
--page <num>-p否1页码(从1开始)
--page-size <num>否20每页数量(最大100)
--keyword <text>-k否搜索关键词(模糊匹配显示名和账号)
--active <bool>否启用/停用状态筛选
--role-codes <json>-r否按角色筛选 JSON 数组

响应字段:

字段类型说明
totalnumber符合条件的总记录数
pagenumber当前页码
pageSizenumber每页数量
itemsarray成员列表(每项含 userId/accountId/displayName/isActive/roleCodes/gmtCreate/lastLoginTime)
tenant-user reset-password ​

重置用户密码。不传 --password-encrypted 时重置为系统默认密码。

bash
winnexo tenant-user reset-password -u 123 --json
winnexo tenant-user reset-password -u 123 -p '<rsa_encrypted_password>' --json
选项缩写必需说明
--user-id <id>-u是目标用户 ID
--password-encrypted <cipher>-p否RSA-OAEP-SHA256 加密新密码密文

响应字段:

字段类型说明
userIdnumber用户 ID
isDefaultPasswordboolean是否重置为系统默认密码

user-token — 用户 API Token 自助管理 ​

面向终端用户的 API Token 自助管理,仅允许 caller_type=user 调用,操作目标强制绑定 Token 持有者自身。

子命令说明端点
info查询当前用户的 Token 状态POST /openapi/getTokenInfo
enable开启 API Token(幂等)POST /openapi/enableToken
disable关闭 API TokenPOST /openapi/disableToken
reset重置 API Token(旧失效 + 发新)POST /openapi/resetToken
user-token info ​

查询当前用户的 Token 状态。

bash
winnexo user-token info --json

响应字段:

字段类型说明
enabledbooleanToken 是否开启(存在 ACTIVE 状态的 Token)
tokenMaskedstring | null脱敏后的 Token 值
gmtCreatestring | nullToken 创建时间(ISO 8601)
user-token enable ​

开启 API Token(已有 ACTIVE Token 时幂等返回,不会重复创建)。

bash
winnexo user-token enable --json

响应字段:

字段类型说明
tokenstringToken 明文(仅本次返回,请妥善保管)
tokenMaskedstring脱敏后的 Token 值
user-token disable ​

关闭 API Token(若当前无 ACTIVE Token,不影响结果)。

bash
winnexo user-token disable --json

响应字段:

字段类型说明
disabledboolean操作是否成功
user-token reset ​

重置 API Token(旧失效 + 发新)。

bash
winnexo user-token reset --json

响应字段:

字段类型说明
tokenstring新 Token 明文(仅本次返回)
tokenMaskedstring脱敏后的新 Token 值

重置后旧 Token 永久失效且不可恢复。新 Token 明文仅在本次响应中返回,需妥善保管。


输出格式 ​

人类可读模式(默认) ​

默认输出带颜色和图标的终端输出,表格使用 cli-table3 格式化。

JSON 模式(--json) ​

使用 --json 标志时,输出直接透传 API 原始响应(POP 网关格式),不添加额外包装。

bash
winnexo --json health

输出示例:

json
{
  "Code": "200",
  "Message": "success",
  "RequestId": "xxx",
  "callerType": "user",
  "authSource": "bearer",
  "tenantId": 10001,
  "userId": 5,
  "digitalEmployeeName": "customer"
}

错误时:

json
{
  "status": "error",
  "message": "健康检查失败",
  "error": "Unauthorized"
}

退出码 ​

退出码含义
0成功
1API 错误
2参数验证错误
3认证错误

凭证配置 ​

WinNexo CLI 支持三种凭证配置方式,按优先级从高到低:

  1. CLI 参数:--server-domain / --user-token / --tenant-id
  2. 环境变量:WINNEXO_SERVER_DOMAIN / WINNEXO_USER_TOKEN / WINNEXO_DEFAULT_TENANT_ID / WINNEXO_DEFAULT_DIGITAL_EMPLOYEE_NAME
  3. 配置文件:~/.winnexo/config.json
json
{
  "server_domain": "https://your-api-endpoint.com",
  "user_token": "wn_xxxxxxxxxxxx",
  "tenant_id": "10001",
  "digital_employee_name": "customer"
}

工作原理 ​

mermaid
graph LR
    A[你的终端 / 脚本 / IDE] --> B[winnexo CLI]
    B -->|环境变量身份| C[WinNexo OpenAPI]
    C --> D[数字员工 / 技能 / 资源 / 知识]

CLI 通过四个环境变量获取身份和服务地址:

环境变量含义来源
WINNEXO_SERVER_DOMAINWinNexo 服务端地址个人设置 → 开放集成
WINNEXO_USER_TOKENBearer Token(wn_ 前缀)个人设置 → 开放集成 → 开启 UserToken
WINNEXO_DEFAULT_TENANT_ID默认租户 ID(请求头 x-tenant-id)个人设置 → 开放集成
WINNEXO_DEFAULT_DIGITAL_EMPLOYEE_NAME默认数字员工名称个人设置 → 开放集成

凭证按"CLI 参数 → 环境变量 → 配置文件 (~/.winnexo/config.json)"的优先级解析。

模块组合 ​

安装方式请阅读在外部 AI 工作台使用 WinNexo。

手工安装 ​

如果你不想让 AI 操作系统:

bash
# macOS Apple Silicon
curl -L -o /tmp/winnexo \
  "https://winnexo-common.oss-cn-shanghai.aliyuncs.com/1.7.20260709/cli/release/winnexo-v1.0.0-darwin-arm64"
sudo mv /tmp/winnexo /usr/local/bin/winnexo
sudo chmod +x /usr/local/bin/winnexo

# macOS 专用:移除隔离属性 + ad-hoc 自签名(避免"已损坏"提示)
sudo xattr -rd com.apple.quarantine /usr/local/bin/winnexo
sudo codesign --sign - /usr/local/bin/winnexo

# 配置环境变量(写入 ~/.zshrc 后 source 生效)
export WINNEXO_SERVER_DOMAIN="https://your-api-endpoint.com"
export WINNEXO_USER_TOKEN="wn_your-token-here"
export WINNEXO_DEFAULT_TENANT_ID="10001"
export WINNEXO_DEFAULT_DIGITAL_EMPLOYEE_NAME="customer"

winnexo --version
winnexo health --json

其他平台按 darwin-x64 / linux-x64 / linux-arm64 / win-x64.exe 替换二进制名即可。无 sudo 权限时可改装到 ~/.local/bin/ 并加入 PATH。

典型场景 ​

场景一:每日定时跑一份客户摘要 ​

crontab 里加一行:

bash
0 9 * * 1-5 winnexo skill run --skill-code customer-daily-recap \
  --arguments '{"date": "yesterday"}' --json \
  > ~/Documents/notes/$(date +%Y%m%d).json

每个工作日早 9 点,本地自动落一份昨天的客户跟进摘要(JSON,可再管道处理成 Markdown)。

场景二:批量入库 ​

一个文件夹里 50 个 PDF 要进知识库:

bash
for f in ./contracts/*.pdf; do
  winnexo knowledge-base create-file -n "$(basename "$f")" \
    --file-path "$f" --directory-id kb-dir-001 --json
done

CLI 逐个上传、自动入库——比手工拖快 10 倍。

场景三:IDE 工作流 ​

在 VS Code 里写技术方案时,想引用上周一次会议的纪要:

bash
winnexo output list --keyword "周会纪要" --json
# 输出列表,拿到一个 source-id
winnexo source preview --source-id $ID --json

输出粘到方案里。

场景四:CI/CD 流水线 ​

发布完成后自动让数字员工写一篇 release note:

bash
winnexo skill run --skill-code release-note-writer \
  --arguments "{\"version\": \"$VERSION\", \"diff\": \"$(git log --oneline ...)\"}" --json \
  | tee CHANGELOG.md

最佳实践 ​

✓
「安装走“贴提示语给 AI 工作台”最省力」——别自己挑二进制、别自己改 PATH,让Qoder Work(AI 工作台)按官方提示语跑。出问题它还能直接帮你排查。
✓
「先 `--help` 再敲命令」——`winnexo skill --help`、`winnexo knowledge-base --help` 会给完整子命令。
✓
「写脚本时别把凭证硬编码」——读 `WINNEXO_USER_TOKEN` 等环境变量;CI/CD 上用 Secrets。
i
凭证重置说明请阅读管理 UserToken。
i
「Windows 装完要重启终端」——PATH 变更对已开终端不生效。

试一试 ​

走 AI 工作台一键安装
验证
winnexo --version
winnexo health --json
返回 `callerType: user` 且 `authSource: bearer` 就成。
跑一个简单技能
winnexo skill list --json               # 看你能调的技能
winnexo skill run --skill-code $CODE --arguments '{}' --json   # 跑一个
把它接到你的工作流

crontab、Makefile、CI、IDE Task 都能直接用。


📌 配套阅读:OpenAPI、编写自定义技能包