@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 +18 -14
- package/dist/plugin2.js +18 -14
- package/package.json +1 -1
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
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
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
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
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", {
|