@anvia/react-ui 1.0.0-rc.2 → 1.0.0-rc.3

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 (42) hide show
  1. package/dist/attachment/index.js +2 -2
  2. package/dist/chat/index.d.ts +4 -4
  3. package/dist/chat/index.js +4 -4
  4. package/dist/chat-BRVgYE68.d.ts +86 -0
  5. package/dist/{chunk-6J6XAQNS.js → chunk-B5JX33SC.js} +2 -2
  6. package/dist/{chunk-PBR53CKI.js → chunk-BZZ7MJNM.js} +24 -15
  7. package/dist/chunk-BZZ7MJNM.js.map +1 -0
  8. package/dist/{chunk-P3JZMVPK.js → chunk-JMGFSYCR.js} +18 -2
  9. package/dist/chunk-JMGFSYCR.js.map +1 -0
  10. package/dist/{chunk-YFPDH2JM.js → chunk-JNPCYX4Z.js} +2 -2
  11. package/dist/{chunk-R5FQUAAE.js → chunk-MF7RWETT.js} +2 -2
  12. package/dist/{chunk-G3D5YKD2.js → chunk-QHOLI3OZ.js} +40 -37
  13. package/dist/chunk-QHOLI3OZ.js.map +1 -0
  14. package/dist/{chunk-OVCNT3OR.js → chunk-URQROKGZ.js} +2 -2
  15. package/dist/{chunk-3OVUVDNY.js → chunk-XZUF27QY.js} +4 -4
  16. package/dist/{chunk-OUWDPMJK.js → chunk-YJNTXNVL.js} +2 -2
  17. package/dist/completion/index.js +2 -2
  18. package/dist/{composer-C4IJllVz.d.ts → composer-BTT2vzYF.d.ts} +1 -1
  19. package/dist/human-input/index.d.ts +7 -6
  20. package/dist/human-input/index.js +2 -2
  21. package/dist/human-input-DOBCZgqw.d.ts +27 -0
  22. package/dist/image/index.js +2 -2
  23. package/dist/index.d.ts +3 -3
  24. package/dist/index.js +9 -9
  25. package/dist/message/index.d.ts +2 -2
  26. package/dist/message/index.js +3 -3
  27. package/dist/selection-toolbar/index.js +2 -2
  28. package/dist/shared.d.ts +3 -3
  29. package/dist/shared.js +1 -1
  30. package/dist/thread-list/index.js +2 -2
  31. package/package.json +5 -5
  32. package/dist/chat-WPrlqdvZ.d.ts +0 -14
  33. package/dist/chunk-G3D5YKD2.js.map +0 -1
  34. package/dist/chunk-P3JZMVPK.js.map +0 -1
  35. package/dist/chunk-PBR53CKI.js.map +0 -1
  36. package/dist/human-input-Bdq46Q56.d.ts +0 -20
  37. /package/dist/{chunk-6J6XAQNS.js.map → chunk-B5JX33SC.js.map} +0 -0
  38. /package/dist/{chunk-YFPDH2JM.js.map → chunk-JNPCYX4Z.js.map} +0 -0
  39. /package/dist/{chunk-R5FQUAAE.js.map → chunk-MF7RWETT.js.map} +0 -0
  40. /package/dist/{chunk-OVCNT3OR.js.map → chunk-URQROKGZ.js.map} +0 -0
  41. /package/dist/{chunk-3OVUVDNY.js.map → chunk-XZUF27QY.js.map} +0 -0
  42. /package/dist/{chunk-OUWDPMJK.js.map → chunk-YJNTXNVL.js.map} +0 -0
@@ -13,7 +13,7 @@ import {
13
13
  useHumanInput,
14
14
  useQuestion,
15
15
  useQuestionPrompt
16
- } from "./chunk-P3JZMVPK.js";
16
+ } from "./chunk-JMGFSYCR.js";
17
17
 
18
18
  // src/human-input/approvals.tsx
19
19
  import { forwardRef, useCallback } from "react";
