@qoder-ai/qmind-cli 5.0.0 → 5.1.1

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
+ ## 5.1.1
8
+
9
+ ### Patch Changes
10
+
11
+ - f070ae0: Update the CLI's HTML entity decoder to `entities@9.0.0`.
12
+
13
+ ## 5.1.0
14
+
15
+ ### Minor Changes
16
+
17
+ - 026d4ff: Use `retrieve --image <path>` to search with an image alone or combine it with text in a single notebook or across notebooks. JSON and NDJSON expose inline images from matching results.
18
+
7
19
  ## 5.0.0
8
20
 
9
21
  ### Major Changes
@@ -4,6 +4,18 @@
4
4
 
5
5
  以下已发布版本属于 Global CLI / 共享实现,不代表 CN 曾发布过这些版本。CN 将在后续共同发行版加入同一历史。
6
6
 
7
+ ## 5.1.1
8
+
9
+ ### Patch Changes
10
+
11
+ - f070ae0: 将 CLI 的 HTML 实体解码依赖升级到 `entities@9.0.0`。
12
+
13
+ ## 5.1.0
14
+
15
+ ### Minor Changes
16
+
17
+ - 026d4ff: 使用 `retrieve --image <path>` 在单库或跨库按图检索,也可以同时输入文字进行图文联合检索。JSON 和 NDJSON 输出包含命中结果中的内嵌图片。
18
+
7
19
  ## 5.0.0
8
20
 
9
21
  ### Major Changes
package/README.md CHANGED
@@ -189,7 +189,18 @@ qmind retrieve --nb <notebook-id> --unified --score-threshold 0.6 'Deployment pr
189
189
  qmind retrieve --targets '[{"notebookId":"nb-1","sourceIds":["source-1"]},{"notebookId":"nb-2","sourceIds":["source-2"]}]' --max-results 8 'Deployment process'
190
190
  ```
191
191
 
192
- `--targets` conflicts with `--nb` and `--sources` and supports independent Source filters per notebook. Unified retrieval defaults to maxResults=8 (1..50), with optional topK (1..100); zero selects the workflow default. There may be at most 32 unique targets. Results use the envelope above: read `data.chunks/data.promptContext`. `--score-threshold` accepts 0..1 and also works on the existing retrieval path. Zero budgets on the existing path still use server defaults; scripts are not silently migrated.
192
+ `--targets` conflicts with `--nb` and `--sources` and supports independent Source filters per notebook. Unified retrieval defaults to maxResults=8 (1..50), with optional topK (1..100); zero selects the workflow default. There may be at most 32 unique targets. Results use the envelope above: read `data.chunks/data.promptContext`. `--score-threshold` accepts 0..1 for non-OTS retrieval on either path. Zero budgets on the existing path still use server defaults; scripts are not silently migrated.
193
+
194
+ ### Search with an image
195
+
196
+ Use `--image <path>` with a single local JPEG, PNG, WebP, BMP, TIFF or GIF file up to 10 MiB. Omit the query for image-only retrieval, or add up to 128 UTF-16 code units of text as a positional query or `--query`. Image queries require OTS retrieval on the server.
197
+
198
+ ```bash
199
+ qmind retrieve --nb nb-1 --image ./diagram.png --format json
200
+ qmind retrieve --targets '[{"notebookId":"nb-1","sourceIds":["source-1"]},{"notebookId":"nb-2"}]' --image ./diagram.png "Find the deployment steps" --format json
201
+ ```
202
+
203
+ Use `--format json` or `--format ndjson` to read returned image bytes. Direct `--nb` retrieval exposes the data URL in `chunks[].metadata.imageDataUrl` (or `metadata.imageDataUrl` on each NDJSON chunk). With `--unified` or `--targets`, an image hit can contain `data.chunks[].image` with `mimeType` and Base64 `data`.
193
204
 
194
205
  ## Scheduled task configuration
195
206
 
package/README.zh-CN.md CHANGED
@@ -189,7 +189,18 @@ qmind retrieve --nb <notebook-id> --unified --score-threshold 0.6 '部署流程'
189
189
  qmind retrieve --targets '[{"notebookId":"nb-1","sourceIds":["source-1"]},{"notebookId":"nb-2","sourceIds":["source-2"]}]' --max-results 8 '部署流程'
190
190
  ```
191
191
 
