@neeter/react
Advanced tools
+1
-1
@@ -12,3 +12,3 @@ import "./widgets/AskUserQuestionWidget.js"; | ||
| import "./widgets/WriteWidget.js"; | ||
| export type { ChatMessage, CustomEvent, ModelUsage, PermissionRequest, PermissionResponse, SessionHistoryEntry, SessionInitEvent, SSEEvent, TokenUsage, ToolApprovalRequest, ToolApprovalResponse, ToolCallInfo, ToolCallPhase, TurnCompleteData, UserQuestion, UserQuestionOption, UserQuestionRequest, UserQuestionResponse, } from "@neeter/types"; | ||
| export type { ChatMessage, CustomEvent, ModelUsage, PermissionRequest, PermissionResponse, SessionHistoryEntry, SessionInitEvent, SSEEvent, StopReason, TokenUsage, ToolApprovalRequest, ToolApprovalResponse, ToolCallInfo, ToolCallPhase, TurnCompleteData, UserQuestion, UserQuestionOption, UserQuestionRequest, UserQuestionResponse, } from "@neeter/types"; | ||
| export { AgentProvider, useAgentContext, useChatStore } from "./AgentProvider.js"; | ||
@@ -15,0 +15,0 @@ export { ChatInput } from "./ChatInput.js"; |
+3
-1
@@ -1,2 +0,2 @@ | ||
| import type { ChatMessage, McpServerStatus, ModelUsage, PermissionRequest, SSEEvent, TurnCompleteData } from "@neeter/types"; | ||
| import type { ChatMessage, McpServerStatus, ModelUsage, PermissionRequest, SSEEvent, StopReason, TurnCompleteData } from "@neeter/types"; | ||
| import { type StoreApi } from "zustand/vanilla"; | ||
@@ -20,2 +20,3 @@ interface ChatStoreState { | ||
| modelUsage: Record<string, ModelUsage> | null; | ||
| lastStopReason: StopReason; | ||
| } | ||
@@ -44,2 +45,3 @@ interface ChatStoreActions { | ||
| addCost: (data: TurnCompleteData) => void; | ||
| setStopReason: (reason: StopReason) => void; | ||
| cancelInflightToolCalls: () => void; | ||
@@ -46,0 +48,0 @@ reset: () => void; |
+8
-0
@@ -37,2 +37,3 @@ import { immer } from "zustand/middleware/immer"; | ||
| modelUsage: null, | ||
| lastStopReason: null, | ||
| setSessionId: (id) => set((s) => { | ||
@@ -187,2 +188,5 @@ s.sessionId = id; | ||
| }), | ||
| setStopReason: (reason) => set((s) => { | ||
| s.lastStopReason = reason; | ||
| }), | ||
| cancelInflightToolCalls: () => set((s) => { | ||
@@ -219,2 +223,3 @@ for (const msg of s.messages) { | ||
| s.modelUsage = null; | ||
| s.lastStopReason = null; | ||
| }), | ||
@@ -291,5 +296,7 @@ }))); | ||
| s.flushStreamingText(); | ||
| s.setStopReason(data.stopReason ?? null); | ||
| s.addCost({ | ||
| cost: data.cost ?? 0, | ||
| numTurns: data.numTurns ?? 0, | ||
| stopReason: data.stopReason ?? null, | ||
| usage: data.usage ?? null, | ||
@@ -302,2 +309,3 @@ modelUsage: data.modelUsage ?? null, | ||
| s.flushStreamingText(); | ||
| s.setStopReason(data.stopReason ?? null); | ||
| s.addSystemMessage(`Session ended: ${data.subtype}`); | ||
@@ -304,0 +312,0 @@ break; |
@@ -110,2 +110,3 @@ import { useCallback, useEffect, useRef, useState, useSyncExternalStore } from "react"; | ||
| es.addEventListener("session_error", (e) => { | ||
| const { subtype, stopReason } = JSON.parse(e.data); | ||
| store.getState().flushStreamingThinking(); | ||
@@ -115,2 +116,3 @@ store.getState().flushStreamingText(); | ||
| store.getState().setStreaming(false); | ||
| store.getState().setStopReason(stopReason ?? null); | ||
| if (abortedRef.current) { | ||
@@ -122,3 +124,2 @@ store.getState().cancelInflightToolCalls(); | ||
| else { | ||
| const { subtype } = JSON.parse(e.data); | ||
| store.getState().addSystemMessage(`Session ended: ${subtype}`); | ||
@@ -133,5 +134,7 @@ } | ||
| store.getState().setStreaming(false); | ||
| store.getState().setStopReason(data.stopReason ?? null); | ||
| store.getState().addCost({ | ||
| cost: data.cost ?? 0, | ||
| numTurns: data.numTurns ?? 0, | ||
| stopReason: data.stopReason ?? null, | ||
| usage: data.usage ?? null, | ||
@@ -138,0 +141,0 @@ modelUsage: data.modelUsage ?? null, |
+2
-2
| { | ||
| "name": "@neeter/react", | ||
| "version": "0.14.0", | ||
| "version": "0.15.0", | ||
| "description": "React components and hooks for building chat UIs on top of the Claude Agent SDK", | ||
@@ -29,3 +29,3 @@ "license": "MIT", | ||
| "tailwind-merge": "^3.5.0", | ||
| "@neeter/types": "0.14.0" | ||
| "@neeter/types": "0.15.0" | ||
| }, | ||
@@ -32,0 +32,0 @@ "peerDependencies": { |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
113187
0.57%2164
0.6%+ Added
- Removed
Updated