@qoder-ai/qmind-cli 3.2.1 → 3.4.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 +12 -0
- package/CHANGELOG.zh-CN.md +12 -0
- package/README.md +26 -0
- package/README.zh-CN.md +26 -0
- package/dist/{bot-gateway-C0KmAiBy.js → bot-gateway-B5oq12FF.js} +1 -1
- package/dist/{cards-YqfPPr12.js → cards-CfhvlNeF.js} +1 -1
- package/dist/{imports-CkLS3Vqu.js → imports-CUruHsu_.js} +58 -1
- package/dist/{management-BqqR6Ihj.js → management-Dr8uPYN9.js} +67 -3
- package/dist/{notes-B9mcsP2n.js → notes-BcyIDQG5.js} +1 -1
- package/dist/qmind.js +263 -61
- package/dist/{shared-BFU7amCH.js → shared-DBGAKppE.js} +52 -34
- package/dist/{source-upload-D3rcA1v1.js → source-upload-CCasR8MW.js} +1 -1
- package/dist/{transfers-CzWL9766.js → transfers-DnuncvOY.js} +2 -2
- package/dist/wiki-branches-BfIfXeN9.js +80 -0
- package/package.json +3 -3
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.4.0
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- 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.
|
|
12
|
+
|
|
13
|
+
## 3.3.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- c024d97: Add `notebook list --shared` with pagination and preserve server-provided notebook permissions in CLI output.
|
|
18
|
+
|
|
7
19
|
## 3.2.1
|
|
8
20
|
|
|
9
21
|
### Patch Changes
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -4,6 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
以下已发布版本属于 Global CLI / 共享实现,不代表 CN 曾发布过这些版本。CN 将在后续共同发行版加入同一历史。
|
|
6
6
|
|
|
7
|
+
## 3.4.0
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- 85ebf9c: `qmind retrieve` 和 `qmind-cn retrieve` 支持通过逗号分隔或重复传入 `--nb` 显式选择最多 5 个不同知识库。多库通过一次统一检索请求共享结果预算,由服务端排序;输出保留知识库身份和服务端顺序,请求失败时不回退到逐库调用。单库检索及输出保持不变,`--sources` 仍仅支持单库。
|
|
12
|
+
|
|
13
|
+
## 3.3.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- c024d97: 新增 `notebook list --shared` 及分页参数,并在 CLI 输出中保留服务端返回的知识库权限信息。
|
|
18
|
+
|
|
7
19
|
## 3.2.1
|
|
8
20
|
|
|
9
21
|
### Patch 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 and output, including knowledge cards and its fallback behavior.
|
|
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. Multi-notebook retrieval does not return knowledge cards.
|
|
91
|
+
|
|
76
92
|
## Directory synchronization
|
|
77
93
|
|
|
78
94
|
Review the plan before allowing remote deletions:
|
|
@@ -102,3 +118,13 @@ After upgrading from the legacy unpartitioned store, sign in again. Root-level c
|
|
|
102
118
|
The shared 3.x Global/CN release is a breaking upgrade from Global 2.x. Upgrade this package with npm, then run `qmind login`; do not copy legacy credentials into the new partition. Existing versions before the shared release describe the Global/shared implementation only and do not imply a historical CN publication.
|
|
103
119
|
|
|
104
120
|
Common variables include `QMIND_TOKEN`, `QMIND_DEBUG_TOKEN`, `QMIND_HOME`, `QMIND_CLIENT`, `QMIND_NON_INTERACTIVE`, `QMIND_REQUEST_TIMEOUT_MS`, `QMIND_STREAM_IDLE_TIMEOUT_MS`, and `QMIND_TLS_CA_FILE`. `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` are supported. TLS verification is strict by default, and credentials are not forwarded to signed object-storage URLs.
|
|
121
|
+
|
|
122
|
+
## Shared notebook discovery and access
|
|
123
|
+
|
|
124
|
+
```sh
|
|
125
|
+
qmind notebook list --shared --page 1 --page-size 20
|
|
126
|
+
qmind notebook list --shared --format json
|
|
127
|
+
qmind notebook get <notebook-id> --format json
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
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.
|
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
|
先审阅计划,再决定是否执行远端删除:
|
|
@@ -102,3 +118,13 @@ qmind login --sash http://localhost:8080 --dashboard http://localhost:3000
|
|
|
102
118
|
共享 3.x Global/CN 发行版相对 Global 2.x 是 breaking upgrade。通过 npm 升级本包后执行 `qmind login`,不要把旧凭证复制到新分区。共同发行版之前的历史版本只描述 Global/共享实现,不代表 CN 曾经发布。
|
|
103
119
|
|
|
104
120
|
常用变量包括 `QMIND_TOKEN`、`QMIND_DEBUG_TOKEN`、`QMIND_HOME`、`QMIND_CLIENT`、`QMIND_NON_INTERACTIVE`、`QMIND_REQUEST_TIMEOUT_MS`、`QMIND_STREAM_IDLE_TIMEOUT_MS` 和 `QMIND_TLS_CA_FILE`。支持 `HTTP_PROXY`、`HTTPS_PROXY` 和 `NO_PROXY`。TLS 默认严格校验,访问签名对象存储地址时不会转发凭证。
|
|
121
|
+
|
|
122
|
+
## 共享知识库发现与权限
|
|
123
|
+
|
|
124
|
+
```sh
|
|
125
|
+
qmind notebook list --shared --page 1 --page-size 20
|
|
126
|
+
qmind notebook list --shared --format json
|
|
127
|
+
qmind notebook get <notebook-id> --format json
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
普通列表和共享列表均支持 `--page`、`--page-size`;`--shared` 不可与 `--filter-client` 组合。共享列表使用与普通列表一致的扁平 `notebooks` 输出,并保留共享关系的 `permission`。JSON/NDJSON 保留服务端返回的 `access`(当前角色、成员数及各操作权限);Agent 输出展开这些字段,表格列表显示角色与成员数,详情显示操作权限。缺失的权限不进行推断,表格显示 `unknown`。
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ 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-DBGAKppE.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 {
|
|
1
|
+
import { C as cardSchema, S as cardListSchema, a as invalidArgument, b as batchMutationResultSchema, 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 } from "./shared-DBGAKppE.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region ../sdk/src/operations/compilation-results.ts
|
|
4
4
|
function linksBody(value, field) {
|
|
@@ -1,7 +1,34 @@
|
|
|
1
|
-
import { O as
|
|
1
|
+
import { D as fullSiteURLImportConfirmationSchema, O as fullSiteURLImportDiscoverySchema, _ as aliDingImportRunItemListSchema, a as invalidArgument, d as pagination, it as assertCapability, j as importProvidersSchema, m as requiredString, n as call, p as queryPath, rt as qmindFullSiteURLImportPageLimit, v as aliDingImportRunSchema } from "./shared-DBGAKppE.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 {
|
|
1
|
+
import { a as invalidArgument, c as optionalRecord, et as voidResponseSchema, 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-DBGAKppE.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",
|
|
@@ -130,15 +151,35 @@ function autoCompilePatch(value) {
|
|
|
130
151
|
}
|
|
131
152
|
function createManagementOperations(context) {
|
|
132
153
|
return {
|
|
154
|
+
async resolveMemberCandidate(notebookId, input, options) {
|
|
155
|
+
const notebook = requiredString(notebookId, "notebookId");
|
|
156
|
+
const hasUserId = input?.userId !== void 0;
|
|
157
|
+
if (hasUserId === (input?.email !== void 0)) throw invalidArgument("exactly one of email or userId is required", "member");
|
|
158
|
+
const value = requiredString(hasUserId ? input.userId : input.email, hasUserId ? "userId" : "email");
|
|
159
|
+
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");
|
|
160
|
+
return call(context, {
|
|
161
|
+
body: hasUserId ? { userId: value } : { email: value },
|
|
162
|
+
callOptions: options,
|
|
163
|
+
capability: "members.resolve",
|
|
164
|
+
idempotent: true,
|
|
165
|
+
method: "POST",
|
|
166
|
+
operation: "members.resolve",
|
|
167
|
+
path: context.profile.apiPath("notebooks", notebook, "member-candidates", "resolve"),
|
|
168
|
+
schema: resolvedMemberCandidateSchema
|
|
169
|
+
});
|
|
170
|
+
},
|
|
133
171
|
async addMember(notebookId, input, options) {
|
|
134
172
|
const notebook = requiredString(notebookId, "notebookId");
|
|
173
|
+
const hasUserId = input?.userId !== void 0;
|
|
174
|
+
if (hasUserId === (input?.email !== void 0)) throw invalidArgument("exactly one of email or userId is required", "member");
|
|
175
|
+
const identity = hasUserId ? { userId: requiredString(input.userId, "userId") } : { email: requiredString(input.email, "email") };
|
|
135
176
|
return call(context, {
|
|
136
177
|
body: {
|
|
137
|
-
|
|
178
|
+
...identity,
|
|
138
179
|
permission: memberPermission(input?.permission, "permission")
|
|
139
180
|
},
|
|
140
181
|
callOptions: options,
|
|
141
|
-
capability: "members",
|
|
182
|
+
capability: hasUserId ? "members.search" : "members",
|
|
142
183
|
idempotent: false,
|
|
143
184
|
method: "POST",
|
|
144
185
|
operation: "members.add",
|
|
@@ -146,6 +187,29 @@ function createManagementOperations(context) {
|
|
|
146
187
|
schema: notebookMemberSchema
|
|
147
188
|
});
|
|
148
189
|
},
|
|
190
|
+
async searchMemberCandidates(input, options) {
|
|
191
|
+
const notebook = requiredString(input?.notebookId, "notebookId");
|
|
192
|
+
const query = requiredString(input?.query, "query");
|
|
193
|
+
if (Array.from(query).length > 100) throw invalidArgument("query must contain at most 100 Unicode characters", "query");
|
|
194
|
+
const page = positiveInteger(input?.page, "page") ?? 1;
|
|
195
|
+
const pageSize = positiveInteger(input?.pageSize, "pageSize") ?? 20;
|
|
196
|
+
if (page > 2147483647) throw invalidArgument("page must not exceed 2147483647", "page");
|
|
197
|
+
if (pageSize > 50) throw invalidArgument("pageSize must not exceed 50", "pageSize");
|
|
198
|
+
if ((page - 1) * pageSize > 2147483647) throw invalidArgument("pagination offset exceeds the supported range", "page");
|
|
199
|
+
return call(context, {
|
|
200
|
+
callOptions: options,
|
|
201
|
+
capability: "members.search",
|
|
202
|
+
idempotent: true,
|
|
203
|
+
method: "GET",
|
|
204
|
+
operation: "members.search",
|
|
205
|
+
path: queryPath(context.profile.apiPath("notebooks", notebook, "member-candidates"), [
|
|
206
|
+
["query", query],
|
|
207
|
+
["page", page],
|
|
208
|
+
["page_size", pageSize]
|
|
209
|
+
]),
|
|
210
|
+
schema: memberCandidateListSchema
|
|
211
|
+
});
|
|
212
|
+
},
|
|
149
213
|
async createScheduledTask(notebookId, input, options) {
|
|
150
214
|
const notebook = requiredString(notebookId, "notebookId");
|
|
151
215
|
return call(context, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as timestampSchema, c as optionalRecord, d as pagination, et as voidResponseSchema, h as requiredText, l as optionalString, m as requiredString, n as call, p as queryPath, r as compactUndefined, t as assertNonEmptyPatch } from "./shared-DBGAKppE.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
|
|
2
|
-
import { t as preflightSourceUpload } from "./source-upload-
|
|
1
|
+
import { A as imageUrlsSchema, B as sourceImportResultsSchema, E as chatSessionSchema, F as retrieveResultSchema, G as sourceTreeSchema, H as sourcePreviewSchema, I as sharedNotebookListSchema, J as sourceWebOfficeSessionSchema, K as sourceUploadCapabilitiesSchema, L as sourceActionAccessSchema, M as notebookListSchema, N as notebookSchema, P as retrieveNotebooksResultSchema, Q as taskRunSchema, R as sourceChildrenCountsSchema, T as chatSessionListSchema, U as sourceRawContentSchema, V as sourceListSchema, W as sourceSchema, X as streamWireEventSchema, Y as sourceWebOfficeTokenSchema, Z as taskRunListSchema, a as invalidArgument$1, at as executeStream, c as optionalRecord, d as pagination$1, et as voidResponseSchema, f as positiveInteger$1, g as stringList, i as httpUrl, it as assertCapability, k as imageUploadTicketSchema, l as optionalString$1, m as requiredString$2, n as call, o as nonNegativeInteger$1, p as queryPath, r as compactUndefined, s as optionalBoolean, st as QMindError, t as assertNonEmptyPatch, u as optionalTrimmedString, w as chatMessageListSchema, x as cancelQuestionResultSchema, y as batchDeleteResultSchema, z as sourceContentSchema } from "./shared-DBGAKppE.js";
|
|
2
|
+
import { t as preflightSourceUpload } from "./source-upload-CCasR8MW.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";
|
|
@@ -346,6 +346,36 @@ function createAgentOperations(context) {
|
|
|
346
346
|
listChatSessions: (notebookId, input, options) => listChatSessionsFor(notebookId, input, options),
|
|
347
347
|
listFeaturedChatMessages: (notebookId, sessionId, input, options) => listChatMessagesFor(notebookId, sessionId, input, options, true),
|
|
348
348
|
listFeaturedChatSessions: (notebookId, input, options) => listChatSessionsFor(notebookId, input, options, true),
|
|
349
|
+
async retrieveNotebooks(input, options) {
|
|
350
|
+
if (!isRecord$3(input) || !Array.isArray(input.targets) || input.targets.length === 0) throw invalidArgument$1("targets must be a non-empty array", "targets");
|
|
351
|
+
const seen = /* @__PURE__ */ new Set();
|
|
352
|
+
const targets = input.targets.map((target) => {
|
|
353
|
+
if (!isRecord$3(target)) throw invalidArgument$1("target must be an object", "targets");
|
|
354
|
+
const notebookId = requiredString$2(target.notebookId, "notebookId");
|
|
355
|
+
if (seen.has(notebookId)) throw invalidArgument$1("targets must be unique", "targets");
|
|
356
|
+
seen.add(notebookId);
|
|
357
|
+
if (target.preference !== void 0 && target.preference !== "default" && target.preference !== "preferred") throw invalidArgument$1("preference must be default or preferred", "preference");
|
|
358
|
+
return compactUndefined({
|
|
359
|
+
notebookId,
|
|
360
|
+
sourceIds: stringList(target.sourceIds ?? [], "sourceIds"),
|
|
361
|
+
preference: target.preference
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
const { sourceIds: _sourceIds, ...body } = retrieveBody(input);
|
|
365
|
+
return call(context, {
|
|
366
|
+
body: {
|
|
367
|
+
...body,
|
|
368
|
+
targets
|
|
369
|
+
},
|
|
370
|
+
callOptions: options,
|
|
371
|
+
capability: "retrieval",
|
|
372
|
+
idempotent: false,
|
|
373
|
+
method: "POST",
|
|
374
|
+
operation: "retrieval.retrieveNotebooks",
|
|
375
|
+
path: context.profile.apiPath("notebooks", "retrieve"),
|
|
376
|
+
schema: retrieveNotebooksResultSchema
|
|
377
|
+
});
|
|
378
|
+
},
|
|
349
379
|
async retrieve(notebookId, input, options) {
|
|
350
380
|
const notebook = requiredString$2(notebookId, "notebookId");
|
|
351
381
|
return call(context, {
|
|
@@ -368,6 +398,8 @@ function createAgentOperations(context) {
|
|
|
368
398
|
//#endregion
|
|
369
399
|
//#region ../sdk/src/operations/notebooks.ts
|
|
370
400
|
function createNotebookOperations(context) {
|
|
401
|
+
let wikiOperations;
|
|
402
|
+
const loadWiki = () => wikiOperations ??= import("./wiki-branches-BfIfXeN9.js").then(({ createWikiBranchOperations }) => createWikiBranchOperations(context));
|
|
371
403
|
return {
|
|
372
404
|
async copyFeaturedNotebook(notebookId, options) {
|
|
373
405
|
const notebook = requiredString$2(notebookId, "notebookId");
|
|
@@ -479,18 +511,8 @@ function createNotebookOperations(context) {
|
|
|
479
511
|
schema: sharedNotebookListSchema
|
|
480
512
|
});
|
|
481
513
|
},
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
return (await call(context, {
|
|
485
|
-
callOptions: options,
|
|
486
|
-
capability: "wikiBranches.read",
|
|
487
|
-
idempotent: true,
|
|
488
|
-
method: "GET",
|
|
489
|
-
operation: "wikiBranches.list",
|
|
490
|
-
path: context.profile.apiPath("notebooks", id, "wiki-branches"),
|
|
491
|
-
schema: wikiBranchListSchema
|
|
492
|
-
})).branches;
|
|
493
|
-
},
|
|
514
|
+
listWikiBranches: (...args) => loadWiki().then((loaded) => loaded.listWikiBranches(...args)),
|
|
515
|
+
listWikiBranchesPage: (...args) => loadWiki().then((loaded) => loaded.listWikiBranchesPage(...args)),
|
|
494
516
|
async updateNotebook(notebookId, input, options) {
|
|
495
517
|
const id = requiredString$2(notebookId, "notebookId");
|
|
496
518
|
const body = compactUndefined({
|
|
@@ -514,6 +536,57 @@ function createNotebookOperations(context) {
|
|
|
514
536
|
};
|
|
515
537
|
}
|
|
516
538
|
//#endregion
|
|
539
|
+
//#region ../sdk/src/source-format.ts
|
|
540
|
+
const mimeTypes = Object.freeze({
|
|
541
|
+
pdf: "application/pdf",
|
|
542
|
+
doc: "application/msword",
|
|
543
|
+
xls: "application/vnd.ms-excel",
|
|
544
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
545
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
546
|
+
ppt: "application/vnd.ms-powerpoint",
|
|
547
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
548
|
+
jpg: "image/jpeg",
|
|
549
|
+
jpeg: "image/jpeg",
|
|
550
|
+
png: "image/png",
|
|
551
|
+
gif: "image/gif",
|
|
552
|
+
bmp: "image/bmp",
|
|
553
|
+
webp: "image/webp",
|
|
554
|
+
svg: "image/svg+xml"
|
|
555
|
+
});
|
|
556
|
+
const mimeFormats = new Map(Object.entries(mimeTypes).map(([format, mime]) => [mime, format]));
|
|
557
|
+
function isQMindSourceBinaryFormat(value) {
|
|
558
|
+
return typeof value === "string" && Object.hasOwn(mimeTypes, value);
|
|
559
|
+
}
|
|
560
|
+
function normalize(value) {
|
|
561
|
+
const format = value?.trim().toLowerCase().replace(/^\./u, "") ?? "";
|
|
562
|
+
if ([
|
|
563
|
+
"markdown",
|
|
564
|
+
"mdown",
|
|
565
|
+
"mdx"
|
|
566
|
+
].includes(format)) return "md";
|
|
567
|
+
return format === "htm" ? "html" : format;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* An explicit format is authoritative, including unknown formats. Legacy compatibility is limited
|
|
571
|
+
* to original binary formats; filenames/MIME never authorize HTML, email, or a private viewer.
|
|
572
|
+
* Callers must pass the original filename, never a user's renamed title.
|
|
573
|
+
*/
|
|
574
|
+
function normalizeQMindSourceFormat(input) {
|
|
575
|
+
const declared = normalize(input.sourceFormat);
|
|
576
|
+
if (declared) return declared;
|
|
577
|
+
const mime = input.mimeType?.split(";", 1)[0]?.trim().toLowerCase();
|
|
578
|
+
const fromMime = mime ? mimeFormats.get(mime) : void 0;
|
|
579
|
+
if (fromMime) return fromMime;
|
|
580
|
+
const extension = normalize(input.extension);
|
|
581
|
+
if (isQMindSourceBinaryFormat(extension)) return extension;
|
|
582
|
+
const filename = input.filename ?? "";
|
|
583
|
+
const fromName = filename.includes(".") ? normalize(filename.slice(filename.lastIndexOf(".") + 1)) : "";
|
|
584
|
+
if (isQMindSourceBinaryFormat(fromName)) return fromName;
|
|
585
|
+
const type = normalize(input.sourceType);
|
|
586
|
+
if (isQMindSourceBinaryFormat(type)) return type;
|
|
587
|
+
return type === "word" ? "docx" : type === "excel" ? "xlsx" : type === "powerpoint" ? "pptx" : "";
|
|
588
|
+
}
|
|
589
|
+
//#endregion
|
|
517
590
|
//#region ../sdk/src/source-email-folder.ts
|
|
518
591
|
/** The email aggregate directory marker shared by tree projection and source readers. */
|
|
519
592
|
function isQMindEmailFolder(source) {
|
|
@@ -544,9 +617,12 @@ function metadataText(source, ...keys) {
|
|
|
544
617
|
* because one MIME type can back several formats.
|
|
545
618
|
*/
|
|
546
619
|
function qmindSourceFormat(source) {
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
620
|
+
return normalizeQMindSourceFormat({
|
|
621
|
+
sourceFormat: metadataText(source, "sourceFormat", "source_format"),
|
|
622
|
+
filename: source?.filename,
|
|
623
|
+
mimeType: source?.mimeType,
|
|
624
|
+
sourceType: source?.sourceType
|
|
625
|
+
});
|
|
550
626
|
}
|
|
551
627
|
function isQMindEmailSource(source) {
|
|
552
628
|
return source?.sourceType.toLowerCase() === "email" && qmindSourceFormat(source) === "eml";
|
|
@@ -588,7 +664,8 @@ function qmindSourceProvider(source) {
|
|
|
588
664
|
* do not project the binding yet.
|
|
589
665
|
*/
|
|
590
666
|
function isQMindExternalSource(source) {
|
|
591
|
-
|
|
667
|
+
const provider = qmindSourceProvider(source);
|
|
668
|
+
return source?.externalBinding !== void 0 || provider === "aliding" || provider === "repowiki";
|
|
592
669
|
}
|
|
593
670
|
[.../* @__PURE__ */ new Set(["axls", "alxs"])];
|
|
594
671
|
//#endregion
|
|
@@ -622,6 +699,7 @@ function buildSourceTree(sources) {
|
|
|
622
699
|
for (const source of sources) nodesById.set(source.id, {
|
|
623
700
|
...source.externalBinding === void 0 ? {} : { externalBinding: source.externalBinding },
|
|
624
701
|
...source.originUrl === void 0 ? {} : { originUrl: source.originUrl },
|
|
702
|
+
...source.metadata === void 0 ? {} : { metadata: source.metadata },
|
|
625
703
|
isEmailFolder: isQMindEmailFolder(source),
|
|
626
704
|
isEmailAggregateMember: isQMindEmailAggregateMember(source, sources),
|
|
627
705
|
isExternalSource: isQMindExternalSource(source),
|
|
@@ -632,7 +710,8 @@ function buildSourceTree(sources) {
|
|
|
632
710
|
path: source.path,
|
|
633
711
|
sourceType: source.sourceType,
|
|
634
712
|
status: source.status,
|
|
635
|
-
type: source.isDir || parentIds.has(source.id) ? "directory" : "file"
|
|
713
|
+
type: source.isDir || parentIds.has(source.id) ? "directory" : "file",
|
|
714
|
+
...source.updatedAt === void 0 ? {} : { updatedAt: source.updatedAt }
|
|
636
715
|
});
|
|
637
716
|
const tree = [];
|
|
638
717
|
for (const source of sources) {
|
|
@@ -876,7 +955,7 @@ function createSourceOperations(context) {
|
|
|
876
955
|
method: "POST",
|
|
877
956
|
operation: "sources.batchDelete",
|
|
878
957
|
path: context.profile.apiPath("notebooks", notebook, "sources", "batch-delete"),
|
|
879
|
-
schema:
|
|
958
|
+
schema: batchDeleteResultSchema
|
|
880
959
|
});
|
|
881
960
|
},
|
|
882
961
|
async countSourceChildren(notebookId, parentIds, options) {
|
|
@@ -1002,6 +1081,21 @@ function createSourceOperations(context) {
|
|
|
1002
1081
|
schema: sourceSchema
|
|
1003
1082
|
});
|
|
1004
1083
|
},
|
|
1084
|
+
async retrySourceIngestion(notebookId, sourceId, input, options) {
|
|
1085
|
+
return call(context, {
|
|
1086
|
+
callOptions: options,
|
|
1087
|
+
capability: "sources.write",
|
|
1088
|
+
idempotent: true,
|
|
1089
|
+
method: "POST",
|
|
1090
|
+
operation: "sources.retryIngestion",
|
|
1091
|
+
path: context.profile.apiPath("notebooks", requiredString$2(notebookId, "notebookId"), "sources", requiredString$2(sourceId, "sourceId"), "retry"),
|
|
1092
|
+
body: {
|
|
1093
|
+
retryKey: requiredString$2(input.retryKey, "retryKey"),
|
|
1094
|
+
expectedUpdatedAt: requiredString$2(input.expectedUpdatedAt, "expectedUpdatedAt")
|
|
1095
|
+
},
|
|
1096
|
+
schema: sourceSchema
|
|
1097
|
+
});
|
|
1098
|
+
},
|
|
1005
1099
|
async getSourceContent(notebookId, sourceId, options) {
|
|
1006
1100
|
const notebook = requiredString$2(notebookId, "notebookId");
|
|
1007
1101
|
const source = requiredString$2(sourceId, "sourceId");
|
|
@@ -1225,7 +1319,10 @@ const dashboardCapabilities = Object.freeze({
|
|
|
1225
1319
|
"images.presignUrls": false,
|
|
1226
1320
|
"imports.aliDing": true,
|
|
1227
1321
|
"imports.discover": true,
|
|
1322
|
+
"imports.fullSiteURL": true,
|
|
1228
1323
|
members: true,
|
|
1324
|
+
"members.search": true,
|
|
1325
|
+
"members.resolve": true,
|
|
1229
1326
|
"notebooks.filterByClient": false,
|
|
1230
1327
|
"notebooks.read": true,
|
|
1231
1328
|
"notebooks.write": true,
|
|
@@ -1249,7 +1346,8 @@ const dashboardCapabilities = Object.freeze({
|
|
|
1249
1346
|
"taskRuns.read": true,
|
|
1250
1347
|
"taskRuns.write": true,
|
|
1251
1348
|
transfers: true,
|
|
1252
|
-
"wikiBranches.read": true
|
|
1349
|
+
"wikiBranches.read": true,
|
|
1350
|
+
"wikiBranches.page": true
|
|
1253
1351
|
});
|
|
1254
1352
|
const sashCapabilities = Object.freeze({
|
|
1255
1353
|
botGateway: false,
|
|
@@ -1265,7 +1363,10 @@ const sashCapabilities = Object.freeze({
|
|
|
1265
1363
|
"images.presignUrls": true,
|
|
1266
1364
|
"imports.aliDing": false,
|
|
1267
1365
|
"imports.discover": false,
|
|
1366
|
+
"imports.fullSiteURL": false,
|
|
1268
1367
|
members: false,
|
|
1368
|
+
"members.search": false,
|
|
1369
|
+
"members.resolve": false,
|
|
1269
1370
|
"notebooks.filterByClient": true,
|
|
1270
1371
|
"notebooks.read": true,
|
|
1271
1372
|
"notebooks.write": true,
|
|
@@ -1274,7 +1375,7 @@ const sashCapabilities = Object.freeze({
|
|
|
1274
1375
|
"notes.saveCondensation": false,
|
|
1275
1376
|
retrieval: true,
|
|
1276
1377
|
scheduledTasks: false,
|
|
1277
|
-
"sharedNotebooks.read":
|
|
1378
|
+
"sharedNotebooks.read": true,
|
|
1278
1379
|
"sources.children": true,
|
|
1279
1380
|
"sources.childrenCount": false,
|
|
1280
1381
|
"sources.actionAccess": true,
|
|
@@ -1289,7 +1390,8 @@ const sashCapabilities = Object.freeze({
|
|
|
1289
1390
|
"taskRuns.read": true,
|
|
1290
1391
|
"taskRuns.write": true,
|
|
1291
1392
|
transfers: true,
|
|
1292
|
-
"wikiBranches.read": true
|
|
1393
|
+
"wikiBranches.read": true,
|
|
1394
|
+
"wikiBranches.page": true
|
|
1293
1395
|
});
|
|
1294
1396
|
function capabilitiesFor(access) {
|
|
1295
1397
|
return access === "sash" ? sashCapabilities : dashboardCapabilities;
|
|
@@ -1506,7 +1608,9 @@ const managementOperationNames = [
|
|
|
1506
1608
|
"listMembers",
|
|
1507
1609
|
"listScheduledTasks",
|
|
1508
1610
|
"removeMember",
|
|
1611
|
+
"resolveMemberCandidate",
|
|
1509
1612
|
"saveCompilationSettings",
|
|
1613
|
+
"searchMemberCandidates",
|
|
1510
1614
|
"startCompilation",
|
|
1511
1615
|
"updateMemberPermission",
|
|
1512
1616
|
"updateScheduledTask"
|
|
@@ -1520,6 +1624,8 @@ const cardOperationNames = [
|
|
|
1520
1624
|
"saveCompilationResult"
|
|
1521
1625
|
];
|
|
1522
1626
|
const importOperationNames = [
|
|
1627
|
+
"confirmFullSiteURLImport",
|
|
1628
|
+
"discoverFullSiteURLImport",
|
|
1523
1629
|
"getAliDingImportRun",
|
|
1524
1630
|
"listAliDingImportRunItems",
|
|
1525
1631
|
"listImportProviders",
|
|
@@ -1552,7 +1658,7 @@ const botGatewayOperationNames = [
|
|
|
1552
1658
|
function createLazyTransferOperations(context) {
|
|
1553
1659
|
let operations;
|
|
1554
1660
|
const load = () => {
|
|
1555
|
-
operations ??= import("./transfers-
|
|
1661
|
+
operations ??= import("./transfers-DnuncvOY.js").then(({ createTransferOperations }) => createTransferOperations(context));
|
|
1556
1662
|
return operations;
|
|
1557
1663
|
};
|
|
1558
1664
|
return {
|
|
@@ -1563,7 +1669,7 @@ function createLazyTransferOperations(context) {
|
|
|
1563
1669
|
function createLazyBotGatewayOperations(context) {
|
|
1564
1670
|
let operations;
|
|
1565
1671
|
const load = () => {
|
|
1566
|
-
operations ??= import("./bot-gateway-
|
|
1672
|
+
operations ??= import("./bot-gateway-B5oq12FF.js").then(({ createBotGatewayOperations }) => createBotGatewayOperations(context));
|
|
1567
1673
|
return operations;
|
|
1568
1674
|
};
|
|
1569
1675
|
return Object.fromEntries(botGatewayOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
|
|
@@ -1571,7 +1677,7 @@ function createLazyBotGatewayOperations(context) {
|
|
|
1571
1677
|
function createLazyNoteOperations(context) {
|
|
1572
1678
|
let operations;
|
|
1573
1679
|
const load = () => {
|
|
1574
|
-
operations ??= import("./notes-
|
|
1680
|
+
operations ??= import("./notes-BcyIDQG5.js").then(({ createNoteOperations }) => createNoteOperations(context));
|
|
1575
1681
|
return operations;
|
|
1576
1682
|
};
|
|
1577
1683
|
return Object.fromEntries(noteOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
|
|
@@ -1579,7 +1685,7 @@ function createLazyNoteOperations(context) {
|
|
|
1579
1685
|
function createLazyCardOperations(context) {
|
|
1580
1686
|
let operations;
|
|
1581
1687
|
const load = () => {
|
|
1582
|
-
operations ??= import("./cards-
|
|
1688
|
+
operations ??= import("./cards-CfhvlNeF.js").then(({ createCardOperations }) => createCardOperations(context));
|
|
1583
1689
|
return operations;
|
|
1584
1690
|
};
|
|
1585
1691
|
return Object.fromEntries(cardOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
|
|
@@ -1587,7 +1693,7 @@ function createLazyCardOperations(context) {
|
|
|
1587
1693
|
function createLazyImportOperations(context) {
|
|
1588
1694
|
let operations;
|
|
1589
1695
|
const load = () => {
|
|
1590
|
-
operations ??= import("./imports-
|
|
1696
|
+
operations ??= import("./imports-CUruHsu_.js").then(({ createImportOperations }) => createImportOperations(context));
|
|
1591
1697
|
return operations;
|
|
1592
1698
|
};
|
|
1593
1699
|
return Object.fromEntries(importOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
|
|
@@ -1595,7 +1701,7 @@ function createLazyImportOperations(context) {
|
|
|
1595
1701
|
function createLazyManagementOperations(context) {
|
|
1596
1702
|
let operations;
|
|
1597
1703
|
const load = () => {
|
|
1598
|
-
operations ??= import("./management-
|
|
1704
|
+
operations ??= import("./management-Dr8uPYN9.js").then(({ createManagementOperations }) => createManagementOperations(context));
|
|
1599
1705
|
return operations;
|
|
1600
1706
|
};
|
|
1601
1707
|
return Object.fromEntries(managementOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
|
|
@@ -2413,6 +2519,39 @@ function createRequestBudgetTransport(transport, budget) {
|
|
|
2413
2519
|
};
|
|
2414
2520
|
}
|
|
2415
2521
|
//#endregion
|
|
2522
|
+
//#region ../node-host/src/networkFailureCause.ts
|
|
2523
|
+
const NETWORK_CODES = /* @__PURE__ */ new Set([
|
|
2524
|
+
"ECONNREFUSED",
|
|
2525
|
+
"ECONNRESET",
|
|
2526
|
+
"ENOTFOUND",
|
|
2527
|
+
"EAI_AGAIN",
|
|
2528
|
+
"ETIMEDOUT",
|
|
2529
|
+
"ENETUNREACH",
|
|
2530
|
+
"EHOSTUNREACH",
|
|
2531
|
+
"EPIPE",
|
|
2532
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
2533
|
+
"UND_ERR_HEADERS_TIMEOUT",
|
|
2534
|
+
"UND_ERR_BODY_TIMEOUT",
|
|
2535
|
+
"UND_ERR_SOCKET",
|
|
2536
|
+
"UND_ERR_ABORTED",
|
|
2537
|
+
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
2538
|
+
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
2539
|
+
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
2540
|
+
"CERT_HAS_EXPIRED",
|
|
2541
|
+
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
2542
|
+
"ERR_TLS_CERT_ALTNAME_INVALID",
|
|
2543
|
+
"QMIND_REQUEST_TIMEOUT"
|
|
2544
|
+
]);
|
|
2545
|
+
/** Preserve only a bounded network code before discarding the original transport exception. */
|
|
2546
|
+
function networkFailureCause(cause) {
|
|
2547
|
+
for (let depth = 0; depth < 4 && typeof cause === "object" && cause !== null; depth += 1) {
|
|
2548
|
+
const record = cause;
|
|
2549
|
+
if (typeof record.code === "string" && NETWORK_CODES.has(record.code)) return { code: record.code };
|
|
2550
|
+
cause = record.cause;
|
|
2551
|
+
}
|
|
2552
|
+
return {};
|
|
2553
|
+
}
|
|
2554
|
+
//#endregion
|
|
2416
2555
|
//#region ../node-host/src/node-transport.ts
|
|
2417
2556
|
const RETRYABLE_STATUS = /* @__PURE__ */ new Set([
|
|
2418
2557
|
408,
|
|
@@ -2638,22 +2777,15 @@ function encodeBody(request, boundary) {
|
|
|
2638
2777
|
};
|
|
2639
2778
|
}
|
|
2640
2779
|
function isTimeoutCause(cause) {
|
|
2641
|
-
const code = cause.code;
|
|
2642
|
-
const name = cause.name;
|
|
2780
|
+
const code = networkFailureCause(cause).code;
|
|
2781
|
+
const name = typeof cause === "object" && cause !== null && "name" in cause ? cause.name : void 0;
|
|
2643
2782
|
return code === "QMIND_REQUEST_TIMEOUT" || code === "UND_ERR_CONNECT_TIMEOUT" || code === "UND_ERR_HEADERS_TIMEOUT" || code === "UND_ERR_BODY_TIMEOUT" || name === "TimeoutError";
|
|
2644
2783
|
}
|
|
2645
|
-
function safeCause(cause) {
|
|
2646
|
-
const record = cause;
|
|
2647
|
-
return {
|
|
2648
|
-
...typeof record.name === "string" ? { name: record.name } : {},
|
|
2649
|
-
...typeof record.code === "string" ? { code: record.code } : {}
|
|
2650
|
-
};
|
|
2651
|
-
}
|
|
2652
2784
|
function transportFailure(request, cause, deadlineExpired = false) {
|
|
2653
2785
|
if (cause instanceof QMindError) return cause;
|
|
2654
2786
|
if (request.signal?.aborted === true) return new QMindError("ABORTED", "QMind request was aborted");
|
|
2655
|
-
if (deadlineExpired || isTimeoutCause(cause)) return new QMindError("TIMEOUT", "QMind request timed out", { cause:
|
|
2656
|
-
return new QMindError("NETWORK_ERROR", "QMind network request failed", { cause:
|
|
2787
|
+
if (deadlineExpired || isTimeoutCause(cause)) return new QMindError("TIMEOUT", "QMind request timed out", { cause: networkFailureCause(cause) });
|
|
2788
|
+
return new QMindError("NETWORK_ERROR", "QMind network request failed", { cause: networkFailureCause(cause) });
|
|
2657
2789
|
}
|
|
2658
2790
|
function requestDeadline(signal, milliseconds) {
|
|
2659
2791
|
const controller = new AbortController();
|
|
@@ -2741,8 +2873,8 @@ async function* decodedEvents(body, request, disposeSignal) {
|
|
|
2741
2873
|
} catch (cause) {
|
|
2742
2874
|
if (cause instanceof QMindError) throw cause;
|
|
2743
2875
|
if (request.signal?.aborted === true) throw new QMindError("ABORTED", "QMind stream was aborted");
|
|
2744
|
-
if (isTimeoutCause(cause)) throw new QMindError("TIMEOUT", "QMind stream timed out", { cause:
|
|
2745
|
-
throw new QMindError("STREAM_ERROR", "QMind SSE stream failed", { cause:
|
|
2876
|
+
if (isTimeoutCause(cause)) throw new QMindError("TIMEOUT", "QMind stream timed out", { cause: networkFailureCause(cause) });
|
|
2877
|
+
throw new QMindError("STREAM_ERROR", "QMind SSE stream failed", { cause: networkFailureCause(cause) });
|
|
2746
2878
|
} finally {
|
|
2747
2879
|
disposeSignal();
|
|
2748
2880
|
body.destroy();
|
|
@@ -3104,8 +3236,8 @@ function requestsJsonOutput(argv) {
|
|
|
3104
3236
|
//#region src/build-info.ts
|
|
3105
3237
|
/** Bundled identity, never inferred from argv, environment, or an endpoint. */
|
|
3106
3238
|
const QMIND_CLI_DISTRIBUTION = "global";
|
|
3107
|
-
const QMIND_CLI_VERSION = "3.
|
|
3108
|
-
const QMIND_CLI_BUILD_TIME = "2026-09-
|
|
3239
|
+
const QMIND_CLI_VERSION = "3.4.0";
|
|
3240
|
+
const QMIND_CLI_BUILD_TIME = "2026-09-20T03:45:50.000Z";
|
|
3109
3241
|
function qmindCliPlatform() {
|
|
3110
3242
|
return process.platform === "win32" ? "windows" : process.platform;
|
|
3111
3243
|
}
|
|
@@ -3564,6 +3696,8 @@ function goNotebook(value) {
|
|
|
3564
3696
|
const settings = optionalMap(source.settings);
|
|
3565
3697
|
return {
|
|
3566
3698
|
id: stringValue(source.id),
|
|
3699
|
+
...value.access === void 0 ? {} : { access: value.access },
|
|
3700
|
+
...value.permission === void 0 ? {} : { permission: value.permission },
|
|
3567
3701
|
orgId: stringValue(source.orgId),
|
|
3568
3702
|
userId: stringValue(source.userId),
|
|
3569
3703
|
title: stringValue(source.title),
|
|
@@ -3691,6 +3825,8 @@ function renderAgentNotebook(writer, value, index = 0) {
|
|
|
3691
3825
|
agentField(writer, "id", value.id);
|
|
3692
3826
|
agentField(writer, "orgId", value.orgId);
|
|
3693
3827
|
agentField(writer, "userId", value.userId);
|
|
3828
|
+
agentField(writer, "permission", value.permission);
|
|
3829
|
+
if (value.access != null) for (const [key, field] of Object.entries(value.access)) agentField(writer, key, field);
|
|
3694
3830
|
agentField(writer, "status", value.status);
|
|
3695
3831
|
agentField(writer, "title", value.title);
|
|
3696
3832
|
agentField(writer, "createdAt", timestamp(value.createdAt));
|
|
@@ -3725,6 +3861,8 @@ function renderNotebook(value, format) {
|
|
|
3725
3861
|
else {
|
|
3726
3862
|
writer.line(`ID: ${value.id}`);
|
|
3727
3863
|
writer.line(`Title: ${value.title}`);
|
|
3864
|
+
writer.line(`Permission: ${value.access?.currentUserPermission ?? value.permission ?? "unknown"}`);
|
|
3865
|
+
if (value.access != null) for (const [key, field] of Object.entries(value.access)) writer.line(`${key}: ${field}`);
|
|
3728
3866
|
writer.line(`Status: ${value.status}`);
|
|
3729
3867
|
writer.line(`OrgID: ${value.orgId}`);
|
|
3730
3868
|
writer.line(`UserID: ${value.userId}`);
|
|
@@ -3750,20 +3888,26 @@ function renderNotebookList(value, format) {
|
|
|
3750
3888
|
"STATUS",
|
|
3751
3889
|
"TITLE",
|
|
3752
3890
|
"USER",
|
|
3891
|
+
"PERMISSION",
|
|
3892
|
+
"MEMBERS",
|
|
3753
3893
|
"UPDATED"
|
|
3754
3894
|
], value.notebooks.map((item) => [
|
|
3755
3895
|
truncate(item.id, 36),
|
|
3756
3896
|
truncate(item.status, 10),
|
|
3757
3897
|
truncate(item.title, 28),
|
|
3758
3898
|
truncate(item.userId, 18),
|
|
3899
|
+
item.access?.currentUserPermission ?? item.permission ?? "unknown",
|
|
3900
|
+
item.access?.memberCount ?? "-",
|
|
3759
3901
|
timestamp(item.updatedAt)
|
|
3760
3902
|
]), [
|
|
3761
3903
|
36,
|
|
3762
3904
|
10,
|
|
3763
3905
|
28,
|
|
3764
3906
|
18,
|
|
3907
|
+
12,
|
|
3908
|
+
7,
|
|
3765
3909
|
20
|
|
3766
|
-
],
|
|
3910
|
+
], 143);
|
|
3767
3911
|
}
|
|
3768
3912
|
return writer.toString();
|
|
3769
3913
|
}
|
|
@@ -3821,11 +3965,12 @@ function renderSourceList(value, format) {
|
|
|
3821
3965
|
return writer.toString();
|
|
3822
3966
|
}
|
|
3823
3967
|
function renderRetrieve(value, format) {
|
|
3824
|
-
|
|
3968
|
+
const cards = "cards" in value ? value.cards : [];
|
|
3969
|
+
if (format === "json") return json("cards" in value ? goRetrieve(value) : value, true);
|
|
3825
3970
|
if (format === "ndjson") return [...value.chunks.map((item) => ({
|
|
3826
3971
|
kind: "chunk",
|
|
3827
3972
|
...item
|
|
3828
|
-
})), ...
|
|
3973
|
+
})), ...cards.map((item) => ({
|
|
3829
3974
|
kind: "card",
|
|
3830
3975
|
...item
|
|
3831
3976
|
}))].map((item) => json(item, false)).join("");
|
|
@@ -3836,6 +3981,10 @@ function renderRetrieve(value, format) {
|
|
|
3836
3981
|
value.chunks.forEach((chunk, index) => {
|
|
3837
3982
|
writer.line("---");
|
|
3838
3983
|
agentField(writer, "type", "chunk");
|
|
3984
|
+
if ("notebookId" in chunk && "notebookTitle" in chunk) {
|
|
3985
|
+
agentField(writer, "notebookId", chunk.notebookId);
|
|
3986
|
+
agentField(writer, "notebookTitle", chunk.notebookTitle);
|
|
3987
|
+
}
|
|
3839
3988
|
agentField(writer, "index", index + 1);
|
|
3840
3989
|
agentField(writer, "chunkId", chunk.chunkId);
|
|
3841
3990
|
agentField(writer, "chunkIndex", chunk.chunkIndex);
|
|
@@ -3846,7 +3995,7 @@ function renderRetrieve(value, format) {
|
|
|
3846
3995
|
agentField(writer, "tokenCount", chunk.tokenCount);
|
|
3847
3996
|
agentText(writer, "content", unescapeText(chunk.content));
|
|
3848
3997
|
});
|
|
3849
|
-
|
|
3998
|
+
cards.forEach((card, index) => {
|
|
3850
3999
|
writer.line("---");
|
|
3851
4000
|
agentField(writer, "type", "retrievedCard");
|
|
3852
4001
|
agentField(writer, "index", index + 1);
|
|
@@ -3862,6 +4011,10 @@ function renderRetrieve(value, format) {
|
|
|
3862
4011
|
value.citations.forEach((citation, index) => {
|
|
3863
4012
|
writer.line("---");
|
|
3864
4013
|
agentField(writer, "type", "citation");
|
|
4014
|
+
if ("notebookId" in citation && "notebookTitle" in citation) {
|
|
4015
|
+
agentField(writer, "notebookId", citation.notebookId);
|
|
4016
|
+
agentField(writer, "notebookTitle", citation.notebookTitle);
|
|
4017
|
+
}
|
|
3865
4018
|
agentField(writer, "index", index + 1);
|
|
3866
4019
|
agentField(writer, "sourceId", citation.sourceId);
|
|
3867
4020
|
agentField(writer, "sourceTitle", citation.sourceTitle);
|
|
@@ -3877,18 +4030,21 @@ function renderRetrieve(value, format) {
|
|
|
3877
4030
|
writer.line("== Chunks ==");
|
|
3878
4031
|
table(writer, [
|
|
3879
4032
|
"SCORE",
|
|
4033
|
+
..."cards" in value ? [] : ["NOTEBOOK"],
|
|
3880
4034
|
"CHUNK_ID",
|
|
3881
4035
|
"IDX",
|
|
3882
4036
|
"SOURCE",
|
|
3883
4037
|
"CONTENT"
|
|
3884
4038
|
], value.chunks.map((chunk) => [
|
|
3885
4039
|
chunk.score.toFixed(2),
|
|
4040
|
+
..."notebookId" in chunk ? [truncate(chunk.notebookTitle || chunk.notebookId, 30)] : [],
|
|
3886
4041
|
truncate(chunk.chunkId, 36),
|
|
3887
4042
|
chunk.chunkIndex,
|
|
3888
4043
|
truncate(chunk.sourceTitle, 30),
|
|
3889
4044
|
truncate(unescapeText(chunk.content).replace(/\n/g, " "), 50)
|
|
3890
4045
|
]), [
|
|
3891
4046
|
6,
|
|
4047
|
+
..."cards" in value ? [] : [30],
|
|
3892
4048
|
36,
|
|
3893
4049
|
6,
|
|
3894
4050
|
30,
|
|
@@ -3897,12 +4053,13 @@ function renderRetrieve(value, format) {
|
|
|
3897
4053
|
writer.line();
|
|
3898
4054
|
value.chunks.forEach((chunk, index) => {
|
|
3899
4055
|
writer.line(`[${index + 1}] chunkId=${chunk.chunkId} sourceId=${chunk.sourceId} sourceTitle=${chunk.sourceTitle} score=${chunk.score.toFixed(4)} tokens=${chunk.tokenCount}`);
|
|
4056
|
+
if ("notebookId" in chunk && "notebookTitle" in chunk) writer.line(` notebookId: ${oneLine(chunk.notebookId)} notebookTitle: ${oneLine(chunk.notebookTitle)}`);
|
|
3900
4057
|
if (chunk.sourceUri.length > 0) writer.line(` uri: ${chunk.sourceUri}`);
|
|
3901
4058
|
if (chunk.content.length > 0) writer.line(` content: ${unescapeText(chunk.content)}`);
|
|
3902
4059
|
writer.line();
|
|
3903
4060
|
});
|
|
3904
4061
|
}
|
|
3905
|
-
if (
|
|
4062
|
+
if (cards.length > 0) {
|
|
3906
4063
|
writer.line("== Cards ==");
|
|
3907
4064
|
table(writer, [
|
|
3908
4065
|
"SCORE",
|
|
@@ -3911,7 +4068,7 @@ function renderRetrieve(value, format) {
|
|
|
3911
4068
|
"CATEGORY",
|
|
3912
4069
|
"TITLE",
|
|
3913
4070
|
"CONTENT"
|
|
3914
|
-
],
|
|
4071
|
+
], cards.map((card) => [
|
|
3915
4072
|
card.score.toFixed(2),
|
|
3916
4073
|
card.depth,
|
|
3917
4074
|
truncate(card.id, 36),
|
|
@@ -3932,6 +4089,7 @@ function renderRetrieve(value, format) {
|
|
|
3932
4089
|
writer.line("== Citations ==");
|
|
3933
4090
|
value.citations.forEach((citation, index) => {
|
|
3934
4091
|
writer.line(`[${index + 1}] sourceId=${citation.sourceId} sourceTitle=${citation.sourceTitle} chunkId=${citation.chunkId}`);
|
|
4092
|
+
if ("notebookId" in citation && "notebookTitle" in citation) writer.line(` notebookId: ${oneLine(citation.notebookId)} notebookTitle: ${oneLine(citation.notebookTitle)}`);
|
|
3935
4093
|
if (citation.snippet.length > 0) writer.line(` snippet: ${oneLine(unescapeText(citation.snippet))}`);
|
|
3936
4094
|
});
|
|
3937
4095
|
writer.line();
|
|
@@ -3943,9 +4101,17 @@ function renderQMindCliPresentation(presentation, format) {
|
|
|
3943
4101
|
switch (presentation.kind) {
|
|
3944
4102
|
case "notebook": return renderNotebook(presentation.value, format);
|
|
3945
4103
|
case "notebookList": return renderNotebookList(presentation.value, format);
|
|
4104
|
+
case "sharedNotebookList": return renderNotebookList({
|
|
4105
|
+
...presentation.value,
|
|
4106
|
+
notebooks: presentation.value.notebooks.map(({ notebook, permission }) => ({
|
|
4107
|
+
...notebook,
|
|
4108
|
+
...permission === void 0 ? {} : { permission }
|
|
4109
|
+
}))
|
|
4110
|
+
}, format);
|
|
3946
4111
|
case "source": return renderSource(presentation.value, format);
|
|
3947
4112
|
case "sourceList": return renderSourceList(presentation.value, format);
|
|
3948
4113
|
case "retrieve": return renderRetrieve(presentation.value, format);
|
|
4114
|
+
case "multiRetrieve": return renderRetrieve(presentation.value, format);
|
|
3949
4115
|
case "imageUpload": return json({
|
|
3950
4116
|
uploadUrl: presentation.value.uploadUrl,
|
|
3951
4117
|
method: presentation.value.method,
|
|
@@ -4377,6 +4543,11 @@ function positiveNumberOption(options, key, fallback) {
|
|
|
4377
4543
|
function splitCsv(value) {
|
|
4378
4544
|
return value?.split(",").map((item) => item.trim()).filter(Boolean) ?? [];
|
|
4379
4545
|
}
|
|
4546
|
+
function collectNotebookIds(value, previous) {
|
|
4547
|
+
const ids = value.split(",").map((id) => id.trim());
|
|
4548
|
+
if (ids.some((id) => id.length === 0)) throw new QMindError("INVALID_ARGUMENT", "--nb must contain non-empty notebook IDs");
|
|
4549
|
+
return [.../* @__PURE__ */ new Set([...previous, ...ids])];
|
|
4550
|
+
}
|
|
4380
4551
|
function formatOf(options) {
|
|
4381
4552
|
return parseQMindCliOutputFormat(String(options.format ?? "table"));
|
|
4382
4553
|
}
|
|
@@ -4447,12 +4618,23 @@ function registerCoreCommands(context, program) {
|
|
|
4447
4618
|
})
|
|
4448
4619
|
});
|
|
4449
4620
|
});
|
|
4450
|
-
withCommon(notebook.command("list").description("List notebooks")).option("--filter-client <name>", "filter by originating client", "").action(async (raw) => {
|
|
4621
|
+
withCommon(notebook.command("list").description("List notebooks")).option("--filter-client <name>", "filter by originating client", "").addOption(new Option("--shared", "list notebooks shared with you").conflicts("filterClient")).option("--page <number>", "page number", integer).option("--page-size <number>", "items per page", integer).action(async (raw) => {
|
|
4451
4622
|
const host = await hostFor(context, raw);
|
|
4452
4623
|
const client = optionalString(raw, "filterClient");
|
|
4453
|
-
|
|
4624
|
+
const pagination = {
|
|
4625
|
+
...raw.page === void 0 ? {} : { page: Number(raw.page) },
|
|
4626
|
+
...raw.pageSize === void 0 ? {} : { pageSize: Number(raw.pageSize) }
|
|
4627
|
+
};
|
|
4628
|
+
if (raw.shared === true) render(context, raw, {
|
|
4629
|
+
kind: "sharedNotebookList",
|
|
4630
|
+
value: await host.client.listSharedNotebooks(pagination)
|
|
4631
|
+
});
|
|
4632
|
+
else render(context, raw, {
|
|
4454
4633
|
kind: "notebookList",
|
|
4455
|
-
value: await host.client.listNotebooks(
|
|
4634
|
+
value: await host.client.listNotebooks({
|
|
4635
|
+
...pagination,
|
|
4636
|
+
...client === void 0 ? {} : { client }
|
|
4637
|
+
})
|
|
4456
4638
|
});
|
|
4457
4639
|
});
|
|
4458
4640
|
withCommon(notebook.command("get <notebook_id>").description("Get a notebook")).action(async (notebookId, raw) => {
|
|
@@ -4465,14 +4647,34 @@ function registerCoreCommands(context, program) {
|
|
|
4465
4647
|
await (await hostFor(context, raw)).client.deleteNotebook(notebookId);
|
|
4466
4648
|
context.io.stdout("deleted\n");
|
|
4467
4649
|
});
|
|
4468
|
-
withCommon(program.command("retrieve [query]").description("Retrieve
|
|
4650
|
+
withCommon(program.command("retrieve [query]").description("Retrieve context from one or more notebooks without an LLM call")).option("--nb <ids>", "notebook IDs (required, comma-separated or repeatable, maximum 5)", collectNotebookIds, []).option("-q, --query <query>", "retrieval query").option("--sources <ids>", "comma-separated source IDs (single notebook only)", "").option("--top-k <number>", "joint recall candidate limit", integer, 0).option("--max-results <number>", "maximum context results across selected notebooks", integer, 0).action(async (query, raw) => {
|
|
4651
|
+
const notebookIds = raw.nb;
|
|
4652
|
+
const [notebookId] = notebookIds;
|
|
4653
|
+
if (notebookId === void 0) throw new QMindError("INVALID_ARGUMENT", "--nb is required");
|
|
4654
|
+
if (notebookIds.length > 5) throw new QMindError("INVALID_ARGUMENT", "--nb accepts at most 5 distinct notebook IDs");
|
|
4655
|
+
const input = {
|
|
4656
|
+
maxResults: numberOption(raw, "maxResults", 0),
|
|
4657
|
+
query: requiredString(raw.query || query, "--query or positional query"),
|
|
4658
|
+
sourceIds: splitCsv(stringOption(raw, "sources")),
|
|
4659
|
+
topK: numberOption(raw, "topK", 0)
|
|
4660
|
+
};
|
|
4661
|
+
if (input.maxResults < 0 || input.topK < 0) throw new QMindError("INVALID_ARGUMENT", "--top-k and --max-results must be non-negative");
|
|
4662
|
+
if (notebookIds.length > 1 && input.sourceIds.length > 0) throw new QMindError("INVALID_ARGUMENT", "--sources requires a single notebook");
|
|
4663
|
+
const host = await hostFor(context, raw);
|
|
4664
|
+
if (notebookIds.length === 1) {
|
|
4665
|
+
render(context, raw, {
|
|
4666
|
+
kind: "retrieve",
|
|
4667
|
+
value: await host.client.retrieve(notebookId, input)
|
|
4668
|
+
});
|
|
4669
|
+
return;
|
|
4670
|
+
}
|
|
4469
4671
|
render(context, raw, {
|
|
4470
|
-
kind: "
|
|
4471
|
-
value: await
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4672
|
+
kind: "multiRetrieve",
|
|
4673
|
+
value: await host.client.retrieveNotebooks({
|
|
4674
|
+
query: input.query,
|
|
4675
|
+
topK: input.topK,
|
|
4676
|
+
maxResults: input.maxResults,
|
|
4677
|
+
targets: notebookIds.map((notebookId) => ({ notebookId }))
|
|
4476
4678
|
})
|
|
4477
4679
|
});
|
|
4478
4680
|
});
|
|
@@ -4782,7 +4984,7 @@ async function runQMindCli(argv, options = {}) {
|
|
|
4782
4984
|
updater: options.updater ?? createQMindCliUpdater({ identity: {
|
|
4783
4985
|
artifactKind: "npm",
|
|
4784
4986
|
command: distribution.command,
|
|
4785
|
-
currentVersion: "3.
|
|
4987
|
+
currentVersion: "3.4.0",
|
|
4786
4988
|
distribution: distribution.id,
|
|
4787
4989
|
executablePath: process.execPath,
|
|
4788
4990
|
package: distribution.package,
|
|
@@ -236,6 +236,7 @@ async function* executeStream(options) {
|
|
|
236
236
|
}
|
|
237
237
|
//#endregion
|
|
238
238
|
//#region ../sdk/src/imports.ts
|
|
239
|
+
const qmindFullSiteURLImportPageLimit = 2e3;
|
|
239
240
|
const runStatuses = Object.freeze({
|
|
240
241
|
ALI_DING_IMPORT_RUN_STATUS_FAILED: "failed",
|
|
241
242
|
ALI_DING_IMPORT_RUN_STATUS_PARTIAL: "partial",
|
|
@@ -373,7 +374,7 @@ const timestampPartsSchema = z.object({
|
|
|
373
374
|
});
|
|
374
375
|
const timestampSchema = z.union([z.iso.datetime({ offset: true }), timestampPartsSchema]).nullable().transform((value, context) => {
|
|
375
376
|
if (value === null) return null;
|
|
376
|
-
const milliseconds = typeof value === "string" ? Date.parse(value) : Number(value.seconds) * 1e3 + (value.nanos ?? 0) / 1e6;
|
|
377
|
+
const milliseconds = typeof value === "string" ? Date.parse(value) : Number(value.seconds) * 1e3 + Math.floor((value.nanos ?? 0) / 1e6);
|
|
377
378
|
const date = new Date(milliseconds);
|
|
378
379
|
if (!Number.isFinite(milliseconds) || Number.isNaN(date.valueOf())) {
|
|
379
380
|
context.addIssue({
|
|
@@ -382,7 +383,8 @@ const timestampSchema = z.union([z.iso.datetime({ offset: true }), timestampPart
|
|
|
382
383
|
});
|
|
383
384
|
return z.NEVER;
|
|
384
385
|
}
|
|
385
|
-
|
|
386
|
+
const canonicalFraction = (typeof value === "string" ? value.match(/\.(\d+)(?:Z|[+-]\d{2}:\d{2})$/u)?.[1] ?? "" : String(value.nanos ?? 0).padStart(9, "0")).replace(/0+$/u, "").padEnd(3, "0");
|
|
387
|
+
return date.toISOString().replace(/\.\d{3}Z$/u, `.${canonicalFraction}Z`);
|
|
386
388
|
});
|
|
387
389
|
const notebookOverviewSchema = z.object({
|
|
388
390
|
status: z.string().default("empty"),
|
|
@@ -434,34 +436,6 @@ const sharedNotebookListSchema = z.object({
|
|
|
434
436
|
pageSize: wirePageNumberSchema,
|
|
435
437
|
totalSize: z.number().int().nonnegative().default(0)
|
|
436
438
|
});
|
|
437
|
-
const wikiDocumentSchema = z.preprocess((value) => isRecord(value) ? {
|
|
438
|
-
...value,
|
|
439
|
-
contentHash: value.contentHash ?? value.content_hash,
|
|
440
|
-
contentUrl: value.contentUrl ?? value.content_url
|
|
441
|
-
} : value, z.object({
|
|
442
|
-
contentHash: z.string().default(""),
|
|
443
|
-
contentUrl: z.string().min(1),
|
|
444
|
-
language: z.string().default("")
|
|
445
|
-
}));
|
|
446
|
-
const wikiBranchSchema = z.preprocess((value) => isRecord(value) ? {
|
|
447
|
-
...value,
|
|
448
|
-
commitTimestamp: value.commitTimestamp ?? value.commit_timestamp,
|
|
449
|
-
knowledgeCount: value.knowledgeCount ?? value.knowledge_count,
|
|
450
|
-
repoUrl: value.repoUrl ?? value.repo_url,
|
|
451
|
-
resultVersion: value.resultVersion ?? value.result_version,
|
|
452
|
-
updatedAt: value.updatedAt ?? value.updated_at
|
|
453
|
-
} : value, z.object({
|
|
454
|
-
branch: z.string().min(1),
|
|
455
|
-
commitTimestamp: z.number().optional(),
|
|
456
|
-
documents: z.array(wikiDocumentSchema).nullish().transform((documents) => documents ?? []),
|
|
457
|
-
exists: z.boolean().optional(),
|
|
458
|
-
knowledgeCount: z.number().int().nonnegative().default(0),
|
|
459
|
-
repo: z.string().min(1),
|
|
460
|
-
repoUrl: z.string().optional(),
|
|
461
|
-
resultVersion: z.string().default(""),
|
|
462
|
-
updatedAt: timestampSchema.optional()
|
|
463
|
-
}));
|
|
464
|
-
const wikiBranchListSchema = z.object({ branches: z.array(wikiBranchSchema).nullish().transform((branches) => branches ?? []) });
|
|
465
439
|
const cardLinkSchema = z.object({
|
|
466
440
|
description: z.string().optional(),
|
|
467
441
|
linkType: z.string().default(""),
|
|
@@ -564,7 +538,11 @@ const sourceListSchema = z.object({
|
|
|
564
538
|
sources: z.array(sourceSchema).nullish().transform((sources) => sources ?? []),
|
|
565
539
|
totalSize: z.number().int().nonnegative().optional()
|
|
566
540
|
});
|
|
567
|
-
const sourceTreeNodeSchema = z.lazy(() => z.
|
|
541
|
+
const sourceTreeNodeSchema = z.lazy(() => z.preprocess((value) => isRecord(value) ? {
|
|
542
|
+
...value,
|
|
543
|
+
updatedAt: value.updatedAt ?? value.updated_at
|
|
544
|
+
} : value, z.object({
|
|
545
|
+
metadata: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
568
546
|
externalBinding: sourceExternalBindingSchema.optional(),
|
|
569
547
|
originUrl: z.string().optional(),
|
|
570
548
|
isEmailFolder: z.boolean().optional(),
|
|
@@ -577,8 +555,9 @@ const sourceTreeNodeSchema = z.lazy(() => z.object({
|
|
|
577
555
|
path: z.string().default(""),
|
|
578
556
|
sourceType: z.string().default(""),
|
|
579
557
|
status: z.string().default(""),
|
|
580
|
-
type: z.enum(["file", "directory"])
|
|
581
|
-
|
|
558
|
+
type: z.enum(["file", "directory"]),
|
|
559
|
+
updatedAt: timestampSchema.optional()
|
|
560
|
+
})));
|
|
582
561
|
const sourceTreeSchema = z.object({
|
|
583
562
|
totalSize: z.number().int().nonnegative().default(0),
|
|
584
563
|
tree: z.array(sourceTreeNodeSchema)
|
|
@@ -857,6 +836,10 @@ const batchMutationResultSchema = z.object({
|
|
|
857
836
|
failureCount: z.number().int().nonnegative().default(0),
|
|
858
837
|
successCount: z.number().int().nonnegative().default(0)
|
|
859
838
|
});
|
|
839
|
+
const batchDeleteResultSchema = z.object({
|
|
840
|
+
failureCount: z.number().int().nonnegative(),
|
|
841
|
+
successCount: z.number().int().nonnegative()
|
|
842
|
+
});
|
|
860
843
|
const voidResponseSchema = z.unknown().transform(() => void 0);
|
|
861
844
|
const imageUploadTicketSchema = z.object({
|
|
862
845
|
expiresAt: z.string().optional(),
|
|
@@ -1029,12 +1012,47 @@ const taskRunSchema = z.object({
|
|
|
1029
1012
|
rawStatus: value.status,
|
|
1030
1013
|
status: normalizeQMindTaskRunStatus(value.status)
|
|
1031
1014
|
}));
|
|
1015
|
+
const fullSiteURLImportDiscoverySchema = z.object({
|
|
1016
|
+
discoveredCount: z.number().int().nonnegative(),
|
|
1017
|
+
discoveryId: z.string().min(1),
|
|
1018
|
+
droppedCount: z.number().int().nonnegative(),
|
|
1019
|
+
entryUrl: z.string().url(),
|
|
1020
|
+
expiresAt: timestampSchema,
|
|
1021
|
+
indexCount: z.number().int().nonnegative(),
|
|
1022
|
+
manifest: z.object({
|
|
1023
|
+
kind: z.enum(["llms", "sitemap"]),
|
|
1024
|
+
url: z.string().url()
|
|
1025
|
+
}),
|
|
1026
|
+
pages: z.array(z.object({
|
|
1027
|
+
id: z.string().min(1),
|
|
1028
|
+
url: z.string().url()
|
|
1029
|
+
})).nullish().transform((pages) => pages ?? []),
|
|
1030
|
+
returnedCount: z.number().int().nonnegative(),
|
|
1031
|
+
truncated: z.boolean()
|
|
1032
|
+
});
|
|
1033
|
+
const fullSiteURLImportConfirmationSchema = z.object({
|
|
1034
|
+
rootSource: sourceSchema,
|
|
1035
|
+
taskRun: taskRunSchema
|
|
1036
|
+
});
|
|
1032
1037
|
const taskRunListSchema = z.object({
|
|
1033
1038
|
currentPage: wirePageNumberSchema,
|
|
1034
1039
|
pageSize: wirePageNumberSchema,
|
|
1035
1040
|
runs: z.array(taskRunSchema).nullish().transform((runs) => runs ?? []),
|
|
1036
1041
|
totalSize: z.number().int().nonnegative().default(0)
|
|
1037
1042
|
});
|
|
1043
|
+
const retrieveNotebooksResultSchema = z.object({
|
|
1044
|
+
chunks: z.array(z.intersection(notebookContextChunkSchema, z.object({
|
|
1045
|
+
notebookId: z.string().min(1),
|
|
1046
|
+
notebookTitle: z.string()
|
|
1047
|
+
}))).default([]),
|
|
1048
|
+
citations: z.array(z.intersection(notebookCitationSchema, z.object({
|
|
1049
|
+
notebookId: z.string().min(1),
|
|
1050
|
+
notebookTitle: z.string()
|
|
1051
|
+
}))).default([]),
|
|
1052
|
+
promptContext: z.string().default(""),
|
|
1053
|
+
reranked: z.boolean().default(false),
|
|
1054
|
+
total: z.number().int().nonnegative().default(0)
|
|
1055
|
+
});
|
|
1038
1056
|
//#endregion
|
|
1039
1057
|
//#region ../sdk/src/operations/shared.ts
|
|
1040
1058
|
function invalidArgument(message, field, details) {
|
|
@@ -1164,4 +1182,4 @@ function call(context, options) {
|
|
|
1164
1182
|
});
|
|
1165
1183
|
}
|
|
1166
1184
|
//#endregion
|
|
1167
|
-
export {
|
|
1185
|
+
export { timestampSchema as $, imageUrlsSchema as A, sourceImportResultsSchema as B, cardSchema as C, fullSiteURLImportConfirmationSchema as D, chatSessionSchema as E, retrieveResultSchema as F, sourceTreeSchema as G, sourcePreviewSchema as H, sharedNotebookListSchema as I, sourceWebOfficeSessionSchema as J, sourceUploadCapabilitiesSchema as K, sourceActionAccessSchema as L, notebookListSchema as M, notebookSchema as N, fullSiteURLImportDiscoverySchema as O, retrieveNotebooksResultSchema as P, taskRunSchema as Q, sourceChildrenCountsSchema as R, cardListSchema as S, chatSessionListSchema as T, sourceRawContentSchema as U, sourceListSchema as V, sourceSchema as W, streamWireEventSchema as X, sourceWebOfficeTokenSchema as Y, taskRunListSchema as Z, aliDingImportRunItemListSchema as _, invalidArgument as a, executeStream as at, batchMutationResultSchema as b, optionalRecord as c, pagination as d, voidResponseSchema as et, positiveInteger as f, stringList as g, requiredText as h, httpUrl as i, assertCapability as it, importProvidersSchema as j, imageUploadTicketSchema as k, optionalString as l, requiredString as m, call as n, QMIND_SOURCE_UPLOAD_MAX_BYTES as nt, nonNegativeInteger as o, executeUnary as ot, queryPath as p, sourceUploadTicketSchema as q, compactUndefined as r, qmindFullSiteURLImportPageLimit as rt, optionalBoolean as s, QMindError as st, assertNonEmptyPatch as t, QMIND_MULTIPART_UPLOAD_MAX_BYTES as tt, optionalTrimmedString as u, aliDingImportRunSchema as v, chatMessageListSchema as w, cancelQuestionResultSchema as x, batchDeleteResultSchema as y, sourceContentSchema as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { K as sourceUploadCapabilitiesSchema, m as requiredString, n as call } from "./shared-DBGAKppE.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 {
|
|
2
|
-
import { t as preflightSourceUpload } from "./source-upload-
|
|
1
|
+
import { W as sourceSchema, a as invalidArgument, et as voidResponseSchema, k as imageUploadTicketSchema, l as optionalString, m as requiredString, nt as QMIND_SOURCE_UPLOAD_MAX_BYTES, ot as executeUnary, p as queryPath, q as sourceUploadTicketSchema, r as compactUndefined, st as QMindError, tt as QMIND_MULTIPART_UPLOAD_MAX_BYTES, u as optionalTrimmedString } from "./shared-DBGAKppE.js";
|
|
2
|
+
import { t as preflightSourceUpload } from "./source-upload-CCasR8MW.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);
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { $ as timestampSchema, a as invalidArgument, d as pagination, m as requiredString, n as call, p as queryPath, u as optionalTrimmedString } from "./shared-DBGAKppE.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region ../sdk/src/operations/wiki-branches.ts
|
|
4
|
+
function isRecord(value) {
|
|
5
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6
|
+
}
|
|
7
|
+
const wikiDocumentSchema = z.preprocess((value) => isRecord(value) ? {
|
|
8
|
+
...value,
|
|
9
|
+
contentHash: value.contentHash ?? value.content_hash,
|
|
10
|
+
contentUrl: value.contentUrl ?? value.content_url
|
|
11
|
+
} : value, z.object({
|
|
12
|
+
contentHash: z.string().default(""),
|
|
13
|
+
contentUrl: z.string().min(1),
|
|
14
|
+
language: z.string().default("")
|
|
15
|
+
}));
|
|
16
|
+
const wikiBranchSchema = z.preprocess((value) => isRecord(value) ? {
|
|
17
|
+
...value,
|
|
18
|
+
commitTimestamp: value.commitTimestamp ?? value.commit_timestamp,
|
|
19
|
+
knowledgeCount: value.knowledgeCount ?? value.knowledge_count,
|
|
20
|
+
repoUrl: value.repoUrl ?? value.repo_url,
|
|
21
|
+
resultVersion: value.resultVersion ?? value.result_version,
|
|
22
|
+
updatedAt: value.updatedAt ?? value.updated_at
|
|
23
|
+
} : value, z.object({
|
|
24
|
+
branch: z.string().min(1),
|
|
25
|
+
commitTimestamp: z.number().optional(),
|
|
26
|
+
documents: z.array(wikiDocumentSchema).nullish().transform((documents) => documents ?? []),
|
|
27
|
+
exists: z.boolean().optional(),
|
|
28
|
+
imported: z.boolean().optional(),
|
|
29
|
+
knowledgeCount: z.number().int().nonnegative().default(0),
|
|
30
|
+
repo: z.string().min(1),
|
|
31
|
+
repoUrl: z.string().optional(),
|
|
32
|
+
resultVersion: z.string().default(""),
|
|
33
|
+
updatedAt: timestampSchema.optional()
|
|
34
|
+
}));
|
|
35
|
+
const wikiBranchListSchema = z.object({ branches: z.array(wikiBranchSchema).nullish().transform((branches) => branches ?? []) });
|
|
36
|
+
const wikiBranchPageSchema = z.object({
|
|
37
|
+
branches: z.array(wikiBranchSchema).nullable().transform((branches) => branches ?? []),
|
|
38
|
+
currentPage: z.number().int().positive(),
|
|
39
|
+
pageSize: z.number().int().positive().max(50),
|
|
40
|
+
totalSize: z.number().int().nonnegative()
|
|
41
|
+
});
|
|
42
|
+
/** Loaded only when RepoWiki discovery is requested, keeping Notebook startup small. */
|
|
43
|
+
function createWikiBranchOperations(context) {
|
|
44
|
+
return {
|
|
45
|
+
async listWikiBranches(notebookId, options) {
|
|
46
|
+
const id = requiredString(notebookId, "notebookId");
|
|
47
|
+
return (await call(context, {
|
|
48
|
+
callOptions: options,
|
|
49
|
+
capability: "wikiBranches.read",
|
|
50
|
+
idempotent: true,
|
|
51
|
+
method: "GET",
|
|
52
|
+
operation: "wikiBranches.list",
|
|
53
|
+
path: context.profile.wikiBranchesPath(id),
|
|
54
|
+
schema: wikiBranchListSchema
|
|
55
|
+
})).branches;
|
|
56
|
+
},
|
|
57
|
+
async listWikiBranchesPage(notebookId, input = {}, options) {
|
|
58
|
+
const id = requiredString(notebookId, "notebookId");
|
|
59
|
+
const { page = 1, pageSize = 20 } = pagination(input);
|
|
60
|
+
if (!Number.isSafeInteger(page)) throw invalidArgument("page is too large", "page");
|
|
61
|
+
const query = optionalTrimmedString(input.query, "query");
|
|
62
|
+
if (query && [...query].length > 256) throw invalidArgument("query must be at most 256 characters", "query");
|
|
63
|
+
return call(context, {
|
|
64
|
+
callOptions: options,
|
|
65
|
+
capability: "wikiBranches.page",
|
|
66
|
+
idempotent: true,
|
|
67
|
+
method: "GET",
|
|
68
|
+
operation: "wikiBranches.listPage",
|
|
69
|
+
path: queryPath(context.profile.wikiBranchesPath(id), [
|
|
70
|
+
["page", page],
|
|
71
|
+
["page_size", Math.min(pageSize, 50)],
|
|
72
|
+
["query", query]
|
|
73
|
+
]),
|
|
74
|
+
schema: wikiBranchPageSchema
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
export { createWikiBranchOperations };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qoder-ai/qmind-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
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.3.
|
|
43
|
-
"@ali/qmind-sdk": "^0.
|
|
42
|
+
"@ali/qmind-node-host": "^2.3.18",
|
|
43
|
+
"@ali/qmind-sdk": "^0.24.1"
|
|
44
44
|
},
|
|
45
45
|
"license": "UNLICENSED"
|
|
46
46
|
}
|