@qoder-ai/qmind-cli 4.0.0 → 4.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 CHANGED
@@ -4,6 +4,14 @@ 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
+ ## 4.1.0
8
+
9
+ ### Minor Changes
10
+
11
+ - 17bb94f: Add notebook discovery with summaries, single-page URL import, scheduled-task CRUD and pause/resume, bounded Source reads, directory filtering and batch deletion to `qmind-cn` and its Global counterpart. New workflows reuse Agent Core validation and confirmed/unknown mutation results. Existing notebook output retains overview and counts; deletion supports JSON/NDJSON receipts and stops on failed preflight.
12
+
13
+ Use `retrieve --unified` or `--targets` for unified single/multi-notebook retrieval with per-notebook Source filters; `--score-threshold` also works on the existing retrieval path. Use `source mkdir --derive-path` and `source mv --to/--to-root` for derived paths and validated destinations. Existing retrieval, full-content and low-level Source patch behavior remains available. Unconfirmed direct writes report `outcome_unknown` with `retryable:false`; inspect current state before another call.
14
+
7
15
  ## 4.0.0
8
16
 
9
17
  ### Major Changes
@@ -4,6 +4,14 @@
4
4
 
5
5
  以下已发布版本属于 Global CLI / 共享实现,不代表 CN 曾发布过这些版本。CN 将在后续共同发行版加入同一历史。
6
6
 
7
+ ## 4.1.0
8
+
9
+ ### Minor Changes
10
+
11
+ - 17bb94f: 为 `qmind-cn` 及对应 Global CLI 增加带摘要的知识库发现、单页 URL 导入、定时任务 CRUD 与暂停/恢复、有界 Source 正文读取、目录过滤和批量删除。新 workflow 复用 Agent Core 校验及确定/未知写入结果。既有知识库输出保留 overview 和数量;删除支持 JSON/NDJSON 回执,预读失败时停止。
12
+
13
+ 使用 `retrieve --unified` 或 `--targets` 进行统一单库/多库检索并按库过滤 Source;既有检索入口也支持 `--score-threshold`。使用 `source mkdir --derive-path` 和 `source mv --to/--to-root` 推导路径并校验目标。原检索、全文读取与低层 Source patch 行为继续保留。未确认的直接写入返回 `outcome_unknown` 和 `retryable:false`;再次操作前先查询当前状态。
14
+
7
15
  ## 4.0.0
8
16
 
9
17
  ### Major Changes
package/README.md CHANGED
@@ -64,6 +64,7 @@ Do not put tokens in command arguments, repositories, or logs. Run `qmind logout
64
64
  | `retrieve` | Retrieve context without invoking an LLM |
65
65
  | `rag` | Ask questions using a knowledge base |
66
66
  | `task` | Manage task runs |
67
+ | `scheduled-task` | Manage notebook schedule configurations |
67
68
  | `upload-folder` / `sync` | Synchronize a local directory |
68
69
  | `image` | Obtain image upload or access URLs |
69
70
  | `version` | Print version and build information |
@@ -128,3 +129,66 @@ qmind notebook get <notebook-id> --format json
128
129
  ```
129
130
 
130
131
  Both notebook collections support `--page` and `--page-size`. `--shared` cannot be combined with `--filter-client`. Shared results use the same flat `notebooks` output as the ordinary list and preserve the membership `permission`. JSON/NDJSON preserve server-provided `access` (current role, member count and action permissions); Agent output expands these fields. Table lists show role and member count, while details show action permissions. Missing permissions are not inferred and display as `unknown` in tables.
