@qoder-ai/qmind-cli 3.1.1 → 3.2.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,22 @@ 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.2.1
8
+
9
+ ### Patch Changes
10
+
11
+ - cb40928: Bundle the SDK fix for Source ID citations in streamed messages so qmind and qmind-cn finish RAG responses with references instead of failing with STREAM_ERROR.
12
+
13
+ ## 3.2.0
14
+
15
+ ### Minor Changes
16
+
17
+ - 7fd1634: Remove the top-level `compile` and `lint` commands and the `source import-site --compile-after-refresh` option, and make `task create` reject the `compilation` and `lint` scenes. `task list` and `task get` can still query historical runs; SDK, UI, backend automatic compilation, and internal capabilities are unchanged.
18
+
19
+ ### Changes without version bumps
20
+
21
+ - Show concise Preparing, Downloading with live transfer progress, and Installed stages in the native `qmind` and `qmind-cn` installers.
22
+
7
23
  ## 3.1.1
8
24
 
9
25
  ### Patch Changes
@@ -4,6 +4,22 @@
4
4
 
5
5
  以下已发布版本属于 Global CLI / 共享实现,不代表 CN 曾发布过这些版本。CN 将在后续共同发行版加入同一历史。
6
6
 
7
+ ## 3.2.1
8
+
9
+ ### Patch Changes
10
+
11
+ - cb40928: 打包 SDK 的流消息 Source ID 引用兼容修复,使 qmind 和 qmind-cn 能正常完成带引用的 RAG 回复,避免 STREAM_ERROR。
12
+
13
+ ## 3.2.0
14
+
15
+ ### Minor Changes
16
+
17
+ - 7fd1634: 移除顶层 `compile`、`lint` 命令及 `source import-site --compile-after-refresh` 选项,并让 `task create` 拒绝 `compilation` 与 `lint` 场景。`task list` 和 `task get` 仍可查询历史运行;SDK、UI、后端自动编译及内部能力不受影响。
18
+
19
+ ### Changes without version bumps
20
+
21
+ - 为 Native `qmind` 和 `qmind-cn` 安装器展示精简的 Preparing、带实时传输进度的 Downloading 和 Installed 三个阶段。
22
+
7
23
  ## 3.1.1
8
24
 
9
25
  ### Patch Changes
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [简体中文](./README.zh-CN.md)
4
4
 
5
- The QMind command-line interface for Qoder Global lets you sign in, manage knowledge bases and sources, retrieve content, run RAG and compilation workflows, and synchronize local directories.
5
+ The QMind command-line interface for Qoder Global lets you sign in, manage knowledge bases and sources, retrieve content, run RAG and task workflows, and synchronize local directories.
6
6
 
7
7
  Package: `@qoder-ai/qmind-cli` · command: `qmind`
8
8
 
