@yushaw/sanqian-chat 0.2.23 → 0.2.24

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.
@@ -639,7 +639,7 @@ var FloatingWindow = class _FloatingWindow {
639
639
  webContents.send("sanqian-chat:streamEvent", { streamId, event: { type: "error", error: "SDK or agent not ready" } });
640
640
  return;
641
641
  }
642
- const streamState = { cancelled: false, runId: null };
642
+ const streamState = { cancelled: false, runId: null, cancelSignalSent: false };
643
643
  activeInstance?.activeStreams.set(streamId, streamState);
644
644
  try {
645
645
  await sdk.ensureReady();
@@ -650,7 +650,24 @@ var FloatingWindow = class _FloatingWindow {
650
650
  { conversationId, persistHistory: true }
651
651
  );
652
652
  for await (const evt of stream) {
653
- if (streamState.cancelled) break;
653
+ const evtWithRunId = evt;
654
+ if (evtWithRunId.run_id && !streamState.runId) {
655
+ streamState.runId = evtWithRunId.run_id;
656
+ }
657
+ if (streamState.cancelled && streamState.runId && !streamState.cancelSignalSent) {
658
+ try {
659
+ sdk.cancelRun(streamState.runId);
660
+ streamState.cancelSignalSent = true;
661
+ } catch (e) {
662
+ console.warn("[FloatingWindow] Failed to cancel run:", e);
663
+ }
664
+ }
665
+ if (streamState.cancelled) {
666
+ if (streamState.cancelSignalSent) {
667
+ break;
668
+ }
669
+ continue;
670
+ }
654
671
  if (activeInstance?.options.devMode) {
655
672
  console.log("[FloatingWindow] SDK event:", evt.type, JSON.stringify(evt).slice(0, 200));
656
673
  }
@@ -702,17 +719,17 @@ var FloatingWindow = class _FloatingWindow {
702
719
  const stream = activeInstance?.activeStreams.get(params.streamId);
703
720
  if (stream) {
704
721
  stream.cancelled = true;
705
- if (stream.runId) {
722
+ if (stream.runId && !stream.cancelSignalSent) {
706
723
  const sdk = activeInstance ? _FloatingWindow.getSdkFromOptions(activeInstance.options) : null;
707
724
  if (sdk) {
708
725
  try {
709
726
  sdk.cancelRun(stream.runId);
727
+ stream.cancelSignalSent = true;
710
728
  } catch (e) {
711
729
  console.warn("[FloatingWindow] Failed to cancel run:", e);
712
730
  }
713
731
  }
714
732
  }
715
- activeInstance?.activeStreams.delete(params.streamId);
716
733
  }
717
734
  return { success: true };
718
735
  });
@@ -1729,7 +1746,7 @@ var ChatPanel = class {
1729
1746
  webContents.send("sanqian-chat:streamEvent", { streamId, event: { type: "error", error: "SDK or agent not ready" } });
1730
1747
  return;
1731
1748
  }
1732
- const streamState = { cancelled: false, runId: null };
1749
+ const streamState = { cancelled: false, runId: null, cancelSignalSent: false };
1733
1750
  activeInstance2?.activeStreams.set(streamId, streamState);
1734
1751
  try {
1735
1752
  await sdk.ensureReady();
@@ -1745,7 +1762,24 @@ var ChatPanel = class {
1745
1762
  sessionResources: sessionResources?.length ? sessionResources : void 0
1746
1763
  });
1747
1764
  for await (const evt of stream) {
1748
- if (streamState.cancelled) break;
1765
+ const evtWithRunId = evt;
1766
+ if (evtWithRunId.run_id && !streamState.runId) {
1767
+ streamState.runId = evtWithRunId.run_id;
1768
+ }
1769
+ if (streamState.cancelled && streamState.runId && !streamState.cancelSignalSent) {
1770
+ try {
1771
+ sdk.cancelRun(streamState.runId);
1772
+ streamState.cancelSignalSent = true;
1773
+ } catch (e) {
1774
+ console.warn("[ChatPanel] Failed to cancel run:", e);
1775
+ }
1776
+ }
1777
+ if (streamState.cancelled) {
1778
+ if (streamState.cancelSignalSent) {
1779
+ break;
1780
+ }
1781
+ continue;
1782
+ }
1749
1783
  if (activeInstance2?.config.devMode) {
1750
1784
  console.log("[ChatPanel] SDK event:", evt.type, JSON.stringify(evt).slice(0, 200));
1751
1785
  }
@@ -1797,17 +1831,17 @@ var ChatPanel = class {
1797
1831
  const stream = activeInstance2?.activeStreams.get(params.streamId);
1798
1832
  if (stream) {
1799
1833
  stream.cancelled = true;
1800
- if (stream.runId) {
1834
+ if (stream.runId && !stream.cancelSignalSent) {
1801
1835
  const sdk = activeInstance2?.getSdk();
1802
1836
  if (sdk) {
1803
1837
  try {
1804
1838
  sdk.cancelRun(stream.runId);
1839
+ stream.cancelSignalSent = true;
1805
1840
  } catch (e) {
1806
1841
  console.warn("[ChatPanel] Failed to cancel run:", e);
1807
1842
  }
1808
1843
  }
1809
1844
  }
1810
- activeInstance2?.activeStreams.delete(params.streamId);
1811
1845
  }
1812
1846
  return { success: true };
1813
1847
  });
@@ -608,7 +608,7 @@ var FloatingWindow = class _FloatingWindow {
608
608
  webContents.send("sanqian-chat:streamEvent", { streamId, event: { type: "error", error: "SDK or agent not ready" } });
609
609
  return;
610
610
  }
611
- const streamState = { cancelled: false, runId: null };
611
+ const streamState = { cancelled: false, runId: null, cancelSignalSent: false };
612
612
  activeInstance?.activeStreams.set(streamId, streamState);
613
613
  try {
614
614
  await sdk.ensureReady();
@@ -619,7 +619,24 @@ var FloatingWindow = class _FloatingWindow {
619
619
  { conversationId, persistHistory: true }
620
620
  );
621
621
  for await (const evt of stream) {
622
- if (streamState.cancelled) break;
622
+ const evtWithRunId = evt;
623
+ if (evtWithRunId.run_id && !streamState.runId) {
624
+ streamState.runId = evtWithRunId.run_id;
625
+ }
626
+ if (streamState.cancelled && streamState.runId && !streamState.cancelSignalSent) {
627
+ try {
628
+ sdk.cancelRun(streamState.runId);
629
+ streamState.cancelSignalSent = true;
630
+ } catch (e) {
631
+ console.warn("[FloatingWindow] Failed to cancel run:", e);
632
+ }
633
+ }
634
+ if (streamState.cancelled) {
635
+ if (streamState.cancelSignalSent) {
636
+ break;
637
+ }
638
+ continue;
639
+ }
623
640
  if (activeInstance?.options.devMode) {
624
641
  console.log("[FloatingWindow] SDK event:", evt.type, JSON.stringify(evt).slice(0, 200));
625
642
  }
@@ -671,17 +688,17 @@ var FloatingWindow = class _FloatingWindow {
671
688
  const stream = activeInstance?.activeStreams.get(params.streamId);
672
689
  if (stream) {
673
690
  stream.cancelled = true;
674
- if (stream.runId) {
691
+ if (stream.runId && !stream.cancelSignalSent) {
675
692
  const sdk = activeInstance ? _FloatingWindow.getSdkFromOptions(activeInstance.options) : null;
676
693
  if (sdk) {
677
694
  try {
678
695
  sdk.cancelRun(stream.runId);
696
+ stream.cancelSignalSent = true;
679
697
  } catch (e) {
680
698
  console.warn("[FloatingWindow] Failed to cancel run:", e);
681
699
  }
682
700
  }
683
701
  }
684
- activeInstance?.activeStreams.delete(params.streamId);
685
702
  }
686
703
  return { success: true };
687
704
  });
@@ -1704,7 +1721,7 @@ var ChatPanel = class {
1704
1721
  webContents.send("sanqian-chat:streamEvent", { streamId, event: { type: "error", error: "SDK or agent not ready" } });
1705
1722
  return;
1706
1723
  }
1707
- const streamState = { cancelled: false, runId: null };
1724
+ const streamState = { cancelled: false, runId: null, cancelSignalSent: false };
1708
1725
  activeInstance2?.activeStreams.set(streamId, streamState);
1709
1726
  try {
1710
1727
  await sdk.ensureReady();
@@ -1720,7 +1737,24 @@ var ChatPanel = class {
1720
1737
  sessionResources: sessionResources?.length ? sessionResources : void 0
1721
1738
  });
1722
1739
  for await (const evt of stream) {
1723
- if (streamState.cancelled) break;
1740
+ const evtWithRunId = evt;
1741
+ if (evtWithRunId.run_id && !streamState.runId) {
1742
+ streamState.runId = evtWithRunId.run_id;
1743
+ }
1744
+ if (streamState.cancelled && streamState.runId && !streamState.cancelSignalSent) {
1745
+ try {
1746
+ sdk.cancelRun(streamState.runId);
1747
+ streamState.cancelSignalSent = true;
1748
+ } catch (e) {
1749
+ console.warn("[ChatPanel] Failed to cancel run:", e);
1750
+ }
1751
+ }
1752
+ if (streamState.cancelled) {
1753
+ if (streamState.cancelSignalSent) {
1754
+ break;
1755
+ }
1756
+ continue;
1757
+ }
1724
1758
  if (activeInstance2?.config.devMode) {
1725
1759
  console.log("[ChatPanel] SDK event:", evt.type, JSON.stringify(evt).slice(0, 200));
1726
1760
  }
@@ -1772,17 +1806,17 @@ var ChatPanel = class {
1772
1806
  const stream = activeInstance2?.activeStreams.get(params.streamId);
1773
1807
  if (stream) {
1774
1808
  stream.cancelled = true;
1775
- if (stream.runId) {
1809
+ if (stream.runId && !stream.cancelSignalSent) {
1776
1810
  const sdk = activeInstance2?.getSdk();
1777
1811
  if (sdk) {
1778
1812
  try {
1779
1813
  sdk.cancelRun(stream.runId);
1814
+ stream.cancelSignalSent = true;
1780
1815
  } catch (e) {
1781
1816
  console.warn("[ChatPanel] Failed to cancel run:", e);
1782
1817
  }
1783
1818
  }
1784
1819
  }
1785
- activeInstance2?.activeStreams.delete(params.streamId);
1786
1820
  }
1787
1821
  return { success: true };
1788
1822
  });
@@ -8130,15 +8130,39 @@ var HitlCard = (0, import_react24.memo)(function HitlCard2({
8130
8130
  }
8131
8131
  };
8132
8132
  const cardBg = isDarkMode ? "bg-zinc-800" : "bg-white";
8133
- const cardBorder = isDarkMode ? "border-zinc-700" : "border-zinc-200";
8133
+ const cardBorder = isDarkMode ? "border-zinc-600" : "border-zinc-300";
8134
8134
  const textPrimary = isDarkMode ? "text-zinc-100" : "text-zinc-900";
8135
8135
  const textSecondary = isDarkMode ? "text-zinc-400" : "text-zinc-500";
8136
8136
  const inputBg = isDarkMode ? "bg-zinc-900" : "bg-zinc-50";
8137
8137
  const inputBorder = isDarkMode ? "border-zinc-600" : "border-zinc-300";
8138
+ const optionControlStyle = {
8139
+ accentColor: "var(--chat-accent, #2563eb)",
8140
+ width: "1.125rem",
8141
+ height: "1.125rem",
8142
+ margin: 0,
8143
+ flexShrink: 0
8144
+ };
8145
+ const cardStyle = {
8146
+ background: isDarkMode ? "rgba(24, 24, 27, 0.98)" : "#ffffff",
8147
+ borderColor: isDarkMode ? "rgba(212, 212, 216, 0.2)" : "rgba(63, 63, 70, 0.22)",
8148
+ boxShadow: isDarkMode ? "0 12px 30px rgba(0, 0, 0, 0.4)" : "0 10px 24px rgba(15, 23, 42, 0.14)"
8149
+ };
8150
+ const questionStyle = {
8151
+ fontSize: "1rem",
8152
+ lineHeight: 1.55,
8153
+ letterSpacing: "0.01em"
8154
+ };
8155
+ const questionIconStyle = {
8156
+ background: isDarkMode ? "rgba(59, 130, 246, 0.26)" : "rgba(59, 130, 246, 0.16)",
8157
+ color: isDarkMode ? "#dbeafe" : "#1d4ed8"
8158
+ };
8159
+ const cancelButtonClass = isDarkMode ? "flex-1 rounded-lg border border-zinc-500 bg-zinc-700/80 px-3 py-2 text-sm font-semibold text-zinc-100 transition-colors hover:bg-zinc-600" : "flex-1 rounded-lg border border-zinc-300 bg-zinc-100 px-3 py-2 text-sm font-semibold text-zinc-900 transition-colors hover:bg-zinc-200";
8160
+ const submitButtonClass = `flex-1 rounded-lg px-3 py-2 text-sm font-semibold ${isApproval && riskLevel === "high" ? "bg-red-600 hover:bg-red-700" : "bg-blue-600 hover:bg-blue-700"} text-white shadow-sm transition-colors disabled:cursor-not-allowed disabled:opacity-45`;
8138
8161
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
8139
8162
  "div",
8140
8163
  {
8141
8164
  className: `rounded-xl border ${cardBorder} ${cardBg} p-3 shadow-sm`,
8165
+ style: cardStyle,
8142
8166
  role: "dialog",
8143
8167
  "aria-modal": "true",
8144
8168
  "aria-label": isApproval ? t.approvalRequest : t.inputRequest,
@@ -8153,7 +8177,7 @@ var HitlCard = (0, import_react24.memo)(function HitlCard2({
8153
8177
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "capitalize", children: riskLevel })
8154
8178
  ]
8155
8179
  }
8156
- ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-lg", children: "?" }) }),
8180
+ ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "inline-flex h-7 w-7 items-center justify-center rounded-full text-base font-semibold", style: questionIconStyle, children: "?" }) }),
8157
8181
  timeLeft !== null && timeLeft > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: `text-xs ${textSecondary} whitespace-nowrap`, children: [
8158
8182
  t.timeoutIn,
8159
8183
  " ",
@@ -8162,7 +8186,7 @@ var HitlCard = (0, import_react24.memo)(function HitlCard2({
8162
8186
  ] })
8163
8187
  ] }),
8164
8188
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-2", children: [
8165
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: `text-sm font-medium ${textPrimary} break-words`, children: isApproval ? interrupt.reason || `${t.executeTool} ${interrupt.tool}?` : interrupt.question }),
8189
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: `text-sm font-semibold ${textPrimary} break-words`, style: questionStyle, children: isApproval ? interrupt.reason || `${t.executeTool} ${interrupt.tool}?` : interrupt.question }),
8166
8190
  isUserInput && interrupt.context && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `text-xs ${textSecondary} rounded p-2 ${inputBg} break-words`, children: interrupt.context }),