132
+
133
+ ## Commands aligned with Agent tools
134
+
135
+ Core-backed workflows (`notebook discover`, `source import-url/read/delete-batch`, `mkdir --derive-path`, `mv --to/--to-root`, unified retrieval, and `scheduled-task`) return `{ ok, data/error, meta }` after entering Agent Core, with `meta.operationId` identifying the operation. `--format ndjson` emits one complete result per line; `table` and `agent` also use this JSON result. CLI validation and host/credential failures before Core keep the existing CLI error format: `{ error }` on stdout for JSON/NDJSON, or text on stderr otherwise. Command usage errors and declined confirmations go to stderr. `source list --parent` keeps the existing Source-list output. Exit codes are 0 for success, 1 for partial success/runtime failure/cancellation, and 2 for invalid arguments. A successful write does not mean Source ingestion or a scheduled run has completed.
136
+
137
+ ```sh
138
+ # Select retrieval-eligible owned/shared notebooks; continue with nextCursor when hasMore is true
139
+ qmind notebook discover --relationship all --page-size 20
140
+ qmind notebook discover --relationship all --cursor '<nextCursor>'
141
+
142
+ # Import a single page; inspect ingestion and content with source get / source read
143
+ qmind source import-url --nb <notebook-id> --url https://example.com/guide
144
+ qmind source list --nb <notebook-id> --parent <directory-id>
145
+ qmind source read <source-id> --nb <notebook-id> --offset 0 --max-chars 20000
146
+
147
+ # Derive paths from the actual parent and preserve the original basename when moving
148
+ qmind source mkdir --nb <notebook-id> --title guides --parent <directory-id> --derive-path
149
+ qmind source mv <source-id> --nb <notebook-id> --to <directory-id>
150
+ qmind source mv <source-id> --nb <notebook-id> --to-root
151
+
152
+ # 1..100 distinct IDs; confirm interactively or explicitly pass --force
153
+ qmind source delete-batch <source-id-1> <source-id-2> --nb <notebook-id> --force
154
+ ```
155
+
156
+ `notebook list/get` JSON/NDJSON preserve the server's overview, sourceCount and materialCount. Agent output expands summary/topics; table lists include summaries and Source counts. `discover` supports owned/shared/all and cursors, defaults to all, and lists retrieval-eligible notebooks; use `list` for the management collection. An empty page may still have `hasMore:true`; continue with the same relationship.
157
+
158
+ `source read` checks ingestion status and returns `content/contentType/truncated/nextOffset`. It still fetches the entire body before slicing, so only output size is bounded. Existing `source content` full-text/download behavior is unchanged. `source list --parent` cannot be combined with `--all`.
159
+
160
+ `mkdir --derive-path` conflicts with `--path`. `mv --to/--to-root` conflicts with the legacy parent/path/rename/status options and only moves eligible leaf documents within one notebook, preserving the basename. Existing low-level mkdir/mv patch operations remain available.
161
+
162
+ Batch deletion returns the submitted sourceIds and successCount/failureCount; sourceIds is not a list of successfully deleted IDs. Partial failure exits 1. Reconcile current state before another call; do not guess failed IDs or replay the entire batch.
163
+
164
+ ## Precise and unified retrieval
165
+
166
+ Existing `retrieve --nb` defaults and output remain unchanged. Explicit `--unified` or `--targets` selects the same unified retrieval workflow used by Agent tools, including notebook identity in single-notebook chunks:
167
+
168
+ ```sh
169
+ qmind retrieve --nb <notebook-id> --unified --score-threshold 0.6 'Deployment process'
170
+ qmind retrieve --targets '[{"notebookId":"nb-1","sourceIds":["source-1"]},{"notebookId":"nb-2","sourceIds":["source-2"]}]' --max-results 8 'Deployment process'
171
+ ```
172
+
173
+ `--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 five 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.
174
+
175
+ ## Scheduled task configuration
176
+
177
+ ```sh
178
+ qmind scheduled-task create --nb <notebook-id> --scene source_refresh --schedule 'CRON_TZ=Asia/Shanghai 0 9 * * *'
179
+ qmind scheduled-task list --nb <notebook-id> --enabled true --page 1 --page-size 20
180
+ qmind scheduled-task update <task-id> --nb <notebook-id> --schedule 'CRON_TZ=Asia/Shanghai 0 10 * * *'
181
+ qmind scheduled-task pause <task-id> --nb <notebook-id>
182
+ qmind scheduled-task resume <task-id> --nb <notebook-id>
183
+ qmind scheduled-task delete <task-id> --nb <notebook-id>
184
+ ```
185
+
186
+ `update --enabled false/true` also pauses/resumes. Creation defaults to enabled with empty config; arbitrary prompt/config inputs are not accepted. Updates only change schedule or enabled. Scenes are compilation, condensation, lint, source_refresh and source_binding_sync; the server decides actual availability and full Cron validity. An explicit IANA timezone is required. Compilation may be retired; source_binding_sync is currently a per-notebook singleton with a minimum five-minute interval. `list` supports `--task/--scene/--enabled`, with pageSize at most 20; the backend still reads all configurations for the notebook. Oversized config is marked `configTruncated:true`.
187
+
188
+ Configuration is separate from execution: use `task list --scheduled-task <task-id>` for run history. Pausing/deleting does not cancel dispatched runs; resuming an overdue schedule may trigger a run immediately. Execution retains the original creator identity; revoking membership does not guarantee schedules stop automatically.
189
+
190
+ ## Unconfirmed writes
191
+
192
+ When a new command returns `error.code=outcome_unknown` and `retryable:false`, inspect current state before deciding what to do next; do not retry automatically. Existing direct-write commands also distinguish this state in JSON/NDJSON errors and retain the original causeCode/requestId. Unknown outcomes do not prove a request reached the server; a same-name resource does not prove this call created it.
193
+
194
+ `notebook delete` and `source delete` support JSON/NDJSON success receipts. Single-Source deletion stops if preflight cannot read the Source; only explicit `--force` skips directory confirmation. Default text output remains `deleted`.
package/README.zh-CN.md CHANGED
@@ -64,6 +64,7 @@ qmind retrieve --nb <notebook-id> --format agent "部署流程是什么?"
64
64
  | `retrieve` | 检索上下文,不发起 LLM 调用 |
65
65
  | `rag` | 基于知识库提问 |
66
66
  | `task` | 管理任务运行 |
67
+ | `scheduled-task` | 管理知识库定时任务配置 |
67
68
  | `upload-folder` / `sync` | 同步本地目录 |
68
69
  | `image` | 获取图片上传地址或访问地址 |
69
70
  | `version` | 查看版本和构建信息 |
@@ -128,3 +129,66 @@ qmind notebook get <notebook-id> --format json
128
129
  ```