@@ -63,13 +63,14 @@ Do not put tokens in command arguments, repositories, or logs. Run `qmind logout
63
63
  | `source` | Manage knowledge-base sources |
64
64
  | `retrieve` | Retrieve context without invoking an LLM |
65
65
  | `rag` | Ask questions using a knowledge base |
66
- | `compile` / `lint` | Run compilation or validation workflows |
67
66
  | `task` | Manage task runs |
68
67
  | `upload-folder` / `sync` | Synchronize a local directory |
69
68
  | `image` | Obtain image upload or access URLs |
70
69
  | `version` | Print version and build information |
71
70
  | `update` / `self-update` | Update an installer-managed Native CLI |
72
71
 
72
+ `task create` does not start `compilation` or `lint` runs; `task list` and `task get` can still inspect historical runs for those scenes. `source import-site` does not provide an automatic compilation option.
73
+
73
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.
74
75
 
75
76
  ## Directory synchronization
package/README.zh-CN.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [English](./README.md)
4
4
 
5
- 面向 Qoder Global 的 QMind 命令行工具,可用于登录、管理知识库和来源、检索内容、运行 RAG/编译任务,以及把本地目录同步到知识库。
5
+ 面向 Qoder Global 的 QMind 命令行工具,可用于登录、管理知识库和来源、检索内容、运行 RAG 与任务工作流,以及把本地目录同步到知识库。
6
6
 
7
7
  npm 包:`@qoder-ai/qmind-cli` · 命令:`qmind`
8
8
 
@@ -63,13 +63,14 @@ qmind retrieve --nb <notebook-id> --format agent "部署流程是什么?"
63
63
  | `source` | 管理知识库来源 |
64
64
  | `retrieve` | 检索上下文,不发起 LLM 调用 |
65
65
  | `rag` | 基于知识库提问 |
66
- | `compile` / `lint` | 运行编译或检查工作流 |
67
66
  | `task` | 管理任务运行 |
68
67
  | `upload-folder` / `sync` | 同步本地目录 |
69
68
  | `image` | 获取图片上传地址或访问地址 |
70
69
  | `version` | 查看版本和构建信息 |
71
70
  | `update` / `self-update` | 更新 installer 管理的 Native CLI |
72
71
 
72
+ `task create` 不会启动 `compilation` 或 `lint` 运行;仍可通过 `task list` 和 `task get` 查询这些场景的历史运行。`source import-site` 不提供自动编译选项。
73
+
73
74
  使用 `qmind <command> --help` 查看完整参数。领域命令支持 `table`、`json`、`agent`、`ndjson` 等输出格式。stdout 只输出结果,进度与诊断信息输出到 stderr。退出码 `0` 表示成功,`1` 表示运行失败、部分成功或取消,`2` 表示参数错误。
74
75
 
75
76
  ## 同步目录
@@ -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-9iPJsfjP.js";
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";
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,4 +1,4 @@
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-9iPJsfjP.js";
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-BFU7amCH.js";
2
2
  import { z } from "zod";
3
3
  //#region ../sdk/src/operations/compilation-results.ts
4
4
  function linksBody(value, field) {
@@ -1,4 +1,4 @@
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-9iPJsfjP.js";
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";
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;
@@ -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-9iPJsfjP.js";
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";
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 { 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-9iPJsfjP.js";
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";
2
2
  import { z } from "zod";
3
3
  //#region ../sdk/src/operations/note-schemas.ts
4
4
  const noteSchema = z.object({
package/dist/qmind.js CHANGED
@@ -1,5 +1,5 @@
1
- import { A as notebookSchema, B as sourceSchema, C as chatMessageListSchema, D as imageUrlsSchema, E as imageUploadTicketSchema, F as sourceContentSchema, G as sourceWebOfficeTokenSchema, H as sourceUploadCapabilitiesSchema, I as sourceImportResultsSchema, J as taskRunSchema, K as streamWireEventSchema, L as sourceListSchema, M as sharedNotebookListSchema, N as sourceActionAccessSchema, P as sourceChildrenCountsSchema, R as sourcePreviewSchema, T as chatSessionSchema, V as sourceTreeSchema, W as sourceWebOfficeSessionSchema, X as voidResponseSchema, Z as wikiBranchListSchema, a as invalidArgument$1, b as cancelQuestionResultSchema, c as optionalRecord, d as pagination$1, et as assertCapability, f as positiveInteger$1, g as stringList, i as httpUrl, j as retrieveResultSchema, k as notebookListSchema, l as optionalString$1, m as requiredString$2, n as call, o as nonNegativeInteger$1, p as queryPath, q as taskRunListSchema, r as compactUndefined, rt as QMindError, s as optionalBoolean, t as assertNonEmptyPatch, tt as executeStream, u as optionalTrimmedString, w as chatSessionListSchema, y as batchMutationResultSchema, z as sourceRawContentSchema } from "./shared-9iPJsfjP.js";
2
- import { t as preflightSourceUpload } from "./source-upload-mZ-N52xb.js";
1
+ import { A as notebookSchema, B as sourceSchema, C as chatMessageListSchema, D as imageUrlsSchema, E as imageUploadTicketSchema, F as sourceContentSchema, G as sourceWebOfficeTokenSchema, H as sourceUploadCapabilitiesSchema, I as sourceImportResultsSchema, J as taskRunSchema, K as streamWireEventSchema, L as sourceListSchema, M as sharedNotebookListSchema, N as sourceActionAccessSchema, P as sourceChildrenCountsSchema, R as sourcePreviewSchema, T as chatSessionSchema, V as sourceTreeSchema, W as sourceWebOfficeSessionSchema, X as voidResponseSchema, Z as wikiBranchListSchema, a as invalidArgument$1, b as cancelQuestionResultSchema, c as optionalRecord, d as pagination$1, et as assertCapability, f as positiveInteger$1, g as stringList, i as httpUrl, j as retrieveResultSchema, k as notebookListSchema, l as optionalString$1, m as requiredString$2, n as call, o as nonNegativeInteger$1, p as queryPath, q as taskRunListSchema, r as compactUndefined, rt as QMindError, s as optionalBoolean, t as assertNonEmptyPatch, tt as executeStream, u as optionalTrimmedString, w as chatSessionListSchema, y as batchMutationResultSchema, z as sourceRawContentSchema } from "./shared-BFU7amCH.js";
2
+ import { t as preflightSourceUpload } from "./source-upload-D3rcA1v1.js";
3
3
  import { createInterface } from "node:readline/promises";
4
4
  import { basename, dirname, extname, join, relative, resolve, sep } from "node:path";
5
5
  import { z } from "zod";
@@ -22,7 +22,7 @@ import { promisify } from "node:util";
22
22
  import semver from "semver";
23
23
  //#region ../sdk/src/operations/agents.ts
24
24
  const workflowPrompt = "Follow the system prompt strictly: use the provided tools to discover, process and prepare the result, then emit the final report. Do NOT greet, do NOT ask for clarification — act immediately.";
25
- function isRecord$2(value) {
25
+ function isRecord$3(value) {
26
26
  return typeof value === "object" && value !== null && !Array.isArray(value);
27
27
  }
28
28
  function finiteNumber(value, field) {
@@ -66,7 +66,7 @@ function billingContext(value) {
66
66
  });
67
67
  }
68
68
  function retrieveBody(input) {
69
- if (!isRecord$2(input)) throw invalidArgument$1("input must be an object", "input");
69
+ if (!isRecord$3(input)) throw invalidArgument$1("input must be an object", "input");
70
70
  return compactUndefined({
71
71
  billingContext: billingContext(input.billingContext),
72
72
  maxResults: nonNegativeInteger$1(input.maxResults, "maxResults"),
@@ -78,7 +78,7 @@ function retrieveBody(input) {
78
78
  });
79
79
  }
80
80
  function chatSessionBody(input = {}) {
81
- if (!isRecord$2(input)) throw invalidArgument$1("input must be an object", "input");
81
+ if (!isRecord$3(input)) throw invalidArgument$1("input must be an object", "input");
82
82
  return compactUndefined({
83
83
  metadata: optionalRecord(input.metadata, "metadata"),
84
84
  modelOverride: optionalTrimmedString(input.modelOverride, "modelOverride"),
@@ -88,7 +88,7 @@ function chatSessionBody(input = {}) {
88
88
  });
89
89
  }
90
90
  function streamBody(input) {
91
- if (!isRecord$2(input)) throw invalidArgument$1("input must be an object", "input");
91
+ if (!isRecord$3(input)) throw invalidArgument$1("input must be an object", "input");
92
92
  return compactUndefined({
93
93
  content: requiredString$2(input.content, "content"),
94
94
  maxResults: nonNegativeInteger$1(input.maxResults, "maxResults"),
@@ -99,7 +99,7 @@ function streamBody(input) {
99
99
  });
100
100
  }
101
101
  function taskRunBody(input) {
102
- if (!isRecord$2(input)) throw invalidArgument$1("input must be an object", "input");
102
+ if (!isRecord$3(input)) throw invalidArgument$1("input must be an object", "input");
103
103
  return compactUndefined({
104
104
  chatSessionId: optionalTrimmedString(input.chatSessionId, "chatSessionId"),
105
105
  config: optionalRecord(input.config, "config"),
@@ -112,7 +112,7 @@ function taskRunBody(input) {
112
112
  });
113
113
  }
114
114
  function taskRunListPath(context, notebookId, input = {}) {
115
- if (!isRecord$2(input)) throw invalidArgument$1("input must be an object", "input");
115
+ if (!isRecord$3(input)) throw invalidArgument$1("input must be an object", "input");
116
116
  const normalizedPage = pagination$1(input);
117
117
  const status = optionalTrimmedString(input.status, "status");
118
118
  if (status !== void 0 && ![
@@ -219,7 +219,7 @@ function createAgentOperations(context) {
219
219
  const cancelQuestionFor = (notebookId, sessionId, input = {}, options, featured = false) => {
220
220
  const notebook = requiredString$2(notebookId, "notebookId");
221
221
  const session = requiredString$2(sessionId, "sessionId");
222
- if (!isRecord$2(input)) throw invalidArgument$1("input must be an object", "input");
222
+ if (!isRecord$3(input)) throw invalidArgument$1("input must be an object", "input");
223
223
  return call(context, {
224
224
  body: compactUndefined({ reason: optionalTrimmedString(input.reason, "reason") }),
225
225
  callOptions: options,
@@ -278,7 +278,7 @@ function createAgentOperations(context) {
278
278
  });
279
279
  };
280
280
  const startAgentRunFor = async (notebookId, input, options, featured) => {
281
- if (!isRecord$2(input)) throw invalidArgument$1("input must be an object", "input");
281
+ if (!isRecord$3(input)) throw invalidArgument$1("input must be an object", "input");
282
282
  if (input.scene !== "rag" && input.scene !== "compilation" && input.scene !== "lint") throw invalidArgument$1("scene must be rag, compilation or lint", "scene");
283
283
  const notebook = requiredString$2(notebookId, "notebookId");
284
284
  const scene = input.scene;
@@ -514,6 +514,84 @@ function createNotebookOperations(context) {
514
514
  };
515
515
  }
516
516
  //#endregion
517
+ //#region ../sdk/src/source-email-folder.ts
518
+ /** The email aggregate directory marker shared by tree projection and source readers. */
519
+ function isQMindEmailFolder(source) {
520
+ return source?.isDir === true && source.metadata?.emailFolder === true;
521
+ }
522
+ //#endregion
523
+ //#region ../sdk/src/sources.ts
524
+ function metadataOf(source) {
525
+ const metadata = source?.metadata;
526
+ return metadata !== null && typeof metadata === "object" ? metadata : {};
527
+ }
528
+ function isRecord$2(value) {
529
+ return typeof value === "object" && value !== null && !Array.isArray(value);
530
+ }
531
+ function text(value) {
532
+ return typeof value === "string" ? value : "";
533
+ }
534
+ function metadataText(source, ...keys) {
535
+ const metadata = metadataOf(source);
536
+ for (const key of keys) {
537
+ const value = metadata[key];
538
+ if (typeof value === "string" && value.trim().length > 0) return value.trim();
539
+ }
540
+ return "";
541
+ }
542
+ /**
543
+ * The canonical stored format of a source, which QMind reports separately from the MIME type
544
+ * because one MIME type can back several formats.
545
+ */
546
+ function qmindSourceFormat(source) {
547
+ const format = metadataText(source, "sourceFormat", "source_format").toLowerCase().replace(/^\./, "");
548
+ if (format === "markdown" || format === "mdown" || format === "mdx") return "md";
549
+ return format === "htm" ? "html" : format;
550
+ }
551
+ function isQMindEmailSource(source) {
552
+ return source?.sourceType.toLowerCase() === "email" && qmindSourceFormat(source) === "eml";
553
+ }
554
+ function qmindEmailAttachmentRef(source) {
555
+ const value = metadataOf(source).emailAttachment;
556
+ if (!isRecord$2(value)) return null;
557
+ return Object.freeze({
558
+ emailSourceId: text(value.emailSourceId),
559
+ index: typeof value.index === "number" && Number.isFinite(value.index) ? Math.floor(value.index) : -1,
560
+ parentSentAt: text(value.parentSentAt),
561
+ parentSubject: text(value.parentSubject)
562
+ });
563
+ }
564
+ /** The id of the email body source this source belongs to, or '' when it is not part of an email. */
565
+ function qmindEmailSourceId(source) {
566
+ if (isQMindEmailFolder(source)) return text(metadataOf(source).emailSourceId);
567
+ const attachment = qmindEmailAttachmentRef(source);
568
+ if (attachment !== null) return attachment.emailSourceId;
569
+ return isQMindEmailSource(source) ? source?.id ?? "" : "";
570
+ }
571
+ /**
572
+ * A body and its attachments cannot leave their email folder, because the folder is what carries
573
+ * the email identity.
574
+ */
575
+ function isQMindEmailAggregateMember(source, siblings) {
576
+ if (source === null || source === void 0 || isQMindEmailFolder(source)) return false;
577
+ if (qmindEmailAttachmentRef(source) !== null) return true;
578
+ if (!isQMindEmailSource(source) || source.parentSourceId.length === 0) return false;
579
+ const parent = siblings.find((item) => item.id === source.parentSourceId);
580
+ return isQMindEmailFolder(parent) && qmindEmailSourceId(parent) === source.id;
581
+ }
582
+ /** The external provider that owns this source, lowercased, or '' when QMind owns it. */
583
+ function qmindSourceProvider(source) {
584
+ return (source?.externalBinding?.provider ?? metadataText(source, "externalProvider", "external_provider")).toLowerCase();
585
+ }
586
+ /**
587
+ * `externalBinding` is authoritative; the metadata fallback keeps sources readable on gateways that
588
+ * do not project the binding yet.
589
+ */
590
+ function isQMindExternalSource(source) {
591
+ return source?.externalBinding !== void 0 || qmindSourceProvider(source) === "aliding";
592
+ }
593
+ [.../* @__PURE__ */ new Set(["axls", "alxs"])];
594
+ //#endregion
517
595
  //#region ../sdk/src/operations/sources.ts
518
596
  const maxImageBytes = 52428800;
519
597
  function sourceTreeNodeOrder(left, right) {
@@ -543,6 +621,10 @@ function buildSourceTree(sources) {
543
621
  const nodesById = /* @__PURE__ */ new Map();
544
622
  for (const source of sources) nodesById.set(source.id, {
545
623
  ...source.externalBinding === void 0 ? {} : { externalBinding: source.externalBinding },
624
+ ...source.originUrl === void 0 ? {} : { originUrl: source.originUrl },
625
+ isEmailFolder: isQMindEmailFolder(source),
626
+ isEmailAggregateMember: isQMindEmailAggregateMember(source, sources),
627
+ isExternalSource: isQMindExternalSource(source),
546
628
  files: [],
547
629
  hasChildren: source.hasChildren ?? (source.childrenCount === void 0 ? source.isDir : source.childrenCount > 0),
548
630
  id: source.id,
@@ -1470,7 +1552,7 @@ const botGatewayOperationNames = [
1470
1552
  function createLazyTransferOperations(context) {
1471
1553
  let operations;
1472
1554
  const load = () => {
1473
- operations ??= import("./transfers-BRx_Hrlz.js").then(({ createTransferOperations }) => createTransferOperations(context));
1555
+ operations ??= import("./transfers-CzWL9766.js").then(({ createTransferOperations }) => createTransferOperations(context));
1474
1556
  return operations;
1475
1557
  };
1476
1558
  return {
@@ -1481,7 +1563,7 @@ function createLazyTransferOperations(context) {
1481
1563
  function createLazyBotGatewayOperations(context) {
1482
1564
  let operations;
1483
1565
  const load = () => {
1484
- operations ??= import("./bot-gateway-CB6KrV15.js").then(({ createBotGatewayOperations }) => createBotGatewayOperations(context));
1566
+ operations ??= import("./bot-gateway-C0KmAiBy.js").then(({ createBotGatewayOperations }) => createBotGatewayOperations(context));
1485
1567
  return operations;
1486
1568
  };
1487
1569
  return Object.fromEntries(botGatewayOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
@@ -1489,7 +1571,7 @@ function createLazyBotGatewayOperations(context) {
1489
1571
  function createLazyNoteOperations(context) {
1490
1572
  let operations;
1491
1573
  const load = () => {
1492
- operations ??= import("./notes-CxkxuWdP.js").then(({ createNoteOperations }) => createNoteOperations(context));
1574
+ operations ??= import("./notes-B9mcsP2n.js").then(({ createNoteOperations }) => createNoteOperations(context));
1493
1575
  return operations;
1494
1576
  };
1495
1577
  return Object.fromEntries(noteOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
@@ -1497,7 +1579,7 @@ function createLazyNoteOperations(context) {
1497
1579
  function createLazyCardOperations(context) {
1498
1580
  let operations;
1499
1581
  const load = () => {
1500
- operations ??= import("./cards-JaeY0mah.js").then(({ createCardOperations }) => createCardOperations(context));
1582
+ operations ??= import("./cards-YqfPPr12.js").then(({ createCardOperations }) => createCardOperations(context));
1501
1583
  return operations;
1502
1584
  };
1503
1585
  return Object.fromEntries(cardOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
@@ -1505,7 +1587,7 @@ function createLazyCardOperations(context) {
1505
1587
  function createLazyImportOperations(context) {
1506
1588
  let operations;
1507
1589
  const load = () => {
1508
- operations ??= import("./imports-CHEgKeR5.js").then(({ createImportOperations }) => createImportOperations(context));
1590
+ operations ??= import("./imports-CkLS3Vqu.js").then(({ createImportOperations }) => createImportOperations(context));
1509
1591
  return operations;
1510
1592
  };
1511
1593
  return Object.fromEntries(importOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
@@ -1513,7 +1595,7 @@ function createLazyImportOperations(context) {
1513
1595
  function createLazyManagementOperations(context) {
1514
1596
  let operations;
1515
1597
  const load = () => {
1516
- operations ??= import("./management-J4OEjnLA.js").then(({ createManagementOperations }) => createManagementOperations(context));
1598
+ operations ??= import("./management-BqqR6Ihj.js").then(({ createManagementOperations }) => createManagementOperations(context));
1517
1599
  return operations;
1518
1600
  };
1519
1601
  return Object.fromEntries(managementOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
@@ -2311,6 +2393,26 @@ async function atomicQMindWrite(path, content, overwrite = false) {
2311
2393
  }
2312
2394
  }
2313
2395
  //#endregion
2396
+ //#region ../node-host/src/request-budget.ts
2397
+ function createRequestBudgetTransport(transport, budget) {
2398
+ const withinBudget = (request) => {
2399
+ const current = budget();
2400
+ if (!current) return request;
2401
+ const remaining = Math.ceil(current.deadlineAt - Date.now());
2402
+ if (remaining <= 0) throw new QMindError("TIMEOUT", "Request deadline exceeded.");
2403
+ if (current.signal.aborted) throw new QMindError("ABORTED", "QMind request was aborted");
2404
+ return {
2405
+ ...request,
2406
+ timeoutMs: Math.min(request.timeoutMs ?? remaining, remaining),
2407
+ signal: request.signal ? AbortSignal.any([request.signal, current.signal]) : current.signal
2408
+ };
2409
+ };
2410
+ return {
2411
+ request: async (request) => await transport.request(withinBudget(request)),
2412
+ stream: async (request) => await transport.stream(withinBudget(request))
2413
+ };
2414
+ }
2415
+ //#endregion
2314
2416
  //#region ../node-host/src/node-transport.ts
2315
2417
  const RETRYABLE_STATUS = /* @__PURE__ */ new Set([
2316
2418
  408,
@@ -2327,6 +2429,7 @@ const CREDENTIAL_HEADERS = /* @__PURE__ */ new Set([
2327
2429
  "x-csrf-token",
2328
2430
  "x-xsrf-token"
2329
2431
  ]);
2432
+ const DOWNLOAD_ERROR_MAX_BYTES = 65536;
2330
2433
  const SSE_MAX_BUFFER_SIZE = 8388608;
2331
2434
  function invalidArgument(message, field) {
2332
2435
  return new QMindError("INVALID_ARGUMENT", message, { details: { field } });
@@ -2417,8 +2520,26 @@ function parseRawBody(rawBody) {
2417
2520
  return rawBody;
2418
2521
  }
2419
2522
  }
2420
- async function wireResponse(response) {
2421
- const rawBody = await response.body.text();
2523
+ async function wireResponse(response, maxBytes) {
2524
+ let rawBody;
2525
+ if (maxBytes === void 0) rawBody = await response.body.text();
2526
+ else {
2527
+ const chunks = [];
2528
+ let bytes = 0;
2529
+ try {
2530
+ if (Number(response.headers["content-length"]) > maxBytes) throw new QMindError("FILE_TOO_LARGE", "Response exceeds read limit");
2531
+ for await (const chunk of response.body) {
2532
+ const value = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
2533
+ bytes += value.byteLength;
2534
+ if (bytes > maxBytes) throw new QMindError("FILE_TOO_LARGE", "Response exceeds read limit");
2535
+ chunks.push(value);
2536
+ }
2537
+ rawBody = Buffer.concat(chunks, bytes).toString("utf8");
2538
+ } finally {
2539
+ response.body.on("error", () => {});
2540
+ response.body.destroy();
2541
+ }
2542
+ }
2422
2543
  return {
2423
2544
  body: parseRawBody(rawBody),
2424
2545
  headers: headersToRecord(response.headers),
@@ -2427,6 +2548,7 @@ async function wireResponse(response) {
2427
2548
  };
2428
2549
  }
2429
2550
  function assertWireRequest(request) {
2551
+ if (request.maxResponseBytes !== void 0) positiveInteger(request.maxResponseBytes, request.maxResponseBytes, "maxResponseBytes");
2430
2552
  if (request.timeoutMs !== void 0) positiveInteger(request.timeoutMs, request.timeoutMs, "timeoutMs");
2431
2553
  if (request.destination.kind === "host") {
2432
2554
  if (!request.destination.path.startsWith("/") || request.destination.path.startsWith("//")) throw new QMindError("HOST_POLICY_ERROR", "host destination must be root-relative");
@@ -2669,7 +2791,7 @@ function createQMindNodeTransport(options) {
2669
2791
  ...download.signal === void 0 ? {} : { signal: download.signal }
2670
2792
  });
2671
2793
  if (response.statusCode < 200 || response.statusCode >= 300) {
2672
- const decoded = await wireResponse(response);
2794
+ const decoded = await wireResponse(response, DOWNLOAD_ERROR_MAX_BYTES);
2673
2795
  throw new QMindError("REMOTE_ERROR", "download request failed", {
2674
2796
  ...decoded.rawBody === void 0 ? {} : { rawBody: decoded.rawBody },
2675
2797
  status: decoded.status
@@ -2712,12 +2834,17 @@ function createQMindNodeTransport(options) {
2712
2834
  signal: deadline.signal
2713
2835
  });
2714
2836
  if (attempt + 1 < attempts && RETRYABLE_STATUS.has(response.statusCode)) {
2715
- await response.body.dump();
2837
+ if (request$2.maxResponseBytes === void 0) await response.body.dump();
2838
+ else {
2839
+ response.body.on("error", () => {});
2840
+ response.body.destroy();
2841
+ }
2716
2842
  await abortableSleep(250 * 2 ** attempt, deadline.signal);
2717
2843
  continue;
2718
2844
  }
2719
- return await wireResponse(response);
2845
+ return await wireResponse(response, request$2.maxResponseBytes);
2720
2846
  } catch (cause) {
2847
+ if (cause instanceof QMindError && cause.code === "FILE_TOO_LARGE") throw cause;
2721
2848
  lastFailure = cause;
2722
2849
  if (attempt + 1 >= attempts || request$2.signal?.aborted === true || deadline.timedOut) break;
2723
2850
  try {
@@ -2762,7 +2889,7 @@ function createQMindNodeTransport(options) {
2762
2889
  const headers = headersToRecord(response.headers);
2763
2890
  if (response.statusCode < 200 || response.statusCode >= 300 || !headers["content-type"]?.toLowerCase().includes("text/event-stream")) try {
2764
2891
  return {
2765
- ...await wireResponse(response),
2892
+ ...await wireResponse(response, request$3.maxResponseBytes),
2766
2893
  kind: "response"
2767
2894
  };
2768
2895
  } finally {
@@ -2890,7 +3017,8 @@ async function createQMindCliHost(options = {}) {
2890
3017
  }
2891
3018
  };
2892
3019
  const ownedTransport = options.adapters?.transport === void 0 ? createQMindNodeTransport(nodeOptions) : void 0;
2893
- const rawTransport = options.adapters?.transport ?? ownedTransport;
3020
+ const baseTransport = options.adapters?.transport ?? ownedTransport;
3021
+ const rawTransport = baseTransport && options.adapters?.requestBudget ? createRequestBudgetTransport(baseTransport, options.adapters.requestBudget) : baseTransport;
2894
3022
  if (rawTransport === void 0) throw new QMindError("HOST_POLICY_ERROR", "unable to initialize the QMind transport");
2895
3023
  const auth = createQMindCliAuthManager({
2896
3024
  browser: options.adapters?.browser ?? defaultBrowser(),
@@ -2976,8 +3104,8 @@ function requestsJsonOutput(argv) {
2976
3104
  //#region src/build-info.ts
2977
3105
  /** Bundled identity, never inferred from argv, environment, or an endpoint. */
2978
3106
  const QMIND_CLI_DISTRIBUTION = "global";
2979
- const QMIND_CLI_VERSION = "3.1.1";
2980
- const QMIND_CLI_BUILD_TIME = "2026-09-04T10:59:00.000Z";
3107
+ const QMIND_CLI_VERSION = "3.2.1";
3108
+ const QMIND_CLI_BUILD_TIME = "2026-09-08T12:44:54.000Z";
2981
3109
  function qmindCliPlatform() {
2982
3110
  return process.platform === "win32" ? "windows" : process.platform;
2983
3111
  }
@@ -4464,11 +4592,10 @@ function registerSourceCommands(context, program) {
4464
4592
  await host.client.deleteSource(notebookId, sourceId);
4465
4593
  context.io.stdout("deleted\n");
4466
4594
  });
4467
- withCommon(source.command("import-site").description("Import a complete web site")).option("--nb <id>", "notebook ID (required)").option("--url <url>", "site root URL (required)").option("--title <title>", "source title").option("--parent <id>", "parent source ID", "").option("--path-prefix <path>", "path prefix", "").option("--max-pages <number>", "maximum page count", integer, 50).option("--sitemap <url>", "sitemap URL", "").option("--include <patterns>", "comma-separated include patterns", "").option("--exclude <patterns>", "comma-separated exclude patterns", "").option("--compile-after-refresh", "enqueue compilation after import").action(async (raw) => {
4595
+ withCommon(source.command("import-site").description("Import a complete web site")).option("--nb <id>", "notebook ID (required)").option("--url <url>", "site root URL (required)").option("--title <title>", "source title").option("--parent <id>", "parent source ID", "").option("--path-prefix <path>", "path prefix", "").option("--max-pages <number>", "maximum page count", integer, 50).option("--sitemap <url>", "sitemap URL", "").option("--include <patterns>", "comma-separated include patterns", "").option("--exclude <patterns>", "comma-separated exclude patterns", "").action(async (raw) => {
4468
4596
  const host = await hostFor(context, raw);
4469
4597
  const rootUrl = requiredString(raw.url, "--url");
4470
4598
  const value = await host.client.importSite(requiredString(raw.nb, "--nb"), {
4471
- compileAfterRefresh: raw.compileAfterRefresh === true,
4472
4599
  excludePaths: splitCsv(stringOption(raw, "exclude")),
4473
4600
  includePaths: splitCsv(stringOption(raw, "include")),
4474
4601
  maxPages: numberOption(raw, "maxPages", 50),
@@ -4535,20 +4662,19 @@ function registerSceneCommands(context, program) {
4535
4662
  topK: numberOption(raw, "topK", 0)
4536
4663
  });
4537
4664
  });
4538
- for (const [name, scene] of [["compile", "compilation"], ["lint", "lint"]]) withCommon(program.command(name).description(`Run notebook ${scene}`)).option("--nb <id>", "notebook ID (required)").action(async (raw) => {
4539
- await renderAgentRun(context, await hostFor(context, raw), requiredString(raw.nb, "--nb"), raw, { scene });
4540
- });
4541
4665
  }
4542
4666
  function registerTaskCommands(context, program) {
4543
4667
  const task = program.command("task").description("Manage notebook task runs");
4544
- withCommon(task.command("create").description("Create a notebook task run")).option("--nb <id>", "notebook ID (required)").option("--scene <scene>", "task scene: compilation | source_refresh | condensation | lint").option("--trigger <trigger>", "task trigger", "manual").option("--sources <ids>", "comma-separated source IDs", "").action(async (raw) => {
4668
+ withCommon(task.command("create").description("Create a notebook task run")).option("--nb <id>", "notebook ID (required)").option("--scene <scene>", "task scene (required)").option("--trigger <trigger>", "task trigger", "manual").option("--sources <ids>", "comma-separated source IDs", "").action(async (raw) => {
4669
+ const scene = requiredString(raw.scene, "--scene").trim();
4670
+ if (scene === "compilation" || scene === "lint") throw new QMindError("INVALID_ARGUMENT", `task creation does not support scene ${JSON.stringify(scene)}`);
4545
4671
  const host = await hostFor(context, raw);
4546
4672
  const sourceIds = splitCsv(stringOption(raw, "sources"));
4547
4673
  render(context, raw, {
4548
4674
  kind: "json",
4549
4675
  value: await host.client.createTaskRun(requiredString(raw.nb, "--nb"), {
4550
4676
  ...sourceIds.length === 0 ? {} : { config: { sourceIds } },
4551
- sceneType: requiredString(raw.scene, "--scene"),
4677
+ sceneType: scene,
4552
4678
  trigger: String(raw.trigger ?? "manual")
4553
4679
  })
4554
4680
  });
@@ -4656,7 +4782,7 @@ async function runQMindCli(argv, options = {}) {
4656
4782
  updater: options.updater ?? createQMindCliUpdater({ identity: {
4657
4783
  artifactKind: "npm",
4658
4784
  command: distribution.command,
4659
- currentVersion: "3.1.1",
4785
+ currentVersion: "3.2.1",
4660
4786
  distribution: distribution.id,
4661
4787
  executablePath: process.execPath,
4662
4788
  package: distribution.package,
@@ -566,6 +566,10 @@ const sourceListSchema = z.object({
566
566
  });
567
567
  const sourceTreeNodeSchema = z.lazy(() => z.object({
568
568
  externalBinding: sourceExternalBindingSchema.optional(),
569
+ originUrl: z.string().optional(),
570
+ isEmailFolder: z.boolean().optional(),
571
+ isEmailAggregateMember: z.boolean().optional(),
572
+ isExternalSource: z.boolean().optional(),
569
573
  files: z.array(sourceTreeNodeSchema).default([]),
570
574
  hasChildren: z.boolean().optional(),
571
575
  id: z.string().min(1),
@@ -899,8 +903,12 @@ const chatMessageSchema = z.object({
899
903
  updatedAt: timestampSchema.optional(),
900
904
  userId: z.string().optional()
901
905
  });
906
+ const streamChatMessageSchema = z.preprocess((value) => isRecord(value) && Array.isArray(value.citations) ? {
907
+ ...value,
908
+ citations: value.citations.map((citation) => typeof citation === "string" ? { sourceId: citation } : citation)
909
+ } : value, chatMessageSchema);
902
910
  const streamWireEventSchema = z.object({
903
- assistantMessage: chatMessageSchema.optional(),
911
+ assistantMessage: streamChatMessageSchema.optional(),
904
912
  assistantMessageId: z.string().optional(),
905
913
  cancelReason: z.string().optional(),
906
914
  canceled: z.boolean().optional(),
@@ -920,7 +928,7 @@ const streamWireEventSchema = z.object({
920
928
  toolResult: z.string().optional(),
921
929
  totalContextChunks: z.number().int().nonnegative().optional(),
922
930
  type: z.string().optional(),
923
- userMessage: chatMessageSchema.optional()
931
+ userMessage: streamChatMessageSchema.optional()
924
932
  });
925
933
  const sourceUploadTicketSchema = z.object({
926
934
  expiresAt: z.string().optional(),
@@ -1125,6 +1133,8 @@ function queryPath(path, entries) {
1125
1133
  function wireRequest(options) {
1126
1134
  const timeoutMs = options.callOptions?.timeoutMs;
1127
1135
  if (timeoutMs !== void 0 && (!Number.isFinite(timeoutMs) || timeoutMs <= 0)) throw invalidArgument("timeoutMs must be a positive finite number", "timeoutMs");
1136
+ const maxResponseBytes = options.callOptions?.maxResponseBytes;
1137
+ if (maxResponseBytes !== void 0 && (!Number.isSafeInteger(maxResponseBytes) || maxResponseBytes <= 0)) throw invalidArgument("maxResponseBytes must be a positive integer", "maxResponseBytes");
1128
1138
  const authorization = options.callOptions?.authorization?.trim();
1129
1139
  return {
1130
1140
  ...options.body === void 0 ? {} : { body: {
@@ -1139,7 +1149,8 @@ function wireRequest(options) {
1139
1149
  idempotent: options.idempotent,
1140
1150
  method: options.method,
1141
1151
  ...options.callOptions?.signal === void 0 ? {} : { signal: options.callOptions.signal },
1142
- ...timeoutMs === void 0 ? {} : { timeoutMs }
1152
+ ...timeoutMs === void 0 ? {} : { timeoutMs },
1153
+ ...maxResponseBytes === void 0 ? {} : { maxResponseBytes }
1143
1154
  };
1144
1155
  }
1145
1156
  function call(context, options) {
@@ -1,4 +1,4 @@
1
- import { H as sourceUploadCapabilitiesSchema, m as requiredString, n as call } from "./shared-9iPJsfjP.js";
1
+ import { H as sourceUploadCapabilitiesSchema, m as requiredString, n as call } from "./shared-BFU7amCH.js";
2
2
  //#region ../sdk/src/operations/source-upload.ts
3
3
  /** Notebook-scoped edit preflight, not the deployment-level capabilities lookup. */
4
4
  async function preflightSourceUpload(context, notebookId, options) {
@@ -1,5 +1,5 @@
1
- import { $ as QMIND_SOURCE_UPLOAD_MAX_BYTES, B as sourceSchema, E as imageUploadTicketSchema, Q as QMIND_MULTIPART_UPLOAD_MAX_BYTES, U as sourceUploadTicketSchema, X as voidResponseSchema, a as invalidArgument, l as optionalString, m as requiredString, nt as executeUnary, p as queryPath, r as compactUndefined, rt as QMindError, u as optionalTrimmedString } from "./shared-9iPJsfjP.js";
2
- import { t as preflightSourceUpload } from "./source-upload-mZ-N52xb.js";
1
+ import { $ as QMIND_SOURCE_UPLOAD_MAX_BYTES, B as sourceSchema, E as imageUploadTicketSchema, Q as QMIND_MULTIPART_UPLOAD_MAX_BYTES, U as sourceUploadTicketSchema, X as voidResponseSchema, a as invalidArgument, l as optionalString, m as requiredString, nt as executeUnary, p as queryPath, r as compactUndefined, rt as QMindError, u as optionalTrimmedString } from "./shared-BFU7amCH.js";
2
+ import { t as preflightSourceUpload } from "./source-upload-D3rcA1v1.js";
3
3
  //#region ../sdk/src/operations/transfers.ts
4
4
  function isRecord(value) {
5
5
  return typeof value === "object" && value !== null && !Array.isArray(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qoder-ai/qmind-cli",
3
- "version": "3.1.1",
3
+ "version": "3.2.1",
4
4
  "description": "QMind command line interface",
5
5
  "bin": {
6
6
  "qmind": "bin/cli.js"
@@ -39,8 +39,8 @@
39
39
  "@types/picomatch": "4.0.3",
40
40
  "@types/proper-lockfile": "4.1.4",
41
41
  "@types/semver": "7.8.0",
42
- "@ali/qmind-node-host": "^2.2.34",
43
- "@ali/qmind-sdk": "^0.15.24"
42
+ "@ali/qmind-node-host": "^2.3.3",
43
+ "@ali/qmind-sdk": "^0.18.3"
44
44
  },
45
45
  "license": "UNLICENSED"
46
46
  }