@standardagents/builder 0.12.7 → 0.12.9
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/built-in-routes.js +52 -5
- package/dist/built-in-routes.js.map +1 -1
- package/dist/client/assets/index.css +1 -1
- package/dist/client/index.js +29 -29
- package/dist/client/vendor.js +1 -1
- package/dist/client/vue.js +1 -1
- package/dist/index.js +115 -105
- package/dist/index.js.map +1 -1
- package/dist/plugin.js +115 -105
- package/dist/plugin.js.map +1 -1
- package/package.json +19 -20
package/dist/built-in-routes.js
CHANGED
|
@@ -20824,6 +20824,16 @@ function transformChatAssistantMessage(msg) {
|
|
|
20824
20824
|
}
|
|
20825
20825
|
}));
|
|
20826
20826
|
}
|
|
20827
|
+
if (msg.reasoningDetails && msg.reasoningDetails.length > 0) {
|
|
20828
|
+
message.reasoning_details = msg.reasoningDetails.map((detail) => {
|
|
20829
|
+
if (detail.type === "text") {
|
|
20830
|
+
return { type: "reasoning.text", text: detail.text, format: detail.format };
|
|
20831
|
+
} else if (detail.type === "summary") {
|
|
20832
|
+
return { type: "reasoning.summary", summary: detail.text, format: detail.format };
|
|
20833
|
+
}
|
|
20834
|
+
return { type: "reasoning.encrypted", data: detail.data, id: detail.id, format: detail.format };
|
|
20835
|
+
});
|
|
20836
|
+
}
|
|
20827
20837
|
return message;
|
|
20828
20838
|
}
|
|
20829
20839
|
function transformChatToolMessage(msg) {
|
|
@@ -21058,9 +21068,28 @@ function createChatStreamState() {
|
|
|
21058
21068
|
reasoningContent: "",
|
|
21059
21069
|
hasContent: false,
|
|
21060
21070
|
hasReasoning: false,
|
|
21061
|
-
finishReason: null
|
|
21071
|
+
finishReason: null,
|
|
21072
|
+
reasoningDetails: []
|
|
21062
21073
|
};
|
|
21063
21074
|
}
|
|
21075
|
+
function accumulateReasoningDetail(state, detail) {
|
|
21076
|
+
const idx = detail.index ?? 0;
|
|
21077
|
+
const textContent = detail.text || detail.summary || "";
|
|
21078
|
+
const detailType = detail.type === "reasoning.summary" ? "summary" : "text";
|
|
21079
|
+
const existing = state.reasoningDetails.find(
|
|
21080
|
+
(d) => d.type === detailType && d._index === idx
|
|
21081
|
+
);
|
|
21082
|
+
if (existing && existing.text !== void 0) {
|
|
21083
|
+
existing.text += textContent;
|
|
21084
|
+
} else {
|
|
21085
|
+
state.reasoningDetails.push({
|
|
21086
|
+
type: detailType,
|
|
21087
|
+
text: textContent,
|
|
21088
|
+
format: detail.format,
|
|
21089
|
+
_index: idx
|
|
21090
|
+
});
|
|
21091
|
+
}
|
|
21092
|
+
}
|
|
21064
21093
|
function processChatStreamChunk(chunk, state) {
|
|
21065
21094
|
const chunks = [];
|
|
21066
21095
|
const choice = chunk.choices?.[0];
|
|
@@ -21073,10 +21102,27 @@ function processChatStreamChunk(chunk, state) {
|
|
|
21073
21102
|
state.content += delta.content;
|
|
21074
21103
|
chunks.push({ type: "content-delta", delta: delta.content });
|
|
21075
21104
|
}
|
|
21076
|
-
|
|
21105
|
+
const reasoningText = delta?.reasoning ?? delta?.reasoning_content;
|
|
21106
|
+
if (reasoningText) {
|
|
21077
21107
|
state.hasReasoning = true;
|
|
21078
|
-
state.reasoningContent +=
|
|
21079
|
-
chunks.push({ type: "reasoning-delta", delta:
|
|
21108
|
+
state.reasoningContent += reasoningText;
|
|
21109
|
+
chunks.push({ type: "reasoning-delta", delta: reasoningText });
|
|
21110
|
+
}
|
|
21111
|
+
if (delta?.reasoning_details && Array.isArray(delta.reasoning_details)) {
|
|
21112
|
+
for (const detail of delta.reasoning_details) {
|
|
21113
|
+
if (detail.type === "reasoning.text") {
|
|
21114
|
+
accumulateReasoningDetail(state, detail);
|
|
21115
|
+
} else if (detail.type === "reasoning.summary") {
|
|
21116
|
+
accumulateReasoningDetail(state, detail);
|
|
21117
|
+
} else if (detail.type === "reasoning.encrypted") {
|
|
21118
|
+
state.reasoningDetails.push({
|
|
21119
|
+
type: "encrypted",
|
|
21120
|
+
id: detail.id,
|
|
21121
|
+
data: detail.data,
|
|
21122
|
+
format: detail.format
|
|
21123
|
+
});
|
|
21124
|
+
}
|
|
21125
|
+
}
|
|
21080
21126
|
}
|
|
21081
21127
|
if (delta?.tool_calls) {
|
|
21082
21128
|
for (const tc of delta.tool_calls) {
|
|
@@ -21138,11 +21184,12 @@ function processChatStreamChunk(chunk, state) {
|
|
|
21138
21184
|
}
|
|
21139
21185
|
if (chunk.usage) {
|
|
21140
21186
|
const actualProvider = chunk.model?.split("/")[0] || void 0;
|
|
21187
|
+
const reasoningDetails = state.reasoningDetails.length > 0 ? state.reasoningDetails.map(({ _index, ...d }) => d) : void 0;
|
|
21141
21188
|
chunks.push({
|
|
21142
21189
|
type: "finish",
|
|
21143
21190
|
finishReason: mapChatFinishReason(state.finishReason),
|
|
21144
21191
|
usage: transformChatUsage(chunk.usage, actualProvider),
|
|
21145
|
-
|
|
21192
|
+
reasoningDetails
|
|
21146
21193
|
});
|
|
21147
21194
|
}
|
|
21148
21195
|
return chunks;
|