@lota-sdk/ui 0.1.14 → 0.1.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lota-sdk/ui",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -25,8 +25,8 @@
25
25
  "registry": "https://registry.npmjs.org/"
26
26
  },
27
27
  "dependencies": {
28
- "@lota-sdk/shared": "0.1.14",
29
- "ai": "^6.0.116"
28
+ "@lota-sdk/shared": "0.1.15",
29
+ "ai": "^6.0.134"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@ai-sdk/react": "^3.0.118",
@@ -34,8 +34,8 @@
34
34
  "react": "^19.2.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@ai-sdk/react": "^3.0.118",
38
- "@tanstack/react-query": "^5.90.21",
37
+ "@ai-sdk/react": "^3.0.136",
38
+ "@tanstack/react-query": "^5.91.3",
39
39
  "@types/react": "^19.2.14",
40
40
  "react": "^19.2.4"
41
41
  }
@@ -19,24 +19,6 @@ export function getLatestAssistantMessage<TMessage extends UIMessage>(messages:
19
19
  return null
20
20
  }
21
21
 
22
- export function readLatestDataPart<TData = unknown, TMessage extends UIMessage = UIMessage>(
23
- messages: TMessage[],
24
- dataPartType: `data-${string}`,
25
- ): TData | null {
26
- for (let messageIndex = messages.length - 1; messageIndex >= 0; messageIndex -= 1) {
27
- const message = messages[messageIndex]
28
- if (message.role !== 'assistant') continue
29
-
30
- for (let partIndex = message.parts.length - 1; partIndex >= 0; partIndex -= 1) {
31
- const part = message.parts[partIndex]
32
- if (part.type !== dataPartType || !('data' in part)) continue
33
- return part.data as TData
34
- }
35
- }
36
-
37
- return null
38
- }
39
-
40
22
  export function readLatestToolOutput<TOutput = unknown, TMessage extends UIMessage = UIMessage>(
41
23
  messages: TMessage[],
42
24
  toolName: string,
@@ -24,7 +24,7 @@ export interface UseThreadManagementOptions<TThread extends ThreadManagementItem
24
24
  isRefetchingThreads: boolean
25
25
  hasMoreThreads: boolean
26
26
  isFetchingNextThreadsPage: boolean
27
- fetchNextThreadsPageRaw: () => Promise<unknown> | void
27
+ fetchNextThreadsPageRaw: () => Promise<void>
28
28
  createThread: () => Promise<{ id: string }>
29
29
  renameThread: (params: { threadId: string; title: string }) => Promise<unknown>
30
30
  archiveThread: (threadId: string) => Promise<unknown>
@@ -255,7 +255,9 @@ export function useThreadManagement<TThread extends ThreadManagementItem<TAgentI
255
255
  isCreatingThreadRef.current = true
256
256
 
257
257
  handleCreateNewThread()
258
- .catch(() => {})
258
+ .catch(() => {
259
+ // Error already forwarded to notifyBackgroundError in handleCreateNewThread
260
+ })
259
261
  .finally(() => {
260
262
  isCreatingThreadRef.current = false
261
263
  })
@@ -1,8 +1,12 @@
1
1
  import type { ExecutionPlanToolResultData, SerializablePlanNode } from '@lota-sdk/shared'
2
2
 
3
+ function isExecutionPlanResult(value: unknown): value is ExecutionPlanToolResultData {
4
+ return value !== null && value !== undefined && typeof value === 'object' && 'hasPlan' in value
5
+ }
6
+
3
7
  export function getLatestExecutionPlanResult(output: unknown): ExecutionPlanToolResultData | null {
4
- if (output && typeof output === 'object' && 'hasPlan' in output) {
5
- return output as ExecutionPlanToolResultData
8
+ if (isExecutionPlanResult(output)) {
9
+ return output
6
10
  }
7
11
 
8
12
  if (Array.isArray(output)) {