8167
8191
  isApproval && interrupt.tool && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `text-xs ${textSecondary} rounded p-2 ${inputBg} space-y-1`, children: [
8168
8192
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
@@ -8182,26 +8206,31 @@ var HitlCard = (0, import_react24.memo)(function HitlCard2({
8182
8206
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("code", { className: "text-[10px]", children: JSON.stringify(interrupt.args, null, 0) })
8183
8207
  ] })
8184
8208
  ] }),
8185
- isUserInput && interrupt.options && interrupt.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "space-y-1.5", children: interrupt.options.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
8186
- "label",
8187
- {
8188
- className: `flex cursor-pointer items-center gap-2 rounded p-2 transition-colors ${selectedIndices.includes(index) ? isDarkMode ? "border-blue-500/50 bg-blue-500/20" : "border-blue-200 bg-blue-50" : `${inputBg} border-transparent hover:border-zinc-300`} border`,
8189
- children: [
8190
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8191
- "input",
8192
- {
8193
- type: interrupt.multi_select ? "checkbox" : "radio",
8194
- name: "hitl-options",
8195
- checked: selectedIndices.includes(index),
8196
- onChange: () => handleOptionToggle(index),
8197
- className: "shrink-0"
8198
- }
8199
- ),
8200
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: `text-sm ${textPrimary} break-words`, children: option })
8201
- ]
8202
- },
8203
- index
8204
- )) }),
8209
+ isUserInput && interrupt.options && interrupt.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "space-y-1.5", children: interrupt.options.map((option, index) => {
8210
+ const isSelected = selectedIndices.includes(index);
8211
+ const optionStyle = isSelected ? isDarkMode ? { borderColor: "rgba(96, 165, 250, 0.75)", background: "rgba(59, 130, 246, 0.24)" } : { borderColor: "rgba(37, 99, 235, 0.36)", background: "rgba(239, 246, 255, 0.98)" } : isDarkMode ? { borderColor: "rgba(113, 113, 122, 0.6)", background: "rgba(9, 9, 11, 0.84)" } : { borderColor: "rgba(113, 113, 122, 0.34)", background: "rgba(250, 250, 250, 0.96)" };
8212
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
8213
+ "label",
8214
+ {
8215
+ className: `flex cursor-pointer items-center gap-2 rounded p-2 transition-colors ${isSelected ? isDarkMode ? "border-blue-500/50 bg-blue-500/20" : "border-blue-200 bg-blue-50" : `${inputBg} border-transparent hover:border-zinc-300`} border`,
8216
+ style: optionStyle,
8217
+ children: [
8218
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8219
+ "input",
8220
+ {
8221
+ type: interrupt.multi_select ? "checkbox" : "radio",
8222
+ name: "hitl-options",
8223
+ checked: isSelected,
8224
+ onChange: () => handleOptionToggle(index),
8225
+ style: optionControlStyle
8226
+ }
8227
+ ),
8228
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: `text-sm ${textPrimary} break-words ${isSelected ? "font-semibold" : "font-medium"}`, children: option })
8229
+ ]
8230
+ },
8231
+ index
8232
+ );
8233
+ }) }),
8205
8234
  isUserInput && (!interrupt.options || interrupt.options.length === 0) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
