@cqfe/sxin-chat-core 1.0.7 → 1.0.8
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/dist/{chunk-7A4ZPM4E.mjs → chunk-PAG3UILI.mjs} +30 -1
- package/dist/index.cjs +30 -1
- package/dist/index.mjs +1 -1
- package/dist/vue/index.cjs +30 -1
- package/dist/vue/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -1370,6 +1370,29 @@ function applyToolMessage(msg, tools, byCallId) {
|
|
|
1370
1370
|
function isPresentFilesTool(name) {
|
|
1371
1371
|
return String(name || "").trim().toLowerCase() === "present_files";
|
|
1372
1372
|
}
|
|
1373
|
+
function attachmentFilePath(file) {
|
|
1374
|
+
if (typeof file === "string") return file.trim();
|
|
1375
|
+
if (file && typeof file === "object") {
|
|
1376
|
+
const p = file.path;
|
|
1377
|
+
if (typeof p === "string") return p.trim();
|
|
1378
|
+
}
|
|
1379
|
+
return "";
|
|
1380
|
+
}
|
|
1381
|
+
function dedupeArtifactAgainstReports(byKind) {
|
|
1382
|
+
const reportPaths = /* @__PURE__ */ new Set();
|
|
1383
|
+
for (const att of byKind.values()) {
|
|
1384
|
+
if (att.kind === "report" && att.sourcePath) reportPaths.add(String(att.sourcePath).trim());
|
|
1385
|
+
}
|
|
1386
|
+
if (!reportPaths.size) return;
|
|
1387
|
+
const artifact = byKind.get("artifact");
|
|
1388
|
+
if (artifact?.kind !== "artifact" || !Array.isArray(artifact.files)) return;
|
|
1389
|
+
const files = artifact.files.filter((f) => {
|
|
1390
|
+
const p = attachmentFilePath(f);
|
|
1391
|
+
return !p || !reportPaths.has(p);
|
|
1392
|
+
});
|
|
1393
|
+
if (!files.length) byKind.delete("artifact");
|
|
1394
|
+
else byKind.set("artifact", { kind: "artifact", files });
|
|
1395
|
+
}
|
|
1373
1396
|
function assembleAttachments(tools, twinEnabled, twinToolPrefix) {
|
|
1374
1397
|
const byKind = /* @__PURE__ */ new Map();
|
|
1375
1398
|
for (const tool of tools) {
|
|
@@ -1390,12 +1413,18 @@ function assembleAttachments(tools, twinEnabled, twinToolPrefix) {
|
|
|
1390
1413
|
if (Array.isArray(paths) && paths.length) {
|
|
1391
1414
|
const prev = byKind.get("artifact");
|
|
1392
1415
|
const prevFiles = prev?.kind === "artifact" && Array.isArray(prev.files) ? prev.files : [];
|
|
1393
|
-
|
|
1416
|
+
const merged = [...prevFiles];
|
|
1417
|
+
for (const p of paths) {
|
|
1418
|
+
const key = attachmentFilePath(p);
|
|
1419
|
+
if (!key || !merged.some((f) => attachmentFilePath(f) === key)) merged.push(p);
|
|
1420
|
+
}
|
|
1421
|
+
byKind.set("artifact", { kind: "artifact", files: merged });
|
|
1394
1422
|
}
|
|
1395
1423
|
} else if (twinEnabled && tool.name.includes(twinToolPrefix)) {
|
|
1396
1424
|
byKind.set("twin", { kind: "twin", payload: tool.input });
|
|
1397
1425
|
}
|
|
1398
1426
|
}
|
|
1427
|
+
dedupeArtifactAgainstReports(byKind);
|
|
1399
1428
|
return [...byKind.values()];
|
|
1400
1429
|
}
|
|
1401
1430
|
function extractClarifications(tools) {
|
package/dist/index.cjs
CHANGED
|
@@ -1792,6 +1792,29 @@ function applyToolMessage(msg, tools, byCallId) {
|
|
|
1792
1792
|
function isPresentFilesTool(name) {
|
|
1793
1793
|
return String(name || "").trim().toLowerCase() === "present_files";
|
|
1794
1794
|
}
|
|
1795
|
+
function attachmentFilePath(file) {
|
|
1796
|
+
if (typeof file === "string") return file.trim();
|
|
1797
|
+
if (file && typeof file === "object") {
|
|
1798
|
+
const p = file.path;
|
|
1799
|
+
if (typeof p === "string") return p.trim();
|
|
1800
|
+
}
|
|
1801
|
+
return "";
|
|
1802
|
+
}
|
|
1803
|
+
function dedupeArtifactAgainstReports(byKind) {
|
|
1804
|
+
const reportPaths = /* @__PURE__ */ new Set();
|
|
1805
|
+
for (const att of byKind.values()) {
|
|
1806
|
+
if (att.kind === "report" && att.sourcePath) reportPaths.add(String(att.sourcePath).trim());
|
|
1807
|
+
}
|
|
1808
|
+
if (!reportPaths.size) return;
|
|
1809
|
+
const artifact = byKind.get("artifact");
|
|
1810
|
+
if (artifact?.kind !== "artifact" || !Array.isArray(artifact.files)) return;
|
|
1811
|
+
const files = artifact.files.filter((f) => {
|
|
1812
|
+
const p = attachmentFilePath(f);
|
|
1813
|
+
return !p || !reportPaths.has(p);
|
|
1814
|
+
});
|
|
1815
|
+
if (!files.length) byKind.delete("artifact");
|
|
1816
|
+
else byKind.set("artifact", { kind: "artifact", files });
|
|
1817
|
+
}
|
|
1795
1818
|
function assembleAttachments(tools, twinEnabled, twinToolPrefix) {
|
|
1796
1819
|
const byKind = /* @__PURE__ */ new Map();
|
|
1797
1820
|
for (const tool of tools) {
|
|
@@ -1812,12 +1835,18 @@ function assembleAttachments(tools, twinEnabled, twinToolPrefix) {
|
|
|
1812
1835
|
if (Array.isArray(paths) && paths.length) {
|
|
1813
1836
|
const prev = byKind.get("artifact");
|
|
1814
1837
|
const prevFiles = prev?.kind === "artifact" && Array.isArray(prev.files) ? prev.files : [];
|
|
1815
|
-
|
|
1838
|
+
const merged = [...prevFiles];
|
|
1839
|
+
for (const p of paths) {
|
|
1840
|
+
const key = attachmentFilePath(p);
|
|
1841
|
+
if (!key || !merged.some((f) => attachmentFilePath(f) === key)) merged.push(p);
|
|
1842
|
+
}
|
|
1843
|
+
byKind.set("artifact", { kind: "artifact", files: merged });
|
|
1816
1844
|
}
|
|
1817
1845
|
} else if (twinEnabled && tool.name.includes(twinToolPrefix)) {
|
|
1818
1846
|
byKind.set("twin", { kind: "twin", payload: tool.input });
|
|
1819
1847
|
}
|
|
1820
1848
|
}
|
|
1849
|
+
dedupeArtifactAgainstReports(byKind);
|
|
1821
1850
|
return [...byKind.values()];
|
|
1822
1851
|
}
|
|
1823
1852
|
function extractClarifications(tools) {
|
package/dist/index.mjs
CHANGED
package/dist/vue/index.cjs
CHANGED
|
@@ -1291,6 +1291,29 @@ function applyToolMessage(msg, tools, byCallId) {
|
|
|
1291
1291
|
function isPresentFilesTool(name) {
|
|
1292
1292
|
return String(name || "").trim().toLowerCase() === "present_files";
|
|
1293
1293
|
}
|
|
1294
|
+
function attachmentFilePath(file) {
|
|
1295
|
+
if (typeof file === "string") return file.trim();
|
|
1296
|
+
if (file && typeof file === "object") {
|
|
1297
|
+
const p = file.path;
|
|
1298
|
+
if (typeof p === "string") return p.trim();
|
|
1299
|
+
}
|
|
1300
|
+
return "";
|
|
1301
|
+
}
|
|
1302
|
+
function dedupeArtifactAgainstReports(byKind) {
|
|
1303
|
+
const reportPaths = /* @__PURE__ */ new Set();
|
|
1304
|
+
for (const att of byKind.values()) {
|
|
1305
|
+
if (att.kind === "report" && att.sourcePath) reportPaths.add(String(att.sourcePath).trim());
|
|
1306
|
+
}
|
|
1307
|
+
if (!reportPaths.size) return;
|
|
1308
|
+
const artifact = byKind.get("artifact");
|
|
1309
|
+
if (artifact?.kind !== "artifact" || !Array.isArray(artifact.files)) return;
|
|
1310
|
+
const files = artifact.files.filter((f) => {
|
|
1311
|
+
const p = attachmentFilePath(f);
|
|
1312
|
+
return !p || !reportPaths.has(p);
|
|
1313
|
+
});
|
|
1314
|
+
if (!files.length) byKind.delete("artifact");
|
|
1315
|
+
else byKind.set("artifact", { kind: "artifact", files });
|
|
1316
|
+
}
|
|
1294
1317
|
function assembleAttachments(tools, twinEnabled, twinToolPrefix) {
|
|
1295
1318
|
const byKind = /* @__PURE__ */ new Map();
|
|
1296
1319
|
for (const tool of tools) {
|
|
@@ -1311,12 +1334,18 @@ function assembleAttachments(tools, twinEnabled, twinToolPrefix) {
|
|
|
1311
1334
|
if (Array.isArray(paths) && paths.length) {
|
|
1312
1335
|
const prev = byKind.get("artifact");
|
|
1313
1336
|
const prevFiles = prev?.kind === "artifact" && Array.isArray(prev.files) ? prev.files : [];
|
|
1314
|
-
|
|
1337
|
+
const merged = [...prevFiles];
|
|
1338
|
+
for (const p of paths) {
|
|
1339
|
+
const key = attachmentFilePath(p);
|
|
1340
|
+
if (!key || !merged.some((f) => attachmentFilePath(f) === key)) merged.push(p);
|
|
1341
|
+
}
|
|
1342
|
+
byKind.set("artifact", { kind: "artifact", files: merged });
|
|
1315
1343
|
}
|
|
1316
1344
|
} else if (twinEnabled && tool.name.includes(twinToolPrefix)) {
|
|
1317
1345
|
byKind.set("twin", { kind: "twin", payload: tool.input });
|
|
1318
1346
|
}
|
|
1319
1347
|
}
|
|
1348
|
+
dedupeArtifactAgainstReports(byKind);
|
|
1320
1349
|
return [...byKind.values()];
|
|
1321
1350
|
}
|
|
1322
1351
|
function extractClarifications(tools) {
|
package/dist/vue/index.mjs
CHANGED