@tangle-network/agent-app 0.60.159 → 0.60.161
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/assistant/index.js +1 -1
- package/dist/chat-routes/index.js +5 -1
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/chat-routes/turn-routes.d.ts +2 -0
- package/dist/{chunk-N5M7YT6P.js → chunk-PYPWEXTD.js} +11 -2
- package/dist/{chunk-N5M7YT6P.js.map → chunk-PYPWEXTD.js.map} +1 -1
- package/dist/{chunk-T4JJXUJI.js → chunk-UMWASXC2.js} +3 -7
- package/dist/{chunk-T4JJXUJI.js.map → chunk-UMWASXC2.js.map} +1 -1
- package/dist/operator/chat-adapter.d.ts +34 -0
- package/dist/operator/index.js +48 -11
- package/dist/operator/index.js.map +1 -1
- package/dist/public-consultation/index.js +1 -1
- package/dist/web-react/agent-setup-block.d.ts +3 -1
- package/dist/web-react/index.js +1 -1
- package/package.json +1 -1
|
@@ -123,6 +123,8 @@ export interface ChatTurnMessageStore {
|
|
|
123
123
|
* drain. `createSandboxChatProducer` returns this; a router-lane producer
|
|
124
124
|
* may omit the optional members (finalText persists as a single text part). */
|
|
125
125
|
export interface ChatTurnRouteProducer extends ChatTurnProducer {
|
|
126
|
+
/** Actual backend result/done was observed; transport EOF/error alone is not completion. */
|
|
127
|
+
terminalObserved?(): boolean;
|
|
126
128
|
assistantParts?(): Array<Record<string, unknown>>;
|
|
127
129
|
/** MID-STREAM snapshot of the same projection, safe to call while the turn
|
|
128
130
|
* is running: no dangling-tool terminalization, no pending-ask settlement
|
|
@@ -500,12 +500,14 @@ function createChatTurnRoutes(options) {
|
|
|
500
500
|
});
|
|
501
501
|
if (!prepared.ok) return prepared.response;
|
|
502
502
|
}
|
|
503
|
-
const
|
|
503
|
+
const readHistory = async () => (await options.store.listMessages(payload.threadId)).map((m) => ({
|
|
504
504
|
id: m.id,
|
|
505
505
|
role: m.role,
|
|
506
506
|
content: m.content,
|
|
507
507
|
parts: m.parts ?? null
|
|
508
508
|
}));
|
|
509
|
+
const existingMessages = await readHistory();
|
|
510
|
+
const historyBeforeLock = options.turnLock ? JSON.stringify(existingMessages) : void 0;
|
|
509
511
|
let hasRunningTurn = false;
|
|
510
512
|
if (draftTuning && existingMessages.at(-1)?.role === "assistant") {
|
|
511
513
|
try {
|
|
@@ -647,6 +649,13 @@ function createChatTurnRoutes(options) {
|
|
|
647
649
|
}
|
|
648
650
|
};
|
|
649
651
|
try {
|
|
652
|
+
if (lockAcquired && JSON.stringify(await readHistory()) !== historyBeforeLock) {
|
|
653
|
+
await releaseLock();
|
|
654
|
+
return Response.json({
|
|
655
|
+
code: "chat_history_changed",
|
|
656
|
+
error: "The conversation changed while this turn was acquiring its lock. Refresh the conversation before starting new work."
|
|
657
|
+
}, { status: 409 });
|
|
658
|
+
}
|
|
650
659
|
const insertUserMessage = chatTurn.shouldInsertUserMessage && (auth.insertUserMessage ?? true);
|
|
651
660
|
let userMessageId = chatTurn.reusedUserMessageId ?? null;
|
|
652
661
|
if (insertUserMessage) {
|
|
@@ -1261,4 +1270,4 @@ export {
|
|
|
1261
1270
|
createChatTurnRoutes,
|
|
1262
1271
|
streamChatRouteAsSandboxEvents
|
|
1263
1272
|
};
|
|
1264
|
-
//# sourceMappingURL=chunk-
|
|
1273
|
+
//# sourceMappingURL=chunk-PYPWEXTD.js.map
|