@qoder-ai/qmind-cli 3.4.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/CHANGELOG.zh-CN.md +6 -0
- package/README.md +2 -2
- package/dist/{bot-gateway-B5oq12FF.js → bot-gateway-eajGWyYA.js} +1 -1
- package/dist/{imports-CUruHsu_.js → imports-CebWSRju.js} +1 -1
- package/dist/{management-Dr8uPYN9.js → management-Avpo7nTn.js} +1 -2
- package/dist/{notes-BcyIDQG5.js → notes-PwqGFJvk.js} +1 -1
- package/dist/qmind.js +162 -156
- package/dist/{shared-DBGAKppE.js → shared-DsqZroGJ.js} +13 -75
- package/dist/{source-upload-CCasR8MW.js → source-upload-DdZ0J4gC.js} +1 -1
- package/dist/{transfers-DnuncvOY.js → transfers-SJE97RLg.js} +2 -2
- package/dist/{wiki-branches-BfIfXeN9.js → wiki-branches-CNLpYYCl.js} +1 -1
- package/package.json +3 -3
- package/dist/cards-CfhvlNeF.js +0 -132
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ English (default) | [简体中文](CHANGELOG.zh-CN.md)
|
|
|
4
4
|
|
|
5
5
|
Published versions below describe the Global CLI/shared implementation, not historical CN releases. CN will join the shared history with the future joint release.
|
|
6
6
|
|
|
7
|
+
## 3.5.0
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- 708977c: Retire Cards completely from `qmind-cn`: retrieval JSON no longer includes `cards`, NDJSON emits only chunks, and table/agent output no longer renders Cards. Compilation progress no longer displays card counts. Update output consumers to use chunks and citations; there is no compatibility flag to restore Cards. Single-notebook retrieval keeps its endpoint, and multi-notebook output keeps notebook identity and server ranking.
|
|
12
|
+
|
|
7
13
|
## 3.4.0
|
|
8
14
|
|
|
9
15
|
### Minor Changes
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
以下已发布版本属于 Global CLI / 共享实现,不代表 CN 曾发布过这些版本。CN 将在后续共同发行版加入同一历史。
|
|
6
6
|
|
|
7
|
+
## 3.5.0
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- 708977c: 从 `qmind-cn` 彻底移除 Cards:检索 JSON 不再包含 `cards`,NDJSON 仅输出 chunks,table/agent 不再渲染卡片。编译进度不再展示卡片计数。消费方需改用 chunks 和 citations,不提供恢复 Cards 的兼容开关。单知识库检索保留原端点,多知识库输出保留知识库身份与服务端排序。
|
|
12
|
+
|
|
7
13
|
## 3.4.0
|
|
8
14
|
|
|
9
15
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -85,9 +85,9 @@ qmind retrieve --nb nb-1 --nb nb-2 "What is the deployment process?" --format ag
|
|
|
85
85
|
- Selection is explicit; the CLI never defaults to all accessible notebooks.
|
|
86
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
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
|
|
88
|
+
- `--sources` requires a single notebook. A single deduplicated notebook keeps the existing retrieval endpoint. All retrieval output formats expose chunks and citations without knowledge cards.
|
|
89
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.
|
|
90
|
+
- Unified retrieval fails as one request when a target is invalid or inaccessible. The CLI reports the error without retrying notebooks individually or constructing partial-success results. Retrieval results no longer contain a `cards` field.
|
|
91
91
|
|
|
92
92
|
## Directory synchronization
|
|
93
93
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Z as timestampSchema, a as invalidArgument, c as optionalRecord, d as pagination, h as requiredText, l as optionalString, m as requiredString, n as call, p as queryPath, r as compactUndefined, s as optionalBoolean, t as assertNonEmptyPatch, u as optionalTrimmedString } from "./shared-DsqZroGJ.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region ../sdk/src/operations/bot-gateway-codecs.ts
|
|
4
4
|
const botTimestamp = z.preprocess((value) => typeof value === "object" && value !== null && !Array.isArray(value) && !("seconds" in value) ? {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { O as importProvidersSchema, T as fullSiteURLImportDiscoverySchema, _ as aliDingImportRunItemListSchema, a as invalidArgument, d as pagination, m as requiredString, n as call, nt as assertCapability, p as queryPath, tt as qmindFullSiteURLImportPageLimit, v as aliDingImportRunSchema, w as fullSiteURLImportConfirmationSchema } from "./shared-DsqZroGJ.js";
|
|
2
2
|
//#region ../sdk/src/operations/imports.ts
|
|
3
3
|
const aliDingHost = "alidocs.dingtalk.com";
|
|
4
4
|
const requestIdPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Q as voidResponseSchema, a as invalidArgument, c as optionalRecord, f as positiveInteger, l as optionalString, m as requiredString, n as call, p as queryPath, r as compactUndefined, s as optionalBoolean, t as assertNonEmptyPatch } from "./shared-DsqZroGJ.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region ../sdk/src/operations/management-schemas.ts
|
|
4
4
|
const memberPermissionSchema = z.enum([
|
|
@@ -70,7 +70,6 @@ const compilationRunSchema = z.object({
|
|
|
70
70
|
"REBUILD"
|
|
71
71
|
]),
|
|
72
72
|
percent: z.number().min(0).max(100).default(0),
|
|
73
|
-
publishedCardCount: z.number().int().nonnegative().default(0),
|
|
74
73
|
runId: z.string().min(1),
|
|
75
74
|
stage: z.string().optional(),
|
|
76
75
|
startedAt: z.string().default(""),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Q as voidResponseSchema, Z as timestampSchema, c as optionalRecord, d as pagination, h as requiredText, l as optionalString, m as requiredString, n as call, p as queryPath, r as compactUndefined, t as assertNonEmptyPatch } from "./shared-DsqZroGJ.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region ../sdk/src/operations/note-schemas.ts
|
|
4
4
|
const noteSchema = z.object({
|
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 notebookSchema, B as sourceQuotaSchema, C as chatSessionSchema, D as imageUrlsSchema, E as imageUploadTicketSchema, F as sourceChildrenCountsSchema, H as sourceSchema, I as sourceContentSchema, J as streamWireEventSchema, K as sourceWebOfficeSessionSchema, L as sourceImportResultsSchema, M as retrieveResultSchema, N as sharedNotebookListSchema, P as sourceActionAccessSchema, Q as voidResponseSchema, R as sourceListSchema, S as chatSessionListSchema, U as sourceTreeSchema, V as sourceRawContentSchema, W as sourceUploadCapabilitiesSchema, X as taskRunSchema, Y as taskRunListSchema, a as invalidArgument$1, at as QMindError, b as cancelQuestionResultSchema, c as optionalRecord, d as pagination$1, f as positiveInteger$1, g as stringList, i as httpUrl, j as retrieveNotebooksResultSchema, k as notebookListSchema, l as optionalString$1, m as requiredString$2, n as call, nt as assertCapability, o as nonNegativeInteger$1, p as queryPath, q as sourceWebOfficeTokenSchema, r as compactUndefined, rt as executeStream, s as optionalBoolean, t as assertNonEmptyPatch, u as optionalTrimmedString, x as chatMessageListSchema, y as batchDeleteResultSchema, z as sourcePreviewSchema } from "./shared-DsqZroGJ.js";
|
|
2
|
+
import { t as preflightSourceUpload } from "./source-upload-DdZ0J4gC.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";
|
|
@@ -12,7 +12,7 @@ import { createReadStream, createWriteStream } from "node:fs";
|
|
|
12
12
|
import { Readable } from "node:stream";
|
|
13
13
|
import { pipeline } from "node:stream/promises";
|
|
14
14
|
import { createParser } from "eventsource-parser";
|
|
15
|
-
import { Agent, EnvHttpProxyAgent, request } from "undici";
|
|
15
|
+
import { Agent, EnvHttpProxyAgent, Pool, ProxyAgent, fetch as fetch$1, request } from "undici";
|
|
16
16
|
import { Command, CommanderError, Option } from "commander";
|
|
17
17
|
import pLimit from "p-limit";
|
|
18
18
|
import picomatch from "picomatch";
|
|
@@ -399,7 +399,7 @@ function createAgentOperations(context) {
|
|
|
399
399
|
//#region ../sdk/src/operations/notebooks.ts
|
|
400
400
|
function createNotebookOperations(context) {
|
|
401
401
|
let wikiOperations;
|
|
402
|
-
const loadWiki = () => wikiOperations ??= import("./wiki-branches-
|
|
402
|
+
const loadWiki = () => wikiOperations ??= import("./wiki-branches-CNLpYYCl.js").then(({ createWikiBranchOperations }) => createWikiBranchOperations(context));
|
|
403
403
|
return {
|
|
404
404
|
async copyFeaturedNotebook(notebookId, options) {
|
|
405
405
|
const notebook = requiredString$2(notebookId, "notebookId");
|
|
@@ -669,8 +669,7 @@ function isQMindExternalSource(source) {
|
|
|
669
669
|
}
|
|
670
670
|
[.../* @__PURE__ */ new Set(["axls", "alxs"])];
|
|
671
671
|
//#endregion
|
|
672
|
-
//#region ../sdk/src/
|
|
673
|
-
const maxImageBytes = 52428800;
|
|
672
|
+
//#region ../sdk/src/source-tree.ts
|
|
674
673
|
function sourceTreeNodeOrder(left, right) {
|
|
675
674
|
if (left.type !== right.type) return left.type === "directory" ? -1 : 1;
|
|
676
675
|
if (left.name !== right.name) return left.name < right.name ? -1 : 1;
|
|
@@ -692,41 +691,53 @@ function createsSourceCycle(source, sourcesById) {
|
|
|
692
691
|
}
|
|
693
692
|
return false;
|
|
694
693
|
}
|
|
695
|
-
function
|
|
694
|
+
function buildQMindSourceTree(sources) {
|
|
696
695
|
const sourcesById = new Map(sources.map((source) => [source.id, source]));
|
|
697
|
-
const parentIds = new Set(sources.filter((source) => sourcesById.has(source.parentSourceId) && !createsSourceCycle(source, sourcesById)).map((source) => source.parentSourceId));
|
|
698
696
|
const nodesById = /* @__PURE__ */ new Map();
|
|
699
697
|
for (const source of sources) nodesById.set(source.id, {
|
|
698
|
+
...projectQMindSourceTreeNode(source, sources),
|
|
699
|
+
files: []
|
|
700
|
+
});
|
|
701
|
+
const tree = [];
|
|
702
|
+
for (const source of sources) {
|
|
703
|
+
const node = nodesById.get(source.id);
|
|
704
|
+
if (node === void 0) continue;
|
|
705
|
+
const parent = nodesById.get(source.parentSourceId);
|
|
706
|
+
if (parent === void 0 || createsSourceCycle(source, sourcesById)) tree.push(node);
|
|
707
|
+
else parent.files.push(node);
|
|
708
|
+
}
|
|
709
|
+
sortSourceTree(tree);
|
|
710
|
+
return {
|
|
711
|
+
totalSize: sources.length,
|
|
712
|
+
tree,
|
|
713
|
+
sources
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
/** A document can have children without losing its file identity or preview capability. */
|
|
717
|
+
function projectQMindSourceTreeNode(source, sources, files = []) {
|
|
718
|
+
return {
|
|
719
|
+
...source.learningStatus === void 0 ? {} : { learningStatus: source.learningStatus },
|
|
720
|
+
...source.learningErrorCode === void 0 ? {} : { learningErrorCode: source.learningErrorCode },
|
|
700
721
|
...source.externalBinding === void 0 ? {} : { externalBinding: source.externalBinding },
|
|
701
722
|
...source.originUrl === void 0 ? {} : { originUrl: source.originUrl },
|
|
702
723
|
...source.metadata === void 0 ? {} : { metadata: source.metadata },
|
|
703
724
|
isEmailFolder: isQMindEmailFolder(source),
|
|
704
725
|
isEmailAggregateMember: isQMindEmailAggregateMember(source, sources),
|
|
705
726
|
isExternalSource: isQMindExternalSource(source),
|
|
706
|
-
files
|
|
727
|
+
files,
|
|
707
728
|
hasChildren: source.hasChildren ?? (source.childrenCount === void 0 ? source.isDir : source.childrenCount > 0),
|
|
708
729
|
id: source.id,
|
|
709
730
|
name: source.title,
|
|
710
731
|
path: source.path,
|
|
711
732
|
sourceType: source.sourceType,
|
|
712
733
|
status: source.status,
|
|
713
|
-
type: source.isDir
|
|
734
|
+
type: source.isDir ? "directory" : "file",
|
|
714
735
|
...source.updatedAt === void 0 ? {} : { updatedAt: source.updatedAt }
|
|
715
|
-
});
|
|
716
|
-
const tree = [];
|
|
717
|
-
for (const source of sources) {
|
|
718
|
-
const node = nodesById.get(source.id);
|
|
719
|
-
if (node === void 0) continue;
|
|
720
|
-
const parent = nodesById.get(source.parentSourceId);
|
|
721
|
-
if (parent === void 0 || createsSourceCycle(source, sourcesById)) tree.push(node);
|
|
722
|
-
else parent.files.push(node);
|
|
723
|
-
}
|
|
724
|
-
sortSourceTree(tree);
|
|
725
|
-
return {
|
|
726
|
-
totalSize: sources.length,
|
|
727
|
-
tree
|
|
728
736
|
};
|
|
729
737
|
}
|
|
738
|
+
//#endregion
|
|
739
|
+
//#region ../sdk/src/operations/sources.ts
|
|
740
|
+
const maxImageBytes = 52428800;
|
|
730
741
|
function sourceBody(input) {
|
|
731
742
|
return compactUndefined({
|
|
732
743
|
isDir: optionalBoolean(input?.isDir, "isDir"),
|
|
@@ -932,7 +943,7 @@ function createSourceOperations(context) {
|
|
|
932
943
|
const getSourceTree = async (notebookId, options) => {
|
|
933
944
|
const notebook = requiredString$2(notebookId, "notebookId");
|
|
934
945
|
assertCapability(context.profile, "sources.tree", "sources.tree");
|
|
935
|
-
if (context.profile.access === "sash") return
|
|
946
|
+
if (context.profile.access === "sash") return buildQMindSourceTree(await collectAllSources(notebook, {}, options, "sources.tree"));
|
|
936
947
|
return call(context, {
|
|
937
948
|
callOptions: options,
|
|
938
949
|
capability: "sources.tree",
|
|
@@ -1091,7 +1102,8 @@ function createSourceOperations(context) {
|
|
|
1091
1102
|
path: context.profile.apiPath("notebooks", requiredString$2(notebookId, "notebookId"), "sources", requiredString$2(sourceId, "sourceId"), "retry"),
|
|
1092
1103
|
body: {
|
|
1093
1104
|
retryKey: requiredString$2(input.retryKey, "retryKey"),
|
|
1094
|
-
expectedUpdatedAt: requiredString$2(input.expectedUpdatedAt, "expectedUpdatedAt")
|
|
1105
|
+
expectedUpdatedAt: requiredString$2(input.expectedUpdatedAt, "expectedUpdatedAt"),
|
|
1106
|
+
...input.expectedVectorRetryAt !== void 0 ? { expectedVectorRetryAt: input.expectedVectorRetryAt } : {}
|
|
1095
1107
|
},
|
|
1096
1108
|
schema: sourceSchema
|
|
1097
1109
|
});
|
|
@@ -1146,6 +1158,17 @@ function createSourceOperations(context) {
|
|
|
1146
1158
|
schema: sourceRawContentSchema
|
|
1147
1159
|
});
|
|
1148
1160
|
},
|
|
1161
|
+
async getSourceQuota(options) {
|
|
1162
|
+
return call(context, {
|
|
1163
|
+
callOptions: options,
|
|
1164
|
+
capability: "sources.quota",
|
|
1165
|
+
idempotent: true,
|
|
1166
|
+
method: "GET",
|
|
1167
|
+
operation: "sources.quota",
|
|
1168
|
+
path: context.profile.mindPath("source-quota"),
|
|
1169
|
+
schema: sourceQuotaSchema
|
|
1170
|
+
});
|
|
1171
|
+
},
|
|
1149
1172
|
async getSourceUploadCapabilities(options) {
|
|
1150
1173
|
return call(context, {
|
|
1151
1174
|
callOptions: options,
|
|
@@ -1161,7 +1184,7 @@ function createSourceOperations(context) {
|
|
|
1161
1184
|
return preflightSourceUpload(context, notebookId, options);
|
|
1162
1185
|
},
|
|
1163
1186
|
async getFeaturedSourceTree(notebookId, options) {
|
|
1164
|
-
return
|
|
1187
|
+
return buildQMindSourceTree((await listFeaturedSources(notebookId, {
|
|
1165
1188
|
page: 1,
|
|
1166
1189
|
pageSize: 200
|
|
1167
1190
|
}, options)).sources);
|
|
@@ -1307,9 +1330,6 @@ function createSourceOperations(context) {
|
|
|
1307
1330
|
//#region ../sdk/src/capabilities.ts
|
|
1308
1331
|
const dashboardCapabilities = Object.freeze({
|
|
1309
1332
|
botGateway: true,
|
|
1310
|
-
"cards.read": true,
|
|
1311
|
-
"cards.write": true,
|
|
1312
|
-
"cards.saveResults": true,
|
|
1313
1333
|
chat: true,
|
|
1314
1334
|
"featuredChat.delete": false,
|
|
1315
1335
|
compilation: true,
|
|
@@ -1339,6 +1359,7 @@ const dashboardCapabilities = Object.freeze({
|
|
|
1339
1359
|
"sources.preview": true,
|
|
1340
1360
|
"sources.rawContent": true,
|
|
1341
1361
|
"sources.read": true,
|
|
1362
|
+
"sources.quota": true,
|
|
1342
1363
|
"sources.search": true,
|
|
1343
1364
|
"sources.tree": true,
|
|
1344
1365
|
"sources.webOffice": true,
|
|
@@ -1351,9 +1372,6 @@ const dashboardCapabilities = Object.freeze({
|
|
|
1351
1372
|
});
|
|
1352
1373
|
const sashCapabilities = Object.freeze({
|
|
1353
1374
|
botGateway: false,
|
|
1354
|
-
"cards.read": true,
|
|
1355
|
-
"cards.write": true,
|
|
1356
|
-
"cards.saveResults": false,
|
|
1357
1375
|
chat: true,
|
|
1358
1376
|
"featuredChat.delete": false,
|
|
1359
1377
|
compilation: false,
|
|
@@ -1383,6 +1401,7 @@ const sashCapabilities = Object.freeze({
|
|
|
1383
1401
|
"sources.preview": true,
|
|
1384
1402
|
"sources.rawContent": true,
|
|
1385
1403
|
"sources.read": true,
|
|
1404
|
+
"sources.quota": false,
|
|
1386
1405
|
"sources.search": false,
|
|
1387
1406
|
"sources.tree": true,
|
|
1388
1407
|
"sources.webOffice": true,
|
|
@@ -1426,22 +1445,9 @@ function firstResultSource(access, operation, body) {
|
|
|
1426
1445
|
status: 200
|
|
1427
1446
|
});
|
|
1428
1447
|
}
|
|
1429
|
-
function dashboardBatchMutation(body) {
|
|
1430
|
-
if (!isRecord$1(body)) return body;
|
|
1431
|
-
const successCount = typeof body.successCount === "number" ? body.successCount : body.success_count;
|
|
1432
|
-
const failureCount = typeof body.failureCount === "number" ? body.failureCount : body.failure_count;
|
|
1433
|
-
if (typeof successCount !== "number" && typeof failureCount !== "number") return body;
|
|
1434
|
-
return {
|
|
1435
|
-
...body,
|
|
1436
|
-
failureCount: typeof failureCount === "number" ? failureCount : 0,
|
|
1437
|
-
successCount: typeof successCount === "number" ? successCount : 0
|
|
1438
|
-
};
|
|
1439
|
-
}
|
|
1440
1448
|
function normalizeSuccess(access, operation, body) {
|
|
1441
1449
|
const unwrapped = access === "dashboard" ? dashboardEnvelope(body) : body;
|
|
1442
1450
|
if (access !== "dashboard") return unwrapped;
|
|
1443
|
-
if (operation === "cards.get" && isRecord$1(unwrapped) && "card" in unwrapped) return unwrapped.card;
|
|
1444
|
-
if (operation === "cards.delete" || operation === "cards.batchDelete") return dashboardBatchMutation(unwrapped);
|
|
1445
1451
|
if (operation === "sources.create" || operation === "sources.importSite") return firstResultSource(access, operation, unwrapped);
|
|
1446
1452
|
if (operation === "transfers.source.multipart" || operation === "transfers.source.register") return firstResultSource(access, operation, unwrapped);
|
|
1447
1453
|
return unwrapped;
|
|
@@ -1615,14 +1621,6 @@ const managementOperationNames = [
|
|
|
1615
1621
|
"updateMemberPermission",
|
|
1616
1622
|
"updateScheduledTask"
|
|
1617
1623
|
];
|
|
1618
|
-
const cardOperationNames = [
|
|
1619
|
-
"batchDeleteCards",
|
|
1620
|
-
"deleteCard",
|
|
1621
|
-
"getCard",
|
|
1622
|
-
"listCards",
|
|
1623
|
-
"listFeaturedCards",
|
|
1624
|
-
"saveCompilationResult"
|
|
1625
|
-
];
|
|
1626
1624
|
const importOperationNames = [
|
|
1627
1625
|
"confirmFullSiteURLImport",
|
|
1628
1626
|
"discoverFullSiteURLImport",
|
|
@@ -1658,7 +1656,7 @@ const botGatewayOperationNames = [
|
|
|
1658
1656
|
function createLazyTransferOperations(context) {
|
|
1659
1657
|
let operations;
|
|
1660
1658
|
const load = () => {
|
|
1661
|
-
operations ??= import("./transfers-
|
|
1659
|
+
operations ??= import("./transfers-SJE97RLg.js").then(({ createTransferOperations }) => createTransferOperations(context));
|
|
1662
1660
|
return operations;
|
|
1663
1661
|
};
|
|
1664
1662
|
return {
|
|
@@ -1669,7 +1667,7 @@ function createLazyTransferOperations(context) {
|
|
|
1669
1667
|
function createLazyBotGatewayOperations(context) {
|
|
1670
1668
|
let operations;
|
|
1671
1669
|
const load = () => {
|
|
1672
|
-
operations ??= import("./bot-gateway-
|
|
1670
|
+
operations ??= import("./bot-gateway-eajGWyYA.js").then(({ createBotGatewayOperations }) => createBotGatewayOperations(context));
|
|
1673
1671
|
return operations;
|
|
1674
1672
|
};
|
|
1675
1673
|
return Object.fromEntries(botGatewayOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
|
|
@@ -1677,23 +1675,15 @@ function createLazyBotGatewayOperations(context) {
|
|
|
1677
1675
|
function createLazyNoteOperations(context) {
|
|
1678
1676
|
let operations;
|
|
1679
1677
|
const load = () => {
|
|
1680
|
-
operations ??= import("./notes-
|
|
1678
|
+
operations ??= import("./notes-PwqGFJvk.js").then(({ createNoteOperations }) => createNoteOperations(context));
|
|
1681
1679
|
return operations;
|
|
1682
1680
|
};
|
|
1683
1681
|
return Object.fromEntries(noteOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
|
|
1684
1682
|
}
|
|
1685
|
-
function createLazyCardOperations(context) {
|
|
1686
|
-
let operations;
|
|
1687
|
-
const load = () => {
|
|
1688
|
-
operations ??= import("./cards-CfhvlNeF.js").then(({ createCardOperations }) => createCardOperations(context));
|
|
1689
|
-
return operations;
|
|
1690
|
-
};
|
|
1691
|
-
return Object.fromEntries(cardOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
|
|
1692
|
-
}
|
|
1693
1683
|
function createLazyImportOperations(context) {
|
|
1694
1684
|
let operations;
|
|
1695
1685
|
const load = () => {
|
|
1696
|
-
operations ??= import("./imports-
|
|
1686
|
+
operations ??= import("./imports-CebWSRju.js").then(({ createImportOperations }) => createImportOperations(context));
|
|
1697
1687
|
return operations;
|
|
1698
1688
|
};
|
|
1699
1689
|
return Object.fromEntries(importOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
|
|
@@ -1701,7 +1691,7 @@ function createLazyImportOperations(context) {
|
|
|
1701
1691
|
function createLazyManagementOperations(context) {
|
|
1702
1692
|
let operations;
|
|
1703
1693
|
const load = () => {
|
|
1704
|
-
operations ??= import("./management-
|
|
1694
|
+
operations ??= import("./management-Avpo7nTn.js").then(({ createManagementOperations }) => createManagementOperations(context));
|
|
1705
1695
|
return operations;
|
|
1706
1696
|
};
|
|
1707
1697
|
return Object.fromEntries(managementOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
|
|
@@ -1720,7 +1710,6 @@ function createQMindClient(options) {
|
|
|
1720
1710
|
access: profile.access,
|
|
1721
1711
|
capabilities: profile.capabilities,
|
|
1722
1712
|
...createNotebookOperations(context),
|
|
1723
|
-
...createLazyCardOperations(context),
|
|
1724
1713
|
...createSourceOperations(context),
|
|
1725
1714
|
...createLazyImportOperations(context),
|
|
1726
1715
|
...createLazyManagementOperations(context),
|
|
@@ -2038,18 +2027,7 @@ function createAuthenticatedQMindTransport(transport, auth, requestCredential) {
|
|
|
2038
2027
|
});
|
|
2039
2028
|
}
|
|
2040
2029
|
//#endregion
|
|
2041
|
-
//#region ../node-host/src/
|
|
2042
|
-
const fileConfigSchema = z.object({
|
|
2043
|
-
client: z.string().optional(),
|
|
2044
|
-
dashboard_url: z.string().optional(),
|
|
2045
|
-
proxy_from_env: z.boolean().optional(),
|
|
2046
|
-
request_timeout_ms: z.number().int().positive().optional(),
|
|
2047
|
-
sash_url: z.string().optional(),
|
|
2048
|
-
stream_idle_timeout_ms: z.number().int().positive().optional(),
|
|
2049
|
-
tls_ca_file: z.string().optional(),
|
|
2050
|
-
tls_reject_unauthorized: z.boolean().optional(),
|
|
2051
|
-
update_public_key: z.string().optional()
|
|
2052
|
-
}).passthrough();
|
|
2030
|
+
//#region ../node-host/src/endpoints.ts
|
|
2053
2031
|
const PRESETS = Object.freeze({
|
|
2054
2032
|
daily: {
|
|
2055
2033
|
dashboardOrigin: "https://daily.qoder.ai",
|
|
@@ -2109,6 +2087,19 @@ function resolveQMindProductEndpoints(productId, presetName, field = "env") {
|
|
|
2109
2087
|
if (preset === void 0) throw invalidConfig(`product ${JSON.stringify(productId)} has no ${JSON.stringify(presetName)} endpoints; set ${field} explicitly`, field);
|
|
2110
2088
|
return { ...preset };
|
|
2111
2089
|
}
|
|
2090
|
+
//#endregion
|
|
2091
|
+
//#region ../node-host/src/config.ts
|
|
2092
|
+
const fileConfigSchema = z.object({
|
|
2093
|
+
client: z.string().optional(),
|
|
2094
|
+
dashboard_url: z.string().optional(),
|
|
2095
|
+
proxy_from_env: z.boolean().optional(),
|
|
2096
|
+
request_timeout_ms: z.number().int().positive().optional(),
|
|
2097
|
+
sash_url: z.string().optional(),
|
|
2098
|
+
stream_idle_timeout_ms: z.number().int().positive().optional(),
|
|
2099
|
+
tls_ca_file: z.string().optional(),
|
|
2100
|
+
tls_reject_unauthorized: z.boolean().optional(),
|
|
2101
|
+
update_public_key: z.string().optional()
|
|
2102
|
+
}).passthrough();
|
|
2112
2103
|
function optionalTrimmed(value) {
|
|
2113
2104
|
const trimmed = value?.trim();
|
|
2114
2105
|
return trimmed === void 0 || trimmed.length === 0 ? void 0 : trimmed;
|
|
@@ -2519,6 +2510,29 @@ function createRequestBudgetTransport(transport, budget) {
|
|
|
2519
2510
|
};
|
|
2520
2511
|
}
|
|
2521
2512
|
//#endregion
|
|
2513
|
+
//#region ../node-host/src/networkProxy.ts
|
|
2514
|
+
/** 跨进程配置只保留受支持字段,错误中不包含可能带凭据的代理地址。 */
|
|
2515
|
+
function parseQMindNodeNetworkProxy(value) {
|
|
2516
|
+
const invalid = () => {
|
|
2517
|
+
throw new QMindError("HOST_POLICY_ERROR", "Invalid host network proxy configuration");
|
|
2518
|
+
};
|
|
2519
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return invalid();
|
|
2520
|
+
const input = value;
|
|
2521
|
+
if (input.mode === "direct" && Object.keys(input).length === 1) return { mode: "direct" };
|
|
2522
|
+
if (input.mode !== "manual" || Object.keys(input).length !== 2 || typeof input.url !== "string") return invalid();
|
|
2523
|
+
if (input.url.length > 2048 || /[\\\s?#\x00-\x1f\x7f]/.test(input.url)) return invalid();
|
|
2524
|
+
try {
|
|
2525
|
+
const url = new URL(input.url);
|
|
2526
|
+
if (!["http:", "https:"].includes(url.protocol) || !url.hostname || url.pathname !== "/" || url.search || url.hash) return invalid();
|
|
2527
|
+
return {
|
|
2528
|
+
mode: "manual",
|
|
2529
|
+
url: input.url
|
|
2530
|
+
};
|
|
2531
|
+
} catch {
|
|
2532
|
+
return invalid();
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
//#endregion
|
|
2522
2536
|
//#region ../node-host/src/networkFailureCause.ts
|
|
2523
2537
|
const NETWORK_CODES = /* @__PURE__ */ new Set([
|
|
2524
2538
|
"ECONNREFUSED",
|
|
@@ -2599,9 +2613,8 @@ function environmentValue(environment, ...keys) {
|
|
|
2599
2613
|
if (value !== void 0 && value.length > 0) return value;
|
|
2600
2614
|
}
|
|
2601
2615
|
}
|
|
2602
|
-
function tlsConnectOptions(options
|
|
2616
|
+
function tlsConnectOptions(options) {
|
|
2603
2617
|
const timeout = positiveInteger(options.connectTimeoutMs, 1e4, "connectTimeoutMs");
|
|
2604
|
-
if (!withTls) return { timeout };
|
|
2605
2618
|
const ca = options.tls?.ca;
|
|
2606
2619
|
return {
|
|
2607
2620
|
...ca === void 0 ? {} : { ca: typeof ca === "string" ? ca : [...ca] },
|
|
@@ -2610,17 +2623,34 @@ function tlsConnectOptions(options, withTls) {
|
|
|
2610
2623
|
};
|
|
2611
2624
|
}
|
|
2612
2625
|
function createDispatchers(options) {
|
|
2626
|
+
const connect = tlsConnectOptions(options);
|
|
2627
|
+
const networkProxy = options.networkProxy === void 0 ? void 0 : parseQMindNodeNetworkProxy(options.networkProxy);
|
|
2628
|
+
if (networkProxy?.mode === "manual") {
|
|
2629
|
+
const createAgent = () => new Agent({ factory(origin) {
|
|
2630
|
+
const hostname = new URL(origin).hostname.replace(/\.$/, "");
|
|
2631
|
+
return hostname === "localhost" || hostname.endsWith(".localhost") || hostname === "[::1]" || /^127\.\d+\.\d+\.\d+$/.test(hostname) ? new Pool(origin, { connect }) : new ProxyAgent({
|
|
2632
|
+
uri: networkProxy.url,
|
|
2633
|
+
requestTls: connect,
|
|
2634
|
+
proxyTls: connect,
|
|
2635
|
+
proxyTunnel: true
|
|
2636
|
+
});
|
|
2637
|
+
} });
|
|
2638
|
+
return {
|
|
2639
|
+
host: createAgent(),
|
|
2640
|
+
signed: createAgent()
|
|
2641
|
+
};
|
|
2642
|
+
}
|
|
2613
2643
|
const environment = options.environment ?? process.env;
|
|
2614
|
-
if (options.proxyFromEnvironment === false) return {
|
|
2615
|
-
host: new Agent({ connect
|
|
2616
|
-
signed: new Agent({ connect
|
|
2644
|
+
if (networkProxy?.mode === "direct" || options.proxyFromEnvironment === false) return {
|
|
2645
|
+
host: new Agent({ connect }),
|
|
2646
|
+
signed: new Agent({ connect })
|
|
2617
2647
|
};
|
|
2618
2648
|
const httpProxy = environmentValue(environment, "HTTP_PROXY", "http_proxy");
|
|
2619
2649
|
const httpsProxy = environmentValue(environment, "HTTPS_PROXY", "https_proxy");
|
|
2620
2650
|
const noProxy = environmentValue(environment, "NO_PROXY", "no_proxy");
|
|
2621
2651
|
if (httpProxy === void 0 && httpsProxy === void 0) return {
|
|
2622
|
-
host: new Agent({ connect
|
|
2623
|
-
signed: new Agent({ connect
|
|
2652
|
+
host: new Agent({ connect }),
|
|
2653
|
+
signed: new Agent({ connect })
|
|
2624
2654
|
};
|
|
2625
2655
|
const proxy = {
|
|
2626
2656
|
httpProxy: httpProxy ?? "",
|
|
@@ -2630,11 +2660,11 @@ function createDispatchers(options) {
|
|
|
2630
2660
|
return {
|
|
2631
2661
|
host: new EnvHttpProxyAgent({
|
|
2632
2662
|
...proxy,
|
|
2633
|
-
requestTls:
|
|
2663
|
+
requestTls: connect
|
|
2634
2664
|
}),
|
|
2635
2665
|
signed: new EnvHttpProxyAgent({
|
|
2636
2666
|
...proxy,
|
|
2637
|
-
requestTls:
|
|
2667
|
+
requestTls: connect
|
|
2638
2668
|
})
|
|
2639
2669
|
};
|
|
2640
2670
|
}
|
|
@@ -2888,6 +2918,35 @@ function createQMindNodeTransport(options) {
|
|
|
2888
2918
|
const dispatchers = createDispatchers(options);
|
|
2889
2919
|
const dispatcherFor = (request) => request.destination.kind === "host" ? dispatchers.host : dispatchers.signed;
|
|
2890
2920
|
return Object.freeze({
|
|
2921
|
+
async fetchSigned(url, signal) {
|
|
2922
|
+
let destination = url;
|
|
2923
|
+
for (let redirects = 0;; redirects++) {
|
|
2924
|
+
assertWireRequest({
|
|
2925
|
+
destination: {
|
|
2926
|
+
kind: "signed",
|
|
2927
|
+
url: destination
|
|
2928
|
+
},
|
|
2929
|
+
method: "GET",
|
|
2930
|
+
idempotent: true
|
|
2931
|
+
});
|
|
2932
|
+
const response = await fetch$1(destination, {
|
|
2933
|
+
dispatcher: dispatchers.signed,
|
|
2934
|
+
signal,
|
|
2935
|
+
redirect: "manual"
|
|
2936
|
+
});
|
|
2937
|
+
if (![
|
|
2938
|
+
301,
|
|
2939
|
+
302,
|
|
2940
|
+
303,
|
|
2941
|
+
307,
|
|
2942
|
+
308
|
|
2943
|
+
].includes(response.status)) return response;
|
|
2944
|
+
const location = response.headers.get("location");
|
|
2945
|
+
await response.body?.cancel();
|
|
2946
|
+
if (!location || redirects >= 3) throw invalidArgument("Invalid signed response redirect", "url");
|
|
2947
|
+
destination = new URL(location, destination).href;
|
|
2948
|
+
}
|
|
2949
|
+
},
|
|
2891
2950
|
async close() {
|
|
2892
2951
|
const unique = /* @__PURE__ */ new Set([dispatchers.host, dispatchers.signed]);
|
|
2893
2952
|
await Promise.all([...unique].map(async (dispatcher) => dispatcher.close()));
|
|
@@ -3141,6 +3200,7 @@ async function createQMindCliHost(options = {}) {
|
|
|
3141
3200
|
...options.maxRetries === void 0 ? {} : { maxRetries: options.maxRetries },
|
|
3142
3201
|
origin: resolved.runtime.sashOrigin,
|
|
3143
3202
|
proxyFromEnvironment: resolved.proxyFromEnvironment,
|
|
3203
|
+
...options.networkProxy === void 0 ? {} : { networkProxy: options.networkProxy },
|
|
3144
3204
|
requestTimeoutMs: resolved.requestTimeoutMs,
|
|
3145
3205
|
streamIdleTimeoutMs: resolved.streamIdleTimeoutMs,
|
|
3146
3206
|
tls: {
|
|
@@ -3236,8 +3296,8 @@ function requestsJsonOutput(argv) {
|
|
|
3236
3296
|
//#region src/build-info.ts
|
|
3237
3297
|
/** Bundled identity, never inferred from argv, environment, or an endpoint. */
|
|
3238
3298
|
const QMIND_CLI_DISTRIBUTION = "global";
|
|
3239
|
-
const QMIND_CLI_VERSION = "3.
|
|
3240
|
-
const QMIND_CLI_BUILD_TIME = "2026-09-
|
|
3299
|
+
const QMIND_CLI_VERSION = "3.5.0";
|
|
3300
|
+
const QMIND_CLI_BUILD_TIME = "2026-09-28T09:35:44.000Z";
|
|
3241
3301
|
function qmindCliPlatform() {
|
|
3242
3302
|
return process.platform === "win32" ? "windows" : process.platform;
|
|
3243
3303
|
}
|
|
@@ -3788,18 +3848,7 @@ function goRetrieve(value) {
|
|
|
3788
3848
|
})),
|
|
3789
3849
|
promptContext: value.promptContext,
|
|
3790
3850
|
total: value.total,
|
|
3791
|
-
reranked: value.reranked
|
|
3792
|
-
cards: value.cards.map((card) => ({
|
|
3793
|
-
id: card.id,
|
|
3794
|
-
title: card.title,
|
|
3795
|
-
content: card.content,
|
|
3796
|
-
...card.category === void 0 ? {} : { category: card.category },
|
|
3797
|
-
...card.cardType === void 0 ? {} : { cardType: card.cardType },
|
|
3798
|
-
keywords: card.keywords,
|
|
3799
|
-
...card.links.length === 0 ? {} : { links: card.links },
|
|
3800
|
-
score: card.score,
|
|
3801
|
-
depth: card.depth
|
|
3802
|
-
}))
|
|
3851
|
+
reranked: value.reranked
|
|
3803
3852
|
};
|
|
3804
3853
|
}
|
|
3805
3854
|
function agentField(writer, name, value) {
|
|
@@ -3964,16 +4013,12 @@ function renderSourceList(value, format) {
|
|
|
3964
4013
|
}
|
|
3965
4014
|
return writer.toString();
|
|
3966
4015
|
}
|
|
3967
|
-
function renderRetrieve(value, format) {
|
|
3968
|
-
|
|
3969
|
-
if (format === "
|
|
3970
|
-
if (format === "ndjson") return [...value.chunks.map((item) => ({
|
|
4016
|
+
function renderRetrieve(value, format, multiNotebook = false) {
|
|
4017
|
+
if (format === "json") return json(multiNotebook ? value : goRetrieve(value), true);
|
|
4018
|
+
if (format === "ndjson") return value.chunks.map((item) => json({
|
|
3971
4019
|
kind: "chunk",
|
|
3972
4020
|
...item
|
|
3973
|
-
}))
|
|
3974
|
-
kind: "card",
|
|
3975
|
-
...item
|
|
3976
|
-
}))].map((item) => json(item, false)).join("");
|
|
4021
|
+
}, false)).join("");
|
|
3977
4022
|
const writer = new TextWriter();
|
|
3978
4023
|
if (format === "agent") {
|
|
3979
4024
|
agentHeader(writer, "notebookContext", value.total);
|
|
@@ -3995,19 +4040,6 @@ function renderRetrieve(value, format) {
|
|
|
3995
4040
|
agentField(writer, "tokenCount", chunk.tokenCount);
|
|
3996
4041
|
agentText(writer, "content", unescapeText(chunk.content));
|
|
3997
4042
|
});
|
|
3998
|
-
cards.forEach((card, index) => {
|
|
3999
|
-
writer.line("---");
|
|
4000
|
-
agentField(writer, "type", "retrievedCard");
|
|
4001
|
-
agentField(writer, "index", index + 1);
|
|
4002
|
-
agentField(writer, "id", card.id);
|
|
4003
|
-
agentField(writer, "title", card.title);
|
|
4004
|
-
agentField(writer, "category", card.category);
|
|
4005
|
-
agentField(writer, "cardType", card.cardType);
|
|
4006
|
-
agentField(writer, "score", card.score.toFixed(4));
|
|
4007
|
-
agentField(writer, "depth", card.depth);
|
|
4008
|
-
if (card.keywords.length > 0) agentField(writer, "keywords", card.keywords.join(", "));
|
|
4009
|
-
agentText(writer, "content", unescapeText(card.content));
|
|
4010
|
-
});
|
|
4011
4043
|
value.citations.forEach((citation, index) => {
|
|
4012
4044
|
writer.line("---");
|
|
4013
4045
|
agentField(writer, "type", "citation");
|
|
@@ -4030,7 +4062,7 @@ function renderRetrieve(value, format) {
|
|
|
4030
4062
|
writer.line("== Chunks ==");
|
|
4031
4063
|
table(writer, [
|
|
4032
4064
|
"SCORE",
|
|
4033
|
-
...
|
|
4065
|
+
...multiNotebook ? ["NOTEBOOK"] : [],
|
|
4034
4066
|
"CHUNK_ID",
|
|
4035
4067
|
"IDX",
|
|
4036
4068
|
"SOURCE",
|
|
@@ -4044,7 +4076,7 @@ function renderRetrieve(value, format) {
|
|
|
4044
4076
|
truncate(unescapeText(chunk.content).replace(/\n/g, " "), 50)
|
|
4045
4077
|
]), [
|
|
4046
4078
|
6,
|
|
4047
|
-
...
|
|
4079
|
+
...multiNotebook ? [30] : [],
|
|
4048
4080
|
36,
|
|
4049
4081
|
6,
|
|
4050
4082
|
30,
|
|
@@ -4059,32 +4091,6 @@ function renderRetrieve(value, format) {
|
|
|
4059
4091
|
writer.line();
|
|
4060
4092
|
});
|
|
4061
4093
|
}
|
|
4062
|
-
if (cards.length > 0) {
|
|
4063
|
-
writer.line("== Cards ==");
|
|
4064
|
-
table(writer, [
|
|
4065
|
-
"SCORE",
|
|
4066
|
-
"DEPTH",
|
|
4067
|
-
"ID",
|
|
4068
|
-
"CATEGORY",
|
|
4069
|
-
"TITLE",
|
|
4070
|
-
"CONTENT"
|
|
4071
|
-
], cards.map((card) => [
|
|
4072
|
-
card.score.toFixed(2),
|
|
4073
|
-
card.depth,
|
|
4074
|
-
truncate(card.id, 36),
|
|
4075
|
-
truncate(card.category, 20),
|
|
4076
|
-
truncate(card.title, 30),
|
|
4077
|
-
truncate(unescapeText(card.content).replace(/\n/g, " "), 30)
|
|
4078
|
-
]), [
|
|
4079
|
-
6,
|
|
4080
|
-
5,
|
|
4081
|
-
36,
|
|
4082
|
-
20,
|
|
4083
|
-
30,
|
|
4084
|
-
30
|
|
4085
|
-
], 130);
|
|
4086
|
-
writer.line();
|
|
4087
|
-
}
|
|
4088
4094
|
if (value.citations.length > 0) {
|
|
4089
4095
|
writer.line("== Citations ==");
|
|
4090
4096
|
value.citations.forEach((citation, index) => {
|
|
@@ -4111,7 +4117,7 @@ function renderQMindCliPresentation(presentation, format) {
|
|
|
4111
4117
|
case "source": return renderSource(presentation.value, format);
|
|
4112
4118
|
case "sourceList": return renderSourceList(presentation.value, format);
|
|
4113
4119
|
case "retrieve": return renderRetrieve(presentation.value, format);
|
|
4114
|
-
case "multiRetrieve": return renderRetrieve(presentation.value, format);
|
|
4120
|
+
case "multiRetrieve": return renderRetrieve(presentation.value, format, true);
|
|
4115
4121
|
case "imageUpload": return json({
|
|
4116
4122
|
uploadUrl: presentation.value.uploadUrl,
|
|
4117
4123
|
method: presentation.value.method,
|
|
@@ -4241,10 +4247,10 @@ function batchProgress(metadata) {
|
|
|
4241
4247
|
};
|
|
4242
4248
|
switch (metadata.phase) {
|
|
4243
4249
|
case "plan": return `[compile] 📋 plan: ${value("totalBatches")} batches, ${value("totalSources")} sources, ${value("totalBytes")} bytes`;
|
|
4244
|
-
case "batch_start": return `[compile] ▶ batch ${index()}/${value("totalBatches")} start (sources=${value("batchSources")}, bytes=${value("batchBytes")}
|
|
4245
|
-
case "batch_done": return `[compile] ✔ batch ${index()}/${value("totalBatches")} done (
|
|
4250
|
+
case "batch_start": return `[compile] ▶ batch ${index()}/${value("totalBatches")} start (sources=${value("batchSources")}, bytes=${value("batchBytes")})`;
|
|
4251
|
+
case "batch_done": return `[compile] ✔ batch ${index()}/${value("totalBatches")} done (steps=${value("batchStepsUsed")}, ${value("elapsedMs")}ms)`;
|
|
4246
4252
|
case "persist_start": return `[compile] 💾 persist start (drafts=${value("draftsTotal")})`;
|
|
4247
|
-
case "persist_done": return metadata.saved === "true" ? `[compile] ✅ persisted
|
|
4253
|
+
case "persist_done": return metadata.saved === "true" ? `[compile] ✅ persisted results` : `[compile] ⚠️ persist failed: ${metadata.persistError || "not persisted"} (drafts retained for fallback save)`;
|
|
4248
4254
|
default: return;
|
|
4249
4255
|
}
|
|
4250
4256
|
}
|
|
@@ -4984,7 +4990,7 @@ async function runQMindCli(argv, options = {}) {
|
|
|
4984
4990
|
updater: options.updater ?? createQMindCliUpdater({ identity: {
|
|
4985
4991
|
artifactKind: "npm",
|
|
4986
4992
|
command: distribution.command,
|
|
4987
|
-
currentVersion: "3.
|
|
4993
|
+
currentVersion: "3.5.0",
|
|
4988
4994
|
distribution: distribution.id,
|
|
4989
4995
|
executablePath: process.execPath,
|
|
4990
4996
|
package: distribution.package,
|
|
@@ -397,12 +397,13 @@ const notebookMaintenanceSchema = z.object({
|
|
|
397
397
|
status: z.string().default("idle")
|
|
398
398
|
});
|
|
399
399
|
const notebookAccessInfoSchema = z.object({
|
|
400
|
+
canRenameNotebook: z.boolean().optional(),
|
|
400
401
|
canDeleteNotebook: z.boolean(),
|
|
401
402
|
canEdit: z.boolean(),
|
|
402
403
|
canManageMembers: z.boolean(),
|
|
403
404
|
canManageTasks: z.boolean(),
|
|
404
405
|
currentUserPermission: z.string(),
|
|
405
|
-
memberCount: z.number().int().nonnegative()
|
|
406
|
+
memberCount: z.number().int().nonnegative().optional()
|
|
406
407
|
});
|
|
407
408
|
const notebookSchema = z.object({
|
|
408
409
|
access: notebookAccessInfoSchema.nullable().optional(),
|
|
@@ -436,57 +437,6 @@ const sharedNotebookListSchema = z.object({
|
|
|
436
437
|
pageSize: wirePageNumberSchema,
|
|
437
438
|
totalSize: z.number().int().nonnegative().default(0)
|
|
438
439
|
});
|
|
439
|
-
const cardLinkSchema = z.object({
|
|
440
|
-
description: z.string().optional(),
|
|
441
|
-
linkType: z.string().default(""),
|
|
442
|
-
targetId: z.string().min(1),
|
|
443
|
-
targetTitle: z.string().optional()
|
|
444
|
-
});
|
|
445
|
-
const cardSchema = z.object({
|
|
446
|
-
branch: z.string().optional(),
|
|
447
|
-
cardType: z.string().optional(),
|
|
448
|
-
category: z.string().optional(),
|
|
449
|
-
content: z.string().default(""),
|
|
450
|
-
createdAt: timestampSchema.optional(),
|
|
451
|
-
extra: z.string().optional(),
|
|
452
|
-
id: z.string().min(1),
|
|
453
|
-
keywords: z.array(z.string()).default([]),
|
|
454
|
-
knowledgeId: z.string().optional(),
|
|
455
|
-
language: z.string().optional(),
|
|
456
|
-
links: z.array(cardLinkSchema).default([]),
|
|
457
|
-
notebookId: z.string().optional(),
|
|
458
|
-
orgId: z.string().optional(),
|
|
459
|
-
repo: z.string().optional(),
|
|
460
|
-
score: z.number().optional(),
|
|
461
|
-
source: z.string().optional(),
|
|
462
|
-
title: z.string().default(""),
|
|
463
|
-
updatedAt: timestampSchema.optional()
|
|
464
|
-
});
|
|
465
|
-
const cardCategoryCountSchema = z.object({
|
|
466
|
-
category: z.string(),
|
|
467
|
-
count: z.number().int().nonnegative()
|
|
468
|
-
});
|
|
469
|
-
const cardLanguageCountSchema = z.object({
|
|
470
|
-
count: z.number().int().nonnegative(),
|
|
471
|
-
language: z.string()
|
|
472
|
-
});
|
|
473
|
-
const cardAppliedFiltersSchema = z.object({
|
|
474
|
-
branch: z.string().optional(),
|
|
475
|
-
category: z.string().optional(),
|
|
476
|
-
language: z.string().optional(),
|
|
477
|
-
query: z.string().optional(),
|
|
478
|
-
repo: z.string().optional(),
|
|
479
|
-
source: z.string().optional()
|
|
480
|
-
});
|
|
481
|
-
const cardListSchema = z.object({
|
|
482
|
-
appliedFilters: cardAppliedFiltersSchema.optional(),
|
|
483
|
-
cards: z.array(cardSchema).nullish().transform((cards) => cards ?? []),
|
|
484
|
-
categoryCounts: z.array(cardCategoryCountSchema).nullish().transform((counts) => counts ?? []),
|
|
485
|
-
currentPage: wirePageNumberSchema,
|
|
486
|
-
languageCounts: z.array(cardLanguageCountSchema).nullish().transform((counts) => counts ?? []),
|
|
487
|
-
pageSize: wirePageNumberSchema,
|
|
488
|
-
totalSize: z.number().int().nonnegative().default(0)
|
|
489
|
-
});
|
|
490
440
|
const sourcePageInfoSchema = z.object({
|
|
491
441
|
currentPage: wirePageNumberSchema,
|
|
492
442
|
lastPage: wirePageNumberSchema,
|
|
@@ -506,6 +456,8 @@ const sourceExternalBindingSchema = z.preprocess((value) => isRecord(value) ? {
|
|
|
506
456
|
provider: z.string().default("")
|
|
507
457
|
}));
|
|
508
458
|
const sourceSchema = z.object({
|
|
459
|
+
learningStatus: z.string().optional(),
|
|
460
|
+
learningErrorCode: z.string().optional(),
|
|
509
461
|
childrenCount: z.number().int().nonnegative().optional(),
|
|
510
462
|
createdAt: timestampSchema.optional(),
|
|
511
463
|
errorCode: z.string().default(""),
|
|
@@ -542,6 +494,8 @@ const sourceTreeNodeSchema = z.lazy(() => z.preprocess((value) => isRecord(value
|
|
|
542
494
|
...value,
|
|
543
495
|
updatedAt: value.updatedAt ?? value.updated_at
|
|
544
496
|
} : value, z.object({
|
|
497
|
+
learningStatus: z.string().optional(),
|
|
498
|
+
learningErrorCode: z.string().optional(),
|
|
545
499
|
metadata: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
546
500
|
externalBinding: sourceExternalBindingSchema.optional(),
|
|
547
501
|
originUrl: z.string().optional(),
|
|
@@ -597,6 +551,12 @@ const sourceUploadFileTypeSchema = z.preprocess((value) => isRecord(value) ? {
|
|
|
597
551
|
sourceType: z.string().min(1),
|
|
598
552
|
uploadMethods: z.array(z.string().min(1)).default([])
|
|
599
553
|
}));
|
|
554
|
+
const sourceQuotaSchema = z.object({
|
|
555
|
+
usedBytes: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
556
|
+
limitBytes: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
557
|
+
planTier: z.string().min(1),
|
|
558
|
+
quotaEnabled: z.boolean()
|
|
559
|
+
}).refine((value) => !value.quotaEnabled || value.limitBytes > 0);
|
|
600
560
|
const sourceUploadCapabilitiesSchema = z.preprocess((value) => isRecord(value) ? {
|
|
601
561
|
...value,
|
|
602
562
|
fileTypes: value.fileTypes ?? value.file_types,
|
|
@@ -832,10 +792,6 @@ const sourceImportResultSchema = z.object({
|
|
|
832
792
|
url: z.string().default("")
|
|
833
793
|
});
|
|
834
794
|
const sourceImportResultsSchema = z.object({ results: z.array(sourceImportResultSchema) }).transform((value) => value.results);
|
|
835
|
-
const batchMutationResultSchema = z.object({
|
|
836
|
-
failureCount: z.number().int().nonnegative().default(0),
|
|
837
|
-
successCount: z.number().int().nonnegative().default(0)
|
|
838
|
-
});
|
|
839
795
|
const batchDeleteResultSchema = z.object({
|
|
840
796
|
failureCount: z.number().int().nonnegative(),
|
|
841
797
|
successCount: z.number().int().nonnegative()
|
|
@@ -958,25 +914,7 @@ const notebookContextChunkSchema = z.object({
|
|
|
958
914
|
sourceUri: z.string().default(""),
|
|
959
915
|
tokenCount: z.number().int().nonnegative().default(0)
|
|
960
916
|
});
|
|
961
|
-
const retrievedCardLinkSchema = z.object({
|
|
962
|
-
description: z.string().optional(),
|
|
963
|
-
linkType: z.string().default(""),
|
|
964
|
-
targetId: z.string().min(1),
|
|
965
|
-
targetTitle: z.string().optional()
|
|
966
|
-
});
|
|
967
|
-
const retrievedCardSchema = z.object({
|
|
968
|
-
cardType: z.string().optional(),
|
|
969
|
-
category: z.string().optional(),
|
|
970
|
-
content: z.string().default(""),
|
|
971
|
-
depth: z.number().int().nonnegative().default(0),
|
|
972
|
-
id: z.string().min(1),
|
|
973
|
-
keywords: z.array(z.string()).default([]),
|
|
974
|
-
links: z.array(retrievedCardLinkSchema).default([]),
|
|
975
|
-
score: z.number().finite().default(0),
|
|
976
|
-
title: z.string().default("")
|
|
977
|
-
});
|
|
978
917
|
const retrieveResultSchema = z.object({
|
|
979
|
-
cards: z.array(retrievedCardSchema).default([]),
|
|
980
918
|
chunks: z.array(notebookContextChunkSchema).default([]),
|
|
981
919
|
citations: z.array(notebookCitationSchema).default([]),
|
|
982
920
|
promptContext: z.string().default(""),
|
|
@@ -1182,4 +1120,4 @@ function call(context, options) {
|
|
|
1182
1120
|
});
|
|
1183
1121
|
}
|
|
1184
1122
|
//#endregion
|
|
1185
|
-
export {
|
|
1123
|
+
export { QMIND_MULTIPART_UPLOAD_MAX_BYTES as $, notebookSchema as A, sourceQuotaSchema as B, chatSessionSchema as C, imageUrlsSchema as D, imageUploadTicketSchema as E, sourceChildrenCountsSchema as F, sourceUploadTicketSchema as G, sourceSchema as H, sourceContentSchema as I, streamWireEventSchema as J, sourceWebOfficeSessionSchema as K, sourceImportResultsSchema as L, retrieveResultSchema as M, sharedNotebookListSchema as N, importProvidersSchema as O, sourceActionAccessSchema as P, voidResponseSchema as Q, sourceListSchema as R, chatSessionListSchema as S, fullSiteURLImportDiscoverySchema as T, sourceTreeSchema as U, sourceRawContentSchema as V, sourceUploadCapabilitiesSchema as W, taskRunSchema as X, taskRunListSchema as Y, timestampSchema as Z, aliDingImportRunItemListSchema as _, invalidArgument as a, QMindError as at, cancelQuestionResultSchema as b, optionalRecord as c, pagination as d, QMIND_SOURCE_UPLOAD_MAX_BYTES as et, positiveInteger as f, stringList as g, requiredText as h, httpUrl as i, executeUnary as it, retrieveNotebooksResultSchema as j, notebookListSchema as k, optionalString as l, requiredString as m, call as n, assertCapability as nt, nonNegativeInteger as o, queryPath as p, sourceWebOfficeTokenSchema as q, compactUndefined as r, executeStream as rt, optionalBoolean as s, assertNonEmptyPatch as t, qmindFullSiteURLImportPageLimit as tt, optionalTrimmedString as u, aliDingImportRunSchema as v, fullSiteURLImportConfirmationSchema as w, chatMessageListSchema as x, batchDeleteResultSchema as y, sourcePreviewSchema as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { W as sourceUploadCapabilitiesSchema, m as requiredString, n as call } from "./shared-DsqZroGJ.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 { $ as QMIND_MULTIPART_UPLOAD_MAX_BYTES, E as imageUploadTicketSchema, G as sourceUploadTicketSchema, H as sourceSchema, Q as voidResponseSchema, a as invalidArgument, at as QMindError, et as QMIND_SOURCE_UPLOAD_MAX_BYTES, it as executeUnary, l as optionalString, m as requiredString, p as queryPath, r as compactUndefined, u as optionalTrimmedString } from "./shared-DsqZroGJ.js";
|
|
2
|
+
import { t as preflightSourceUpload } from "./source-upload-DdZ0J4gC.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);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Z as timestampSchema, a as invalidArgument, d as pagination, m as requiredString, n as call, p as queryPath, u as optionalTrimmedString } from "./shared-DsqZroGJ.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region ../sdk/src/operations/wiki-branches.ts
|
|
4
4
|
function isRecord(value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qoder-ai/qmind-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.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.5.3",
|
|
43
|
+
"@ali/qmind-sdk": "^0.29.0"
|
|
44
44
|
},
|
|
45
45
|
"license": "UNLICENSED"
|
|
46
46
|
}
|
package/dist/cards-CfhvlNeF.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
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
|
-
import { z } from "zod";
|
|
3
|
-
//#region ../sdk/src/operations/compilation-results.ts
|
|
4
|
-
function linksBody(value, field) {
|
|
5
|
-
if (value === void 0) return void 0;
|
|
6
|
-
if (!Array.isArray(value)) throw invalidArgument(`${field} must be an array`, field);
|
|
7
|
-
return value.map((value, index) => {
|
|
8
|
-
const name = `${field}[${index}]`;
|
|
9
|
-
const link = optionalRecord(value, name);
|
|
10
|
-
const targetId = optionalTrimmedString(link?.targetId, `${name}.targetId`);
|
|
11
|
-
const targetRef = optionalTrimmedString(link?.targetRef, `${name}.targetRef`);
|
|
12
|
-
if (targetId === void 0 && targetRef === void 0) throw invalidArgument(`${name} requires targetId or targetRef`, name);
|
|
13
|
-
return compactUndefined({
|
|
14
|
-
description: optionalString(link?.description, `${name}.description`),
|
|
15
|
-
linkType: optionalTrimmedString(link?.linkType, `${name}.linkType`),
|
|
16
|
-
targetId,
|
|
17
|
-
targetRef
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
function compilationResultBody(value) {
|
|
22
|
-
if (!Array.isArray(value) || value.length === 0) throw invalidArgument("cards must be a non-empty array", "cards");
|
|
23
|
-
return { cards: value.map((value, index) => {
|
|
24
|
-
const name = `cards[${index}]`;
|
|
25
|
-
const card = optionalRecord(value, name);
|
|
26
|
-
return compactUndefined({
|
|
27
|
-
cardType: optionalTrimmedString(card?.cardType, `${name}.cardType`),
|
|
28
|
-
content: requiredText(card?.content, `${name}.content`),
|
|
29
|
-
id: optionalTrimmedString(card?.id, `${name}.id`),
|
|
30
|
-
keywords: card?.keywords === void 0 ? void 0 : stringList(card.keywords, `${name}.keywords`),
|
|
31
|
-
links: linksBody(card?.links, `${name}.links`),
|
|
32
|
-
refId: optionalTrimmedString(card?.refId, `${name}.refId`),
|
|
33
|
-
title: requiredString(card?.title, `${name}.title`)
|
|
34
|
-
});
|
|
35
|
-
}) };
|
|
36
|
-
}
|
|
37
|
-
const saveCompilationResultSchema = z.object({
|
|
38
|
-
cards: z.array(z.object({
|
|
39
|
-
id: z.string().min(1),
|
|
40
|
-
refId: z.string().optional()
|
|
41
|
-
})).nullish().transform((cards) => cards ?? []),
|
|
42
|
-
failureCount: z.number().int().nonnegative(),
|
|
43
|
-
successCount: z.number().int().nonnegative()
|
|
44
|
-
});
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region ../sdk/src/operations/cards.ts
|
|
47
|
-
function createCardOperations(context) {
|
|
48
|
-
const listCards = async (notebookId, input = {}, options, featured = false) => {
|
|
49
|
-
const notebook = requiredString(notebookId, "notebookId");
|
|
50
|
-
const normalizedPage = pagination({
|
|
51
|
-
page: input.page ?? 1,
|
|
52
|
-
pageSize: input.pageSize ?? 20
|
|
53
|
-
});
|
|
54
|
-
const category = optionalTrimmedString(input.category, "category");
|
|
55
|
-
const query = optionalTrimmedString(input.query, "query");
|
|
56
|
-
const root = context.profile.apiPath(featured ? "featured-notebooks" : "notebooks", notebook, "cards");
|
|
57
|
-
const path = queryPath(root, [
|
|
58
|
-
["category", category],
|
|
59
|
-
["query", query],
|
|
60
|
-
["page", normalizedPage.page],
|
|
61
|
-
["page_size", normalizedPage.pageSize]
|
|
62
|
-
]);
|
|
63
|
-
return call(context, {
|
|
64
|
-
callOptions: options,
|
|
65
|
-
capability: featured ? "featuredNotebooks.read" : "cards.read",
|
|
66
|
-
idempotent: true,
|
|
67
|
-
method: "GET",
|
|
68
|
-
operation: featured ? "featuredCards.list" : "cards.list",
|
|
69
|
-
path,
|
|
70
|
-
schema: cardListSchema
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
return {
|
|
74
|
-
async saveCompilationResult(notebookId, input, options) {
|
|
75
|
-
const notebook = requiredString(notebookId, "notebookId");
|
|
76
|
-
return call(context, {
|
|
77
|
-
body: compilationResultBody(input?.cards),
|
|
78
|
-
callOptions: options,
|
|
79
|
-
capability: "cards.saveResults",
|
|
80
|
-
idempotent: false,
|
|
81
|
-
method: "POST",
|
|
82
|
-
operation: "cards.saveCompilationResult",
|
|
83
|
-
path: context.profile.apiPath("notebooks", notebook, "cards", "save-compilation-result"),
|
|
84
|
-
schema: saveCompilationResultSchema
|
|
85
|
-
});
|
|
86
|
-
},
|
|
87
|
-
async batchDeleteCards(notebookId, cardIds, options) {
|
|
88
|
-
const notebook = requiredString(notebookId, "notebookId");
|
|
89
|
-
const ids = stringList(cardIds, "cardIds", { min: 1 });
|
|
90
|
-
return call(context, {
|
|
91
|
-
body: { cardIds: ids },
|
|
92
|
-
callOptions: options,
|
|
93
|
-
capability: "cards.write",
|
|
94
|
-
idempotent: false,
|
|
95
|
-
method: "POST",
|
|
96
|
-
operation: "cards.batchDelete",
|
|
97
|
-
path: context.profile.apiPath("notebooks", notebook, "cards", "batch-delete"),
|
|
98
|
-
schema: batchMutationResultSchema
|
|
99
|
-
});
|
|
100
|
-
},
|
|
101
|
-
async deleteCard(notebookId, cardId, options) {
|
|
102
|
-
const notebook = requiredString(notebookId, "notebookId");
|
|
103
|
-
const card = requiredString(cardId, "cardId");
|
|
104
|
-
return call(context, {
|
|
105
|
-
callOptions: options,
|
|
106
|
-
capability: "cards.write",
|
|
107
|
-
idempotent: false,
|
|
108
|
-
method: "DELETE",
|
|
109
|
-
operation: "cards.delete",
|
|
110
|
-
path: context.profile.apiPath("notebooks", notebook, "cards", card),
|
|
111
|
-
schema: batchMutationResultSchema
|
|
112
|
-
});
|
|
113
|
-
},
|
|
114
|
-
async getCard(notebookId, cardId, options) {
|
|
115
|
-
const notebook = requiredString(notebookId, "notebookId");
|
|
116
|
-
const card = requiredString(cardId, "cardId");
|
|
117
|
-
return call(context, {
|
|
118
|
-
callOptions: options,
|
|
119
|
-
capability: "cards.read",
|
|
120
|
-
idempotent: true,
|
|
121
|
-
method: "GET",
|
|
122
|
-
operation: "cards.get",
|
|
123
|
-
path: context.profile.apiPath("notebooks", notebook, "cards", card),
|
|
124
|
-
schema: cardSchema
|
|
125
|
-
});
|
|
126
|
-
},
|
|
127
|
-
listCards: (notebookId, input, options) => listCards(notebookId, input, options),
|
|
128
|
-
listFeaturedCards: (notebookId, input, options) => listCards(notebookId, input, options, true)
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
//#endregion
|
|
132
|
-
export { createCardOperations };
|