@qoder-ai/qmind-cli 3.3.0 → 3.5.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 CHANGED
@@ -4,6 +4,18 @@ 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.5.0
8
+
9
+ ### Minor Changes
10
+
11
+ - 708977c: Retire Cards completely from `qmind-cn`: retrieval JSON no longer includes `cards`, NDJSON emits only chunks, and table/agent output no longer renders Cards. Compilation progress no longer displays card counts. Update output consumers to use chunks and citations; there is no compatibility flag to restore Cards. Single-notebook retrieval keeps its endpoint, and multi-notebook output keeps notebook identity and server ranking.
12
+
13
+ ## 3.4.0
14
+
15
+ ### Minor Changes
16
+
17
+ - 85ebf9c: Support explicit multi-notebook retrieval in `qmind retrieve` and `qmind-cn retrieve` with up to 5 distinct notebooks selected through comma-separated or repeated `--nb` values. Multiple notebooks use one unified retrieval request with server-side ranking and a shared result budget. Output preserves notebook identity and server order; request failures do not fall back to individual notebook calls. Single-notebook retrieval and output stay unchanged, and `--sources` remains single-notebook only.
18
+
7
19
  ## 3.3.0
8
20
 
9
21
  ### Minor Changes
@@ -4,6 +4,18 @@
4
4
 
5
5
  以下已发布版本属于 Global CLI / 共享实现,不代表 CN 曾发布过这些版本。CN 将在后续共同发行版加入同一历史。
6
6
 
7
+ ## 3.5.0
8
+
9
+ ### Minor Changes
10
+
11
+ - 708977c: 从 `qmind-cn` 彻底移除 Cards:检索 JSON 不再包含 `cards`,NDJSON 仅输出 chunks,table/agent 不再渲染卡片。编译进度不再展示卡片计数。消费方需改用 chunks 和 citations,不提供恢复 Cards 的兼容开关。单知识库检索保留原端点,多知识库输出保留知识库身份与服务端排序。
12
+
13
+ ## 3.4.0
14
+
15
+ ### Minor Changes
16
+
17
+ - 85ebf9c: `qmind retrieve` 和 `qmind-cn retrieve` 支持通过逗号分隔或重复传入 `--nb` 显式选择最多 5 个不同知识库。多库通过一次统一检索请求共享结果预算,由服务端排序;输出保留知识库身份和服务端顺序,请求失败时不回退到逐库调用。单库检索及输出保持不变,`--sources` 仍仅支持单库。
18
+
7
19
  ## 3.3.0
8
20
 
9
21
  ### Minor Changes
package/README.md CHANGED
@@ -73,6 +73,22 @@ Do not put tokens in command arguments, repositories, or logs. Run `qmind logout
73
73
 
74
74
  Run `qmind <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.
75
75
 
76
+ ## Multi-notebook retrieval
77
+
78
+ `retrieve --nb` accepts comma-separated or repeated Notebook IDs, deduplicating up to 5 distinct notebooks:
79
+
80
+ ```sh
81
+ qmind retrieve --nb nb-1,nb-2 "What is the deployment process?" --format json
82
+ qmind retrieve --nb nb-1 --nb nb-2 "What is the deployment process?" --format agent
83
+ ```
84
+
85
+ - Selection is explicit; the CLI never defaults to all accessible notebooks.
86
+ - Multiple notebooks use one unified retrieval request. The server jointly retrieves and reranks Source chunks; output retains server ranking and each chunk/citation's `notebookId` and `notebookTitle`.
87
+ - `--top-k` controls the joint recall candidate budget per route/query/channel; it is not multiplied by notebook count. `--max-results` limits the final results across all selected notebooks. Zero uses server defaults.
88
+ - `--sources` requires a single notebook. A single deduplicated notebook keeps the existing retrieval endpoint. All retrieval output formats expose chunks and citations without knowledge cards.
89
+ - Multi-notebook JSON returns `{ chunks, citations, promptContext, total, reranked }`. NDJSON emits one `kind: "chunk"` record per returned chunk, in server order; zero hits emit no records. Table and agent output also identify each evidence item's notebook.
90
+ - Unified retrieval fails as one request when a target is invalid or inaccessible. The CLI reports the error without retrying notebooks individually or constructing partial-success results. Retrieval results no longer contain a `cards` field.
91
+
76
92
  ## Directory synchronization
77
93
 
78
94
  Review the plan before allowing remote deletions:
package/README.zh-CN.md CHANGED
@@ -73,6 +73,22 @@ qmind retrieve --nb <notebook-id> --format agent "部署流程是什么?"
73
73
 