129
130
 
130
131
  普通列表和共享列表均支持 `--page`、`--page-size`;`--shared` 不可与 `--filter-client` 组合。共享列表使用与普通列表一致的扁平 `notebooks` 输出,并保留共享关系的 `permission`。JSON/NDJSON 保留服务端返回的 `access`(当前角色、成员数及各操作权限);Agent 输出展开这些字段,表格列表显示角色与成员数,详情显示操作权限。缺失的权限不进行推断,表格显示 `unknown`。
132
+
133
+ ## 与 Agent 工具一致的命令
134
+
135
+ 复用 Core 的 workflow(`notebook discover`、`source import-url/read/delete-batch`、`mkdir --derive-path`、`mv --to/--to-root`、统一检索和 `scheduled-task`)在进入 Agent Core 后返回 `{ ok, data/error, meta }`,其中 `meta.operationId` 标识本次操作。`--format ndjson` 每次操作输出一行完整结果;`table` 和 `agent` 也使用这个 JSON 结果。进入 Core 前的 CLI 参数校验、Host/凭据错误沿用原 CLI 错误格式:JSON/NDJSON 向 stdout 输出 `{ error }`,其他格式向 stderr 输出文本。命令用法错误和取消确认写入 stderr。`source list --parent` 保留原 Source 列表输出。成功退出 0,部分成功/运行失败/取消退出 1,参数错误退出 2。写入成功不表示 Source 已完成解析或调度任务已执行。
136
+
137
+ ```sh
138
+ # 从可检索的自有/共享库中选库;有 hasMore 时继续使用 nextCursor
139
+ qmind notebook discover --relationship all --page-size 20
140
+ qmind notebook discover --relationship all --cursor '<nextCursor>'
141
+
142
+ # 普通单页导入;上传后用 source get / source read 查看状态和正文
143
+ qmind source import-url --nb <notebook-id> --url https://example.com/guide
144
+ qmind source list --nb <notebook-id> --parent <directory-id>
145
+ qmind source read <source-id> --nb <notebook-id> --offset 0 --max-chars 20000
146
+
147
+ # 按真实目录推导路径,移动时保留原始 basename
148
+ qmind source mkdir --nb <notebook-id> --title guides --parent <directory-id> --derive-path
149
+ qmind source mv <source-id> --nb <notebook-id> --to <directory-id>
150
+ qmind source mv <source-id> --nb <notebook-id> --to-root
151
+
152
+ # 1..100 个不同 ID;交互确认或显式 --force 后执行
153
+ qmind source delete-batch <source-id-1> <source-id-2> --nb <notebook-id> --force
154
+ ```
155
+
156
+ `notebook list/get` 的 JSON/NDJSON 保留服务端 overview、sourceCount 和 materialCount;Agent 输出展开 summary/topics,表格列表增加摘要与 Source 数量。`discover` 支持 owned/shared/all 和游标,默认 all,只返回检索可用库;管理清单仍用 `list`。空页也可能 `hasMore:true`,不要直接判断已结束,续页须保持 relationship。
157
+
158
+ `source read` 先检查解析状态,返回 `content/contentType/truncated/nextOffset`。它仍取回全文再切片,只限制输出大小。原 `source content` 的全文输出/下载不变。`source list --parent` 不能与 `--all` 组合。
159
+
160
+ `mkdir --derive-path` 不能与 `--path` 组合;`mv --to/--to-root` 不能与旧 parent/path/rename/status 参数组合,仅移动当前库内可操作的叶子文档,保留原 basename。原来的低层 mkdir/mv patch 入口仍可使用。
161
+
162
+ 批删返回提交的 sourceIds 和 successCount/failureCount,sourceIds 不是成功 ID 清单。部分失败退出 1,不能猜测失败对象或重放整批;先重新查询对账。
163
+
164
+ ## 精确与统一检索
165
+
166
+ 旧的 `retrieve --nb` 默认行为和输出形状保持不变。显式 `--unified` 或 `--targets` 使用与 Agent 工具一致的统一检索,单库也返回携带 Notebook 身份的 chunks:
167
+
168
+ ```sh
169
+ qmind retrieve --nb <notebook-id> --unified --score-threshold 0.6 '部署流程'
170
+ qmind retrieve --targets '[{"notebookId":"nb-1","sourceIds":["source-1"]},{"notebookId":"nb-2","sourceIds":["source-2"]}]' --max-results 8 '部署流程'
171
+ ```
172
+
173
+ `--targets` 不能与 `--nb` 或 `--sources` 组合,每库可独立过滤 Source。统一检索默认 maxResults=8(1..50),topK 可选(1..100),0 表示使用该 workflow 的默认值;最多五个唯一目标。结果采用上述结构化 envelope,读取 `data.chunks/data.promptContext`;`--score-threshold` 范围为 0..1,旧检索入口也支持。旧路径的零预算继续使用服务端默认值,不隐式切换旧脚本。
174
+
175
+ ## 定时任务配置
176
+
177
+ ```sh
178
+ qmind scheduled-task create --nb <notebook-id> --scene source_refresh --schedule 'CRON_TZ=Asia/Shanghai 0 9 * * *'
179
+ qmind scheduled-task list --nb <notebook-id> --enabled true --page 1 --page-size 20
180
+ qmind scheduled-task update <task-id> --nb <notebook-id> --schedule 'CRON_TZ=Asia/Shanghai 0 10 * * *'
181
+ qmind scheduled-task pause <task-id> --nb <notebook-id>
182
+ qmind scheduled-task resume <task-id> --nb <notebook-id>
183
+ qmind scheduled-task delete <task-id> --nb <notebook-id>
184
+ ```
185
+
186
+ `update --enabled false/true` 等价于暂停/恢复。创建默认启用、config 固定为空,不能提交任意 prompt/config;更新仅支持时间或 enabled。scene 为 compilation、condensation、lint、source_refresh、source_binding_sync,实际可用性和完整 Cron 语法由服务端裁决。必须显式提供 IANA 时区,不能依赖本机时区。compilation 可能已退役;source_binding_sync 当前是单库单例且间隔至少五分钟。`list` 可用 `--task/--scene/--enabled` 过滤,pageSize 最大 20;底层仍读取本库全量配置。过大的 config 会显示 `configTruncated:true`。
187
+
188
+ 定时配置与执行记录分开:`task list --scheduled-task <task-id>` 查看执行记录。暂停/删除不取消已派发任务;恢复过期任务可能立即触发一次。调度沿用最初创建者身份,成员撤权不保证自动停任务。
189
+
190
+ ## 写入结果不确定
191
+
192
+ 新命令返回 `error.code=outcome_unknown`、`retryable:false` 时,先查询当前状态再决定后续操作,不能自动重试。旧直接写入命令在 JSON/NDJSON 错误中也区分该状态并保留原 causeCode/requestId。未知结果不证明请求已到达服务器;同名资源也不能证明是本次创建。
193
+
194
+ `notebook delete` 和 `source delete` 支持 JSON/NDJSON 成功回执。单 Source 删除的预读失败会停止,只有显式 `--force` 才跳过目录确认;原默认文本成功输出保持 `deleted`。
@@ -68,7 +68,7 @@ function createImportOperations(context) {
68
68
  idempotent: false,
69
69
  method: "POST",
70
70
  operation: "imports.fullSiteURL.confirm",
71
- path: context.profile.mindPath("notebooks", notebook, "full-site-url-import", "discoveries", discovery, "confirm"),
71
+ path: context.profile.apiPath("mind", "notebooks", notebook, "full-site-url-import", "discoveries", discovery, "confirm"),
72
72
  schema: fullSiteURLImportConfirmationSchema
73
73
  });
