@anvia/react-ui 1.3.0 → 1.3.2

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.
Files changed (133) hide show
  1. package/dist/attachment/index.d.ts +3 -21
  2. package/dist/attachment/index.js +3 -12
  3. package/dist/attachment-By2pged3.js +91 -0
  4. package/dist/attachment-By2pged3.js.map +1 -0
  5. package/dist/chat/index.d.ts +3 -152
  6. package/dist/chat/index.js +3 -25
  7. package/dist/chat-Dgz8hsVT.js +1210 -0
  8. package/dist/chat-Dgz8hsVT.js.map +1 -0
  9. package/dist/completion/index.d.ts +3 -29
  10. package/dist/completion/index.js +3 -16
  11. package/dist/completion-DDTKoZRJ.js +124 -0
  12. package/dist/completion-DDTKoZRJ.js.map +1 -0
  13. package/dist/connection-DeNq8wHS.js +203 -0
  14. package/dist/connection-DeNq8wHS.js.map +1 -0
  15. package/dist/contexts-B4ijG24z.js +212 -0
  16. package/dist/contexts-B4ijG24z.js.map +1 -0
  17. package/dist/elements-D4vmkkF8.js +19 -0
  18. package/dist/elements-D4vmkkF8.js.map +1 -0
  19. package/dist/graph-explorer/index.d.ts +54 -73
  20. package/dist/graph-explorer/index.d.ts.map +1 -0
  21. package/dist/graph-explorer/index.js +181 -248
  22. package/dist/graph-explorer/index.js.map +1 -1
  23. package/dist/human-input/index.d.ts +3 -78
  24. package/dist/human-input/index.js +3 -21
  25. package/dist/human-input-CsCbZomZ.js +314 -0
  26. package/dist/human-input-CsCbZomZ.js.map +1 -0
  27. package/dist/image/index.d.ts +3 -40
  28. package/dist/image/index.js +3 -12
  29. package/dist/image-aCWm6hFe.js +303 -0
  30. package/dist/image-aCWm6hFe.js.map +1 -0
  31. package/dist/index-B1Qs2Cjv.d.ts +145 -0
  32. package/dist/index-B1Qs2Cjv.d.ts.map +1 -0
  33. package/dist/index-BCBVcl0D.d.ts +277 -0
  34. package/dist/index-BCBVcl0D.d.ts.map +1 -0
  35. package/dist/index-CE22tsua.d.ts +20 -0
  36. package/dist/index-CE22tsua.d.ts.map +1 -0
  37. package/dist/index-CGqtpc6b.d.ts +25 -0
  38. package/dist/index-CGqtpc6b.d.ts.map +1 -0
  39. package/dist/index-DqdyM0Jm.d.ts +7 -0
  40. package/dist/index-DqdyM0Jm.d.ts.map +1 -0
  41. package/dist/index-Mw3ltwSG.d.ts +318 -0
  42. package/dist/index-Mw3ltwSG.d.ts.map +1 -0
  43. package/dist/index.d.ts +7 -40
  44. package/dist/index.js +34 -118
  45. package/dist/index.js.map +1 -1
  46. package/dist/message/index.d.ts +3 -105
  47. package/dist/message/index.js +3 -20
  48. package/dist/message-CElFEKgL.js +783 -0
  49. package/dist/message-CElFEKgL.js.map +1 -0
  50. package/dist/primitives-xfE7zfwJ.js +15 -0
  51. package/dist/primitives-xfE7zfwJ.js.map +1 -0
  52. package/dist/refs-Djj9rSvB.js +10 -0
  53. package/dist/refs-Djj9rSvB.js.map +1 -0
  54. package/dist/sandbox-desktop/index.d.ts +100 -104
  55. package/dist/sandbox-desktop/index.d.ts.map +1 -0
  56. package/dist/sandbox-desktop/index.js +344 -342
  57. package/dist/sandbox-desktop/index.js.map +1 -1
  58. package/dist/sandbox-terminal/index.d.ts +52 -56
  59. package/dist/sandbox-terminal/index.d.ts.map +1 -0
  60. package/dist/sandbox-terminal/index.js +217 -208
  61. package/dist/sandbox-terminal/index.js.map +1 -1
  62. package/dist/selection-toolbar/index.d.ts +3 -21
  63. package/dist/selection-toolbar/index.js +3 -13
  64. package/dist/selection-toolbar-CIkOoM-7.js +171 -0
  65. package/dist/selection-toolbar-CIkOoM-7.js.map +1 -0
  66. package/dist/shared-BSYElFU2.d.ts +2 -0
  67. package/dist/shared.d.ts +4 -14
  68. package/dist/shared.js +1 -43
  69. package/dist/stream/index.d.ts +2 -22
  70. package/dist/stream/index.js +1 -8
  71. package/dist/stream-CAO0x8_1.js +298 -0
  72. package/dist/stream-CAO0x8_1.js.map +1 -0
  73. package/dist/thread-list/index.d.ts +3 -47
  74. package/dist/thread-list/index.js +3 -18
  75. package/dist/thread-list-xJbGXFrE.js +228 -0
  76. package/dist/thread-list-xJbGXFrE.js.map +1 -0
  77. package/dist/ticket-CoJHBpdF.d.ts +32 -0
  78. package/dist/ticket-CoJHBpdF.d.ts.map +1 -0
  79. package/dist/url-CiYZkDks.js +52 -0
  80. package/dist/url-CiYZkDks.js.map +1 -0
  81. package/dist/value-BGGrx72L.js +13 -0
  82. package/dist/value-BGGrx72L.js.map +1 -0
  83. package/package.json +22 -22
  84. package/dist/attachment/index.js.map +0 -1
  85. package/dist/attachment-mbjsroli.d.ts +0 -9
  86. package/dist/chat/index.js.map +0 -1
  87. package/dist/chat-PSj1Fo4W.d.ts +0 -88
  88. package/dist/chunk-22EZJUPM.js +0 -120
  89. package/dist/chunk-22EZJUPM.js.map +0 -1
  90. package/dist/chunk-5FZKTDZR.js +0 -201
  91. package/dist/chunk-5FZKTDZR.js.map +0 -1
  92. package/dist/chunk-6XOJFLX4.js +0 -22
  93. package/dist/chunk-6XOJFLX4.js.map +0 -1
  94. package/dist/chunk-CKA4CE26.js +0 -25
  95. package/dist/chunk-CKA4CE26.js.map +0 -1
  96. package/dist/chunk-DLBNFBXQ.js +0 -425
  97. package/dist/chunk-DLBNFBXQ.js.map +0 -1
  98. package/dist/chunk-E73S3SOF.js +0 -404
  99. package/dist/chunk-E73S3SOF.js.map +0 -1
  100. package/dist/chunk-F6AKBUO3.js +0 -380
  101. package/dist/chunk-F6AKBUO3.js.map +0 -1
  102. package/dist/chunk-HGOPGZNQ.js +0 -195
  103. package/dist/chunk-HGOPGZNQ.js.map +0 -1
  104. package/dist/chunk-KHB5CHAU.js +0 -220
  105. package/dist/chunk-KHB5CHAU.js.map +0 -1
  106. package/dist/chunk-LHABOAOP.js +0 -316
  107. package/dist/chunk-LHABOAOP.js.map +0 -1
  108. package/dist/chunk-N5XQU36W.js +0 -410
  109. package/dist/chunk-N5XQU36W.js.map +0 -1
  110. package/dist/chunk-T3ZFZ3NP.js +0 -30
  111. package/dist/chunk-T3ZFZ3NP.js.map +0 -1
  112. package/dist/chunk-T4IYUEPH.js +0 -1612
  113. package/dist/chunk-T4IYUEPH.js.map +0 -1
  114. package/dist/chunk-W2AHKMRS.js +0 -1092
  115. package/dist/chunk-W2AHKMRS.js.map +0 -1
  116. package/dist/completion/index.js.map +0 -1
  117. package/dist/completion-input-DHlwrhxB.d.ts +0 -24
  118. package/dist/composer-6iCSIq6L.d.ts +0 -111
  119. package/dist/human-input/index.js.map +0 -1
  120. package/dist/human-input-CkLrZ8IC.d.ts +0 -27
  121. package/dist/image/index.js.map +0 -1
  122. package/dist/image-VZv6Ddsn.d.ts +0 -14
  123. package/dist/message/index.js.map +0 -1
  124. package/dist/message-CNRnZQwU.d.ts +0 -14
  125. package/dist/render-CRKWam2v.d.ts +0 -8
  126. package/dist/selection-toolbar/index.js.map +0 -1
  127. package/dist/selection-toolbar-Cwjbuv5S.d.ts +0 -14
  128. package/dist/shared.js.map +0 -1
  129. package/dist/stream/index.js.map +0 -1
  130. package/dist/thread-Bz6-1zaJ.d.ts +0 -12
  131. package/dist/thread-list/index.js.map +0 -1
  132. package/dist/thread-list-On8db4XL.d.ts +0 -34
  133. package/dist/ticket-pexI1zIa.d.ts +0 -33