74
74
  使用 `qmind <command> --help` 查看完整参数。领域命令支持 `table`、`json`、`agent`、`ndjson` 等输出格式。stdout 只输出结果,进度与诊断信息输出到 stderr。退出码 `0` 表示成功,`1` 表示运行失败、部分成功或取消,`2` 表示参数错误。
75
75
 
76
+ ## 多库检索
77
+
78
+ `retrieve --nb` 支持逗号分隔或重复传入 Notebook ID,去重后最多选择 5 个知识库:
79
+
80
+ ```sh
81
+ qmind retrieve --nb nb-1,nb-2 "部署流程是什么?" --format json
82
+ qmind retrieve --nb nb-1 --nb nb-2 "部署流程是什么?" --format agent
83
+ ```
84
+
85
+ - 必须显式选择知识库,不会默认枚举所有可访问库。
86
+ - 多库检索只发送一次统一请求,由服务端联合召回并重排 Source chunks;输出保留服务端排序,以及每条 chunk/citation 的 `notebookId` 和 `notebookTitle`。
87
+ - `--top-k` 控制每路、每个查询变体、每种召回通道的联合候选预算,不按知识库数量相乘;`--max-results` 限制全部选中库的最终结果总数。零值使用服务端默认配置。
88
+ - `--sources` 仅支持单库。去重后只有一个库时,保留原单库检索接口和输出,包括知识卡片及原有兜底行为。
89
+ - 多库 JSON 返回 `{ chunks, citations, promptContext, total, reranked }`;NDJSON 按服务端顺序逐条输出 `kind: "chunk"` 记录,零命中时不输出记录。table 和 agent 格式也会标明证据所属知识库。
90
+ - 目标无效或无权限时,统一请求整体失败。CLI 输出错误,不逐库重试或构造部分成功结果。多库检索不返回知识卡片。
91
+
76
92
  ## 同步目录
77
93
 
78
94
  先审阅计划,再决定是否执行远端删除:
@@ -1,4 +1,4 @@
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-BFU7amCH.js";
1
+ import { Z 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-DsqZroGJ.js";
2
2
  import { z } from "zod";
3
3
  //#region ../sdk/src/operations/bot-gateway-codecs.ts
4
4
  const botTimestamp = z.preprocess((value) => typeof value === "object" && value !== null && !Array.isArray(value) && !("seconds" in value) ? {
@@ -1,7 +1,34 @@
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-BFU7amCH.js";
1
+ import { O as importProvidersSchema, T as fullSiteURLImportDiscoverySchema, _ as aliDingImportRunItemListSchema, a as invalidArgument, d as pagination, m as requiredString, n as call, nt as assertCapability, p as queryPath, tt as qmindFullSiteURLImportPageLimit, v as aliDingImportRunSchema, w as fullSiteURLImportConfirmationSchema } from "./shared-DsqZroGJ.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;
5
+ const maxFullSitePages = qmindFullSiteURLImportPageLimit;
6
+ function publicHTTPURL(value, field) {
7
+ const raw = requiredString(value, field);
8
+ let url;
9
+ try {
10
+ url = new URL(raw);
11
+ } catch (cause) {
12
+ throw invalidArgument(`${field} must be a valid HTTP or HTTPS URL`, field, { cause });
13
+ }
14
+ if (url.protocol !== "http:" && url.protocol !== "https:") throw invalidArgument(`${field} must use HTTP or HTTPS`, field);
15
+ if (url.username.length > 0 || url.password.length > 0) throw invalidArgument(`${field} must not contain inline credentials`, field);
16
+ return url.toString();
17
+ }
18
+ function fullSiteConfirmationBody(input) {
19
+ requiredString(input?.discoveryId, "discoveryId");
20
+ if (!Array.isArray(input?.selectedPageIds)) throw invalidArgument("selectedPageIds must be an array", "selectedPageIds");
21
+ if (input.selectedPageIds.length === 0 || input.selectedPageIds.length > maxFullSitePages) throw invalidArgument(`selectedPageIds must contain between 1 and ${maxFullSitePages} items`, "selectedPageIds");
22
+ const selectedPageIds = input.selectedPageIds.map((id, index) => requiredString(id, `selectedPageIds[${index}]`));
23
+ if (new Set(selectedPageIds).size !== selectedPageIds.length) throw invalidArgument("selectedPageIds must not contain duplicates", "selectedPageIds");
24
+ return {
25
+ compileAfterImport: input.compileAfterImport ?? false,
26
+ parentSourceId: input.parentSourceId,
27
+ path: input.path,
28
+ selectedPageIds,
29
+ title: input.title
30
+ };
31
+ }
5
32
  /**
6
33
  * A canonical AliDing URL identifies exactly one node or knowledge base. Share links, short links,
7
34
  * query strings and fragments are aliases, so they are rejected rather than silently trimmed.
@@ -30,6 +57,36 @@ function importRunBody(input, scope) {
30
57
  }
31
58
  function createImportOperations(context) {
32
59
  return {
60
+ async confirmFullSiteURLImport(notebookId, input, options) {
61
+ const notebook = requiredString(notebookId, "notebookId");
62
+ const discovery = requiredString(input?.discoveryId, "discoveryId");
63
+ assertCapability(context.profile, "imports.fullSiteURL", "imports.fullSiteURL.confirm");
64
+ return call(context, {
65
+ body: fullSiteConfirmationBody(input),
66
+ callOptions: options,
67
+ capability: "imports.fullSiteURL",
68
+ idempotent: false,
69
+ method: "POST",
70
+ operation: "imports.fullSiteURL.confirm",
71
+ path: context.profile.mindPath("notebooks", notebook, "full-site-url-import", "discoveries", discovery, "confirm"),
72
+ schema: fullSiteURLImportConfirmationSchema
73
+ });
74
+ },
75
+ async discoverFullSiteURLImport(notebookId, input, options) {
76
+ const notebook = requiredString(notebookId, "notebookId");
77
+ const url = publicHTTPURL(input?.url, "url");
78
+ assertCapability(context.profile, "imports.fullSiteURL", "imports.fullSiteURL.discover");
79
+ return call(context, {
80
+ body: { url },
81
+ callOptions: options,
82
+ capability: "imports.fullSiteURL",
83
+ idempotent: true,
84
+ method: "POST",
85
+ operation: "imports.fullSiteURL.discover",
86
+ path: context.profile.mindPath("notebooks", notebook, "full-site-url-import", "discoveries"),
87
+ schema: fullSiteURLImportDiscoverySchema
88
+ });
89
+ },
33
90
  async getAliDingImportRun(notebookId, runId, options) {
34
91
  const notebook = requiredString(notebookId, "notebookId");
35
92
  const run = requiredString(runId, "runId");
@@ -1,4 +1,4 @@
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-BFU7amCH.js";
1
+ import { Q as voidResponseSchema, a as invalidArgument, c as optionalRecord, f as positiveInteger, l as optionalString, m as requiredString, n as call, p as queryPath, r as compactUndefined, s as optionalBoolean, t as assertNonEmptyPatch } from "./shared-DsqZroGJ.js";
2
2
  import { z } from "zod";
3
3
  //#region ../sdk/src/operations/management-schemas.ts
4
4
  const memberPermissionSchema = z.enum([
@@ -7,6 +7,14 @@ const memberPermissionSchema = z.enum([
7
7
  "edit",
8
8
  "view"
9
9
  ]);
10
+ const resolvedMemberCandidateSchema = z.object({ candidate: z.object({
11
+ userId: z.string().min(1),
12
+ name: z.string(),
13
+ email: z.string(),
14
+ avatar: z.string().optional(),
15
+ alreadyMember: z.boolean(),
16
+ matchedBy: z.enum(["email", "userId"])
17
+ }).nullable() });
10
18
  const notebookMemberSchema = z.object({
11
19
  addedBy: z.string().default(""),
12
20
  createdAt: z.string().default(""),
@@ -18,6 +26,19 @@ const notebookMemberSchema = z.object({
18
26
  userId: z.string().default("")
19
27
  });
20
28
  const notebookMemberListSchema = z.object({ members: z.array(notebookMemberSchema).nullish().transform((members) => members ?? []) });
29
+ const memberCandidateListSchema = z.object({
30
+ candidates: z.array(z.object({
31
+ userId: z.string().min(1),
32
+ name: z.string(),
33
+ email: z.string(),
34
+ avatar: z.string().optional(),
35
+ alreadyMember: z.boolean(),
36
+ matchedBy: z.enum(["email", "name"])
37
+ })).nullish().transform((candidates) => candidates ?? []),
38
+ currentPage: z.number().int().positive(),
39
+ pageSize: z.number().int().positive().max(50),
40
+ totalSize: z.number().int().nonnegative()
41
+ });
21
42
  const scheduledTaskSceneSchema = z.enum([
22
43
  "compilation",
23
44
  "condensation",
@@ -49,7 +70,6 @@ const compilationRunSchema = z.object({
49
70
  "REBUILD"
50
71
  ]),
51
72
  percent: z.number().min(0).max(100).default(0),
52
- publishedCardCount: z.number().int().nonnegative().default(0),
53
73
  runId: z.string().min(1),
54
74
  stage: z.string().optional(),
55
75
  startedAt: z.string().default(""),
@@ -130,15 +150,35 @@ function autoCompilePatch(value) {
130
150
  }
131
151
  function createManagementOperations(context) {
132
152
  return {
153
+ async resolveMemberCandidate(notebookId, input, options) {
154
+ const notebook = requiredString(notebookId, "notebookId");
155
+ const hasUserId = input?.userId !== void 0;
156
+ if (hasUserId === (input?.email !== void 0)) throw invalidArgument("exactly one of email or userId is required", "member");
157
+ const value = requiredString(hasUserId ? input.userId : input.email, hasUserId ? "userId" : "email");
158
+ if (hasUserId ? !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu.test(value) : !/^[^\s@]+@[^\s@]+\.[^\s@]+$/u.test(value)) throw invalidArgument("a complete email or UUID is required", hasUserId ? "userId" : "email");
159
+ return call(context, {
160
+ body: hasUserId ? { userId: value } : { email: value },
161
+ callOptions: options,
162
+ capability: "members.resolve",
163
+ idempotent: true,
164
+ method: "POST",
165
+ operation: "members.resolve",
166
+ path: context.profile.apiPath("notebooks", notebook, "member-candidates", "resolve"),
167
+ schema: resolvedMemberCandidateSchema
168
+ });
169
+ },
133
170
  async addMember(notebookId, input, options) {
134
171
  const notebook = requiredString(notebookId, "notebookId");
172
+ const hasUserId = input?.userId !== void 0;
173
+ if (hasUserId === (input?.email !== void 0)) throw invalidArgument("exactly one of email or userId is required", "member");
174
+ const identity = hasUserId ? { userId: requiredString(input.userId, "userId") } : { email: requiredString(input.email, "email") };
135
175
  return call(context, {
136
176
  body: {
137
- email: requiredString(input?.email, "email"),
177
+ ...identity,
138
178
  permission: memberPermission(input?.permission, "permission")
139
179
  },
140
180
  callOptions: options,
141
- capability: "members",
181
+ capability: hasUserId ? "members.search" : "members",
142
182
  idempotent: false,
143
183
  method: "POST",
144
184
  operation: "members.add",
@@ -146,6 +186,29 @@ function createManagementOperations(context) {
146
186
  schema: notebookMemberSchema
147
187
  });
148
188
  },
189
+ async searchMemberCandidates(input, options) {
190
+ const notebook = requiredString(input?.notebookId, "notebookId");
191
+ const query = requiredString(input?.query, "query");
192
+ if (Array.from(query).length > 100) throw invalidArgument("query must contain at most 100 Unicode characters", "query");
193
+ const page = positiveInteger(input?.page, "page") ?? 1;
194
+ const pageSize = positiveInteger(input?.pageSize, "pageSize") ?? 20;
195
+ if (page > 2147483647) throw invalidArgument("page must not exceed 2147483647", "page");
196
+ if (pageSize > 50) throw invalidArgument("pageSize must not exceed 50", "pageSize");
197
+ if ((page - 1) * pageSize > 2147483647) throw invalidArgument("pagination offset exceeds the supported range", "page");
198
+ return call(context, {
199
+ callOptions: options,
200
+ capability: "members.search",
201
+ idempotent: true,
202
+ method: "GET",
203
+ operation: "members.search",
204
+ path: queryPath(context.profile.apiPath("notebooks", notebook, "member-candidates"), [
205
+ ["query", query],
206
+ ["page", page],
207
+ ["page_size", pageSize]
208
+ ]),
209
+ schema: memberCandidateListSchema
210
+ });
211
+ },
149
212
  async createScheduledTask(notebookId, input, options) {
150
213
  const notebook = requiredString(notebookId, "notebookId");
151
214
  return call(context, {
@@ -1,4 +1,4 @@
1
- import { X as voidResponseSchema, Y as timestampSchema, c as optionalRecord, d as pagination, h as requiredText, l as optionalString, m as requiredString, n as call, p as queryPath, r as compactUndefined, t as assertNonEmptyPatch } from "./shared-BFU7amCH.js";
1
+ import { Q as voidResponseSchema, Z as timestampSchema, c as optionalRecord, d as pagination, h as requiredText, l as optionalString, m as requiredString, n as call, p as queryPath, r as compactUndefined, t as assertNonEmptyPatch } from "./shared-DsqZroGJ.js";
2
2
  import { z } from "zod";
3
3
  //#region ../sdk/src/operations/note-schemas.ts
4
4
  const noteSchema = z.object({