192
- `--targets` 不能与 `--nb` 或 `--sources` 组合,每库可独立过滤 Source。统一检索默认 maxResults=8(1..50),topK 可选(1..100),0 表示使用该 workflow 的默认值;最多 32 个唯一目标。结果采用上述结构化 envelope,读取 `data.chunks/data.promptContext`;`--score-threshold` 范围为 0..1,旧检索入口也支持。旧路径的零预算继续使用服务端默认值,不隐式切换旧脚本。
192
+ `--targets` 不能与 `--nb` 或 `--sources` 组合,每库可独立过滤 Source。统一检索默认 maxResults=8(1..50),topK 可选(1..100),0 表示使用该 workflow 的默认值;最多 32 个唯一目标。结果采用上述结构化 envelope,读取 `data.chunks/data.promptContext`;`--score-threshold` 在两种入口均接受 0..1,由非 OTS 检索引擎执行。旧路径的零预算继续使用服务端默认值,不隐式切换旧脚本。
193
+
194
+ ### 图片和图文检索
195
+
196
+ 用 `--image <path>` 指定一张不超过 10 MiB 的本地图片,支持 JPEG、PNG、WebP、BMP、TIFF 和 GIF。省略文字时按图检索。图文联合检索可用位置参数或 `--query` 传入最多 128 个 UTF-16 代码单元的文字。含图查询需要服务端启用 OTS 检索。
197
+
198
+ ```bash
199
+ qmind retrieve --nb nb-1 --image ./diagram.png --format json
200
+ qmind retrieve --targets '[{"notebookId":"nb-1","sourceIds":["source-1"]},{"notebookId":"nb-2"}]' --image ./diagram.png "查找部署步骤" --format json
201
+ ```
202
+
203
+ 使用 `--format json` 或 `--format ndjson` 读取命中图片。直接用 `--nb` 时,图片 data URL 在 `chunks[].metadata.imageDataUrl`,NDJSON 则在每条 chunk 的 `metadata.imageDataUrl`。使用 `--unified` 或 `--targets` 时,命中可能在 `data.chunks[].image` 提供 `mimeType` 和 Base64 `data`。
193
204
 
194
205
  ## 定时任务配置
195
206
 
@@ -1,4 +1,4 @@
1
- import { C as dataSourceResourceSchema, D as qmindPath, S as dataSourcePreviewSchema, T as dataSourceSchema, b as dataSourceConfigurationSchema, m as requiredString, n as call, p as queryPath, w as dataSourceRunsSchema, x as dataSourceListSchema } from "./shared-evTnu_EB.js";
1
+ import { at as dataSourceConfigurationSchema, ct as dataSourceResourceSchema, lt as dataSourceRunsSchema, m as requiredString, n as call, ot as dataSourceListSchema, p as queryPath, st as dataSourcePreviewSchema, ut as dataSourceSchema, x as qmindPath } from "./shared-Cyj1bHGY.js";
2
2
  import { z } from "zod";
3
3
  //#region ../sdk/src/operations/data-sources.ts
