CLI
CLI 的本质是把 WinNexo 能力变成 Unix Pipe 上的一个命令,可以接进任何工作流。
CLI 命令参考
基于
winnexo --help及各命令--help输出整理,涵盖所有命令和子命令。Agent 调用时务必加--json以获取结构化可解析的响应。
全局选项
| 选项 | 说明 |
|---|---|
-v, --version | 显示版本号 |
--json | JSON 格式输出(适用于 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 |
billing | Credit 消耗账单查询 | 1 |
用户与权限管理(2 个)
| 命令 | 说明 | 子命令数 |
|---|---|---|
tenant-user | 租户用户管理(管理员) | 6 |
user-token | 用户 API Token 自助管理 | 4 |
组织同步(1 个)
| 命令 | 说明 | 子命令数 |
|---|---|---|
org-sync | 组织架构同步 | 4 |
配置与交互(2 个)
| 命令 | 说明 | 子命令数 |
|---|---|---|
config | 管理 CLI 配置 | 3 |
repl | 进入交互式命令行 | — |
命令详情
health — 检查 API 连接和认证状态
验证 API 端点是否可达以及认证凭证是否有效。成功时返回当前身份信息。
winnexo health
winnexo --json health响应字段:
| 字段 | 类型 | 说明 |
|---|---|---|
callerType | string | 调用方类型:user / aliyun_main / aliyun_ram / service |
authSource | string | 认证来源:bearer / aliyun_gateway |
tenantId | number | 生效租户 ID |
userId | number | null | 平台用户 ID |
digitalEmployeeName | string | null | 当前生效的数字员工名 |
chat — 发送聊天消息
启动与 WinNexo AI 的对话交互。消息正文作为位置参数传入,默认流式输出;支持附件与多轮续聊。
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 回复的内容片段,适合交互场景。
winnexo chat "你好"
winnexo chat "分析一下本月销售趋势" -e customer --jsonJSON 模式响应:
{"content": "完整的AI回复内容", "sessionId": "sess-abc123"}非 JSON 模式直接在终端实时输出内容。
非流式模式
等待完整回复后一次性返回,适合程序化调用。响应兼容两种格式:
winnexo chat "生成季度总结" --no-stream --json格式一(OpenAI 兼容):
{
"Code": "200",
"choices": [{"message": {"content": "AI完整回复"}}],
"session": {"id": "sess-abc123"}
}格式二(旧版平台):
{
"Code": "200",
"messages": [{"role": "assistant", "content": "AI完整回复"}],
"session": {"id": "sess-abc123"}
}附件对话与多轮对话
# 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 --jsonchat-session — 管理聊天会话
对聊天会话进行增删改查操作。
| 子命令 | 说明 |
|---|---|
list [options] | 列出聊天会话 |
get [options] | 获取会话详情 |
update [options] | 更新会话信息 |
delete [options] | 删除会话 |
stop [options] | 停止正在生成的消息 |
chat-session list
列出聊天会话,支持关键词与数字员工过滤、分页。
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 | 否 | 按数字员工过滤 |
响应:
{
"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
获取会话详情与最近若干条消息。
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) |
响应:
{
"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
更新会话标题或模型。
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
删除会话。
winnexo chat-session delete --session-id abc123 --json| 选项 | 缩写 | 必需 | 说明 |
|---|---|---|---|
--session-id <id> | -s | 是 | 会话 ID |
响应:
{"Code": "200", "hardDelete": true}chat-session stop
停止正在生成的消息。
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 引用。
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 自动解析) |
响应:
{"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
列出可用技能,支持关键词、类型、标签、绑定状态过滤。
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 |
响应:
{
"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 之一。
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 | 包含完整文件树 |
响应:
{
"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 之一。
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(重复提交时防止重复执行) |
响应:
{"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。
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 状态响应:
{"Code": "200", "runId": "run-abc123", "status": "Running", "progress": 45, "progressMessage": "正在生成图表..."}Succeeded 状态响应:
{"Code": "200", "runId": "run-abc123", "status": "Succeeded", "result": {"content": "日报内容..."}}Failed 状态响应:
{"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 数组:
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 必填。text / web_search / mention / skill |
content | string | 文本内容,type=text 时必填 |
enabled | boolean | 功能开关,type=web_search 时可选 |
name | string | 对象或技能名称 |
objectId | string | 对象 ID,type=mention 时有值 |
objectType | string | 对象类型,type=mention 时有值 |
skillCode | string | 技能编码,type=skill 时有值 |
公共数据结构 · TriggerConfig(触发配置) — --trigger-config 字段:
| 字段 | 类型 | 说明 |
|---|---|---|
triggerMode | string | 必填。manual(手动)/ scheduled(定时) |
cron | string | Cron 表达式,定时模式必填,如 "00 09 * * *" |
timezone和language由服务端自动注入,无需传入。
公共数据结构 · TaskDetail(任务详情) — --task-detail 字段,由 understand 命令返回后原样回传:
| 字段 | 类型 | 说明 |
|---|---|---|
taskUnderstand | string | LLM 润色后的任务理解描述 |
relatedSemantics | array | 语义实体列表(entity/attributes) |
relatedObjects | array | 相关对象列表(name/objectId/objectType/mentionType) |
relatedSkills | array | 相关技能列表(name/displayName/skillCode/sourceIds) |
scheduled-task list
查询定时任务列表。
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> | 否 | 按数字员工过滤(自动解析) |
响应:
{
"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 解析后的结构化任务信息。
winnexo scheduled-task understand --user-input "每天早上9点发送销售日报" --json| 选项 | 缩写 | 必需 | 说明 |
|---|---|---|---|
--user-input <text> | 是 | 自然语言任务描述 | |
--digital-employee-name <name> | 否 | 数字员工名称(自动解析) | |
--segments <json> | 否 | 附加富文本段 |
响应字段:
| 字段 | 类型 | 说明 |
|---|---|---|
taskUnderstand | string | LLM 润色后的任务理解描述 |
relatedSemantics | array | 语义实体列表(entity/attributes) |
relatedObjects | array | 相关对象列表(name/objectId/objectType/mentionType) |
relatedSkills | array | 相关技能列表(skillCode/displayName/name/sourceIds) |
{
"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
创建定时任务。
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 | 否 | 创建后关闭任务(默认创建后自动开启) |
响应:
{"Code": "200", "taskId": "task-new-001"}scheduled-task update
更新定时任务。
# 修改 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 调度。
winnexo scheduled-task execute --task-id task-001 --json| 选项 | 必需 | 说明 |
|---|---|---|
--task-id <id> | 是 | 任务 ID |
响应:
{
"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 参数)。
winnexo scheduled-task execution-records --json响应:
{
"Code": "200",
"tasks": [
{"taskId": "task-001", "name": "每日日报", "triggerType": "cron", "timeline": [{"status": "SUCCESS", "startedAt": "2026-06-15T09:00:00Z"}]}
]
}scheduled-task execution-detail
获取单次执行详情。
winnexo scheduled-task execution-detail --execution-id exec-001 --json| 选项 | 必需 | 说明 |
|---|---|---|
--execution-id <id> | 是 | 执行 ID |
响应字段:
| 字段 | 类型 | 说明 |
|---|---|---|
executionId | string | 执行 ID |
taskId | string | 任务 ID |
status | string | 执行状态(如 SUCCESS) |
triggerType | string | 触发类型(cron / manual) |
digitalEmployeeName | string | 数字员工名 |
startedAt | string | 开始时间 |
completedAt | string | 完成时间 |
errorMessage | string | null | 错误信息 |
object — 主对象数据查询与收藏
查询主对象数据并管理收藏状态。
| 子命令 | 说明 |
|---|---|
query [options] | 查询主对象数据 |
toggle-favorite [options] | 批量切换收藏状态 |
object query
查询主对象数据。
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 | 否 | 仅返回已收藏数据 |
响应:
{
"Code": "200",
"total": 100,
"items": [
{"id": "obj-001", "object_id": "1513075685394636800", "name": "张三", "company": "示例企业"}
]
}
items中的字段结构取决于具体主对象类型,内容动态。
object toggle-favorite
批量切换收藏状态。
# 批量收藏
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 自动解析,无需手动传入 |
响应:
{
"Code": "200",
"results": [
{"objectId": "1513075685394636800", "isFavorited": true, "success": true, "message": null}
],
"favoriteCount": 5
}output — 产出查询与保存
产出(Output)是数字员工在聊天会话中生成的结构化内容(PPT、文档、图片、幻灯片等)。
| 子命令 | 说明 |
|---|---|
list [options] | 查询产出列表 |
save [options] | 将产出明细批量保存为个人资源 |
output list
查询当前用户的产出列表,支持关键词/类型/数字员工过滤和分页。
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。
响应:
{
"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
将产出明细批量保存为当前用户的个人资源。
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— 创建产出内容的独立快照,不随原始产出变化
响应:
{
"Code": "200",
"Message": "success",
"results": [
{"itemId": "item-001", "success": true, "sourceId": "resource-abc"},
{"itemId": "item-002", "success": false, "errorCode": "NOT_FOUND", "errorMessage": "产出明细不存在"}
]
}参数校验规则:
| 校验 | 退出码 | 错误信息 |
|---|---|---|
--mode 不是 link 或 copy | 2 | --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
在个人资源下创建目录。
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> | 否 | 目录描述 |
响应:
{
"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
下钻查询个人目录内容。
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。
响应:
{
"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
更新个人目录基础信息。
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> | 否 | 新目录路径(会级联更新子目录) |
响应:
{"Code": "200", "success": true, "directoryId": "dir_abc123"}personal-directory move-resource
在个人目录间移动资源。
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 |
响应:
{"Code": "200", "success": true, "sourceId": "src-001", "sourceDirectoryId": "dir_abc", "targetDirectoryId": "dir_xyz"}personal-directory retry-failed
重试目录下所有失败数据源(递归包含子目录)。
winnexo personal-directory retry-failed --directory-id dir_abc123 --json| 选项 | 缩写 | 必需 | 说明 |
|---|---|---|---|
--directory-id <id> | -d | 是 | 目录 ID(递归包含子目录下的失败资源) |
响应:
{
"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
获取资源详情。
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) |
响应:
{
"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。
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(企业知识库) |
响应:
{
"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获取签名 → 用返回的uploadSignatureUrlPUT 上传 → 用fileUrl/filePath调source create-file创建资源。
source create-text
上传纯文本资源。
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
上传文件资源。
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
上传阿里钉在线文档。
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
创建阿里钉整体知识库。
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
上传阿里钉会议。
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
上传钉钉会议。
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
上传飞书妙记。
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
上传离线会议。
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
重命名数据源。
winnexo source rename --source-id src-001 --new-name "新名称" --json| 选项 | 缩写 | 必需 | 说明 |
|---|---|---|---|
--source-id <id> | -s | 是 | 数据源 ID |
--new-name <name> | -n | 是 | 新的数据源名称 |
响应:
{"Code": "200", "sourceId": "src-001", "name": "新名称", "status": "READY", "gmtModified": "2026-06-15T10:00:00Z"}source replace-bindings
全量替换数据源对象绑定。
# 替换绑定
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
预览个人知识库中的知识内容,仅允许预览本人资源。
winnexo source preview --source-id src-001 --json| 选项 | 必需 | 说明 |
|---|---|---|
--source-id <id> | 是 | 知识 ID(数据源唯一标识) |
响应:
{
"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
后台查询企业知识库,管理员视图,无权限过滤,可下钻目录。
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"]' |
响应:
{
"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 权限过滤,返回数字员工能访问的知识库列表。
winnexo knowledge-base visible-list -o customer --json| 选项 | 缩写 | 必需 | 说明 |
|---|---|---|---|
--operating-object-name <name> | -o | 是 | 数字员工名称 |
响应:
{
"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
下钻查询可见知识库内容。
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):
{
"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)提交到企业知识库目录。
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 |
响应:
{"Code": "200", "sourceId": "src-001", "scope": "KNOWLEDGE", "targetDirectoryId": "kb-dir-002"}knowledge-base create-aliding
从阿里钉知识库 URL 创建整体知识库到个人资源,后台异步同步内容。
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 * * *"} |
响应:
{
"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
在企业知识库目录间移动资源。
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
重命名企业知识库数据源。
winnexo knowledge-base rename-source --source-id src-001 --new-name "新名称" --json| 选项 | 缩写 | 必需 | 说明 |
|---|---|---|---|
--source-id <id> | -s | 是 | 数据源 ID |
--new-name <name> | -n | 是 | 新名称 |
响应:
{"Code": "200", "sourceId": "src-001", "name": "新名称", "status": "READY", "gmtModified": "2026-06-15T10:00:00Z"}knowledge-base retry-failed
重试目录下所有失败数据源(递归含子目录)。
winnexo knowledge-base retry-failed --directory-id kb-dir-001 --json| 选项 | 缩写 | 必需 | 说明 |
|---|---|---|---|
--directory-id <id> | -d | 是 | 企业知识库目录 ID(递归含子目录) |
响应:
{"Code": "200", "directoryId": "kb-dir-001", "failedCount": 3, "enqueuedCount": 2, "skippedCount": 1}knowledge-base update-source-tags
更新数据源标签。
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
创建企业知识库分类。
winnexo knowledge-base create-directory --name "产品文档" --json| 选项 | 缩写 | 必需 | 说明 |
|---|---|---|---|
--name <name> | -n | 是 | 分类名称 |
--parent-directory-id <id> | 否 | 父分类 ID;不传则在根目录下创建 | |
--description <text> | 否 | 分类描述 |
响应:
{"Code": "200", "directoryId": "kb-dir-new", "name": "产品文档", "path": "/产品文档", "directoryKind": "normal", "gmtCreate": 1718438400}knowledge-base update-directory
修改企业知识库分类。
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 |
响应:
{"Code": "200", "success": true, "directoryId": "kb-dir-001"}knowledge-base list-directories
获取企业知识库分类列表。
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
获取企业知识库知识详情。
winnexo knowledge-base get-source --source-id src-001 --json| 选项 | 缩写 | 必需 | 说明 |
|---|---|---|---|
--source-id <id> | -s | 是 | 知识 ID |
响应:
{
"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)。
winnexo knowledge-base preview-source --source-id src-001 --json| 选项 | 缩写 | 必需 | 说明 |
|---|---|---|---|
--source-id <id> | -s | 是 | 知识 ID(数据源唯一标识) |
响应:
{
"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
上传纯文本到企业知识库。
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
上传文件到企业知识库。
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
上传阿里钉在线文档到企业知识库。
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
获取当前用户信息。
winnexo user get --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)退出。
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字符) |
响应:
{"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
查询积分用量。
winnexo user credits --json响应字段:
| 字段 | 类型 | 说明 |
|---|---|---|
creditLimit | number | 正式额度上限 |
usedCredits | number | 已使用正式额度 |
remainingCredits | number | 剩余正式额度 |
shadowCreditLimit | number | 影子额度上限(不实际扣费的试用额度) |
shadowUsedCredits | number | 已使用影子额度 |
shadowRemainingCredits | number | 剩余影子额度 |
{"Code": "200", "creditLimit": 10000, "usedCredits": 3500, "remainingCredits": 6500, "shadowCreditLimit": 5000, "shadowUsedCredits": 1000, "shadowRemainingCredits": 4000}instance — 实例信息
查询实例信息。
| 子命令 | 说明 |
|---|---|
expire-time | 查询实例到期时间 |
instance expire-time
查询实例到期时间。
winnexo instance expire-time --json响应:
{"Code": "200", "expireTime": "2027-01-01T00:00:00Z", "instanceId": "inst-001", "instanceName": "企业版实例"}billing — Credit 账单查询
账单(Billing)记录了平台上每次操作消耗的 credit 明细。
| 子命令 | 说明 |
|---|---|
list [options] | 分页查询账单列表 |
billing list
分页查询账单列表,支持按用户、操作类型、状态、时间范围、业务来源等条件筛选。
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 |
响应:
{
"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
设置配置值。
winnexo config set server_domain https://api.winnexo.com
winnexo config set user_token wn_xxxxxxxxxxxxconfig get
获取配置值。
winnexo config get server_domainconfig list
列出所有配置。
winnexo config listrepl — 进入交互式命令行
进入 REPL 交互模式,直接输入文本即发送消息(流式输出),首次输入自动创建会话。
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 四种平台类型。
winnexo org-sync list-configs --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
注册纯自定义组织。注意:自定义组织仅支持部门树同步,不支持成员关系同步。
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 相同) |
响应:
{"Code": "200", "corpId": "my-org", "corpName": "My Organization", "platformType": "custom"}org-sync sync
接收部门树和成员关系数据,创建异步同步任务。返回 taskId 供 query 轮询。
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 时必须提供) |
部门数据结构:
| 字段 | 类型 | 说明 |
|---|---|---|
deptId | string | 部门 ID(外部标识,客户端保证唯一) |
deptName | string | 部门名称 |
parentDeptId | string? | 父部门 ID(null 表示根部门) |
order | number | 排序号(越小越靠前,默认 0) |
成员数据结构:
| 字段 | 类型 | 说明 |
|---|---|---|
deptId | string | 所属部门 ID |
accountId | string | 用户标识 |
name | string? | 用户姓名(可选) |
响应:
{"Code": "200", "taskId": 12345, "status": "PENDING"}org-sync query
根据 taskId 查询组织同步任务的执行状态和结果。状态流转:PENDING → RUNNING → COMPLETED / FAILED / TIMEOUT / CANCELED。建议轮询间隔 3-5 秒。
winnexo org-sync query --task-id 12345 --json| 选项 | 必需 | 说明 |
|---|---|---|
--task-id <id> | 是 | 同步任务 ID(由 sync 命令返回) |
响应:
{
"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),则将其加入当前租户。
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 加密密码密文;不传使用系统默认密码 |
响应字段:
| 字段 | 类型 | 说明 |
|---|---|---|
userId | number | 平台用户 ID |
accountId | string | 登录账号 |
displayName | string | 显示名称 |
isNewUser | boolean | 是否新创建(false 表示已有用户加入租户) |
isDefaultPassword | boolean | 是否使用系统默认密码 |
tenant-user update
修改用户信息。所有修改字段均为可选,不传表示不修改。roleCodes 和 userGroupIds 为全量替换语义。
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
从当前租户移除用户。用户主体保留,仅移除租户关联(角色、用户组、授权)。
winnexo tenant-user remove -u 123 --json| 选项 | 缩写 | 必需 | 说明 |
|---|---|---|---|
--user-id <id> | -u | 是 | 要移除的用户 ID |
tenant-user get
查询用户详情,支持按 userId 或 accountId 查询。
winnexo tenant-user get -u 123 --json
winnexo tenant-user get -a user001 --json| 选项 | 缩写 | 必需 | 说明 |
|---|---|---|---|
--user-id <id> | -u | 二选一 | 用户 ID |
--account-id <id> | -a | 二选一 | WINNEXO 登录账号 |
响应字段:
| 字段 | 类型 | 说明 |
|---|---|---|
userId | number | 用户 ID |
accountId | string | 登录账号 |
displayName | string | 显示名称 |
isActive | boolean | 启用/停用状态 |
roleCodes | string[] | 系统角色 code 列表 |
userGroupIds | string[] | 用户组 ID 列表 |
gmtCreate | string | null | 加入租户时间 |
lastLoginTime | string | null | 最后登录时间 |
tenant-user list
分页查询租户成员列表,支持关键词搜索、状态筛选和角色筛选。
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 数组 |
响应字段:
| 字段 | 类型 | 说明 |
|---|---|---|
total | number | 符合条件的总记录数 |
page | number | 当前页码 |
pageSize | number | 每页数量 |
items | array | 成员列表(每项含 userId/accountId/displayName/isActive/roleCodes/gmtCreate/lastLoginTime) |
tenant-user reset-password
重置用户密码。不传 --password-encrypted 时重置为系统默认密码。
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 加密新密码密文 |
响应字段:
| 字段 | 类型 | 说明 |
|---|---|---|
userId | number | 用户 ID |
isDefaultPassword | boolean | 是否重置为系统默认密码 |
user-token — 用户 API Token 自助管理
面向终端用户的 API Token 自助管理,仅允许 caller_type=user 调用,操作目标强制绑定 Token 持有者自身。
| 子命令 | 说明 | 端点 |
|---|---|---|
info | 查询当前用户的 Token 状态 | POST /openapi/getTokenInfo |
enable | 开启 API Token(幂等) | POST /openapi/enableToken |
disable | 关闭 API Token | POST /openapi/disableToken |
reset | 重置 API Token(旧失效 + 发新) | POST /openapi/resetToken |
user-token info
查询当前用户的 Token 状态。
winnexo user-token info --json响应字段:
| 字段 | 类型 | 说明 |
|---|---|---|
enabled | boolean | Token 是否开启(存在 ACTIVE 状态的 Token) |
tokenMasked | string | null | 脱敏后的 Token 值 |
gmtCreate | string | null | Token 创建时间(ISO 8601) |
user-token enable
开启 API Token(已有 ACTIVE Token 时幂等返回,不会重复创建)。
winnexo user-token enable --json响应字段:
| 字段 | 类型 | 说明 |
|---|---|---|
token | string | Token 明文(仅本次返回,请妥善保管) |
tokenMasked | string | 脱敏后的 Token 值 |
user-token disable
关闭 API Token(若当前无 ACTIVE Token,不影响结果)。
winnexo user-token disable --json响应字段:
| 字段 | 类型 | 说明 |
|---|---|---|
disabled | boolean | 操作是否成功 |
user-token reset
重置 API Token(旧失效 + 发新)。
winnexo user-token reset --json响应字段:
| 字段 | 类型 | 说明 |
|---|---|---|
token | string | 新 Token 明文(仅本次返回) |
tokenMasked | string | 脱敏后的新 Token 值 |
重置后旧 Token 永久失效且不可恢复。新 Token 明文仅在本次响应中返回,需妥善保管。
输出格式
人类可读模式(默认)
默认输出带颜色和图标的终端输出,表格使用 cli-table3 格式化。
JSON 模式(--json)
使用 --json 标志时,输出直接透传 API 原始响应(POP 网关格式),不添加额外包装。
winnexo --json health输出示例:
{
"Code": "200",
"Message": "success",
"RequestId": "xxx",
"callerType": "user",
"authSource": "bearer",
"tenantId": 10001,
"userId": 5,
"digitalEmployeeName": "customer"
}错误时:
{
"status": "error",
"message": "健康检查失败",
"error": "Unauthorized"
}退出码
| 退出码 | 含义 |
|---|---|
| 0 | 成功 |
| 1 | API 错误 |
| 2 | 参数验证错误 |
| 3 | 认证错误 |
凭证配置
WinNexo CLI 支持三种凭证配置方式,按优先级从高到低:
- CLI 参数:
--server-domain/--user-token/--tenant-id - 环境变量:
WINNEXO_SERVER_DOMAIN/WINNEXO_USER_TOKEN/WINNEXO_DEFAULT_TENANT_ID/WINNEXO_DEFAULT_DIGITAL_EMPLOYEE_NAME - 配置文件:
~/.winnexo/config.json
{
"server_domain": "https://your-api-endpoint.com",
"user_token": "wn_xxxxxxxxxxxx",
"tenant_id": "10001",
"digital_employee_name": "customer"
}工作原理
graph LR
A[你的终端 / 脚本 / IDE] --> B[winnexo CLI]
B -->|环境变量身份| C[WinNexo OpenAPI]
C --> D[数字员工 / 技能 / 资源 / 知识]CLI 通过四个环境变量获取身份和服务地址:
| 环境变量 | 含义 | 来源 |
|---|---|---|
WINNEXO_SERVER_DOMAIN | WinNexo 服务端地址 | 个人设置 → 开放集成 |
WINNEXO_USER_TOKEN | Bearer Token(wn_ 前缀) | 个人设置 → 开放集成 → 开启 UserToken |
WINNEXO_DEFAULT_TENANT_ID | 默认租户 ID(请求头 x-tenant-id) | 个人设置 → 开放集成 |
WINNEXO_DEFAULT_DIGITAL_EMPLOYEE_NAME | 默认数字员工名称 | 个人设置 → 开放集成 |
凭证按"CLI 参数 → 环境变量 → 配置文件 (~/.winnexo/config.json)"的优先级解析。
模块组合
安装方式请阅读在外部 AI 工作台使用 WinNexo。
手工安装
如果你不想让 AI 操作系统:
# 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 里加一行:
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 要进知识库:
for f in ./contracts/*.pdf; do
winnexo knowledge-base create-file -n "$(basename "$f")" \
--file-path "$f" --directory-id kb-dir-001 --json
doneCLI 逐个上传、自动入库——比手工拖快 10 倍。
场景三:IDE 工作流
在 VS Code 里写技术方案时,想引用上周一次会议的纪要:
winnexo output list --keyword "周会纪要" --json
# 输出列表,拿到一个 source-id
winnexo source preview --source-id $ID --json输出粘到方案里。
场景四:CI/CD 流水线
发布完成后自动让数字员工写一篇 release note:
winnexo skill run --skill-code release-note-writer \
--arguments "{\"version\": \"$VERSION\", \"diff\": \"$(git log --oneline ...)\"}" --json \
| tee CHANGELOG.md最佳实践
试一试
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 都能直接用。
