@tutti-os/agent-gui 0.0.99 → 0.0.101

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 (95) hide show
  1. package/dist/{AgentGUI-Bkk2TRS0.d.ts → AgentGUI-FECh2x1p.d.ts} +19 -37
  2. package/dist/agent-conversation/index.d.ts +4 -4
  3. package/dist/agent-conversation/index.js +8 -9
  4. package/dist/agent-conversation/index.js.map +1 -1
  5. package/dist/agent-gui.d.ts +5 -4
  6. package/dist/agent-gui.js +19 -19
  7. package/dist/agent-message-center/index.d.ts +4 -6
  8. package/dist/agent-message-center/index.js +13 -52
  9. package/dist/agent-message-center/index.js.map +1 -1
  10. package/dist/agent-title-text.js +1 -1
  11. package/dist/{agentConversationVM-C335TR6S.d.ts → agentConversationVM-BzHZhwFP.d.ts} +1 -1
  12. package/dist/{agentGuiNodeTypes-DAsluxjv.d.ts → agentGuiNodeTypes-BH3lz6gn.d.ts} +21 -5
  13. package/dist/app/renderer/agentactivity.css +142 -72
  14. package/dist/chunk-2RQM7PJN.js +16 -0
  15. package/dist/chunk-2RQM7PJN.js.map +1 -0
  16. package/dist/{chunk-FSKGEGGX.js → chunk-4E3QCW6L.js} +17 -3
  17. package/dist/chunk-4E3QCW6L.js.map +1 -0
  18. package/dist/{chunk-63BE6RGM.js → chunk-4YCCATI4.js} +14 -374
  19. package/dist/chunk-4YCCATI4.js.map +1 -0
  20. package/dist/{chunk-IYEXLOUE.js → chunk-4YVKAPKW.js} +5 -8
  21. package/dist/chunk-4YVKAPKW.js.map +1 -0
  22. package/dist/{chunk-MRRICFWA.js → chunk-D7HMQLBO.js} +159 -55
  23. package/dist/chunk-D7HMQLBO.js.map +1 -0
  24. package/dist/{chunk-OTRZBTFQ.js → chunk-DWUVRWXD.js} +2 -2
  25. package/dist/{chunk-RHTZAODZ.js → chunk-E5AD46HP.js} +2 -2
  26. package/dist/{chunk-3NOJFKDV.js → chunk-EUW6VPIK.js} +414 -49
  27. package/dist/chunk-EUW6VPIK.js.map +1 -0
  28. package/dist/{chunk-Y35GDLP2.js → chunk-F5UR6EJG.js} +2 -17
  29. package/dist/chunk-F5UR6EJG.js.map +1 -0
  30. package/dist/{chunk-J7ZYAUPC.js → chunk-FAE7CXZO.js} +8 -6
  31. package/dist/chunk-FAE7CXZO.js.map +1 -0
  32. package/dist/{chunk-CPUEPDF7.js → chunk-GCW57WYQ.js} +646 -595
  33. package/dist/chunk-GCW57WYQ.js.map +1 -0
  34. package/dist/{chunk-4ROALW3K.js → chunk-KAV2WHTG.js} +82 -61
  35. package/dist/chunk-KAV2WHTG.js.map +1 -0
  36. package/dist/chunk-MIJXEELH.js +96 -0
  37. package/dist/chunk-MIJXEELH.js.map +1 -0
  38. package/dist/{chunk-T6PEJFRP.js → chunk-MJOQP2ED.js} +392 -452
  39. package/dist/chunk-MJOQP2ED.js.map +1 -0
  40. package/dist/{chunk-QWGJ5TEG.js → chunk-QY22OBJS.js} +28 -30
  41. package/dist/chunk-QY22OBJS.js.map +1 -0
  42. package/dist/{chunk-SPZJCTBV.js → chunk-TDVYZEUI.js} +348 -322
  43. package/dist/chunk-TDVYZEUI.js.map +1 -0
  44. package/dist/{chunk-MASXZENX.js → chunk-UESYITH6.js} +21 -2
  45. package/dist/chunk-UESYITH6.js.map +1 -0
  46. package/dist/{chunk-PLCHNOXL.js → chunk-VQOPBBBI.js} +1288 -1141
  47. package/dist/chunk-VQOPBBBI.js.map +1 -0
  48. package/dist/{chunk-7M77BK6K.js → chunk-ZPKPIHMZ.js} +196 -156
  49. package/dist/chunk-ZPKPIHMZ.js.map +1 -0
  50. package/dist/context-mention-palette/index.d.ts +5 -1
  51. package/dist/context-mention-palette/index.js +10 -11
  52. package/dist/contribution-CTVBPN0R.d.ts +119 -0
  53. package/dist/i18n/index.d.ts +16 -2
  54. package/dist/i18n/index.js +2 -2
  55. package/dist/index.d.ts +8 -7
  56. package/dist/index.js +21 -20
  57. package/dist/index.js.map +1 -1
  58. package/dist/mention-search.d.ts +18 -6
  59. package/dist/mention-search.js +8 -9
  60. package/dist/workbench/contribution.d.ts +6 -107
  61. package/dist/workbench/contribution.js +7 -3
  62. package/dist/workbench/index.d.ts +6 -4
  63. package/dist/workbench/index.js +27 -21
  64. package/dist/workbench/launch.d.ts +13 -5
  65. package/dist/workbench/launch.js +1 -1
  66. package/dist/workbench/sessionTitle.d.ts +5 -7
  67. package/dist/workbench/sessionTitle.js +3 -4
  68. package/dist/workbench/state.js +3 -1
  69. package/dist/workspace-agent-generated-files.d.ts +8 -13
  70. package/dist/workspace-agent-generated-files.js +6 -21
  71. package/dist/{workspaceAgentActivityListTypes-C7gPWYiA.d.ts → workspaceAgentActivityListTypes-DZfS_HgG.d.ts} +3 -26
  72. package/package.json +14 -14
  73. package/dist/chunk-3NOJFKDV.js.map +0 -1
  74. package/dist/chunk-4ROALW3K.js.map +0 -1
  75. package/dist/chunk-63BE6RGM.js.map +0 -1
  76. package/dist/chunk-7M77BK6K.js.map +0 -1
  77. package/dist/chunk-CPUEPDF7.js.map +0 -1
  78. package/dist/chunk-FSKGEGGX.js.map +0 -1
  79. package/dist/chunk-GAD6Y3BF.js +0 -88
  80. package/dist/chunk-GAD6Y3BF.js.map +0 -1
  81. package/dist/chunk-GCBDIQDX.js +0 -22
  82. package/dist/chunk-GCBDIQDX.js.map +0 -1
  83. package/dist/chunk-IYEXLOUE.js.map +0 -1
  84. package/dist/chunk-J7ZYAUPC.js.map +0 -1
  85. package/dist/chunk-MASXZENX.js.map +0 -1
  86. package/dist/chunk-MRRICFWA.js.map +0 -1
  87. package/dist/chunk-PLCHNOXL.js.map +0 -1
  88. package/dist/chunk-QWGJ5TEG.js.map +0 -1
  89. package/dist/chunk-SPZJCTBV.js.map +0 -1
  90. package/dist/chunk-T6PEJFRP.js.map +0 -1
  91. package/dist/chunk-Y35GDLP2.js.map +0 -1
  92. package/dist/chunk-Y5M6Q6WX.js +0 -25
  93. package/dist/chunk-Y5M6Q6WX.js.map +0 -1
  94. /package/dist/{chunk-OTRZBTFQ.js.map → chunk-DWUVRWXD.js.map} +0 -0
  95. /package/dist/{chunk-RHTZAODZ.js.map → chunk-E5AD46HP.js.map} +0 -0
