@tangle-network/agent-app 1.0.8 → 1.0.10
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/agent-profiles/d1.js +3 -3
- package/dist/agent-profiles/index.js +3 -3
- package/dist/app-auth/index.js +1 -1
- package/dist/chat-routes/dispatch-parts.d.ts +1 -1
- package/dist/chat-routes/index.js +5 -5
- package/dist/{chunk-7JUQQEQY.js → chunk-532GILWC.js} +2 -2
- package/dist/{chunk-3KJAPMZB.js → chunk-C3JXGK3R.js} +2 -2
- package/dist/{chunk-UOZ4JCFJ.js → chunk-GJMKHY5U.js} +3 -25
- package/dist/chunk-GJMKHY5U.js.map +1 -0
- package/dist/{chunk-7MVMNCRP.js → chunk-IDRATMRZ.js} +5 -5
- package/dist/{chunk-7MVMNCRP.js.map → chunk-IDRATMRZ.js.map} +1 -1
- package/dist/{chunk-2CRRXINH.js → chunk-OJI2H3EZ.js} +13 -27
- package/dist/{chunk-2CRRXINH.js.map → chunk-OJI2H3EZ.js.map} +1 -1
- package/dist/{chunk-UCXB3ZZ3.js → chunk-TJA5ERCP.js} +3 -3
- package/dist/{chunk-VHDBKP3G.js → chunk-WQZCX4IJ.js} +2 -2
- package/dist/email/index.js +1 -1
- package/dist/email/palette.d.ts +23 -30
- package/dist/integrations-react/index.js +4 -0
- package/dist/integrations-react/index.js.map +1 -1
- package/dist/preset-cloudflare/index.js +2 -2
- package/dist/public-consultation/index.d.ts +1 -1
- package/dist/public-consultation/index.js +5 -5
- package/dist/sandbox/index.js +4 -4
- package/dist/theme/tokens.css +3 -3
- package/dist/tools/index.js +4 -4
- package/dist/work-product/index.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-UOZ4JCFJ.js.map +0 -1
- /package/dist/{chunk-7JUQQEQY.js.map → chunk-532GILWC.js.map} +0 -0
- /package/dist/{chunk-3KJAPMZB.js.map → chunk-C3JXGK3R.js.map} +0 -0
- /package/dist/{chunk-UCXB3ZZ3.js.map → chunk-TJA5ERCP.js.map} +0 -0
- /package/dist/{chunk-VHDBKP3G.js.map → chunk-WQZCX4IJ.js.map} +0 -0
|
@@ -242,6 +242,7 @@ function createUploadRoute(options) {
|
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
// src/chat-routes/dispatch-parts.ts
|
|
245
|
+
import { partitionBySpeaker } from "@tangle-network/agent-interface/speaker";
|
|
245
246
|
import { pathToFileURL } from "url";
|
|
246
247
|
function byteLen(value) {
|
|
247
248
|
return new TextEncoder().encode(value).length;
|
|
@@ -320,41 +321,26 @@ function projectDispatchHistory(messages, view = {}) {
|
|
|
320
321
|
out.push({ role: "user", content: textOf(message) });
|
|
321
322
|
continue;
|
|
322
323
|
}
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
|
|
324
|
+
const sections = partitionBySpeaker(message.parts ?? []);
|
|
325
|
+
const grouped = sections.some((section) => section.speaker !== null);
|
|
326
|
+
for (const { speaker, parts } of sections) {
|
|
327
|
+
const text = textOf(grouped ? {
|
|
328
|
+
role: "assistant",
|
|
329
|
+
parts,
|
|
330
|
+
content: parts.filter((part) => part.type === "text" && typeof part.text === "string").map((part) => part.text).join("")
|
|
331
|
+
} : message);
|
|
332
|
+
if (grouped && !speaker && !text) continue;
|
|
333
|
+
const owner = speaker ?? view.owner;
|
|
326
334
|
const foreign = view.pov !== void 0 && owner !== void 0 && owner.id !== view.pov;
|
|
327
335
|
out.push({
|
|
328
336
|
role: foreign ? "user" : "assistant",
|
|
329
|
-
content: foreign ? tagged(owner.name,
|
|
337
|
+
content: owner && (foreign || speaker && view.pov === void 0) ? tagged(owner.name, text) : text
|
|
330
338
|
});
|
|
331
|
-
continue;
|
|
332
|
-
}
|
|
333
|
-
for (const slice of slices) {
|
|
334
|
-
const text = textOf({ role: "assistant", content: slice.text, parts: slice.parts });
|
|
335
|
-
if (view.pov === void 0) out.push({ role: "assistant", content: tagged(slice.name, text) });
|
|
336
|
-
else if (slice.id === view.pov) out.push({ role: "assistant", content: text });
|
|
337
|
-
else out.push({ role: "user", content: tagged(slice.name, text) });
|
|
338
339
|
}
|
|
339
340
|
}
|
|
340
341
|
return out;
|
|
341
342
|
}
|
|
342
343
|
var tagged = (name, text) => `[${name}] ${text}`;
|
|
343
|
-
function speakerSlices(message) {
|
|
344
|
-
const parts = message.parts ?? [];
|
|
345
|
-
const slices = [];
|
|
346
|
-
let current = null;
|
|
347
|
-
for (const part of parts) {
|
|
348
|
-
if (part.type === "speaker" && typeof part.id === "string" && typeof part.name === "string") {
|
|
349
|
-
current = { id: part.id, name: part.name, text: "", parts: [] };
|
|
350
|
-
slices.push(current);
|
|
351
|
-
} else if (current) {
|
|
352
|
-
current.parts.push(part);
|
|
353
|
-
if (part.type === "text" && typeof part.text === "string") current.text += part.text;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
return slices;
|
|
357
|
-
}
|
|
358
344
|
function readResultToBase64(read) {
|
|
359
345
|
if (typeof read.base64 === "string") return read.base64;
|
|
360
346
|
if (read.bytes) return bytesToBase64(read.bytes);
|
|
@@ -4167,4 +4153,4 @@ export {
|
|
|
4167
4153
|
createChatTurnRoutes,
|
|
4168
4154
|
streamChatRouteAsSandboxEvents
|
|
4169
4155
|
};
|
|
4170
|
-
//# sourceMappingURL=chunk-
|
|
4156
|
+
//# sourceMappingURL=chunk-OJI2H3EZ.js.map
|