@assistant-ui/react-ink 0.0.4 → 0.0.6
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/context/AssistantContext.d.ts +1 -1
- package/dist/context/AssistantContext.d.ts.map +1 -1
- package/dist/context/AssistantContext.js +1 -1
- package/dist/context/AssistantContext.js.map +1 -1
- package/dist/index.d.ts +26 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -17
- package/dist/index.js.map +1 -1
- package/dist/primitives/{actionBar/index.d.ts → actionBar.d.ts} +6 -6
- package/dist/primitives/actionBar.d.ts.map +1 -0
- package/dist/primitives/actionBar.js +6 -0
- package/dist/primitives/actionBar.js.map +1 -0
- package/dist/primitives/{attachment/index.d.ts → attachment.d.ts} +5 -5
- package/dist/primitives/attachment.d.ts.map +1 -0
- package/dist/primitives/attachment.js +5 -0
- package/dist/primitives/attachment.js.map +1 -0
- package/dist/primitives/branchPicker/BranchPickerNext.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNext.js +3 -15
- package/dist/primitives/branchPicker/BranchPickerNext.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.d.ts.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerPrevious.js +3 -15
- package/dist/primitives/branchPicker/BranchPickerPrevious.js.map +1 -1
- package/dist/primitives/branchPicker.d.ts +5 -0
- package/dist/primitives/branchPicker.d.ts.map +1 -0
- package/dist/primitives/branchPicker.js +5 -0
- package/dist/primitives/branchPicker.js.map +1 -0
- package/dist/primitives/{chainOfThought/index.d.ts → chainOfThought.d.ts} +3 -3
- package/dist/primitives/chainOfThought.d.ts.map +1 -0
- package/dist/primitives/chainOfThought.js +4 -0
- package/dist/primitives/chainOfThought.js.map +1 -0
- package/dist/primitives/composer.d.ts +8 -0
- package/dist/primitives/composer.d.ts.map +1 -0
- package/dist/primitives/composer.js +8 -0
- package/dist/primitives/composer.js.map +1 -0
- package/dist/primitives/error/ErrorMessage.d.ts +10 -0
- package/dist/primitives/error/ErrorMessage.d.ts.map +1 -0
- package/dist/primitives/error/ErrorMessage.js +11 -0
- package/dist/primitives/error/ErrorMessage.js.map +1 -0
- package/dist/primitives/error/ErrorRoot.d.ts +10 -0
- package/dist/primitives/error/ErrorRoot.d.ts.map +1 -0
- package/dist/primitives/error/ErrorRoot.js +11 -0
- package/dist/primitives/error/ErrorRoot.js.map +1 -0
- package/dist/primitives/error/index.d.ts +3 -0
- package/dist/primitives/error/index.d.ts.map +1 -0
- package/dist/primitives/error/index.js +3 -0
- package/dist/primitives/error/index.js.map +1 -0
- package/dist/primitives/message/MessageError.d.ts +3 -0
- package/dist/primitives/message/MessageError.d.ts.map +1 -0
- package/dist/primitives/message/MessageError.js +7 -0
- package/dist/primitives/message/MessageError.js.map +1 -0
- package/dist/primitives/message/MessageParts.d.ts.map +1 -1
- package/dist/primitives/message/MessageParts.js +5 -1
- package/dist/primitives/message/MessageParts.js.map +1 -1
- package/dist/primitives/message.d.ts +7 -0
- package/dist/primitives/message.d.ts.map +1 -0
- package/dist/primitives/message.js +7 -0
- package/dist/primitives/message.js.map +1 -0
- package/dist/primitives/suggestion/SuggestionTrigger.d.ts +1 -1
- package/dist/primitives/suggestion/SuggestionTrigger.d.ts.map +1 -1
- package/dist/primitives/suggestion/SuggestionTrigger.js +8 -29
- package/dist/primitives/suggestion/SuggestionTrigger.js.map +1 -1
- package/dist/primitives/suggestion.d.ts +4 -0
- package/dist/primitives/suggestion.d.ts.map +1 -0
- package/dist/primitives/suggestion.js +4 -0
- package/dist/primitives/suggestion.js.map +1 -0
- package/dist/primitives/thread/ThreadMessages.d.ts +9 -2
- package/dist/primitives/thread/ThreadMessages.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadMessages.js +18 -18
- package/dist/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.d.ts +1 -1
- package/dist/primitives/thread/ThreadSuggestion.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadSuggestion.js +7 -29
- package/dist/primitives/thread/ThreadSuggestion.js.map +1 -1
- package/dist/primitives/{thread/index.d.ts → thread.d.ts} +6 -6
- package/dist/primitives/thread.d.ts.map +1 -0
- package/dist/primitives/thread.js +8 -0
- package/dist/primitives/thread.js.map +1 -0
- package/dist/primitives/threadList/ThreadListNew.d.ts +1 -1
- package/dist/primitives/threadList/ThreadListNew.d.ts.map +1 -1
- package/dist/primitives/threadList/ThreadListNew.js +3 -7
- package/dist/primitives/threadList/ThreadListNew.js.map +1 -1
- package/dist/primitives/{threadList/index.d.ts → threadList.d.ts} +4 -4
- package/dist/primitives/threadList.d.ts.map +1 -0
- package/dist/primitives/threadList.js +4 -0
- package/dist/primitives/threadList.js.map +1 -0
- package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts +1 -1
- package/dist/primitives/threadListItem/ThreadListItemArchive.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemArchive.js +3 -7
- package/dist/primitives/threadListItem/ThreadListItemArchive.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts +1 -1
- package/dist/primitives/threadListItem/ThreadListItemDelete.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemDelete.js +3 -7
- package/dist/primitives/threadListItem/ThreadListItemDelete.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTrigger.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemTrigger.js +3 -7
- package/dist/primitives/threadListItem/ThreadListItemTrigger.js.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts +1 -1
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.d.ts.map +1 -1
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js +3 -7
- package/dist/primitives/threadListItem/ThreadListItemUnarchive.js.map +1 -1
- package/dist/primitives/threadListItem.d.ts +7 -0
- package/dist/primitives/threadListItem.d.ts.map +1 -0
- package/dist/primitives/threadListItem.js +7 -0
- package/dist/primitives/threadListItem.js.map +1 -0
- package/dist/primitives/toolCall/ToolFallback.d.ts +1 -1
- package/dist/primitives/toolCall/ToolFallback.d.ts.map +1 -1
- package/dist/primitives/toolCall.d.ts +2 -0
- package/dist/primitives/toolCall.d.ts.map +1 -0
- package/dist/primitives/toolCall.js +2 -0
- package/dist/primitives/toolCall.js.map +1 -0
- package/package.json +11 -11
- package/src/context/AssistantContext.tsx +1 -4
- package/src/index.ts +69 -7
- package/src/primitives/{actionBar/index.ts → actionBar.ts} +5 -5
- package/src/primitives/{attachment/index.ts → attachment.ts} +4 -4
- package/src/primitives/branchPicker/BranchPickerNext.tsx +3 -15
- package/src/primitives/branchPicker/BranchPickerPrevious.tsx +3 -15
- package/src/primitives/{branchPicker/index.ts → branchPicker.ts} +4 -4
- package/src/primitives/{chainOfThought/index.ts → chainOfThought.ts} +2 -2
- package/src/primitives/{composer/index.ts → composer.ts} +7 -7
- package/src/primitives/error/ErrorMessage.tsx +17 -0
- package/src/primitives/error/ErrorRoot.tsx +16 -0
- package/src/primitives/error/index.ts +8 -0
- package/src/primitives/message/MessageContent.tsx +1 -1
- package/src/primitives/message/MessageError.tsx +9 -0
- package/src/primitives/message/MessageParts.tsx +10 -4
- package/src/primitives/{message/index.ts → message.ts} +9 -5
- package/src/primitives/suggestion/SuggestionTrigger.tsx +10 -30
- package/src/primitives/{suggestion/index.ts → suggestion.ts} +3 -3
- package/src/primitives/thread/ThreadMessages.tsx +46 -37
- package/src/primitives/thread/ThreadSuggestion.tsx +9 -30
- package/src/primitives/{thread/index.ts → thread.ts} +8 -5
- package/src/primitives/threadList/ThreadListNew.tsx +4 -8
- package/src/primitives/{threadList/index.ts → threadList.ts} +3 -3
- package/src/primitives/threadListItem/ThreadListItemArchive.tsx +4 -8
- package/src/primitives/threadListItem/ThreadListItemDelete.tsx +4 -8
- package/src/primitives/threadListItem/ThreadListItemTrigger.tsx +4 -8
- package/src/primitives/threadListItem/ThreadListItemUnarchive.tsx +4 -8
- package/src/primitives/{threadListItem/index.ts → threadListItem.ts} +5 -5
- package/src/primitives/toolCall/ToolFallback.tsx +1 -1
- package/src/primitives/{toolCall/index.ts → toolCall.ts} +1 -1
- package/dist/client/index.d.ts +0 -5
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js +0 -7
- package/dist/client/index.js.map +0 -1
- package/dist/context/index.d.ts +0 -2
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/index.js +0 -2
- package/dist/context/index.js.map +0 -1
- package/dist/model-context/index.d.ts +0 -9
- package/dist/model-context/index.d.ts.map +0 -1
- package/dist/model-context/index.js +0 -7
- package/dist/model-context/index.js.map +0 -1
- package/dist/primitives/actionBar/index.d.ts.map +0 -1
- package/dist/primitives/actionBar/index.js +0 -6
- package/dist/primitives/actionBar/index.js.map +0 -1
- package/dist/primitives/attachment/index.d.ts.map +0 -1
- package/dist/primitives/attachment/index.js +0 -5
- package/dist/primitives/attachment/index.js.map +0 -1
- package/dist/primitives/branchPicker/index.d.ts +0 -5
- package/dist/primitives/branchPicker/index.d.ts.map +0 -1
- package/dist/primitives/branchPicker/index.js +0 -5
- package/dist/primitives/branchPicker/index.js.map +0 -1
- package/dist/primitives/chainOfThought/index.d.ts.map +0 -1
- package/dist/primitives/chainOfThought/index.js +0 -4
- package/dist/primitives/chainOfThought/index.js.map +0 -1
- package/dist/primitives/composer/index.d.ts +0 -8
- package/dist/primitives/composer/index.d.ts.map +0 -1
- package/dist/primitives/composer/index.js +0 -8
- package/dist/primitives/composer/index.js.map +0 -1
- package/dist/primitives/message/index.d.ts +0 -6
- package/dist/primitives/message/index.d.ts.map +0 -1
- package/dist/primitives/message/index.js +0 -6
- package/dist/primitives/message/index.js.map +0 -1
- package/dist/primitives/suggestion/index.d.ts +0 -4
- package/dist/primitives/suggestion/index.d.ts.map +0 -1
- package/dist/primitives/suggestion/index.js +0 -4
- package/dist/primitives/suggestion/index.js.map +0 -1
- package/dist/primitives/thread/index.d.ts.map +0 -1
- package/dist/primitives/thread/index.js +0 -8
- package/dist/primitives/thread/index.js.map +0 -1
- package/dist/primitives/threadList/index.d.ts.map +0 -1
- package/dist/primitives/threadList/index.js +0 -4
- package/dist/primitives/threadList/index.js.map +0 -1
- package/dist/primitives/threadListItem/index.d.ts +0 -7
- package/dist/primitives/threadListItem/index.d.ts.map +0 -1
- package/dist/primitives/threadListItem/index.js +0 -7
- package/dist/primitives/threadListItem/index.js.map +0 -1
- package/dist/primitives/toolCall/index.d.ts +0 -2
- package/dist/primitives/toolCall/index.d.ts.map +0 -1
- package/dist/primitives/toolCall/index.js +0 -2
- package/dist/primitives/toolCall/index.js.map +0 -1
- package/dist/runtimes/index.d.ts +0 -3
- package/dist/runtimes/index.d.ts.map +0 -1
- package/dist/runtimes/index.js +0 -3
- package/dist/runtimes/index.js.map +0 -1
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -2
- package/dist/types/index.js.map +0 -1
- package/dist/types/scopes/index.d.ts +0 -3
- package/dist/types/scopes/index.d.ts.map +0 -1
- package/dist/types/scopes/index.js +0 -2
- package/dist/types/scopes/index.js.map +0 -1
- package/src/client/index.ts +0 -7
- package/src/context/index.ts +0 -4
- package/src/model-context/index.ts +0 -44
- package/src/runtimes/index.ts +0 -2
- package/src/types/index.ts +0 -23
- package/src/types/scopes/index.ts +0 -59
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assistant-ui/react-ink",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "React Ink (terminal UI) bindings for assistant-ui",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"assistant",
|
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
],
|
|
35
35
|
"sideEffects": false,
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@assistant-ui/core": "^0.1.
|
|
38
|
-
"@assistant-ui/store": "^0.2.
|
|
39
|
-
"@assistant-ui/tap": "^0.5.
|
|
40
|
-
"assistant-stream": "^0.3.
|
|
37
|
+
"@assistant-ui/core": "^0.1.7",
|
|
38
|
+
"@assistant-ui/store": "^0.2.3",
|
|
39
|
+
"@assistant-ui/tap": "^0.5.3",
|
|
40
|
+
"assistant-stream": "^0.3.6",
|
|
41
41
|
"ink-spinner": "^5.0.0",
|
|
42
42
|
"zustand": "^5.0.11"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@types/react": "*",
|
|
46
|
-
"ink": ">=
|
|
47
|
-
"react": "^
|
|
46
|
+
"ink": ">=6",
|
|
47
|
+
"react": "^19"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
50
50
|
"@types/react": {
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/react": "^19.2.14",
|
|
56
|
-
"ink": "^
|
|
56
|
+
"ink": "^6.8.0",
|
|
57
57
|
"ink-testing-library": "^4.0.0",
|
|
58
|
-
"react": "
|
|
59
|
-
"vitest": "^4.0
|
|
60
|
-
"@assistant-ui/x-buildutils": "0.0.
|
|
58
|
+
"react": "^19.1.0",
|
|
59
|
+
"vitest": "^4.1.0",
|
|
60
|
+
"@assistant-ui/x-buildutils": "0.0.3"
|
|
61
61
|
},
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public",
|
package/src/index.ts
CHANGED
|
@@ -91,15 +91,15 @@ export {
|
|
|
91
91
|
type AssistantEventCallback,
|
|
92
92
|
} from "@assistant-ui/store";
|
|
93
93
|
|
|
94
|
-
// Context providers
|
|
95
|
-
export { AssistantRuntimeProvider
|
|
94
|
+
// Context providers
|
|
95
|
+
export { AssistantRuntimeProvider } from "./context/AssistantContext";
|
|
96
96
|
|
|
97
97
|
// Runtime
|
|
98
98
|
export {
|
|
99
99
|
useLocalRuntime,
|
|
100
100
|
type LocalRuntimeOptions,
|
|
101
|
-
|
|
102
|
-
} from "./runtimes";
|
|
101
|
+
} from "./runtimes/useLocalRuntime";
|
|
102
|
+
export { useRemoteThreadListRuntime } from "./runtimes/useRemoteThreadListRuntime";
|
|
103
103
|
|
|
104
104
|
// Primitives
|
|
105
105
|
export * as ThreadPrimitive from "./primitives/thread";
|
|
@@ -113,6 +113,7 @@ export * as ThreadListItemPrimitive from "./primitives/threadListItem";
|
|
|
113
113
|
export * as ChainOfThoughtPrimitive from "./primitives/chainOfThought";
|
|
114
114
|
export * as SuggestionPrimitive from "./primitives/suggestion";
|
|
115
115
|
export * as ToolCallPrimitive from "./primitives/toolCall";
|
|
116
|
+
export * as ErrorPrimitive from "./primitives/error";
|
|
116
117
|
|
|
117
118
|
// Re-export shared providers from core/react
|
|
118
119
|
export {
|
|
@@ -126,6 +127,67 @@ export {
|
|
|
126
127
|
} from "@assistant-ui/core/react";
|
|
127
128
|
|
|
128
129
|
// Model context, tools & clients
|
|
129
|
-
export
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
export {
|
|
131
|
+
makeAssistantTool,
|
|
132
|
+
type AssistantTool,
|
|
133
|
+
makeAssistantToolUI,
|
|
134
|
+
type AssistantToolUI,
|
|
135
|
+
makeAssistantDataUI,
|
|
136
|
+
type AssistantDataUI,
|
|
137
|
+
useAssistantTool,
|
|
138
|
+
type AssistantToolProps,
|
|
139
|
+
useAssistantToolUI,
|
|
140
|
+
type AssistantToolUIProps,
|
|
141
|
+
useAssistantDataUI,
|
|
142
|
+
type AssistantDataUIProps,
|
|
143
|
+
useAssistantInstructions,
|
|
144
|
+
useInlineRender,
|
|
145
|
+
type Toolkit,
|
|
146
|
+
type ToolDefinition,
|
|
147
|
+
Tools,
|
|
148
|
+
DataRenderers,
|
|
149
|
+
} from "@assistant-ui/core/react";
|
|
150
|
+
export type {
|
|
151
|
+
ModelContext,
|
|
152
|
+
ModelContextProvider,
|
|
153
|
+
LanguageModelConfig,
|
|
154
|
+
LanguageModelV1CallSettings,
|
|
155
|
+
} from "@assistant-ui/core";
|
|
156
|
+
export { mergeModelContexts } from "@assistant-ui/core";
|
|
157
|
+
export type { Tool } from "assistant-stream";
|
|
158
|
+
export { tool } from "@assistant-ui/core";
|
|
159
|
+
export { Suggestions, type SuggestionConfig } from "@assistant-ui/core/store";
|
|
160
|
+
export { ModelContextRegistry } from "@assistant-ui/core";
|
|
161
|
+
export type {
|
|
162
|
+
ModelContextRegistryToolHandle,
|
|
163
|
+
ModelContextRegistryInstructionHandle,
|
|
164
|
+
ModelContextRegistryProviderHandle,
|
|
165
|
+
} from "@assistant-ui/core";
|
|
166
|
+
|
|
167
|
+
// Client exports
|
|
168
|
+
export { ModelContext as ModelContextClient } from "@assistant-ui/core/store";
|
|
169
|
+
export { ChainOfThoughtClient } from "@assistant-ui/core/store";
|
|
170
|
+
|
|
171
|
+
// Component types
|
|
172
|
+
export type {
|
|
173
|
+
EmptyMessagePartComponent,
|
|
174
|
+
EmptyMessagePartProps,
|
|
175
|
+
TextMessagePartComponent,
|
|
176
|
+
TextMessagePartProps,
|
|
177
|
+
ReasoningMessagePartComponent,
|
|
178
|
+
ReasoningMessagePartProps,
|
|
179
|
+
ReasoningGroupProps,
|
|
180
|
+
ReasoningGroupComponent,
|
|
181
|
+
SourceMessagePartComponent,
|
|
182
|
+
SourceMessagePartProps,
|
|
183
|
+
ImageMessagePartComponent,
|
|
184
|
+
ImageMessagePartProps,
|
|
185
|
+
FileMessagePartComponent,
|
|
186
|
+
FileMessagePartProps,
|
|
187
|
+
Unstable_AudioMessagePartComponent,
|
|
188
|
+
Unstable_AudioMessagePartProps,
|
|
189
|
+
DataMessagePartComponent,
|
|
190
|
+
DataMessagePartProps,
|
|
191
|
+
ToolCallMessagePartComponent,
|
|
192
|
+
ToolCallMessagePartProps,
|
|
193
|
+
} from "@assistant-ui/core/react";
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
export {
|
|
2
2
|
ActionBarCopy as Copy,
|
|
3
3
|
type ActionBarCopyProps as CopyProps,
|
|
4
|
-
} from "./ActionBarCopy";
|
|
4
|
+
} from "./actionBar/ActionBarCopy";
|
|
5
5
|
export {
|
|
6
6
|
ActionBarEdit as Edit,
|
|
7
7
|
type ActionBarEditProps as EditProps,
|
|
8
|
-
} from "./ActionBarEdit";
|
|
8
|
+
} from "./actionBar/ActionBarEdit";
|
|
9
9
|
export {
|
|
10
10
|
ActionBarReload as Reload,
|
|
11
11
|
type ActionBarReloadProps as ReloadProps,
|
|
12
|
-
} from "./ActionBarReload";
|
|
12
|
+
} from "./actionBar/ActionBarReload";
|
|
13
13
|
export {
|
|
14
14
|
ActionBarFeedbackPositive as FeedbackPositive,
|
|
15
15
|
type ActionBarFeedbackPositiveProps as FeedbackPositiveProps,
|
|
16
|
-
} from "./ActionBarFeedbackPositive";
|
|
16
|
+
} from "./actionBar/ActionBarFeedbackPositive";
|
|
17
17
|
export {
|
|
18
18
|
ActionBarFeedbackNegative as FeedbackNegative,
|
|
19
19
|
type ActionBarFeedbackNegativeProps as FeedbackNegativeProps,
|
|
20
|
-
} from "./ActionBarFeedbackNegative";
|
|
20
|
+
} from "./actionBar/ActionBarFeedbackNegative";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export {
|
|
2
2
|
AttachmentRoot as Root,
|
|
3
3
|
type AttachmentRootProps as RootProps,
|
|
4
|
-
} from "./AttachmentRoot";
|
|
4
|
+
} from "./attachment/AttachmentRoot";
|
|
5
5
|
export {
|
|
6
6
|
AttachmentName as Name,
|
|
7
7
|
type AttachmentNameProps as NameProps,
|
|
8
|
-
} from "./AttachmentName";
|
|
8
|
+
} from "./attachment/AttachmentName";
|
|
9
9
|
export {
|
|
10
10
|
AttachmentThumb as Thumb,
|
|
11
11
|
type AttachmentThumbProps as ThumbProps,
|
|
12
|
-
} from "./AttachmentThumb";
|
|
12
|
+
} from "./attachment/AttachmentThumb";
|
|
13
13
|
export {
|
|
14
14
|
AttachmentRemove as Remove,
|
|
15
15
|
type AttachmentRemoveProps as RemoveProps,
|
|
16
|
-
} from "./AttachmentRemove";
|
|
16
|
+
} from "./attachment/AttachmentRemove";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { useAui, useAuiState } from "@assistant-ui/store";
|
|
2
|
+
import { useBranchPickerNext } from "@assistant-ui/core/react";
|
|
4
3
|
import { Pressable, type PressableProps } from "../internal/Pressable";
|
|
5
4
|
|
|
6
5
|
export type BranchPickerNextProps = Omit<PressableProps, "onPress"> & {
|
|
@@ -12,22 +11,11 @@ export const BranchPickerNext = ({
|
|
|
12
11
|
disabled: disabledProp,
|
|
13
12
|
...pressableProps
|
|
14
13
|
}: BranchPickerNextProps) => {
|
|
15
|
-
const
|
|
16
|
-
const disabled = useAuiState((s) => {
|
|
17
|
-
if (s.message.branchNumber >= s.message.branchCount) return true;
|
|
18
|
-
if (s.thread.isRunning && !s.thread.capabilities.switchBranchDuringRun) {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
return false;
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const goToNext = useCallback(() => {
|
|
25
|
-
aui.message().switchToBranch({ position: "next" });
|
|
26
|
-
}, [aui]);
|
|
14
|
+
const { next, disabled } = useBranchPickerNext();
|
|
27
15
|
|
|
28
16
|
return (
|
|
29
17
|
<Pressable
|
|
30
|
-
onPress={
|
|
18
|
+
onPress={next}
|
|
31
19
|
disabled={disabledProp ?? disabled}
|
|
32
20
|
{...pressableProps}
|
|
33
21
|
>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { useAui, useAuiState } from "@assistant-ui/store";
|
|
2
|
+
import { useBranchPickerPrevious } from "@assistant-ui/core/react";
|
|
4
3
|
import { Pressable, type PressableProps } from "../internal/Pressable";
|
|
5
4
|
|
|
6
5
|
export type BranchPickerPreviousProps = Omit<PressableProps, "onPress"> & {
|
|
@@ -12,22 +11,11 @@ export const BranchPickerPrevious = ({
|
|
|
12
11
|
disabled: disabledProp,
|
|
13
12
|
...pressableProps
|
|
14
13
|
}: BranchPickerPreviousProps) => {
|
|
15
|
-
const
|
|
16
|
-
const disabled = useAuiState((s) => {
|
|
17
|
-
if (s.message.branchNumber <= 1) return true;
|
|
18
|
-
if (s.thread.isRunning && !s.thread.capabilities.switchBranchDuringRun) {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
return false;
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const goToPrevious = useCallback(() => {
|
|
25
|
-
aui.message().switchToBranch({ position: "previous" });
|
|
26
|
-
}, [aui]);
|
|
14
|
+
const { previous, disabled } = useBranchPickerPrevious();
|
|
27
15
|
|
|
28
16
|
return (
|
|
29
17
|
<Pressable
|
|
30
|
-
onPress={
|
|
18
|
+
onPress={previous}
|
|
31
19
|
disabled={disabledProp ?? disabled}
|
|
32
20
|
{...pressableProps}
|
|
33
21
|
>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export {
|
|
2
2
|
BranchPickerPrevious as Previous,
|
|
3
3
|
type BranchPickerPreviousProps as PreviousProps,
|
|
4
|
-
} from "./BranchPickerPrevious";
|
|
4
|
+
} from "./branchPicker/BranchPickerPrevious";
|
|
5
5
|
export {
|
|
6
6
|
BranchPickerNext as Next,
|
|
7
7
|
type BranchPickerNextProps as NextProps,
|
|
8
|
-
} from "./BranchPickerNext";
|
|
8
|
+
} from "./branchPicker/BranchPickerNext";
|
|
9
9
|
export {
|
|
10
10
|
BranchPickerNumber as Number,
|
|
11
11
|
type BranchPickerNumberProps as NumberProps,
|
|
12
|
-
} from "./BranchPickerNumber";
|
|
12
|
+
} from "./branchPicker/BranchPickerNumber";
|
|
13
13
|
export {
|
|
14
14
|
BranchPickerCount as Count,
|
|
15
15
|
type BranchPickerCountProps as CountProps,
|
|
16
|
-
} from "./BranchPickerCount";
|
|
16
|
+
} from "./branchPicker/BranchPickerCount";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export {
|
|
2
2
|
ChainOfThoughtRoot as Root,
|
|
3
3
|
type ChainOfThoughtRootProps as RootProps,
|
|
4
|
-
} from "./ChainOfThoughtRoot";
|
|
4
|
+
} from "./chainOfThought/ChainOfThoughtRoot";
|
|
5
5
|
export {
|
|
6
6
|
ChainOfThoughtAccordionTrigger as AccordionTrigger,
|
|
7
7
|
type ChainOfThoughtAccordionTriggerProps as AccordionTriggerProps,
|
|
8
|
-
} from "./ChainOfThoughtAccordionTrigger";
|
|
8
|
+
} from "./chainOfThought/ChainOfThoughtAccordionTrigger";
|
|
9
9
|
export { ChainOfThoughtPrimitiveParts as Parts } from "@assistant-ui/core/react";
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
export {
|
|
2
2
|
ComposerRoot as Root,
|
|
3
3
|
type ComposerRootProps as RootProps,
|
|
4
|
-
} from "./ComposerRoot";
|
|
4
|
+
} from "./composer/ComposerRoot";
|
|
5
5
|
export {
|
|
6
6
|
ComposerAttachments as Attachments,
|
|
7
7
|
ComposerAttachmentByIndex as AttachmentByIndex,
|
|
8
|
-
} from "./ComposerAttachments";
|
|
8
|
+
} from "./composer/ComposerAttachments";
|
|
9
9
|
export {
|
|
10
10
|
ComposerInput as Input,
|
|
11
11
|
type ComposerInputProps as InputProps,
|
|
12
|
-
} from "./ComposerInput";
|
|
12
|
+
} from "./composer/ComposerInput";
|
|
13
13
|
export {
|
|
14
14
|
ComposerSend as Send,
|
|
15
15
|
type ComposerSendProps as SendProps,
|
|
16
|
-
} from "./ComposerSend";
|
|
16
|
+
} from "./composer/ComposerSend";
|
|
17
17
|
export {
|
|
18
18
|
ComposerCancel as Cancel,
|
|
19
19
|
type ComposerCancelProps as CancelProps,
|
|
20
|
-
} from "./ComposerCancel";
|
|
20
|
+
} from "./composer/ComposerCancel";
|
|
21
21
|
export {
|
|
22
22
|
ComposerAddAttachment as AddAttachment,
|
|
23
23
|
type ComposerAddAttachmentProps as AddAttachmentProps,
|
|
24
|
-
} from "./ComposerAddAttachment";
|
|
25
|
-
export { ComposerIf as If } from "./ComposerIf";
|
|
24
|
+
} from "./composer/ComposerAddAttachment";
|
|
25
|
+
export { ComposerIf as If } from "./composer/ComposerIf";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import { Text } from "ink";
|
|
3
|
+
import { useMessageError } from "@assistant-ui/core/react";
|
|
4
|
+
|
|
5
|
+
export type ErrorMessageProps = ComponentProps<typeof Text> & {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const ErrorMessage = ({ children, ...props }: ErrorMessageProps) => {
|
|
10
|
+
const error = useMessageError();
|
|
11
|
+
|
|
12
|
+
if (error === undefined) return null;
|
|
13
|
+
|
|
14
|
+
return <Text {...props}>{children ?? String(error)}</Text>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
ErrorMessage.displayName = "ErrorPrimitive.Message";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import { Box } from "ink";
|
|
3
|
+
import { useMessageError } from "@assistant-ui/core/react";
|
|
4
|
+
|
|
5
|
+
export type ErrorRootProps = ComponentProps<typeof Box> & {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const ErrorRoot = ({ children, ...props }: ErrorRootProps) => {
|
|
10
|
+
const error = useMessageError();
|
|
11
|
+
if (error === undefined) return null;
|
|
12
|
+
|
|
13
|
+
return <Box {...props}>{children}</Box>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
ErrorRoot.displayName = "ErrorPrimitive.Root";
|
|
@@ -9,7 +9,7 @@ import { useAui, useAuiState } from "@assistant-ui/store";
|
|
|
9
9
|
import type {
|
|
10
10
|
ToolCallMessagePartProps,
|
|
11
11
|
DataMessagePartProps,
|
|
12
|
-
} from "
|
|
12
|
+
} from "@assistant-ui/core/react";
|
|
13
13
|
import { ToolFallback } from "../toolCall/ToolFallback";
|
|
14
14
|
|
|
15
15
|
type MessageContentPart = ThreadUserMessagePart | ThreadAssistantMessagePart;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FC, PropsWithChildren } from "react";
|
|
2
|
+
import { useMessageError } from "@assistant-ui/core/react";
|
|
3
|
+
|
|
4
|
+
export const MessageError: FC<PropsWithChildren> = ({ children }) => {
|
|
5
|
+
const error = useMessageError();
|
|
6
|
+
return error !== undefined ? children : null;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
MessageError.displayName = "MessagePrimitive.Error";
|
|
@@ -19,10 +19,16 @@ export namespace MessagePrimitiveParts {
|
|
|
19
19
|
/**
|
|
20
20
|
* Renders the parts of a message with Ink-specific default components.
|
|
21
21
|
*/
|
|
22
|
-
export const MessagePrimitiveParts: FC<MessagePrimitiveParts.Props> = (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
export const MessagePrimitiveParts: FC<MessagePrimitiveParts.Props> = (
|
|
23
|
+
props,
|
|
24
|
+
) => {
|
|
25
|
+
if ("children" in props) {
|
|
26
|
+
return (
|
|
27
|
+
<MessagePrimitivePartsBase>{props.children}</MessagePrimitivePartsBase>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { components, ...rest } = props;
|
|
26
32
|
const merged = components
|
|
27
33
|
? {
|
|
28
34
|
Text: components.Text ?? inkDefaultComponents.Text,
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
export {
|
|
2
2
|
MessageRoot as Root,
|
|
3
3
|
type MessageRootProps as RootProps,
|
|
4
|
-
} from "./MessageRoot";
|
|
4
|
+
} from "./message/MessageRoot";
|
|
5
5
|
export {
|
|
6
6
|
MessageContent as Content,
|
|
7
7
|
type MessageContentProps as ContentProps,
|
|
8
|
-
} from "./MessageContent";
|
|
8
|
+
} from "./message/MessageContent";
|
|
9
9
|
export {
|
|
10
10
|
MessagePrimitiveParts as Parts,
|
|
11
11
|
MessagePrimitivePartByIndex as PartByIndex,
|
|
12
|
-
} from "./MessageParts";
|
|
13
|
-
export {
|
|
12
|
+
} from "./message/MessageParts";
|
|
13
|
+
export {
|
|
14
|
+
MessageIf as If,
|
|
15
|
+
type MessageIfProps as IfProps,
|
|
16
|
+
} from "./message/MessageIf";
|
|
14
17
|
export {
|
|
15
18
|
MessageAttachments as Attachments,
|
|
16
19
|
MessageAttachmentByIndex as AttachmentByIndex,
|
|
17
|
-
} from "./MessageAttachments";
|
|
20
|
+
} from "./message/MessageAttachments";
|
|
21
|
+
export { MessageError as Error } from "./message/MessageError";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useAuiState
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
3
|
+
import { useSuggestionTrigger } from "@assistant-ui/core/react";
|
|
3
4
|
import { Pressable, type PressableProps } from "../internal/Pressable";
|
|
4
5
|
|
|
5
6
|
export type SuggestionTriggerProps = Omit<PressableProps, "onPress"> & {
|
|
@@ -15,38 +16,17 @@ export const SuggestionTrigger = ({
|
|
|
15
16
|
disabled: disabledProp,
|
|
16
17
|
...pressableProps
|
|
17
18
|
}: SuggestionTriggerProps) => {
|
|
18
|
-
const aui = useAui();
|
|
19
|
-
const isDisabled = useAuiState((s) => s.thread.isDisabled);
|
|
20
19
|
const prompt = useAuiState((s) => s.suggestion.prompt);
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (resolvedSend && !isRunning) {
|
|
27
|
-
aui.thread().append({
|
|
28
|
-
content: [{ type: "text", text: prompt }],
|
|
29
|
-
runConfig: aui.composer().getState().runConfig,
|
|
30
|
-
});
|
|
31
|
-
if (clearComposer) {
|
|
32
|
-
aui.composer().setText("");
|
|
33
|
-
}
|
|
34
|
-
} else {
|
|
35
|
-
if (clearComposer) {
|
|
36
|
-
aui.composer().setText(prompt);
|
|
37
|
-
} else {
|
|
38
|
-
const currentText = aui.composer().getState().text;
|
|
39
|
-
aui
|
|
40
|
-
.composer()
|
|
41
|
-
.setText(currentText.trim() ? `${currentText} ${prompt}` : prompt);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}, [aui, resolvedSend, clearComposer, prompt]);
|
|
20
|
+
const { trigger, disabled } = useSuggestionTrigger({
|
|
21
|
+
prompt,
|
|
22
|
+
send,
|
|
23
|
+
clearComposer,
|
|
24
|
+
});
|
|
45
25
|
|
|
46
26
|
return (
|
|
47
27
|
<Pressable
|
|
48
|
-
onPress={
|
|
49
|
-
disabled={disabledProp ??
|
|
28
|
+
onPress={trigger}
|
|
29
|
+
disabled={disabledProp ?? disabled}
|
|
50
30
|
{...pressableProps}
|
|
51
31
|
>
|
|
52
32
|
{children}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export {
|
|
2
2
|
SuggestionTitle as Title,
|
|
3
3
|
type SuggestionTitleProps as TitleProps,
|
|
4
|
-
} from "./SuggestionTitle";
|
|
4
|
+
} from "./suggestion/SuggestionTitle";
|
|
5
5
|
export {
|
|
6
6
|
SuggestionDescription as Description,
|
|
7
7
|
type SuggestionDescriptionProps as DescriptionProps,
|
|
8
|
-
} from "./SuggestionDescription";
|
|
8
|
+
} from "./suggestion/SuggestionDescription";
|
|
9
9
|
export {
|
|
10
10
|
SuggestionTrigger as Trigger,
|
|
11
11
|
type SuggestionTriggerProps as TriggerProps,
|
|
12
|
-
} from "./SuggestionTrigger";
|
|
12
|
+
} from "./suggestion/SuggestionTrigger";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type ComponentType, type FC,
|
|
1
|
+
import { type ComponentType, type FC, type ReactNode, useMemo } from "react";
|
|
2
2
|
import { Box } from "ink";
|
|
3
3
|
import type { ThreadMessage } from "@assistant-ui/core";
|
|
4
|
-
import { useAuiState } from "@assistant-ui/store";
|
|
4
|
+
import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
|
|
5
5
|
import { MessageByIndexProvider } from "@assistant-ui/core/react";
|
|
6
6
|
|
|
7
7
|
type MessageComponents =
|
|
@@ -26,9 +26,15 @@ type MessageComponents =
|
|
|
26
26
|
SystemMessage?: ComponentType | undefined;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
export type ThreadMessagesProps =
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
export type ThreadMessagesProps =
|
|
30
|
+
| {
|
|
31
|
+
components: MessageComponents;
|
|
32
|
+
children?: never;
|
|
33
|
+
}
|
|
34
|
+
| {
|
|
35
|
+
children: (value: { message: ThreadMessage }) => ReactNode;
|
|
36
|
+
components?: never;
|
|
37
|
+
};
|
|
32
38
|
|
|
33
39
|
const DEFAULT_SYSTEM_MESSAGE = () => null;
|
|
34
40
|
|
|
@@ -95,44 +101,47 @@ const ThreadMessageComponent: FC<{ components: MessageComponents }> = ({
|
|
|
95
101
|
return <Component />;
|
|
96
102
|
};
|
|
97
103
|
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
const ThreadMessagesInner: FC<{
|
|
105
|
+
children: (value: { message: ThreadMessage }) => ReactNode;
|
|
106
|
+
}> = ({ children }) => {
|
|
107
|
+
const messagesLength = useAuiState((s) => s.thread.messages.length);
|
|
108
|
+
|
|
109
|
+
return useMemo(() => {
|
|
110
|
+
if (messagesLength === 0) return null;
|
|
111
|
+
return Array.from({ length: messagesLength }, (_, index) => (
|
|
112
|
+
<MessageByIndexProvider key={index} index={index}>
|
|
113
|
+
<RenderChildrenWithAccessor
|
|
114
|
+
getItemState={(aui) => aui.thread().message({ index }).getState()}
|
|
115
|
+
>
|
|
116
|
+
{(getItem) =>
|
|
117
|
+
children({
|
|
118
|
+
get message() {
|
|
119
|
+
return getItem();
|
|
120
|
+
},
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
</RenderChildrenWithAccessor>
|
|
124
|
+
</MessageByIndexProvider>
|
|
125
|
+
));
|
|
126
|
+
}, [messagesLength, children]);
|
|
109
127
|
};
|
|
110
128
|
|
|
111
|
-
const
|
|
112
|
-
|
|
129
|
+
export const ThreadMessages: FC<ThreadMessagesProps> = ({
|
|
130
|
+
components,
|
|
131
|
+
children,
|
|
132
|
+
}) => {
|
|
133
|
+
if (components) {
|
|
113
134
|
return (
|
|
114
|
-
<
|
|
115
|
-
<
|
|
116
|
-
|
|
135
|
+
<Box flexDirection="column">
|
|
136
|
+
<ThreadMessagesInner>
|
|
137
|
+
{() => <ThreadMessageComponent components={components} />}
|
|
138
|
+
</ThreadMessagesInner>
|
|
139
|
+
</Box>
|
|
117
140
|
);
|
|
118
|
-
}
|
|
119
|
-
(prev, next) =>
|
|
120
|
-
prev.index === next.index &&
|
|
121
|
-
isComponentsSame(prev.components, next.components),
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
export const ThreadMessages = ({ components }: ThreadMessagesProps) => {
|
|
125
|
-
const messagesLength = useAuiState((s) => s.thread.messages.length);
|
|
126
|
-
|
|
141
|
+
}
|
|
127
142
|
return (
|
|
128
143
|
<Box flexDirection="column">
|
|
129
|
-
{
|
|
130
|
-
<ThreadMessageByIndex
|
|
131
|
-
key={index}
|
|
132
|
-
index={index}
|
|
133
|
-
components={components}
|
|
134
|
-
/>
|
|
135
|
-
))}
|
|
144
|
+
<ThreadMessagesInner>{children}</ThreadMessagesInner>
|
|
136
145
|
</Box>
|
|
137
146
|
);
|
|
138
147
|
};
|