@nextclaw/ncp-agent-runtime 0.3.11 → 0.3.13
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/index.js +18 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -817,6 +817,20 @@ function* flushTextDeltas(ctx, state) {
|
|
|
817
817
|
textStarted
|
|
818
818
|
};
|
|
819
819
|
}
|
|
820
|
+
function* closeTextPartBeforeToolCalls(delta, ctx, state) {
|
|
821
|
+
if (!Array.isArray(delta.tool_calls) || delta.tool_calls.length === 0) return state;
|
|
822
|
+
let nextState = state;
|
|
823
|
+
if (nextState.normalizer) nextState = yield* flushTextDeltas(ctx, nextState);
|
|
824
|
+
if (!nextState.textStarted) return nextState;
|
|
825
|
+
yield {
|
|
826
|
+
type: NcpEventType.MessageTextEnd,
|
|
827
|
+
payload: ctx
|
|
828
|
+
};
|
|
829
|
+
return {
|
|
830
|
+
...nextState,
|
|
831
|
+
textStarted: false
|
|
832
|
+
};
|
|
833
|
+
}
|
|
820
834
|
function* emitReasoningDelta(delta, ctx) {
|
|
821
835
|
const reasoning = delta.reasoning_content ?? delta.reasoning;
|
|
822
836
|
if (typeof reasoning !== "string" || !reasoning) return;
|
|
@@ -932,6 +946,10 @@ var DefaultNcpStreamEncoder = class {
|
|
|
932
946
|
sessionId,
|
|
933
947
|
messageId
|
|
934
948
|
}, state);
|
|
949
|
+
state = yield* closeTextPartBeforeToolCalls(delta, {
|
|
950
|
+
sessionId,
|
|
951
|
+
messageId
|
|
952
|
+
}, state);
|
|
935
953
|
yield* emitToolCallDeltas(delta, toolCallBuffers, {
|
|
936
954
|
sessionId,
|
|
937
955
|
messageId
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/ncp-agent-runtime",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.13",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Default agent runtime implementation built on NCP interfaces.",
|
|
6
6
|
"type": "module",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"ajv": "^8.17.1",
|
|
19
|
-
"@nextclaw/ncp": "0.5.
|
|
19
|
+
"@nextclaw/ncp": "0.5.3"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^20.17.6",
|