74
74
  },
@@ -83,7 +83,7 @@ function createImportOperations(context) {
83
83
  idempotent: true,
84
84
  method: "POST",
85
85
  operation: "imports.fullSiteURL.discover",
86
- path: context.profile.mindPath("notebooks", notebook, "full-site-url-import", "discoveries"),
86
+ path: context.profile.apiPath("mind", "notebooks", notebook, "full-site-url-import", "discoveries"),
87
87
  schema: fullSiteURLImportDiscoverySchema
88
88
  });
89
89
  },
@@ -97,7 +97,7 @@ function createImportOperations(context) {
97
97
  idempotent: true,
98
98
  method: "GET",
99
99
  operation: "imports.aliDing.getRun",
100
- path: context.profile.mindPath("notebooks", notebook, "aliding", "import-runs", run),
100
+ path: context.profile.apiPath("mind", "notebooks", notebook, "aliding", "import-runs", run),
101
101
  schema: aliDingImportRunSchema
102
102
  });
103
103
  },
@@ -106,7 +106,7 @@ function createImportOperations(context) {
106
106
  const run = requiredString(runId, "runId");
107
107
  const normalizedPage = pagination(input);
108
108
  assertCapability(context.profile, "imports.aliDing", "imports.aliDing.listRunItems");
109
- const base = context.profile.mindPath("notebooks", notebook, "aliding", "import-runs", run, "items");
109
+ const base = context.profile.apiPath("mind", "notebooks", notebook, "aliding", "import-runs", run, "items");
110
110
  return call(context, {
111
111
  callOptions: options,
112
112
  capability: "imports.aliDing",
@@ -131,7 +131,7 @@ function createImportOperations(context) {
131
131
  idempotent: true,
132
132
  method: "GET",
133
133
  operation: "imports.discover",
134
- path: context.profile.mindPath("import-sources"),
134
+ path: context.profile.apiPath("mind", "import-sources"),
135
135
  schema: importProvidersSchema
136
136
  });
137
137
  },
@@ -146,7 +146,7 @@ function createImportOperations(context) {
146
146
  idempotent: false,
147
147
  method: "POST",
148
148
  operation: "imports.aliDing.createKnowledgeBaseRun",
149
- path: context.profile.mindPath("notebooks", notebook, "aliding", "knowledge-base-import-runs"),
149
+ path: context.profile.apiPath("mind", "notebooks", notebook, "aliding", "knowledge-base-import-runs"),
150
150
  schema: aliDingImportRunSchema
151
151
  });
152
152
  },
@@ -161,7 +161,7 @@ function createImportOperations(context) {
161
161
  idempotent: false,
162
162
  method: "POST",
163
163
  operation: "imports.aliDing.createNodeSubtreeRun",
164
- path: context.profile.mindPath("notebooks", notebook, "aliding", "node-subtree-import-runs"),
164
+ path: context.profile.apiPath("mind", "notebooks", notebook, "aliding", "node-subtree-import-runs"),
165
165
  schema: aliDingImportRunSchema
166
166
  });
167
167
  }
@@ -188,7 +188,7 @@ function createManagementOperations(context) {
188
188
  permission: memberPermission(input?.permission, "permission")
189
189
  },
190
190
  callOptions: options,
191
- capability: hasUserId ? "members.search" : "members",
191
+ capability: "members",
192
192
  idempotent: false,
193
193
  method: "POST",
194
194
  operation: "members.add",