@@ -47,7 +47,7 @@ var HumanInputApprovals = forwardRef(
47
47
  "div",
48
48
  {
49
49
  ...props,
50
- children: approvals.map((approval) => /* @__PURE__ */ jsx(InternalApprovalProvider, { approval, children: typeof children === "function" ? children(approval) : children ?? /* @__PURE__ */ jsx(HumanInputApproval, {}) }, approval.id)),
50
+ children: approvals.map((approval) => /* @__PURE__ */ jsx(InternalApprovalProvider, { approval, children: typeof children === "function" ? children(approval) : children ?? /* @__PURE__ */ jsx(HumanInputApproval, {}) }, approval.request.id)),
51
51
  "data-anvia-approvals": "",
52
52
  "data-empty": empty ? "" : void 0
53
53
  },
@@ -75,7 +75,7 @@ var HumanInputApprove = forwardRef(
75
75
  function HumanInputApprove2({ onClick, ...props }, ref) {
76
76
  const chat = useChatContext();
77
77
  const { approval, reason } = useApproval();
78
- const disabled = props.disabled ?? (approval.status !== "pending" || chat.decidingApprovals.has(approval.id));
78
+ const disabled = props.disabled ?? (approval.status !== "pending" || chat.respondingInteractions.has(approval.request.id));
79
79
  const handleClick = useCallback(
80
80
  (event) => {
81
81
  onClick?.(event);
@@ -83,12 +83,14 @@ var HumanInputApprove = forwardRef(
83
83
  return;
84
84
  }
85
85
  const decisionReason = reason.trim().length > 0 ? reason : void 0;
86
- void chat.approveTool({
87
- approvalId: approval.id,
88
- ...decisionReason === void 0 ? {} : { reason: decisionReason }
86
+ const response = { type: "tool-approval", approved: true };
87
+ if (decisionReason !== void 0) Object.assign(response, { reason: decisionReason });
88
+ void chat.respondToInteraction({
89
+ interactionId: approval.request.id,
90
+ response
89
91
  });
90
92
  },
91
- [approval.id, chat, disabled, onClick, reason]
93
+ [approval.request.id, chat, disabled, onClick, reason]
92
94
  );
93
95
  return renderPrimitive(
94
96
  "button",
@@ -109,7 +111,7 @@ var HumanInputReject = forwardRef(
109
111
  function HumanInputReject2({ onClick, ...props }, ref) {
110
112
  const chat = useChatContext();
111
113
  const { approval, reason } = useApproval();
112
- const disabled = props.disabled ?? (approval.status !== "pending" || chat.decidingApprovals.has(approval.id));
114
+ const disabled = props.disabled ?? (approval.status !== "pending" || chat.respondingInteractions.has(approval.request.id));
113
115
  const handleClick = useCallback(
114
116
  (event) => {
115
117
  onClick?.(event);
@@ -117,12 +119,14 @@ var HumanInputReject = forwardRef(
117
119
  return;
118
120
  }
119
121
  const decisionReason = reason.trim().length > 0 ? reason : void 0;
120
- void chat.rejectTool({
121
- approvalId: approval.id,
122
- ...decisionReason === void 0 ? {} : { reason: decisionReason }
122
+ const response = { type: "tool-approval", approved: false };
123
+ if (decisionReason !== void 0) Object.assign(response, { reason: decisionReason });
124
+ void chat.respondToInteraction({
125
+ interactionId: approval.request.id,
126
+ response
123
127
  });
124
128
  },
125
- [approval.id, chat, disabled, onClick, reason]
129
+ [approval.request.id, chat, disabled, onClick, reason]
126
130
  );
127
131
  return renderPrimitive(
128
132
  "button",
@@ -166,8 +170,8 @@ var HumanInputApprovalReason = forwardRef(
166
170
  );
167
171
  function defaultApprovalContent(approval) {
168
172
  return /* @__PURE__ */ jsxs(Fragment, { children: [
169
- /* @__PURE__ */ jsx("div", { "data-anvia-approval-tool": "", children: approval.toolName }),
170
- approval.input !== void 0 ? /* @__PURE__ */ jsx("pre", { "data-anvia-approval-args": "", children: stringifyValue(approval.input) }) : null,
173
+ /* @__PURE__ */ jsx("div", { "data-anvia-approval-tool": "", children: approval.request.toolName }),
174
+ approval.request.input !== void 0 ? /* @__PURE__ */ jsx("pre", { "data-anvia-approval-args": "", children: stringifyValue(approval.request.input) }) : null,
171
175
  /* @__PURE__ */ jsx(HumanInputApprovalReason, {}),
172
176
  /* @__PURE__ */ jsx(HumanInputApprove, {}),
173
177
  /* @__PURE__ */ jsx(HumanInputReject, {})
@@ -197,7 +201,7 @@ var HumanInputQuestions = forwardRef2(
197
201
  "div",
198
202
  {
199
203
  ...props,
200
- children: questions.map((question) => /* @__PURE__ */ jsx2(QuestionProvider, { question, children: typeof children === "function" ? children(question) : children ?? /* @__PURE__ */ jsx2(HumanInputQuestion, {}) }, question.id)),
204
+ children: questions.map((question) => /* @__PURE__ */ jsx2(QuestionProvider, { question, children: typeof children === "function" ? children(question) : children ?? /* @__PURE__ */ jsx2(HumanInputQuestion, {}) }, question.request.id)),
201
205
  "data-anvia-questions": "",
202
206
  "data-empty": empty ? "" : void 0
203
207
  },
@@ -224,7 +228,7 @@ var HumanInputQuestion = forwardRef2(
224
228
  var HumanInputQuestionPrompt = forwardRef2(
225
229
  function HumanInputQuestionPrompt2({ promptId, ...props }, ref) {
226
230
  const { question } = useQuestion();
227
- const prompt = question.questions.find((item) => item.id === promptId) ?? question.questions[0];
231
+ const prompt = question.request.questions.find((item) => item.id === promptId) ?? question.request.questions[0];
228
232
  if (prompt === void 0) {
229
233
  return null;
230
234
  }
@@ -243,9 +247,9 @@ var HumanInputQuestionChoice = forwardRef2(
243
247
  function HumanInputQuestionChoice2({ answer, custom = false, onClick, value, ...props }, ref) {
244
248
  const { prompt } = useQuestionPrompt();
245
249
  const question = useQuestion();
246
- const choiceValue = value ?? prompt.choices[0]?.value ?? "";
247
- const choice = prompt.choices.find((item) => item.value === choiceValue);
248
- const selected = question.answers[prompt.id]?.choice === choiceValue;
250
+ const choiceValue = value ?? prompt.choices?.[0]?.value ?? "";
251
+ const choice = prompt.choices?.find((item) => item.value === choiceValue);
252
+ const selected = question.answers[prompt.id]?.value === choiceValue;
249
253
  const handleClick = useCallback2(
250
254
  (event) => {
251
255
  onClick?.(event);
@@ -254,10 +258,8 @@ var HumanInputQuestionChoice = forwardRef2(
254
258
  }
255
259
  const nextAnswer = {
256
260
  questionId: prompt.id,
257
- answer: answer ?? choice?.label ?? choiceValue,
258
- choice: choiceValue
261
+ value: custom ? answer ?? choice?.label ?? choiceValue : choiceValue
259
262
  };
260
- if (custom) nextAnswer.custom = true;
261
263
  question.setAnswer(prompt, nextAnswer);
262
264
  },
263
265
  [answer, choice?.label, choiceValue, custom, onClick, prompt, question]
@@ -280,7 +282,7 @@ var HumanInputQuestionTextAnswer = forwardRef2(
280
282
  function HumanInputQuestionTextAnswer2({ onChange, ...props }, ref) {
281
283
  const { prompt } = useQuestionPrompt();
282
284
  const question = useQuestion();
283
- const value = question.answers[prompt.id]?.answer ?? "";
285
+ const value = question.answers[prompt.id]?.value ?? "";
284
286
  const handleChange = useCallback2(
285
287
  (event) => {
286
288
  onChange?.(event);
@@ -290,8 +292,7 @@ var HumanInputQuestionTextAnswer = forwardRef2(
290
292
  const answer = event.currentTarget.value;
291
293
  question.setAnswer(prompt, {
292
294
  questionId: prompt.id,
293
- answer,
294
- custom: true
295
+ value: answer
295
296
  });
296
297
  },
297
298
  [onChange, prompt, question]
@@ -300,7 +301,7 @@ var HumanInputQuestionTextAnswer = forwardRef2(
300
301
  "textarea",
301
302
  {
302
303
  ...props,
303
- "aria-label": props["aria-label"] ?? prompt.question,
304
+ "aria-label": props["aria-label"] ?? prompt.text,
304
305
  onChange: handleChange,
305
306
  value,
306
307
  "data-anvia-question-text-answer": ""
@@ -314,22 +315,25 @@ var HumanInputQuestionSubmit = forwardRef2(
314
315
  const chat = useChatContext();
315
316
  const question = useQuestion();
316
317
  const answers = useMemo(
317
- () => question.question.questions.flatMap((prompt) => {
318
+ () => question.question.request.questions.flatMap((prompt) => {
318
319
  const answer = question.answers[prompt.id];
319
- return answer === void 0 || answer.answer.trim().length === 0 ? [] : [answer];
320
+ return answer === void 0 || answer.value.trim().length === 0 ? [] : [answer];
320
321
  }),
321
322
  [question]
322
323
  );
323
- const disabled = props.disabled ?? (question.question.status !== "pending" || chat.answeringQuestions.has(question.question.id) || answers.length === 0);
324
+ const disabled = props.disabled ?? (question.question.status !== "pending" || chat.respondingInteractions.has(question.question.request.id) || answers.length !== question.question.request.questions.length);
324
325
  const handleClick = useCallback2(
325
326
  (event) => {
326
327
  onClick?.(event);
327
328
  if (event.defaultPrevented || disabled) {
328
329
  return;
329
330
  }
330
- void chat.answerToolQuestion({ questionId: question.question.id, answers });
331
+ void chat.respondToInteraction({
332
+ interactionId: question.question.request.id,
333
+ response: { type: "tool-question", answers }
334
+ });
331
335
  },
332
- [answers, chat, disabled, onClick, question.question.id]
336
+ [answers, chat, disabled, onClick, question.question.request.id]
333
337
  );
334
338
  return renderPrimitive(
335
339
  "button",
@@ -362,16 +366,15 @@ function QuestionProvider({
362
366
  }
363
367
  function defaultQuestionContent(question) {
364
368
  return /* @__PURE__ */ jsxs2(Fragment2, { children: [
365
- /* @__PURE__ */ jsx2("div", { "data-anvia-question-tool": "", children: question.toolName }),
366
- question.input !== void 0 ? /* @__PURE__ */ jsx2("pre", { "data-anvia-question-args": "", children: stringifyValue(question.input) }) : null,
367
- question.questions.map((prompt) => /* @__PURE__ */ jsx2(HumanInputQuestionPrompt, { promptId: prompt.id }, prompt.id)),
369
+ /* @__PURE__ */ jsx2("div", { "data-anvia-question-tool": "", children: question.request.toolName }),
370
+ question.request.questions.map((prompt) => /* @__PURE__ */ jsx2(HumanInputQuestionPrompt, { promptId: prompt.id }, prompt.id)),
368
371
  /* @__PURE__ */ jsx2(HumanInputQuestionSubmit, {})
369
372
  ] });
370
373
  }
371
374
  function defaultQuestionPrompt(prompt) {
372
375
  return /* @__PURE__ */ jsxs2(Fragment2, { children: [
373
- /* @__PURE__ */ jsx2("div", { "data-anvia-question-text": "", children: prompt.question }),
374
- prompt.choices.length > 0 ? /* @__PURE__ */ jsx2("div", { "data-anvia-question-choices": "", children: prompt.choices.map((choice) => /* @__PURE__ */ jsx2(HumanInputQuestionChoice, { value: choice.value, children: choice.label }, choice.value)) }) : /* @__PURE__ */ jsx2(HumanInputQuestionTextAnswer, {})
376
+ /* @__PURE__ */ jsx2("div", { "data-anvia-question-text": "", children: prompt.text }),
377
+ (prompt.choices?.length ?? 0) > 0 ? /* @__PURE__ */ jsx2("div", { "data-anvia-question-choices": "", children: prompt.choices?.map((choice) => /* @__PURE__ */ jsx2(HumanInputQuestionChoice, { value: choice.value, children: choice.label }, choice.value)) }) : /* @__PURE__ */ jsx2(HumanInputQuestionTextAnswer, {})
375
378
  ] });
376
379
  }
377
380
 
@@ -418,4 +421,4 @@ var HumanInput = {
418
421
  export {
419
422
  HumanInput
420
423
  };
421
- //# sourceMappingURL=chunk-G3D5YKD2.js.map
424
+ //# sourceMappingURL=chunk-QHOLI3OZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/human-input/approvals.tsx","../src/human-input/panel.tsx","../src/human-input/questions.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 \"data-anvia-human-input-status\": \"\",\n \"data-pending\": String(pendingCount),\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-anvia-approvals\": \"\",\n \"data-empty\": empty ? \"\" : undefined,\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-anvia-approval\": \"\",\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-anvia-approve\": \"\",\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-anvia-reject\": \"\",\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 \"data-anvia-approval-reason\": \"\",\n } as PrimitiveProps<\"textarea\">,\n ref,\n );\n },\n);\n\nfunction defaultApprovalContent(approval: ApprovalInteraction): ReactNode {\n return (\n <>\n <div data-anvia-approval-tool=\"\">{approval.request.toolName}</div>\n {approval.request.input !== undefined ? (\n <pre data-anvia-approval-args=\"\">{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 { 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 \"data-anvia-human-input-panel\": \"\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n});\n\nexport { HumanInputPanel };\n","import type { AgentQuestionAnswer, AgentQuestionPrompt } from \"@anvia/core/agent\";\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-anvia-questions\": \"\",\n \"data-empty\": empty ? \"\" : undefined,\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-anvia-question\": \"\",\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 \"data-anvia-question-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-anvia-question-choice\": \"\",\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 \"data-anvia-question-text-answer\": \"\",\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-anvia-question-submit\": \"\",\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 data-anvia-question-tool=\"\">{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 data-anvia-question-text=\"\">{prompt.text}</div>\n {(prompt.choices?.length ?? 0) > 0 ? (\n <div data-anvia-question-choices=\"\">\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 {\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 HumanInput = {\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":";;;;;;;;;;;;;;;;;;AAAA,SAA2B,YAA6C,mBAAmB;AAgE9D,SAoJzB,UApJyB,KAoJzB,YApJyB;AA7C7B,IAAM,mBAAmB;AAAA,EACvB,SAASA,kBAAiB,EAAE,UAAU,GAAG,MAAM,GAAG,KAAK;AACrD,UAAM,aAAa,cAAc;AACjC,UAAM,mBAAmB,OAAO,aAAa,aAAa,SAAS,UAAU,IAAI;AACjF,UAAM,eAAe,WAAW,UAAU,QAAQ,SAAS,WAAW,UAAU,QAAQ;AAEx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;AElBM,IAAM,aAAa;AAAA,EACxB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,gBAAgB;AAClB;","names":["HumanInputStatus","HumanInputApprovals","HumanInputApproval","HumanInputApprove","HumanInputReject","HumanInputApprovalReason","forwardRef","forwardRef","useCallback","Fragment","jsx","jsxs","forwardRef","HumanInputQuestions","HumanInputQuestion","HumanInputQuestionPrompt","HumanInputQuestionChoice","useCallback","HumanInputQuestionTextAnswer","HumanInputQuestionSubmit","Fragment","jsx","jsxs","forwardRef","HumanInputPanel"]}
@@ -5,7 +5,7 @@ import {
5
5
  InternalCompletionInputProvider,
6
6
  useCompletionContext,
7
7
  useCompletionInput
8
- } from "./chunk-P3JZMVPK.js";
8
+ } from "./chunk-JMGFSYCR.js";
9
9
 
10
10
  // src/completion/form.tsx
11
11
  import {
@@ -198,4 +198,4 @@ var Completion = {
198
198
  export {
199
199
  Completion
200
200
  };
201
- //# sourceMappingURL=chunk-OVCNT3OR.js.map
201
+ //# sourceMappingURL=chunk-URQROKGZ.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  Message,
3
3
  shiftComposerEntityRanges
4
- } from "./chunk-PBR53CKI.js";
4
+ } from "./chunk-BZZ7MJNM.js";
5
5
  import {
6
6
  Attachment
7
- } from "./chunk-6J6XAQNS.js";
7
+ } from "./chunk-B5JX33SC.js";
8
8
  import {
9
9
  composeRefs,
10
10
  renderPrimitive
@@ -17,7 +17,7 @@ import {
17
17
  useChatContext,
18
18
  useComposer,
19
19
  useThread
20
- } from "./chunk-P3JZMVPK.js";
20
+ } from "./chunk-JMGFSYCR.js";
21
21
 
22
22
  // src/chat/composer.tsx
23
23
  import { mergeAttributes } from "@tiptap/core";
@@ -1573,4 +1573,4 @@ export {
1573
1573
  Composer,
1574
1574
  Thread
1575
1575
  };
1576
- //# sourceMappingURL=chunk-3OVUVDNY.js.map
1576
+ //# sourceMappingURL=chunk-XZUF27QY.js.map
@@ -6,7 +6,7 @@ import {
6
6
  InternalImageProvider,
7
7
  useImage,
8
8
  useOptionalAttachment
9
- } from "./chunk-P3JZMVPK.js";
9
+ } from "./chunk-JMGFSYCR.js";
10
10
 
11
11
  // src/image/parts.tsx
12
12
  import {
@@ -429,4 +429,4 @@ var Image = {
429
429
  export {
430
430
  Image
431
431
  };
432
- //# sourceMappingURL=chunk-OUWDPMJK.js.map
432
+ //# sourceMappingURL=chunk-YJNTXNVL.js.map
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  Completion
3
- } from "../chunk-OVCNT3OR.js";
3
+ } from "../chunk-URQROKGZ.js";
4
4
  import "../chunk-T3ZFZ3NP.js";
5
5
  import {
6
6
  CompletionProvider,
7
7
  useCompletionContext,
8
8
  useCompletionInput
9
- } from "../chunk-P3JZMVPK.js";
9
+ } from "../chunk-JMGFSYCR.js";
10
10
  export {
11
11
  Completion,
12
12
  CompletionProvider,
@@ -1,6 +1,6 @@
1
1
  import { CreateUIAttachment, UIAttachment } from '@anvia/client';
2
2
  import { ReactNode } from 'react';
3
- import { C as ChatController } from './chat-WPrlqdvZ.js';
3
+ import { C as ChatController } from './chat-BRVgYE68.js';
4
4
 
5
5
  type ComposerEntityData = string | number | boolean | null | ComposerEntityData[] | {
6
6
  [key: string]: ComposerEntityData | undefined;
@@ -1,16 +1,17 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { ToolApproval, ToolQuestion } from '@anvia/client';
4
- import { c as useHumanInput } from '../chat-WPrlqdvZ.js';
5
- export { u as useChatContext } from '../chat-WPrlqdvZ.js';
6
- export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from '../human-input-Bdq46Q56.js';
3
+ import { d as ApprovalInteraction, e as QuestionInteraction } from '../human-input-DOBCZgqw.js';
4
+ export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from '../human-input-DOBCZgqw.js';
5
+ import { c as useHumanInput } from '../chat-BRVgYE68.js';
6
+ export { u as useChatContext } from '../chat-BRVgYE68.js';
7
7
  import { P as PrimitiveProps } from '../render-CRKWam2v.js';
8
+ import '@anvia/client';
8
9
  import '@anvia/react';
9
10
 
10
- type ApprovalChildren = ReactNode | ((approval: ToolApproval) => ReactNode);
11
+ type ApprovalChildren = ReactNode | ((approval: ApprovalInteraction) => ReactNode);
11
12
  type HumanInputFilter = "pending" | "all";
12
13
 
13
- type QuestionChildren = ReactNode | ((question: ToolQuestion) => ReactNode);
14
+ type QuestionChildren = ReactNode | ((question: QuestionInteraction) => ReactNode);
14
15
 
15
16
  declare const HumanInput: {
16
17
  readonly Panel: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HumanInput
3
- } from "../chunk-G3D5YKD2.js";
3
+ } from "../chunk-QHOLI3OZ.js";
4
4
  import "../chunk-CKA4CE26.js";
5
5
  import "../chunk-T3ZFZ3NP.js";
6
6
  import {
@@ -9,7 +9,7 @@ import {
9
9
  useHumanInput,
10
10
  useQuestion,
11
11
  useQuestionPrompt
12
- } from "../chunk-P3JZMVPK.js";
12
+ } from "../chunk-JMGFSYCR.js";
13
13
  export {
14
14
  HumanInput,
15
15
  useApproval,
@@ -0,0 +1,27 @@
1
+ import { ClientInteraction } from '@anvia/client';
2
+ import { A as AgentToolApprovalRequest, d as AgentToolQuestionRequest, e as AgentQuestionAnswer, f as AgentQuestionPrompt } from './chat-BRVgYE68.js';
3
+
4
+ type ApprovalContextValue = {
5
+ approval: ApprovalInteraction;
6
+ reason: string;
7
+ setReason(reason: string): void;
8
+ };
9
+ type QuestionContextValue = {
10
+ question: QuestionInteraction;
11
+ answers: Record<string, AgentQuestionAnswer>;
12
+ setAnswer(prompt: AgentQuestionPrompt, answer: AgentQuestionAnswer): void;
13
+ };
14
+ type QuestionPromptContextValue = {
15
+ prompt: AgentQuestionPrompt;
16
+ };
17
+ type ApprovalInteraction = ClientInteraction & {
18
+ request: AgentToolApprovalRequest;
19
+ };
20
+ type QuestionInteraction = ClientInteraction & {
21
+ request: AgentToolQuestionRequest;
22
+ };
23
+ declare function useApproval(): ApprovalContextValue;
24
+ declare function useQuestion(): QuestionContextValue;
25
+ declare function useQuestionPrompt(): QuestionPromptContextValue;
26
+
27
+ export { type ApprovalContextValue as A, type QuestionContextValue as Q, type QuestionPromptContextValue as a, useQuestion as b, useQuestionPrompt as c, type ApprovalInteraction as d, type QuestionInteraction as e, useApproval as u };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  Image
3
- } from "../chunk-OUWDPMJK.js";
3
+ } from "../chunk-YJNTXNVL.js";
4
4
  import "../chunk-T3ZFZ3NP.js";
5
5
  import {
6
6
  useImage
7
- } from "../chunk-P3JZMVPK.js";
7
+ } from "../chunk-JMGFSYCR.js";
8
8
  export {
9
9
  Image,
10
10
  useImage
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  export { Attachment } from './attachment/index.js';
2
2
  export { A as AttachmentContextValue, u as useAttachment } from './attachment-mbjsroli.js';
3
- export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-WPrlqdvZ.js';
3
+ export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-BRVgYE68.js';
4
4
  export { C as CompletionController, a as CompletionInputContextValue, b as CompletionProvider, c as CompletionProviderProps, u as useCompletionContext, d as useCompletionInput } from './completion-input-DHlwrhxB.js';
5
- export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, c as ComposerEntitiesUpdate, d as ComposerEntity, e as ComposerEntityData, f as ComposerMessageMetadata, g as ComposerQuote, h as ComposerTriggerDefinition, i as ComposerTriggerItem, j as ComposerTriggerItems, k as ComposerTriggerItemsArgs, l as ComposerTriggerState, m as ComposerTriggerStateUpdate, u as useComposer } from './composer-C4IJllVz.js';
6
- export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-Bdq46Q56.js';
5
+ export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, c as ComposerEntitiesUpdate, d as ComposerEntity, e as ComposerEntityData, f as ComposerMessageMetadata, g as ComposerQuote, h as ComposerTriggerDefinition, i as ComposerTriggerItem, j as ComposerTriggerItems, k as ComposerTriggerItemsArgs, l as ComposerTriggerState, m as ComposerTriggerStateUpdate, u as useComposer } from './composer-BTT2vzYF.js';
6
+ export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-DOBCZgqw.js';
7
7
  export { I as ImageContextValue, u as useImage } from './image-VZv6Ddsn.js';
8
8
  export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from './message-CNRnZQwU.js';
9
9
  export { S as SelectionToolbarContextValue, a as SelectionToolbarSelection, u as useSelectionToolbar } from './selection-toolbar-Cwjbuv5S.js';
package/dist/index.js CHANGED
@@ -1,32 +1,32 @@
1
1
  import {
2
2
  SelectionToolbar
3
- } from "./chunk-R5FQUAAE.js";
3
+ } from "./chunk-MF7RWETT.js";
4
4
  import {
5
5
  ThreadList,
6
6
  ThreadListItem
7
- } from "./chunk-YFPDH2JM.js";
7
+ } from "./chunk-JNPCYX4Z.js";
8
8
  import {
9
9
  Composer,
10
10
  Thread
11
- } from "./chunk-3OVUVDNY.js";
11
+ } from "./chunk-XZUF27QY.js";
12
12
  import {
13
13
  Completion
14
- } from "./chunk-OVCNT3OR.js";
14
+ } from "./chunk-URQROKGZ.js";
15
15
  import {
16
16
  HumanInput
17
- } from "./chunk-G3D5YKD2.js";
17
+ } from "./chunk-QHOLI3OZ.js";
18
18
  import {
19
19
  Image
20
- } from "./chunk-OUWDPMJK.js";
20
+ } from "./chunk-YJNTXNVL.js";
21
21
  import {
22
22
  Message
23
- } from "./chunk-PBR53CKI.js";
23
+ } from "./chunk-BZZ7MJNM.js";
24
24
  import {
25
25
  StreamMarkdown
26
26
  } from "./chunk-ULGJLLZE.js";
27
27
  import {
28
28
  Attachment
29
- } from "./chunk-6J6XAQNS.js";
29
+ } from "./chunk-B5JX33SC.js";
30
30
  import "./chunk-CKA4CE26.js";
31
31
  import {
32
32
  renderPrimitive
@@ -51,7 +51,7 @@ import {
51
51
  useThread,
52
52
  useThreadList,
53
53
  useThreadListItem
54
- } from "./chunk-P3JZMVPK.js";
54
+ } from "./chunk-JMGFSYCR.js";
55
55
 
56
56
  // src/context-meter.tsx
57
57
  import { forwardRef } from "react";
@@ -4,8 +4,8 @@ import { UIMessagePart } from '@anvia/client';
4
4
  import { StreamSmoothingLifecycle } from '@anvia/react';
5
5
  import * as react from 'react';
6
6
  import { HTMLAttributes } from 'react';
7
- export { u as useChatContext } from '../chat-WPrlqdvZ.js';
8
- import { d as ComposerEntity } from '../composer-C4IJllVz.js';
7
+ export { u as useChatContext } from '../chat-BRVgYE68.js';
8
+ import { d as ComposerEntity } from '../composer-BTT2vzYF.js';
9
9
  export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from '../message-CNRnZQwU.js';
10
10
  import { P as PrimitiveProps } from '../render-CRKWam2v.js';
11
11
 
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  Message
3
- } from "../chunk-PBR53CKI.js";
3
+ } from "../chunk-BZZ7MJNM.js";
4
4
  import "../chunk-ULGJLLZE.js";
5
- import "../chunk-6J6XAQNS.js";
5
+ import "../chunk-B5JX33SC.js";
6
6
  import "../chunk-CKA4CE26.js";
7
7
  import "../chunk-T3ZFZ3NP.js";
8
8
  import {
9
9
  useChatContext,
10
10
  useMessage,
11
11
  useMessagePart
12
- } from "../chunk-P3JZMVPK.js";
12
+ } from "../chunk-JMGFSYCR.js";
13
13
  export {
14
14
  Message,
15
15
  useChatContext,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  SelectionToolbar
3
- } from "../chunk-R5FQUAAE.js";
3
+ } from "../chunk-MF7RWETT.js";
4
4
  import "../chunk-T3ZFZ3NP.js";
5
5
  import {
6
6
  useSelectionToolbar
7
- } from "../chunk-P3JZMVPK.js";
7
+ } from "../chunk-JMGFSYCR.js";
8
8
  export {
9
9
  SelectionToolbar,
10
10
  useSelectionToolbar
package/dist/shared.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export { A as AttachmentContextValue, u as useAttachment } from './attachment-mbjsroli.js';
2
- export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-WPrlqdvZ.js';
2
+ export { C as ChatController, a as ChatProvider, b as ChatProviderProps, u as useChatContext, c as useHumanInput } from './chat-BRVgYE68.js';
3
3
  export { C as CompletionController, a as CompletionInputContextValue, b as CompletionProvider, c as CompletionProviderProps, u as useCompletionContext, d as useCompletionInput } from './completion-input-DHlwrhxB.js';
4
- export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, c as ComposerEntitiesUpdate, d as ComposerEntity, e as ComposerEntityData, f as ComposerMessageMetadata, g as ComposerQuote, h as ComposerTriggerDefinition, i as ComposerTriggerItem, j as ComposerTriggerItems, k as ComposerTriggerItemsArgs, l as ComposerTriggerState, m as ComposerTriggerStateUpdate, u as useComposer } from './composer-C4IJllVz.js';
5
- export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-Bdq46Q56.js';
4
+ export { C as ComposerAttachmentInput, a as ComposerAttachmentsUpdate, b as ComposerContextValue, c as ComposerEntitiesUpdate, d as ComposerEntity, e as ComposerEntityData, f as ComposerMessageMetadata, g as ComposerQuote, h as ComposerTriggerDefinition, i as ComposerTriggerItem, j as ComposerTriggerItems, k as ComposerTriggerItemsArgs, l as ComposerTriggerState, m as ComposerTriggerStateUpdate, u as useComposer } from './composer-BTT2vzYF.js';
5
+ export { A as ApprovalContextValue, Q as QuestionContextValue, a as QuestionPromptContextValue, u as useApproval, b as useQuestion, c as useQuestionPrompt } from './human-input-DOBCZgqw.js';
6
6
  export { I as ImageContextValue, u as useImage } from './image-VZv6Ddsn.js';
7
7
  export { M as MessageContextValue, a as MessagePartContextValue, u as useMessage, b as useMessagePart } from './message-CNRnZQwU.js';
8
8
  export { S as SelectionToolbarContextValue, a as SelectionToolbarSelection, u as useSelectionToolbar } from './selection-toolbar-Cwjbuv5S.js';
package/dist/shared.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  useThread,
19
19
  useThreadList,
20
20
  useThreadListItem
21
- } from "./chunk-P3JZMVPK.js";
21
+ } from "./chunk-JMGFSYCR.js";
22
22
  export {
23
23
  ChatProvider,
24
24
  CompletionProvider,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  ThreadList,
3
3
  ThreadListItem
4
- } from "../chunk-YFPDH2JM.js";
4
+ } from "../chunk-JNPCYX4Z.js";
5
5
  import "../chunk-T3ZFZ3NP.js";
6
6
  import {
7
7
  ThreadListProvider,
8
8
  useThreadList,
9
9
  useThreadListItem
10
- } from "../chunk-P3JZMVPK.js";
10
+ } from "../chunk-JMGFSYCR.js";
11
11
  export {
12
12
  ThreadList,
13
13
  ThreadListItem,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anvia/react-ui",
3
- "version": "1.0.0-rc.2",
3
+ "version": "1.0.0-rc.3",
4
4
  "description": "Composable React UI primitives for Anvia chat and completion experiences.",
5
5
  "author": "anvia",
6
6
  "maintainer": "Indra Zulfi",
@@ -86,8 +86,8 @@
86
86
  "peerDependencies": {
87
87
  "react": ">=18",
88
88
  "react-dom": ">=18",
89
- "@anvia/client": "1.0.0-rc.2",
90
- "@anvia/react": "1.0.0-rc.2"
89
+ "@anvia/client": "1.0.0-rc.3",
90
+ "@anvia/react": "1.0.0-rc.3"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@testing-library/react": "^16.3.2",
@@ -101,8 +101,8 @@
101
101
  "tsup": "^8.5.0",
102
102
  "typescript": "^5.9.3",
103
103
  "vitest": "^4.0.8",
104
- "@anvia/client": "1.0.0-rc.2",
105
- "@anvia/react": "1.0.0-rc.2"
104
+ "@anvia/react": "1.0.0-rc.3",
105
+ "@anvia/client": "1.0.0-rc.3"
106
106
  },
107
107
  "scripts": {
108
108
  "build": "tsup src/index.ts src/attachment/index.ts src/chat/index.ts src/completion/index.ts src/human-input/index.ts src/image/index.ts src/message/index.ts src/selection-toolbar/index.ts src/shared.ts src/stream/index.ts src/thread-list/index.ts --format esm --dts --sourcemap --clean --external react --external react-dom && cp src/styles.css dist/styles.css && cp src/stream/styles.css dist/stream/styles.css",