@@ -0,0 +1,314 @@
1
+ import { C as useQuestionPrompt, I as useChatContext, L as useHumanInput, S as useQuestion, b as InternalQuestionProvider, v as InternalApprovalProvider, x as useApproval, y as InternalQuestionPromptProvider } from "./contexts-B4ijG24z.js";
2
+ import { t as stringifyValue } from "./value-BGGrx72L.js";
3
+ import { t as renderPrimitive } from "./primitives-xfE7zfwJ.js";
4
+ import { forwardRef, useCallback, useMemo, useState } from "react";
5
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
+ // src/human-input/approvals.tsx
7
+ const HumanInputStatus = forwardRef(function HumanInputStatus({ children, ...props }, ref) {
8
+ const humanInput = useHumanInput();
9
+ const renderedChildren = typeof children === "function" ? children(humanInput) : children;
10
+ const pendingCount = humanInput.approvals.pending.length + humanInput.questions.pending.length;
11
+ return renderPrimitive("div", {
12
+ ...props,
13
+ children: renderedChildren ?? `${pendingCount} pending`
14
+ }, ref);
15
+ });
16
+ const HumanInputApprovals = forwardRef(function HumanInputApprovals({ children, filter = "pending", keepMounted = false, ...props }, ref) {
17
+ const humanInput = useHumanInput();
18
+ const approvals = filter === "all" ? humanInput.approvals.all : humanInput.approvals.pending;
19
+ const empty = approvals.length === 0;
20
+ if (empty && !keepMounted) return null;
21
+ return renderPrimitive("div", {
22
+ ...props,
23
+ children: approvals.map((approval) => /* @__PURE__ */ jsx(InternalApprovalProvider, {
24
+ approval,
25
+ children: typeof children === "function" ? children(approval) : children ?? /* @__PURE__ */ jsx(HumanInputApproval, {})
26
+ }, approval.request.id)),
27
+ "data-state": empty ? "empty" : "populated"
28
+ }, ref);
29
+ });
30
+ const HumanInputApproval = forwardRef(function HumanInputApproval({ children, ...props }, ref) {
31
+ const { approval } = useApproval();
32
+ const renderedChildren = typeof children === "function" ? children(approval) : children ?? defaultApprovalContent(approval);
33
+ return renderPrimitive("div", {
34
+ ...props,
35
+ children: renderedChildren,
36
+ "data-state": approval.status
37
+ }, ref);
38
+ });
39
+ const HumanInputApprove = forwardRef(function HumanInputApprove({ onClick, ...props }, ref) {
40
+ const chat = useChatContext();
41
+ const { approval, reason } = useApproval();
42
+ const disabled = props.disabled ?? (approval.status !== "pending" || chat.respondingInteractions.has(approval.request.id));
43
+ const handleClick = useCallback((event) => {
44
+ onClick?.(event);
45
+ if (event.defaultPrevented || disabled) return;
46
+ const decisionReason = reason.trim().length > 0 ? reason : void 0;
47
+ const response = {
48
+ type: "tool-approval",
49
+ approved: true
50
+ };
51
+ if (decisionReason !== void 0) Object.assign(response, { reason: decisionReason });
52
+ chat.respondToInteraction({
53
+ interactionId: approval.request.id,
54
+ response
55
+ });
56
+ }, [
57
+ approval.request.id,
58
+ chat,
59
+ disabled,
60
+ onClick,
61
+ reason
62
+ ]);
63
+ return renderPrimitive("button", {
64
+ ...props,
65
+ children: props.children ?? "Approve",
66
+ disabled,
67
+ onClick: handleClick,
68
+ type: props.type ?? "button",
69
+ "data-state": disabled ? "disabled" : "enabled"
70
+ }, ref);
71
+ });
72
+ const HumanInputReject = forwardRef(function HumanInputReject({ onClick, ...props }, ref) {
73
+ const chat = useChatContext();
74
+ const { approval, reason } = useApproval();
75
+ const disabled = props.disabled ?? (approval.status !== "pending" || chat.respondingInteractions.has(approval.request.id));
76
+ const handleClick = useCallback((event) => {
77
+ onClick?.(event);
78
+ if (event.defaultPrevented || disabled) return;
79
+ const decisionReason = reason.trim().length > 0 ? reason : void 0;
80
+ const response = {
81
+ type: "tool-approval",
82
+ approved: false
83
+ };
84
+ if (decisionReason !== void 0) Object.assign(response, { reason: decisionReason });
85
+ chat.respondToInteraction({
86
+ interactionId: approval.request.id,
87
+ response
88
+ });
89
+ }, [
90
+ approval.request.id,
91
+ chat,
92
+ disabled,
93
+ onClick,
94
+ reason
95
+ ]);
96
+ return renderPrimitive("button", {
97
+ ...props,
98
+ children: props.children ?? "Reject",
99
+ disabled,
100
+ onClick: handleClick,
101
+ type: props.type ?? "button",
102
+ "data-state": disabled ? "disabled" : "enabled"
103
+ }, ref);
104
+ });
105
+ const HumanInputApprovalReason = forwardRef(function HumanInputApprovalReason({ onChange, ...props }, ref) {
106
+ const approval = useApproval();
107
+ const handleChange = useCallback((event) => {
108
+ onChange?.(event);
109
+ if (!event.defaultPrevented) approval.setReason(event.currentTarget.value);
110
+ }, [approval, onChange]);
111
+ return renderPrimitive("textarea", {
112
+ ...props,
113
+ "aria-label": props["aria-label"] ?? "Approval reason",
114
+ onChange: handleChange,
115
+ value: approval.reason
116
+ }, ref);
117
+ });
118
+ function defaultApprovalContent(approval) {
119
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
120
+ /* @__PURE__ */ jsx("div", { children: approval.request.toolName }),
121
+ approval.request.input !== void 0 ? /* @__PURE__ */ jsx("pre", { children: stringifyValue(approval.request.input) }) : null,
122
+ /* @__PURE__ */ jsx(HumanInputApprovalReason, {}),
123
+ /* @__PURE__ */ jsx(HumanInputApprove, {}),
124
+ /* @__PURE__ */ jsx(HumanInputReject, {})
125
+ ] });
126
+ }
127
+ // src/human-input/questions.tsx
128
+ const HumanInputQuestions = forwardRef(function HumanInputQuestions({ children, filter = "pending", keepMounted = false, ...props }, ref) {
129
+ const humanInput = useHumanInput();
130
+ const questions = filter === "all" ? humanInput.questions.all : humanInput.questions.pending;
131
+ const empty = questions.length === 0;
132
+ if (empty && !keepMounted) return null;
133
+ return renderPrimitive("div", {
134
+ ...props,
135
+ children: questions.map((question) => /* @__PURE__ */ jsx(QuestionProvider, {
136
+ question,
137
+ children: typeof children === "function" ? children(question) : children ?? /* @__PURE__ */ jsx(HumanInputQuestion, {})
138
+ }, question.request.id)),
139
+ "data-state": empty ? "empty" : "populated"
140
+ }, ref);
141
+ });
142
+ const HumanInputQuestion = forwardRef(function HumanInputQuestion({ children, ...props }, ref) {
143
+ const { question } = useQuestion();
144
+ const renderedChildren = typeof children === "function" ? children(question) : children ?? defaultQuestionContent(question);
145
+ return renderPrimitive("div", {
146
+ ...props,
147
+ children: renderedChildren,
148
+ "data-state": question.status
149
+ }, ref);
150
+ });
151
+ const HumanInputQuestionPrompt = forwardRef(function HumanInputQuestionPrompt({ promptId, ...props }, ref) {
152
+ const { question } = useQuestion();
153
+ const prompt = question.request.questions.find((item) => item.id === promptId) ?? question.request.questions[0];
154
+ if (prompt === void 0) return null;
155
+ return /* @__PURE__ */ jsx(InternalQuestionPromptProvider, {
156
+ prompt,
157
+ children: renderPrimitive("div", {
158
+ ...props,
159
+ children: props.children ?? defaultQuestionPrompt(prompt)
160
+ }, ref)
161
+ });
162
+ });
163
+ const HumanInputQuestionChoice = forwardRef(function HumanInputQuestionChoice({ answer, custom = false, onClick, value, ...props }, ref) {
164
+ const { prompt } = useQuestionPrompt();
165
+ const question = useQuestion();
166
+ const choiceValue = value ?? prompt.choices?.[0]?.value ?? "";
167
+ const choice = prompt.choices?.find((item) => item.value === choiceValue);
168
+ const selected = question.answers[prompt.id]?.value === choiceValue;
169
+ const handleClick = useCallback((event) => {
170
+ onClick?.(event);
171
+ if (event.defaultPrevented || choiceValue.length === 0) return;
172
+ const nextAnswer = {
173
+ questionId: prompt.id,
174
+ value: custom ? answer ?? choice?.label ?? choiceValue : choiceValue
175
+ };
176
+ question.setAnswer(prompt, nextAnswer);
177
+ }, [
178
+ answer,
179
+ choice?.label,
180
+ choiceValue,
181
+ custom,
182
+ onClick,
183
+ prompt,
184
+ question
185
+ ]);
186
+ return renderPrimitive("button", {
187
+ ...props,
188
+ children: props.children ?? choice?.label ?? choiceValue,
189
+ onClick: handleClick,
190
+ type: props.type ?? "button",
191
+ "data-state": selected ? "selected" : "idle"
192
+ }, ref);
193
+ });
194
+ const HumanInputQuestionTextAnswer = forwardRef(function HumanInputQuestionTextAnswer({ onChange, ...props }, ref) {
195
+ const { prompt } = useQuestionPrompt();
196
+ const question = useQuestion();
197
+ const value = question.answers[prompt.id]?.value ?? "";
198
+ const handleChange = useCallback((event) => {
199
+ onChange?.(event);
200
+ if (event.defaultPrevented) return;
201
+ const answer = event.currentTarget.value;
202
+ question.setAnswer(prompt, {
203
+ questionId: prompt.id,
204
+ value: answer
205
+ });
206
+ }, [
207
+ onChange,
208
+ prompt,
209
+ question
210
+ ]);
211
+ return renderPrimitive("textarea", {
212
+ ...props,
213
+ "aria-label": props["aria-label"] ?? prompt.text,
214
+ onChange: handleChange,
215
+ value
216
+ }, ref);
217
+ });
218
+ const HumanInputQuestionSubmit = forwardRef(function HumanInputQuestionSubmit({ onClick, ...props }, ref) {
219
+ const chat = useChatContext();
220
+ const question = useQuestion();
221
+ const answers = useMemo(() => question.question.request.questions.flatMap((prompt) => {
222
+ const answer = question.answers[prompt.id];
223
+ return answer === void 0 || answer.value.trim().length === 0 ? [] : [answer];
224
+ }), [question]);
225
+ const disabled = props.disabled ?? (question.question.status !== "pending" || chat.respondingInteractions.has(question.question.request.id) || answers.length !== question.question.request.questions.length);
226
+ const handleClick = useCallback((event) => {
227
+ onClick?.(event);
228
+ if (event.defaultPrevented || disabled) return;
229
+ chat.respondToInteraction({
230
+ interactionId: question.question.request.id,
231
+ response: {
232
+ type: "tool-question",
233
+ answers
234
+ }
235
+ });
236
+ }, [
237
+ answers,
238
+ chat,
239
+ disabled,
240
+ onClick,
241
+ question.question.request.id
242
+ ]);
243
+ return renderPrimitive("button", {
244
+ ...props,
245
+ children: props.children ?? "Submit",
246
+ disabled,
247
+ onClick: handleClick,
248
+ type: props.type ?? "button",
249
+ "data-state": disabled ? "disabled" : "enabled"
250
+ }, ref);
251
+ });
252
+ function QuestionProvider({ question, children }) {
253
+ const [answers, setAnswers] = useState({});
254
+ const setAnswer = useCallback((prompt, answer) => {
255
+ setAnswers((current) => ({
256
+ ...current,
257
+ [prompt.id]: answer
258
+ }));
259
+ }, []);
260
+ const value = useMemo(() => ({
261
+ question,
262
+ answers,
263
+ setAnswer
264
+ }), [
265
+ answers,
266
+ question,
267
+ setAnswer
268
+ ]);
269
+ return /* @__PURE__ */ jsx(InternalQuestionProvider, {
270
+ value,
271
+ children
272
+ });
273
+ }
274
+ function defaultQuestionContent(question) {
275
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
276
+ /* @__PURE__ */ jsx("div", { children: question.request.toolName }),
277
+ question.request.questions.map((prompt) => /* @__PURE__ */ jsx(HumanInputQuestionPrompt, { promptId: prompt.id }, prompt.id)),
278
+ /* @__PURE__ */ jsx(HumanInputQuestionSubmit, {})
279
+ ] });
280
+ }
281
+ function defaultQuestionPrompt(prompt) {
282
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", { children: prompt.text }), (prompt.choices?.length ?? 0) > 0 ? /* @__PURE__ */ jsx("div", { children: prompt.choices?.map((choice) => /* @__PURE__ */ jsx(HumanInputQuestionChoice, {
283
+ value: choice.value,
284
+ children: choice.label
285
+ }, choice.value)) }) : /* @__PURE__ */ jsx(HumanInputQuestionTextAnswer, {})] });
286
+ }
287
+ // src/human-input/index.ts
288
+ const HumanInputPrimitive = {
289
+ Panel: forwardRef(function HumanInputPanel({ children, filter = "pending", ...props }, ref) {
290
+ const humanInput = useHumanInput();
291
+ const approvals = filter === "all" ? humanInput.approvals.all : humanInput.approvals.pending;
292
+ const questions = filter === "all" ? humanInput.questions.all : humanInput.questions.pending;
293
+ if (approvals.length === 0 && questions.length === 0) return null;
294
+ return renderPrimitive("div", {
295
+ ...props,
296
+ children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(HumanInputApprovals, { filter }), /* @__PURE__ */ jsx(HumanInputQuestions, { filter })] })
297
+ }, ref);
298
+ }),
299
+ Status: HumanInputStatus,
300
+ Approvals: HumanInputApprovals,
301
+ Approval: HumanInputApproval,
302
+ ApprovalReason: HumanInputApprovalReason,
303
+ Approve: HumanInputApprove,
304
+ Reject: HumanInputReject,
305
+ Questions: HumanInputQuestions,
306
+ Question: HumanInputQuestion,
307
+ QuestionPrompt: HumanInputQuestionPrompt,
308
+ QuestionChoice: HumanInputQuestionChoice,
309
+ QuestionTextAnswer: HumanInputQuestionTextAnswer,
310
+ QuestionSubmit: HumanInputQuestionSubmit
311
+ };
312
+ export { HumanInputPrimitive as t };
313
+
314
+ //# sourceMappingURL=human-input-CsCbZomZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"human-input-CsCbZomZ.js","names":[],"sources":["../src/human-input/approvals.tsx","../src/human-input/questions.tsx","../src/human-input/panel.tsx","../src/human-input/index.ts"],"sourcesContent":["import { type ChangeEvent, forwardRef, type MouseEvent, type ReactNode, useCallback } from \"react\";\n\nimport {\n type ApprovalInteraction,\n InternalApprovalProvider,\n useApproval,\n useChatContext,\n useHumanInput,\n} from \"../contexts\";\nimport { stringifyValue } from \"../format\";\nimport { type PrimitiveProps, renderPrimitive } from \"../primitives\";\n\ntype ApprovalChildren = ReactNode | ((approval: ApprovalInteraction) => ReactNode);\ntype HumanInputFilter = \"pending\" | \"all\";\n\ntype HumanInputStatusProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n children?: ReactNode | ((state: ReturnType<typeof useHumanInput>) => ReactNode);\n};\n\nconst HumanInputStatus = forwardRef<HTMLDivElement, HumanInputStatusProps>(\n function HumanInputStatus({ children, ...props }, ref) {\n const humanInput = useHumanInput();\n const renderedChildren = typeof children === \"function\" ? children(humanInput) : children;\n const pendingCount = humanInput.approvals.pending.length + humanInput.questions.pending.length;\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: renderedChildren ?? `${pendingCount} pending`,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype HumanInputApprovalsProps = PrimitiveProps<\"div\"> & {\n filter?: HumanInputFilter;\n keepMounted?: boolean;\n children?: ApprovalChildren;\n};\n\nconst HumanInputApprovals = forwardRef<HTMLDivElement, HumanInputApprovalsProps>(\n function HumanInputApprovals(\n { children, filter = \"pending\", keepMounted = false, ...props },\n ref,\n ) {\n const humanInput = useHumanInput();\n const approvals = filter === \"all\" ? humanInput.approvals.all : humanInput.approvals.pending;\n const empty = approvals.length === 0;\n if (empty && !keepMounted) {\n return null;\n }\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: approvals.map((approval) => (\n <InternalApprovalProvider key={approval.request.id} approval={approval}>\n {typeof children === \"function\"\n ? children(approval)\n : (children ?? <HumanInputApproval />)}\n </InternalApprovalProvider>\n )),\n \"data-state\": empty ? \"empty\" : \"populated\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype HumanInputApprovalProps = PrimitiveProps<\"div\"> & {\n children?: ApprovalChildren;\n};\n\nconst HumanInputApproval = forwardRef<HTMLDivElement, HumanInputApprovalProps>(\n function HumanInputApproval({ children, ...props }, ref) {\n const { approval } = useApproval();\n const renderedChildren =\n typeof children === \"function\"\n ? children(approval)\n : (children ?? defaultApprovalContent(approval));\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: renderedChildren,\n \"data-state\": approval.status,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\nconst HumanInputApprove = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(\n function HumanInputApprove({ onClick, ...props }, ref) {\n const chat = useChatContext();\n const { approval, reason } = useApproval();\n const disabled =\n props.disabled ??\n (approval.status !== \"pending\" || chat.respondingInteractions.has(approval.request.id));\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled) {\n return;\n }\n const decisionReason = reason.trim().length > 0 ? reason : undefined;\n const response = { type: \"tool-approval\" as const, approved: true };\n if (decisionReason !== undefined) Object.assign(response, { reason: decisionReason });\n void chat.respondToInteraction({\n interactionId: approval.request.id,\n response,\n });\n },\n [approval.request.id, chat, disabled, onClick, reason],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Approve\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-state\": disabled ? \"disabled\" : \"enabled\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\nconst HumanInputReject = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(\n function HumanInputReject({ onClick, ...props }, ref) {\n const chat = useChatContext();\n const { approval, reason } = useApproval();\n const disabled =\n props.disabled ??\n (approval.status !== \"pending\" || chat.respondingInteractions.has(approval.request.id));\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled) {\n return;\n }\n const decisionReason = reason.trim().length > 0 ? reason : undefined;\n const response = { type: \"tool-approval\" as const, approved: false };\n if (decisionReason !== undefined) Object.assign(response, { reason: decisionReason });\n void chat.respondToInteraction({\n interactionId: approval.request.id,\n response,\n });\n },\n [approval.request.id, chat, disabled, onClick, reason],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Reject\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-state\": disabled ? \"disabled\" : \"enabled\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\nconst HumanInputApprovalReason = forwardRef<HTMLTextAreaElement, PrimitiveProps<\"textarea\">>(\n function HumanInputApprovalReason({ onChange, ...props }, ref) {\n const approval = useApproval();\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLTextAreaElement>) => {\n onChange?.(event);\n if (!event.defaultPrevented) {\n approval.setReason(event.currentTarget.value);\n }\n },\n [approval, onChange],\n );\n\n return renderPrimitive(\n \"textarea\",\n {\n ...props,\n \"aria-label\": props[\"aria-label\"] ?? \"Approval reason\",\n onChange: handleChange,\n value: approval.reason,\n } as PrimitiveProps<\"textarea\">,\n ref,\n );\n },\n);\n\nfunction defaultApprovalContent(approval: ApprovalInteraction): ReactNode {\n return (\n <>\n <div>{approval.request.toolName}</div>\n {approval.request.input !== undefined ? (\n <pre>{stringifyValue(approval.request.input)}</pre>\n ) : null}\n <HumanInputApprovalReason />\n <HumanInputApprove />\n <HumanInputReject />\n </>\n );\n}\n\nexport type { ApprovalChildren, HumanInputFilter };\nexport {\n HumanInputApproval,\n HumanInputApprovalReason,\n HumanInputApprovals,\n HumanInputApprove,\n HumanInputReject,\n HumanInputStatus,\n};\n","import type { AgentQuestionAnswer, AgentQuestionPrompt } from \"@anvia/core/agent/interactions\";\nimport {\n type ChangeEvent,\n forwardRef,\n type MouseEvent,\n type ReactNode,\n useCallback,\n useMemo,\n useState,\n} from \"react\";\n\nimport {\n InternalQuestionPromptProvider,\n InternalQuestionProvider,\n type QuestionContextValue,\n type QuestionInteraction,\n useChatContext,\n useHumanInput,\n useQuestion,\n useQuestionPrompt,\n} from \"../contexts\";\nimport { type PrimitiveProps, renderPrimitive } from \"../primitives\";\nimport type { HumanInputFilter } from \"./approvals\";\n\ntype QuestionChildren = ReactNode | ((question: QuestionInteraction) => ReactNode);\n\ntype HumanInputQuestionsProps = PrimitiveProps<\"div\"> & {\n filter?: HumanInputFilter;\n keepMounted?: boolean;\n children?: QuestionChildren;\n};\n\nconst HumanInputQuestions = forwardRef<HTMLDivElement, HumanInputQuestionsProps>(\n function HumanInputQuestions(\n { children, filter = \"pending\", keepMounted = false, ...props },\n ref,\n ) {\n const humanInput = useHumanInput();\n const questions = filter === \"all\" ? humanInput.questions.all : humanInput.questions.pending;\n const empty = questions.length === 0;\n if (empty && !keepMounted) {\n return null;\n }\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: questions.map((question) => (\n <QuestionProvider key={question.request.id} question={question}>\n {typeof children === \"function\"\n ? children(question)\n : (children ?? <HumanInputQuestion />)}\n </QuestionProvider>\n )),\n \"data-state\": empty ? \"empty\" : \"populated\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype HumanInputQuestionProps = PrimitiveProps<\"div\"> & {\n children?: QuestionChildren;\n};\n\nconst HumanInputQuestion = forwardRef<HTMLDivElement, HumanInputQuestionProps>(\n function HumanInputQuestion({ children, ...props }, ref) {\n const { question } = useQuestion();\n const renderedChildren =\n typeof children === \"function\"\n ? children(question)\n : (children ?? defaultQuestionContent(question));\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: renderedChildren,\n \"data-state\": question.status,\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype HumanInputQuestionPromptProps = PrimitiveProps<\"div\"> & {\n promptId?: string;\n};\n\nconst HumanInputQuestionPrompt = forwardRef<HTMLDivElement, HumanInputQuestionPromptProps>(\n function HumanInputQuestionPrompt({ promptId, ...props }, ref) {\n const { question } = useQuestion();\n const prompt =\n question.request.questions.find((item) => item.id === promptId) ??\n question.request.questions[0];\n if (prompt === undefined) {\n return null;\n }\n\n return (\n <InternalQuestionPromptProvider prompt={prompt}>\n {renderPrimitive(\n \"div\",\n {\n ...props,\n children: props.children ?? defaultQuestionPrompt(prompt),\n } as PrimitiveProps<\"div\">,\n ref,\n )}\n </InternalQuestionPromptProvider>\n );\n },\n);\n\ntype HumanInputQuestionChoiceProps = PrimitiveProps<\"button\"> & {\n value?: string;\n answer?: string;\n custom?: boolean;\n};\n\nconst HumanInputQuestionChoice = forwardRef<HTMLButtonElement, HumanInputQuestionChoiceProps>(\n function HumanInputQuestionChoice({ answer, custom = false, onClick, value, ...props }, ref) {\n const { prompt } = useQuestionPrompt();\n const question = useQuestion();\n const choiceValue = value ?? prompt.choices?.[0]?.value ?? \"\";\n const choice = prompt.choices?.find((item) => item.value === choiceValue);\n const selected = question.answers[prompt.id]?.value === choiceValue;\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || choiceValue.length === 0) {\n return;\n }\n const nextAnswer: AgentQuestionAnswer = {\n questionId: prompt.id,\n value: custom ? (answer ?? choice?.label ?? choiceValue) : choiceValue,\n };\n question.setAnswer(prompt, nextAnswer);\n },\n [answer, choice?.label, choiceValue, custom, onClick, prompt, question],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? choice?.label ?? choiceValue,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-state\": selected ? \"selected\" : \"idle\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\nconst HumanInputQuestionTextAnswer = forwardRef<HTMLTextAreaElement, PrimitiveProps<\"textarea\">>(\n function HumanInputQuestionTextAnswer({ onChange, ...props }, ref) {\n const { prompt } = useQuestionPrompt();\n const question = useQuestion();\n const value = question.answers[prompt.id]?.value ?? \"\";\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLTextAreaElement>) => {\n onChange?.(event);\n if (event.defaultPrevented) {\n return;\n }\n const answer = event.currentTarget.value;\n question.setAnswer(prompt, {\n questionId: prompt.id,\n value: answer,\n });\n },\n [onChange, prompt, question],\n );\n\n return renderPrimitive(\n \"textarea\",\n {\n ...props,\n \"aria-label\": props[\"aria-label\"] ?? prompt.text,\n onChange: handleChange,\n value,\n } as PrimitiveProps<\"textarea\">,\n ref,\n );\n },\n);\n\nconst HumanInputQuestionSubmit = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(\n function HumanInputQuestionSubmit({ onClick, ...props }, ref) {\n const chat = useChatContext();\n const question = useQuestion();\n const answers = useMemo(\n () =>\n question.question.request.questions.flatMap((prompt) => {\n const answer = question.answers[prompt.id];\n return answer === undefined || answer.value.trim().length === 0 ? [] : [answer];\n }),\n [question],\n );\n const disabled =\n props.disabled ??\n (question.question.status !== \"pending\" ||\n chat.respondingInteractions.has(question.question.request.id) ||\n answers.length !== question.question.request.questions.length);\n\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled) {\n return;\n }\n void chat.respondToInteraction({\n interactionId: question.question.request.id,\n response: { type: \"tool-question\", answers },\n });\n },\n [answers, chat, disabled, onClick, question.question.request.id],\n );\n\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Submit\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"data-state\": disabled ? \"disabled\" : \"enabled\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\nfunction QuestionProvider({\n question,\n children,\n}: {\n question: QuestionInteraction;\n children?: ReactNode;\n}) {\n const [answers, setAnswers] = useState<Record<string, AgentQuestionAnswer>>({});\n const setAnswer = useCallback((prompt: AgentQuestionPrompt, answer: AgentQuestionAnswer) => {\n setAnswers((current) => ({ ...current, [prompt.id]: answer }));\n }, []);\n const value = useMemo<QuestionContextValue>(\n () => ({ question, answers, setAnswer }),\n [answers, question, setAnswer],\n );\n\n return <InternalQuestionProvider value={value}>{children}</InternalQuestionProvider>;\n}\n\nfunction defaultQuestionContent(question: QuestionInteraction): ReactNode {\n return (\n <>\n <div>{question.request.toolName}</div>\n {question.request.questions.map((prompt) => (\n <HumanInputQuestionPrompt key={prompt.id} promptId={prompt.id} />\n ))}\n <HumanInputQuestionSubmit />\n </>\n );\n}\n\nfunction defaultQuestionPrompt(prompt: AgentQuestionPrompt): ReactNode {\n return (\n <>\n <div>{prompt.text}</div>\n {(prompt.choices?.length ?? 0) > 0 ? (\n <div>\n {prompt.choices?.map((choice) => (\n <HumanInputQuestionChoice key={choice.value} value={choice.value}>\n {choice.label}\n </HumanInputQuestionChoice>\n ))}\n </div>\n ) : (\n <HumanInputQuestionTextAnswer />\n )}\n </>\n );\n}\n\nexport type { QuestionChildren };\nexport {\n HumanInputQuestion,\n HumanInputQuestionChoice,\n HumanInputQuestionPrompt,\n HumanInputQuestionSubmit,\n HumanInputQuestions,\n HumanInputQuestionTextAnswer,\n};\n","import { forwardRef } from \"react\";\n\nimport { useHumanInput } from \"../contexts\";\nimport { type PrimitiveProps, renderPrimitive } from \"../primitives\";\nimport { HumanInputApprovals, type HumanInputFilter } from \"./approvals\";\nimport { HumanInputQuestions } from \"./questions\";\n\ntype HumanInputPanelProps = PrimitiveProps<\"div\"> & {\n filter?: HumanInputFilter;\n};\n\nconst HumanInputPanel = forwardRef<HTMLDivElement, HumanInputPanelProps>(function HumanInputPanel(\n { children, filter = \"pending\", ...props },\n ref,\n) {\n const humanInput = useHumanInput();\n const approvals = filter === \"all\" ? humanInput.approvals.all : humanInput.approvals.pending;\n const questions = filter === \"all\" ? humanInput.questions.all : humanInput.questions.pending;\n if (approvals.length === 0 && questions.length === 0) {\n return null;\n }\n\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: children ?? (\n <>\n <HumanInputApprovals filter={filter} />\n <HumanInputQuestions filter={filter} />\n </>\n ),\n } as PrimitiveProps<\"div\">,\n ref,\n );\n});\n\nexport { HumanInputPanel };\n","import {\n HumanInputApproval,\n HumanInputApprovalReason,\n HumanInputApprovals,\n HumanInputApprove,\n HumanInputReject,\n HumanInputStatus,\n} from \"./approvals\";\nimport { HumanInputPanel } from \"./panel\";\nimport {\n HumanInputQuestion,\n HumanInputQuestionChoice,\n HumanInputQuestionPrompt,\n HumanInputQuestionSubmit,\n HumanInputQuestions,\n HumanInputQuestionTextAnswer,\n} from \"./questions\";\n\nexport const HumanInputPrimitive = {\n Panel: HumanInputPanel,\n Status: HumanInputStatus,\n Approvals: HumanInputApprovals,\n Approval: HumanInputApproval,\n ApprovalReason: HumanInputApprovalReason,\n Approve: HumanInputApprove,\n Reject: HumanInputReject,\n Questions: HumanInputQuestions,\n Question: HumanInputQuestion,\n QuestionPrompt: HumanInputQuestionPrompt,\n QuestionChoice: HumanInputQuestionChoice,\n QuestionTextAnswer: HumanInputQuestionTextAnswer,\n QuestionSubmit: HumanInputQuestionSubmit,\n} as const;\n\nexport type {\n ApprovalContextValue,\n QuestionContextValue,\n QuestionPromptContextValue,\n} from \"../contexts\";\nexport {\n useApproval,\n useChatContext,\n useHumanInput,\n useQuestion,\n useQuestionPrompt,\n} from \"../contexts\";\n"],"mappings":";;;;;;AAmBA,MAAM,mBAAmB,WACvB,SAAS,iBAAiB,EAAE,UAAU,GAAG,SAAS,KAAK;CACrD,MAAM,aAAa,cAAc;CACjC,MAAM,mBAAmB,OAAO,aAAa,aAAa,SAAS,UAAU,IAAI;CACjF,MAAM,eAAe,WAAW,UAAU,QAAQ,SAAS,WAAW,UAAU,QAAQ;CAExF,OAAO,gBACL,OACA;EACE,GAAG;EACH,UAAU,oBAAoB,GAAG,aAAa;CAChD,GACA,GACF;AACF,CACF;AAQA,MAAM,sBAAsB,WAC1B,SAAS,oBACP,EAAE,UAAU,SAAS,WAAW,cAAc,OAAO,GAAG,SACxD,KACA;CACA,MAAM,aAAa,cAAc;CACjC,MAAM,YAAY,WAAW,QAAQ,WAAW,UAAU,MAAM,WAAW,UAAU;CACrF,MAAM,QAAQ,UAAU,WAAW;CACnC,IAAI,SAAS,CAAC,aACZ,OAAO;CAGT,OAAO,gBACL,OACA;EACE,GAAG;EACH,UAAU,UAAU,KAAK,aACvB,oBAAC,0BAAD;GAA8D;GAC3D,UAAA,OAAO,aAAa,aACjB,SAAS,QAAQ,IAChB,YAAY,oBAAC,oBAAD,CAAqB,CAAA;EACd,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AA;EAEN,GACA,GACF;CACF,CChBS;CACP,QAAQ;CACR,WAAW;CACX,UAAU;CACV,gBAAgB;CAChB,SAAS;CACT,QAAQ;CACR,WAAW;CACX,UAAU;CACV,gBAAgB;CAChB,gBAAgB;CAChB,oBAAoB;CACpB,gBAAgB;AAClB"}
@@ -1,40 +1,3 @@
1
- import * as react from 'react';
2
- import * as _anvia_client from '@anvia/client';
3
- import { I as ImageContextValue } from '../image-VZv6Ddsn.js';
4
- export { u as useImage } from '../image-VZv6Ddsn.js';
5
- import { P as PrimitiveProps } from '../render-CRKWam2v.js';
6
-
7
- declare const ImagePrimitive: {
8
- readonly Root: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"figure">, "children"> & {
9
- attachment?: _anvia_client.UIAttachment;
10
- children?: react.ReactNode | ((image: ImageContextValue) => react.ReactNode);
11
- renderWhen?: "image" | "always";
12
- } & react.RefAttributes<HTMLElement>>;
13
- readonly Preview: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
14
- alt?: string;
15
- errorFallback?: react.ReactNode;
16
- loadingFallback?: react.ReactNode;
17
- } & react.RefAttributes<HTMLDivElement>>;
18
- readonly Name: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, "asChild"> & {
19
- asChild?: boolean;
20
- } & react.RefAttributes<HTMLElement>>;
21
- readonly Actions: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
22
- asChild?: boolean;
23
- } & react.RefAttributes<HTMLDivElement>>;
24
- readonly Copy: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
25
- asChild?: boolean;
26
- } & react.RefAttributes<HTMLButtonElement>>;
27
- readonly Download: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
28
- asChild?: boolean;
29
- } & {
30
- filename?: string;
31
- } & react.RefAttributes<HTMLButtonElement>>;
32
- readonly ZoomTrigger: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
33
- asChild?: boolean;
34
- } & react.RefAttributes<HTMLButtonElement>>;
35
- readonly ZoomOverlay: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
36
- container?: Element | DocumentFragment;
37
- } & react.RefAttributes<HTMLDivElement>>;
38
- };
39
-
40
- export { ImageContextValue, ImagePrimitive };
1
+ import { _ as ImageContextValue, v as useImage } from "../index-Mw3ltwSG.js";
2
+ import { f as ImagePrimitive } from "../index-BCBVcl0D.js";
3
+ export { type ImageContextValue, ImagePrimitive, useImage };
@@ -1,12 +1,3 @@
1
- import {
2
- ImagePrimitive
3
- } from "../chunk-DLBNFBXQ.js";
4
- import "../chunk-T3ZFZ3NP.js";
5
- import {
6
- useImage
7
- } from "../chunk-E73S3SOF.js";
8
- export {
9
- ImagePrimitive,
10
- useImage
11
- };
12
- //# sourceMappingURL=index.js.map
1
+ import { _ as useImage } from "../contexts-B4ijG24z.js";
2
+ import { t as ImagePrimitive } from "../image-aCWm6hFe.js";
3
+ export { ImagePrimitive, useImage };