8206
8235
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
8207
8236
  "input",
@@ -8244,8 +8273,7 @@ var HitlCard = (0, import_react24.memo)(function HitlCard2({
8244
8273
  "button",
8245
8274
  {
8246
8275
  onClick: handleCancel,
8247
- style: { color: isDarkMode ? "#f4f4f5" : "#18181b" },
8248
- className: "flex-1 rounded-lg border border-zinc-600 px-3 py-2 text-sm font-medium transition-colors hover:bg-zinc-700",
8276
+ className: cancelButtonClass,
8249
8277
  children: isApproval ? t.reject : t.cancel
8250
8278
  }
8251
8279
  ),
@@ -8254,7 +8282,7 @@ var HitlCard = (0, import_react24.memo)(function HitlCard2({
8254
8282
  {
8255
8283
  onClick: handleSubmit,
8256
8284
  disabled: isUserInput && interrupt.required && !answer.trim() && (!interrupt.options || selectedIndices.length === 0),
8257
- className: `flex-1 rounded-lg px-3 py-2 text-sm font-medium ${isApproval && riskLevel === "high" ? "bg-red-500 hover:bg-red-600" : "bg-blue-500 hover:bg-blue-600"} text-white transition-colors disabled:cursor-not-allowed disabled:opacity-40`,
8285
+ className: submitButtonClass,
8258
8286
  children: isApproval ? t.approve : t.submit
8259
8287
  }
8260
8288
  )
@@ -8058,15 +8058,39 @@ var HitlCard = memo8(function HitlCard2({
8058
8058
  }
8059
8059
  };
8060
8060
  const cardBg = isDarkMode ? "bg-zinc-800" : "bg-white";
8061
- const cardBorder = isDarkMode ? "border-zinc-700" : "border-zinc-200";
8061
+ const cardBorder = isDarkMode ? "border-zinc-600" : "border-zinc-300";
8062
8062
  const textPrimary = isDarkMode ? "text-zinc-100" : "text-zinc-900";
8063
8063
  const textSecondary = isDarkMode ? "text-zinc-400" : "text-zinc-500";
8064
8064
  const inputBg = isDarkMode ? "bg-zinc-900" : "bg-zinc-50";
8065
8065
  const inputBorder = isDarkMode ? "border-zinc-600" : "border-zinc-300";
8066
+ const optionControlStyle = {
8067
+ accentColor: "var(--chat-accent, #2563eb)",
8068
+ width: "1.125rem",
8069
+ height: "1.125rem",
8070
+ margin: 0,
8071
+ flexShrink: 0
8072
+ };
8073
+ const cardStyle = {
8074
+ background: isDarkMode ? "rgba(24, 24, 27, 0.98)" : "#ffffff",
8075
+ borderColor: isDarkMode ? "rgba(212, 212, 216, 0.2)" : "rgba(63, 63, 70, 0.22)",
8076
+ boxShadow: isDarkMode ? "0 12px 30px rgba(0, 0, 0, 0.4)" : "0 10px 24px rgba(15, 23, 42, 0.14)"
8077
+ };
8078
+ const questionStyle = {
8079
+ fontSize: "1rem",
8080
+ lineHeight: 1.55,
8081
+ letterSpacing: "0.01em"
8082
+ };
8083
+ const questionIconStyle = {
8084
+ background: isDarkMode ? "rgba(59, 130, 246, 0.26)" : "rgba(59, 130, 246, 0.16)",
8085
+ color: isDarkMode ? "#dbeafe" : "#1d4ed8"
8086
+ };
8087
+ const cancelButtonClass = isDarkMode ? "flex-1 rounded-lg border border-zinc-500 bg-zinc-700/80 px-3 py-2 text-sm font-semibold text-zinc-100 transition-colors hover:bg-zinc-600" : "flex-1 rounded-lg border border-zinc-300 bg-zinc-100 px-3 py-2 text-sm font-semibold text-zinc-900 transition-colors hover:bg-zinc-200";
8088
+ const submitButtonClass = `flex-1 rounded-lg px-3 py-2 text-sm font-semibold ${isApproval && riskLevel === "high" ? "bg-red-600 hover:bg-red-700" : "bg-blue-600 hover:bg-blue-700"} text-white shadow-sm transition-colors disabled:cursor-not-allowed disabled:opacity-45`;
8066
8089
  return /* @__PURE__ */ jsxs6(
8067
8090
  "div",
8068
8091
  {
8069
8092
  className: `rounded-xl border ${cardBorder} ${cardBg} p-3 shadow-sm`,
8093
+ style: cardStyle,
8070
8094
  role: "dialog",
8071
8095
  "aria-modal": "true",
8072
8096
  "aria-label": isApproval ? t.approvalRequest : t.inputRequest,
@@ -8081,7 +8105,7 @@ var HitlCard = memo8(function HitlCard2({
8081
8105
  /* @__PURE__ */ jsx12("span", { className: "capitalize", children: riskLevel })
8082
8106
  ]
8083
8107
  }
8084
- ) : /* @__PURE__ */ jsx12("span", { className: "text-lg", children: "?" }) }),
8108
+ ) : /* @__PURE__ */ jsx12("span", { className: "inline-flex h-7 w-7 items-center justify-center rounded-full text-base font-semibold", style: questionIconStyle, children: "?" }) }),
8085
8109
  timeLeft !== null && timeLeft > 0 && /* @__PURE__ */ jsxs6("span", { className: `text-xs ${textSecondary} whitespace-nowrap`, children: [
8086
8110
  t.timeoutIn,
8087
8111
  " ",
@@ -8090,7 +8114,7 @@ var HitlCard = memo8(function HitlCard2({
8090
8114
  ] })
8091
8115
  ] }),
8092
8116
  /* @__PURE__ */ jsxs6("div", { className: "space-y-2", children: [
8093
- /* @__PURE__ */ jsx12("p", { className: `text-sm font-medium ${textPrimary} break-words`, children: isApproval ? interrupt.reason || `${t.executeTool} ${interrupt.tool}?` : interrupt.question }),
8117
+ /* @__PURE__ */ jsx12("p", { className: `text-sm font-semibold ${textPrimary} break-words`, style: questionStyle, children: isApproval ? interrupt.reason || `${t.executeTool} ${interrupt.tool}?` : interrupt.question }),
8094
8118
  isUserInput && interrupt.context && /* @__PURE__ */ jsx12("div", { className: `text-xs ${textSecondary} rounded p-2 ${inputBg} break-words`, children: interrupt.context }),
8095
8119
  isApproval && interrupt.tool && /* @__PURE__ */ jsxs6("div", { className: `text-xs ${textSecondary} rounded p-2 ${inputBg} space-y-1`, children: [
8096
8120
  /* @__PURE__ */ jsxs6("div", { children: [
@@ -8110,26 +8134,31 @@ var HitlCard = memo8(function HitlCard2({
8110
8134
  /* @__PURE__ */ jsx12("code", { className: "text-[10px]", children: JSON.stringify(interrupt.args, null, 0) })
8111
8135
  ] })
8112
8136
  ] }),
8113
- isUserInput && interrupt.options && interrupt.options.length > 0 && /* @__PURE__ */ jsx12("div", { className: "space-y-1.5", children: interrupt.options.map((option, index) => /* @__PURE__ */ jsxs6(
8114
- "label",
8115
- {
8116
- className: `flex cursor-pointer items-center gap-2 rounded p-2 transition-colors ${selectedIndices.includes(index) ? isDarkMode ? "border-blue-500/50 bg-blue-500/20" : "border-blue-200 bg-blue-50" : `${inputBg} border-transparent hover:border-zinc-300`} border`,
8117
- children: [
8118
- /* @__PURE__ */ jsx12(
8119
- "input",
8120
- {
8121
- type: interrupt.multi_select ? "checkbox" : "radio",
8122
- name: "hitl-options",
8123
- checked: selectedIndices.includes(index),
8124
- onChange: () => handleOptionToggle(index),
8125
- className: "shrink-0"
8126
- }
8127
- ),
8128
- /* @__PURE__ */ jsx12("span", { className: `text-sm ${textPrimary} break-words`, children: option })
8129
- ]
8130
- },
8131
- index
8132
- )) }),
8137
+ isUserInput && interrupt.options && interrupt.options.length > 0 && /* @__PURE__ */ jsx12("div", { className: "space-y-1.5", children: interrupt.options.map((option, index) => {
8138
+ const isSelected = selectedIndices.includes(index);
8139
+ const optionStyle = isSelected ? isDarkMode ? { borderColor: "rgba(96, 165, 250, 0.75)", background: "rgba(59, 130, 246, 0.24)" } : { borderColor: "rgba(37, 99, 235, 0.36)", background: "rgba(239, 246, 255, 0.98)" } : isDarkMode ? { borderColor: "rgba(113, 113, 122, 0.6)", background: "rgba(9, 9, 11, 0.84)" } : { borderColor: "rgba(113, 113, 122, 0.34)", background: "rgba(250, 250, 250, 0.96)" };
8140
+ return /* @__PURE__ */ jsxs6(
8141
+ "label",
8142
+ {
8143
+ className: `flex cursor-pointer items-center gap-2 rounded p-2 transition-colors ${isSelected ? isDarkMode ? "border-blue-500/50 bg-blue-500/20" : "border-blue-200 bg-blue-50" : `${inputBg} border-transparent hover:border-zinc-300`} border`,
8144
+ style: optionStyle,
8145
+ children: [
8146
+ /* @__PURE__ */ jsx12(
8147
+ "input",
8148
+ {
8149
+ type: interrupt.multi_select ? "checkbox" : "radio",
8150
+ name: "hitl-options",
8151
+ checked: isSelected,
8152
+ onChange: () => handleOptionToggle(index),
8153
+ style: optionControlStyle
8154
+ }
8155
+ ),
8156
+ /* @__PURE__ */ jsx12("span", { className: `text-sm ${textPrimary} break-words ${isSelected ? "font-semibold" : "font-medium"}`, children: option })
8157
+ ]
8158
+ },
8159
+ index
8160
+ );
8161
+ }) }),
8133
8162
  isUserInput && (!interrupt.options || interrupt.options.length === 0) && /* @__PURE__ */ jsxs6("div", { children: [
8134
8163
  /* @__PURE__ */ jsx12(
8135
8164
  "input",
@@ -8172,8 +8201,7 @@ var HitlCard = memo8(function HitlCard2({
8172
8201
  "button",
8173
8202
  {
8174
8203
  onClick: handleCancel,
8175
- style: { color: isDarkMode ? "#f4f4f5" : "#18181b" },
8176
- className: "flex-1 rounded-lg border border-zinc-600 px-3 py-2 text-sm font-medium transition-colors hover:bg-zinc-700",
8204
+ className: cancelButtonClass,
8177
8205
  children: isApproval ? t.reject : t.cancel
8178
8206
  }
8179
8207
  ),
@@ -8182,7 +8210,7 @@ var HitlCard = memo8(function HitlCard2({
8182
8210
  {
8183
8211
  onClick: handleSubmit,
8184
8212
  disabled: isUserInput && interrupt.required && !answer.trim() && (!interrupt.options || selectedIndices.length === 0),
8185
- className: `flex-1 rounded-lg px-3 py-2 text-sm font-medium ${isApproval && riskLevel === "high" ? "bg-red-500 hover:bg-red-600" : "bg-blue-500 hover:bg-blue-600"} text-white transition-colors disabled:cursor-not-allowed disabled:opacity-40`,
8213
+ className: submitButtonClass,
8186
8214
  children: isApproval ? t.approve : t.submit
8187
8215
  }
8188
8216
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yushaw/sanqian-chat",
3
- "version": "0.2.23",
3
+ "version": "0.2.24",
4
4
  "description": "Floating chat window SDK for Sanqian AI Assistant",
5
5
  "main": "./dist/main/index.js",
6
6
  "types": "./dist/main/index.d.ts",