@nextclaw/ncp-react 0.4.13 → 0.4.14

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 CHANGED
@@ -21,13 +21,12 @@ type UseHydratedNcpAgentOptions = {
21
21
  sessionId: string;
22
22
  client: NcpAgentClientEndpoint;
23
23
  loadSeed: NcpConversationSeedLoader;
24
- autoResumeRunningSession?: boolean;
25
24
  };
26
25
  type UseHydratedNcpAgentResult = UseNcpAgentResult & {
27
26
  isHydrating: boolean;
28
27
  hydrateError: Error | null;
29
28
  };
30
- declare function useHydratedNcpAgent({ sessionId, client, loadSeed, autoResumeRunningSession, }: UseHydratedNcpAgentOptions): UseHydratedNcpAgentResult;
29
+ declare function useHydratedNcpAgent({ sessionId, client, loadSeed, }: UseHydratedNcpAgentOptions): UseHydratedNcpAgentResult;
31
30
 
32
31
  declare function useNcpAgent(sessionId: string, client: NcpAgentClientEndpoint): UseNcpAgentResult;
33
32
 
package/dist/index.js CHANGED
@@ -187,9 +187,7 @@ function useNcpAgentRuntime({
187
187
  await client.abort({ sessionId });
188
188
  };
189
189
  const streamRun = async () => {
190
- if (!snapshot.activeRun) {
191
- return;
192
- }
190
+ await client.stop();
193
191
  await client.stream({ sessionId });
194
192
  };
195
193
  return {
@@ -214,14 +212,15 @@ function resolveSessionHydratingState(params) {
214
212
  function useHydratedNcpAgent({
215
213
  sessionId,
216
214
  client,
217
- loadSeed,
218
- autoResumeRunningSession = true
215
+ loadSeed
219
216
  }) {
220
217
  const manager = useScopedAgentManager(sessionId);
221
218
  const runtime = useNcpAgentRuntime({ sessionId, client, manager });
222
219
  const [isHydrating, setIsHydrating] = useState2(true);
223
220
  const [hydrateError, setHydrateError] = useState2(null);
224
- const [hydratedSessionId, setHydratedSessionId] = useState2(null);
221
+ const [hydratedSessionId, setHydratedSessionId] = useState2(
222
+ null
223
+ );
225
224
  const loadStateRef = useRef2({ requestId: 0, controller: null });
226
225
  const hydrateSeed = useCallback(async () => {
227
226
  loadStateRef.current.controller?.abort();
@@ -252,14 +251,12 @@ function useHydratedNcpAgent({
252
251
  setHydrateError(null);
253
252
  setHydratedSessionId(sessionId);
254
253
  setIsHydrating(false);
255
- if (seed.status === "running" && autoResumeRunningSession) {
256
- void client.stream({ sessionId }).catch((error) => {
257
- if (loadStateRef.current.requestId !== requestId) {
258
- return;
259
- }
260
- setHydrateError(toError(error));
261
- });
262
- }
254
+ void client.stream({ sessionId }).catch((error) => {
255
+ if (loadStateRef.current.requestId !== requestId) {
256
+ return;
257
+ }
258
+ setHydrateError(toError(error));
259
+ });
263
260
  } catch (error) {
264
261
  if (controller.signal.aborted || loadStateRef.current.requestId !== requestId) {
265
262
  return;
@@ -272,7 +269,7 @@ function useHydratedNcpAgent({
272
269
  loadStateRef.current.controller = null;
273
270
  }
274
271
  }
275
- }, [autoResumeRunningSession, client, loadSeed, manager, sessionId]);
272
+ }, [client, loadSeed, manager, sessionId]);
276
273
  useEffect2(() => {
277
274
  void hydrateSeed();
278
275
  return () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/ncp-react",
3
- "version": "0.4.13",
3
+ "version": "0.4.14",
4
4
  "private": false,
5
5
  "description": "React bindings for building NCP-based agent applications.",
6
6
  "type": "module",
@@ -16,7 +16,7 @@
16
16
  ],
17
17
  "dependencies": {
18
18
  "@nextclaw/ncp": "0.4.6",
19
- "@nextclaw/ncp-toolkit": "0.4.16"
19
+ "@nextclaw/ncp-toolkit": "0.4.17"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "react": "^18.0.0 || ^19.0.0"