@cqfe/sxin-chat-core 1.0.6 → 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-7M2OXIYQ.mjs → chunk-PAG3UILI.mjs} +39 -0
- package/dist/index.cjs +39 -0
- package/dist/index.mjs +1 -1
- package/dist/vue/index.cjs +39 -0
- package/dist/vue/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -1367,6 +1367,32 @@ function applyToolMessage(msg, tools, byCallId) {
|
|
|
1367
1367
|
if (extracted) tool.extracted = extracted;
|
|
1368
1368
|
tool.status = String(msg?.status || "") === "error" ? "error" : "finished";
|
|
1369
1369
|
}
|
|
1370
|
+
function isPresentFilesTool(name) {
|
|
1371
|
+
return String(name || "").trim().toLowerCase() === "present_files";
|
|
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
|
+
}
|
|
1370
1396
|
function assembleAttachments(tools, twinEnabled, twinToolPrefix) {
|
|
1371
1397
|
const byKind = /* @__PURE__ */ new Map();
|
|
1372
1398
|
for (const tool of tools) {
|
|
@@ -1382,10 +1408,23 @@ function assembleAttachments(tools, twinEnabled, twinToolPrefix) {
|
|
|
1382
1408
|
});
|
|
1383
1409
|
} else if (ex?.kind === "artifact") {
|
|
1384
1410
|
byKind.set("artifact", { kind: "artifact", files: ex.files });
|
|
1411
|
+
} else if (isPresentFilesTool(tool.name)) {
|
|
1412
|
+
const paths = tool.input?.filepaths;
|
|
1413
|
+
if (Array.isArray(paths) && paths.length) {
|
|
1414
|
+
const prev = byKind.get("artifact");
|
|
1415
|
+
const prevFiles = prev?.kind === "artifact" && Array.isArray(prev.files) ? prev.files : [];
|
|
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 });
|
|
1422
|
+
}
|
|
1385
1423
|
} else if (twinEnabled && tool.name.includes(twinToolPrefix)) {
|
|
1386
1424
|
byKind.set("twin", { kind: "twin", payload: tool.input });
|
|
1387
1425
|
}
|
|
1388
1426
|
}
|
|
1427
|
+
dedupeArtifactAgainstReports(byKind);
|
|
1389
1428
|
return [...byKind.values()];
|
|
1390
1429
|
}
|
|
1391
1430
|
function extractClarifications(tools) {
|
package/dist/index.cjs
CHANGED
|
@@ -1789,6 +1789,32 @@ function applyToolMessage(msg, tools, byCallId) {
|
|
|
1789
1789
|
if (extracted) tool.extracted = extracted;
|
|
1790
1790
|
tool.status = String(msg?.status || "") === "error" ? "error" : "finished";
|
|
1791
1791
|
}
|
|
1792
|
+
function isPresentFilesTool(name) {
|
|
1793
|
+
return String(name || "").trim().toLowerCase() === "present_files";
|
|
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
|
+
}
|
|
1792
1818
|
function assembleAttachments(tools, twinEnabled, twinToolPrefix) {
|
|
1793
1819
|
const byKind = /* @__PURE__ */ new Map();
|
|
1794
1820
|
for (const tool of tools) {
|
|
@@ -1804,10 +1830,23 @@ function assembleAttachments(tools, twinEnabled, twinToolPrefix) {
|
|
|
1804
1830
|
});
|
|
1805
1831
|
} else if (ex?.kind === "artifact") {
|
|
1806
1832
|
byKind.set("artifact", { kind: "artifact", files: ex.files });
|
|
1833
|
+
} else if (isPresentFilesTool(tool.name)) {
|
|
1834
|
+
const paths = tool.input?.filepaths;
|
|
1835
|
+
if (Array.isArray(paths) && paths.length) {
|
|
1836
|
+
const prev = byKind.get("artifact");
|
|
1837
|
+
const prevFiles = prev?.kind === "artifact" && Array.isArray(prev.files) ? prev.files : [];
|
|
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 });
|
|
1844
|
+
}
|
|
1807
1845
|
} else if (twinEnabled && tool.name.includes(twinToolPrefix)) {
|
|
1808
1846
|
byKind.set("twin", { kind: "twin", payload: tool.input });
|
|
1809
1847
|
}
|
|
1810
1848
|
}
|
|
1849
|
+
dedupeArtifactAgainstReports(byKind);
|
|
1811
1850
|
return [...byKind.values()];
|
|
1812
1851
|
}
|
|
1813
1852
|
function extractClarifications(tools) {
|
package/dist/index.mjs
CHANGED
package/dist/vue/index.cjs
CHANGED
|
@@ -1288,6 +1288,32 @@ function applyToolMessage(msg, tools, byCallId) {
|
|
|
1288
1288
|
if (extracted) tool.extracted = extracted;
|
|
1289
1289
|
tool.status = String(msg?.status || "") === "error" ? "error" : "finished";
|
|
1290
1290
|
}
|
|
1291
|
+
function isPresentFilesTool(name) {
|
|
1292
|
+
return String(name || "").trim().toLowerCase() === "present_files";
|
|
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
|
+
}
|
|
1291
1317
|
function assembleAttachments(tools, twinEnabled, twinToolPrefix) {
|
|
1292
1318
|
const byKind = /* @__PURE__ */ new Map();
|
|
1293
1319
|
for (const tool of tools) {
|
|
@@ -1303,10 +1329,23 @@ function assembleAttachments(tools, twinEnabled, twinToolPrefix) {
|
|
|
1303
1329
|
});
|
|
1304
1330
|
} else if (ex?.kind === "artifact") {
|
|
1305
1331
|
byKind.set("artifact", { kind: "artifact", files: ex.files });
|
|
1332
|
+
} else if (isPresentFilesTool(tool.name)) {
|
|
1333
|
+
const paths = tool.input?.filepaths;
|
|
1334
|
+
if (Array.isArray(paths) && paths.length) {
|
|
1335
|
+
const prev = byKind.get("artifact");
|
|
1336
|
+
const prevFiles = prev?.kind === "artifact" && Array.isArray(prev.files) ? prev.files : [];
|
|
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 });
|
|
1343
|
+
}
|
|
1306
1344
|
} else if (twinEnabled && tool.name.includes(twinToolPrefix)) {
|
|
1307
1345
|
byKind.set("twin", { kind: "twin", payload: tool.input });
|
|
1308
1346
|
}
|
|
1309
1347
|
}
|
|
1348
|
+
dedupeArtifactAgainstReports(byKind);
|
|
1310
1349
|
return [...byKind.values()];
|
|
1311
1350
|
}
|
|
1312
1351
|
function extractClarifications(tools) {
|
package/dist/vue/index.mjs
CHANGED