@syntrologie/adapt-chatbot 2.8.0-canary.296 → 2.8.0-canary.298
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/ChatAssistantLit.js
CHANGED
|
@@ -7325,6 +7325,7 @@ var AgUiTransport = class {
|
|
|
7325
7325
|
this._pendingResume = false;
|
|
7326
7326
|
this._currentAssistantMessageId = null;
|
|
7327
7327
|
this._toolCallMessageIds = /* @__PURE__ */ new Map();
|
|
7328
|
+
this._localPendingInterrupts = /* @__PURE__ */ new Map();
|
|
7328
7329
|
this._url = options.url;
|
|
7329
7330
|
this._headers = options.headers ?? {};
|
|
7330
7331
|
this._threadId = options.threadId;
|
|
@@ -7366,6 +7367,7 @@ var AgUiTransport = class {
|
|
|
7366
7367
|
this._pendingResume = false;
|
|
7367
7368
|
this._currentAssistantMessageId = null;
|
|
7368
7369
|
this._toolCallMessageIds.clear();
|
|
7370
|
+
this._localPendingInterrupts.clear();
|
|
7369
7371
|
}
|
|
7370
7372
|
send(action) {
|
|
7371
7373
|
if (!this._agent) return;
|
|
@@ -7394,10 +7396,15 @@ var AgUiTransport = class {
|
|
|
7394
7396
|
// Private — user message flow
|
|
7395
7397
|
// ---------------------------------------------------------------------------
|
|
7396
7398
|
_sendUserMessage(text) {
|
|
7399
|
+
if (!text || !text.trim()) return;
|
|
7397
7400
|
const agent = this._agent;
|
|
7398
|
-
const
|
|
7401
|
+
const upstream = (agent.pendingInterrupts ?? []).map((i) => i).filter(
|
|
7399
7402
|
(i) => typeof i?.id === "string" && i.id.length > 0
|
|
7400
7403
|
);
|
|
7404
|
+
const byId = /* @__PURE__ */ new Map();
|
|
7405
|
+
for (const i of this._localPendingInterrupts.values()) byId.set(i.id, i);
|
|
7406
|
+
for (const i of upstream) byId.set(i.id, i);
|
|
7407
|
+
const pendingInterrupts = [...byId.values()];
|
|
7401
7408
|
const cancelResume = pendingInterrupts.length > 0 ? pendingInterrupts.map((i) => {
|
|
7402
7409
|
const toolCallId = i.toolCallId ?? i.tool_call_id;
|
|
7403
7410
|
if (toolCallId) {
|
|
@@ -7408,6 +7415,7 @@ var AgUiTransport = class {
|
|
|
7408
7415
|
status: "cancelled"
|
|
7409
7416
|
};
|
|
7410
7417
|
}) : void 0;
|
|
7418
|
+
if (cancelResume) this._localPendingInterrupts.clear();
|
|
7411
7419
|
agent.addMessage({
|
|
7412
7420
|
id: generateId(),
|
|
7413
7421
|
role: "user",
|
|
@@ -7441,6 +7449,7 @@ var AgUiTransport = class {
|
|
|
7441
7449
|
// ---------------------------------------------------------------------------
|
|
7442
7450
|
_sendDeferredToolResume(action) {
|
|
7443
7451
|
let entry;
|
|
7452
|
+
this._localPendingInterrupts.delete(action.interruptId);
|
|
7444
7453
|
if (action.decision === "cancel") {
|
|
7445
7454
|
entry = { interruptId: action.interruptId, status: "cancelled" };
|
|
7446
7455
|
} else if (action.decision === "approve") {
|
|
@@ -7635,6 +7644,12 @@ var AgUiTransport = class {
|
|
|
7635
7644
|
if (outcome?.type === "interrupt" && Array.isArray(outcome.interrupts)) {
|
|
7636
7645
|
for (const interrupt of outcome.interrupts) {
|
|
7637
7646
|
const toolCallId = interrupt.toolCallId ?? interrupt.tool_call_id;
|
|
7647
|
+
if (typeof interrupt.id === "string" && interrupt.id) {
|
|
7648
|
+
this._localPendingInterrupts.set(interrupt.id, {
|
|
7649
|
+
id: interrupt.id,
|
|
7650
|
+
toolCallId: typeof toolCallId === "string" ? toolCallId : void 0
|
|
7651
|
+
});
|
|
7652
|
+
}
|
|
7638
7653
|
if (typeof toolCallId === "string" && typeof interrupt.id === "string") {
|
|
7639
7654
|
this._emit({
|
|
7640
7655
|
type: "tool-call-deferred",
|
|
@@ -8752,4 +8767,4 @@ fast-json-patch/module/duplex.mjs:
|
|
|
8752
8767
|
* MIT license
|
|
8753
8768
|
*)
|
|
8754
8769
|
*/
|
|
8755
|
-
//# sourceMappingURL=chunk-
|
|
8770
|
+
//# sourceMappingURL=chunk-2ZUJ7DZI.js.map
|