@syntrologie/adapt-chatbot 2.8.0-canary.246 → 2.8.0-canary.248

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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ChatAssistantLitMountable,
3
3
  acquireTurnstileToken
4
- } from "./chunk-DUQTO5RE.js";
4
+ } from "./chunk-HMJHNZ4Z.js";
5
5
  import "./chunk-V6TY7KAL.js";
6
6
  export {
7
7
  ChatAssistantLitMountable,
@@ -2972,10 +2972,18 @@ var SyntroChat = class extends LitElement {
2972
2972
  if (event.isTyping) this._scrollToBottom();
2973
2973
  break;
2974
2974
  case "tool-call": {
2975
- this._messages = this._messages.map(
2976
- (m2) => m2.id === event.messageId ? { ...m2, toolCalls: [...m2.toolCalls ?? [], event.toolCall] } : m2
2977
- );
2975
+ this._messages = this._messages.map((m2) => {
2976
+ if (m2.id !== event.messageId) return m2;
2977
+ const existing = (m2.toolCalls ?? []).findIndex((tc) => tc.id === event.toolCall.id);
2978
+ if (existing >= 0) {
2979
+ const toolCalls = [...m2.toolCalls ?? []];
2980
+ toolCalls[existing] = event.toolCall;
2981
+ return { ...m2, toolCalls };
2982
+ }
2983
+ return { ...m2, toolCalls: [...m2.toolCalls ?? [], event.toolCall] };
2984
+ });
2978
2985
  if (this.autoExecTools?.has(event.toolCall.name) && event.toolCall.status === "pending") {
2986
+ this._markToolDone(event.toolCall.id);
2979
2987
  this.transport.send({
2980
2988
  type: "tool-result",
2981
2989
  toolCallId: event.toolCall.id,
@@ -3048,6 +3056,7 @@ var SyntroChat = class extends LitElement {
3048
3056
  this.transport.send({ type: "regenerate", messageId });
3049
3057
  };
3050
3058
  this._onToolApprove = (toolCallId) => {
3059
+ this._markToolDone(toolCallId);
3051
3060
  this.transport.send({
3052
3061
  type: "tool-result",
3053
3062
  toolCallId,
@@ -3056,6 +3065,7 @@ var SyntroChat = class extends LitElement {
3056
3065
  });
3057
3066
  };
3058
3067
  this._onToolDeny = (toolCallId) => {
3068
+ this._markToolDone(toolCallId);
3059
3069
  this.transport.send({
3060
3070
  type: "tool-result",
3061
3071
  toolCallId,
@@ -3125,6 +3135,15 @@ var SyntroChat = class extends LitElement {
3125
3135
  }
3126
3136
  });
3127
3137
  }
3138
+ _markToolDone(toolCallId) {
3139
+ this._messages = this._messages.map((m2) => {
3140
+ if (!m2.toolCalls) return m2;
3141
+ const toolCalls = m2.toolCalls.map(
3142
+ (tc) => tc.id === toolCallId ? { ...tc, status: "done" } : tc
3143
+ );
3144
+ return { ...m2, toolCalls };
3145
+ });
3146
+ }
3128
3147
  render() {
3129
3148
  const headerSlot = this.slots?.header;
3130
3149
  const emptyState = this.slots?.emptyState ?? (this.greeting ? html7`<div style="padding:24px;text-align:center;color:var(--sc-content-text-secondary-color,#87919f)">${this.greeting}</div>` : void 0);
@@ -3731,4 +3750,4 @@ export {
3731
3750
  dompurify/dist/purify.es.mjs:
3732
3751
  (*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE *)
3733
3752
  */
3734
- //# sourceMappingURL=chunk-DUQTO5RE.js.map
3753
+ //# sourceMappingURL=chunk-HMJHNZ4Z.js.map