@nextclaw/ncp-react 0.4.29 → 0.4.31
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.d.ts +2 -2
- package/dist/index.js +4 -4
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DefaultNcpAgentConversationStateManager } from "@nextclaw/ncp-toolkit";
|
|
2
|
-
import { NcpAgentClientEndpoint, NcpAgentConversationSnapshot, NcpAgentSendEnvelope, NcpMessage, NcpMessagePart } from "@nextclaw/ncp";
|
|
2
|
+
import { NcpAgentClientEndpoint, NcpAgentConversationSnapshot, NcpAgentSendEnvelope, NcpMessage, NcpMessagePart, NcpRunHandle } from "@nextclaw/ncp";
|
|
3
3
|
|
|
4
4
|
//#region src/hooks/use-ncp-agent-runtime.d.ts
|
|
5
5
|
type NcpAgentSendInput = string | NcpAgentSendEnvelope;
|
|
@@ -9,7 +9,7 @@ type UseNcpAgentResult = {
|
|
|
9
9
|
activeRunId: string | null;
|
|
10
10
|
isRunning: boolean;
|
|
11
11
|
isSending: boolean;
|
|
12
|
-
send: (input: NcpAgentSendInput) => Promise<
|
|
12
|
+
send: (input: NcpAgentSendInput) => Promise<NcpRunHandle | null>;
|
|
13
13
|
abort: () => Promise<void>;
|
|
14
14
|
streamRun: () => Promise<void>;
|
|
15
15
|
};
|
package/dist/index.js
CHANGED
|
@@ -132,9 +132,9 @@ function useNcpAgentRuntime({ sessionId, client, manager }) {
|
|
|
132
132
|
const activeRunId = snapshot.activeRun?.runId ?? null;
|
|
133
133
|
const isRunning = !!snapshot.activeRun;
|
|
134
134
|
const send = async (input) => {
|
|
135
|
-
if (isSending || isRunning) return;
|
|
135
|
+
if (isSending || isRunning) return null;
|
|
136
136
|
const envelope = normalizeSendEnvelope(input, sessionId);
|
|
137
|
-
if (!envelope) return;
|
|
137
|
+
if (!envelope) return null;
|
|
138
138
|
setIsSending(true);
|
|
139
139
|
if (sessionId) await manager.dispatch({
|
|
140
140
|
type: NcpEventType.MessageSent,
|
|
@@ -148,13 +148,13 @@ function useNcpAgentRuntime({ sessionId, client, manager }) {
|
|
|
148
148
|
}
|
|
149
149
|
});
|
|
150
150
|
try {
|
|
151
|
-
await client.send(envelope);
|
|
151
|
+
return await client.send(envelope);
|
|
152
152
|
} finally {
|
|
153
153
|
setIsSending(false);
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
const abort = async () => {
|
|
157
|
-
if (!
|
|
157
|
+
if (!sessionId) return;
|
|
158
158
|
await client.abort({ sessionId });
|
|
159
159
|
};
|
|
160
160
|
const streamRun = async () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/ncp-react",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.31",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "React bindings for building NCP-based agent applications.",
|
|
6
6
|
"type": "module",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@nextclaw/ncp": "0.5.
|
|
19
|
-
"@nextclaw/ncp-toolkit": "0.5.
|
|
18
|
+
"@nextclaw/ncp": "0.5.11",
|
|
19
|
+
"@nextclaw/ncp-toolkit": "0.5.16"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"react": "^18.0.0 || ^19.0.0"
|