@qodercn-ai/qmind-cli 3.0.0 → 3.1.0
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/CHANGELOG.md +10 -0
- package/CHANGELOG.zh-CN.md +10 -0
- package/README.md +12 -13
- package/README.zh-CN.md +12 -13
- package/dist/bot-gateway-Hzjl50zu.js +373 -0
- package/dist/cards-DsMbd-g1.js +132 -0
- package/dist/{imports-Da88W09Q.js → imports-B01ERZgD.js} +3 -3
- package/dist/{management-xYuUDFtg.js → management-BIYQa9Al.js} +5 -4
- package/dist/notes-BvucEfdi.js +128 -0
- package/dist/qmind.js +163 -362
- package/dist/{shared-DwycozMA.js → shared-BkQJzIZF.js} +14 -6
- package/dist/source-upload-DBm1Hyki.js +17 -0
- package/dist/transfers-F1ZLLBdU.js +237 -0
- package/package.json +3 -3
- package/dist/cards-2J6ebaI0.js +0 -75
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@ English (default) | [简体中文](CHANGELOG.zh-CN.md)
|
|
|
4
4
|
|
|
5
5
|
Published versions below describe the Global CLI/shared implementation, not historical CN releases. CN will join the shared history with the future joint release.
|
|
6
6
|
|
|
7
|
+
## 3.1.0
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- bd500e8: Remove the `cards` command group and its top-level `list` / `search` aliases, following the Cards sunset policy. The dedicated card-list rendering path is removed as well; `retrieve` keeps its own card rendering and remains the way to query notebook context.
|
|
12
|
+
|
|
13
|
+
### Changes without version bumps
|
|
14
|
+
|
|
15
|
+
- Make CLI release verification recognize equivalent SSH and HTTPS repository destinations, and make settlement regression tests deterministic in depth-one CI checkouts. This changes release tooling only; package bytes and versions remain unchanged.
|
|
16
|
+
|
|
7
17
|
## 3.0.0
|
|
8
18
|
|
|
9
19
|
### Major Changes
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
以下已发布版本属于 Global CLI / 共享实现,不代表 CN 曾发布过这些版本。CN 将在后续共同发行版加入同一历史。
|
|
6
6
|
|
|
7
|
+
## 3.1.0
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- bd500e8: 按照 Cards 下线策略,移除 `cards` 命令组及其顶层 `list` / `search` 别名,并一并删除专用的卡片列表渲染路径;`retrieve` 保留自身的卡片渲染,仍可用于查询知识库上下文。
|
|
12
|
+
|
|
13
|
+
### Changes without version bumps
|
|
14
|
+
|
|
15
|
+
- 让 CLI 发布校验能够识别等价的 SSH 与 HTTPS 仓库目标,并使 settlement 回归测试在 depth-one CI checkout 中保持确定性。本次只修改发布工具,不改变包字节或版本。
|
|
16
|
+
|
|
7
17
|
## 3.0.0
|
|
8
18
|
|
|
9
19
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -44,19 +44,18 @@ Do not put tokens in command arguments, repositories, or logs. Run `qmind-cn log
|
|
|
44
44
|
|
|
45
45
|
## Commands
|
|
46
46
|
|
|
47
|
-
| Command
|
|
48
|
-
|
|
|
49
|
-
| `login` / `logout`
|
|
50
|
-
| `notebook`
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
57
|
-
| `
|
|
58
|
-
| `
|
|
59
|
-
| `version` | Print version and build information |
|
|
47
|
+
| Command | Purpose |
|
|
48
|
+
| ------------------------ | ---------------------------------------- |
|
|
49
|
+
| `login` / `logout` | Sign in or remove local credentials |
|
|
50
|
+
| `notebook` | Manage knowledge bases |
|
|
51
|
+
| `source` | Manage knowledge-base sources |
|
|
52
|
+
| `retrieve` | Retrieve context without invoking an LLM |
|
|
53
|
+
| `rag` | Ask questions using a knowledge base |
|
|
54
|
+
| `compile` / `lint` | Run compilation or validation workflows |
|
|
55
|
+
| `task` | Manage task runs |
|
|
56
|
+
| `upload-folder` / `sync` | Synchronize a local directory |
|
|
57
|
+
| `image` | Obtain image upload or access URLs |
|
|
58
|
+
| `version` | Print version and build information |
|
|
60
59
|
|
|
61
60
|
Run `qmind-cn <command> --help` for complete options. Domain commands support formats such as `table`, `json`, `agent`, and `ndjson`. stdout contains results; progress and diagnostics go to stderr. Exit codes are `0` for success, `1` for runtime failure/partial success/cancellation, and `2` for invalid usage.
|
|
62
61
|
|
package/README.zh-CN.md
CHANGED
|
@@ -44,19 +44,18 @@ qmind-cn retrieve --nb <notebook-id> --format agent "部署流程是什么?"
|
|
|
44
44
|
|
|
45
45
|
## 命令
|
|
46
46
|
|
|
47
|
-
| 命令
|
|
48
|
-
|
|
|
49
|
-
| `login` / `logout`
|
|
50
|
-
| `notebook`
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
57
|
-
| `
|
|
58
|
-
| `
|
|
59
|
-
| `version` | 查看版本和构建信息 |
|
|
47
|
+
| 命令 | 用途 |
|
|
48
|
+
| ------------------------ | --------------------------- |
|
|
49
|
+
| `login` / `logout` | 登录或清除本机凭证 |
|
|
50
|
+
| `notebook` | 管理知识库 |
|
|
51
|
+
| `source` | 管理知识库来源 |
|
|
52
|
+
| `retrieve` | 检索上下文,不发起 LLM 调用 |
|
|
53
|
+
| `rag` | 基于知识库提问 |
|
|
54
|
+
| `compile` / `lint` | 运行编译或检查工作流 |
|
|
55
|
+
| `task` | 管理任务运行 |
|
|
56
|
+
| `upload-folder` / `sync` | 同步本地目录 |
|
|
57
|
+
| `image` | 获取图片上传地址或访问地址 |
|
|
58
|
+
| `version` | 查看版本和构建信息 |
|
|
60
59
|
|
|
61
60
|
使用 `qmind-cn <command> --help` 查看完整参数。领域命令支持 `table`、`json`、`agent`、`ndjson` 等输出格式。stdout 只输出结果,进度与诊断信息输出到 stderr。退出码 `0` 表示成功,`1` 表示运行失败、部分成功或取消,`2` 表示参数错误。
|
|
62
61
|
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import { Y as timestampSchema, a as invalidArgument, c as optionalRecord, d as pagination, h as requiredText, l as optionalString, m as requiredString, n as call, p as queryPath, r as compactUndefined, s as optionalBoolean, t as assertNonEmptyPatch, u as optionalTrimmedString } from "./shared-BkQJzIZF.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region ../sdk/src/operations/bot-gateway-codecs.ts
|
|
4
|
+
const botTimestamp = z.preprocess((value) => typeof value === "object" && value !== null && !Array.isArray(value) && !("seconds" in value) ? {
|
|
5
|
+
...value,
|
|
6
|
+
seconds: 0
|
|
7
|
+
} : value, timestampSchema).optional();
|
|
8
|
+
const jsonObject = z.record(z.string(), z.json());
|
|
9
|
+
const fields = {
|
|
10
|
+
id: z.string().min(1),
|
|
11
|
+
org_id: z.string().default(""),
|
|
12
|
+
platform: z.string().default(""),
|
|
13
|
+
is_active: z.boolean().default(false),
|
|
14
|
+
created_at: botTimestamp,
|
|
15
|
+
updated_at: botTimestamp
|
|
16
|
+
};
|
|
17
|
+
function base(value) {
|
|
18
|
+
return {
|
|
19
|
+
id: value.id,
|
|
20
|
+
orgId: value.org_id,
|
|
21
|
+
platform: value.platform,
|
|
22
|
+
isActive: value.is_active,
|
|
23
|
+
...value.created_at === void 0 ? {} : { createdAt: value.created_at },
|
|
24
|
+
...value.updated_at === void 0 ? {} : { updatedAt: value.updated_at }
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const platformAppSchema = z.object({
|
|
28
|
+
...fields,
|
|
29
|
+
app_name: z.string().default(""),
|
|
30
|
+
client_id: z.string().default("")
|
|
31
|
+
}).transform((value) => ({
|
|
32
|
+
...base(value),
|
|
33
|
+
appName: value.app_name,
|
|
34
|
+
clientId: value.client_id
|
|
35
|
+
}));
|
|
36
|
+
const expertBindingSchema = z.object({
|
|
37
|
+
...fields,
|
|
38
|
+
user_id: z.string().default(""),
|
|
39
|
+
platform_app_id: z.string().default(""),
|
|
40
|
+
external_union_id: z.string().default(""),
|
|
41
|
+
external_nickname: z.string().default("")
|
|
42
|
+
}).transform((value) => ({
|
|
43
|
+
...base(value),
|
|
44
|
+
userId: value.user_id,
|
|
45
|
+
platformAppId: value.platform_app_id,
|
|
46
|
+
externalUnionId: value.external_union_id,
|
|
47
|
+
externalNickname: value.external_nickname
|
|
48
|
+
}));
|
|
49
|
+
const groupBindingSchema = z.object({
|
|
50
|
+
...fields,
|
|
51
|
+
platform_app_id: z.string().default(""),
|
|
52
|
+
conversation_id: z.string().default(""),
|
|
53
|
+
conversation_name: z.string().default(""),
|
|
54
|
+
notebook_id: z.string().default(""),
|
|
55
|
+
context_window: z.int32().default(0),
|
|
56
|
+
writer_user_id: z.string().default(""),
|
|
57
|
+
instructions: jsonObject.nullish()
|
|
58
|
+
}).transform((value) => ({
|
|
59
|
+
...base(value),
|
|
60
|
+
platformAppId: value.platform_app_id,
|
|
61
|
+
conversationId: value.conversation_id,
|
|
62
|
+
conversationName: value.conversation_name,
|
|
63
|
+
notebookId: value.notebook_id,
|
|
64
|
+
contextWindow: value.context_window,
|
|
65
|
+
writerUserId: value.writer_user_id,
|
|
66
|
+
...value.instructions == null ? {} : { instructions: value.instructions }
|
|
67
|
+
}));
|
|
68
|
+
const pageInfoSchema = z.object({
|
|
69
|
+
current_page: z.int32().nonnegative().default(0),
|
|
70
|
+
last_page: z.int32().nonnegative().default(0),
|
|
71
|
+
next_page: z.int32().nonnegative().default(0),
|
|
72
|
+
prev_page: z.int32().nonnegative().default(0),
|
|
73
|
+
page_size: z.int32().nonnegative().default(0),
|
|
74
|
+
total_size: z.int32().nonnegative().default(0),
|
|
75
|
+
next_token: z.string().default("")
|
|
76
|
+
}).transform((value) => ({
|
|
77
|
+
currentPage: value.current_page,
|
|
78
|
+
lastPage: value.last_page,
|
|
79
|
+
nextPage: value.next_page,
|
|
80
|
+
previousPage: value.prev_page,
|
|
81
|
+
pageSize: value.page_size,
|
|
82
|
+
totalSize: value.total_size,
|
|
83
|
+
nextToken: value.next_token
|
|
84
|
+
}));
|
|
85
|
+
const platformAppListSchema = z.object({
|
|
86
|
+
apps: z.array(platformAppSchema).nullish(),
|
|
87
|
+
pages: pageInfoSchema.nullish()
|
|
88
|
+
}).transform((value) => ({
|
|
89
|
+
apps: value.apps ?? [],
|
|
90
|
+
...value.pages == null ? {} : { pages: value.pages }
|
|
91
|
+
}));
|
|
92
|
+
const expertBindingListSchema = z.object({
|
|
93
|
+
bindings: z.array(expertBindingSchema).nullish(),
|
|
94
|
+
pages: pageInfoSchema.nullish()
|
|
95
|
+
}).transform((value) => ({
|
|
96
|
+
bindings: value.bindings ?? [],
|
|
97
|
+
...value.pages == null ? {} : { pages: value.pages }
|
|
98
|
+
}));
|
|
99
|
+
const groupBindingListSchema = z.object({
|
|
100
|
+
bindings: z.array(groupBindingSchema).nullish(),
|
|
101
|
+
pages: pageInfoSchema.nullish()
|
|
102
|
+
}).transform((value) => ({
|
|
103
|
+
bindings: value.bindings ?? [],
|
|
104
|
+
...value.pages == null ? {} : { pages: value.pages }
|
|
105
|
+
}));
|
|
106
|
+
const publishDingTalkSchema = z.object({
|
|
107
|
+
binding_code: z.string().min(1),
|
|
108
|
+
bind_command: z.string().min(1),
|
|
109
|
+
group_binding: groupBindingSchema
|
|
110
|
+
}).transform((value) => ({
|
|
111
|
+
bindingCode: value.binding_code,
|
|
112
|
+
bindCommand: value.bind_command,
|
|
113
|
+
groupBinding: value.group_binding
|
|
114
|
+
}));
|
|
115
|
+
const inviteDingTalkSchema = z.object({
|
|
116
|
+
binding_code: z.string().min(1),
|
|
117
|
+
bind_command: z.string().min(1),
|
|
118
|
+
expert_binding: expertBindingSchema
|
|
119
|
+
}).transform((value) => ({
|
|
120
|
+
bindingCode: value.binding_code,
|
|
121
|
+
bindCommand: value.bind_command,
|
|
122
|
+
expertBinding: value.expert_binding
|
|
123
|
+
}));
|
|
124
|
+
const botDeleteSchema = z.object({}).transform(() => void 0);
|
|
125
|
+
function optionalInt32(value, field) {
|
|
126
|
+
if (value === void 0) return void 0;
|
|
127
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value < -2147483648 || value > 2147483647) throw invalidArgument(`${field} must be an int32`, field);
|
|
128
|
+
return value;
|
|
129
|
+
}
|
|
130
|
+
function isJson(value, ancestors) {
|
|
131
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return true;
|
|
132
|
+
if (typeof value === "number") return Number.isFinite(value);
|
|
133
|
+
if (typeof value !== "object" || ancestors.has(value)) return false;
|
|
134
|
+
if (!Array.isArray(value) && Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) return false;
|
|
135
|
+
if (Object.getOwnPropertySymbols(value).length > 0) return false;
|
|
136
|
+
ancestors.add(value);
|
|
137
|
+
const valid = (Array.isArray(value) ? Array.from(value) : Object.values(value)).every((child) => isJson(child, ancestors));
|
|
138
|
+
ancestors.delete(value);
|
|
139
|
+
return valid;
|
|
140
|
+
}
|
|
141
|
+
function optionalInstructions(value) {
|
|
142
|
+
const object = optionalRecord(value, "instructions");
|
|
143
|
+
if (object === void 0) return void 0;
|
|
144
|
+
try {
|
|
145
|
+
if (isJson(object, /* @__PURE__ */ new Set())) return object;
|
|
146
|
+
} catch {}
|
|
147
|
+
throw invalidArgument("instructions must contain only JSON values", "instructions");
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region ../sdk/src/operations/bot-gateway.ts
|
|
151
|
+
function groupFields(input) {
|
|
152
|
+
return compactUndefined({
|
|
153
|
+
conversation_name: optionalString(input?.conversationName, "conversationName"),
|
|
154
|
+
context_window: optionalInt32(input?.contextWindow, "contextWindow"),
|
|
155
|
+
writer_user_id: optionalString(input?.writerUserId, "writerUserId"),
|
|
156
|
+
is_active: optionalBoolean(input?.isActive, "isActive"),
|
|
157
|
+
instructions: optionalInstructions(input?.instructions)
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function patch(body) {
|
|
161
|
+
assertNonEmptyPatch(body, "input");
|
|
162
|
+
return body;
|
|
163
|
+
}
|
|
164
|
+
function createBotGatewayOperations(context) {
|
|
165
|
+
const path = (notebookId, ...segments) => context.profile.apiPath("notebooks", requiredString(notebookId, "notebookId"), "botgw", ...segments);
|
|
166
|
+
const listPath = (notebookId, resource, input = {}) => {
|
|
167
|
+
const page = pagination({
|
|
168
|
+
page: input.page ?? 1,
|
|
169
|
+
pageSize: input.pageSize ?? 20
|
|
170
|
+
});
|
|
171
|
+
const onlyActive = optionalBoolean(input.onlyActive, "onlyActive");
|
|
172
|
+
return queryPath(path(notebookId, resource), [
|
|
173
|
+
["page", optionalInt32(page.page, "page")],
|
|
174
|
+
["page_size", optionalInt32(page.pageSize, "pageSize")],
|
|
175
|
+
["platform", optionalTrimmedString(input.platform, "platform")],
|
|
176
|
+
["only_active", onlyActive === void 0 ? void 0 : String(onlyActive)],
|
|
177
|
+
["platform_app_id", resource === "platform-apps" ? void 0 : optionalTrimmedString(input.platformAppId, "platformAppId")],
|
|
178
|
+
["user_id", resource === "expert-bindings" ? optionalTrimmedString(input.userId, "userId") : void 0]
|
|
179
|
+
]);
|
|
180
|
+
};
|
|
181
|
+
return {
|
|
182
|
+
async listPlatformApps(notebookId, input, options) {
|
|
183
|
+
return call(context, {
|
|
184
|
+
callOptions: options,
|
|
185
|
+
capability: "botGateway",
|
|
186
|
+
method: "GET",
|
|
187
|
+
idempotent: true,
|
|
188
|
+
operation: "botGateway.platformApps.list",
|
|
189
|
+
path: listPath(notebookId, "platform-apps", input),
|
|
190
|
+
schema: platformAppListSchema
|
|
191
|
+
});
|
|
192
|
+
},
|
|
193
|
+
async createPlatformApp(notebookId, input, options) {
|
|
194
|
+
const body = compactUndefined({
|
|
195
|
+
platform: requiredString(input?.platform, "platform"),
|
|
196
|
+
app_name: requiredString(input?.appName, "appName"),
|
|
197
|
+
client_id: requiredString(input?.clientId, "clientId"),
|
|
198
|
+
client_secret: requiredText(input?.clientSecret, "clientSecret"),
|
|
199
|
+
is_active: optionalBoolean(input?.isActive, "isActive")
|
|
200
|
+
});
|
|
201
|
+
return call(context, {
|
|
202
|
+
body,
|
|
203
|
+
callOptions: options,
|
|
204
|
+
capability: "botGateway",
|
|
205
|
+
method: "POST",
|
|
206
|
+
idempotent: false,
|
|
207
|
+
operation: "botGateway.platformApps.create",
|
|
208
|
+
path: path(notebookId, "platform-apps"),
|
|
209
|
+
schema: platformAppSchema
|
|
210
|
+
});
|
|
211
|
+
},
|
|
212
|
+
async updatePlatformApp(notebookId, appId, input, options) {
|
|
213
|
+
const body = patch(compactUndefined({
|
|
214
|
+
app_name: optionalString(input?.appName, "appName"),
|
|
215
|
+
client_secret: optionalString(input?.clientSecret, "clientSecret"),
|
|
216
|
+
is_active: optionalBoolean(input?.isActive, "isActive")
|
|
217
|
+
}));
|
|
218
|
+
return call(context, {
|
|
219
|
+
body,
|
|
220
|
+
callOptions: options,
|
|
221
|
+
capability: "botGateway",
|
|
222
|
+
method: "PATCH",
|
|
223
|
+
idempotent: false,
|
|
224
|
+
operation: "botGateway.platformApps.update",
|
|
225
|
+
path: path(notebookId, "platform-apps", requiredString(appId, "appId")),
|
|
226
|
+
schema: platformAppSchema
|
|
227
|
+
});
|
|
228
|
+
},
|
|
229
|
+
async deletePlatformApp(notebookId, appId, options) {
|
|
230
|
+
return call(context, {
|
|
231
|
+
callOptions: options,
|
|
232
|
+
capability: "botGateway",
|
|
233
|
+
method: "DELETE",
|
|
234
|
+
idempotent: false,
|
|
235
|
+
operation: "botGateway.platformApps.delete",
|
|
236
|
+
path: path(notebookId, "platform-apps", requiredString(appId, "appId")),
|
|
237
|
+
schema: botDeleteSchema
|
|
238
|
+
});
|
|
239
|
+
},
|
|
240
|
+
async listExpertBindings(notebookId, input, options) {
|
|
241
|
+
return call(context, {
|
|
242
|
+
callOptions: options,
|
|
243
|
+
capability: "botGateway",
|
|
244
|
+
method: "GET",
|
|
245
|
+
idempotent: true,
|
|
246
|
+
operation: "botGateway.expertBindings.list",
|
|
247
|
+
path: listPath(notebookId, "expert-bindings", input),
|
|
248
|
+
schema: expertBindingListSchema
|
|
249
|
+
});
|
|
250
|
+
},
|
|
251
|
+
async updateExpertBinding(notebookId, bindingId, input, options) {
|
|
252
|
+
const body = patch(compactUndefined({
|
|
253
|
+
external_nickname: optionalString(input?.externalNickname, "externalNickname"),
|
|
254
|
+
is_active: optionalBoolean(input?.isActive, "isActive")
|
|
255
|
+
}));
|
|
256
|
+
return call(context, {
|
|
257
|
+
body,
|
|
258
|
+
callOptions: options,
|
|
259
|
+
capability: "botGateway",
|
|
260
|
+
method: "PATCH",
|
|
261
|
+
idempotent: false,
|
|
262
|
+
operation: "botGateway.expertBindings.update",
|
|
263
|
+
path: path(notebookId, "expert-bindings", requiredString(bindingId, "bindingId")),
|
|
264
|
+
schema: expertBindingSchema
|
|
265
|
+
});
|
|
266
|
+
},
|
|
267
|
+
async deleteExpertBinding(notebookId, bindingId, options) {
|
|
268
|
+
return call(context, {
|
|
269
|
+
callOptions: options,
|
|
270
|
+
capability: "botGateway",
|
|
271
|
+
method: "DELETE",
|
|
272
|
+
idempotent: false,
|
|
273
|
+
operation: "botGateway.expertBindings.delete",
|
|
274
|
+
path: path(notebookId, "expert-bindings", requiredString(bindingId, "bindingId")),
|
|
275
|
+
schema: botDeleteSchema
|
|
276
|
+
});
|
|
277
|
+
},
|
|
278
|
+
async listGroupBindings(notebookId, input, options) {
|
|
279
|
+
return call(context, {
|
|
280
|
+
callOptions: options,
|
|
281
|
+
capability: "botGateway",
|
|
282
|
+
method: "GET",
|
|
283
|
+
idempotent: true,
|
|
284
|
+
operation: "botGateway.groupBindings.list",
|
|
285
|
+
path: listPath(notebookId, "group-bindings", input),
|
|
286
|
+
schema: groupBindingListSchema
|
|
287
|
+
});
|
|
288
|
+
},
|
|
289
|
+
async createGroupBinding(notebookId, input, options) {
|
|
290
|
+
const body = {
|
|
291
|
+
...groupFields(input),
|
|
292
|
+
platform_app_id: requiredString(input?.platformAppId, "platformAppId"),
|
|
293
|
+
conversation_id: requiredString(input?.conversationId, "conversationId")
|
|
294
|
+
};
|
|
295
|
+
return call(context, {
|
|
296
|
+
body,
|
|
297
|
+
callOptions: options,
|
|
298
|
+
capability: "botGateway",
|
|
299
|
+
method: "POST",
|
|
300
|
+
idempotent: false,
|
|
301
|
+
operation: "botGateway.groupBindings.create",
|
|
302
|
+
path: path(notebookId, "group-bindings"),
|
|
303
|
+
schema: groupBindingSchema
|
|
304
|
+
});
|
|
305
|
+
},
|
|
306
|
+
async updateGroupBinding(notebookId, bindingId, input, options) {
|
|
307
|
+
const body = patch(compactUndefined({
|
|
308
|
+
...groupFields(input),
|
|
309
|
+
notebook_id: optionalString(input?.notebookId, "notebookId")
|
|
310
|
+
}));
|
|
311
|
+
return call(context, {
|
|
312
|
+
body,
|
|
313
|
+
callOptions: options,
|
|
314
|
+
capability: "botGateway",
|
|
315
|
+
method: "PATCH",
|
|
316
|
+
idempotent: false,
|
|
317
|
+
operation: "botGateway.groupBindings.update",
|
|
318
|
+
path: path(notebookId, "group-bindings", requiredString(bindingId, "bindingId")),
|
|
319
|
+
schema: groupBindingSchema
|
|
320
|
+
});
|
|
321
|
+
},
|
|
322
|
+
async deleteGroupBinding(notebookId, bindingId, options) {
|
|
323
|
+
return call(context, {
|
|
324
|
+
callOptions: options,
|
|
325
|
+
capability: "botGateway",
|
|
326
|
+
method: "DELETE",
|
|
327
|
+
idempotent: false,
|
|
328
|
+
operation: "botGateway.groupBindings.delete",
|
|
329
|
+
path: path(notebookId, "group-bindings", requiredString(bindingId, "bindingId")),
|
|
330
|
+
schema: botDeleteSchema
|
|
331
|
+
});
|
|
332
|
+
},
|
|
333
|
+
async publishDingTalk(notebookId, input, options) {
|
|
334
|
+
const body = compactUndefined({
|
|
335
|
+
platform_app_id: requiredString(input?.platformAppId, "platformAppId"),
|
|
336
|
+
context_window: optionalInt32(input?.contextWindow, "contextWindow"),
|
|
337
|
+
instructions: optionalInstructions(input?.instructions)
|
|
338
|
+
});
|
|
339
|
+
return call(context, {
|
|
340
|
+
body,
|
|
341
|
+
callOptions: options,
|
|
342
|
+
capability: "botGateway",
|
|
343
|
+
method: "POST",
|
|
344
|
+
idempotent: false,
|
|
345
|
+
operation: "botGateway.dingTalk.publish",
|
|
346
|
+
path: path(notebookId, "dingtalk", "publish"),
|
|
347
|
+
schema: publishDingTalkSchema
|
|
348
|
+
});
|
|
349
|
+
},
|
|
350
|
+
async inviteDingTalkExpert(notebookId, input, options) {
|
|
351
|
+
const userId = optionalTrimmedString(input?.userId, "userId");
|
|
352
|
+
const email = optionalTrimmedString(input?.email, "email");
|
|
353
|
+
if (userId === void 0 && email === void 0) throw invalidArgument("provide userId or email", "input");
|
|
354
|
+
const body = compactUndefined({
|
|
355
|
+
platform_app_id: requiredString(input?.platformAppId, "platformAppId"),
|
|
356
|
+
user_id: userId,
|
|
357
|
+
email
|
|
358
|
+
});
|
|
359
|
+
return call(context, {
|
|
360
|
+
body,
|
|
361
|
+
callOptions: options,
|
|
362
|
+
capability: "botGateway",
|
|
363
|
+
method: "POST",
|
|
364
|
+
idempotent: false,
|
|
365
|
+
operation: "botGateway.dingTalk.inviteExpert",
|
|
366
|
+
path: path(notebookId, "dingtalk", "experts", "invite"),
|
|
367
|
+
schema: inviteDingTalkSchema
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
//#endregion
|
|
373
|
+
export { createBotGatewayOperations };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { S as cardSchema, a as invalidArgument, c as optionalRecord, d as pagination, g as stringList, h as requiredText, l as optionalString, m as requiredString, n as call, p as queryPath, r as compactUndefined, u as optionalTrimmedString, x as cardListSchema, y as batchMutationResultSchema } from "./shared-BkQJzIZF.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region ../sdk/src/operations/compilation-results.ts
|
|
4
|
+
function linksBody(value, field) {
|
|
5
|
+
if (value === void 0) return void 0;
|
|
6
|
+
if (!Array.isArray(value)) throw invalidArgument(`${field} must be an array`, field);
|
|
7
|
+
return value.map((value, index) => {
|
|
8
|
+
const name = `${field}[${index}]`;
|
|
9
|
+
const link = optionalRecord(value, name);
|
|
10
|
+
const targetId = optionalTrimmedString(link?.targetId, `${name}.targetId`);
|
|
11
|
+
const targetRef = optionalTrimmedString(link?.targetRef, `${name}.targetRef`);
|
|
12
|
+
if (targetId === void 0 && targetRef === void 0) throw invalidArgument(`${name} requires targetId or targetRef`, name);
|
|
13
|
+
return compactUndefined({
|
|
14
|
+
description: optionalString(link?.description, `${name}.description`),
|
|
15
|
+
linkType: optionalTrimmedString(link?.linkType, `${name}.linkType`),
|
|
16
|
+
targetId,
|
|
17
|
+
targetRef
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function compilationResultBody(value) {
|
|
22
|
+
if (!Array.isArray(value) || value.length === 0) throw invalidArgument("cards must be a non-empty array", "cards");
|
|
23
|
+
return { cards: value.map((value, index) => {
|
|
24
|
+
const name = `cards[${index}]`;
|
|
25
|
+
const card = optionalRecord(value, name);
|
|
26
|
+
return compactUndefined({
|
|
27
|
+
cardType: optionalTrimmedString(card?.cardType, `${name}.cardType`),
|
|
28
|
+
content: requiredText(card?.content, `${name}.content`),
|
|
29
|
+
id: optionalTrimmedString(card?.id, `${name}.id`),
|
|
30
|
+
keywords: card?.keywords === void 0 ? void 0 : stringList(card.keywords, `${name}.keywords`),
|
|
31
|
+
links: linksBody(card?.links, `${name}.links`),
|
|
32
|
+
refId: optionalTrimmedString(card?.refId, `${name}.refId`),
|
|
33
|
+
title: requiredString(card?.title, `${name}.title`)
|
|
34
|
+
});
|
|
35
|
+
}) };
|
|
36
|
+
}
|
|
37
|
+
const saveCompilationResultSchema = z.object({
|
|
38
|
+
cards: z.array(z.object({
|
|
39
|
+
id: z.string().min(1),
|
|
40
|
+
refId: z.string().optional()
|
|
41
|
+
})).nullish().transform((cards) => cards ?? []),
|
|
42
|
+
failureCount: z.number().int().nonnegative(),
|
|
43
|
+
successCount: z.number().int().nonnegative()
|
|
44
|
+
});
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region ../sdk/src/operations/cards.ts
|
|
47
|
+
function createCardOperations(context) {
|
|
48
|
+
const listCards = async (notebookId, input = {}, options, featured = false) => {
|
|
49
|
+
const notebook = requiredString(notebookId, "notebookId");
|
|
50
|
+
const normalizedPage = pagination({
|
|
51
|
+
page: input.page ?? 1,
|
|
52
|
+
pageSize: input.pageSize ?? 20
|
|
53
|
+
});
|
|
54
|
+
const category = optionalTrimmedString(input.category, "category");
|
|
55
|
+
const query = optionalTrimmedString(input.query, "query");
|
|
56
|
+
const root = context.profile.apiPath(featured ? "featured-notebooks" : "notebooks", notebook, "cards");
|
|
57
|
+
const path = queryPath(root, [
|
|
58
|
+
["category", category],
|
|
59
|
+
["query", query],
|
|
60
|
+
["page", normalizedPage.page],
|
|
61
|
+
["page_size", normalizedPage.pageSize]
|
|
62
|
+
]);
|
|
63
|
+
return call(context, {
|
|
64
|
+
callOptions: options,
|
|
65
|
+
capability: featured ? "featuredNotebooks.read" : "cards.read",
|
|
66
|
+
idempotent: true,
|
|
67
|
+
method: "GET",
|
|
68
|
+
operation: featured ? "featuredCards.list" : "cards.list",
|
|
69
|
+
path,
|
|
70
|
+
schema: cardListSchema
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
return {
|
|
74
|
+
async saveCompilationResult(notebookId, input, options) {
|
|
75
|
+
const notebook = requiredString(notebookId, "notebookId");
|
|
76
|
+
return call(context, {
|
|
77
|
+
body: compilationResultBody(input?.cards),
|
|
78
|
+
callOptions: options,
|
|
79
|
+
capability: "cards.saveResults",
|
|
80
|
+
idempotent: false,
|
|
81
|
+
method: "POST",
|
|
82
|
+
operation: "cards.saveCompilationResult",
|
|
83
|
+
path: context.profile.apiPath("notebooks", notebook, "cards", "save-compilation-result"),
|
|
84
|
+
schema: saveCompilationResultSchema
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
async batchDeleteCards(notebookId, cardIds, options) {
|
|
88
|
+
const notebook = requiredString(notebookId, "notebookId");
|
|
89
|
+
const ids = stringList(cardIds, "cardIds", { min: 1 });
|
|
90
|
+
return call(context, {
|
|
91
|
+
body: { cardIds: ids },
|
|
92
|
+
callOptions: options,
|
|
93
|
+
capability: "cards.write",
|
|
94
|
+
idempotent: false,
|
|
95
|
+
method: "POST",
|
|
96
|
+
operation: "cards.batchDelete",
|
|
97
|
+
path: context.profile.apiPath("notebooks", notebook, "cards", "batch-delete"),
|
|
98
|
+
schema: batchMutationResultSchema
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
async deleteCard(notebookId, cardId, options) {
|
|
102
|
+
const notebook = requiredString(notebookId, "notebookId");
|
|
103
|
+
const card = requiredString(cardId, "cardId");
|
|
104
|
+
return call(context, {
|
|
105
|
+
callOptions: options,
|
|
106
|
+
capability: "cards.write",
|
|
107
|
+
idempotent: false,
|
|
108
|
+
method: "DELETE",
|
|
109
|
+
operation: "cards.delete",
|
|
110
|
+
path: context.profile.apiPath("notebooks", notebook, "cards", card),
|
|
111
|
+
schema: batchMutationResultSchema
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
async getCard(notebookId, cardId, options) {
|
|
115
|
+
const notebook = requiredString(notebookId, "notebookId");
|
|
116
|
+
const card = requiredString(cardId, "cardId");
|
|
117
|
+
return call(context, {
|
|
118
|
+
callOptions: options,
|
|
119
|
+
capability: "cards.read",
|
|
120
|
+
idempotent: true,
|
|
121
|
+
method: "GET",
|
|
122
|
+
operation: "cards.get",
|
|
123
|
+
path: context.profile.apiPath("notebooks", notebook, "cards", card),
|
|
124
|
+
schema: cardSchema
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
listCards: (notebookId, input, options) => listCards(notebookId, input, options),
|
|
128
|
+
listFeaturedCards: (notebookId, input, options) => listCards(notebookId, input, options, true)
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
export { createCardOperations };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { O as importProvidersSchema, _ as aliDingImportRunItemListSchema, a as invalidArgument, d as pagination, et as assertCapability, m as requiredString, n as call, p as queryPath, v as aliDingImportRunSchema } from "./shared-BkQJzIZF.js";
|
|
2
2
|
//#region ../sdk/src/operations/imports.ts
|
|
3
3
|
const aliDingHost = "alidocs.dingtalk.com";
|
|
4
4
|
const requestIdPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u;
|
|
@@ -14,8 +14,8 @@ function canonicalAliDingUrl(value, scope) {
|
|
|
14
14
|
} catch (cause) {
|
|
15
15
|
throw invalidArgument("url must be a canonical AliDing HTTPS URL", "url", { cause });
|
|
16
16
|
}
|
|
17
|
-
if (url.
|
|
18
|
-
if (url.search.length > 0 || url.hash.length > 0 || url.username.length > 0) throw invalidArgument("url must not carry a query, fragment or credentials", "url");
|
|
17
|
+
if (url.origin !== `https://${aliDingHost}`) throw invalidArgument(`url must be an https://${aliDingHost} address`, "url");
|
|
18
|
+
if (url.search.length > 0 || url.hash.length > 0 || url.username.length > 0 || url.password.length > 0) throw invalidArgument("url must not carry a query, fragment or credentials", "url");
|
|
19
19
|
const prefix = scope === "nodeSubtree" ? "/i/nodes/" : "/i/spaces/";
|
|
20
20
|
if (!url.pathname.startsWith(prefix) || url.pathname === prefix) throw invalidArgument(`url must be an AliDing ${prefix} address for this import scope`, "url");
|
|
21
21
|
return url.toString();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { X as voidResponseSchema, a as invalidArgument, c as optionalRecord, l as optionalString, m as requiredString, n as call, r as compactUndefined, s as optionalBoolean, t as assertNonEmptyPatch } from "./shared-BkQJzIZF.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region ../sdk/src/operations/management-schemas.ts
|
|
4
4
|
const memberPermissionSchema = z.enum([
|
|
@@ -22,7 +22,8 @@ const scheduledTaskSceneSchema = z.enum([
|
|
|
22
22
|
"compilation",
|
|
23
23
|
"condensation",
|
|
24
24
|
"lint",
|
|
25
|
-
"source_refresh"
|
|
25
|
+
"source_refresh",
|
|
26
|
+
"source_binding_sync"
|
|
26
27
|
]);
|
|
27
28
|
const scheduledTaskSchema = z.object({
|
|
28
29
|
config: z.record(z.string(), z.unknown()).default({}),
|
|
@@ -107,8 +108,8 @@ function memberPermission(value, field) {
|
|
|
107
108
|
throw invalidArgument(`${field} must be manage, edit, or view`, field);
|
|
108
109
|
}
|
|
109
110
|
function scheduledTaskScene(value, field) {
|
|
110
|
-
if (value === "compilation" || value === "condensation" || value === "lint" || value === "source_refresh") return value;
|
|
111
|
-
throw invalidArgument(`${field} must be compilation, condensation, lint, or
|
|
111
|
+
if (value === "compilation" || value === "condensation" || value === "lint" || value === "source_refresh" || value === "source_binding_sync") return value;
|
|
112
|
+
throw invalidArgument(`${field} must be compilation, condensation, lint, source_refresh, or source_binding_sync`, field);
|
|
112
113
|
}
|
|
113
114
|
function compilationMode(value, field) {
|
|
114
115
|
if (value === "FULL" || value === "INCREMENTAL" || value === "REBUILD") return value;
|