weaver-work-cli 0.1.23 → 0.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -2
- package/dist/internal/e10/auth/commands.js +194 -16
- package/dist/internal/e10/auth/xiaoe.js +15 -6
- package/dist/internal/e10/context.js +3 -3
- package/dist/internal/e10/request-runtime.js +46 -4
- package/dist/shortcuts/caizhilian/file-upload/metadata.js +124 -0
- package/dist/shortcuts/caizhilian/file-upload/multipart.js +47 -0
- package/dist/shortcuts/caizhilian/file-upload/protocol.js +116 -0
- package/dist/shortcuts/caizhilian/file-upload/receipt.js +37 -0
- package/dist/shortcuts/caizhilian/host.js +13 -5
- package/dist/shortcuts/caizhilian/operations/handlers/file-upload.js +72 -179
- package/dist/shortcuts/caizhilian/operations/handlers/folder.js +701 -4
- package/dist/shortcuts/caizhilian/operations/registry.js +5 -1
- package/dist/shortcuts/caizhilian/operations/specs.js +52 -0
- package/dist/shortcuts/workflow/continuation.js +14 -9
- package/dist/shortcuts/workflow/endpoints.js +11 -1
- package/dist/shortcuts/workflow/operations/flow-status.js +63 -0
- package/dist/shortcuts/workflow/operations/form.js +650 -518
- package/dist/shortcuts/workflow/operations/read.js +374 -13
- package/dist/shortcuts/workflow/operations/shared.js +3 -0
- package/dist/shortcuts/workflow/operations/write.js +5 -5
- package/dist/shortcuts/workflow/operations.js +8 -6
- package/docs/caizhilian.md +8 -2
- package/docs/e10-auth.md +18 -3
- package/package.json +1 -1
- package/skills/weaver-e10-caizhilian/SKILL.md +8 -3
- package/skills/weaver-e10-caizhilian/references/file-upload.md +100 -295
- package/skills/weaver-e10-caizhilian/references/folder.md +31 -3
- package/skills/weaver-e10-caizhilian/references/source-manifest.json +536 -25
- package/skills/weaver-e10-jiuchuanhui/SKILL.md +9 -1
- package/skills/weaver-e10-shared/SKILL.md +12 -2
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +21 -3
- package/skills/weaver-e10-workflow/SKILL.md +10 -8
- package/skills/weaver-e10-workflow/references/source-manifest.json +36 -31
- package/skills/weaver-e10-workflow/references/workflow-batch.md +2 -4
- package/skills/weaver-e10-workflow/references/workflow-create.md +58 -36
- package/skills/weaver-e10-workflow/references/workflow-edit.md +2 -1
- package/skills/weaver-e10-workflow/references/workflow-memory.md +2 -2
- package/skills/weaver-e10-workflow/references/workflow-operate.md +2 -1
- package/skills/weaver-e10-workflow/references/workflow-query.md +9 -7
- package/skills/weaver-e10-workflow/references/workflow-share.md +2 -0
|
@@ -5,7 +5,7 @@ display_name_en: Weaver E10 Document Management
|
|
|
5
5
|
description: "泛微E10采知连知识管理系统Skill,包含多个功能模块,覆盖文档创建/搜索/编辑/比对、附件管理、文件夹操作、参与人与标签管理、文档共享与权限设置、文件存储/备份/加解密/附件设置、FTP/SFTP文件采集、本地文件上传。"
|
|
6
6
|
description_zh: "泛微E10采知连知识管理系统Skill,包含多个功能模块,覆盖文档创建/搜索/编辑/比对、附件管理、文件夹操作、参与人与标签管理、文档共享与权限设置、文件存储/备份/加解密/附件设置、FTP/SFTP文件采集、本地文件上传。"
|
|
7
7
|
description_en: "Weaver E10 document management Skill with multiple functional modules covering document CRUD, attachments, folders, sharing, permissions, file settings, FTP/SFTP collection, and file upload."
|
|
8
|
-
version: 1.1.
|
|
8
|
+
version: 1.1.30
|
|
9
9
|
author: 泛微网络科技股份有限公司
|
|
10
10
|
agent_created: true
|
|
11
11
|
requires:
|
|
@@ -16,7 +16,7 @@ cliHelp: "weaver-work-cli caizhilian --help"
|
|
|
16
16
|
**CRITICAL — 开始前 MUST 先用 Read 工具读取 [`../weaver-e10-shared/SKILL.md`](../weaver-e10-shared/SKILL.md),其中包含安装、E10 认证、JSON 输出和高风险写入规则。若共享规则不存在、CLI 未安装或读取失败,说明本技能的必需依赖缺失,必须调用宿主提供的提问/确认弹框,向用户说明必须补齐 `weaver-work-cli` 与共享 skill `weaver-e10-shared`(不补齐本技能无法执行)及补齐计划,并把下面两条待执行命令原样完整展示在确认信息中;Agent 不能在未确认时自行安装。用户明确确认后,Agent 必须直接代为按顺序执行且每条仅执行一次,不得要求或引导用户手动执行:① 缺 CLI 时执行 `npm install -g weaver-work-cli`;② 再执行 `weaver-work-cli skills install shared --target-dir <SKILLS_ROOT>` 装回共享 skill,`<SKILLS_ROOT>` 取本 SKILL.md 所在目录的上一级绝对目录(即与本技能同级的 skills 根目录),不要省略 `--target-dir`——省略会装进默认目录,导致本技能依然读不到共享规则。命令均成功后重新读取共享规则;仍读不到就停止并把结果报告用户,不得凭猜测继续。**
|
|
17
17
|
**`--is-connector` 判据**:用户明确使用连接器、或上下文要求用连接器完成任务 → 传 `true`;本次任务或上下文直接选择单独技能 → 不传;用户没有明确说明时,按**正在运行的这份 Skill 是哪一级**定——**用户级(条目标 `(user)`)不传,连接器级(标 `(connector)`)传**(同名 Skill 只会运行用户级那一份)。传 `true` 时不要再写 `--profile` / `--base-url`。完整规则见 [`../weaver-e10-shared/SKILL.md`](../weaver-e10-shared/SKILL.md)。
|
|
18
18
|
|
|
19
|
-
认证与登录态只能按共享规则通过 `weaver-work-cli auth ...` 判断:本 Skill 不自行发起 HTTP 请求,请求头凭证由 CLI 统一注入,Agent 不手写、不索取、不转存,也不得直接读取、列出、打印或解析用户主目录下的旧 `.e10-cli`、auth、config 或 Keychain 数据。业务入参里出现认证字段会被 CLI
|
|
19
|
+
认证与登录态只能按共享规则通过 `weaver-work-cli auth ...` 判断:本 Skill 不自行发起 HTTP 请求,请求头凭证由 CLI 统一注入,Agent 不手写、不索取、不转存,也不得直接读取、列出、打印或解析用户主目录下的旧 `.e10-cli`、auth、config 或 Keychain 数据。业务入参里出现认证字段会被 CLI 拒绝或剥离。请求头三件套由 CLI 统一注入、缺一不可:Cookie: <完整原始 Cookie 串>(禁止裁剪/去重/改写)、eteamsid: <ETEAMSID>、User-Agent: AgentType=<agentType>,IsAgent=true。完整契约见共享规则「请求头契约」章节。
|
|
20
20
|
|
|
21
21
|
所有命令通过 `weaver-work-cli --json caizhilian run <operation>` 执行:简单 JSON 优先传 `--input-json '<json>'`,复杂或多行 JSON 先写入 UTF-8 文件再传 `--input <path>`,只有确认当前 shell 能稳定传管道时才使用 `--input -`。**不要写内联脚本包装调用**——自写脚本在中文与 Windows 环境下容易出现编码、转义问题,且脚本报错时无法判断调用是否已生效,容易导致误判或重复提交。调用前先按需读取 references 下对应的文件查参数结构,不要猜字段;**references 是第一信息源**,`weaver-work-cli caizhilian schema` 是 operation、字段和风险等级的合约来源,`weaver-work-cli caizhilian operations` 是按资源分组的能力目录(含 `withheldOperations`)。
|
|
22
22
|
|
|
@@ -53,7 +53,7 @@ cliHelp: "weaver-work-cli caizhilian --help"
|
|
|
53
53
|
| 创建文档(HTML / Markdown / Office / 批量上传) | `caizhilian run caizhilian.document.create-html|create-markdown|create-office|create-by-upload.prepare/apply` | [`document.md`](references/document.md) |
|
|
54
54
|
| 改文档基础字段 / 改作者 / 存正文 / 替换正文 | `caizhilian run caizhilian.document.update-field|update-author|update-html|replace-content.prepare/apply` | [`document.md`](references/document.md) |
|
|
55
55
|
| 建文件夹 / 查虚拟文件夹 / 查文件夹设置 | `caizhilian run caizhilian.folder.create.prepare/apply`、`.search-virtual`、`.get-settings`、`.query-by-name` | [`folder.md`](references/folder.md) |
|
|
56
|
-
|
|
|
56
|
+
| 文件夹默认共享与八类权限、按权限反查、同步管理员/维护/下载/删除/复制/新建/移动/默认参与人/默认共享人到子文件夹 | `caizhilian run caizhilian.folder.default-share.*`、`caizhilian.folder.permission.*`、`.query-by-permission`、`.sync-setting`、`.sync-maintain`、`.sync-download`、`.sync-delete`、`.sync-copy`、`.sync-create`、`.sync-move`、`.sync-participant`、`.sync-default-share` | [`folder.md`](references/folder.md) |
|
|
57
57
|
| 标签增删查、参与人增删查、文档共享增删查 | `caizhilian run caizhilian.tag.*`、`caizhilian.participant.*`、`caizhilian.share.*` | [`collaboration.md`](references/collaboration.md) |
|
|
58
58
|
| 把人名/部门/分部/岗位/角色/客户解析成 ID | `caizhilian run caizhilian.org.search-*`、`caizhilian.user.current` | [`org-browser.md`](references/org-browser.md) |
|
|
59
59
|
| 附件上传/替换/下载(含 PDF 版)、封面上传/设置/移除、文档比对 | `caizhilian run caizhilian.attachment.*`、`caizhilian.cover.*`、`caizhilian.compare.*` | [`files.md`](references/files.md) |
|
|
@@ -67,6 +67,11 @@ cliHelp: "weaver-work-cli caizhilian --help"
|
|
|
67
67
|
| 任何写操作的确认链、票据报错、写结果不确定 | `<name>.prepare` -> 用户确认 -> `<name>.apply --continuation TOKEN --yes` | [`write-protocol.md`](references/write-protocol.md) |
|
|
68
68
|
| 环境列表 / 配置查看 / 重载配置 / 切换环境等未暴露能力 | 无 caizhilian 命令,改用框架命令 | [`withheld.md`](references/withheld.md) |
|
|
69
69
|
|
|
70
|
+
文件上传支持秒传、普通流式上传和分片流式上传;成功必须有非空文件 ID、大小校验与私有回执。
|
|
71
|
+
上传协议的 `lastModified`、`lastModifiedDate` 必须使用相同的整数毫秒值,由 CLI 自动处理;
|
|
72
|
+
小数毫秒可能触发 E10 整数解析错误,详见 [`file-upload.md`](references/file-upload.md) 的时间戳规则与失败处理。
|
|
73
|
+
认证沿用 `weaver-work-cli` 的共享规则;不执行独立文件上传 Skill 的 bundle 或独立浏览器登录。
|
|
74
|
+
|
|
70
75
|
处理链:
|
|
71
76
|
|
|
72
77
|
- 检索并阅读:`caizhilian.document.search` -> 用户选条目 -> `caizhilian.document.get` 取详情
|
|
@@ -1,309 +1,114 @@
|
|
|
1
|
-
|
|
2
|
-
name: weaver-file-upload
|
|
3
|
-
description: >-
|
|
4
|
-
Upload local files to the Weaver E10/eTeams file service with a bundled
|
|
5
|
-
single-file Node CLI through the recorded preUploadCheck and module/upload
|
|
6
|
-
protocol. Supports server-side second-hit, common streaming upload, chunked
|
|
7
|
-
upload, terminal fileId validation, safe metadata, and session-isolated
|
|
8
|
-
receipts. Use for Weaver file upload, attachment pre-upload, large-file
|
|
9
|
-
chunk upload, second upload, or when another workflow needs a verified
|
|
10
|
-
Weaver fileId from an absolute local path. Login is an explicit provider or
|
|
11
|
-
standalone-browser choice with no automatic fallback.
|
|
12
|
-
---
|
|
1
|
+
# 文件上传
|
|
13
2
|
|
|
14
|
-
|
|
3
|
+
本模块把一个本地文件上传到 E10 文件服务,返回经过校验的文件 ID 与本地回执。
|
|
4
|
+
上传协议采用 `weaver-file-upload` 的预检查、秒传、普通上传和分片上传契约。
|
|
5
|
+
文件绑定到文档、附件字段、表单或消息由调用方负责。
|
|
15
6
|
|
|
16
|
-
|
|
17
|
-
business-verified Weaver `fileId`. Binding that file to a form, document,
|
|
18
|
-
message, or other business object belongs to the caller.
|
|
7
|
+
## 运行与认证
|
|
19
8
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
- 唯一运行时为 `weaver-work-cli`;源码位于 `src/shortcuts/caizhilian/file-upload/`,
|
|
10
|
+
操作入口位于 `src/shortcuts/caizhilian/operations/handlers/file-upload.ts`。
|
|
11
|
+
- 安装与登录遵守 `../../weaver-e10-shared/SKILL.md`。认证只使用 CLI 当前身份或连接器注入的身份。
|
|
12
|
+
- 本模块不执行独立 Skill 的 `dist/weaver-file-upload.js`,不复用 `e10-login` 的会话,
|
|
13
|
+
不启动第二套 Chrome 登录;独立 Skill 的双登录模式不属于本 CLI 上传接口。
|
|
14
|
+
- 缺少会话或登录失效时按共享规则处理,不自行切换账号或环境。
|
|
24
15
|
|
|
25
|
-
##
|
|
16
|
+
## 操作与参数
|
|
26
17
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
mode owns its browser, validator, session, and cleanup. Failure never switches
|
|
34
|
-
to the other identity source.
|
|
18
|
+
| 操作 | 作用 | 必填 |
|
|
19
|
+
| --- | --- | --- |
|
|
20
|
+
| `caizhilian.file-upload.contract` | 获取完整命令、参数用途、策略和结果证据 | 无 |
|
|
21
|
+
| `caizhilian.file-upload.prepare` | 本地文件/上下文检查与 MD5、SHA256;不登录、不联网、不签发上传票据 | `file_path`、`module` |
|
|
22
|
+
| `caizhilian.file-upload.upload.prepare` | 用户授权检查、本地校验、绑定当前环境和身份的确认票据 | `file_path`、`module`、`user_confirmed=true` |
|
|
23
|
+
| `caizhilian.file-upload.upload.apply` | 校验确认票据和内容未变,再执行上传 | 上述参数、`continuation`、`confirm=true`(CLI 用 `--yes`) |
|
|
35
24
|
|
|
36
|
-
|
|
25
|
+
上传参数来自真实业务上下文,不能因为缺少可选字段阻塞基础上传。
|
|
37
26
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
```text
|
|
41
|
-
node "$SKILL_ROOT/dist/weaver-file-upload.js" contract \
|
|
42
|
-
--chat-id '<chatId>'
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Use `agent_callable_interface_contract.v1`; do not guess flags or learn them
|
|
46
|
-
through repeated help calls. All flags follow the command. Before requesting
|
|
47
|
-
missing upload inputs, show the contract's complete required, conditionally
|
|
48
|
-
required, and optional lists with their purposes. Reuse an existing host
|
|
49
|
-
attachment path instead of asking for it again.
|
|
50
|
-
|
|
51
|
-
## Workflow
|
|
52
|
-
|
|
53
|
-
```text
|
|
54
|
-
contract
|
|
55
|
-
-> prepare absolute file + context
|
|
56
|
-
-> explicit provider | standalone login
|
|
57
|
-
-> current-user upload authorization
|
|
58
|
-
-> preUploadCheck
|
|
59
|
-
-> second | common | chunk
|
|
60
|
-
-> terminal non-empty fileId
|
|
61
|
-
-> secret-free 0600 receipt
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Standalone login without a saved domain returns `status=requires_input`,
|
|
65
|
-
`channel=agent_conversation`, and `resumeArgument=--base-url`. Ask for the
|
|
66
|
-
non-secret OA/E10 root address in the current conversation, then resume:
|
|
67
|
-
|
|
68
|
-
```text
|
|
69
|
-
node "$SKILL_ROOT/dist/weaver-file-upload.js" login \
|
|
70
|
-
--chat-id '<chatId>' --login-mode standalone \
|
|
71
|
-
--base-url 'https://<runtime-host>'
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Provider validation:
|
|
75
|
-
|
|
76
|
-
```text
|
|
77
|
-
node "$SKILL_ROOT/dist/weaver-file-upload.js" login \
|
|
78
|
-
--chat-id '<chatId>' --login-mode weaver-e10-login
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
## Hard Rules
|
|
82
|
-
|
|
83
|
-
- `--file` and `--context-file` are absolute paths. `--chat-id` isolates
|
|
84
|
-
receipts under `runs/<chatId>/`, or the resolved private state root.
|
|
85
|
-
- `--module` is mandatory and comes from real caller business context. Never
|
|
86
|
-
guess `workflow`, `document`, or another module.
|
|
87
|
-
- `upload` requires `--user-confirmed` from the current user request. The CLI
|
|
88
|
-
rejects a missing confirmation before file, authentication, or network work.
|
|
89
|
-
- Context cannot override protocol-owned fields. File and chunk bodies remain
|
|
90
|
-
streaming; the complete large file is never buffered in memory.
|
|
91
|
-
- Never print or persist Cookie, ETEAMSID, token, Authorization, ticket,
|
|
92
|
-
password, signed URL, multipart body, or raw server response.
|
|
93
|
-
- HTTP 200 and `endChunk=true` are insufficient. Success requires a non-empty
|
|
94
|
-
terminal `fileId`; any nonzero server size must match the local file.
|
|
95
|
-
- A transport failure after an upload POST is
|
|
96
|
-
`execution_state=unknown`, is not retry-safe, and is never replayed
|
|
97
|
-
automatically.
|
|
98
|
-
- Use `receipt_ref` and `receipt_sha256` as terminal evidence.
|
|
99
|
-
|
|
100
|
-
## Resources
|
|
101
|
-
|
|
102
|
-
| Need | Read |
|
|
27
|
+
| 参数 | 用途 |
|
|
103
28
|
| --- | --- |
|
|
104
|
-
|
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
node "<skill_root>/dist/weaver-file-upload.js" prepare \
|
|
175
|
-
--chat-id '<chatId>' --file '<absoluteFilePath>' --module '<module>' \
|
|
176
|
-
[--context-file '<absoluteJsonObjectPath>']
|
|
177
|
-
|
|
178
|
-
node "<skill_root>/dist/weaver-file-upload.js" login \
|
|
179
|
-
--chat-id '<chatId>' \
|
|
180
|
-
--login-mode '<weaver-e10-login|standalone>' \
|
|
181
|
-
[--base-url '<runtimeRootUrl>']
|
|
182
|
-
|
|
183
|
-
node "<skill_root>/dist/weaver-file-upload.js" upload \
|
|
184
|
-
--chat-id '<chatId>' \
|
|
185
|
-
--login-mode '<weaver-e10-login|standalone>' \
|
|
186
|
-
--user-confirmed --file '<absoluteFilePath>' --module '<module>' \
|
|
187
|
-
[--context-file '<absoluteJsonObjectPath>']
|
|
29
|
+
| `file_path` | 普通文件绝对路径;拒绝符号链接,复用已有宿主附件路径 |
|
|
30
|
+
| `module` | 真实业务模块,1–64 个字母、数字或 `._-`;无默认值,禁止猜测 |
|
|
31
|
+
| `user_confirmed` | 当前用户对本文件上传的明确授权;必须为布尔 `true` |
|
|
32
|
+
| `context_file`(可选) | 可选业务上下文 JSON 对象文件绝对路径,最大 64 KiB、嵌套最多 12 层 |
|
|
33
|
+
| `chat_id`(可选) | 宿主对话标识,隔离回执;1–128 个字母、数字或 `._-`,默认 `cli` |
|
|
34
|
+
| `timeout_seconds`(可选) | 每次请求及响应读取的超时上限,1–3600 秒,默认 300 |
|
|
35
|
+
|
|
36
|
+
`context_file` 可包含真实业务提供的 `source`(来源场景)、`fieldId`(附件字段)、
|
|
37
|
+
`sourceRefId`(来源对象)、`authModule`(鉴权模块)、`customParam`(模块扩展)、
|
|
38
|
+
`refId`(关联对象)、`commonText`(通用扩展)、`folderId`(目标文件夹)。
|
|
39
|
+
空字符串按原业务语义保留。上下文不得包含凭证或危险对象键,也不能覆盖协议自动字段:
|
|
40
|
+
`sf_request_type`、`compressImg`、`module`、`name`、`size`、`MD5`、`lastModified`、
|
|
41
|
+
`lastModifiedDate`、`preUploadId`、`uploadType`、`uploadShardSize`、`chunk`、`chunks`、`file`。
|
|
42
|
+
|
|
43
|
+
### 上传时间戳规则
|
|
44
|
+
|
|
45
|
+
`lastModified` 与 `lastModifiedDate` 是自 Unix epoch 起的**整数毫秒**,两个字段必须一致。
|
|
46
|
+
Node.js `stat().mtimeMs` 可能含小数;CLI 仅在生成协议字段时使用
|
|
47
|
+
`String(Math.floor(file.mtime_ms))`,例如 `1791798507076.7322` 转为 `1791798507076`。
|
|
48
|
+
预检查、普通上传及每个分片都复用该整数值。不能直接提交带小数的 `mtimeMs`,也不能换成秒。
|
|
49
|
+
|
|
50
|
+
本地用于检测文件变更的修改时间保留原始精度;无需修改源文件的时间属性。
|
|
51
|
+
这些字段由 CLI 生成,不需要用户提供,也不能通过 `context_file` 覆盖。
|
|
52
|
+
移植上传协议或维护其他运行时时,必须保留此归一化规则。
|
|
53
|
+
|
|
54
|
+
## 上传与结果验证
|
|
55
|
+
|
|
56
|
+
1. 未确认上传时,在文件读取、认证和网络操作前拒绝 `upload.prepare/apply`。
|
|
57
|
+
2. 票据绑定环境、身份、完整入参、文件 SHA256 和上下文哈希;确认后改变文件或上下文必须重新 prepare。
|
|
58
|
+
3. 执行 `preUploadCheck`,两个上传接口均固定 `sf_request_type=ajax`。
|
|
59
|
+
4. `second` 直接解析已有文件对象;`common` 流式上传整个文件;`chunk` 使用服务端 MiB 分片大小,
|
|
60
|
+
逐片发送精确切片、零起始编号、总片数与实际片字节数。未知策略和缺少预检字段直接失败。
|
|
61
|
+
5. 中间分片必须明确 `endChunk=false` 且没有终态文件 ID;最终结果必须包含非空文件 ID。
|
|
62
|
+
服务端返回的非零大小必须与本地一致;HTTP 200 或 `endChunk=true` 本身不能证明成功。
|
|
63
|
+
6. 文件不会整体缓存在内存。multipart 使用精确 `Content-Length`,包含安全文件名和 RFC 5987 UTF-8 文件名。
|
|
64
|
+
响应最大 4 MiB,保留大整数文件 ID 的字符串精度。
|
|
65
|
+
|
|
66
|
+
成功结果包含 `version=weaver_file_upload_result.v1`、`business_verified=true`、
|
|
67
|
+
`upload_type`、归一化 `file`、`integrity.md5/sha256`、安全 `request_evidence`、
|
|
68
|
+
`receipt_ref` 与 `receipt_sha256`。同时保留兼容字段 `file_id`、`file_name`、`size`、`ext`。
|
|
69
|
+
|
|
70
|
+
回执位于 CLI 私有状态目录下的 `caizhilian/file-upload/runs/<chat_id>/receipts/`,
|
|
71
|
+
POSIX 文件权限为 `0600`、回执目录为 `0700`。回执只保存归一化元数据和哈希,
|
|
72
|
+
不保存凭证、签名 URL、业务上下文值、multipart 或原始服务端响应。
|
|
73
|
+
|
|
74
|
+
## 失败处理
|
|
75
|
+
|
|
76
|
+
- 上传 POST 后的连接中断、响应读取或协议失败返回 `partial/write_uncertain`,
|
|
77
|
+
`execution_state=unknown`、`retry_safe=false`,不得自动重放。
|
|
78
|
+
- 文件上传已确认成功但回执写入失败返回 `partial/receipt_write_failed`,携带已上传文件 ID;
|
|
79
|
+
不得因回执失败重新上传。
|
|
80
|
+
- 服务端明确拒绝、策略无效、分片不一致、文件 ID 缺失或大小不符都是失败;不得报告为上传成功。
|
|
81
|
+
- 若 `/api/file/module/upload` 返回业务 `code=500`(HTTP 可能仍为 200),且错误含
|
|
82
|
+
`For input string: "1791798507076.7322"` 这类带小数的毫秒时间戳,说明提交值触发整数解析错误。
|
|
83
|
+
检查所用 CLI 是否包含时间戳归一化修复;维护其他运行时时核对上述两个字段。
|
|
84
|
+
不能仅凭 500 判定为此问题;结果不确定时仍遵守不得自动重放的规则。
|
|
85
|
+
- 本地准备和预检失败没有上传文件内容的副作用。重新上传必须是用户授权的新事务。
|
|
86
|
+
|
|
87
|
+
## 命令示例
|
|
88
|
+
|
|
89
|
+
先读取 contract。下面的 `document` 只示意真实文档业务;使用时必须来自当前调用方场景。
|
|
90
|
+
只有用户已经明确确认后,才传 `user_confirmed=true`,并遵守共享规则的连接器参数要求。
|
|
91
|
+
|
|
92
|
+
Windows PowerShell:
|
|
93
|
+
|
|
94
|
+
```powershell
|
|
95
|
+
weaver-work-cli --json caizhilian run caizhilian.file-upload.contract
|
|
96
|
+
weaver-work-cli --json caizhilian run caizhilian.file-upload.prepare --input-json '{"file_path":"C:\\data\\report.pdf","module":"document"}'
|
|
97
|
+
weaver-work-cli --json caizhilian run caizhilian.file-upload.upload.prepare --input-json '{"file_path":"C:\\data\\report.pdf","module":"document","user_confirmed":true,"chat_id":"current-chat"}'
|
|
98
|
+
weaver-work-cli --json caizhilian run caizhilian.file-upload.upload.apply --input-json '{"file_path":"C:\\data\\report.pdf","module":"document","user_confirmed":true,"chat_id":"current-chat"}' --continuation TOKEN --yes
|
|
188
99
|
```
|
|
189
100
|
|
|
190
|
-
|
|
191
|
-
`--base-url` is valid only for `login` in standalone mode.
|
|
192
|
-
|
|
193
|
-
## Input Contract
|
|
194
|
-
|
|
195
|
-
- `chatId`: 1-128 ASCII letters, digits, dot, underscore, or hyphen.
|
|
196
|
-
- `file`: absolute path to a readable regular, non-symlink file.
|
|
197
|
-
- `module`: 1-64 ASCII letters, digits, dot, underscore, or hyphen.
|
|
198
|
-
- `context-file`: optional absolute path to a UTF-8 JSON object up to 64 KiB.
|
|
199
|
-
Object keys cannot override protocol fields; nested unsafe object keys and
|
|
200
|
-
nesting deeper than 12 levels are rejected.
|
|
201
|
-
- `timeout`: optional positive seconds up to 3600.
|
|
202
|
-
- `provider-timeout`: optional positive seconds up to 3600.
|
|
203
|
-
- `user-confirmed`: mandatory for `upload` and valid only for the current user
|
|
204
|
-
request and file.
|
|
205
|
-
- `login-mode`: `weaver-e10-login` or `standalone`. Failure never changes it.
|
|
206
|
-
|
|
207
|
-
Reserved fields are published by `references/file-upload-cli-contract.json`. Known optional
|
|
208
|
-
context fields and their purposes are in `references/file-upload-input-parameters.md`.
|
|
209
|
-
|
|
210
|
-
## Upload Strategies
|
|
211
|
-
|
|
212
|
-
Every file-bearing multipart request emits a sanitized quoted `filename`
|
|
213
|
-
fallback and an RFC 5987 `filename*=UTF-8''...` value. The extended value
|
|
214
|
-
percent-encodes UTF-8 bytes and the reserved characters `'`, `(`, `)`, and
|
|
215
|
-
`*`, including filenames that combine Chinese text, spaces, and those
|
|
216
|
-
characters.
|
|
217
|
-
|
|
218
|
-
### `second`
|
|
219
|
-
|
|
220
|
-
The preflight already returns an existing file object, so no upload body is
|
|
221
|
-
sent. The file ID is resolved from direct data, `uploadModuleDto`,
|
|
222
|
-
`imUploadInfoDto`, or their `fileObj`. A returned nonzero size must equal the
|
|
223
|
-
local size.
|
|
224
|
-
|
|
225
|
-
### `common`
|
|
101
|
+
macOS/Linux(bash/zsh):
|
|
226
102
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
Require `preUploadId` and a positive `chunkDto.chunkSize`, interpreted as MiB.
|
|
234
|
-
Calculate local chunk count; if the server supplies `chunkCount`, it must match.
|
|
235
|
-
Send zero-based slices with exact `uploadShardSize`, `chunk`, and `chunks`.
|
|
236
|
-
Intermediate responses must be explicitly nonterminal. The final response must
|
|
237
|
-
contain the terminal file ID.
|
|
238
|
-
|
|
239
|
-
Unknown or empty upload types stop before an upload body is sent.
|
|
240
|
-
|
|
241
|
-
## Business Validation
|
|
242
|
-
|
|
243
|
-
- HTTP status is exactly 200 and redirects are rejected.
|
|
244
|
-
- HTML and non-object JSON responses are rejected.
|
|
245
|
-
- `status=false`, `success=false`, `fail=true`, or a non-success code is a
|
|
246
|
-
business failure.
|
|
247
|
-
- Preflight data is an object; network branches include `preUploadId`.
|
|
248
|
-
- Final file ID is nonempty; returned nonzero size equals local size.
|
|
249
|
-
- `endChunk=true` without a file ID is not terminal success.
|
|
250
|
-
|
|
251
|
-
Responses are bounded to 4 MiB. Raw responses, credentials, signed URLs, and
|
|
252
|
-
multipart bodies are neither returned nor saved.
|
|
253
|
-
|
|
254
|
-
## Result Contract
|
|
255
|
-
|
|
256
|
-
Successful upload returns `weaver_file_upload_result.v1`:
|
|
257
|
-
|
|
258
|
-
```json
|
|
259
|
-
{
|
|
260
|
-
"status": "completed",
|
|
261
|
-
"business_verified": true,
|
|
262
|
-
"upload_type": "second|common|chunk",
|
|
263
|
-
"file": {
|
|
264
|
-
"file_id": "...",
|
|
265
|
-
"name": "...",
|
|
266
|
-
"size": 123,
|
|
267
|
-
"mime_type": "...",
|
|
268
|
-
"extension": "...",
|
|
269
|
-
"is_image": false
|
|
270
|
-
},
|
|
271
|
-
"integrity": {"md5": "...", "sha256": "..."},
|
|
272
|
-
"request_evidence": {
|
|
273
|
-
"module": "...",
|
|
274
|
-
"context_keys": [],
|
|
275
|
-
"context_sha256": "...",
|
|
276
|
-
"environment_identity_sha256": "...",
|
|
277
|
-
"login_mode": "weaver-e10-login|standalone",
|
|
278
|
-
"automatic_fallback": false
|
|
279
|
-
},
|
|
280
|
-
"receipt_ref": "/absolute/private/path.json",
|
|
281
|
-
"receipt_sha256": "..."
|
|
282
|
-
}
|
|
103
|
+
```bash
|
|
104
|
+
weaver-work-cli --json caizhilian run caizhilian.file-upload.contract
|
|
105
|
+
weaver-work-cli --json caizhilian run caizhilian.file-upload.prepare --input-json '{"file_path":"/data/report.pdf","module":"document"}'
|
|
106
|
+
weaver-work-cli --json caizhilian run caizhilian.file-upload.upload.prepare --input-json '{"file_path":"/data/report.pdf","module":"document","user_confirmed":true,"chat_id":"current-chat"}'
|
|
107
|
+
weaver-work-cli --json caizhilian run caizhilian.file-upload.upload.apply --input-json '{"file_path":"/data/report.pdf","module":"document","user_confirmed":true,"chat_id":"current-chat"}' --continuation TOKEN --yes
|
|
283
108
|
```
|
|
284
109
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
## Authentication Boundary
|
|
288
|
-
|
|
289
|
-
Provider mode resolves only `e10-login whoami`. Its raw output remains in the
|
|
290
|
-
child process boundary. The Node adapter bounds stdout, drains stderr, validates
|
|
291
|
-
domain/session/identity fields, and calls the same business validator before
|
|
292
|
-
use.
|
|
293
|
-
|
|
294
|
-
Standalone mode resolves a runtime root from explicit input, environment, or
|
|
295
|
-
this Skill's `.env.local`. Missing domain returns an Agent-conversation handoff.
|
|
296
|
-
It launches an isolated Chrome, reads `DevToolsActivePort`, obtains same-origin
|
|
297
|
-
cookies through CDP, and requires `ETEAMSID` plus a successful side-effect-free
|
|
298
|
-
`teamsCheck` identity. It then atomically writes a `0600` session and closes the
|
|
299
|
-
owned browser and process tree.
|
|
300
|
-
|
|
301
|
-
## Failure And Recovery
|
|
110
|
+
## 验证范围
|
|
302
111
|
|
|
303
|
-
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
- Do not replay an outcome-unknown upload. A later user-authorized attempt begins
|
|
307
|
-
with a new `preUploadCheck` and is a separate transaction.
|
|
308
|
-
- Missing terminal ID, early terminal chunk, inconsistent count, or size mismatch
|
|
309
|
-
is a hard failure with safe diagnostics only.
|
|
112
|
+
`test/business/caizhilian-file-upload.test.ts` 使用本机 HTTP 服务验证真实 multipart 传输、
|
|
113
|
+
三种上传策略、带小数毫秒的文件修改时间归一化、内容变更保护、授权门禁、回执和失败恢复。
|
|
114
|
+
此验证不等于真实 E10 租户验证。
|
|
@@ -46,7 +46,15 @@
|
|
|
46
46
|
| `caizhilian.folder.permission.add` | `folder_id`、`permission_type`、`obj_type` | `obj_id`、`obj_id_department`、`obj_id_subcompany`、`obj_id_role`、`obj_id_position`、`obj_id_customer`、`obj_id_customer_type`、`department_attribute`、`role_level`、`position_level`、`position_attribute`、`position_level_department`、`position_level_subcompany` |
|
|
47
47
|
| `caizhilian.folder.permission.delete` | `folder_id`、`permission_type`、`ids` | 无 |
|
|
48
48
|
| `caizhilian.folder.permission.set-auth` | `folder_id`、`permission_type`、`value`(`true`/`user`/`false`) | 无 |
|
|
49
|
-
| `caizhilian.folder.permission.sync-setting` | `id`(文件夹 ID
|
|
49
|
+
| `caizhilian.folder.permission.sync-setting` | `id`(文件夹 ID)、`keepOldSettingForAllFolders` | 无 |
|
|
50
|
+
| `caizhilian.folder.permission.sync-maintain` | `id`(文件夹 ID)、`keepOldSettingForAllFolders` | 无 |
|
|
51
|
+
| `caizhilian.folder.permission.sync-download` | `id`(文件夹 ID) | `keepOldSettingForAllFolders`(仅当下载权限为"允许以下人员下载"时必填) |
|
|
52
|
+
| `caizhilian.folder.permission.sync-delete` | `id`(文件夹 ID) | `keepOldSettingForAllFolders`(仅当删除权限为"允许以下人员删除文档"时必填) |
|
|
53
|
+
| `caizhilian.folder.permission.sync-copy` | `id`(文件夹 ID)、`keepOldSettingForAllFolders` | 无 |
|
|
54
|
+
| `caizhilian.folder.permission.sync-create` | `id`(文件夹 ID)、`keepOldSettingForAllFolders` | 无 |
|
|
55
|
+
| `caizhilian.folder.permission.sync-move` | `id`(文件夹 ID)、`keepOldSettingForAllFolders` | 无 |
|
|
56
|
+
| `caizhilian.folder.permission.sync-participant` | `id`(文件夹 ID)、`sync_to_folder_docs`、`sync_to_all_folders`、`sync_to_all_sub_folder_docs`(至少选一个) | `keep_old_for_folder_docs`、`keep_old_for_all_folders`、`keep_old_for_all_sub_folder_docs`(默认 true) |
|
|
57
|
+
| `caizhilian.folder.permission.sync-default-share` | `id`(文件夹 ID)、`sync_to_folder_docs`、`sync_to_all_folders`、`sync_to_all_sub_folder_docs`(至少选一个) | `keep_old_default_share_for_folder_docs`、`keep_old_non_default_share_for_folder_docs`、`keep_old_default_share_for_all_folders`、`keep_old_default_share_for_sub_folder_docs`、`keep_old_non_default_share_for_sub_folder_docs`(默认 true) |
|
|
50
58
|
|
|
51
59
|
- `folder.create` 的 `parent_type=privy`(个人)时,`sequence` 强制为 `0`、`inherit_parent` 强制为 `false`(源行为)。
|
|
52
60
|
- `obj_type` 与 `share_level` 不要猜:先用 `default-share.form` / `permission.form` 拿到 `obj_types[].id` 和级联参数,再决定要传哪些 `obj_id*` 字段;传了 `obj_type` 未配置的对象字段会报 `validation/obj_type_not_configured` 或 `obj_type_not_supported`。
|
|
@@ -65,6 +73,14 @@ weaver-work-cli --json caizhilian run caizhilian.folder.create.prepare --input-j
|
|
|
65
73
|
weaver-work-cli --json caizhilian run caizhilian.folder.create.apply --input-json '{"name":"2026 合同","parent_id":"456","parent_type":"company","inherit_parent":true}' --continuation TOKEN --yes
|
|
66
74
|
weaver-work-cli --json caizhilian run caizhilian.folder.permission.set-auth.prepare --input-json '{"folder_id":"456","permission_type":"downloadPremisstion","value":"user"}'
|
|
67
75
|
weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-setting.prepare --input-json '{"id":"456","keepOldSettingForAllFolders":true}'
|
|
76
|
+
weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-maintain.prepare --input-json '{"id":"456","keepOldSettingForAllFolders":true}'
|
|
77
|
+
weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-download.prepare --input-json '{"id":"456","keepOldSettingForAllFolders":true}'
|
|
78
|
+
weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-delete.prepare --input-json '{"id":"456","keepOldSettingForAllFolders":true}'
|
|
79
|
+
weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-copy.prepare --input-json '{"id":"456","keepOldSettingForAllFolders":true}'
|
|
80
|
+
weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-create.prepare --input-json '{"id":"456","keepOldSettingForAllFolders":true}'
|
|
81
|
+
weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-move.prepare --input-json '{"id":"456","keepOldSettingForAllFolders":true}'
|
|
82
|
+
weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-participant.prepare --input-json '{"id":"456","sync_to_all_folders":true}'
|
|
83
|
+
weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-default-share.prepare --input-json '{"id":"456","sync_to_all_folders":true}'
|
|
68
84
|
```
|
|
69
85
|
|
|
70
86
|
macOS/Linux(bash/zsh):
|
|
@@ -77,6 +93,14 @@ weaver-work-cli --json caizhilian run caizhilian.folder.create.prepare --input-j
|
|
|
77
93
|
weaver-work-cli --json caizhilian run caizhilian.folder.create.apply --input-json '{"name":"2026 合同","parent_id":"456","parent_type":"company","inherit_parent":true}' --continuation TOKEN --yes
|
|
78
94
|
weaver-work-cli --json caizhilian run caizhilian.folder.permission.set-auth.prepare --input-json '{"folder_id":"456","permission_type":"downloadPremisstion","value":"user"}'
|
|
79
95
|
weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-setting.prepare --input-json '{"id":"456","keepOldSettingForAllFolders":true}'
|
|
96
|
+
weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-maintain.prepare --input-json '{"id":"456","keepOldSettingForAllFolders":true}'
|
|
97
|
+
weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-download.prepare --input-json '{"id":"456","keepOldSettingForAllFolders":true}'
|
|
98
|
+
weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-delete.prepare --input-json '{"id":"456","keepOldSettingForAllFolders":true}'
|
|
99
|
+
weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-copy.prepare --input-json '{"id":"456","keepOldSettingForAllFolders":true}'
|
|
100
|
+
weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-create.prepare --input-json '{"id":"456","keepOldSettingForAllFolders":true}'
|
|
101
|
+
weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-move.prepare --input-json '{"id":"456","keepOldSettingForAllFolders":true}'
|
|
102
|
+
weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-participant.prepare --input-json '{"id":"456","sync_to_all_folders":true}'
|
|
103
|
+
weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-default-share.prepare --input-json '{"id":"456","sync_to_all_folders":true}'
|
|
80
104
|
```
|
|
81
105
|
|
|
82
106
|
## 输出处理
|
|
@@ -92,7 +116,7 @@ weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-setting.
|
|
|
92
116
|
- `permission.detail` 返回 `{ title, current_setting, list_label, items[] }`;`setting_type=defaultShares` 时只返回 `{ title, items[] }`。
|
|
93
117
|
- `permission.query` 返回 `{ permissions }`:以 `folder_id` 为 key 的映射,每个 value 含 `isCreateDoc`、`isCreateFolder`、`canMoveDoc`、`canCopyDoc` 四个布尔标志与 `allowDocumentCreateTypes`(允许创建的文档类型列表,无设置时为空数组)。建文档前可用它确认目标文件夹是否允许创建及允许的文档类型。
|
|
94
118
|
- `query-by-permission` 返回 `{ total, page_no, page_size, has_next, folders[] }`,每项含 `folder_id`、`folder_name`、`folder_type`。返回空数组只表示「没有匹配到」:先按上文核对 `object_ids` 是不是对象的真实 ID,再如实把结果告诉用户;**不要据此断定「反查不支持该权限类型」**。返回里没有文件夹路径,需要展示路径时用 `get-settings` 的 `currentFolder.title` 或 `query-by-name` 补。
|
|
95
|
-
- 写操作 `apply` 返回结果回显:`default-share.add` → `{ added: true, default_shares }` 或 `{ added: false, message }`(服务端判定「已存在」不是失败,必须把 message 转述给用户);`default-share.delete` → `{ deleted: true, default_shares }`;`permission.add` → `{ added: true, shares }`;`permission.delete` → `{ deleted: true, shares }`;`permission.set-auth` → `{ permission_type, value, current_value }`;`permission.sync-setting` → `{ existChildFolder }`。
|
|
119
|
+
- 写操作 `apply` 返回结果回显:`default-share.add` → `{ added: true, default_shares }` 或 `{ added: false, message }`(服务端判定「已存在」不是失败,必须把 message 转述给用户);`default-share.delete` → `{ deleted: true, default_shares }`;`permission.add` → `{ added: true, shares }`;`permission.delete` → `{ deleted: true, shares }`;`permission.set-auth` → `{ permission_type, value, current_value }`;`permission.sync-setting` → `{ existChildFolder }`;`permission.sync-maintain` → `{ existChildFolder }`;`permission.sync-download` → `{ existChildFolder }`;`permission.sync-delete` → `{ existChildFolder }`;`permission.sync-copy` → `{ existChildFolder }`;`permission.sync-create` → `{ existChildFolder }`;`permission.sync-move` → `{ existChildFolder }`;`permission.sync-participant` → `{ existChildFolder, existChildDocument, asyncKey }`;`permission.sync-default-share` → `{ existChildFolder, existChildDocument, asyncKey }`。
|
|
96
120
|
- 权限/共享类写操作的 `prepare` 返回请求体预览 + `continuation`;向用户摘要时必须写清「哪个文件夹、哪项权限、给谁、什么级别」,并说明删除类操作不可撤销。
|
|
97
121
|
- 列表类结果默认用 Markdown 表格摘要(文件夹名/路径/权限类型/对象/级别),不要原样贴 JSON。
|
|
98
122
|
|
|
@@ -101,7 +125,11 @@ weaver-work-cli --json caizhilian run caizhilian.folder.permission.sync-setting.
|
|
|
101
125
|
- 文件夹权限与默认共享是**影响面很大的配置**:改错会导致整个知识库的下载、复制、新建权限对全员开放或全部收紧。`permission.set-auth` 从 `user` 改成 `true` 等于放开给所有人,确认摘要里必须显式写出这一后果。
|
|
102
126
|
- `folder.create` 会在服务端产生新节点;`inherit_parent=true` 会连带继承父文件夹的权限与默认设置,必须在确认摘要里说明。
|
|
103
127
|
- 删除类(`default-share.delete` / `permission.delete`)必须先做一次对应 `list` 只读查询,把待删条目的可读信息展示给用户后再 prepare。
|
|
104
|
-
- `permission.sync-setting`
|
|
128
|
+
- `permission.sync-setting`、`permission.sync-maintain`、`permission.sync-copy`、`permission.sync-create`、`permission.sync-move` 的 `keepOldSettingForAllFolders` 是**必填参数**,必须明确传入 `true`(保留原有设置)或 `false`(不保留),否则会报错。执行前必须提醒用户此操作对系统性能可能有一定影响。
|
|
129
|
+
- `permission.sync-participant` 是**异步操作**,支持三种同步范围:同步到当前文件夹内的历史文档(`sync_to_folder_docs`)、同步到所有下级文件夹(`sync_to_all_folders`)、同步到所有下级文件夹内的历史文档(`sync_to_all_sub_folder_docs`),**至少选择一个**。每个选中的范围对应的"原有参与人"参数(`keep_old_for_folder_docs`、`keep_old_for_all_folders`、`keep_old_for_all_sub_folder_docs`)默认为 `true`(保留)。执行后会自动轮询进度,超时时间为 300 秒。
|
|
130
|
+
- `permission.sync-default-share` 是**异步操作**,支持三种同步范围:同步到当前文件夹内的历史文档(`sync_to_folder_docs`)、同步到所有下级文件夹(`sync_to_all_folders`)、同步到所有下级文件夹内的历史文档(`sync_to_all_sub_folder_docs`),**至少选择一个**。每个选中的范围对应的"原有默认共享人"和"原有非默认共享人"参数默认为 `true`(保留)。执行后会自动轮询进度,超时时间为 300 秒。
|
|
131
|
+
- `permission.sync-download` 的行为取决于当前下载权限设置:当下载权限为"允许所有人下载"或"不允许下载"时,直接同步到所有下级文件夹,不需要 `keepOldSettingForAllFolders` 参数;当下载权限为"允许以下人员下载"时,`keepOldSettingForAllFolders` 是**必填参数**,必须明确传入 `true`(保留原有下载权限设置)或 `false`(不保留)。
|
|
132
|
+
- `permission.sync-delete` 的行为取决于当前删除权限设置:当删除权限为"允许完全控制权限人员删除文档"时,直接同步到所有下级文件夹,不需要 `keepOldSettingForAllFolders` 参数;当删除权限为"允许以下人员删除文档"时,`keepOldSettingForAllFolders` 是**必填参数**,必须明确传入 `true`(保留原有删除权限设置)或 `false`(不保留)。
|
|
105
133
|
- 本 reference 只覆盖文件夹与权限;文档级共享/参与人/标签见 `collaboration.md`。
|
|
106
134
|
|
|
107
135
|
## 失败处理
|