@assistant-ui/react-ink 0.0.2 → 0.0.4
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/README.md +86 -0
- package/dist/context/AssistantContext.d.ts +1 -7
- package/dist/context/AssistantContext.d.ts.map +1 -1
- package/dist/context/AssistantContext.js +1 -15
- package/dist/context/AssistantContext.js.map +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -1
- package/dist/context/index.js.map +1 -1
- package/dist/index.d.ts +13 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -16
- package/dist/index.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.d.ts +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.d.ts.map +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.js +1 -1
- package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.js +1 -1
- package/dist/primitives/actionBar/ActionBarEdit.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarReload.js +1 -1
- package/dist/primitives/actionBar/ActionBarReload.js.map +1 -1
- package/dist/primitives/actionBar/index.d.ts +5 -5
- package/dist/primitives/actionBar/index.d.ts.map +1 -1
- package/dist/primitives/actionBar/index.js +5 -5
- package/dist/primitives/actionBar/index.js.map +1 -1
- package/dist/primitives/attachment/index.d.ts +4 -4
- package/dist/primitives/attachment/index.d.ts.map +1 -1
- package/dist/primitives/attachment/index.js +4 -4
- package/dist/primitives/attachment/index.js.map +1 -1
- package/dist/primitives/branchPicker/index.d.ts +4 -4
- package/dist/primitives/branchPicker/index.d.ts.map +1 -1
- package/dist/primitives/branchPicker/index.js +4 -4
- package/dist/primitives/branchPicker/index.js.map +1 -1
- package/dist/primitives/chainOfThought/index.d.ts +3 -3
- package/dist/primitives/chainOfThought/index.d.ts.map +1 -1
- package/dist/primitives/chainOfThought/index.js +3 -3
- package/dist/primitives/chainOfThought/index.js.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.js +3 -5
- package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -1
- package/dist/primitives/composer/ComposerCancel.js +3 -3
- package/dist/primitives/composer/ComposerCancel.js.map +1 -1
- package/dist/primitives/composer/ComposerSend.js +3 -3
- package/dist/primitives/composer/ComposerSend.js.map +1 -1
- package/dist/primitives/composer/index.d.ts +7 -10
- package/dist/primitives/composer/index.d.ts.map +1 -1
- package/dist/primitives/composer/index.js +7 -10
- package/dist/primitives/composer/index.js.map +1 -1
- package/dist/primitives/message/MessageContent.d.ts.map +1 -1
- package/dist/primitives/message/MessageContent.js +9 -3
- package/dist/primitives/message/MessageContent.js.map +1 -1
- package/dist/primitives/message/index.d.ts +5 -5
- package/dist/primitives/message/index.d.ts.map +1 -1
- package/dist/primitives/message/index.js +5 -5
- package/dist/primitives/message/index.js.map +1 -1
- package/dist/primitives/suggestion/index.d.ts +3 -3
- package/dist/primitives/suggestion/index.d.ts.map +1 -1
- package/dist/primitives/suggestion/index.js +3 -3
- package/dist/primitives/suggestion/index.js.map +1 -1
- package/dist/primitives/thread/ThreadEmpty.js +1 -1
- package/dist/primitives/thread/ThreadEmpty.js.map +1 -1
- package/dist/primitives/thread/ThreadMessages.d.ts +23 -7
- package/dist/primitives/thread/ThreadMessages.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadMessages.js +67 -13
- package/dist/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/primitives/thread/index.d.ts +7 -7
- package/dist/primitives/thread/index.d.ts.map +1 -1
- package/dist/primitives/thread/index.js +7 -7
- package/dist/primitives/thread/index.js.map +1 -1
- package/dist/primitives/threadList/index.d.ts +3 -3
- package/dist/primitives/threadList/index.d.ts.map +1 -1
- package/dist/primitives/threadList/index.js +3 -3
- package/dist/primitives/threadList/index.js.map +1 -1
- package/dist/primitives/threadListItem/index.d.ts +6 -6
- package/dist/primitives/threadListItem/index.d.ts.map +1 -1
- package/dist/primitives/threadListItem/index.js +6 -6
- package/dist/primitives/threadListItem/index.js.map +1 -1
- package/dist/primitives/toolCall/ToolFallback.d.ts +33 -0
- package/dist/primitives/toolCall/ToolFallback.d.ts.map +1 -0
- package/dist/primitives/toolCall/ToolFallback.js +103 -0
- package/dist/primitives/toolCall/ToolFallback.js.map +1 -0
- package/dist/primitives/toolCall/index.d.ts +2 -0
- package/dist/primitives/toolCall/index.d.ts.map +1 -0
- package/dist/primitives/toolCall/index.js +2 -0
- package/dist/primitives/toolCall/index.js.map +1 -0
- package/dist/runtimes/useLocalRuntime.d.ts +1 -17
- package/dist/runtimes/useLocalRuntime.d.ts.map +1 -1
- package/dist/runtimes/useLocalRuntime.js +1 -61
- package/dist/runtimes/useLocalRuntime.js.map +1 -1
- package/package.json +5 -3
- package/src/context/AssistantContext.tsx +4 -31
- package/src/context/index.ts +4 -1
- package/src/index.ts +13 -39
- package/src/primitives/actionBar/ActionBarCopy.tsx +1 -1
- package/src/primitives/actionBar/ActionBarEdit.tsx +1 -1
- package/src/primitives/actionBar/ActionBarFeedbackNegative.tsx +1 -1
- package/src/primitives/actionBar/ActionBarFeedbackPositive.tsx +1 -1
- package/src/primitives/actionBar/ActionBarReload.tsx +1 -1
- package/src/primitives/actionBar/index.ts +16 -7
- package/src/primitives/attachment/index.ts +14 -5
- package/src/primitives/branchPicker/index.ts +8 -8
- package/src/primitives/chainOfThought/index.ts +5 -5
- package/src/primitives/composer/ComposerAddAttachment.tsx +3 -5
- package/src/primitives/composer/ComposerCancel.tsx +3 -3
- package/src/primitives/composer/ComposerSend.tsx +3 -3
- package/src/primitives/composer/index.ts +19 -19
- package/src/primitives/message/MessageContent.test.tsx +83 -0
- package/src/primitives/message/MessageContent.tsx +21 -15
- package/src/primitives/message/index.ts +13 -7
- package/src/primitives/suggestion/index.ts +6 -6
- package/src/primitives/thread/ThreadEmpty.tsx +1 -1
- package/src/primitives/thread/ThreadMessages.tsx +122 -27
- package/src/primitives/thread/index.ts +17 -11
- package/src/primitives/threadList/index.ts +12 -3
- package/src/primitives/threadListItem/index.ts +11 -11
- package/src/primitives/toolCall/ToolFallback.test.tsx +40 -0
- package/src/primitives/toolCall/ToolFallback.tsx +227 -0
- package/src/primitives/toolCall/index.ts +5 -0
- package/src/runtimes/useLocalRuntime.ts +4 -105
- package/dist/adapters/LocalStorageThreadListAdapter.d.ts +0 -15
- package/dist/adapters/LocalStorageThreadListAdapter.d.ts.map +0 -1
- package/dist/adapters/LocalStorageThreadListAdapter.js +0 -154
- package/dist/adapters/LocalStorageThreadListAdapter.js.map +0 -1
- package/dist/adapters/TitleGenerationAdapter.d.ts +0 -6
- package/dist/adapters/TitleGenerationAdapter.d.ts.map +0 -1
- package/dist/adapters/TitleGenerationAdapter.js +0 -15
- package/dist/adapters/TitleGenerationAdapter.js.map +0 -1
- package/dist/adapters/index.d.ts +0 -3
- package/dist/adapters/index.d.ts.map +0 -1
- package/dist/adapters/index.js +0 -3
- package/dist/adapters/index.js.map +0 -1
- package/dist/primitive-hooks/index.d.ts +0 -15
- package/dist/primitive-hooks/index.d.ts.map +0 -1
- package/dist/primitive-hooks/index.js +0 -15
- package/dist/primitive-hooks/index.js.map +0 -1
- package/dist/primitive-hooks/useActionBarCopy.d.ts +0 -10
- package/dist/primitive-hooks/useActionBarCopy.d.ts.map +0 -1
- package/dist/primitive-hooks/useActionBarCopy.js +0 -26
- package/dist/primitive-hooks/useActionBarCopy.js.map +0 -1
- package/dist/primitive-hooks/useActionBarEdit.d.ts +0 -5
- package/dist/primitive-hooks/useActionBarEdit.d.ts.map +0 -1
- package/dist/primitive-hooks/useActionBarEdit.js +0 -11
- package/dist/primitive-hooks/useActionBarEdit.js.map +0 -1
- package/dist/primitive-hooks/useActionBarFeedback.d.ts +0 -9
- package/dist/primitive-hooks/useActionBarFeedback.d.ts.map +0 -1
- package/dist/primitive-hooks/useActionBarFeedback.js +0 -19
- package/dist/primitive-hooks/useActionBarFeedback.js.map +0 -1
- package/dist/primitive-hooks/useActionBarReload.d.ts +0 -5
- package/dist/primitive-hooks/useActionBarReload.d.ts.map +0 -1
- package/dist/primitive-hooks/useActionBarReload.js +0 -13
- package/dist/primitive-hooks/useActionBarReload.js.map +0 -1
- package/dist/primitive-hooks/useComposerAddAttachment.d.ts +0 -5
- package/dist/primitive-hooks/useComposerAddAttachment.d.ts.map +0 -1
- package/dist/primitive-hooks/useComposerAddAttachment.js +0 -10
- package/dist/primitive-hooks/useComposerAddAttachment.js.map +0 -1
- package/dist/primitive-hooks/useComposerCancel.d.ts +0 -5
- package/dist/primitive-hooks/useComposerCancel.d.ts.map +0 -1
- package/dist/primitive-hooks/useComposerCancel.js +0 -11
- package/dist/primitive-hooks/useComposerCancel.js.map +0 -1
- package/dist/primitive-hooks/useComposerSend.d.ts +0 -5
- package/dist/primitive-hooks/useComposerSend.d.ts.map +0 -1
- package/dist/primitive-hooks/useComposerSend.js +0 -11
- package/dist/primitive-hooks/useComposerSend.js.map +0 -1
- package/dist/primitive-hooks/useEditComposerCancel.d.ts +0 -4
- package/dist/primitive-hooks/useEditComposerCancel.d.ts.map +0 -1
- package/dist/primitive-hooks/useEditComposerCancel.js +0 -10
- package/dist/primitive-hooks/useEditComposerCancel.js.map +0 -1
- package/dist/primitive-hooks/useEditComposerSend.d.ts +0 -5
- package/dist/primitive-hooks/useEditComposerSend.d.ts.map +0 -1
- package/dist/primitive-hooks/useEditComposerSend.js +0 -11
- package/dist/primitive-hooks/useEditComposerSend.js.map +0 -1
- package/dist/primitive-hooks/useMessageBranching.d.ts +0 -7
- package/dist/primitive-hooks/useMessageBranching.d.ts.map +0 -1
- package/dist/primitive-hooks/useMessageBranching.js +0 -15
- package/dist/primitive-hooks/useMessageBranching.js.map +0 -1
- package/dist/primitive-hooks/useMessageReload.d.ts +0 -5
- package/dist/primitive-hooks/useMessageReload.d.ts.map +0 -1
- package/dist/primitive-hooks/useMessageReload.js +0 -11
- package/dist/primitive-hooks/useMessageReload.js.map +0 -1
- package/dist/primitive-hooks/useThreadIsEmpty.d.ts +0 -2
- package/dist/primitive-hooks/useThreadIsEmpty.d.ts.map +0 -1
- package/dist/primitive-hooks/useThreadIsEmpty.js +0 -5
- package/dist/primitive-hooks/useThreadIsEmpty.js.map +0 -1
- package/dist/primitive-hooks/useThreadIsRunning.d.ts +0 -2
- package/dist/primitive-hooks/useThreadIsRunning.d.ts.map +0 -1
- package/dist/primitive-hooks/useThreadIsRunning.js +0 -5
- package/dist/primitive-hooks/useThreadIsRunning.js.map +0 -1
- package/dist/primitive-hooks/useThreadMessages.d.ts +0 -3
- package/dist/primitive-hooks/useThreadMessages.d.ts.map +0 -1
- package/dist/primitive-hooks/useThreadMessages.js +0 -5
- package/dist/primitive-hooks/useThreadMessages.js.map +0 -1
- package/dist/primitives/composer/EditComposerCancel.d.ts +0 -7
- package/dist/primitives/composer/EditComposerCancel.d.ts.map +0 -1
- package/dist/primitives/composer/EditComposerCancel.js +0 -8
- package/dist/primitives/composer/EditComposerCancel.js.map +0 -1
- package/dist/primitives/composer/EditComposerInput.d.ts +0 -10
- package/dist/primitives/composer/EditComposerInput.d.ts.map +0 -1
- package/dist/primitives/composer/EditComposerInput.js +0 -19
- package/dist/primitives/composer/EditComposerInput.js.map +0 -1
- package/dist/primitives/composer/EditComposerSend.d.ts +0 -7
- package/dist/primitives/composer/EditComposerSend.d.ts.map +0 -1
- package/dist/primitives/composer/EditComposerSend.js +0 -8
- package/dist/primitives/composer/EditComposerSend.js.map +0 -1
- package/src/adapters/LocalStorageThreadListAdapter.tsx +0 -227
- package/src/adapters/TitleGenerationAdapter.ts +0 -20
- package/src/adapters/index.ts +0 -5
- package/src/primitive-hooks/index.ts +0 -20
- package/src/primitive-hooks/useActionBarCopy.ts +0 -38
- package/src/primitive-hooks/useActionBarEdit.ts +0 -13
- package/src/primitive-hooks/useActionBarFeedback.ts +0 -28
- package/src/primitive-hooks/useActionBarReload.ts +0 -18
- package/src/primitive-hooks/useComposerAddAttachment.ts +0 -16
- package/src/primitive-hooks/useComposerCancel.ts +0 -13
- package/src/primitive-hooks/useComposerSend.ts +0 -13
- package/src/primitive-hooks/useEditComposerCancel.ts +0 -12
- package/src/primitive-hooks/useEditComposerSend.ts +0 -13
- package/src/primitive-hooks/useMessageBranching.ts +0 -18
- package/src/primitive-hooks/useMessageReload.ts +0 -13
- package/src/primitive-hooks/useThreadIsEmpty.ts +0 -5
- package/src/primitive-hooks/useThreadIsRunning.ts +0 -5
- package/src/primitive-hooks/useThreadMessages.ts +0 -6
- package/src/primitives/composer/EditComposerCancel.tsx +0 -20
- package/src/primitives/composer/EditComposerInput.tsx +0 -40
- package/src/primitives/composer/EditComposerSend.tsx +0 -25
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { Box, Text } from "ink";
|
|
4
|
+
import Spinner from "ink-spinner";
|
|
5
|
+
const STATUS_ICONS = {
|
|
6
|
+
complete: "+",
|
|
7
|
+
error: "x",
|
|
8
|
+
"requires-action": "?",
|
|
9
|
+
};
|
|
10
|
+
const STATUS_COLORS = {
|
|
11
|
+
running: "yellow",
|
|
12
|
+
complete: "green",
|
|
13
|
+
error: "red",
|
|
14
|
+
"requires-action": "cyan",
|
|
15
|
+
};
|
|
16
|
+
const prettyPrintArgs = (argsText) => {
|
|
17
|
+
if (!argsText)
|
|
18
|
+
return "";
|
|
19
|
+
try {
|
|
20
|
+
return JSON.stringify(JSON.parse(argsText), null, 2);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return argsText;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const formatResult = (result) => {
|
|
27
|
+
if (result === undefined || result === null)
|
|
28
|
+
return "";
|
|
29
|
+
if (typeof result === "string")
|
|
30
|
+
return result;
|
|
31
|
+
try {
|
|
32
|
+
return JSON.stringify(result, null, 2);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return String(result);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const truncate = (text, maxLines) => {
|
|
39
|
+
const lines = text.split("\n");
|
|
40
|
+
if (lines.length <= maxLines)
|
|
41
|
+
return text;
|
|
42
|
+
return (lines.slice(0, maxLines).join("\n") +
|
|
43
|
+
`\n... (${lines.length - maxLines} more lines)`);
|
|
44
|
+
};
|
|
45
|
+
const resolveStatus = (part, status) => {
|
|
46
|
+
if (status?.type === "requires-action")
|
|
47
|
+
return "requires-action";
|
|
48
|
+
if (status?.type === "incomplete")
|
|
49
|
+
return "error";
|
|
50
|
+
if (status?.type === "complete")
|
|
51
|
+
return "complete";
|
|
52
|
+
if (part.isError)
|
|
53
|
+
return "error";
|
|
54
|
+
if (part.result !== undefined)
|
|
55
|
+
return "complete";
|
|
56
|
+
if (part.interrupt)
|
|
57
|
+
return "requires-action";
|
|
58
|
+
return "running";
|
|
59
|
+
};
|
|
60
|
+
const getDisplayResult = (result, status) => {
|
|
61
|
+
if (result !== undefined)
|
|
62
|
+
return result;
|
|
63
|
+
if (status?.type === "incomplete")
|
|
64
|
+
return status.error;
|
|
65
|
+
return undefined;
|
|
66
|
+
};
|
|
67
|
+
const getFallbackErrorText = (status) => {
|
|
68
|
+
if (status?.type === "incomplete" && status.reason === "cancelled") {
|
|
69
|
+
return "Tool call cancelled";
|
|
70
|
+
}
|
|
71
|
+
return "Tool call failed";
|
|
72
|
+
};
|
|
73
|
+
const StatusIcon = ({ status }) => {
|
|
74
|
+
if (status === "running") {
|
|
75
|
+
return (_jsx(Text, { color: STATUS_COLORS.running, children: _jsx(Spinner, { type: "line" }) }));
|
|
76
|
+
}
|
|
77
|
+
return _jsx(Text, { color: STATUS_COLORS[status], children: STATUS_ICONS[status] });
|
|
78
|
+
};
|
|
79
|
+
export const ToolFallback = ({ toolName, args, argsText, result: partResult, isError, interrupt, status, expanded: expandedProp, maxArgLines = 20, maxResultLines = 20, maxResultPreviewLines = 1, renderHeader, renderArgs, renderResult, }) => {
|
|
80
|
+
const displayStatus = resolveStatus({
|
|
81
|
+
interrupt,
|
|
82
|
+
isError,
|
|
83
|
+
result: partResult,
|
|
84
|
+
}, status);
|
|
85
|
+
const expanded = expandedProp ??
|
|
86
|
+
(displayStatus === "running" ||
|
|
87
|
+
displayStatus === "requires-action" ||
|
|
88
|
+
displayStatus === "error");
|
|
89
|
+
const result = getDisplayResult(partResult, status);
|
|
90
|
+
const resultStr = result !== undefined || displayStatus === "error"
|
|
91
|
+
? formatResult(result)
|
|
92
|
+
: "";
|
|
93
|
+
const argsDisplay = useMemo(() => prettyPrintArgs(argsText), [argsText]);
|
|
94
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { gap: 1, children: renderHeader ? (renderHeader({
|
|
95
|
+
toolName,
|
|
96
|
+
status: displayStatus,
|
|
97
|
+
expanded,
|
|
98
|
+
})) : (_jsxs(_Fragment, { children: [_jsx(StatusIcon, { status: displayStatus }), _jsx(Text, { bold: true, children: toolName }), !expanded && resultStr ? (_jsx(Text, { dimColor: true, children: truncate(resultStr, maxResultPreviewLines) })) : null] })) }), expanded && (_jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [argsText ? (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: "Args:" }), renderArgs ? (renderArgs({ args, argsText })) : (_jsx(Text, { children: truncate(argsDisplay, maxArgLines) }))] })) : null, partResult !== undefined || displayStatus === "error" ? (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: displayStatus === "error" ? "Error:" : "Result:" }), renderResult ? (renderResult({
|
|
99
|
+
result,
|
|
100
|
+
isError: displayStatus === "error",
|
|
101
|
+
})) : displayStatus === "error" ? (_jsx(Text, { color: "red", children: truncate(resultStr || getFallbackErrorText(status), maxResultLines) })) : (_jsx(Text, { children: truncate(resultStr, maxResultLines) }))] })) : null, displayStatus === "running" && _jsx(Text, { dimColor: true, children: "Running..." }), displayStatus === "requires-action" && (_jsx(Text, { color: "cyan", children: "Waiting for approval..." }))] }))] }));
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=ToolFallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolFallback.js","sourceRoot":"","sources":["../../../src/primitives/toolCall/ToolFallback.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,OAAO,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,OAAO,MAAM,aAAa,CAAC;AAgBlC,MAAM,YAAY,GAAuD;IACvE,QAAQ,EAAE,GAAG;IACb,KAAK,EAAE,GAAG;IACV,iBAAiB,EAAE,GAAG;CACvB,CAAC;AAEF,MAAM,aAAa,GAAmC;IACpD,OAAO,EAAE,QAAQ;IACjB,QAAQ,EAAE,OAAO;IACjB,KAAK,EAAE,KAAK;IACZ,iBAAiB,EAAE,MAAM;CAC1B,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,QAAgB,EAAU,EAAE;IACnD,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IACzB,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACvD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC;IAClB,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,MAAe,EAAU,EAAE;IAC/C,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI;QA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W,CAAC,GAAQ,CAClD,IACG,CACP,CAAC,CAAC,CAAC,IAAI,EAEP,UAAU,KAAK,SAAS,IAAI,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,CACvD,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,aACzB,KAAC,IAAI,IAAC,QAAQ,kBACX,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,GAC5C,EACN,YAAY,CAAC,CAAC,CAAC,CACd,YAAY,CAAC;gCACX,MAAM;gCACN,OAAO,EAAE,aAAa,KAAK,OAAO;6BACnC,CAAC,CACH,CAAC,CAAC,CAAC,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,CAC9B,KAAC,IAAI,IAAC,KAAK,EAAC,KAAK,YACd,QAAQ,CACP,SAAS,IAAI,oBAAoB,CAAC,MAAM,CAAC,EACzC,cAAc,CACf,GACI,CACR,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,cAAE,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC,GAAQ,CACnD,IACG,CACP,CAAC,CAAC,CAAC,IAAI,EAEP,aAAa,KAAK,SAAS,IAAI,KAAC,IAAI,IAAC,QAAQ,iCAAkB,EAE/D,aAAa,KAAK,iBAAiB,IAAI,CACtC,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,wCAA+B,CAClD,IACG,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/toolCall/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,IAAI,QAAQ,EACxB,KAAK,iBAAiB,IAAI,aAAa,EACvC,KAAK,cAAc,GACpB,0BAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/primitives/toolCall/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,IAAI,QAAQ,GAGzB,0BAAuB"}
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { LocalRuntimeOptionsBase } from "@assistant-ui/core/internal";
|
|
3
|
-
import type { TitleGenerationAdapter } from "../adapters/TitleGenerationAdapter.js";
|
|
4
|
-
type AsyncStorageLike = {
|
|
5
|
-
getItem(key: string): Promise<string | null>;
|
|
6
|
-
setItem(key: string, value: string): Promise<void>;
|
|
7
|
-
removeItem(key: string): Promise<void>;
|
|
8
|
-
};
|
|
9
|
-
export type LocalRuntimeOptions = Omit<LocalRuntimeOptionsBase, "adapters"> & {
|
|
10
|
-
adapters?: Omit<LocalRuntimeOptionsBase["adapters"], "chatModel"> | undefined;
|
|
11
|
-
initialMessages?: readonly ThreadMessageLike[] | undefined;
|
|
12
|
-
titleGenerator?: TitleGenerationAdapter | undefined;
|
|
13
|
-
storage?: AsyncStorageLike | undefined;
|
|
14
|
-
storagePrefix?: string | undefined;
|
|
15
|
-
};
|
|
16
|
-
export declare const useLocalRuntime: (chatModel: ChatModelAdapter, options?: LocalRuntimeOptions) => AssistantRuntime;
|
|
17
|
-
export {};
|
|
1
|
+
export { useLocalRuntime, type LocalRuntimeOptions, } from "@assistant-ui/core/react";
|
|
18
2
|
//# sourceMappingURL=useLocalRuntime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocalRuntime.d.ts","sourceRoot":"","sources":["../../src/runtimes/useLocalRuntime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useLocalRuntime.d.ts","sourceRoot":"","sources":["../../src/runtimes/useLocalRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,KAAK,mBAAmB,GACzB,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,62 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { InMemoryThreadListAdapter } from "@assistant-ui/core";
|
|
3
|
-
import { AssistantRuntimeImpl, LocalRuntimeCore, } from "@assistant-ui/core/internal";
|
|
4
|
-
import { useAuiState } from "@assistant-ui/store";
|
|
5
|
-
import { useRemoteThreadListRuntime } from "./useRemoteThreadListRuntime.js";
|
|
6
|
-
import { createLocalStorageAdapter } from "../adapters/LocalStorageThreadListAdapter.js";
|
|
7
|
-
import { useRuntimeAdapters } from "../context/providers/RuntimeAdapterProvider.js";
|
|
8
|
-
const useInnerLocalRuntime = (chatModel, options) => {
|
|
9
|
-
const { initialMessages, ...restOptions } = options;
|
|
10
|
-
const { modelContext, ...threadListAdapters } = useRuntimeAdapters() ?? {};
|
|
11
|
-
const opt = {
|
|
12
|
-
...restOptions,
|
|
13
|
-
adapters: {
|
|
14
|
-
...threadListAdapters,
|
|
15
|
-
...restOptions.adapters,
|
|
16
|
-
chatModel,
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
const [runtime] = useState(() => new LocalRuntimeCore(opt, initialMessages));
|
|
20
|
-
const threadIdRef = useRef(undefined);
|
|
21
|
-
threadIdRef.current = useAuiState((s) => s.threadListItem.remoteId);
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
runtime.threads
|
|
24
|
-
.getMainThreadRuntimeCore()
|
|
25
|
-
.__internal_setGetThreadId(() => threadIdRef.current);
|
|
26
|
-
}, [runtime]);
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
return () => {
|
|
29
|
-
runtime.threads.getMainThreadRuntimeCore().detach();
|
|
30
|
-
};
|
|
31
|
-
}, [runtime]);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
runtime.threads.getMainThreadRuntimeCore().__internal_setOptions(opt);
|
|
34
|
-
runtime.threads.getMainThreadRuntimeCore().__internal_load();
|
|
35
|
-
});
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
if (!modelContext)
|
|
38
|
-
return undefined;
|
|
39
|
-
return runtime.registerModelContextProvider(modelContext);
|
|
40
|
-
}, [modelContext, runtime]);
|
|
41
|
-
return useMemo(() => new AssistantRuntimeImpl(runtime), [runtime]);
|
|
42
|
-
};
|
|
43
|
-
export const useLocalRuntime = (chatModel, options = {}) => {
|
|
44
|
-
const { titleGenerator, storage, storagePrefix, ...innerOptions } = options;
|
|
45
|
-
const adapter = useMemo(() => {
|
|
46
|
-
if (!storage)
|
|
47
|
-
return new InMemoryThreadListAdapter();
|
|
48
|
-
return createLocalStorageAdapter({
|
|
49
|
-
storage,
|
|
50
|
-
prefix: storagePrefix,
|
|
51
|
-
titleGenerator,
|
|
52
|
-
});
|
|
53
|
-
}, [storage, storagePrefix, titleGenerator]);
|
|
54
|
-
return useRemoteThreadListRuntime({
|
|
55
|
-
runtimeHook: function RuntimeHook() {
|
|
56
|
-
return useInnerLocalRuntime(chatModel, innerOptions);
|
|
57
|
-
},
|
|
58
|
-
adapter,
|
|
59
|
-
allowNesting: true,
|
|
60
|
-
});
|
|
61
|
-
};
|
|
1
|
+
export { useLocalRuntime, } from "@assistant-ui/core/react";
|
|
62
2
|
//# sourceMappingURL=useLocalRuntime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocalRuntime.js","sourceRoot":"","sources":["../../src/runtimes/useLocalRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"useLocalRuntime.js","sourceRoot":"","sources":["../../src/runtimes/useLocalRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,GAEhB,MAAM,0BAA0B,CAAC"}
|
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.4",
|
|
4
4
|
"description": "React Ink (terminal UI) bindings for assistant-ui",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"assistant",
|
|
@@ -34,10 +34,11 @@
|
|
|
34
34
|
],
|
|
35
35
|
"sideEffects": false,
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@assistant-ui/core": "^0.1.
|
|
37
|
+
"@assistant-ui/core": "^0.1.5",
|
|
38
38
|
"@assistant-ui/store": "^0.2.2",
|
|
39
39
|
"@assistant-ui/tap": "^0.5.2",
|
|
40
|
-
"assistant-stream": "^0.3.
|
|
40
|
+
"assistant-stream": "^0.3.5",
|
|
41
|
+
"ink-spinner": "^5.0.0",
|
|
41
42
|
"zustand": "^5.0.11"
|
|
42
43
|
},
|
|
43
44
|
"peerDependencies": {
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@types/react": "^19.2.14",
|
|
55
56
|
"ink": "^5.2.0",
|
|
57
|
+
"ink-testing-library": "^4.0.0",
|
|
56
58
|
"react": "18.3.1",
|
|
57
59
|
"vitest": "^4.0.18",
|
|
58
60
|
"@assistant-ui/x-buildutils": "0.0.2"
|
|
@@ -1,31 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export const useAssistantRuntime = (): AssistantRuntime => {
|
|
7
|
-
const aui = useAui();
|
|
8
|
-
const runtime = aui.threads().__internal_getAssistantRuntime?.();
|
|
9
|
-
if (!runtime) {
|
|
10
|
-
throw new Error(
|
|
11
|
-
"useAssistantRuntime must be used within an AssistantProvider",
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
|
-
return runtime;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const AssistantProvider = memo(
|
|
18
|
-
({
|
|
19
|
-
runtime,
|
|
20
|
-
children,
|
|
21
|
-
}: {
|
|
22
|
-
runtime: AssistantRuntime;
|
|
23
|
-
children: ReactNode;
|
|
24
|
-
}) => {
|
|
25
|
-
return (
|
|
26
|
-
<AssistantProviderBase runtime={runtime}>
|
|
27
|
-
{children}
|
|
28
|
-
</AssistantProviderBase>
|
|
29
|
-
);
|
|
30
|
-
},
|
|
31
|
-
);
|
|
1
|
+
export {
|
|
2
|
+
AssistantRuntimeProvider,
|
|
3
|
+
useAssistantRuntime,
|
|
4
|
+
} from "@assistant-ui/core/react";
|
package/src/context/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="@assistant-ui/core/react" />
|
|
2
2
|
|
|
3
3
|
// Re-export core types
|
|
4
4
|
export type {
|
|
@@ -92,27 +92,7 @@ export {
|
|
|
92
92
|
} from "@assistant-ui/store";
|
|
93
93
|
|
|
94
94
|
// Context providers and hooks
|
|
95
|
-
export {
|
|
96
|
-
|
|
97
|
-
// Primitive hooks
|
|
98
|
-
export {
|
|
99
|
-
useThreadMessages,
|
|
100
|
-
useThreadIsRunning,
|
|
101
|
-
useThreadIsEmpty,
|
|
102
|
-
useComposerSend,
|
|
103
|
-
useComposerCancel,
|
|
104
|
-
useMessageReload,
|
|
105
|
-
useMessageBranching,
|
|
106
|
-
useActionBarCopy,
|
|
107
|
-
type UseActionBarCopyOptions,
|
|
108
|
-
useActionBarEdit,
|
|
109
|
-
useActionBarReload,
|
|
110
|
-
useActionBarFeedbackPositive,
|
|
111
|
-
useActionBarFeedbackNegative,
|
|
112
|
-
useEditComposerSend,
|
|
113
|
-
useEditComposerCancel,
|
|
114
|
-
useComposerAddAttachment,
|
|
115
|
-
} from "./primitive-hooks";
|
|
95
|
+
export { AssistantRuntimeProvider, useAssistantRuntime } from "./context";
|
|
116
96
|
|
|
117
97
|
// Runtime
|
|
118
98
|
export {
|
|
@@ -122,16 +102,17 @@ export {
|
|
|
122
102
|
} from "./runtimes";
|
|
123
103
|
|
|
124
104
|
// Primitives
|
|
125
|
-
export * from "./primitives/thread";
|
|
126
|
-
export * from "./primitives/composer";
|
|
127
|
-
export * from "./primitives/message";
|
|
128
|
-
export * from "./primitives/threadList";
|
|
129
|
-
export * from "./primitives/actionBar";
|
|
130
|
-
export * from "./primitives/branchPicker";
|
|
131
|
-
export * from "./primitives/attachment";
|
|
132
|
-
export * from "./primitives/threadListItem";
|
|
133
|
-
export * from "./primitives/chainOfThought";
|
|
134
|
-
export * from "./primitives/suggestion";
|
|
105
|
+
export * as ThreadPrimitive from "./primitives/thread";
|
|
106
|
+
export * as ComposerPrimitive from "./primitives/composer";
|
|
107
|
+
export * as MessagePrimitive from "./primitives/message";
|
|
108
|
+
export * as ThreadListPrimitive from "./primitives/threadList";
|
|
109
|
+
export * as ActionBarPrimitive from "./primitives/actionBar";
|
|
110
|
+
export * as BranchPickerPrimitive from "./primitives/branchPicker";
|
|
111
|
+
export * as AttachmentPrimitive from "./primitives/attachment";
|
|
112
|
+
export * as ThreadListItemPrimitive from "./primitives/threadListItem";
|
|
113
|
+
export * as ChainOfThoughtPrimitive from "./primitives/chainOfThought";
|
|
114
|
+
export * as SuggestionPrimitive from "./primitives/suggestion";
|
|
115
|
+
export * as ToolCallPrimitive from "./primitives/toolCall";
|
|
135
116
|
|
|
136
117
|
// Re-export shared providers from core/react
|
|
137
118
|
export {
|
|
@@ -148,10 +129,3 @@ export {
|
|
|
148
129
|
export * from "./model-context";
|
|
149
130
|
export * from "./client";
|
|
150
131
|
export * from "./types";
|
|
151
|
-
|
|
152
|
-
// Adapters
|
|
153
|
-
export {
|
|
154
|
-
type TitleGenerationAdapter,
|
|
155
|
-
createSimpleTitleAdapter,
|
|
156
|
-
createLocalStorageAdapter,
|
|
157
|
-
} from "./adapters";
|
|
@@ -2,7 +2,7 @@ import type { ReactNode } from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
useActionBarCopy,
|
|
4
4
|
type UseActionBarCopyOptions,
|
|
5
|
-
} from "
|
|
5
|
+
} from "@assistant-ui/core/react";
|
|
6
6
|
import { Pressable, type PressableProps } from "../internal/Pressable";
|
|
7
7
|
|
|
8
8
|
export type ActionBarCopyProps = Omit<PressableProps, "onPress" | "children"> &
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import { useActionBarEdit } from "
|
|
2
|
+
import { useActionBarEdit } from "@assistant-ui/core/react";
|
|
3
3
|
import { Pressable, type PressableProps } from "../internal/Pressable";
|
|
4
4
|
|
|
5
5
|
export type ActionBarEditProps = Omit<PressableProps, "onPress"> & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import { useActionBarFeedbackNegative } from "
|
|
2
|
+
import { useActionBarFeedbackNegative } from "@assistant-ui/core/react";
|
|
3
3
|
import { Pressable, type PressableProps } from "../internal/Pressable";
|
|
4
4
|
|
|
5
5
|
export type ActionBarFeedbackNegativeProps = Omit<
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import { useActionBarFeedbackPositive } from "
|
|
2
|
+
import { useActionBarFeedbackPositive } from "@assistant-ui/core/react";
|
|
3
3
|
import { Pressable, type PressableProps } from "../internal/Pressable";
|
|
4
4
|
|
|
5
5
|
export type ActionBarFeedbackPositiveProps = Omit<
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import { useActionBarReload } from "
|
|
2
|
+
import { useActionBarReload } from "@assistant-ui/core/react";
|
|
3
3
|
import { Pressable, type PressableProps } from "../internal/Pressable";
|
|
4
4
|
|
|
5
5
|
export type ActionBarReloadProps = Omit<PressableProps, "onPress"> & {
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
export { ActionBarCopy, type ActionBarCopyProps } from "./ActionBarCopy";
|
|
2
|
-
export { ActionBarEdit, type ActionBarEditProps } from "./ActionBarEdit";
|
|
3
|
-
export { ActionBarReload, type ActionBarReloadProps } from "./ActionBarReload";
|
|
4
1
|
export {
|
|
5
|
-
|
|
6
|
-
type
|
|
2
|
+
ActionBarCopy as Copy,
|
|
3
|
+
type ActionBarCopyProps as CopyProps,
|
|
4
|
+
} from "./ActionBarCopy";
|
|
5
|
+
export {
|
|
6
|
+
ActionBarEdit as Edit,
|
|
7
|
+
type ActionBarEditProps as EditProps,
|
|
8
|
+
} from "./ActionBarEdit";
|
|
9
|
+
export {
|
|
10
|
+
ActionBarReload as Reload,
|
|
11
|
+
type ActionBarReloadProps as ReloadProps,
|
|
12
|
+
} from "./ActionBarReload";
|
|
13
|
+
export {
|
|
14
|
+
ActionBarFeedbackPositive as FeedbackPositive,
|
|
15
|
+
type ActionBarFeedbackPositiveProps as FeedbackPositiveProps,
|
|
7
16
|
} from "./ActionBarFeedbackPositive";
|
|
8
17
|
export {
|
|
9
|
-
ActionBarFeedbackNegative,
|
|
10
|
-
type ActionBarFeedbackNegativeProps,
|
|
18
|
+
ActionBarFeedbackNegative as FeedbackNegative,
|
|
19
|
+
type ActionBarFeedbackNegativeProps as FeedbackNegativeProps,
|
|
11
20
|
} from "./ActionBarFeedbackNegative";
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
export { AttachmentRoot, type AttachmentRootProps } from "./AttachmentRoot";
|
|
2
|
-
export { AttachmentName, type AttachmentNameProps } from "./AttachmentName";
|
|
3
|
-
export { AttachmentThumb, type AttachmentThumbProps } from "./AttachmentThumb";
|
|
4
1
|
export {
|
|
5
|
-
|
|
6
|
-
type
|
|
2
|
+
AttachmentRoot as Root,
|
|
3
|
+
type AttachmentRootProps as RootProps,
|
|
4
|
+
} from "./AttachmentRoot";
|
|
5
|
+
export {
|
|
6
|
+
AttachmentName as Name,
|
|
7
|
+
type AttachmentNameProps as NameProps,
|
|
8
|
+
} from "./AttachmentName";
|
|
9
|
+
export {
|
|
10
|
+
AttachmentThumb as Thumb,
|
|
11
|
+
type AttachmentThumbProps as ThumbProps,
|
|
12
|
+
} from "./AttachmentThumb";
|
|
13
|
+
export {
|
|
14
|
+
AttachmentRemove as Remove,
|
|
15
|
+
type AttachmentRemoveProps as RemoveProps,
|
|
7
16
|
} from "./AttachmentRemove";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export {
|
|
2
|
-
BranchPickerPrevious,
|
|
3
|
-
type BranchPickerPreviousProps,
|
|
2
|
+
BranchPickerPrevious as Previous,
|
|
3
|
+
type BranchPickerPreviousProps as PreviousProps,
|
|
4
4
|
} from "./BranchPickerPrevious";
|
|
5
5
|
export {
|
|
6
|
-
BranchPickerNext,
|
|
7
|
-
type BranchPickerNextProps,
|
|
6
|
+
BranchPickerNext as Next,
|
|
7
|
+
type BranchPickerNextProps as NextProps,
|
|
8
8
|
} from "./BranchPickerNext";
|
|
9
9
|
export {
|
|
10
|
-
BranchPickerNumber,
|
|
11
|
-
type BranchPickerNumberProps,
|
|
10
|
+
BranchPickerNumber as Number,
|
|
11
|
+
type BranchPickerNumberProps as NumberProps,
|
|
12
12
|
} from "./BranchPickerNumber";
|
|
13
13
|
export {
|
|
14
|
-
BranchPickerCount,
|
|
15
|
-
type BranchPickerCountProps,
|
|
14
|
+
BranchPickerCount as Count,
|
|
15
|
+
type BranchPickerCountProps as CountProps,
|
|
16
16
|
} from "./BranchPickerCount";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export {
|
|
2
|
-
ChainOfThoughtRoot,
|
|
3
|
-
type ChainOfThoughtRootProps,
|
|
2
|
+
ChainOfThoughtRoot as Root,
|
|
3
|
+
type ChainOfThoughtRootProps as RootProps,
|
|
4
4
|
} from "./ChainOfThoughtRoot";
|
|
5
5
|
export {
|
|
6
|
-
ChainOfThoughtAccordionTrigger,
|
|
7
|
-
type ChainOfThoughtAccordionTriggerProps,
|
|
6
|
+
ChainOfThoughtAccordionTrigger as AccordionTrigger,
|
|
7
|
+
type ChainOfThoughtAccordionTriggerProps as AccordionTriggerProps,
|
|
8
8
|
} from "./ChainOfThoughtAccordionTrigger";
|
|
9
|
-
export { ChainOfThoughtPrimitiveParts } from "@assistant-ui/core/react";
|
|
9
|
+
export { ChainOfThoughtPrimitiveParts as Parts } from "@assistant-ui/core/react";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { useComposerAddAttachment } from "../../primitive-hooks/useComposerAddAttachment";
|
|
2
|
+
import { useComposerAddAttachment } from "@assistant-ui/core/react";
|
|
4
3
|
import { Pressable, type PressableProps } from "../internal/Pressable";
|
|
5
4
|
|
|
6
5
|
export type ComposerAddAttachmentProps = Omit<PressableProps, "onPress"> & {
|
|
@@ -12,11 +11,10 @@ export const ComposerAddAttachment = ({
|
|
|
12
11
|
disabled: disabledProp,
|
|
13
12
|
...pressableProps
|
|
14
13
|
}: ComposerAddAttachmentProps) => {
|
|
15
|
-
const
|
|
16
|
-
const { addAttachment: _addAttachment } = useComposerAddAttachment();
|
|
14
|
+
const { disabled } = useComposerAddAttachment();
|
|
17
15
|
|
|
18
16
|
return (
|
|
19
|
-
<Pressable disabled={disabledProp ??
|
|
17
|
+
<Pressable disabled={disabledProp ?? disabled} {...pressableProps}>
|
|
20
18
|
{children}
|
|
21
19
|
</Pressable>
|
|
22
20
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import { useComposerCancel } from "
|
|
2
|
+
import { useComposerCancel } from "@assistant-ui/core/react";
|
|
3
3
|
import { Pressable, type PressableProps } from "../internal/Pressable";
|
|
4
4
|
|
|
5
5
|
export type ComposerCancelProps = Omit<PressableProps, "onPress"> & {
|
|
@@ -11,12 +11,12 @@ export const ComposerCancel = ({
|
|
|
11
11
|
disabled,
|
|
12
12
|
...pressableProps
|
|
13
13
|
}: ComposerCancelProps) => {
|
|
14
|
-
const { cancel,
|
|
14
|
+
const { cancel, disabled: hookDisabled } = useComposerCancel();
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<Pressable
|
|
18
18
|
onPress={cancel}
|
|
19
|
-
disabled={disabled ??
|
|
19
|
+
disabled={disabled ?? hookDisabled}
|
|
20
20
|
{...pressableProps}
|
|
21
21
|
>
|
|
22
22
|
{children}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import { useComposerSend } from "
|
|
2
|
+
import { useComposerSend } from "@assistant-ui/core/react";
|
|
3
3
|
import { Pressable, type PressableProps } from "../internal/Pressable";
|
|
4
4
|
|
|
5
5
|
export type ComposerSendProps = Omit<PressableProps, "onPress"> & {
|
|
@@ -11,12 +11,12 @@ export const ComposerSend = ({
|
|
|
11
11
|
disabled,
|
|
12
12
|
...pressableProps
|
|
13
13
|
}: ComposerSendProps) => {
|
|
14
|
-
const { send,
|
|
14
|
+
const { send, disabled: hookDisabled } = useComposerSend();
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<Pressable
|
|
18
18
|
onPress={send}
|
|
19
|
-
disabled={disabled ??
|
|
19
|
+
disabled={disabled ?? hookDisabled}
|
|
20
20
|
{...pressableProps}
|
|
21
21
|
>
|
|
22
22
|
{children}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
export { ComposerRoot, type ComposerRootProps } from "./ComposerRoot";
|
|
2
1
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
ComposerRoot as Root,
|
|
3
|
+
type ComposerRootProps as RootProps,
|
|
4
|
+
} from "./ComposerRoot";
|
|
5
|
+
export {
|
|
6
|
+
ComposerAttachments as Attachments,
|
|
7
|
+
ComposerAttachmentByIndex as AttachmentByIndex,
|
|
5
8
|
} from "./ComposerAttachments";
|
|
6
|
-
export { ComposerInput, type ComposerInputProps } from "./ComposerInput";
|
|
7
|
-
export { ComposerSend, type ComposerSendProps } from "./ComposerSend";
|
|
8
|
-
export { ComposerCancel, type ComposerCancelProps } from "./ComposerCancel";
|
|
9
9
|
export {
|
|
10
|
-
|
|
11
|
-
type
|
|
12
|
-
} from "./
|
|
13
|
-
export { ComposerIf } from "./ComposerIf";
|
|
10
|
+
ComposerInput as Input,
|
|
11
|
+
type ComposerInputProps as InputProps,
|
|
12
|
+
} from "./ComposerInput";
|
|
14
13
|
export {
|
|
15
|
-
|
|
16
|
-
type
|
|
17
|
-
} from "./
|
|
14
|
+
ComposerSend as Send,
|
|
15
|
+
type ComposerSendProps as SendProps,
|
|
16
|
+
} from "./ComposerSend";
|
|
18
17
|
export {
|
|
19
|
-
|
|
20
|
-
type
|
|
21
|
-
} from "./
|
|
18
|
+
ComposerCancel as Cancel,
|
|
19
|
+
type ComposerCancelProps as CancelProps,
|
|
20
|
+
} from "./ComposerCancel";
|
|
22
21
|
export {
|
|
23
|
-
|
|
24
|
-
type
|
|
25
|
-
} from "./
|
|
22
|
+
ComposerAddAttachment as AddAttachment,
|
|
23
|
+
type ComposerAddAttachmentProps as AddAttachmentProps,
|
|
24
|
+
} from "./ComposerAddAttachment";
|
|
25
|
+
export { ComposerIf as If } from "./ComposerIf";
|