@@ -2,26 +2,14 @@ import {
2
2
  AgentGUIConversation_styles_default,
3
3
  MessageSquareMoreIcon,
4
4
  extractAgentMcpToolTarget
5
- } from "./chunk-T6PEJFRP.js";
5
+ } from "./chunk-MJOQP2ED.js";
6
6
  import {
7
7
  getOptionalAgentHostApi,
8
8
  useOptionalAgentHostApi
9
- } from "./chunk-MASXZENX.js";
9
+ } from "./chunk-UESYITH6.js";
10
10
  import {
11
11
  translate
12
- } from "./chunk-RHTZAODZ.js";
13
-
14
- // shared/engine/useEngineSelector.ts
15
- import { useSyncExternalStoreWithSelector } from "use-sync-external-store/with-selector.js";
16
- function useEngineSelector(engine, selector, isEqual) {
17
- return useSyncExternalStoreWithSelector(
18
- engine.subscribe,
19
- engine.getSnapshot,
20
- engine.getSnapshot,
21
- selector,
22
- isEqual
23
- );
24
- }
12
+ } from "./chunk-E5AD46HP.js";
25
13
 
26
14
  // shared/agentConversation/planImplementationPresentation.ts
27
15
  var PLAN_IMPLEMENTATION_PROMPT = "Implement the plan.";
@@ -378,8 +366,7 @@ function numericValue(value) {
378
366
  return typeof value === "number" && Number.isFinite(value) ? value : null;
379
367
  }
380
368
 
381
- // shared/agentConversation/components/AgentInteractivePromptSurface.tsx
382
- import { useMemo as useMemo2, useState as useState2 } from "react";
369
+ // shared/agentConversation/components/AgentAskUserPromptSurface.tsx
383
370
  import { Button } from "@tutti-os/ui-system";
384
371
 
385
372
  // shared/agentConversation/interactiveAnswerPayload.ts
@@ -390,10 +377,6 @@ function buildAskUserAnswerPayload(answersByQuestionId) {
390
377
  return { answers, answersByQuestionId };
391
378
  }
392
379
 
393
- // shared/agentConversation/components/AgentInteractiveDecisionPromptSurfaces.tsx
394
- import { useCallback, useEffect, useMemo, useRef, useState } from "react";
395
- import { ShortcutBadge } from "@tutti-os/ui-system";
396
-
397
380
  // shared/agentConversation/components/interactivePromptPresentation.tsx
