@bysages/react 0.4.3 → 0.5.0
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/ai-B3vbpXlK.mjs +309 -0
- package/dist/ai-prompt-input-k34KssHJ.mjs +401 -0
- package/dist/{ai-response-CjjjprMY.mjs → ai-response-DTxdL5rX.mjs} +9 -11
- package/dist/{chevron-BA7kV9m7.mjs → chevron-DnImlNip.mjs} +2 -3
- package/dist/components/accordion/index.d.mts +1 -2
- package/dist/components/accordion/index.mjs +3 -4
- package/dist/components/affix/index.d.mts +1 -2
- package/dist/components/affix/index.mjs +2 -3
- package/dist/components/ai/index.d.mts +107 -2
- package/dist/components/ai/index.mjs +7 -82
- package/dist/components/ai-action/index.d.mts +0 -2
- package/dist/components/ai-action/index.mjs +2 -3
- package/dist/components/ai-attachments/index.d.mts +0 -2
- package/dist/components/ai-attachments/index.mjs +4 -5
- package/dist/components/ai-message/index.d.mts +2 -14
- package/dist/components/ai-message/index.mjs +5 -4
- package/dist/components/ai-prompt-input/index.d.mts +14 -18
- package/dist/components/ai-prompt-input/index.mjs +1 -126
- package/dist/components/ai-reasoning/index.d.mts +0 -2
- package/dist/components/ai-reasoning/index.mjs +3 -4
- package/dist/components/ai-response/index.d.mts +1 -3
- package/dist/components/ai-response/index.mjs +1 -2
- package/dist/components/ai-source/index.d.mts +0 -2
- package/dist/components/ai-source/index.mjs +2 -3
- package/dist/components/ai-suggestion/index.d.mts +0 -2
- package/dist/components/ai-suggestion/index.mjs +2 -3
- package/dist/components/ai-tool/index.d.mts +2 -24
- package/dist/components/ai-tool/index.mjs +46 -14
- package/dist/components/alert/index.d.mts +1 -2
- package/dist/components/alert/index.mjs +2 -3
- package/dist/components/angle-slider/index.d.mts +1 -2
- package/dist/components/angle-slider/index.mjs +2 -3
- package/dist/components/aspect-ratio/index.d.mts +1 -2
- package/dist/components/aspect-ratio/index.mjs +2 -3
- package/dist/components/autocomplete/index.d.mts +1 -2
- package/dist/components/autocomplete/index.mjs +3 -4
- package/dist/components/avatar/index.d.mts +13 -4
- package/dist/components/avatar/index.mjs +20 -6
- package/dist/components/avatar-group/index.d.mts +1 -2
- package/dist/components/avatar-group/index.mjs +2 -3
- package/dist/components/back-top/index.d.mts +1 -2
- package/dist/components/back-top/index.mjs +3 -4
- package/dist/components/badge/index.d.mts +1 -2
- package/dist/components/badge/index.mjs +2 -3
- package/dist/components/banner/index.d.mts +17 -4
- package/dist/components/banner/index.mjs +21 -6
- package/dist/components/bento/index.d.mts +1 -3
- package/dist/components/bento/index.mjs +1 -2
- package/dist/components/block-ui/index.d.mts +1 -2
- package/dist/components/block-ui/index.mjs +2 -3
- package/dist/components/breadcrumb/index.d.mts +16 -3
- package/dist/components/breadcrumb/index.mjs +22 -5
- package/dist/components/browser/index.d.mts +1 -3
- package/dist/components/browser/index.mjs +1 -2
- package/dist/components/button/index.d.mts +1 -2
- package/dist/components/button/index.mjs +2 -3
- package/dist/components/button-group/index.d.mts +1 -2
- package/dist/components/button-group/index.mjs +1 -2
- package/dist/components/calendar/index.d.mts +1 -2
- package/dist/components/calendar/index.mjs +3 -4
- package/dist/components/card/index.d.mts +1 -3
- package/dist/components/card/index.mjs +1 -2
- package/dist/components/carousel/index.d.mts +1 -2
- package/dist/components/carousel/index.mjs +3 -4
- package/dist/components/cascade-select/index.d.mts +1 -2
- package/dist/components/cascade-select/index.mjs +6 -7
- package/dist/components/checkbox/index.d.mts +1 -2
- package/dist/components/checkbox/index.mjs +3 -4
- package/dist/components/checkbox-group/index.d.mts +1 -2
- package/dist/components/checkbox-group/index.mjs +3 -4
- package/dist/components/chip/index.d.mts +1 -2
- package/dist/components/chip/index.mjs +2 -3
- package/dist/components/client-only/index.d.mts +0 -2
- package/dist/components/client-only/index.mjs +2 -3
- package/dist/components/clipboard/index.d.mts +1 -2
- package/dist/components/clipboard/index.mjs +3 -4
- package/dist/components/collapsible/index.d.mts +1 -2
- package/dist/components/collapsible/index.mjs +3 -4
- package/dist/components/collection/index.mjs +1 -2
- package/dist/components/color-picker/index.d.mts +3 -2
- package/dist/components/color-picker/index.mjs +38 -25
- package/dist/components/combobox/index.d.mts +1 -2
- package/dist/components/combobox/index.mjs +3 -4
- package/dist/components/command/index.d.mts +1 -2
- package/dist/components/command/index.mjs +3 -4
- package/dist/components/comment/index.d.mts +1 -2
- package/dist/components/comment/index.mjs +2 -3
- package/dist/components/config-provider/index.d.mts +1 -2
- package/dist/components/config-provider/index.mjs +2 -3
- package/dist/components/container/index.d.mts +1 -2
- package/dist/components/container/index.mjs +2 -3
- package/dist/components/data-view/index.d.mts +1 -2
- package/dist/components/data-view/index.mjs +3 -4
- package/dist/components/date-input/index.d.mts +0 -2
- package/dist/components/date-input/index.mjs +2 -3
- package/dist/components/date-picker/index.d.mts +0 -2
- package/dist/components/date-picker/index.mjs +3 -4
- package/dist/components/deferred-content/index.d.mts +1 -2
- package/dist/components/deferred-content/index.mjs +2 -3
- package/dist/components/descriptions/index.d.mts +1 -2
- package/dist/components/descriptions/index.mjs +2 -3
- package/dist/components/dialog/index.d.mts +31 -4
- package/dist/components/dialog/index.mjs +41 -10
- package/dist/components/dock/index.d.mts +1 -3
- package/dist/components/dock/index.mjs +1 -2
- package/dist/components/download-trigger/index.d.mts +0 -2
- package/dist/components/download-trigger/index.mjs +2 -3
- package/dist/components/drawer/index.d.mts +1 -2
- package/dist/components/drawer/index.mjs +3 -4
- package/dist/components/dynamic-input/index.d.mts +1 -2
- package/dist/components/dynamic-input/index.mjs +5 -6
- package/dist/components/editable/index.d.mts +1 -2
- package/dist/components/editable/index.mjs +3 -4
- package/dist/components/ellipsis/index.d.mts +1 -2
- package/dist/components/ellipsis/index.mjs +2 -3
- package/dist/components/empty/index.d.mts +1 -3
- package/dist/components/empty/index.mjs +1 -2
- package/dist/components/field/index.d.mts +1 -2
- package/dist/components/field/index.mjs +2 -3
- package/dist/components/fieldset/index.d.mts +1 -2
- package/dist/components/fieldset/index.mjs +2 -3
- package/dist/components/file-upload/index.d.mts +1 -2
- package/dist/components/file-upload/index.mjs +4 -9
- package/dist/components/float-button/index.d.mts +23 -3
- package/dist/components/float-button/index.mjs +30 -5
- package/dist/components/floating-panel/index.d.mts +1 -2
- package/dist/components/floating-panel/index.mjs +8 -4
- package/dist/components/focus-trap/index.d.mts +0 -2
- package/dist/components/focus-trap/index.mjs +2 -3
- package/dist/components/form/index.d.mts +0 -2
- package/dist/components/form/index.mjs +2 -3
- package/dist/components/format/index.d.mts +1 -3
- package/dist/components/format/index.mjs +1 -2
- package/dist/components/frame/index.d.mts +1 -3
- package/dist/components/frame/index.mjs +3 -4
- package/dist/components/grid/index.d.mts +1 -2
- package/dist/components/grid/index.mjs +2 -3
- package/dist/components/highlight/index.d.mts +1 -3
- package/dist/components/highlight/index.mjs +2 -3
- package/dist/components/hover-card/index.d.mts +1 -2
- package/dist/components/hover-card/index.mjs +2 -3
- package/dist/components/icon/index.d.mts +1 -2
- package/dist/components/icon/index.mjs +2 -3
- package/dist/components/image/index.d.mts +1 -2
- package/dist/components/image/index.mjs +3 -4
- package/dist/components/image-cropper/index.d.mts +1 -2
- package/dist/components/image-cropper/index.mjs +2 -3
- package/dist/components/image-viewer/index.d.mts +1 -1
- package/dist/components/image-viewer/index.mjs +1 -2
- package/dist/components/input/index.d.mts +1 -3
- package/dist/components/input/index.mjs +1 -2
- package/dist/components/input-group/index.d.mts +1 -3
- package/dist/components/input-group/index.mjs +1 -2
- package/dist/components/json-tree-view/index.d.mts +1 -2
- package/dist/components/json-tree-view/index.mjs +3 -4
- package/dist/components/kbd/index.d.mts +1 -2
- package/dist/components/kbd/index.mjs +2 -3
- package/dist/components/layout/index.d.mts +1 -2
- package/dist/components/layout/index.mjs +19 -15
- package/dist/components/link/index.d.mts +1 -2
- package/dist/components/link/index.mjs +2 -3
- package/dist/components/list/index.d.mts +1 -2
- package/dist/components/list/index.mjs +1 -2
- package/dist/components/listbox/index.d.mts +0 -2
- package/dist/components/listbox/index.mjs +3 -4
- package/dist/components/marquee/index.d.mts +1 -2
- package/dist/components/marquee/index.mjs +2 -3
- package/dist/components/masonry/index.d.mts +1 -2
- package/dist/components/masonry/index.mjs +2 -3
- package/dist/components/media-player/index.d.mts +1 -1
- package/dist/components/media-player/index.mjs +1 -2
- package/dist/components/mentions/index.d.mts +2 -2
- package/dist/components/mentions/index.mjs +1 -2
- package/dist/components/menu/index.d.mts +1 -2
- package/dist/components/menu/index.mjs +3 -4
- package/dist/components/menubar/index.d.mts +1 -2
- package/dist/components/menubar/index.mjs +2 -3
- package/dist/components/meter/index.d.mts +1 -3
- package/dist/components/meter/index.mjs +1 -2
- package/dist/components/navigation-menu/index.d.mts +1 -2
- package/dist/components/navigation-menu/index.mjs +2 -3
- package/dist/components/number-input/index.d.mts +1 -2
- package/dist/components/number-input/index.mjs +3 -4
- package/dist/components/order-list/index.d.mts +1 -2
- package/dist/components/order-list/index.mjs +4 -5
- package/dist/components/page-header/index.d.mts +1 -3
- package/dist/components/page-header/index.mjs +1 -2
- package/dist/components/pagination/index.d.mts +3 -4
- package/dist/components/pagination/index.mjs +3 -4
- package/dist/components/password-input/index.d.mts +1 -2
- package/dist/components/password-input/index.mjs +3 -4
- package/dist/components/pin-input/index.d.mts +1 -2
- package/dist/components/pin-input/index.mjs +2 -3
- package/dist/components/popconfirm/index.d.mts +2 -3
- package/dist/components/popconfirm/index.mjs +2 -3
- package/dist/components/popover/index.d.mts +1 -1
- package/dist/components/popover/index.mjs +3 -4
- package/dist/components/presence/index.d.mts +0 -2
- package/dist/components/presence/index.mjs +2 -3
- package/dist/components/progress/index.d.mts +1 -2
- package/dist/components/progress/index.mjs +2 -3
- package/dist/components/progress-group/index.d.mts +1 -2
- package/dist/components/progress-group/index.mjs +2 -3
- package/dist/components/qr-code/index.d.mts +1 -2
- package/dist/components/qr-code/index.mjs +2 -3
- package/dist/components/radio-group/index.d.mts +1 -2
- package/dist/components/radio-group/index.mjs +2 -3
- package/dist/components/rating-group/index.d.mts +1 -2
- package/dist/components/rating-group/index.mjs +3 -4
- package/dist/components/result/index.d.mts +1 -2
- package/dist/components/result/index.mjs +2 -3
- package/dist/components/scroll-area/index.d.mts +8 -3
- package/dist/components/scroll-area/index.mjs +7 -6
- package/dist/components/segment-group/index.d.mts +1 -2
- package/dist/components/segment-group/index.mjs +2 -3
- package/dist/components/select/index.d.mts +1 -1
- package/dist/components/select/index.mjs +1 -2
- package/dist/components/separator/index.d.mts +1 -2
- package/dist/components/separator/index.mjs +2 -3
- package/dist/components/signature-pad/index.d.mts +1 -2
- package/dist/components/signature-pad/index.mjs +3 -4
- package/dist/components/skeleton/index.d.mts +1 -2
- package/dist/components/skeleton/index.mjs +2 -3
- package/dist/components/slider/index.d.mts +1 -2
- package/dist/components/slider/index.mjs +2 -3
- package/dist/components/spinner/index.d.mts +1 -2
- package/dist/components/spinner/index.mjs +3 -4
- package/dist/components/split-button/index.d.mts +1 -2
- package/dist/components/split-button/index.mjs +4 -5
- package/dist/components/splitter/index.d.mts +1 -2
- package/dist/components/splitter/index.mjs +2 -3
- package/dist/components/spotlight/index.d.mts +1 -2
- package/dist/components/spotlight/index.mjs +2 -3
- package/dist/components/stack/index.d.mts +1 -2
- package/dist/components/stack/index.mjs +2 -3
- package/dist/components/stat/index.d.mts +1 -3
- package/dist/components/stat/index.mjs +1 -2
- package/dist/components/steps/index.d.mts +0 -2
- package/dist/components/steps/index.mjs +2 -3
- package/dist/components/swap/index.d.mts +1 -2
- package/dist/components/swap/index.mjs +3 -4
- package/dist/components/switch/index.d.mts +1 -2
- package/dist/components/switch/index.mjs +2 -3
- package/dist/components/table/index.d.mts +0 -2
- package/dist/components/table/index.mjs +5 -6
- package/dist/components/tabs/index.d.mts +9 -3
- package/dist/components/tabs/index.mjs +36 -8
- package/dist/components/tag/index.d.mts +1 -2
- package/dist/components/tag/index.mjs +3 -4
- package/dist/components/tags-input/index.d.mts +1 -2
- package/dist/components/tags-input/index.mjs +3 -4
- package/dist/components/terminal/index.d.mts +4 -3
- package/dist/components/terminal/index.mjs +8 -7
- package/dist/components/textarea/index.d.mts +1 -2
- package/dist/components/textarea/index.mjs +2 -3
- package/dist/components/timeline/index.d.mts +1 -2
- package/dist/components/timeline/index.mjs +1 -2
- package/dist/components/timer/index.d.mts +1 -2
- package/dist/components/timer/index.mjs +2 -3
- package/dist/components/toast/index.d.mts +0 -2
- package/dist/components/toast/index.mjs +18 -6
- package/dist/components/toc/index.d.mts +1 -2
- package/dist/components/toc/index.mjs +2 -3
- package/dist/components/toggle/index.d.mts +1 -2
- package/dist/components/toggle/index.mjs +2 -3
- package/dist/components/toggle-group/index.d.mts +1 -2
- package/dist/components/toggle-group/index.mjs +3 -4
- package/dist/components/toolbar/index.d.mts +1 -2
- package/dist/components/toolbar/index.mjs +2 -3
- package/dist/components/tooltip/index.d.mts +1 -2
- package/dist/components/tooltip/index.mjs +2 -3
- package/dist/components/tour/index.d.mts +0 -2
- package/dist/components/tour/index.mjs +2 -3
- package/dist/components/transfer/index.d.mts +1 -2
- package/dist/components/transfer/index.mjs +5 -6
- package/dist/components/tree-select/index.d.mts +2 -3
- package/dist/components/tree-select/index.mjs +5 -6
- package/dist/components/tree-view/index.d.mts +15 -5
- package/dist/components/tree-view/index.mjs +30 -12
- package/dist/components/typography/index.d.mts +1 -3
- package/dist/components/typography/index.mjs +1 -2
- package/dist/components/user/index.d.mts +1 -2
- package/dist/components/user/index.mjs +2 -3
- package/dist/components/virtual-list/index.d.mts +1 -2
- package/dist/components/virtual-list/index.mjs +2 -3
- package/dist/components/watermark/index.d.mts +1 -2
- package/dist/components/watermark/index.mjs +2 -3
- package/dist/{family-DE_GQeeM.mjs → family-Co1YsN4N.mjs} +1 -2
- package/dist/generative/index.d.mts +0 -2
- package/dist/generative/index.mjs +146 -106
- package/dist/{icon-Cri0-7-x.mjs → icon-C9udWCyz.mjs} +1 -2
- package/dist/{id-C37UYLwJ.mjs → id-Ctic_3o8.mjs} +1 -2
- package/dist/{image-viewer-D4FuYrk6.mjs → image-viewer-BYiXpi1X.mjs} +21 -26
- package/dist/{index-Eu-Bttta.d.mts → index-BVdkcSSY.d.mts} +0 -2
- package/dist/index-CjO4Ggf0.d.mts +115 -0
- package/dist/{index-Dj8S4eyJ.d.mts → index-D4C52fI7.d.mts} +0 -4
- package/dist/{index-BcRdWGY-.d.mts → index-DIZEFqJM.d.mts} +0 -8
- package/dist/{index-Bbg4heDO.d.mts → index-DcpvCyt6.d.mts} +63 -18
- package/dist/{index-D_iKc2Uw.d.mts → index-DczfbPCg.d.mts} +0 -4
- package/dist/index-lCsvE2Vl.d.mts +37 -0
- package/dist/index.d.mts +14 -14
- package/dist/index.mjs +10 -10
- package/dist/{input-BDpQ0e6G.mjs → input-YRjehBhU.mjs} +3 -5
- package/dist/{media-player-C0WcjVI-.mjs → media-player-CO2Cczl-.mjs} +7 -12
- package/dist/mentions-De7ChJbl.mjs +335 -0
- package/dist/{messages-1jJWtaYU.mjs → messages-B6n0lVyt.mjs} +1 -2
- package/dist/{select-D_soVdWK.mjs → select-DQ5669_K.mjs} +4 -6
- package/package.json +17 -17
- package/dist/index-B4twHAQC.d.mts +0 -10456
- package/dist/mentions-BwnyvdXz.mjs +0 -213
|
@@ -1,82 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import { AiSource as Source, AiSources as Sources } from "../ai-source/index.mjs";
|
|
9
|
-
import { AiSuggestion as Suggestion } from "../ai-suggestion/index.mjs";
|
|
10
|
-
import { AiTool as Tool } from "../ai-tool/index.mjs";
|
|
11
|
-
import { injectComponentStyle } from "@bysages/core/styling";
|
|
12
|
-
import { jsx } from "react/jsx-runtime";
|
|
13
|
-
//#region src/components/ai/index.tsx
|
|
14
|
-
/** A conversation column: Root is the log, Message carries a role, and
|
|
15
|
-
* the speaking parts — Response, Reasoning, Tool, Sources — part the
|
|
16
|
-
* stream. The interactive folds are the shared Collapsible wearing a
|
|
17
|
-
* `data-ai` marker, so the machine work is never ours. Parts stay
|
|
18
|
-
* agnostic of any client; consumers map their message format (e.g. the
|
|
19
|
-
* `UIMessage` parts re-exported here) onto these primitives. */
|
|
20
|
-
function part(name, tag, extra = {}) {
|
|
21
|
-
const Tag = tag;
|
|
22
|
-
const Component = ({ children, ...rest }) => /* @__PURE__ */ jsx(Tag, {
|
|
23
|
-
...extra,
|
|
24
|
-
...rest,
|
|
25
|
-
"data-scope": "ai",
|
|
26
|
-
"data-part": name.toLowerCase(),
|
|
27
|
-
children
|
|
28
|
-
});
|
|
29
|
-
Component.displayName = "Ai" + name;
|
|
30
|
-
return Component;
|
|
31
|
-
}
|
|
32
|
-
/** The log itself: the column every stroke lands in, a landmark to
|
|
33
|
-
* screen readers. */
|
|
34
|
-
function AiConversation({ children, ...rest }) {
|
|
35
|
-
const messages = useComponentMessages();
|
|
36
|
-
return /* @__PURE__ */ jsx("div", {
|
|
37
|
-
...rest,
|
|
38
|
-
role: "log",
|
|
39
|
-
"aria-label": rest["aria-label"] ?? messages.ai.conversation,
|
|
40
|
-
"data-scope": "ai",
|
|
41
|
-
"data-part": "conversation",
|
|
42
|
-
children
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
/** The bubble's inner measure — content that belongs to neither side
|
|
46
|
-
* specifically. */
|
|
47
|
-
const AiContent = withSelfRoot(part("Content", "div"));
|
|
48
|
-
/** The quiet row under a message — copy, retry, feedback. */
|
|
49
|
-
const AiActions = withSelfRoot(part("Actions", "div"));
|
|
50
|
-
/** The while-it-works whisper for the in-flight turns. */
|
|
51
|
-
function AiLoader({ children, ...rest }) {
|
|
52
|
-
const messages = useComponentMessages();
|
|
53
|
-
return /* @__PURE__ */ jsx("span", {
|
|
54
|
-
...rest,
|
|
55
|
-
role: "status",
|
|
56
|
-
"aria-label": rest["aria-label"] ?? messages.ai.loading,
|
|
57
|
-
"data-scope": "ai",
|
|
58
|
-
"data-part": "loader",
|
|
59
|
-
children
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
/** The whole family under one handle — `Ai.Conversation`,
|
|
63
|
-
* `Ai.Message`, and the rest, exactly as before the split. */
|
|
64
|
-
const Ai = Object.assign(AiConversation, {
|
|
65
|
-
Root: AiConversation,
|
|
66
|
-
Conversation: AiConversation,
|
|
67
|
-
MessageContent: AiContent,
|
|
68
|
-
Actions: AiActions,
|
|
69
|
-
Loader: AiLoader,
|
|
70
|
-
Message,
|
|
71
|
-
Response,
|
|
72
|
-
Reasoning,
|
|
73
|
-
Tool,
|
|
74
|
-
Sources,
|
|
75
|
-
Source,
|
|
76
|
-
Action,
|
|
77
|
-
Suggestion,
|
|
78
|
-
PromptInput
|
|
79
|
-
});
|
|
80
|
-
injectComponentStyle("ai");
|
|
81
|
-
//#endregion
|
|
82
|
-
export { Ai, AiActions, AiContent };
|
|
1
|
+
import "../ai-action/index.mjs";
|
|
2
|
+
import "../ai-message/index.mjs";
|
|
3
|
+
import "../ai-reasoning/index.mjs";
|
|
4
|
+
import "../ai-source/index.mjs";
|
|
5
|
+
import "../ai-suggestion/index.mjs";
|
|
6
|
+
import "../ai-tool/index.mjs";
|
|
7
|
+
export { t as Ai, n as AiActions, r as AiContent, i as AiConversation, a as AiJumpToLatest, o as AiMedia, s as AiParts, c as toolPartDisplay } from "../../ai-B3vbpXlK.mjs";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ButtonHTMLAttributes, ReactNode } from "react";
|
|
2
|
-
//#region src/components/ai-action/index.d.ts
|
|
3
2
|
/** A quiet icon button — copy, retry, thumbs. The label names it to
|
|
4
3
|
* assistive tech and as the hover title. The control itself is the
|
|
5
4
|
* shared Button in its ghost register. */
|
|
@@ -13,5 +12,4 @@ declare function ActionImpl({ label, children, ...rest }: ActionProps): import("
|
|
|
13
12
|
export declare const Action: typeof ActionImpl & {
|
|
14
13
|
Root: typeof ActionImpl;
|
|
15
14
|
};
|
|
16
|
-
//#endregion
|
|
17
15
|
export { Action as AiAction };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as withSelfRoot } from "../../family-
|
|
1
|
+
import { t as withSelfRoot } from "../../family-Co1YsN4N.mjs";
|
|
2
2
|
import { Button } from "../button/index.mjs";
|
|
3
3
|
import { injectComponentStyle } from "@bysages/core/styling";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
// src/components/ai-action/index.tsx
|
|
6
6
|
function ActionImpl({ label, children, ...rest }) {
|
|
7
7
|
injectComponentStyle("ai");
|
|
8
8
|
return /* @__PURE__ */ jsx(Button, {
|
|
@@ -16,5 +16,4 @@ function ActionImpl({ label, children, ...rest }) {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
const Action = withSelfRoot(ActionImpl);
|
|
19
|
-
//#endregion
|
|
20
19
|
export { Action, Action as AiAction };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
|
-
//#region src/components/ai-attachments/index.d.ts
|
|
3
2
|
/** One file riding the prompt: its icon by extension, its name and
|
|
4
3
|
* human size, and a quiet way to take it back off. Uploading reads as
|
|
5
4
|
* a dashed ghost, error as danger ink. */
|
|
@@ -21,5 +20,4 @@ declare function AttachmentsImpl({ children, ...rest }: HTMLAttributes<HTMLSpanE
|
|
|
21
20
|
export declare const Attachments: typeof AttachmentsImpl & {
|
|
22
21
|
Root: typeof AttachmentsImpl;
|
|
23
22
|
};
|
|
24
|
-
//#endregion
|
|
25
23
|
export { Attachment as AiAttachment, Attachments as AiAttachments };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { r as iconNode } from "../../icon-
|
|
2
|
-
import { t as withSelfRoot } from "../../family-
|
|
3
|
-
import { n as useComponentMessages, t as formatMessage } from "../../messages-
|
|
1
|
+
import { r as iconNode } from "../../icon-C9udWCyz.mjs";
|
|
2
|
+
import { t as withSelfRoot } from "../../family-Co1YsN4N.mjs";
|
|
3
|
+
import { n as useComponentMessages, t as formatMessage } from "../../messages-B6n0lVyt.mjs";
|
|
4
4
|
import { injectComponentStyle } from "@bysages/core/styling";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// src/components/ai-attachments/index.tsx
|
|
7
7
|
const imageIcon = iconNode("image", {
|
|
8
8
|
width: 16,
|
|
9
9
|
height: 16
|
|
@@ -76,5 +76,4 @@ function AttachmentsImpl({ children, ...rest }) {
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
const Attachments = withSelfRoot(AttachmentsImpl);
|
|
79
|
-
//#endregion
|
|
80
79
|
export { Attachment as AiAttachment, Attachment, Attachments as AiAttachments, Attachments };
|
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/** Whose stroke this is — the user's words sit in a recessed bubble,
|
|
4
|
-
* the assistant speaks flat on the paper. */
|
|
5
|
-
export interface MessageProps extends HTMLAttributes<HTMLElement> {
|
|
6
|
-
role?: "user" | "assistant" | "system";
|
|
7
|
-
children?: ReactNode;
|
|
8
|
-
}
|
|
9
|
-
declare function MessageImpl({ role, children, ...rest }: MessageProps): import("react").JSX.Element;
|
|
10
|
-
export declare const Message: typeof MessageImpl & {
|
|
11
|
-
Root: typeof MessageImpl;
|
|
12
|
-
};
|
|
13
|
-
//#endregion
|
|
14
|
-
export { Message as AiMessage };
|
|
1
|
+
import { n as MessageProps, t as Message } from "../../index-CjO4Ggf0.mjs";
|
|
2
|
+
export { Message as AiMessage, Message, MessageProps };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { t as withSelfRoot } from "../../family-
|
|
1
|
+
import { t as withSelfRoot } from "../../family-Co1YsN4N.mjs";
|
|
2
2
|
import { injectComponentStyle } from "@bysages/core/styling";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
5
|
-
function MessageImpl({ role
|
|
4
|
+
// src/components/ai-message/index.tsx
|
|
5
|
+
function MessageImpl({ message, role: roleProp, children, ...rest }) {
|
|
6
6
|
injectComponentStyle("ai");
|
|
7
|
+
const role = message?.role ?? roleProp ?? "assistant";
|
|
7
8
|
return /* @__PURE__ */ jsx("article", {
|
|
8
9
|
...rest,
|
|
9
10
|
"data-scope": "ai",
|
|
10
11
|
"data-part": "message",
|
|
12
|
+
...message ? { "data-message-id": message.id } : {},
|
|
11
13
|
"data-role": role,
|
|
12
14
|
children
|
|
13
15
|
});
|
|
14
16
|
}
|
|
15
17
|
const Message = withSelfRoot(MessageImpl);
|
|
16
|
-
//#endregion
|
|
17
18
|
export { Message as AiMessage, Message };
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
import { t as MentionEntry } from "../../index-
|
|
1
|
+
import { c as MentionCommitKey, n as MentionPlacement, t as MentionEntry } from "../../index-DcpvCyt6.mjs";
|
|
2
2
|
import { HTMLAttributes, ReactNode } from "react";
|
|
3
|
-
//#region src/components/ai-prompt-input/index.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* The prompt vessel: the shared field textarea — self-growing on the
|
|
6
|
-
* machine's autoresize — with the submit seal riding its last line.
|
|
7
|
-
*
|
|
8
|
-
* attachments riding above, `leading` for the tools at the text's
|
|
9
|
-
* left, `trailing` for the seal itself, `footer` for the tools beneath,
|
|
10
|
-
* and `footerEnd` for the controls that close the footer row — the
|
|
11
|
-
* seal falls there by default, so a model picker dropped in rides the
|
|
12
|
-
* send's shoulder. Controlled — bind `value` and take the text on
|
|
13
|
-
* `submit`. Enter sends; Shift+Enter breaks the line. While `busy`
|
|
14
|
-
* the seal becomes a stop seal and Enter holds its breath.
|
|
5
|
+
* machine's autoresize — with the submit seal riding its last line. With
|
|
6
|
+
* mentions it becomes a token editor; the bound value remains plain text.
|
|
15
7
|
*/
|
|
16
|
-
export interface PromptInputProps extends Omit<HTMLAttributes<HTMLFormElement>, "onSubmit"> {
|
|
8
|
+
export interface PromptInputProps extends Omit<HTMLAttributes<HTMLFormElement>, "onSubmit" | "onSelect"> {
|
|
17
9
|
/** The draft in the vessel — bind `value`; it clears itself on a
|
|
18
10
|
* successful submit. */
|
|
19
11
|
value: string;
|
|
@@ -28,23 +20,27 @@ export interface PromptInputProps extends Omit<HTMLAttributes<HTMLFormElement>,
|
|
|
28
20
|
/** The machine is working — the seal becomes a stop seal and Enter
|
|
29
21
|
* holds its breath. */
|
|
30
22
|
busy?: boolean;
|
|
31
|
-
/** Mention candidates
|
|
32
|
-
*
|
|
33
|
-
* textarea. While candidates are up, Enter inserts and the send
|
|
34
|
-
* waits. */
|
|
23
|
+
/** Mention candidates. Rich tokens render after a choice; the value
|
|
24
|
+
* stays ordinary composer text. */
|
|
35
25
|
mentions?: {
|
|
36
26
|
items: MentionEntry[];
|
|
37
27
|
trigger?: string;
|
|
28
|
+
triggers?: string | string[];
|
|
29
|
+
insertOnSelect?: boolean;
|
|
30
|
+
commitKeys?: MentionCommitKey[];
|
|
31
|
+
placement?: MentionPlacement;
|
|
32
|
+
clearQueryOnSelect?: boolean;
|
|
38
33
|
};
|
|
34
|
+
/** The whole mention entry was selected. */
|
|
35
|
+
onSelect?: (entry: MentionEntry) => void;
|
|
39
36
|
header?: ReactNode;
|
|
40
37
|
leading?: ReactNode;
|
|
41
38
|
trailing?: ReactNode;
|
|
42
39
|
footer?: ReactNode;
|
|
43
40
|
footerEnd?: ReactNode;
|
|
44
41
|
}
|
|
45
|
-
declare function PromptInputImpl({ value, onValueChange, onSubmit, onStop, placeholder, "aria-label": ariaLabel, disabled, busy, mentions, header, leading, trailing, footer, footerEnd, ...rest }: PromptInputProps): import("react").JSX.Element;
|
|
42
|
+
declare function PromptInputImpl({ value, onValueChange, onSubmit, onStop, placeholder, "aria-label": ariaLabel, disabled, busy, mentions, onSelect, header, leading, trailing, footer, footerEnd, ...rest }: PromptInputProps): import("react").JSX.Element;
|
|
46
43
|
export declare const PromptInput: typeof PromptInputImpl & {
|
|
47
44
|
Root: typeof PromptInputImpl;
|
|
48
45
|
};
|
|
49
|
-
//#endregion
|
|
50
46
|
export { PromptInput as AiPromptInput };
|
|
@@ -1,126 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { t as withSelfRoot } from "../../family-DE_GQeeM.mjs";
|
|
3
|
-
import { n as useComponentMessages } from "../../messages-1jJWtaYU.mjs";
|
|
4
|
-
import { Button } from "../button/index.mjs";
|
|
5
|
-
import { Field } from "../field/index.mjs";
|
|
6
|
-
import { n as MentionsVessel, r as useMentions } from "../../mentions-BwnyvdXz.mjs";
|
|
7
|
-
import { injectComponentStyle } from "@bysages/core/styling";
|
|
8
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
import { useRef } from "react";
|
|
10
|
-
//#region src/components/ai-prompt-input/index.tsx
|
|
11
|
-
const arrowUpIcon = iconNode("arrow-up", {
|
|
12
|
-
width: 14,
|
|
13
|
-
height: 14
|
|
14
|
-
});
|
|
15
|
-
const stopIcon = iconNode("square", {
|
|
16
|
-
width: 14,
|
|
17
|
-
height: 14
|
|
18
|
-
});
|
|
19
|
-
/** An empty slot leaves no part in the anatomy — the bare vessel keeps
|
|
20
|
-
* its single-line posture. */
|
|
21
|
-
function row(part, content) {
|
|
22
|
-
if (content == null || Array.isArray(content) && content.length === 0) return null;
|
|
23
|
-
return /* @__PURE__ */ jsx("div", {
|
|
24
|
-
"data-scope": "ai",
|
|
25
|
-
"data-part": part,
|
|
26
|
-
children: content
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
function PromptInputImpl({ value, onValueChange, onSubmit, onStop, placeholder, "aria-label": ariaLabel, disabled = false, busy = false, mentions, header, leading, trailing, footer, footerEnd, ...rest }) {
|
|
30
|
-
injectComponentStyle("ai");
|
|
31
|
-
const fieldRef = useRef(null);
|
|
32
|
-
const messages = useComponentMessages();
|
|
33
|
-
const placeholderText = placeholder ?? messages.ai.conversation;
|
|
34
|
-
const mentionState = useMentions(() => ({
|
|
35
|
-
items: mentions?.items ?? [],
|
|
36
|
-
trigger: mentions?.trigger
|
|
37
|
-
}), () => fieldRef.current, {
|
|
38
|
-
getText: () => fieldRef.current?.value ?? value,
|
|
39
|
-
setText: (next) => onValueChange?.(next)
|
|
40
|
-
});
|
|
41
|
-
const mentionsActive = mentions != null;
|
|
42
|
-
const submit = () => {
|
|
43
|
-
const text = value.trim();
|
|
44
|
-
if (!text || disabled || busy) return;
|
|
45
|
-
onSubmit?.(text);
|
|
46
|
-
onValueChange?.("");
|
|
47
|
-
};
|
|
48
|
-
const seal = busy ? /* @__PURE__ */ jsx(Button, {
|
|
49
|
-
variant: "solid",
|
|
50
|
-
size: "sm",
|
|
51
|
-
square: true,
|
|
52
|
-
type: "button",
|
|
53
|
-
"aria-label": messages.ai.stop,
|
|
54
|
-
disabled,
|
|
55
|
-
onClick: () => onStop?.(),
|
|
56
|
-
children: stopIcon
|
|
57
|
-
}) : /* @__PURE__ */ jsx(Button, {
|
|
58
|
-
variant: "solid",
|
|
59
|
-
size: "sm",
|
|
60
|
-
square: true,
|
|
61
|
-
type: "submit",
|
|
62
|
-
"aria-label": messages.ai.send,
|
|
63
|
-
disabled: disabled || !value.trim(),
|
|
64
|
-
children: arrowUpIcon
|
|
65
|
-
});
|
|
66
|
-
const hasFooter = footer != null && (!Array.isArray(footer) || footer.length > 0);
|
|
67
|
-
return /* @__PURE__ */ jsxs("form", {
|
|
68
|
-
...rest,
|
|
69
|
-
"data-scope": "ai",
|
|
70
|
-
"data-part": "prompt",
|
|
71
|
-
onSubmit: (event) => {
|
|
72
|
-
event.preventDefault();
|
|
73
|
-
submit();
|
|
74
|
-
},
|
|
75
|
-
children: [
|
|
76
|
-
row("prompt-header", header),
|
|
77
|
-
/* @__PURE__ */ jsxs("div", {
|
|
78
|
-
"data-scope": "ai",
|
|
79
|
-
"data-part": "prompt-main",
|
|
80
|
-
children: [
|
|
81
|
-
row("prompt-leading", leading),
|
|
82
|
-
/* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsx(Field.Textarea, {
|
|
83
|
-
ref: fieldRef,
|
|
84
|
-
autoresize: true,
|
|
85
|
-
rows: 1,
|
|
86
|
-
value,
|
|
87
|
-
placeholder: placeholderText,
|
|
88
|
-
"aria-label": ariaLabel ?? messages.ai.conversation,
|
|
89
|
-
disabled,
|
|
90
|
-
onChange: (event) => {
|
|
91
|
-
onValueChange?.(event.target.value);
|
|
92
|
-
mentionState.onInput();
|
|
93
|
-
},
|
|
94
|
-
onKeyDown: (event) => {
|
|
95
|
-
if (mentionState.onKeydown(event)) return;
|
|
96
|
-
if (event.key === "Enter" && !event.shiftKey) {
|
|
97
|
-
event.preventDefault();
|
|
98
|
-
submit();
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}) }),
|
|
102
|
-
mentionsActive ? /* @__PURE__ */ jsx(MentionsVessel, {
|
|
103
|
-
open: mentionState.open,
|
|
104
|
-
matches: mentionState.matches,
|
|
105
|
-
active: mentionState.active,
|
|
106
|
-
anchor: fieldRef.current,
|
|
107
|
-
onInsert: mentionState.insert,
|
|
108
|
-
onActiveChange: mentionState.setActive,
|
|
109
|
-
onOpenChange: (open) => {
|
|
110
|
-
if (!open) mentionState.close();
|
|
111
|
-
}
|
|
112
|
-
}) : null,
|
|
113
|
-
row("prompt-trailing", hasFooter ? trailing : trailing ?? seal)
|
|
114
|
-
]
|
|
115
|
-
}),
|
|
116
|
-
hasFooter ? /* @__PURE__ */ jsxs("div", {
|
|
117
|
-
"data-scope": "ai",
|
|
118
|
-
"data-part": "prompt-footer",
|
|
119
|
-
children: [footer, row("prompt-end", footerEnd == null ? seal : /* @__PURE__ */ jsxs(Fragment, { children: [footerEnd, seal] }))]
|
|
120
|
-
}) : null
|
|
121
|
-
]
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
const PromptInput = withSelfRoot(PromptInputImpl);
|
|
125
|
-
//#endregion
|
|
126
|
-
export { PromptInput as AiPromptInput, PromptInput };
|
|
1
|
+
export { t as AiPromptInput, t as PromptInput } from "../../ai-prompt-input-k34KssHJ.mjs";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
-
//#region src/components/ai-reasoning/index.d.ts
|
|
3
2
|
/** The model's thought, folded by the shared collapsible in its quiet
|
|
4
3
|
* register: bare ink for a trigger, the thought on one hairline. */
|
|
5
4
|
export interface ReasoningProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -12,5 +11,4 @@ declare function ReasoningImpl({ label, children, ...rest }: ReasoningProps): im
|
|
|
12
11
|
export declare const Reasoning: typeof ReasoningImpl & {
|
|
13
12
|
Root: typeof ReasoningImpl;
|
|
14
13
|
};
|
|
15
|
-
//#endregion
|
|
16
14
|
export { Reasoning as AiReasoning };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as withSelfRoot } from "../../family-
|
|
2
|
-
import { t as chevron } from "../../chevron-
|
|
1
|
+
import { t as withSelfRoot } from "../../family-Co1YsN4N.mjs";
|
|
2
|
+
import { t as chevron } from "../../chevron-DnImlNip.mjs";
|
|
3
3
|
import { Collapsible } from "../collapsible/index.mjs";
|
|
4
4
|
import { injectComponentStyle } from "@bysages/core/styling";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// src/components/ai-reasoning/index.tsx
|
|
7
7
|
function ReasoningImpl({ label = "Thinking", children, ...rest }) {
|
|
8
8
|
injectComponentStyle("ai");
|
|
9
9
|
return /* @__PURE__ */ jsxs(Collapsible.Root, {
|
|
@@ -17,5 +17,4 @@ function ReasoningImpl({ label = "Thinking", children, ...rest }) {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
const Reasoning = withSelfRoot(ReasoningImpl);
|
|
20
|
-
//#endregion
|
|
21
20
|
export { Reasoning as AiReasoning, Reasoning };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
|
-
//#region src/components/ai-response/index.d.ts
|
|
3
2
|
/** Markdown set on the paper. Rendering goes through
|
|
4
|
-
* `@
|
|
3
|
+
* `@bysages/core/markdown`, whose defaults leave raw HTML and executable
|
|
5
4
|
* links inert — streaming-safe by construction. An optional
|
|
6
5
|
* highlighter re-inks fenced code; the component stays agnostic about
|
|
7
6
|
* which engine provides it. */
|
|
@@ -23,5 +22,4 @@ declare function ResponseImpl({ content, highlighter, copyLabel, copiedLabel, ..
|
|
|
23
22
|
export declare const Response: typeof ResponseImpl & {
|
|
24
23
|
Root: typeof ResponseImpl;
|
|
25
24
|
};
|
|
26
|
-
//#endregion
|
|
27
25
|
export { Response as AiResponse };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { Response as AiResponse, Response };
|
|
1
|
+
export { t as AiResponse, t as Response } from "../../ai-response-DTxdL5rX.mjs";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
-
//#region src/components/ai-source/index.d.ts
|
|
3
2
|
/** One place the ink came from; href and the rest ride the anchor. */
|
|
4
3
|
export interface SourceProps extends HTMLAttributes<HTMLAnchorElement> {
|
|
5
4
|
/** Where the ink came from — also the link text when no children are
|
|
@@ -19,5 +18,4 @@ declare function SourcesImpl({ children, ...rest }: SourcesProps): import("react
|
|
|
19
18
|
export declare const Sources: typeof SourcesImpl & {
|
|
20
19
|
Root: typeof SourcesImpl;
|
|
21
20
|
};
|
|
22
|
-
//#endregion
|
|
23
21
|
export { Source as AiSource, Sources as AiSources };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as withSelfRoot } from "../../family-
|
|
1
|
+
import { t as withSelfRoot } from "../../family-Co1YsN4N.mjs";
|
|
2
2
|
import { injectComponentStyle } from "@bysages/core/styling";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/components/ai-source/index.tsx
|
|
5
5
|
function SourceImpl({ href, children, ...rest }) {
|
|
6
6
|
injectComponentStyle("ai");
|
|
7
7
|
return /* @__PURE__ */ jsx("li", {
|
|
@@ -26,5 +26,4 @@ function SourcesImpl({ children, ...rest }) {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
const Sources = withSelfRoot(SourcesImpl);
|
|
29
|
-
//#endregion
|
|
30
29
|
export { Source as AiSource, Source, Sources as AiSources, Sources };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
|
-
//#region src/components/ai-suggestion/index.d.ts
|
|
3
2
|
/** A seal-cut button proposing the next stroke; selection hands back
|
|
4
3
|
* the prompt. The shared Button in its outline register. */
|
|
5
4
|
export interface SuggestionProps extends Omit<HTMLAttributes<HTMLButtonElement>, "onSelect"> {
|
|
@@ -12,5 +11,4 @@ declare function SuggestionImpl({ prompt, onSelect, ...rest }: SuggestionProps):
|
|
|
12
11
|
export declare const Suggestion: typeof SuggestionImpl & {
|
|
13
12
|
Root: typeof SuggestionImpl;
|
|
14
13
|
};
|
|
15
|
-
//#endregion
|
|
16
14
|
export { Suggestion as AiSuggestion };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as withSelfRoot } from "../../family-
|
|
1
|
+
import { t as withSelfRoot } from "../../family-Co1YsN4N.mjs";
|
|
2
2
|
import { Button } from "../button/index.mjs";
|
|
3
3
|
import { injectComponentStyle } from "@bysages/core/styling";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
// src/components/ai-suggestion/index.tsx
|
|
6
6
|
function SuggestionImpl({ prompt, onSelect, ...rest }) {
|
|
7
7
|
injectComponentStyle("ai");
|
|
8
8
|
return /* @__PURE__ */ jsx(Button, {
|
|
@@ -14,5 +14,4 @@ function SuggestionImpl({ prompt, onSelect, ...rest }) {
|
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
const Suggestion = withSelfRoot(SuggestionImpl);
|
|
17
|
-
//#endregion
|
|
18
17
|
export { Suggestion as AiSuggestion, Suggestion };
|
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export type ToolStatus = "pending" | "running" | "completed" | "error";
|
|
4
|
-
/** A tool call: the shared collapsible as the vessel — the name it was
|
|
5
|
-
* reached by and the state it reached in on the trigger, its input and
|
|
6
|
-
* output folded inside. */
|
|
7
|
-
export interface ToolProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
-
/** The name the tool was reached by — shown raw on the trigger
|
|
9
|
-
* unless a `label` speaks friendlier words ("Searching pages…"). */
|
|
10
|
-
name: string;
|
|
11
|
-
label?: ReactNode;
|
|
12
|
-
/** The state the call reached — pending, running, completed, or
|
|
13
|
-
* error; stamped on the fold and whispered in the status chip. */
|
|
14
|
-
status?: ToolStatus;
|
|
15
|
-
defaultOpen?: boolean;
|
|
16
|
-
input?: ReactNode;
|
|
17
|
-
output?: ReactNode;
|
|
18
|
-
}
|
|
19
|
-
declare function ToolImpl({ name, label, status, input, output, ...rest }: ToolProps): import("react").JSX.Element;
|
|
20
|
-
export declare const Tool: typeof ToolImpl & {
|
|
21
|
-
Root: typeof ToolImpl;
|
|
22
|
-
};
|
|
23
|
-
//#endregion
|
|
24
|
-
export { Tool as AiTool };
|
|
1
|
+
import { a as ToolValue, i as ToolStatus, n as ToolApproval, r as ToolProps, t as Tool } from "../../index-lCsvE2Vl.mjs";
|
|
2
|
+
export { Tool as AiTool, Tool, ToolApproval, ToolProps, ToolStatus, ToolValue };
|
|
@@ -1,15 +1,28 @@
|
|
|
1
|
-
import { t as withSelfRoot } from "../../family-
|
|
2
|
-
import {
|
|
1
|
+
import { t as withSelfRoot } from "../../family-Co1YsN4N.mjs";
|
|
2
|
+
import { n as useComponentMessages } from "../../messages-B6n0lVyt.mjs";
|
|
3
|
+
import { Button } from "../button/index.mjs";
|
|
4
|
+
import { t as chevron } from "../../chevron-DnImlNip.mjs";
|
|
3
5
|
import { Collapsible } from "../collapsible/index.mjs";
|
|
4
6
|
import { injectComponentStyle } from "@bysages/core/styling";
|
|
5
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
+
// src/components/ai-tool/index.tsx
|
|
9
|
+
function formatValue(value) {
|
|
10
|
+
if (typeof value === "string") return value;
|
|
11
|
+
if (typeof value === "number" || typeof value === "boolean" || value === null) return String(value);
|
|
12
|
+
if (value === void 0) return "";
|
|
13
|
+
return JSON.stringify(value, null, 2) ?? "";
|
|
14
|
+
}
|
|
15
|
+
function ToolImpl({ name, label, status, approval, input, inputValue, output, outputValue, defaultOpen = false, onApprove, onDeny, ...rest }) {
|
|
8
16
|
injectComponentStyle("ai");
|
|
17
|
+
const messages = useComponentMessages();
|
|
18
|
+
const inputContent = input ?? (inputValue !== void 0 ? formatValue(inputValue) : null);
|
|
19
|
+
const outputContent = output ?? (outputValue !== void 0 ? formatValue(outputValue) : null);
|
|
9
20
|
return /* @__PURE__ */ jsxs(Collapsible.Root, {
|
|
10
21
|
...rest,
|
|
22
|
+
defaultOpen,
|
|
11
23
|
"data-ai": "tool",
|
|
12
24
|
"data-status": status,
|
|
25
|
+
"data-approval": approval,
|
|
13
26
|
children: [/* @__PURE__ */ jsxs(Collapsible.Trigger, { children: [
|
|
14
27
|
/* @__PURE__ */ jsx("span", { children: label ?? name }),
|
|
15
28
|
status ? /* @__PURE__ */ jsx("span", {
|
|
@@ -21,18 +34,37 @@ function ToolImpl({ name, label, status, input, output, ...rest }) {
|
|
|
21
34
|
] }), /* @__PURE__ */ jsx(Collapsible.Content, { children: /* @__PURE__ */ jsxs("div", {
|
|
22
35
|
"data-scope": "ai",
|
|
23
36
|
"data-part": "tool-body",
|
|
24
|
-
children: [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
children: [
|
|
38
|
+
inputContent != null ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
39
|
+
"data-scope": "ai",
|
|
40
|
+
"data-part": "tool-label",
|
|
41
|
+
children: messages.ai.input
|
|
42
|
+
}), /* @__PURE__ */ jsx("pre", { children: inputContent })] }) : null,
|
|
43
|
+
outputContent != null ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
44
|
+
"data-scope": "ai",
|
|
45
|
+
"data-part": "tool-label",
|
|
46
|
+
children: messages.ai.output
|
|
47
|
+
}), /* @__PURE__ */ jsx("pre", { children: outputContent })] }) : null,
|
|
48
|
+
approval === "required" ? /* @__PURE__ */ jsxs("div", {
|
|
49
|
+
"data-scope": "ai",
|
|
50
|
+
"data-part": "tool-actions",
|
|
51
|
+
"data-approval": approval,
|
|
52
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
53
|
+
variant: "outline",
|
|
54
|
+
size: "sm",
|
|
55
|
+
tone: "danger",
|
|
56
|
+
onClick: () => onDeny?.(),
|
|
57
|
+
children: messages.ai.deny
|
|
58
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
59
|
+
variant: "solid",
|
|
60
|
+
size: "sm",
|
|
61
|
+
onClick: () => onApprove?.(),
|
|
62
|
+
children: messages.ai.approve
|
|
63
|
+
})]
|
|
64
|
+
}) : null
|
|
65
|
+
]
|
|
33
66
|
}) })]
|
|
34
67
|
});
|
|
35
68
|
}
|
|
36
69
|
const Tool = withSelfRoot(ToolImpl);
|
|
37
|
-
//#endregion
|
|
38
70
|
export { Tool as AiTool, Tool };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
-
//#region src/components/alert/index.d.ts
|
|
3
2
|
export type AlertStatus = "ink" | "info" | "success" | "warning" | "danger";
|
|
4
3
|
/** A notice
|
|
5
4
|
|
|
@@ -22,4 +21,4 @@ export declare const Alert: typeof AlertRoot & {
|
|
|
22
21
|
Title: typeof Title;
|
|
23
22
|
Description: typeof Description;
|
|
24
23
|
};
|
|
25
|
-
|
|
24
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r as iconNode } from "../../icon-
|
|
1
|
+
import { r as iconNode } from "../../icon-C9udWCyz.mjs";
|
|
2
2
|
import { injectComponentStyle } from "@bysages/core/styling";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { createContext, useContext } from "react";
|
|
5
|
-
|
|
5
|
+
// src/components/alert/index.tsx
|
|
6
6
|
const StatusContext = createContext("ink");
|
|
7
7
|
function statusIcon(status) {
|
|
8
8
|
return iconNode({
|
|
@@ -69,5 +69,4 @@ const Alert = Object.assign(AlertRoot, {
|
|
|
69
69
|
Description
|
|
70
70
|
});
|
|
71
71
|
injectComponentStyle("alert");
|
|
72
|
-
//#endregion
|
|
73
72
|
export { Alert };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
2
|
import { AngleSlider as AngleSlider$1 } from "@ark-ui/react/angle-slider";
|
|
3
|
-
//#region src/components/angle-slider/index.d.ts
|
|
4
3
|
type AngleSliderRootProps = ComponentProps<typeof AngleSlider$1.Root> & {
|
|
5
4
|
/** One rung of the dial ladder — the diameter the needle sweeps. */
|
|
6
5
|
size?: "sm" | "md" | "lg";
|
|
@@ -30,4 +29,4 @@ type AngleSliderParts = Omit<typeof AngleSlider$1, "Root"> & {
|
|
|
30
29
|
Root: typeof AngleSliderRoot;
|
|
31
30
|
};
|
|
32
31
|
export declare const AngleSlider: typeof AngleSliderFacade & AngleSliderParts;
|
|
33
|
-
|
|
32
|
+
export {};
|