4
4
  function createDataSourceOperations(context) {
@@ -18,7 +18,10 @@ function createDataSourceOperations(context) {
18
18
  body: {
19
19
  configuration: dataSourceConfigurationSchema.parse(configuration),
20
20
  credentials: credentials(secret),
21
- ...parentId ? { parentId } : {}
21
+ ...parentId ? { parentId } : {},
22
+ ...options?.checkImport ? { checkImport: true } : {},
23
+ ...options?.wikiSpaceUrl ? { wikiSpaceUrl: options.wikiSpaceUrl } : {},
24
+ ...options?.savedDataSourceId ? { savedDataSourceId: options.savedDataSourceId } : {}
22
25
  },
23
26
  schema: dataSourcePreviewSchema,
24
27
  callOptions: options
@@ -1,4 +1,4 @@
1
- import { A as aliDingImportRunSchema, B as importProvidersSchema, D as qmindPath, I as fullSiteURLImportConfirmationSchema, L as fullSiteURLImportDiscoverySchema, _ as assertCapability, a as invalidArgument, d as pagination, k as aliDingImportRunItemListSchema, lt as qmindFullSiteURLImportPageLimit, m as requiredString, n as call, p as queryPath } from "./shared-evTnu_EB.js";
1
+ import { A as fullSiteURLImportConfirmationSchema, C as aliDingImportRunItemListSchema, F as knowledgeImportProvidersSchema, P as importProvidersSchema, _ as assertCapability, a as invalidArgument, d as pagination, dt as QMindError, it as qmindFullSiteURLImportPageLimit, j as fullSiteURLImportDiscoverySchema, m as requiredString, n as call, p as queryPath, w as aliDingImportRunSchema, x as qmindPath } from "./shared-Cyj1bHGY.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;
@@ -50,9 +50,22 @@ function canonicalAliDingUrl(value, scope) {
50
50
  function importRunBody(input, scope) {
51
51
  const requestId = requiredString(input?.requestId, "requestId");
52
52
  if (!requestIdPattern.test(requestId.toLowerCase())) throw invalidArgument("requestId must be a UUID", "requestId");
53
+ const url = canonicalAliDingUrl(input?.url, scope);
54
+ const selection = input.selectedNodeIds;
55
+ if (selection !== void 0 && (!input.documentConnection || !Array.isArray(selection) || !selection.length || selection.length > 256 || selection.some((id) => typeof id !== "string" || !/^[A-Za-z0-9._~-]{1,256}$/.test(id) || id === "." || id === ".."))) throw invalidArgument("Invalid AliDing node selection", "selectedNodeIds");
56
+ if (input.documentConnection === void 0) return {
57
+ requestId,
58
+ url
59
+ };
60
+ if (scope !== "knowledgeBase") throw invalidArgument("OAuth requires a knowledge base", "documentConnection");
53
61
  return {
54
62
  requestId,
55
- url: canonicalAliDingUrl(input?.url, scope)
63
+ url,
64
+ ...selection && { selectedNodeIds: [...new Set(selection)].sort() },
65
+ documentConnection: {
66
+ serverId: requiredString(input.documentConnection?.serverId, "serverId"),
67
+ connectionId: requiredString(input.documentConnection?.connectionId, "connectionId")
68
+ }
56
69
  };
57
70
  }
58
71
  function createImportOperations(context) {
@@ -125,15 +138,27 @@ function createImportOperations(context) {
125
138
  },
126
139
  async listImportProviders(options) {
127
140
  assertCapability(context.capabilities, "imports.discover", "imports.discover");
128
- return call(context, {
141
+ const request = {
129
142
  callOptions: options,
130
143
  capability: "imports.discover",
131
144
  idempotent: true,
132
145
  method: "GET",
133
- operation: "imports.discover",
134
- path: qmindPath("import-sources"),
135
- schema: importProvidersSchema
136
- });
146
+ operation: "imports.discover"
147
+ };
148
+ try {
149
+ return await call(context, {
150
+ ...request,
151
+ path: qmindPath("import-sources"),
152
+ schema: importProvidersSchema
153
+ });
154
+ } catch (error) {
155
+ if (!(error instanceof QMindError) || error.status !== 404) throw error;
156
+ return call(context, {
157
+ ...request,
158
+ path: qmindPath("knowledge-capabilities"),
159
+ schema: knowledgeImportProvidersSchema
160
+ });
161
+ }
137
162
  },
138
163
  async startAliDingKnowledgeBaseImport(notebookId, input, options) {
139
164
  const notebook = requiredString(notebookId, "notebookId");
@@ -146,7 +171,7 @@ function createImportOperations(context) {
146
171
  idempotent: false,
147
172
  method: "POST",
148
173
  operation: "imports.aliDing.createKnowledgeBaseRun",
149
- path: qmindPath("notebooks", notebook, "aliding", "knowledge-base-import-runs"),
174
+ path: qmindPath("notebooks", notebook, "aliding", input.selectedNodeIds ? "selected-import-runs" : "knowledge-base-import-runs"),
150
175
  schema: aliDingImportRunSchema
151
176
  });
152
177
  },
@@ -1,4 +1,4 @@
1
- import { D as qmindPath, a as invalidArgument, c as optionalRecord, ct as voidResponseSchema, l as optionalString, m as requiredString, n as call, r as compactUndefined, s as optionalBoolean, t as assertNonEmptyPatch, ut as QMindError } from "./shared-evTnu_EB.js";
1
+ import { a as invalidArgument, c as optionalRecord, dt as QMindError, l as optionalString, m as requiredString, n as call, r as compactUndefined, rt as voidResponseSchema, s as optionalBoolean, t as assertNonEmptyPatch, x as qmindPath } from "./shared-Cyj1bHGY.js";
2
2
  import { z } from "zod";
3
3
  //#region ../sdk/src/operations/management-schemas.ts
4
4
  const memberPermissionSchema = z.enum([
@@ -1,4 +1,4 @@
1
- import { E as pathBuilder, ut as QMindError } from "./shared-evTnu_EB.js";
1
+ import { b as pathBuilder, dt as QMindError } from "./shared-Cyj1bHGY.js";
2
2
  //#region ../sdk/src/nezha.ts
3
3
  const dashboardPath = pathBuilder("/api/v1");
4
4
  const sashPath = pathBuilder("/sash/api/v1");
@@ -1,4 +1,4 @@
1
- import { D as qmindPath, c as optionalRecord, ct as voidResponseSchema, d as pagination, h as requiredText, l as optionalString, m as requiredString, n as call, p as queryPath, r as compactUndefined, st as timestampSchema, t as assertNonEmptyPatch } from "./shared-evTnu_EB.js";
1
+ import { c as optionalRecord, d as pagination, h as requiredText, l as optionalString, m as requiredString, n as call, nt as timestampSchema, p as queryPath, r as compactUndefined, rt as voidResponseSchema, t as assertNonEmptyPatch, x as qmindPath } from "./shared-Cyj1bHGY.js";
2
2
  import { z } from "zod";
3
3
  //#region ../sdk/src/operations/note-schemas.ts
4
4
  const noteSchema = z.object({