398
381
  import {
399
382
  Spinner,
@@ -586,8 +569,298 @@ function interactiveOptionLabel(label, description) {
586
569
  return trimmedDescription ? `${label} ${trimmedDescription}` : label;
587
570
  }
588
571
 
589
- // shared/agentConversation/components/AgentInteractiveDecisionPromptSurfaces.tsx
572
+ // shared/agentConversation/components/useAskUserAnswerFlow.ts
573
+ import { useCallback, useMemo, useState } from "react";
574
+ function readOwnValue(values, key, fallback) {
575
+ return Object.prototype.hasOwnProperty.call(values, key) ? values[key] : fallback;
576
+ }
577
+ function writeOwnValue(values, key, value) {
578
+ Object.defineProperty(values, key, {
579
+ configurable: true,
580
+ enumerable: true,
581
+ value,
582
+ writable: true
583
+ });
584
+ }
585
+ function useAskUserAnswerFlow({
586
+ isSubmitting,
587
+ questions
588
+ }) {
589
+ const [currentIndex, setCurrentIndex] = useState(0);
590
+ const [selectedByQuestionId, setSelectedByQuestionId] = useState({});
591
+ const [freeTextByQuestionId, setFreeTextByQuestionId] = useState({});
592
+ const currentQuestion = questions[currentIndex] ?? null;
593
+ const selectedOptions = currentQuestion ? readOwnValue(selectedByQuestionId, currentQuestion.id, []) : [];
594
+ const freeText = currentQuestion ? readOwnValue(freeTextByQuestionId, currentQuestion.id, "") : "";
595
+ const currentQuestionAnswered = currentQuestion !== null && (selectedOptions.length > 0 || freeText.trim() !== "");
596
+ const isLastQuestion = currentIndex >= questions.length - 1;
597
+ const answerPayload = useMemo(() => {
598
+ const answersByQuestionId = {};
599
+ for (const question of questions) {
600
+ const selected = readOwnValue(selectedByQuestionId, question.id, []);
601
+ const customAnswer = readOwnValue(
602
+ freeTextByQuestionId,
603
+ question.id,
604
+ ""
605
+ ).trim();
606
+ if (question.multiSelect) {
607
+ const answers = customAnswer ? [...selected, customAnswer] : selected;
608
+ if (answers.length > 0) {
609
+ writeOwnValue(answersByQuestionId, question.id, answers);
610
+ }
611
+ continue;
612
+ }
613
+ const answer = customAnswer || selected[0];
614
+ if (answer) {
615
+ writeOwnValue(answersByQuestionId, question.id, answer);
616
+ }
617
+ }
618
+ return buildAskUserAnswerPayload(answersByQuestionId);
619
+ }, [freeTextByQuestionId, questions, selectedByQuestionId]);
620
+ const allQuestionsAnswered = questions.length > 0 && questions.every(
621
+ (question) => Object.prototype.hasOwnProperty.call(
622
+ answerPayload.answersByQuestionId,
623
+ question.id
624
+ )
625
+ );
626
+ const toggleOption = useCallback(
627
+ (optionLabel) => {
628
+ if (isSubmitting || !currentQuestion) return;
629
+ setSelectedByQuestionId((current) => {
630
+ const existing = readOwnValue(current, currentQuestion.id, []);
631
+ const next = currentQuestion.multiSelect ? existing.includes(optionLabel) ? existing.filter((value) => value !== optionLabel) : [...existing, optionLabel] : existing.includes(optionLabel) ? [] : [optionLabel];
632
+ const updated = { ...current };
633
+ writeOwnValue(updated, currentQuestion.id, next);
634
+ return updated;
635
+ });
636
+ },
637
+ [currentQuestion, isSubmitting]
638
+ );
639
+ const setFreeText = useCallback(
640
+ (value) => {
641
+ if (isSubmitting || !currentQuestion) return;
642
+ setFreeTextByQuestionId((current) => {
643
+ const updated = { ...current };
644
+ writeOwnValue(updated, currentQuestion.id, value);
645
+ return updated;
646
+ });
647
+ },
648
+ [currentQuestion, isSubmitting]
649
+ );
650
+ const goToPreviousQuestion = useCallback(() => {
651
+ if (isSubmitting) return;
652
+ setCurrentIndex((current) => Math.max(current - 1, 0));
653
+ }, [isSubmitting]);
654
+ const goToNextQuestion = useCallback(() => {
655
+ if (isSubmitting || !currentQuestionAnswered) return;
656
+ setCurrentIndex((current) => Math.min(current + 1, questions.length - 1));
657
+ }, [currentQuestionAnswered, isSubmitting, questions.length]);
658
+ return {
659
+ allQuestionsAnswered,
660
+ answerPayload,
661
+ currentIndex,
662
+ currentQuestion,
663
+ currentQuestionAnswered,
664
+ freeText,
665
+ isLastQuestion,
666
+ selectedOptions,
667
+ goToNextQuestion,
668
+ goToPreviousQuestion,
669
+ setFreeText,
670
+ toggleOption
671
+ };
672
+ }
673
+
674
+ // shared/agentConversation/components/AgentAskUserPromptSurface.tsx
590
675
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
676
+ function AgentAskUserPromptSurface({
677
+ prompt,
678
+ variant,
679
+ ...props
680
+ }) {
681
+ "use memo";
682
+ const question = prompt.questions[0] ?? null;
683
+ const useCompactQuickAnswer = variant === "compact" && prompt.questions.length === 1 && question !== null && !question.multiSelect && question.options.length > 0;
684
+ if (useCompactQuickAnswer) {
685
+ return /* @__PURE__ */ jsx2(
686
+ CompactQuickAnswerSurface,
687
+ {
688
+ ...props,
689
+ prompt,
690
+ question
691
+ }
692
+ );
693
+ }
694
+ return /* @__PURE__ */ jsx2(
695
+ AskUserAnswerFlowSurface,
696
+ {
697
+ ...props,
698
+ prompt
699
+ },
700
+ prompt.requestId
701
+ );
702
+ }
703
+ function CompactQuickAnswerSurface({
704
+ prompt,
705
+ question,
706
+ embedded = false,
707
+ edgeGlow = false,
708
+ isSubmitting,
709
+ onSubmit
710
+ }) {
711
+ return /* @__PURE__ */ jsx2("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsxs2("div", { className: interactivePromptCardClassName(edgeGlow), children: [
712
+ /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptHeader, children: /* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(question.header) }) }),
713
+ /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptQuestion, children: question.question }),
714
+ /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: question.options.map((option) => /* @__PURE__ */ jsxs2(
715
+ "button",
716
+ {
717
+ type: "button",
718
+ className: AgentGUIConversation_styles_default.interactiveOptionButton,
719
+ "aria-label": interactiveOptionLabel(
720
+ option.label,
721
+ option.description
722
+ ),
723
+ disabled: isSubmitting,
724
+ onClick: () => onSubmit({
725
+ requestId: prompt.requestId,
726
+ action: "submit",
727
+ payload: {
728
+ ...buildAskUserAnswerPayload({
729
+ [question.id]: option.label
730
+ })
731
+ }
732
+ }),
733
+ children: [
734
+ /* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: option.label }),
735
+ option.description ? /* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: option.description }) : null
736
+ ]
737
+ },
738
+ option.label
739
+ )) })
740
+ ] }) });
741
+ }
742
+ function AskUserAnswerFlowSurface({
743
+ prompt,
744
+ embedded = false,
745
+ edgeGlow = false,
746
+ isSubmitting,
747
+ onSubmit,
748
+ labels
749
+ }) {
750
+ "use memo";
751
+ const flow = useAskUserAnswerFlow({
752
+ isSubmitting,
753
+ questions: prompt.questions
754
+ });
755
+ const question = flow.currentQuestion;
756
+ if (!question) {
757
+ return /* @__PURE__ */ jsx2("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsx2("div", { className: interactivePromptCardClassName(edgeGlow), children: /* @__PURE__ */ jsxs2(
758
+ "div",
759
+ {
760
+ className: `${AgentGUIConversation_styles_default.interactivePromptLead} inline-flex items-center gap-1.5`,
761
+ children: [
762
+ /* @__PURE__ */ jsx2(
763
+ MessageSquareMoreIcon,
764
+ {
765
+ size: 15,
766
+ active: true,
767
+ "aria-hidden": "true",
768
+ className: "shrink-0"
769
+ }
770
+ ),
771
+ stripPromptTitlePunctuation(labels.waitingForAnswer)
772
+ ]
773
+ }
774
+ ) }) });
775
+ }
776
+ return /* @__PURE__ */ jsx2("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsxs2("div", { className: interactivePromptCardClassName(edgeGlow), children: [
777
+ /* @__PURE__ */ jsxs2("div", { className: AgentGUIConversation_styles_default.interactivePromptHeader, children: [
778
+ /* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(question.header) }),
779
+ /* @__PURE__ */ jsxs2("span", { className: AgentGUIConversation_styles_default.interactivePromptMeta, children: [
780
+ flow.currentIndex + 1,
781
+ "/",
782
+ prompt.questions.length
783
+ ] })
784
+ ] }),
785
+ /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptQuestion, children: question.question }),
786
+ question.options.length > 0 ? /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: question.options.map((option) => {
787
+ const active = flow.selectedOptions.includes(option.label);
788
+ return /* @__PURE__ */ jsxs2(
789
+ "button",
790
+ {
791
+ type: "button",
792
+ className: AgentGUIConversation_styles_default.interactiveOptionButton,
793
+ "data-active": active,
794
+ "aria-pressed": active,
795
+ "aria-label": interactiveOptionLabel(
796
+ option.label,
797
+ option.description
798
+ ),
799
+ disabled: isSubmitting,
800
+ onClick: () => flow.toggleOption(option.label),
801
+ children: [
802
+ /* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: option.label }),
803
+ option.description ? /* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: option.description }) : null
804
+ ]
805
+ },
806
+ option.label
807
+ );
808
+ }) }) : null,
809
+ /* @__PURE__ */ jsx2(
810
+ "textarea",
811
+ {
812
+ value: flow.freeText,
813
+ placeholder: labels.answerPlaceholder,
814
+ disabled: isSubmitting,
815
+ className: AgentGUIConversation_styles_default.interactivePromptTextarea,
816
+ onChange: (event) => flow.setFreeText(event.currentTarget.value)
817
+ }
818
+ ),
819
+ /* @__PURE__ */ jsxs2("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: [
820
+ prompt.questions.length > 1 ? /* @__PURE__ */ jsx2(
821
+ Button,
822
+ {
823
+ type: "button",
824
+ variant: "secondary",
825
+ size: "sm",
826
+ disabled: isSubmitting || flow.currentIndex === 0,
827
+ onClick: flow.goToPreviousQuestion,
828
+ children: labels.previousQuestion
829
+ }
830
+ ) : null,
831
+ flow.isLastQuestion ? /* @__PURE__ */ jsx2(
832
+ Button,
833
+ {
834
+ type: "button",
835
+ variant: "default",
836
+ size: "sm",
837
+ disabled: isSubmitting || !flow.allQuestionsAnswered,
838
+ onClick: () => onSubmit({
839
+ requestId: prompt.requestId,
840
+ action: "submit",
841
+ payload: { ...flow.answerPayload }
842
+ }),
843
+ children: labels.submitAnswers
844
+ }
845
+ ) : /* @__PURE__ */ jsx2(
846
+ Button,
847
+ {
848
+ type: "button",
849
+ variant: "default",
850
+ size: "sm",
851
+ disabled: isSubmitting || !flow.currentQuestionAnswered,
852
+ onClick: flow.goToNextQuestion,
853
+ children: labels.nextQuestion
854
+ }
855
+ )
856
+ ] })
857
+ ] }) });
858
+ }
859
+
860
+ // shared/agentConversation/components/AgentInteractiveDecisionPromptSurfaces.tsx
861
+ import { useCallback as useCallback2, useEffect, useMemo as useMemo2, useRef, useState as useState2 } from "react";
862
+ import { ShortcutBadge } from "@tutti-os/ui-system";
863
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
591
864
  function ApprovalPromptSurface({
592
865
  prompt,
593
866
  embedded = false,
@@ -599,19 +872,19 @@ function ApprovalPromptSurface({
599
872
  labels
600
873
  }) {
601
874
  "use memo";
602
- const promptDetails = useMemo(
875
+ const promptDetails = useMemo2(
603
876
  () => formatToolDetails(prompt.input ?? null),
604
877
  [prompt.input]
605
878
  );
606
- const [submittingOptionId, setSubmittingOptionId] = useState(
879
+ const [submittingOptionId, setSubmittingOptionId] = useState2(
607
880
  null
608
881
  );
609
- const [pendingFeedbackOptionId, setPendingFeedbackOptionId] = useState(null);
610
- const [feedback, setFeedback] = useState("");
882
+ const [pendingFeedbackOptionId, setPendingFeedbackOptionId] = useState2(null);
883
+ const [feedback, setFeedback] = useState2("");
611
884
  const feedbackTextareaRef = useRef(null);
612
885
  const agentHostApi = useOptionalAgentHostApi() ?? getOptionalAgentHostApi();
613
886
  const isDarwin = isDarwinPlatform(agentHostApi?.meta?.platform);
614
- const feedbackOptionId = useMemo(
887
+ const feedbackOptionId = useMemo2(
615
888
  () => approvalFeedbackOptionId(prompt.options),
616
889
  [prompt.options]
617
890
  );
@@ -631,7 +904,7 @@ function ApprovalPromptSurface({
631
904
  feedbackTextareaRef.current?.focus();
632
905
  }
633
906
  }, [pendingFeedbackOptionId]);
634
- const submitOption = useCallback(
907
+ const submitOption = useCallback2(
635
908
  (optionId) => {
636
909
  const feedbackOption = feedbackOptionId === optionId;
637
910
  if (feedbackOption && pendingFeedbackOptionId !== optionId) {
@@ -681,21 +954,21 @@ function ApprovalPromptSurface({
681
954
  submitOption,
682
955
  submittingOptionId
683
956
  ]);
684
- return /* @__PURE__ */ jsx2("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsxs2("div", { className: interactivePromptCardClassName(edgeGlow), children: [
685
- /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(labels.approvalLead) }),
686
- promptDetails.length > 0 ? /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: promptDetails.map((detail) => /* @__PURE__ */ jsxs2(
957
+ return /* @__PURE__ */ jsx3("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsxs3("div", { className: interactivePromptCardClassName(edgeGlow), children: [
958
+ /* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(labels.approvalLead) }),
959
+ promptDetails.length > 0 ? /* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: promptDetails.map((detail) => /* @__PURE__ */ jsxs3(
687
960
  "div",
688
961
  {
689
962
  className: AgentGUIConversation_styles_default.interactiveOptionDisplay,
690
963
  children: [
691
- /* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: detail.label }),
692
- /* @__PURE__ */ jsx2(PromptDetailValue, { detail, previewMode }),
693
- detail.meta ? /* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: detail.meta }) : null
964
+ /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: detail.label }),
965
+ /* @__PURE__ */ jsx3(PromptDetailValue, { detail, previewMode }),
966
+ detail.meta ? /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: detail.meta }) : null
694
967
  ]
695
968
  },
696
969
  `${detail.label}:${detail.value}`
697
970
  )) }) : null,
698
- /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: prompt.options.map((option, optionIndex) => {
971
+ /* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: prompt.options.map((option, optionIndex) => {
699
972
  const showSpinner = submittingOptionId === option.id;
700
973
  const optionSupportsFeedback = feedbackOptionId === option.id;
701
974
  const optionLabel = approvalOptionDisplayLabel(option, {
@@ -711,12 +984,12 @@ function ApprovalPromptSurface({
711
984
  );
712
985
  const showFeedbackComposer = pendingFeedbackOptionId === option.id;
713
986
  if (showFeedbackComposer) {
714
- return /* @__PURE__ */ jsxs2(
987
+ return /* @__PURE__ */ jsxs3(
715
988
  "div",
716
989
  {
717
990
  className: AgentGUIConversation_styles_default.interactiveFeedbackComposer,
718
991
  children: [
719
- /* @__PURE__ */ jsx2(
992
+ /* @__PURE__ */ jsx3(
720
993
  "textarea",
721
994
  {
722
995
  ref: feedbackTextareaRef,
@@ -742,7 +1015,7 @@ function ApprovalPromptSurface({
742
1015
  }
743
1016
  }
744
1017
  ),
745
- /* @__PURE__ */ jsx2(
1018
+ /* @__PURE__ */ jsx3(
746
1019
  "button",
747
1020
  {
748
1021
  type: "button",
@@ -758,7 +1031,7 @@ function ApprovalPromptSurface({
758
1031
  }
759
1032
  submitOption(option.id);
760
1033
  },
761
- children: showSpinner ? /* @__PURE__ */ jsx2(InteractiveOptionSpinner, {}) : /* @__PURE__ */ jsx2(SendFilledIcon, {})
1034
+ children: showSpinner ? /* @__PURE__ */ jsx3(InteractiveOptionSpinner, {}) : /* @__PURE__ */ jsx3(SendFilledIcon, {})
762
1035
  }
763
1036
  )
764
1037
  ]
@@ -766,7 +1039,7 @@ function ApprovalPromptSurface({
766
1039
  option.id
767
1040
  );
768
1041
  }
769
- return /* @__PURE__ */ jsxs2(
1042
+ return /* @__PURE__ */ jsxs3(
770
1043
  "button",
771
1044
  {
772
1045
  type: "button",
@@ -778,8 +1051,8 @@ function ApprovalPromptSurface({
778
1051
  disabled: isSubmitting || submittingOptionId !== null,
779
1052
  onClick: () => submitOption(option.id),
780
1053
  children: [
781
- /* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: optionPresentation.label }),
782
- optionPresentation.commandPrefix ? /* @__PURE__ */ jsx2(
1054
+ /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: optionPresentation.label }),
1055
+ optionPresentation.commandPrefix ? /* @__PURE__ */ jsx3(
783
1056
  CommandTextWithTooltip,
784
1057
  {
785
1058
  value: optionPresentation.commandPrefix,
@@ -787,8 +1060,8 @@ function ApprovalPromptSurface({
787
1060
  tooltipsEnabled: !previewMode
788
1061
  }
789
1062
  ) : null,
790
- option.description ? /* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: option.description }) : null,
791
- keyboardShortcuts && shortcutLabel && !showSpinner ? /* @__PURE__ */ jsx2(
1063
+ option.description ? /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: option.description }) : null,
1064
+ keyboardShortcuts && shortcutLabel && !showSpinner ? /* @__PURE__ */ jsx3(
792
1065
  ShortcutBadge,
793
1066
  {
794
1067
  className: AgentGUIConversation_styles_default.interactiveOptionShortcut,
@@ -796,7 +1069,7 @@ function ApprovalPromptSurface({
796
1069
  children: shortcutLabel
797
1070
  }
798
1071
  ) : null,
799
- showSpinner ? /* @__PURE__ */ jsx2(InteractiveOptionSpinner, {}) : null
1072
+ showSpinner ? /* @__PURE__ */ jsx3(InteractiveOptionSpinner, {}) : null
800
1073
  ]
801
1074
  },
802
1075
  option.id
@@ -814,9 +1087,9 @@ function ExitPlanPromptSurface({
814
1087
  labels
815
1088
  }) {
816
1089
  "use memo";
817
- const [feedback, setFeedback] = useState("");
1090
+ const [feedback, setFeedback] = useState2("");
818
1091
  const showFeedbackFooter = variant !== "compact";
819
- const [submittingOptionId, setSubmittingOptionId] = useState(
1092
+ const [submittingOptionId, setSubmittingOptionId] = useState2(
820
1093
  null
821
1094
  );
822
1095
  const trimmed = feedback.trim();
@@ -837,11 +1110,11 @@ function ExitPlanPromptSurface({
837
1110
  setSubmittingOptionId(null);
838
1111
  }
839
1112
  }, [isSubmitting]);
840
- return /* @__PURE__ */ jsx2("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsxs2("div", { className: interactivePromptCardClassName(edgeGlow), children: [
841
- /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(labels.planLead) }),
842
- /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: modes.map((mode) => {
1113
+ return /* @__PURE__ */ jsx3("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsxs3("div", { className: interactivePromptCardClassName(edgeGlow), children: [
1114
+ /* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(labels.planLead) }),
1115
+ /* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: modes.map((mode) => {
843
1116
  const showSpinner = submittingOptionId === mode.id;
844
- return /* @__PURE__ */ jsxs2(
1117
+ return /* @__PURE__ */ jsxs3(
845
1118
  "button",
846
1119
  {
847
1120
  type: "button",
@@ -860,16 +1133,16 @@ function ExitPlanPromptSurface({
860
1133
  });
861
1134
  },
862
1135
  children: [
863
- /* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: mode.label }),
864
- /* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: mode.description }),
865
- showSpinner ? /* @__PURE__ */ jsx2(InteractiveOptionSpinner, {}) : null
1136
+ /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: mode.label }),
1137
+ /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: mode.description }),
1138
+ showSpinner ? /* @__PURE__ */ jsx3(InteractiveOptionSpinner, {}) : null
866
1139
  ]
867
1140
  },
868
1141
  mode.id
869
1142
  );
870
1143
  }) }),
871
- showFeedbackFooter ? /* @__PURE__ */ jsxs2("div", { className: AgentGUIConversation_styles_default.interactivePromptFooter, children: [
872
- /* @__PURE__ */ jsx2(
1144
+ showFeedbackFooter ? /* @__PURE__ */ jsxs3("div", { className: AgentGUIConversation_styles_default.interactivePromptFooter, children: [
1145
+ /* @__PURE__ */ jsx3(
873
1146
  "textarea",
874
1147
  {
875
1148
  value: feedback,
@@ -879,7 +1152,7 @@ function ExitPlanPromptSurface({
879
1152
  onChange: (event) => setFeedback(event.currentTarget.value)
880
1153
  }
881
1154
  ),
882
- /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: /* @__PURE__ */ jsx2(
1155
+ /* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: /* @__PURE__ */ jsx3(
883
1156
  "button",
884
1157
  {
885
1158
  type: "button",
@@ -901,7 +1174,7 @@ function ExitPlanPromptSurface({
901
1174
  // Compact (deck): no textarea, but keep declining reachable — the deck
902
1175
  // must still let the user keep planning (refining/feedback is deferred
903
1176
  // to the conversation via the card's "open conversation" jump).
904
- /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: /* @__PURE__ */ jsx2(
1177
+ /* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: /* @__PURE__ */ jsx3(
905
1178
  "button",
906
1179
  {
907
1180
  type: "button",
@@ -927,13 +1200,13 @@ function PlanImplementationSurface({
927
1200
  labels
928
1201
  }) {
929
1202
  "use memo";
930
- const [feedback, setFeedback] = useState("");
1203
+ const [feedback, setFeedback] = useState2("");
931
1204
  const trimmed = feedback.trim();
932
1205
  const continueLabel = trimmed === "" ? labels.planImplementationSkip : labels.planImplementationSend;
933
1206
  const showFeedbackFooter = variant !== "compact";
934
- return /* @__PURE__ */ jsx2("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsxs2("div", { className: interactivePromptCardClassName(edgeGlow), children: [
935
- /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(labels.planImplementationLead) }),
936
- /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: /* @__PURE__ */ jsx2(
1207
+ return /* @__PURE__ */ jsx3("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsxs3("div", { className: interactivePromptCardClassName(edgeGlow), children: [
1208
+ /* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(labels.planImplementationLead) }),
1209
+ /* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: /* @__PURE__ */ jsx3(
937
1210
  "button",
938
1211
  {
939
1212
  type: "button",
@@ -944,11 +1217,11 @@ function PlanImplementationSurface({
944
1217
  requestId: prompt.requestId,
945
1218
  action: PLAN_IMPLEMENTATION_ACTION_IMPLEMENT
946
1219
  }),
947
- children: /* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: labels.planImplementationConfirm })
1220
+ children: /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: labels.planImplementationConfirm })
948
1221
  }
949
1222
  ) }),
950
- showFeedbackFooter ? /* @__PURE__ */ jsxs2("div", { className: AgentGUIConversation_styles_default.interactivePromptFooter, children: [
951
- /* @__PURE__ */ jsx2(
1223
+ showFeedbackFooter ? /* @__PURE__ */ jsxs3("div", { className: AgentGUIConversation_styles_default.interactivePromptFooter, children: [
1224
+ /* @__PURE__ */ jsx3(
952
1225
  "textarea",
953
1226
  {
954
1227
  value: feedback,
@@ -959,7 +1232,7 @@ function PlanImplementationSurface({
959
1232
  onChange: (event) => setFeedback(event.currentTarget.value)
960
1233
  }
961
1234
  ),
962
- /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: /* @__PURE__ */ jsx2(
1235
+ /* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: /* @__PURE__ */ jsx3(
963
1236
  "button",
964
1237
  {
965
1238
  type: "button",
@@ -978,7 +1251,7 @@ function PlanImplementationSurface({
978
1251
  }
979
1252
 
980
1253
  // shared/agentConversation/components/AgentInteractivePromptSurface.tsx
981
- import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
1254
+ import { jsx as jsx4 } from "react/jsx-runtime";
982
1255
  function AgentInteractivePromptSurface({
983
1256
  prompt,
984
1257
  variant = "full",
@@ -992,7 +1265,7 @@ function AgentInteractivePromptSurface({
992
1265
  }) {
993
1266
  "use memo";
994
1267
  if (prompt.kind === "approval") {
995
- return /* @__PURE__ */ jsx3(
1268
+ return /* @__PURE__ */ jsx4(
996
1269
  ApprovalPromptSurface,
997
1270
  {
998
1271
  prompt,
@@ -1007,7 +1280,7 @@ function AgentInteractivePromptSurface({
1007
1280
  );
1008
1281
  }
1009
1282
  if (prompt.kind === "exit-plan") {
1010
- return /* @__PURE__ */ jsx3(
1283
+ return /* @__PURE__ */ jsx4(
1011
1284
  ExitPlanPromptSurface,
1012
1285
  {
1013
1286
  prompt,
@@ -1022,7 +1295,7 @@ function AgentInteractivePromptSurface({
1022
1295
  );
1023
1296
  }
1024
1297
  if (prompt.kind === "plan-implementation") {
1025
- return /* @__PURE__ */ jsx3(
1298
+ return /* @__PURE__ */ jsx4(
1026
1299
  PlanImplementationSurface,
1027
1300
  {
1028
1301
  prompt,
@@ -1036,269 +1309,22 @@ function AgentInteractivePromptSurface({
1036
1309
  }
1037
1310
  );
1038
1311
  }
1039
- return /* @__PURE__ */ jsx3(
1040
- AskUserPromptSurface,
1312
+ return /* @__PURE__ */ jsx4(
1313
+ AgentAskUserPromptSurface,
1041
1314
  {
1042
1315
  prompt,
1043
1316
  variant,
1044
1317
  embedded,
1045
1318
  edgeGlow,
1046
- previewMode,
1047
- isSubmitting,
1048
- onSubmit,
1049
- labels
1050
- }
1051
- );
1052
- }
1053
- function CompactAskUserPromptSurface({
1054
- prompt,
1055
- embedded = false,
1056
- edgeGlow = false,
1057
- isSubmitting,
1058
- onSubmit
1059
- }) {
1060
- "use memo";
1061
- const question = prompt.questions[0] ?? null;
1062
- const oneClickable = prompt.questions.length === 1 && question !== null && !question.multiSelect && question.options.length > 0;
1063
- return /* @__PURE__ */ jsx3("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsx3("div", { className: interactivePromptCardClassName(edgeGlow), children: question ? /* @__PURE__ */ jsxs3(Fragment, { children: [
1064
- /* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptHeader, children: /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(question.header) }) }),
1065
- /* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptQuestion, children: question.question }),
1066
- oneClickable ? /* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: question.options.map((option) => /* @__PURE__ */ jsxs3(
1067
- "button",
1068
- {
1069
- type: "button",
1070
- className: AgentGUIConversation_styles_default.interactiveOptionButton,
1071
- "aria-label": interactiveOptionLabel(
1072
- option.label,
1073
- option.description
1074
- ),
1075
- disabled: isSubmitting,
1076
- onClick: () => onSubmit({
1077
- requestId: prompt.requestId,
1078
- action: "submit",
1079
- payload: {
1080
- ...buildAskUserAnswerPayload({
1081
- [question.id]: option.label
1082
- })
1083
- }
1084
- }),
1085
- children: [
1086
- /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: option.label }),
1087
- option.description ? /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: option.description }) : null
1088
- ]
1089
- },
1090
- option.label
1091
- )) }) : question.options.length > 0 ? (
1092
- // Multi-select / multi-question prompts can't be answered with a
1093
- // single click here, so the options are shown as read-only
1094
- // context instead of being silently omitted. Answering still
1095
- // happens in the full conversation via the card's "open
1096
- // conversation" jump.
1097
- /* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: question.options.map((option) => /* @__PURE__ */ jsxs3(
1098
- "div",
1099
- {
1100
- className: AgentGUIConversation_styles_default.interactiveOptionDisplay,
1101
- children: [
1102
- /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: option.label }),
1103
- option.description ? /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: option.description }) : null
1104
- ]
1105
- },
1106
- option.label
1107
- )) })
1108
- ) : null
1109
- ] }) : null }) });
1110
- }
1111
- function AskUserPromptSurface({
1112
- prompt,
1113
- variant = "full",
1114
- embedded = false,
1115
- edgeGlow = false,
1116
- isSubmitting,
1117
- onSubmit,
1118
- labels
1119
- }) {
1120
- "use memo";
1121
- if (variant === "compact") {
1122
- return /* @__PURE__ */ jsx3(
1123
- CompactAskUserPromptSurface,
1124
- {
1125
- prompt,
1126
- embedded,
1127
- edgeGlow,
1128
- isSubmitting,
1129
- onSubmit,
1130
- labels
1131
- }
1132
- );
1133
- }
1134
- return /* @__PURE__ */ jsx3(
1135
- FullAskUserPromptSurface,
1136
- {
1137
- prompt,
1138
- embedded,
1139
- edgeGlow,
1140
1319
  isSubmitting,
1141
1320
  onSubmit,
1142
1321
  labels
1143
- }
1322
+ },
1323
+ prompt.requestId
1144
1324
  );
1145
1325
  }
1146
- function FullAskUserPromptSurface({
1147
- prompt,
1148
- embedded = false,
1149
- edgeGlow = false,
1150
- isSubmitting,
1151
- onSubmit,
1152
- labels
1153
- }) {
1154
- "use memo";
1155
- const [index, setIndex] = useState2(0);
1156
- const [selectedByQuestionId, setSelectedByQuestionId] = useState2({});
1157
- const [freeTextByQuestionId, setFreeTextByQuestionId] = useState2({});
1158
- const question = prompt.questions[index] ?? null;
1159
- const selected = question ? selectedByQuestionId[question.id] ?? [] : [];
1160
- const freeText = question ? freeTextByQuestionId[question.id] ?? "" : "";
1161
- const canAdvance = question !== null && (selected.length > 0 || freeText.trim() !== "" || question.options.length === 0);
1162
- const isLast = index >= prompt.questions.length - 1;
1163
- const payload = useMemo2(() => {
1164
- const answersByQuestionId = {};
1165
- for (const current of prompt.questions) {
1166
- const chosen = selectedByQuestionId[current.id] ?? [];
1167
- const other = (freeTextByQuestionId[current.id] ?? "").trim();
1168
- if (current.multiSelect) {
1169
- const value2 = other ? [...chosen, other] : chosen;
1170
- if (value2.length > 0) {
1171
- answersByQuestionId[current.id] = value2;
1172
- }
1173
- continue;
1174
- }
1175
- const value = other || chosen[0];
1176
- if (value) {
1177
- answersByQuestionId[current.id] = value;
1178
- }
1179
- }
1180
- return buildAskUserAnswerPayload(answersByQuestionId);
1181
- }, [freeTextByQuestionId, prompt.questions, selectedByQuestionId]);
1182
- if (!question) {
1183
- return /* @__PURE__ */ jsx3("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsx3("div", { className: interactivePromptCardClassName(edgeGlow), children: /* @__PURE__ */ jsxs3(
1184
- "div",
1185
- {
1186
- className: `${AgentGUIConversation_styles_default.interactivePromptLead} inline-flex items-center gap-1.5`,
1187
- children: [
1188
- /* @__PURE__ */ jsx3(
1189
- MessageSquareMoreIcon,
1190
- {
1191
- size: 15,
1192
- active: true,
1193
- "aria-hidden": "true",
1194
- className: "shrink-0"
1195
- }
1196
- ),
1197
- stripPromptTitlePunctuation(labels.waitingForAnswer)
1198
- ]
1199
- }
1200
- ) }) });
1201
- }
1202
- return /* @__PURE__ */ jsx3("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsxs3("div", { className: interactivePromptCardClassName(edgeGlow), children: [
1203
- /* @__PURE__ */ jsxs3("div", { className: AgentGUIConversation_styles_default.interactivePromptHeader, children: [
1204
- /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(question.header) }),
1205
- /* @__PURE__ */ jsxs3("span", { className: AgentGUIConversation_styles_default.interactivePromptMeta, children: [
1206
- index + 1,
1207
- "/",
1208
- prompt.questions.length
1209
- ] })
1210
- ] }),
1211
- /* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptQuestion, children: question.question }),
1212
- question.options.length > 0 ? /* @__PURE__ */ jsx3("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: question.options.map((option) => {
1213
- const active = selected.includes(option.label);
1214
- return /* @__PURE__ */ jsxs3(
1215
- "button",
1216
- {
1217
- type: "button",
1218
- className: AgentGUIConversation_styles_default.interactiveOptionButton,
1219
- "data-active": active,
1220
- "aria-pressed": active,
1221
- "aria-label": interactiveOptionLabel(
1222
- option.label,
1223
- option.description
1224
- ),
1225
- disabled: isSubmitting,
1226
- onClick: () => {
1227
- setSelectedByQuestionId((current) => {
1228
- const existing = current[question.id] ?? [];
1229
- const next = question.multiSelect ? existing.includes(option.label) ? existing.filter((value) => value !== option.label) : [...existing, option.label] : existing.includes(option.label) ? [] : [option.label];
1230
- return { ...current, [question.id]: next };
1231
- });
1232
- },
1233
- children: [
1234
- /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: option.label }),
1235
- /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: option.description })
1236
- ]
1237
- },
1238
- option.label
1239
- );
1240
- }) }) : null,
1241
- /* @__PURE__ */ jsx3(
1242
- "textarea",
1243
- {
1244
- value: freeText,
1245
- placeholder: labels.answerPlaceholder,
1246
- disabled: isSubmitting,
1247
- className: AgentGUIConversation_styles_default.interactivePromptTextarea,
1248
- onChange: (event) => {
1249
- const value = event.currentTarget.value;
1250
- setFreeTextByQuestionId((current) => ({
1251
- ...current,
1252
- [question.id]: value
1253
- }));
1254
- }
1255
- }
1256
- ),
1257
- /* @__PURE__ */ jsxs3("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: [
1258
- prompt.questions.length > 1 ? /* @__PURE__ */ jsx3(
1259
- Button,
1260
- {
1261
- type: "button",
1262
- variant: "secondary",
1263
- size: "sm",
1264
- disabled: isSubmitting || index === 0,
1265
- onClick: () => setIndex((current) => Math.max(current - 1, 0)),
1266
- children: labels.previousQuestion
1267
- }
1268
- ) : null,
1269
- isLast ? /* @__PURE__ */ jsx3(
1270
- Button,
1271
- {
1272
- type: "button",
1273
- variant: "default",
1274
- size: "sm",
1275
- disabled: isSubmitting || Object.keys(payload.answersByQuestionId).length === 0,
1276
- onClick: () => onSubmit({
1277
- requestId: prompt.requestId,
1278
- action: "submit",
1279
- payload: { ...payload }
1280
- }),
1281
- children: labels.submitAnswers
1282
- }
1283
- ) : /* @__PURE__ */ jsx3(
1284
- Button,
1285
- {
1286
- type: "button",
1287
- variant: "default",
1288
- size: "sm",
1289
- disabled: isSubmitting || !canAdvance,
1290
- onClick: () => setIndex(
1291
- (current) => Math.min(current + 1, prompt.questions.length - 1)
1292
- ),
1293
- children: labels.nextQuestion
1294
- }
1295
- )
1296
- ] })
1297
- ] }) });
1298
- }
1299
1326
 
1300
1327
  export {
1301
- useEngineSelector,
1302
1328
  PLAN_IMPLEMENTATION_PROMPT,
1303
1329
  PLAN_IMPLEMENTATION_ACTION_IMPLEMENT,
1304
1330
  PLAN_IMPLEMENTATION_ACTION_FEEDBACK,
@@ -1312,4 +1338,4 @@ export {
1312
1338
  isPromptRequestIdTitle,
1313
1339
  AgentInteractivePromptSurface
1314
1340
  };
1315
- //# sourceMappingURL=chunk-SPZJCTBV.js.map
1341
+ //# sourceMappingURL=chunk-TDVYZEUI.js.map