@alfe.ai/openclaw-chat 0.5.0 → 0.5.1

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/plugin2.cjs CHANGED
@@ -1441,6 +1441,7 @@ async function handleAgentRequest(request, log) {
1441
1441
  sessionKey: null
1442
1442
  };
1443
1443
  let lastThinkingLen = 0;
1444
+ let sawStructuredThinking = false;
1444
1445
  const turnThinking = {
1445
1446
  text: "",
1446
1447
  ts: 0
@@ -1497,20 +1498,22 @@ async function handleAgentRequest(request, log) {
1497
1498
  const { visible, thinking } = splitThinkTags(raw);
1498
1499
  if (thinking.length > lastThinkingLen) {
1499
1500
  const thinkingDelta = thinking.slice(lastThinkingLen);
1500
- chatClient?.sendEvent("chat-activity", {
1501
- runId: evt.runId,
1502
- sessionKey: legacySessionKey,
1503
- seq: evt.seq,
1504
- state: "activity",
1505
- activity: {
1506
- kind: "thinking",
1507
- text: thinkingDelta,
1508
- delta: true,
1509
- ts: evt.ts,
1510
- seq: evt.seq
1511
- }
1512
- });
1513
- recordThinking(thinkingDelta, evt.ts);
1501
+ if (!sawStructuredThinking) {
1502
+ chatClient?.sendEvent("chat-activity", {
1503
+ runId: evt.runId,
1504
+ sessionKey: legacySessionKey,
1505
+ seq: evt.seq,
1506
+ state: "activity",
1507
+ activity: {
1508
+ kind: "thinking",
1509
+ text: thinkingDelta,
1510
+ delta: true,
1511
+ ts: evt.ts,
1512
+ seq: evt.seq
1513
+ }
1514
+ });
1515
+ recordThinking(thinkingDelta, evt.ts);
1516
+ }
1514
1517
  lastThinkingLen = thinking.length;
1515
1518
  }
1516
1519
  const message = visible === raw && thinking.length === 0 ? evt.data : rewriteAssistantText(evt.data, visible);
@@ -1524,6 +1527,7 @@ async function handleAgentRequest(request, log) {
1524
1527
  return;
1525
1528
  }
1526
1529
  if (evt.stream === "thinking") {
1530
+ sawStructuredThinking = true;
1527
1531
  const activity = buildThinkingActivity(evt.data);
1528
1532
  if (activity) {
1529
1533
  chatClient?.sendEvent("chat-activity", {
package/dist/plugin2.js CHANGED
@@ -1441,6 +1441,7 @@ async function handleAgentRequest(request, log) {
1441
1441
  sessionKey: null
1442
1442
  };
1443
1443
  let lastThinkingLen = 0;
1444
+ let sawStructuredThinking = false;
1444
1445
  const turnThinking = {
1445
1446
  text: "",
1446
1447
  ts: 0
@@ -1497,20 +1498,22 @@ async function handleAgentRequest(request, log) {
1497
1498
  const { visible, thinking } = splitThinkTags(raw);
1498
1499
  if (thinking.length > lastThinkingLen) {
1499
1500
  const thinkingDelta = thinking.slice(lastThinkingLen);
1500
- chatClient?.sendEvent("chat-activity", {
1501
- runId: evt.runId,
1502
- sessionKey: legacySessionKey,
1503
- seq: evt.seq,
1504
- state: "activity",
1505
- activity: {
1506
- kind: "thinking",
1507
- text: thinkingDelta,
1508
- delta: true,
1509
- ts: evt.ts,
1510
- seq: evt.seq
1511
- }
1512
- });
1513
- recordThinking(thinkingDelta, evt.ts);
1501
+ if (!sawStructuredThinking) {
1502
+ chatClient?.sendEvent("chat-activity", {
1503
+ runId: evt.runId,
1504
+ sessionKey: legacySessionKey,
1505
+ seq: evt.seq,
1506
+ state: "activity",
1507
+ activity: {
1508
+ kind: "thinking",
1509
+ text: thinkingDelta,
1510
+ delta: true,
1511
+ ts: evt.ts,
1512
+ seq: evt.seq
1513
+ }
1514
+ });
1515
+ recordThinking(thinkingDelta, evt.ts);
1516
+ }
1514
1517
  lastThinkingLen = thinking.length;
1515
1518
  }
1516
1519
  const message = visible === raw && thinking.length === 0 ? evt.data : rewriteAssistantText(evt.data, visible);
@@ -1524,6 +1527,7 @@ async function handleAgentRequest(request, log) {
1524
1527
  return;
1525
1528
  }
1526
1529
  if (evt.stream === "thinking") {
1530
+ sawStructuredThinking = true;
1527
1531
  const activity = buildThinkingActivity(evt.data);
1528
1532
  if (activity) {
1529
1533
  chatClient?.sendEvent("chat-activity", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfe.ai/openclaw-chat",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "OpenClaw chat plugin for Alfe — web widget and mobile app channels",
5
5
  "type": "module",
6
6
  "main": "./dist/plugin.js",