@productbrain/mcp 0.0.1-beta.14245 → 0.0.1-beta.14269
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.
|
@@ -401,6 +401,11 @@ var ENTRY_BODY_HELP = `The detail, in Markdown. ${KEY_RESULT_BODY_HELP}`;
|
|
|
401
401
|
var SOURCE_EXCERPT_MAX_CHARS = 4e3;
|
|
402
402
|
var LABEL_DESCRIPTION_MAX_CHARS = 2e3;
|
|
403
403
|
var RELATION_BATCH_MAX = 25;
|
|
404
|
+
var BATCH_GET_CHUNK = 4;
|
|
405
|
+
async function readInChunks(ids, read) {
|
|
406
|
+
const chunks = Array.from({ length: Math.ceil(ids.length / BATCH_GET_CHUNK) }, (_, i) => ids.slice(i * BATCH_GET_CHUNK, (i + 1) * BATCH_GET_CHUNK));
|
|
407
|
+
return (await Promise.all(chunks.map(read))).flat();
|
|
408
|
+
}
|
|
404
409
|
var ANSWER_TEXT_MAX_CHARS = 4e3;
|
|
405
410
|
var ANSWER_REFUSAL_FIX = "Shorten the answer.";
|
|
406
411
|
function answerTextRefusal(answer2) {
|
|
@@ -3009,7 +3014,8 @@ function entryCard(e) {
|
|
|
3009
3014
|
return { lines, entryData };
|
|
3010
3015
|
}
|
|
3011
3016
|
async function handleBatch(entryIds) {
|
|
3012
|
-
const
|
|
3017
|
+
const read = (ids) => kernelQuery("chain.batchGetEntries", { entryIds: ids, includeOwner: true }, { recall: true });
|
|
3018
|
+
const results = await readInChunks(entryIds, read);
|
|
3013
3019
|
const cards = entryIds.map((_, i) => results[i]?.entry ? entryCard(results[i].entry) : null);
|
|
3014
3020
|
const notFound2 = entryIds.filter((_, i) => !cards[i]);
|
|
3015
3021
|
const blocks = entryIds.map((id, i) => cards[i]?.lines.join("\n") ?? getNotFoundText(id));
|
|
@@ -7075,8 +7081,7 @@ function rowOf(entryId, answer2, isTask, workspaceId) {
|
|
|
7075
7081
|
}
|
|
7076
7082
|
async function readRows(io, ids, workspaceId) {
|
|
7077
7083
|
try {
|
|
7078
|
-
const
|
|
7079
|
-
const answers = (await Promise.all(chunks.map((chunk) => io.readEntries(chunk)))).flat();
|
|
7084
|
+
const answers = await readInChunks(ids, io.readEntries);
|
|
7080
7085
|
return ids.map((id, i) => rowOf(id, answers[i], i > 0, workspaceId));
|
|
7081
7086
|
} catch (error) {
|
|
7082
7087
|
return ids.map((entryId) => ({ entryId, notRead: messageOf(error) }));
|
|
@@ -12288,4 +12293,4 @@ export {
|
|
|
12288
12293
|
SERVER_VERSION,
|
|
12289
12294
|
createProductBrainServer
|
|
12290
12295
|
};
|
|
12291
|
-
//# sourceMappingURL=chunk-
|
|
12296
|
+
//# sourceMappingURL=chunk-JEMDFT7G.js.map
|