@qoder-ai/qmind-cli 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/CHANGELOG.zh-CN.md +10 -0
- package/README.md +12 -13
- package/README.zh-CN.md +12 -13
- package/dist/bot-gateway-Hzjl50zu.js +373 -0
- package/dist/cards-DsMbd-g1.js +132 -0
- package/dist/{imports-Da88W09Q.js → imports-B01ERZgD.js} +3 -3
- package/dist/{management-xYuUDFtg.js → management-BIYQa9Al.js} +5 -4
- package/dist/notes-BvucEfdi.js +128 -0
- package/dist/qmind.js +163 -362
- package/dist/{shared-DwycozMA.js → shared-BkQJzIZF.js} +14 -6
- package/dist/source-upload-DBm1Hyki.js +17 -0
- package/dist/transfers-F1ZLLBdU.js +237 -0
- package/package.json +3 -3
- package/dist/cards-2J6ebaI0.js +0 -75
package/dist/qmind.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as notebookSchema, B as sourceSchema, C as chatMessageListSchema, D as imageUrlsSchema, E as imageUploadTicketSchema, F as sourceContentSchema, G as sourceWebOfficeTokenSchema, H as sourceUploadCapabilitiesSchema, I as sourceImportResultsSchema, J as taskRunSchema, K as streamWireEventSchema, L as sourceListSchema, M as sharedNotebookListSchema, N as sourceActionAccessSchema, P as sourceChildrenCountsSchema, R as sourcePreviewSchema, T as chatSessionSchema, V as sourceTreeSchema, W as sourceWebOfficeSessionSchema, X as voidResponseSchema, Z as wikiBranchListSchema, a as invalidArgument$1, b as cancelQuestionResultSchema, c as optionalRecord, d as pagination$1, et as assertCapability, f as positiveInteger$1, g as stringList, i as httpUrl, j as retrieveResultSchema, k as notebookListSchema, l as optionalString$1, m as requiredString$2, n as call, o as nonNegativeInteger$1, p as queryPath, q as taskRunListSchema, r as compactUndefined, rt as QMindError, s as optionalBoolean, t as assertNonEmptyPatch, tt as executeStream, u as optionalTrimmedString, w as chatSessionListSchema, y as batchMutationResultSchema, z as sourceRawContentSchema } from "./shared-BkQJzIZF.js";
|
|
2
|
+
import { t as preflightSourceUpload } from "./source-upload-DBm1Hyki.js";
|
|
2
3
|
import { createInterface } from "node:readline/promises";
|
|
3
4
|
import { basename, dirname, extname, join, relative, resolve, sep } from "node:path";
|
|
4
5
|
import { z } from "zod";
|
|
@@ -18,7 +19,7 @@ import picomatch from "picomatch";
|
|
|
18
19
|
import { decodeHTML } from "entities";
|
|
19
20
|
//#region ../sdk/src/operations/agents.ts
|
|
20
21
|
const workflowPrompt = "Follow the system prompt strictly: use the provided tools to discover, process and prepare the result, then emit the final report. Do NOT greet, do NOT ask for clarification — act immediately.";
|
|
21
|
-
function isRecord$
|
|
22
|
+
function isRecord$2(value) {
|
|
22
23
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23
24
|
}
|
|
24
25
|
function finiteNumber(value, field) {
|
|
@@ -62,7 +63,7 @@ function billingContext(value) {
|
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
65
|
function retrieveBody(input) {
|
|
65
|
-
if (!isRecord$
|
|
66
|
+
if (!isRecord$2(input)) throw invalidArgument$1("input must be an object", "input");
|
|
66
67
|
return compactUndefined({
|
|
67
68
|
billingContext: billingContext(input.billingContext),
|
|
68
69
|
maxResults: nonNegativeInteger$1(input.maxResults, "maxResults"),
|
|
@@ -74,7 +75,7 @@ function retrieveBody(input) {
|
|
|
74
75
|
});
|
|
75
76
|
}
|
|
76
77
|
function chatSessionBody(input = {}) {
|
|
77
|
-
if (!isRecord$
|
|
78
|
+
if (!isRecord$2(input)) throw invalidArgument$1("input must be an object", "input");
|
|
78
79
|
return compactUndefined({
|
|
79
80
|
metadata: optionalRecord(input.metadata, "metadata"),
|
|
80
81
|
modelOverride: optionalTrimmedString(input.modelOverride, "modelOverride"),
|
|
@@ -84,7 +85,7 @@ function chatSessionBody(input = {}) {
|
|
|
84
85
|
});
|
|
85
86
|
}
|
|
86
87
|
function streamBody(input) {
|
|
87
|
-
if (!isRecord$
|
|
88
|
+
if (!isRecord$2(input)) throw invalidArgument$1("input must be an object", "input");
|
|
88
89
|
return compactUndefined({
|
|
89
90
|
content: requiredString$2(input.content, "content"),
|
|
90
91
|
maxResults: nonNegativeInteger$1(input.maxResults, "maxResults"),
|
|
@@ -95,7 +96,7 @@ function streamBody(input) {
|
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
function taskRunBody(input) {
|
|
98
|
-
if (!isRecord$
|
|
99
|
+
if (!isRecord$2(input)) throw invalidArgument$1("input must be an object", "input");
|
|
99
100
|
return compactUndefined({
|
|
100
101
|
chatSessionId: optionalTrimmedString(input.chatSessionId, "chatSessionId"),
|
|
101
102
|
config: optionalRecord(input.config, "config"),
|
|
@@ -108,7 +109,7 @@ function taskRunBody(input) {
|
|
|
108
109
|
});
|
|
109
110
|
}
|
|
110
111
|
function taskRunListPath(context, notebookId, input = {}) {
|
|
111
|
-
if (!isRecord$
|
|
112
|
+
if (!isRecord$2(input)) throw invalidArgument$1("input must be an object", "input");
|
|
112
113
|
const normalizedPage = pagination$1(input);
|
|
113
114
|
const status = optionalTrimmedString(input.status, "status");
|
|
114
115
|
if (status !== void 0 && ![
|
|
@@ -159,6 +160,19 @@ function streamCallOptions(options) {
|
|
|
159
160
|
};
|
|
160
161
|
}
|
|
161
162
|
function createAgentOperations(context) {
|
|
163
|
+
const getChatSessionFor = (notebookId, sessionId, options, featured) => {
|
|
164
|
+
const notebook = requiredString$2(notebookId, "notebookId");
|
|
165
|
+
const session = requiredString$2(sessionId, "sessionId");
|
|
166
|
+
return call(context, {
|
|
167
|
+
callOptions: options,
|
|
168
|
+
capability: featured ? "featuredNotebooks.read" : "chat",
|
|
169
|
+
idempotent: true,
|
|
170
|
+
method: "GET",
|
|
171
|
+
operation: featured ? "featuredChatSessions.get" : "chatSessions.get",
|
|
172
|
+
path: context.profile.apiPath(featured ? "featured-notebooks" : "notebooks", notebook, "chat-sessions", session),
|
|
173
|
+
schema: chatSessionSchema
|
|
174
|
+
});
|
|
175
|
+
};
|
|
162
176
|
const createChatSessionFor = (notebookId, input, options, featured) => {
|
|
163
177
|
const notebook = requiredString$2(notebookId, "notebookId");
|
|
164
178
|
return call(context, {
|
|
@@ -202,7 +216,7 @@ function createAgentOperations(context) {
|
|
|
202
216
|
const cancelQuestionFor = (notebookId, sessionId, input = {}, options, featured = false) => {
|
|
203
217
|
const notebook = requiredString$2(notebookId, "notebookId");
|
|
204
218
|
const session = requiredString$2(sessionId, "sessionId");
|
|
205
|
-
if (!isRecord$
|
|
219
|
+
if (!isRecord$2(input)) throw invalidArgument$1("input must be an object", "input");
|
|
206
220
|
return call(context, {
|
|
207
221
|
body: compactUndefined({ reason: optionalTrimmedString(input.reason, "reason") }),
|
|
208
222
|
callOptions: options,
|
|
@@ -252,7 +266,7 @@ function createAgentOperations(context) {
|
|
|
252
266
|
const session = requiredString$2(sessionId, "sessionId");
|
|
253
267
|
return call(context, {
|
|
254
268
|
callOptions: options,
|
|
255
|
-
capability: featured ? "
|
|
269
|
+
capability: featured ? "featuredChat.delete" : "chat",
|
|
256
270
|
idempotent: false,
|
|
257
271
|
method: "DELETE",
|
|
258
272
|
operation: featured ? "featuredChatSessions.delete" : "chatSessions.delete",
|
|
@@ -261,7 +275,7 @@ function createAgentOperations(context) {
|
|
|
261
275
|
});
|
|
262
276
|
};
|
|
263
277
|
const startAgentRunFor = async (notebookId, input, options, featured) => {
|
|
264
|
-
if (!isRecord$
|
|
278
|
+
if (!isRecord$2(input)) throw invalidArgument$1("input must be an object", "input");
|
|
265
279
|
if (input.scene !== "rag" && input.scene !== "compilation" && input.scene !== "lint") throw invalidArgument$1("scene must be rag, compilation or lint", "scene");
|
|
266
280
|
const notebook = requiredString$2(notebookId, "notebookId");
|
|
267
281
|
const scene = input.scene;
|
|
@@ -279,6 +293,8 @@ function createAgentOperations(context) {
|
|
|
279
293
|
};
|
|
280
294
|
};
|
|
281
295
|
return {
|
|
296
|
+
getChatSession: (notebookId, sessionId, options) => getChatSessionFor(notebookId, sessionId, options, false),
|
|
297
|
+
getFeaturedChatSession: (notebookId, sessionId, options) => getChatSessionFor(notebookId, sessionId, options, true),
|
|
282
298
|
cancelFeaturedQuestion: (notebookId, sessionId, input, options) => cancelQuestionFor(notebookId, sessionId, input, options, true),
|
|
283
299
|
cancelQuestion: (notebookId, sessionId, input, options) => cancelQuestionFor(notebookId, sessionId, input, options),
|
|
284
300
|
createChatSession,
|
|
@@ -350,6 +366,18 @@ function createAgentOperations(context) {
|
|
|
350
366
|
//#region ../sdk/src/operations/notebooks.ts
|
|
351
367
|
function createNotebookOperations(context) {
|
|
352
368
|
return {
|
|
369
|
+
async copyFeaturedNotebook(notebookId, options) {
|
|
370
|
+
const notebook = requiredString$2(notebookId, "notebookId");
|
|
371
|
+
return call(context, {
|
|
372
|
+
callOptions: options,
|
|
373
|
+
capability: "featuredNotebooks.copy",
|
|
374
|
+
idempotent: false,
|
|
375
|
+
method: "POST",
|
|
376
|
+
operation: "featuredNotebooks.copy",
|
|
377
|
+
path: context.profile.apiPath("featured-notebooks", notebook, "copy"),
|
|
378
|
+
schema: notebookSchema
|
|
379
|
+
});
|
|
380
|
+
},
|
|
353
381
|
async createNotebook(input, options) {
|
|
354
382
|
const title = requiredString$2(input?.title, "title");
|
|
355
383
|
const description = optionalString$1(input?.description, "description");
|
|
@@ -512,6 +540,7 @@ function buildSourceTree(sources) {
|
|
|
512
540
|
const nodesById = /* @__PURE__ */ new Map();
|
|
513
541
|
for (const source of sources) nodesById.set(source.id, {
|
|
514
542
|
files: [],
|
|
543
|
+
hasChildren: source.hasChildren ?? (source.childrenCount === void 0 ? source.isDir : source.childrenCount > 0),
|
|
515
544
|
id: source.id,
|
|
516
545
|
name: source.title,
|
|
517
546
|
path: source.path,
|
|
@@ -641,6 +670,14 @@ function createSourceOperations(context) {
|
|
|
641
670
|
});
|
|
642
671
|
};
|
|
643
672
|
const listSources = (notebookId, input, options) => readSourcePage(notebookId, input, options);
|
|
673
|
+
const normalizeChildrenPage = (page) => ({
|
|
674
|
+
...page,
|
|
675
|
+
sources: page.sources.map((source) => ({
|
|
676
|
+
...source,
|
|
677
|
+
hasChildren: source.hasChildren ?? (source.childrenCount === void 0 ? source.isDir : source.childrenCount > 0)
|
|
678
|
+
}))
|
|
679
|
+
});
|
|
680
|
+
const isMissingChildrenRoute = (error) => error instanceof QMindError && (error.status === 404 || error.status === 405 || error.upstreamCode?.toLowerCase() === "routenotfound");
|
|
644
681
|
const listFeaturedSources = async (notebookId, input = {}, options) => {
|
|
645
682
|
const notebook = requiredString$2(notebookId, "notebookId");
|
|
646
683
|
const normalizedPage = pagination$1({
|
|
@@ -665,6 +702,43 @@ function createSourceOperations(context) {
|
|
|
665
702
|
schema: sourceListSchema
|
|
666
703
|
});
|
|
667
704
|
};
|
|
705
|
+
const listSourceChildrenPage = async (featured, notebookId, input, options) => {
|
|
706
|
+
const notebook = requiredString$2(notebookId, "notebookId");
|
|
707
|
+
const { page, pageSize } = pagination$1({
|
|
708
|
+
page: input.page ?? 1,
|
|
709
|
+
pageSize: input.pageSize ?? 100
|
|
710
|
+
});
|
|
711
|
+
const parentSourceId = optionalString$1(input.parentSourceId, "parentSourceId");
|
|
712
|
+
const collection = featured ? "featured-notebooks" : "notebooks";
|
|
713
|
+
const operation = featured ? "featuredSources.children.list" : "sources.children.list";
|
|
714
|
+
if (featured || context.profile.access !== "sash") try {
|
|
715
|
+
const result = await call(context, {
|
|
716
|
+
callOptions: options,
|
|
717
|
+
capability: featured ? "featuredNotebooks.read" : "sources.children",
|
|
718
|
+
idempotent: true,
|
|
719
|
+
method: "GET",
|
|
720
|
+
operation,
|
|
721
|
+
path: queryPath(context.profile.apiPath(collection, notebook, "source-tree", "children"), [
|
|
722
|
+
["parent_source_id", parentSourceId],
|
|
723
|
+
["page", page],
|
|
724
|
+
["page_size", pageSize]
|
|
725
|
+
]),
|
|
726
|
+
schema: sourceListSchema.nullable()
|
|
727
|
+
});
|
|
728
|
+
if (result !== null) return normalizeChildrenPage(result);
|
|
729
|
+
} catch (error) {
|
|
730
|
+
if (!isMissingChildrenRoute(error)) throw error;
|
|
731
|
+
}
|
|
732
|
+
const fallbackInput = {
|
|
733
|
+
page,
|
|
734
|
+
pageSize,
|
|
735
|
+
parentSourceId,
|
|
736
|
+
view: "children"
|
|
737
|
+
};
|
|
738
|
+
return normalizeChildrenPage(featured ? await listFeaturedSources(notebook, fallbackInput, options) : await readSourcePage(notebook, fallbackInput, options, "sources.children.list"));
|
|
739
|
+
};
|
|
740
|
+
const listSourceChildren = (notebookId, input = {}, options) => listSourceChildrenPage(false, notebookId, input, options);
|
|
741
|
+
const listFeaturedSourceChildren = (notebookId, input = {}, options) => listSourceChildrenPage(true, notebookId, input, options);
|
|
668
742
|
const collectAllSources = async (notebookId, input = {}, options, operation) => {
|
|
669
743
|
const notebook = requiredString$2(notebookId, "notebookId");
|
|
670
744
|
const pageSize = positiveInteger$1(input.pageSize, "pageSize") ?? 200;
|
|
@@ -903,6 +977,9 @@ function createSourceOperations(context) {
|
|
|
903
977
|
schema: sourceUploadCapabilitiesSchema
|
|
904
978
|
});
|
|
905
979
|
},
|
|
980
|
+
preflightSourceUpload(notebookId, options) {
|
|
981
|
+
return preflightSourceUpload(context, notebookId, options);
|
|
982
|
+
},
|
|
906
983
|
async getFeaturedSourceTree(notebookId, options) {
|
|
907
984
|
return buildSourceTree((await listFeaturedSources(notebookId, {
|
|
908
985
|
page: 1,
|
|
@@ -910,6 +987,8 @@ function createSourceOperations(context) {
|
|
|
910
987
|
}, options)).sources);
|
|
911
988
|
},
|
|
912
989
|
getSourceTree,
|
|
990
|
+
listFeaturedSourceChildren,
|
|
991
|
+
listSourceChildren,
|
|
913
992
|
async importSite(notebookId, input, options) {
|
|
914
993
|
const notebook = requiredString$2(notebookId, "notebookId");
|
|
915
994
|
return call(context, {
|
|
@@ -1045,225 +1124,17 @@ function createSourceOperations(context) {
|
|
|
1045
1124
|
};
|
|
1046
1125
|
}
|
|
1047
1126
|
//#endregion
|
|
1048
|
-
//#region ../sdk/src/operations/transfers.ts
|
|
1049
|
-
function isRecord$2(value) {
|
|
1050
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1051
|
-
}
|
|
1052
|
-
function binarySource(value) {
|
|
1053
|
-
if (!isRecord$2(value)) throw invalidArgument$1("source must be a QMindBinarySource", "source");
|
|
1054
|
-
const filename = requiredString$2(value.filename, "source.filename");
|
|
1055
|
-
const mimeType = requiredString$2(value.mimeType, "source.mimeType");
|
|
1056
|
-
const size = value.size;
|
|
1057
|
-
if (typeof size !== "number" || !Number.isSafeInteger(size) || size <= 0) throw invalidArgument$1("source.size must be a positive safe integer", "source.size");
|
|
1058
|
-
if (typeof value.open !== "function") throw invalidArgument$1("source.open must be a function", "source.open");
|
|
1059
|
-
const source = value;
|
|
1060
|
-
return {
|
|
1061
|
-
filename,
|
|
1062
|
-
mimeType,
|
|
1063
|
-
open: () => source.open(),
|
|
1064
|
-
size
|
|
1065
|
-
};
|
|
1066
|
-
}
|
|
1067
|
-
function transferOptions(options) {
|
|
1068
|
-
if (options === void 0) return {};
|
|
1069
|
-
if (!isRecord$2(options)) throw invalidArgument$1("options must be an object", "options");
|
|
1070
|
-
if (options.onProgress !== void 0 && typeof options.onProgress !== "function") throw invalidArgument$1("onProgress must be a function", "onProgress");
|
|
1071
|
-
return options;
|
|
1072
|
-
}
|
|
1073
|
-
function uploadMetadata(value) {
|
|
1074
|
-
if (value === void 0) return {};
|
|
1075
|
-
if (!isRecord$2(value)) throw invalidArgument$1("metadata must be an object", "metadata");
|
|
1076
|
-
return {
|
|
1077
|
-
parentSourceId: optionalString$1(value.parentSourceId, "parentSourceId"),
|
|
1078
|
-
path: optionalString$1(value.path, "path"),
|
|
1079
|
-
sha256: optionalTrimmedString(value.sha256, "sha256"),
|
|
1080
|
-
sourceType: optionalTrimmedString(value.sourceType, "sourceType"),
|
|
1081
|
-
title: optionalTrimmedString(value.title, "title")
|
|
1082
|
-
};
|
|
1083
|
-
}
|
|
1084
|
-
function progressReporter(context, operation, strategy, totalBytes, options) {
|
|
1085
|
-
let lastUploadedBytes = 0;
|
|
1086
|
-
const notify = (phase, uploadedBytes) => {
|
|
1087
|
-
if (!Number.isSafeInteger(uploadedBytes) || uploadedBytes < lastUploadedBytes) throw new QMindError("HOST_POLICY_ERROR", "upload progress must be a monotonic integer", {
|
|
1088
|
-
access: context.profile.access,
|
|
1089
|
-
details: {
|
|
1090
|
-
lastUploadedBytes,
|
|
1091
|
-
totalBytes,
|
|
1092
|
-
uploadedBytes
|
|
1093
|
-
},
|
|
1094
|
-
operation
|
|
1095
|
-
});
|
|
1096
|
-
if (uploadedBytes > totalBytes) throw new QMindError("HOST_POLICY_ERROR", "upload progress exceeds source size", {
|
|
1097
|
-
access: context.profile.access,
|
|
1098
|
-
details: {
|
|
1099
|
-
totalBytes,
|
|
1100
|
-
uploadedBytes
|
|
1101
|
-
},
|
|
1102
|
-
operation
|
|
1103
|
-
});
|
|
1104
|
-
lastUploadedBytes = uploadedBytes;
|
|
1105
|
-
const progress = {
|
|
1106
|
-
phase,
|
|
1107
|
-
strategy,
|
|
1108
|
-
totalBytes,
|
|
1109
|
-
uploadedBytes
|
|
1110
|
-
};
|
|
1111
|
-
options.onProgress?.(progress);
|
|
1112
|
-
};
|
|
1113
|
-
return {
|
|
1114
|
-
complete: () => notify("uploading", totalBytes),
|
|
1115
|
-
registering: () => notify("registering", totalBytes),
|
|
1116
|
-
start: () => notify("uploading", 0),
|
|
1117
|
-
update: (uploadedBytes) => notify("uploading", uploadedBytes)
|
|
1118
|
-
};
|
|
1119
|
-
}
|
|
1120
|
-
function requestOptions(options) {
|
|
1121
|
-
return {
|
|
1122
|
-
...options.signal === void 0 ? {} : { signal: options.signal },
|
|
1123
|
-
...options.timeoutMs === void 0 ? {} : { timeoutMs: options.timeoutMs }
|
|
1124
|
-
};
|
|
1125
|
-
}
|
|
1126
|
-
function transferCall(context, operation, request, schema) {
|
|
1127
|
-
return executeUnary({
|
|
1128
|
-
capability: operation.startsWith("images.") ? "images.presignUpload" : "transfers",
|
|
1129
|
-
operation,
|
|
1130
|
-
profile: context.profile,
|
|
1131
|
-
request,
|
|
1132
|
-
schema,
|
|
1133
|
-
transport: context.transport
|
|
1134
|
-
});
|
|
1135
|
-
}
|
|
1136
|
-
function hostRequest(path, method, idempotent, options, body) {
|
|
1137
|
-
const authorization = options.authorization?.trim();
|
|
1138
|
-
return {
|
|
1139
|
-
body,
|
|
1140
|
-
destination: {
|
|
1141
|
-
kind: "host",
|
|
1142
|
-
path
|
|
1143
|
-
},
|
|
1144
|
-
...authorization === void 0 || authorization.length === 0 ? {} : { headers: { authorization: `Bearer ${authorization}` } },
|
|
1145
|
-
idempotent,
|
|
1146
|
-
method,
|
|
1147
|
-
...requestOptions(options)
|
|
1148
|
-
};
|
|
1149
|
-
}
|
|
1150
|
-
function signedUploadRequest(ticket, source, progress, options) {
|
|
1151
|
-
return {
|
|
1152
|
-
body: {
|
|
1153
|
-
kind: "binary",
|
|
1154
|
-
onProgress: progress.update,
|
|
1155
|
-
source
|
|
1156
|
-
},
|
|
1157
|
-
destination: {
|
|
1158
|
-
kind: "signed",
|
|
1159
|
-
url: ticket.uploadUrl
|
|
1160
|
-
},
|
|
1161
|
-
headers: ticket.headers,
|
|
1162
|
-
idempotent: true,
|
|
1163
|
-
method: "PUT",
|
|
1164
|
-
...requestOptions(options)
|
|
1165
|
-
};
|
|
1166
|
-
}
|
|
1167
|
-
function createTransferOperations(context) {
|
|
1168
|
-
return {
|
|
1169
|
-
async uploadImage(notebookId, sourceId, rawSource, rawOptions) {
|
|
1170
|
-
const notebook = requiredString$2(notebookId, "notebookId");
|
|
1171
|
-
const sourceIdValue = requiredString$2(sourceId, "sourceId");
|
|
1172
|
-
const source = binarySource(rawSource);
|
|
1173
|
-
const options = transferOptions(rawOptions);
|
|
1174
|
-
if (source.size > 52428800) throw new QMindError("FILE_TOO_LARGE", "image exceeds the 50 MiB upload limit", {
|
|
1175
|
-
access: context.profile.access,
|
|
1176
|
-
details: {
|
|
1177
|
-
limitBytes: QMIND_MULTIPART_UPLOAD_MAX_BYTES,
|
|
1178
|
-
size: source.size
|
|
1179
|
-
},
|
|
1180
|
-
operation: "images.upload"
|
|
1181
|
-
});
|
|
1182
|
-
const ticket = await transferCall(context, "images.presignUpload", hostRequest(context.profile.apiPath("notebooks", notebook, "sources", sourceIdValue, "images", "presign"), "POST", false, options, {
|
|
1183
|
-
kind: "json",
|
|
1184
|
-
value: {
|
|
1185
|
-
filename: source.filename,
|
|
1186
|
-
mimeType: source.mimeType,
|
|
1187
|
-
size: source.size
|
|
1188
|
-
}
|
|
1189
|
-
}), imageUploadTicketSchema);
|
|
1190
|
-
const progress = progressReporter(context, "images.upload", "presigned", source.size, options);
|
|
1191
|
-
progress.start();
|
|
1192
|
-
await transferCall(context, "images.upload", signedUploadRequest(ticket, source, progress, options), voidResponseSchema);
|
|
1193
|
-
progress.complete();
|
|
1194
|
-
return ticket;
|
|
1195
|
-
},
|
|
1196
|
-
async uploadSource(notebookId, rawSource, rawMetadata, rawOptions) {
|
|
1197
|
-
const notebook = requiredString$2(notebookId, "notebookId");
|
|
1198
|
-
const source = binarySource(rawSource);
|
|
1199
|
-
const metadata = uploadMetadata(rawMetadata);
|
|
1200
|
-
const options = transferOptions(rawOptions);
|
|
1201
|
-
if (source.size > 524288e3) throw new QMindError("FILE_TOO_LARGE", "file exceeds the 500 MiB upload limit", {
|
|
1202
|
-
access: context.profile.access,
|
|
1203
|
-
details: {
|
|
1204
|
-
limitBytes: QMIND_SOURCE_UPLOAD_MAX_BYTES,
|
|
1205
|
-
size: source.size
|
|
1206
|
-
},
|
|
1207
|
-
operation: "transfers.source.multipart"
|
|
1208
|
-
});
|
|
1209
|
-
if (source.size <= 52428800) {
|
|
1210
|
-
const progress = progressReporter(context, "transfers.source.multipart", "multipart", source.size, options);
|
|
1211
|
-
progress.start();
|
|
1212
|
-
const fields = compactUndefined({
|
|
1213
|
-
parent_source_id: metadata.parentSourceId,
|
|
1214
|
-
path: metadata.path,
|
|
1215
|
-
retain_original_file: "true",
|
|
1216
|
-
source_type: metadata.sourceType,
|
|
1217
|
-
title: metadata.title
|
|
1218
|
-
});
|
|
1219
|
-
const result = await transferCall(context, "transfers.source.multipart", hostRequest(queryPath(context.profile.apiPath("notebooks", notebook, "sources", "upload"), [["client", context.client]]), "POST", false, options, {
|
|
1220
|
-
file: source,
|
|
1221
|
-
fields,
|
|
1222
|
-
kind: "multipart",
|
|
1223
|
-
onProgress: progress.update
|
|
1224
|
-
}), sourceSchema);
|
|
1225
|
-
progress.complete();
|
|
1226
|
-
return result;
|
|
1227
|
-
}
|
|
1228
|
-
const ticket = await transferCall(context, "transfers.source.presign", hostRequest(context.profile.apiPath("notebooks", notebook, "sources", "presign"), "POST", false, options, {
|
|
1229
|
-
kind: "json",
|
|
1230
|
-
value: {
|
|
1231
|
-
filename: source.filename,
|
|
1232
|
-
mimeType: source.mimeType,
|
|
1233
|
-
size: source.size
|
|
1234
|
-
}
|
|
1235
|
-
}), sourceUploadTicketSchema);
|
|
1236
|
-
const progress = progressReporter(context, "transfers.source.upload", "presigned", source.size, options);
|
|
1237
|
-
progress.start();
|
|
1238
|
-
await transferCall(context, "transfers.source.upload", signedUploadRequest(ticket, source, progress, options), voidResponseSchema);
|
|
1239
|
-
progress.complete();
|
|
1240
|
-
progress.registering();
|
|
1241
|
-
return transferCall(context, "transfers.source.register", hostRequest(context.profile.apiPath("notebooks", notebook, "sources", "register"), "POST", false, options, {
|
|
1242
|
-
kind: "json",
|
|
1243
|
-
value: compactUndefined({
|
|
1244
|
-
filename: source.filename,
|
|
1245
|
-
mimeType: source.mimeType,
|
|
1246
|
-
parentSourceId: metadata.parentSourceId,
|
|
1247
|
-
path: metadata.path,
|
|
1248
|
-
sha256: metadata.sha256,
|
|
1249
|
-
size: source.size,
|
|
1250
|
-
sourceType: metadata.sourceType,
|
|
1251
|
-
title: metadata.title,
|
|
1252
|
-
uri: ticket.uri
|
|
1253
|
-
})
|
|
1254
|
-
}), sourceSchema);
|
|
1255
|
-
}
|
|
1256
|
-
};
|
|
1257
|
-
}
|
|
1258
|
-
//#endregion
|
|
1259
1127
|
//#region ../sdk/src/capabilities.ts
|
|
1260
1128
|
const dashboardCapabilities = Object.freeze({
|
|
1261
|
-
botGateway:
|
|
1129
|
+
botGateway: true,
|
|
1262
1130
|
"cards.read": true,
|
|
1263
1131
|
"cards.write": true,
|
|
1132
|
+
"cards.saveResults": true,
|
|
1264
1133
|
chat: true,
|
|
1134
|
+
"featuredChat.delete": false,
|
|
1265
1135
|
compilation: true,
|
|
1266
1136
|
"featuredNotebooks.read": true,
|
|
1137
|
+
"featuredNotebooks.copy": true,
|
|
1267
1138
|
"images.presignUpload": false,
|
|
1268
1139
|
"images.presignUrls": false,
|
|
1269
1140
|
"imports.aliDing": true,
|
|
@@ -1272,14 +1143,15 @@ const dashboardCapabilities = Object.freeze({
|
|
|
1272
1143
|
"notebooks.filterByClient": false,
|
|
1273
1144
|
"notebooks.read": true,
|
|
1274
1145
|
"notebooks.write": true,
|
|
1275
|
-
"notes.read":
|
|
1276
|
-
"notes.write":
|
|
1146
|
+
"notes.read": true,
|
|
1147
|
+
"notes.write": true,
|
|
1148
|
+
"notes.saveCondensation": true,
|
|
1277
1149
|
retrieval: true,
|
|
1278
1150
|
scheduledTasks: true,
|
|
1279
1151
|
"sharedNotebooks.read": true,
|
|
1280
1152
|
"sources.children": true,
|
|
1281
1153
|
"sources.childrenCount": true,
|
|
1282
|
-
"sources.actionAccess":
|
|
1154
|
+
"sources.actionAccess": false,
|
|
1283
1155
|
"sources.importWeb": true,
|
|
1284
1156
|
"sources.preview": true,
|
|
1285
1157
|
"sources.rawContent": true,
|
|
@@ -1297,9 +1169,12 @@ const sashCapabilities = Object.freeze({
|
|
|
1297
1169
|
botGateway: false,
|
|
1298
1170
|
"cards.read": true,
|
|
1299
1171
|
"cards.write": true,
|
|
1172
|
+
"cards.saveResults": false,
|
|
1300
1173
|
chat: true,
|
|
1174
|
+
"featuredChat.delete": false,
|
|
1301
1175
|
compilation: false,
|
|
1302
1176
|
"featuredNotebooks.read": false,
|
|
1177
|
+
"featuredNotebooks.copy": true,
|
|
1303
1178
|
"images.presignUpload": true,
|
|
1304
1179
|
"images.presignUrls": true,
|
|
1305
1180
|
"imports.aliDing": false,
|
|
@@ -1308,8 +1183,9 @@ const sashCapabilities = Object.freeze({
|
|
|
1308
1183
|
"notebooks.filterByClient": true,
|
|
1309
1184
|
"notebooks.read": true,
|
|
1310
1185
|
"notebooks.write": true,
|
|
1311
|
-
"notes.read":
|
|
1312
|
-
"notes.write":
|
|
1186
|
+
"notes.read": true,
|
|
1187
|
+
"notes.write": true,
|
|
1188
|
+
"notes.saveCondensation": false,
|
|
1313
1189
|
retrieval: true,
|
|
1314
1190
|
scheduledTasks: false,
|
|
1315
1191
|
"sharedNotebooks.read": false,
|
|
@@ -1554,7 +1430,8 @@ const cardOperationNames = [
|
|
|
1554
1430
|
"deleteCard",
|
|
1555
1431
|
"getCard",
|
|
1556
1432
|
"listCards",
|
|
1557
|
-
"listFeaturedCards"
|
|
1433
|
+
"listFeaturedCards",
|
|
1434
|
+
"saveCompilationResult"
|
|
1558
1435
|
];
|
|
1559
1436
|
const importOperationNames = [
|
|
1560
1437
|
"getAliDingImportRun",
|
|
@@ -1563,10 +1440,60 @@ const importOperationNames = [
|
|
|
1563
1440
|
"startAliDingKnowledgeBaseImport",
|
|
1564
1441
|
"startAliDingNodeSubtreeImport"
|
|
1565
1442
|
];
|
|
1443
|
+
const noteOperationNames = [
|
|
1444
|
+
"createNote",
|
|
1445
|
+
"deleteNote",
|
|
1446
|
+
"getNote",
|
|
1447
|
+
"listNotes",
|
|
1448
|
+
"saveCondensationResult",
|
|
1449
|
+
"updateNote"
|
|
1450
|
+
];
|
|
1451
|
+
const botGatewayOperationNames = [
|
|
1452
|
+
"listPlatformApps",
|
|
1453
|
+
"createPlatformApp",
|
|
1454
|
+
"updatePlatformApp",
|
|
1455
|
+
"deletePlatformApp",
|
|
1456
|
+
"listExpertBindings",
|
|
1457
|
+
"updateExpertBinding",
|
|
1458
|
+
"deleteExpertBinding",
|
|
1459
|
+
"listGroupBindings",
|
|
1460
|
+
"createGroupBinding",
|
|
1461
|
+
"updateGroupBinding",
|
|
1462
|
+
"deleteGroupBinding",
|
|
1463
|
+
"publishDingTalk",
|
|
1464
|
+
"inviteDingTalkExpert"
|
|
1465
|
+
];
|
|
1466
|
+
function createLazyTransferOperations(context) {
|
|
1467
|
+
let operations;
|
|
1468
|
+
const load = () => {
|
|
1469
|
+
operations ??= import("./transfers-F1ZLLBdU.js").then(({ createTransferOperations }) => createTransferOperations(context));
|
|
1470
|
+
return operations;
|
|
1471
|
+
};
|
|
1472
|
+
return {
|
|
1473
|
+
uploadImage: (...args) => load().then((loaded) => loaded.uploadImage(...args)),
|
|
1474
|
+
uploadSource: (...args) => load().then((loaded) => loaded.uploadSource(...args))
|
|
1475
|
+
};
|
|
1476
|
+
}
|
|
1477
|
+
function createLazyBotGatewayOperations(context) {
|
|
1478
|
+
let operations;
|
|
1479
|
+
const load = () => {
|
|
1480
|
+
operations ??= import("./bot-gateway-Hzjl50zu.js").then(({ createBotGatewayOperations }) => createBotGatewayOperations(context));
|
|
1481
|
+
return operations;
|
|
1482
|
+
};
|
|
1483
|
+
return Object.fromEntries(botGatewayOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
|
|
1484
|
+
}
|
|
1485
|
+
function createLazyNoteOperations(context) {
|
|
1486
|
+
let operations;
|
|
1487
|
+
const load = () => {
|
|
1488
|
+
operations ??= import("./notes-BvucEfdi.js").then(({ createNoteOperations }) => createNoteOperations(context));
|
|
1489
|
+
return operations;
|
|
1490
|
+
};
|
|
1491
|
+
return Object.fromEntries(noteOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
|
|
1492
|
+
}
|
|
1566
1493
|
function createLazyCardOperations(context) {
|
|
1567
1494
|
let operations;
|
|
1568
1495
|
const load = () => {
|
|
1569
|
-
operations ??= import("./cards-
|
|
1496
|
+
operations ??= import("./cards-DsMbd-g1.js").then(({ createCardOperations }) => createCardOperations(context));
|
|
1570
1497
|
return operations;
|
|
1571
1498
|
};
|
|
1572
1499
|
return Object.fromEntries(cardOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
|
|
@@ -1574,7 +1501,7 @@ function createLazyCardOperations(context) {
|
|
|
1574
1501
|
function createLazyImportOperations(context) {
|
|
1575
1502
|
let operations;
|
|
1576
1503
|
const load = () => {
|
|
1577
|
-
operations ??= import("./imports-
|
|
1504
|
+
operations ??= import("./imports-B01ERZgD.js").then(({ createImportOperations }) => createImportOperations(context));
|
|
1578
1505
|
return operations;
|
|
1579
1506
|
};
|
|
1580
1507
|
return Object.fromEntries(importOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
|
|
@@ -1582,7 +1509,7 @@ function createLazyImportOperations(context) {
|
|
|
1582
1509
|
function createLazyManagementOperations(context) {
|
|
1583
1510
|
let operations;
|
|
1584
1511
|
const load = () => {
|
|
1585
|
-
operations ??= import("./management-
|
|
1512
|
+
operations ??= import("./management-BIYQa9Al.js").then(({ createManagementOperations }) => createManagementOperations(context));
|
|
1586
1513
|
return operations;
|
|
1587
1514
|
};
|
|
1588
1515
|
return Object.fromEntries(managementOperationNames.map((name) => [name, (...args) => load().then((loaded) => Reflect.apply(loaded[name], loaded, args))]));
|
|
@@ -1605,7 +1532,9 @@ function createQMindClient(options) {
|
|
|
1605
1532
|
...createSourceOperations(context),
|
|
1606
1533
|
...createLazyImportOperations(context),
|
|
1607
1534
|
...createLazyManagementOperations(context),
|
|
1608
|
-
...
|
|
1535
|
+
...createLazyNoteOperations(context),
|
|
1536
|
+
...createLazyBotGatewayOperations(context),
|
|
1537
|
+
...createLazyTransferOperations(context),
|
|
1609
1538
|
...createAgentOperations(context),
|
|
1610
1539
|
supports(capability) {
|
|
1611
1540
|
return profile.capabilities[capability] === true;
|
|
@@ -3040,8 +2969,8 @@ function requestsJsonOutput(argv) {
|
|
|
3040
2969
|
//#region src/build-info.ts
|
|
3041
2970
|
/** Bundled identity, never inferred from argv, environment, or an endpoint. */
|
|
3042
2971
|
const QMIND_CLI_DISTRIBUTION = "global";
|
|
3043
|
-
const QMIND_CLI_VERSION = "3.
|
|
3044
|
-
const QMIND_CLI_BUILD_TIME = "2026-09-
|
|
2972
|
+
const QMIND_CLI_VERSION = "3.1.0";
|
|
2973
|
+
const QMIND_CLI_BUILD_TIME = "2026-09-01T12:26:44.000Z";
|
|
3045
2974
|
function qmindCliPlatform() {
|
|
3046
2975
|
return process.platform === "win32" ? "windows" : process.platform;
|
|
3047
2976
|
}
|
|
@@ -3482,9 +3411,6 @@ function optionalMap(value) {
|
|
|
3482
3411
|
const result = record(value);
|
|
3483
3412
|
return Object.keys(result).length === 0 ? void 0 : result;
|
|
3484
3413
|
}
|
|
3485
|
-
function optionalStrings(value) {
|
|
3486
|
-
return Array.isArray(value) && value.length > 0 ? value.map(stringValue) : void 0;
|
|
3487
|
-
}
|
|
3488
3414
|
function pagination(value) {
|
|
3489
3415
|
if (value === void 0 || value === null) return "";
|
|
3490
3416
|
const page = record(value);
|
|
@@ -3565,45 +3491,6 @@ function goSourceList(value) {
|
|
|
3565
3491
|
pageSize: numberValue(value.pageSize)
|
|
3566
3492
|
};
|
|
3567
3493
|
}
|
|
3568
|
-
function goCardLink(value) {
|
|
3569
|
-
const source = record(value);
|
|
3570
|
-
return {
|
|
3571
|
-
linkType: stringValue(source.linkType),
|
|
3572
|
-
targetId: stringValue(source.targetId),
|
|
3573
|
-
...source.targetTitle ? { targetTitle: stringValue(source.targetTitle) } : {},
|
|
3574
|
-
...source.description ? { description: stringValue(source.description) } : {}
|
|
3575
|
-
};
|
|
3576
|
-
}
|
|
3577
|
-
function goCard(value) {
|
|
3578
|
-
const source = record(value);
|
|
3579
|
-
const keywords = optionalStrings(source.keywords);
|
|
3580
|
-
const links = Array.isArray(source.links) && source.links.length > 0 ? source.links.map(goCardLink) : void 0;
|
|
3581
|
-
return {
|
|
3582
|
-
id: stringValue(source.id),
|
|
3583
|
-
...source.knowledgeId ? { knowledgeId: stringValue(source.knowledgeId) } : {},
|
|
3584
|
-
orgId: stringValue(source.orgId),
|
|
3585
|
-
...source.notebookId ? { notebookId: stringValue(source.notebookId) } : {},
|
|
3586
|
-
source: stringValue(source.source),
|
|
3587
|
-
...source.cardType ? { cardType: stringValue(source.cardType) } : {},
|
|
3588
|
-
...source.category ? { category: stringValue(source.category) } : {},
|
|
3589
|
-
...source.repo ? { repo: stringValue(source.repo) } : {},
|
|
3590
|
-
title: stringValue(source.title),
|
|
3591
|
-
content: stringValue(source.content),
|
|
3592
|
-
...keywords === void 0 ? {} : { keywords },
|
|
3593
|
-
...links === void 0 ? {} : { links },
|
|
3594
|
-
...source.extra ? { extra: stringValue(source.extra) } : {},
|
|
3595
|
-
createdAt: goTimestamp(source.createdAt),
|
|
3596
|
-
updatedAt: goTimestamp(source.updatedAt)
|
|
3597
|
-
};
|
|
3598
|
-
}
|
|
3599
|
-
function goCardList(value) {
|
|
3600
|
-
return {
|
|
3601
|
-
cards: value.cards.map(goCard),
|
|
3602
|
-
totalSize: numberValue(value.totalSize),
|
|
3603
|
-
currentPage: numberValue(value.currentPage),
|
|
3604
|
-
pageSize: numberValue(value.pageSize)
|
|
3605
|
-
};
|
|
3606
|
-
}
|
|
3607
3494
|
function goRetrieve(value) {
|
|
3608
3495
|
return {
|
|
3609
3496
|
chunks: value.chunks.map((chunk) => ({
|
|
@@ -3690,32 +3577,6 @@ function renderAgentSource(writer, value, index = 0) {
|
|
|
3690
3577
|
agentField(writer, "updatedAt", timestamp(value.updatedAt));
|
|
3691
3578
|
agentText(writer, "error", value.errorMessage);
|
|
3692
3579
|
}
|
|
3693
|
-
function renderAgentCard(writer, value, index, score) {
|
|
3694
|
-
writer.line("---");
|
|
3695
|
-
agentField(writer, "type", "card");
|
|
3696
|
-
if (index > 0) agentField(writer, "index", index);
|
|
3697
|
-
if (score !== void 0) agentField(writer, "score", score.toFixed(4));
|
|
3698
|
-
agentField(writer, "id", value.id);
|
|
3699
|
-
agentField(writer, "knowledgeId", value.knowledgeId);
|
|
3700
|
-
agentField(writer, "notebookId", value.notebookId);
|
|
3701
|
-
agentField(writer, "source", value.source);
|
|
3702
|
-
agentField(writer, "cardType", value.cardType);
|
|
3703
|
-
agentField(writer, "category", value.category);
|
|
3704
|
-
agentField(writer, "repo", value.repo);
|
|
3705
|
-
agentField(writer, "title", value.title);
|
|
3706
|
-
if (value.keywords.length > 0) agentField(writer, "keywords", value.keywords.join(", "));
|
|
3707
|
-
agentField(writer, "createdAt", timestamp(value.createdAt));
|
|
3708
|
-
agentField(writer, "updatedAt", timestamp(value.updatedAt));
|
|
3709
|
-
agentText(writer, "content", value.content);
|
|
3710
|
-
if (value.links.length > 0) {
|
|
3711
|
-
writer.line("links:");
|
|
3712
|
-
for (const link of value.links) {
|
|
3713
|
-
writer.line(` - targetId: ${link.targetId}`);
|
|
3714
|
-
agentField(writer, " linkType", link.linkType);
|
|
3715
|
-
agentField(writer, " description", link.description);
|
|
3716
|
-
}
|
|
3717
|
-
}
|
|
3718
|
-
}
|
|
3719
3580
|
function json(value, pretty) {
|
|
3720
3581
|
return `${JSON.stringify(value, null, pretty ? 2 : 0)}\n`;
|
|
3721
3582
|
}
|
|
@@ -3822,42 +3683,6 @@ function renderSourceList(value, format) {
|
|
|
3822
3683
|
}
|
|
3823
3684
|
return writer.toString();
|
|
3824
3685
|
}
|
|
3825
|
-
function renderCardList(value, format) {
|
|
3826
|
-
if (format === "json") return json(goCardList(value), true);
|
|
3827
|
-
if (format === "ndjson") return value.cards.map((item) => json(goCard(item), false)).join("");
|
|
3828
|
-
const writer = new TextWriter();
|
|
3829
|
-
if (format === "agent") {
|
|
3830
|
-
agentHeader(writer, "cards", value.totalSize || value.cards.length);
|
|
3831
|
-
value.cards.forEach((item, index) => renderAgentCard(writer, item, index + 1));
|
|
3832
|
-
} else if (value.cards.length === 0) writer.line("No cards found.");
|
|
3833
|
-
else {
|
|
3834
|
-
writer.line(`Total: ${value.totalSize || value.cards.length}`);
|
|
3835
|
-
writer.line();
|
|
3836
|
-
table(writer, [
|
|
3837
|
-
"ID",
|
|
3838
|
-
"TYPE",
|
|
3839
|
-
"CATEGORY",
|
|
3840
|
-
"TITLE",
|
|
3841
|
-
"LINKS",
|
|
3842
|
-
"UPDATED"
|
|
3843
|
-
], value.cards.map((item) => [
|
|
3844
|
-
truncate(item.id, 36),
|
|
3845
|
-
truncate(item.cardType, 8),
|
|
3846
|
-
truncate(item.category, 16),
|
|
3847
|
-
truncate(item.title, 30),
|
|
3848
|
-
item.links.length,
|
|
3849
|
-
timestamp(item.updatedAt)
|
|
3850
|
-
]), [
|
|
3851
|
-
36,
|
|
3852
|
-
8,
|
|
3853
|
-
16,
|
|
3854
|
-
30,
|
|
3855
|
-
5,
|
|
3856
|
-
20
|
|
3857
|
-
], 125);
|
|
3858
|
-
}
|
|
3859
|
-
return writer.toString();
|
|
3860
|
-
}
|
|
3861
3686
|
function renderRetrieve(value, format) {
|
|
3862
3687
|
if (format === "json") return json(goRetrieve(value), true);
|
|
3863
3688
|
if (format === "ndjson") return [...value.chunks.map((item) => ({
|
|
@@ -3983,7 +3808,6 @@ function renderQMindCliPresentation(presentation, format) {
|
|
|
3983
3808
|
case "notebookList": return renderNotebookList(presentation.value, format);
|
|
3984
3809
|
case "source": return renderSource(presentation.value, format);
|
|
3985
3810
|
case "sourceList": return renderSourceList(presentation.value, format);
|
|
3986
|
-
case "cardList": return renderCardList(presentation.value, format);
|
|
3987
3811
|
case "retrieve": return renderRetrieve(presentation.value, format);
|
|
3988
3812
|
case "imageUpload": return json({
|
|
3989
3813
|
uploadUrl: presentation.value.uploadUrl,
|
|
@@ -4289,22 +4113,6 @@ function withCommon(command, output = true) {
|
|
|
4289
4113
|
if (output) command.option("--format <format>", "output format: table | json | agent | ndjson", "table");
|
|
4290
4114
|
return command;
|
|
4291
4115
|
}
|
|
4292
|
-
function registerCardQueryCommand(context, command) {
|
|
4293
|
-
withCommon(command).option("--nb <id>", "notebook ID (required)").option("-q, --query <query>", "search query", "").option("--cat <category>", "category filter", "").option("--page <number>", "page number", integer, 0).option("--page-size <number>", "page size", integer, 20).action(async (raw) => {
|
|
4294
|
-
const host = await hostFor(context, raw);
|
|
4295
|
-
const page = positiveNumberOption(raw, "page", 0);
|
|
4296
|
-
const pageSize = positiveNumberOption(raw, "pageSize", 20);
|
|
4297
|
-
render(context, raw, {
|
|
4298
|
-
kind: "cardList",
|
|
4299
|
-
value: await host.client.listCards(requiredString(raw.nb, "--nb"), {
|
|
4300
|
-
category: String(raw.cat ?? ""),
|
|
4301
|
-
...page === void 0 ? {} : { page },
|
|
4302
|
-
...pageSize === void 0 ? {} : { pageSize },
|
|
4303
|
-
query: String(raw.query ?? "")
|
|
4304
|
-
})
|
|
4305
|
-
});
|
|
4306
|
-
});
|
|
4307
|
-
}
|
|
4308
4116
|
function registerCoreCommands(context, program) {
|
|
4309
4117
|
withCommon(program.command("login").description("Authorize via browser and save credentials"), false).option("--client-id <id>", "OAuth App client_id").action(async (raw) => {
|
|
4310
4118
|
const host = await hostFor(context, raw);
|
|
@@ -4344,12 +4152,6 @@ function registerCoreCommands(context, program) {
|
|
|
4344
4152
|
await (await hostFor(context, raw)).client.deleteNotebook(notebookId);
|
|
4345
4153
|
context.io.stdout("deleted\n");
|
|
4346
4154
|
});
|
|
4347
|
-
const cards = program.command("cards").description("Manage notebook cards");
|
|
4348
|
-
for (const action of ["list", "search"]) {
|
|
4349
|
-
const description = action === "search" ? "Search notebook cards" : "List notebook cards";
|
|
4350
|
-
registerCardQueryCommand(context, cards.command(action).description(description));
|
|
4351
|
-
registerCardQueryCommand(context, program.command(action).description(`${description} (alias for cards ${action})`));
|
|
4352
|
-
}
|
|
4353
4155
|
withCommon(program.command("retrieve [query]").description("Retrieve notebook context without an LLM call")).option("--nb <id>", "notebook ID (required)").option("-q, --query <query>", "retrieval query").option("--sources <ids>", "comma-separated source IDs", "").option("--top-k <number>", "top-k for retrieval", integer, 0).option("--max-results <number>", "maximum context results", integer, 0).action(async (query, raw) => {
|
|
4354
4156
|
render(context, raw, {
|
|
4355
4157
|
kind: "retrieve",
|
|
@@ -4665,7 +4467,6 @@ async function runQMindCli(argv, options = {}) {
|
|
|
4665
4467
|
const normalized = normalizeLegacyArgv(argv);
|
|
4666
4468
|
const requiresLegacyAction = normalized.length === 0 || normalized.length === 1 && (/* @__PURE__ */ new Set([
|
|
4667
4469
|
"notebook",
|
|
4668
|
-
"cards",
|
|
4669
4470
|
"source",
|
|
4670
4471
|
"image"
|
|
4671
4472
|
])).has(normalized[0] ?? "");
|