@tutti-os/agent-gui 0.0.94 → 0.0.96

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 (163) hide show
  1. package/README.md +86 -38
  2. package/dist/AgentGUI-DWdvUV4x.d.ts +1038 -0
  3. package/dist/agent-conversation/index.d.ts +6 -7
  4. package/dist/agent-conversation/index.js +15 -10
  5. package/dist/agent-conversation/index.js.map +1 -1
  6. package/dist/agent-env/index.d.ts +10 -36
  7. package/dist/agent-env/index.js +2 -57
  8. package/dist/agent-env/index.js.map +1 -1
  9. package/dist/agent-gui.d.ts +21 -0
  10. package/dist/agent-gui.js +39 -0
  11. package/dist/agent-message-center/index.d.ts +156 -124
  12. package/dist/agent-message-center/index.js +1656 -1463
  13. package/dist/agent-message-center/index.js.map +1 -1
  14. package/dist/{agentConversationVM-Cl4G0Lln.d.ts → agentConversationVM-C335TR6S.d.ts} +112 -7
  15. package/dist/agentFileMentionContracts-58IjMU-u.d.ts +108 -0
  16. package/dist/{agentGuiNodeTypes-CAioPXK9.d.ts → agentGuiNodeTypes-B9X4aWfv.d.ts} +123 -163
  17. package/dist/agentPlanPromptDispatch-C7cCMjve.d.ts +37 -0
  18. package/dist/agents.d.ts +13 -0
  19. package/dist/agents.js +13 -0
  20. package/dist/app/renderer/agentactivity.css +276 -83
  21. package/dist/app/renderer/assets/icons/agent-vinyls/tutti-vinyl.png +0 -0
  22. package/dist/app/renderer/assets/icons/open-link-lined.svg +4 -0
  23. package/dist/{chunk-7BUYFVRI.js → chunk-2HJEOO7W.js} +2931 -2946
  24. package/dist/chunk-2HJEOO7W.js.map +1 -0
  25. package/dist/{chunk-E5FOXRUM.js → chunk-3XXBDYAI.js} +293 -258
  26. package/dist/chunk-3XXBDYAI.js.map +1 -0
  27. package/dist/{chunk-ZUW4B5AT.js → chunk-3Y3F7CS5.js} +21 -32
  28. package/dist/chunk-3Y3F7CS5.js.map +1 -0
  29. package/dist/{chunk-SCLLP5DO.js → chunk-4PQPJ5OY.js} +50 -155
  30. package/dist/chunk-4PQPJ5OY.js.map +1 -0
  31. package/dist/chunk-4YG7YK7S.js +23 -0
  32. package/dist/chunk-4YG7YK7S.js.map +1 -0
  33. package/dist/chunk-5X7YDOC6.js +42 -0
  34. package/dist/chunk-5X7YDOC6.js.map +1 -0
  35. package/dist/{chunk-R2EWECUP.js → chunk-7BXWPI4F.js} +17 -2
  36. package/dist/{chunk-R2EWECUP.js.map → chunk-7BXWPI4F.js.map} +1 -1
  37. package/dist/chunk-AGT7MUTV.js +491 -0
  38. package/dist/chunk-AGT7MUTV.js.map +1 -0
  39. package/dist/chunk-C35SNDVZ.js +96 -0
  40. package/dist/chunk-C35SNDVZ.js.map +1 -0
  41. package/dist/{chunk-5FE7M42A.js → chunk-E4HQUTM3.js} +2 -2
  42. package/dist/chunk-FGLQZ6I4.js +9 -0
  43. package/dist/chunk-FGLQZ6I4.js.map +1 -0
  44. package/dist/chunk-H5F3QSCF.js +25 -0
  45. package/dist/chunk-H5F3QSCF.js.map +1 -0
  46. package/dist/chunk-H6IQ63DQ.js +14 -0
  47. package/dist/chunk-H6IQ63DQ.js.map +1 -0
  48. package/dist/{chunk-45FF4DQU.js → chunk-IYEXLOUE.js} +22 -27
  49. package/dist/chunk-IYEXLOUE.js.map +1 -0
  50. package/dist/{chunk-P72YLKC6.js → chunk-JKIZA7EJ.js} +3573 -3755
  51. package/dist/chunk-JKIZA7EJ.js.map +1 -0
  52. package/dist/chunk-KJQERFKX.js +259 -0
  53. package/dist/chunk-KJQERFKX.js.map +1 -0
  54. package/dist/{chunk-XW4CVBUH.js → chunk-L3GMMGRS.js} +25 -16
  55. package/dist/chunk-L3GMMGRS.js.map +1 -0
  56. package/dist/chunk-MASXZENX.js +231 -0
  57. package/dist/chunk-MASXZENX.js.map +1 -0
  58. package/dist/{chunk-BXVPOGYK.js → chunk-O3Q5SIJH.js} +505 -504
  59. package/dist/chunk-O3Q5SIJH.js.map +1 -0
  60. package/dist/{chunk-554VG7ZW.js → chunk-QVBF5BN5.js} +2 -2
  61. package/dist/{chunk-AWAIUYG4.js → chunk-RE4AXS27.js} +532 -565
  62. package/dist/chunk-RE4AXS27.js.map +1 -0
  63. package/dist/{chunk-7LMJXF4R.js → chunk-TVIGLNNI.js} +20 -16
  64. package/dist/chunk-TVIGLNNI.js.map +1 -0
  65. package/dist/{chunk-XDV4ZRVK.js → chunk-UGVI47X6.js} +98 -37
  66. package/dist/chunk-UGVI47X6.js.map +1 -0
  67. package/dist/{chunk-GAPTLVII.js → chunk-UHBCM6RO.js} +1 -1
  68. package/dist/chunk-UHBCM6RO.js.map +1 -0
  69. package/dist/{chunk-UBDPV34P.js → chunk-W6WAGPMD.js} +1385 -1305
  70. package/dist/chunk-W6WAGPMD.js.map +1 -0
  71. package/dist/chunk-WKSFPJHZ.js +33054 -0
  72. package/dist/chunk-WKSFPJHZ.js.map +1 -0
  73. package/dist/{chunk-IGY4ASUF.js → chunk-WMNS4MAQ.js} +1288 -1696
  74. package/dist/chunk-WMNS4MAQ.js.map +1 -0
  75. package/dist/{chunk-MATIJPGF.js → chunk-XPFHJMZP.js} +541 -401
  76. package/dist/chunk-XPFHJMZP.js.map +1 -0
  77. package/dist/chunk-YMXYBG7U.js +12 -0
  78. package/dist/chunk-YMXYBG7U.js.map +1 -0
  79. package/dist/context-mention-palette/index.d.ts +3 -2
  80. package/dist/context-mention-palette/index.js +17 -12
  81. package/dist/custom-mention.d.ts +42 -0
  82. package/dist/custom-mention.js +17 -0
  83. package/dist/custom-mention.js.map +1 -0
  84. package/dist/dock-icons.d.ts +4 -0
  85. package/dist/dock-icons.js +11 -0
  86. package/dist/dock-icons.js.map +1 -0
  87. package/dist/i18n/index.d.ts +880 -841
  88. package/dist/i18n/index.js +2 -2
  89. package/dist/index.d.ts +56 -1063
  90. package/dist/index.js +78 -35532
  91. package/dist/index.js.map +1 -1
  92. package/dist/mention-search.d.ts +226 -0
  93. package/dist/mention-search.js +29 -0
  94. package/dist/mention-search.js.map +1 -0
  95. package/dist/open-link-lined-JWEKUKME.svg +4 -0
  96. package/dist/pastedTextKinds-D-XuInaS.d.ts +4 -0
  97. package/dist/provider-icons.d.ts +6 -0
  98. package/dist/provider-icons.js +12 -0
  99. package/dist/provider-icons.js.map +1 -0
  100. package/dist/provider-identity.d.ts +9 -0
  101. package/dist/provider-identity.js +21 -0
  102. package/dist/provider-identity.js.map +1 -0
  103. package/dist/runtime-BBNdWgDU.d.ts +10 -0
  104. package/dist/startup-shell.d.ts +8 -0
  105. package/dist/startup-shell.js +184 -0
  106. package/dist/startup-shell.js.map +1 -0
  107. package/dist/{types-PLFZ8SBX.d.ts → types-CnT8rNUI.d.ts} +43 -87
  108. package/dist/workbench/contribution.d.ts +34 -41
  109. package/dist/workbench/contribution.js +10 -6
  110. package/dist/workbench/index.d.ts +5 -4
  111. package/dist/workbench/index.js +27 -25
  112. package/dist/workbench/launch.d.ts +4 -7
  113. package/dist/workbench/launch.js +4 -3
  114. package/dist/workbench/providerCatalog.d.ts +2 -2
  115. package/dist/workbench/providerCatalog.js +2 -1
  116. package/dist/workbench/sessionTitle.d.ts +11 -14
  117. package/dist/workbench/sessionTitle.js +6 -7
  118. package/dist/workbench/state.d.ts +1 -1
  119. package/dist/workbench/state.js +3 -2
  120. package/dist/workbench/types.d.ts +2 -4
  121. package/dist/workbench/types.js +1 -1
  122. package/dist/workspace-agent-generated-files.d.ts +20 -2
  123. package/dist/workspace-agent-generated-files.js +6 -5
  124. package/dist/workspaceAgentActivityListTypes-C7gPWYiA.d.ts +71 -0
  125. package/package.json +70 -26
  126. package/dist/AgentMentionSearchController-DD_WOred.d.ts +0 -241
  127. package/dist/AgentMessageMarkdown-DeYPURtF.d.ts +0 -7
  128. package/dist/chunk-45FF4DQU.js.map +0 -1
  129. package/dist/chunk-4HP6V2YA.js +0 -207
  130. package/dist/chunk-4HP6V2YA.js.map +0 -1
  131. package/dist/chunk-7BUYFVRI.js.map +0 -1
  132. package/dist/chunk-7LMJXF4R.js.map +0 -1
  133. package/dist/chunk-AWAIUYG4.js.map +0 -1
  134. package/dist/chunk-BXVPOGYK.js.map +0 -1
  135. package/dist/chunk-E5FOXRUM.js.map +0 -1
  136. package/dist/chunk-GAPTLVII.js.map +0 -1
  137. package/dist/chunk-IBIMGLCD.js +0 -66
  138. package/dist/chunk-IBIMGLCD.js.map +0 -1
  139. package/dist/chunk-IGY4ASUF.js.map +0 -1
  140. package/dist/chunk-LR4FA5X6.js +0 -368
  141. package/dist/chunk-LR4FA5X6.js.map +0 -1
  142. package/dist/chunk-MATIJPGF.js.map +0 -1
  143. package/dist/chunk-MKHDRIGN.js +0 -71
  144. package/dist/chunk-MKHDRIGN.js.map +0 -1
  145. package/dist/chunk-P72YLKC6.js.map +0 -1
  146. package/dist/chunk-SCLLP5DO.js.map +0 -1
  147. package/dist/chunk-UBDPV34P.js.map +0 -1
  148. package/dist/chunk-VAKFNNKT.js +0 -410
  149. package/dist/chunk-VAKFNNKT.js.map +0 -1
  150. package/dist/chunk-XDV4ZRVK.js.map +0 -1
  151. package/dist/chunk-XW4CVBUH.js.map +0 -1
  152. package/dist/chunk-ZUW4B5AT.js.map +0 -1
  153. package/dist/plan-decision-ops.d.ts +0 -70
  154. package/dist/plan-decision-ops.js +0 -19
  155. package/dist/queued-prompt-runtime.d.ts +0 -115
  156. package/dist/queued-prompt-runtime.js +0 -9
  157. package/dist/uiSettings-BQS9r2eo.d.ts +0 -6
  158. package/dist/workspaceAgentActivityListViewModel-BzV-cf0D.d.ts +0 -340
  159. package/dist/workspaceLinkActions-DS9LWqzI.d.ts +0 -74
  160. /package/dist/{plan-decision-ops.js.map → agent-gui.js.map} +0 -0
  161. /package/dist/{queued-prompt-runtime.js.map → agents.js.map} +0 -0
  162. /package/dist/{chunk-5FE7M42A.js.map → chunk-E4HQUTM3.js.map} +0 -0
  163. /package/dist/{chunk-554VG7ZW.js.map → chunk-QVBF5BN5.js.map} +0 -0
@@ -1,20 +1,138 @@
1
- import {
2
- PLAN_IMPLEMENTATION_ACTION_FEEDBACK,
3
- PLAN_IMPLEMENTATION_ACTION_IMPLEMENT,
4
- PLAN_IMPLEMENTATION_ACTION_SKIP
5
- } from "./chunk-MKHDRIGN.js";
6
1
  import {
7
2
  AgentGUIConversation_styles_default,
8
3
  MessageSquareMoreIcon,
9
4
  extractAgentMcpToolTarget
10
- } from "./chunk-7BUYFVRI.js";
5
+ } from "./chunk-2HJEOO7W.js";
11
6
  import {
12
7
  getOptionalAgentHostApi,
13
8
  useOptionalAgentHostApi
14
- } from "./chunk-LR4FA5X6.js";
9
+ } from "./chunk-MASXZENX.js";
15
10
  import {
16
11
  translate
17
- } from "./chunk-5FE7M42A.js";
12
+ } from "./chunk-E4HQUTM3.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
+ }
25
+
26
+ // shared/agentConversation/planImplementationPresentation.ts
27
+ var PLAN_IMPLEMENTATION_PROMPT = "Implement the plan.";
28
+ var PLAN_IMPLEMENTATION_ACTION_IMPLEMENT = "implement";
29
+ var PLAN_IMPLEMENTATION_ACTION_FEEDBACK = "feedback";
30
+ var PLAN_IMPLEMENTATION_ACTION_SKIP = "skip";
31
+ function planImplementationPromptFromPlanTurn(planTurnId, title) {
32
+ return {
33
+ kind: "plan-implementation",
34
+ requestId: planTurnId,
35
+ title
36
+ };
37
+ }
38
+ function itemTime(item) {
39
+ return item.occurredAtUnixMs ?? item.createdAtUnixMs ?? item.seq ?? 0;
40
+ }
41
+ function isPlanItem(item) {
42
+ return item.payload?.messageKind === "plan";
43
+ }
44
+ function latestPlanTurnId(timelineItems) {
45
+ let latestTurnId = null;
46
+ let latestTime = Number.NEGATIVE_INFINITY;
47
+ for (const item of timelineItems) {
48
+ const turnId = item.turnId?.trim();
49
+ if (!turnId) continue;
50
+ const time = itemTime(item);
51
+ if (time >= latestTime) {
52
+ latestTime = time;
53
+ latestTurnId = turnId;
54
+ }
55
+ }
56
+ if (!latestTurnId) return null;
57
+ return timelineItems.some(
58
+ (item) => item.turnId?.trim() === latestTurnId && isPlanItem(item)
59
+ ) ? latestTurnId : null;
60
+ }
61
+
62
+ // shared/agentConversation/agentPlanPromptDispatch.ts
63
+ import {
64
+ selectPlanDecisionForTurn,
65
+ selectWorkspaceAgentConsumerSession
66
+ } from "@tutti-os/agent-activity-core";
67
+ function selectAgentPlanPromptTurn(state, agentSessionId, requestId) {
68
+ const latestTurn = selectWorkspaceAgentConsumerSession(
69
+ state,
70
+ agentSessionId
71
+ )?.latestTurn;
72
+ return latestTurn?.turnId === requestId && latestTurn.phase === "settled" && latestTurn.outcome === "completed" ? latestTurn : null;
73
+ }
74
+ function dispatchAgentPlanPromptAction(input) {
75
+ const turn = selectAgentPlanPromptTurn(
76
+ input.engine.getSnapshot(),
77
+ input.agentSessionId,
78
+ input.requestId
79
+ );
80
+ if (!turn) return false;
81
+ const scopeKey = [
82
+ "plan-implementation",
83
+ input.workspaceId,
84
+ input.agentSessionId,
85
+ turn.turnId
86
+ ].join(":");
87
+ if (input.action === PLAN_IMPLEMENTATION_ACTION_IMPLEMENT) {
88
+ const existing = selectPlanDecisionForTurn(
89
+ input.engine.getSnapshot(),
90
+ input.agentSessionId,
91
+ turn.turnId
92
+ );
93
+ input.engine.dispatch({
94
+ type: "plan/decisionRequested",
95
+ action: "implement",
96
+ agentSessionId: input.agentSessionId,
97
+ commandId: `plan-decision:${scopeKey}`,
98
+ idempotencyKey: scopeKey,
99
+ promptKind: "plan-implementation",
100
+ requestId: input.requestId,
101
+ turnId: turn.turnId,
102
+ workspaceId: input.workspaceId,
103
+ ...existing?.status === "failed" || existing?.status === "unknown" ? { retry: true } : {},
104
+ timeoutMs: 3e4
105
+ });
106
+ return true;
107
+ }
108
+ if (input.action === PLAN_IMPLEMENTATION_ACTION_SKIP) {
109
+ input.engine.dispatch({
110
+ type: "plan/skipped",
111
+ agentSessionId: input.agentSessionId,
112
+ requestId: input.requestId,
113
+ turnId: turn.turnId,
114
+ workspaceId: input.workspaceId
115
+ });
116
+ return true;
117
+ }
118
+ const text = input.feedbackText?.trim() ?? "";
119
+ if (!text) return false;
120
+ const requestedAtUnixMs = (input.nowUnixMs ?? Date.now)();
121
+ input.engine.dispatch({
122
+ type: "plan/feedbackRequested",
123
+ agentSessionId: input.agentSessionId,
124
+ clientSubmitId: `${scopeKey}:feedback:${requestedAtUnixMs}`,
125
+ content: [{ type: "text", text }],
126
+ displayPrompt: text,
127
+ expiresAtUnixMs: requestedAtUnixMs + 12e4,
128
+ requestedAtUnixMs,
129
+ requestId: input.requestId,
130
+ runtimeContent: [{ type: "text", text }],
131
+ turnId: turn.turnId,
132
+ workspaceId: input.workspaceId
133
+ });
134
+ return true;
135
+ }
18
136
 
19
137
  // shared/agentConversation/approvalOptionPresentation.ts
20
138
  function approvalOptionDisplayLabel(option, intent = {}) {
@@ -261,22 +379,8 @@ function numericValue(value) {
261
379
  }
262
380
 
263
381
  // shared/agentConversation/components/AgentInteractivePromptSurface.tsx
264
- import {
265
- useCallback,
266
- useEffect,
267
- useMemo,
268
- useRef,
269
- useState
270
- } from "react";
271
- import {
272
- Button,
273
- ShortcutBadge,
274
- Spinner,
275
- Tooltip,
276
- TooltipContent,
277
- TooltipProvider,
278
- TooltipTrigger
279
- } from "@tutti-os/ui-system";
382
+ import { useMemo as useMemo2, useState as useState2 } from "react";
383
+ import { Button } from "@tutti-os/ui-system";
280
384
 
281
385
  // shared/agentConversation/interactiveAnswerPayload.ts
282
386
  function buildAskUserAnswerPayload(answersByQuestionId) {
@@ -286,160 +390,226 @@ function buildAskUserAnswerPayload(answersByQuestionId) {
286
390
  return { answers, answersByQuestionId };
287
391
  }
288
392
 
289
- // shared/agentConversation/components/AgentInteractivePromptSurface.tsx
290
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
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
+ // shared/agentConversation/components/interactivePromptPresentation.tsx
398
+ import {
399
+ Spinner,
400
+ Tooltip,
401
+ TooltipContent,
402
+ TooltipProvider,
403
+ TooltipTrigger
404
+ } from "@tutti-os/ui-system";
405
+ import { jsx, jsxs } from "react/jsx-runtime";
291
406
  var COMMAND_TOOLTIP_DELAY_MS = 1e3;
292
- function AgentInteractivePromptSurface({
293
- prompt,
294
- variant = "full",
295
- edgeGlow = false,
296
- embedded = false,
297
- keyboardShortcuts = true,
298
- previewMode = false,
299
- isSubmitting,
300
- onSubmit,
301
- labels
302
- }) {
303
- "use memo";
304
- if (prompt.kind === "approval") {
305
- return /* @__PURE__ */ jsx(
306
- ApprovalPromptSurface,
307
- {
308
- prompt,
309
- embedded,
310
- edgeGlow,
311
- keyboardShortcuts,
312
- previewMode,
313
- isSubmitting,
314
- onSubmit,
315
- labels
316
- }
317
- );
407
+ function isEnterLikeKey(event) {
408
+ return event.key === "Enter" || event.code === "Enter" || event.code === "NumpadEnter";
409
+ }
410
+ function isEditableKeyboardTarget(target) {
411
+ if (!(target instanceof HTMLElement)) {
412
+ return false;
318
413
  }
319
- if (prompt.kind === "exit-plan") {
320
- return /* @__PURE__ */ jsx(
321
- ExitPlanPromptSurface,
322
- {
323
- prompt,
324
- variant,
325
- embedded,
326
- edgeGlow,
327
- previewMode,
328
- isSubmitting,
329
- onSubmit,
330
- labels
331
- }
332
- );
414
+ const tagName = target.tagName.toLowerCase();
415
+ return tagName === "input" || tagName === "textarea" || tagName === "select" || target.isContentEditable;
416
+ }
417
+ function approvalOptionShortcutLabel(optionIndex, isDarwin) {
418
+ if (optionIndex === 0) {
419
+ return translate("agentHost.agentGui.shortcutEnter");
333
420
  }
334
- if (prompt.kind === "plan-implementation") {
335
- return /* @__PURE__ */ jsx(
336
- PlanImplementationSurface,
337
- {
338
- prompt,
339
- variant,
340
- embedded,
341
- edgeGlow,
342
- previewMode,
343
- isSubmitting,
344
- onSubmit,
345
- labels
346
- }
347
- );
421
+ if (optionIndex === 1) {
422
+ return isDarwin ? translate("agentHost.agentGui.shortcutCmdEnter") : translate("agentHost.agentGui.shortcutCtrEnter");
423
+ }
424
+ return null;
425
+ }
426
+ function isDarwinPlatform(platform) {
427
+ if (platform) {
428
+ return platform === "darwin";
348
429
  }
430
+ if (typeof navigator === "undefined") {
431
+ return false;
432
+ }
433
+ const userAgentPlatform = "userAgentData" in navigator ? navigator.userAgentData?.platform : void 0;
434
+ const navigatorPlatform = userAgentPlatform ?? navigator.platform ?? "";
435
+ return /mac/i.test(navigatorPlatform);
436
+ }
437
+ function InteractiveOptionSpinner() {
438
+ "use memo";
349
439
  return /* @__PURE__ */ jsx(
350
- AskUserPromptSurface,
440
+ Spinner,
351
441
  {
352
- prompt,
353
- variant,
354
- embedded,
355
- edgeGlow,
356
- previewMode,
357
- isSubmitting,
358
- onSubmit,
359
- labels
442
+ className: AgentGUIConversation_styles_default.interactiveOptionSpinner,
443
+ testId: "agent-interactive-option-spinner"
360
444
  }
361
445
  );
362
446
  }
363
- function CompactAskUserPromptSurface({
364
- prompt,
365
- embedded = false,
366
- edgeGlow = false,
367
- isSubmitting,
368
- onSubmit
369
- }) {
447
+ function SendFilledIcon() {
370
448
  "use memo";
371
- const question = prompt.questions[0] ?? null;
372
- const oneClickable = prompt.questions.length === 1 && question !== null && !question.multiSelect && question.options.length > 0;
373
- return /* @__PURE__ */ jsx("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsx("div", { className: interactivePromptCardClassName(edgeGlow), children: question ? /* @__PURE__ */ jsxs(Fragment, { children: [
374
- /* @__PURE__ */ jsx("div", { className: AgentGUIConversation_styles_default.interactivePromptHeader, children: /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(question.header) }) }),
375
- /* @__PURE__ */ jsx("div", { className: AgentGUIConversation_styles_default.interactivePromptQuestion, children: question.question }),
376
- oneClickable ? /* @__PURE__ */ jsx("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: question.options.map((option) => /* @__PURE__ */ jsxs(
377
- "button",
378
- {
379
- type: "button",
380
- className: AgentGUIConversation_styles_default.interactiveOptionButton,
381
- "aria-label": interactiveOptionLabel(
382
- option.label,
383
- option.description
384
- ),
385
- disabled: isSubmitting,
386
- onClick: () => onSubmit({
387
- requestId: prompt.requestId,
388
- action: "submit",
389
- payload: {
390
- ...buildAskUserAnswerPayload({
391
- [question.id]: option.label
392
- })
393
- }
394
- }),
395
- children: [
396
- /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: option.label }),
397
- option.description ? /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: option.description }) : null
398
- ]
399
- },
400
- option.label
401
- )) }) : question.options.length > 0 ? (
402
- // Multi-select / multi-question prompts can't be answered with a
403
- // single click here, so the options are shown as read-only
404
- // context instead of being silently omitted. Answering still
405
- // happens in the full conversation via the card's "open
406
- // conversation" jump.
407
- /* @__PURE__ */ jsx("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: question.options.map((option) => /* @__PURE__ */ jsxs(
408
- "div",
449
+ return /* @__PURE__ */ jsx(
450
+ "svg",
451
+ {
452
+ width: "24",
453
+ height: "24",
454
+ viewBox: "0 0 24 24",
455
+ fill: "none",
456
+ "aria-hidden": "true",
457
+ children: /* @__PURE__ */ jsx(
458
+ "path",
409
459
  {
410
- className: AgentGUIConversation_styles_default.interactiveOptionDisplay,
411
- children: [
412
- /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: option.label }),
413
- option.description ? /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: option.description }) : null
414
- ]
415
- },
416
- option.label
417
- )) })
418
- ) : null
419
- ] }) : null }) });
460
+ d: "M2.74311 8.80587C2.84592 8.40096 3.14571 8.08844 3.54551 7.97033L18.5197 3.51569C18.9336 3.39383 19.3809 3.5054 19.6881 3.81262C19.9951 4.11984 20.1076 4.56798 19.9857 4.9817L15.5311 19.9559C15.413 20.3557 15.1005 20.6555 14.6956 20.7583C14.2895 20.8597 13.869 20.7438 13.5721 20.4469L10.455 15.1823C10.8585 14.6483 12.1563 12.9094 14.3475 9.96528C14.6086 9.70419 14.6382 9.31168 14.4138 9.08692C14.1891 8.86221 13.796 8.8913 13.5348 9.15252L8.31088 13.0423L3.05316 9.92799C2.7562 9.63104 2.64049 9.21071 2.74311 8.80587Z",
461
+ fill: "currentColor"
462
+ }
463
+ )
464
+ }
465
+ );
420
466
  }
421
- function ApprovalPromptSurface({
422
- prompt,
423
- embedded = false,
424
- edgeGlow = false,
425
- keyboardShortcuts = true,
426
- previewMode = false,
427
- isSubmitting,
428
- onSubmit,
429
- labels
467
+ function interactivePromptClassName(embedded) {
468
+ return embedded ? `${AgentGUIConversation_styles_default.interactivePrompt} agent-gui-conversation__interactive-prompt--embedded` : AgentGUIConversation_styles_default.interactivePrompt;
469
+ }
470
+ function interactivePromptCardClassName(edgeGlow) {
471
+ return edgeGlow ? `${AgentGUIConversation_styles_default.interactivePromptCard} agent-gui-edge-glow` : AgentGUIConversation_styles_default.interactivePromptCard;
472
+ }
473
+ function formatToolDetails(input) {
474
+ return getPromptToolDetails(input).map((detail) => ({
475
+ kind: detail.kind,
476
+ label: promptToolDetailLabel(detail.kind),
477
+ value: detail.value,
478
+ ...detail.meta ? { meta: detail.meta } : {}
479
+ }));
480
+ }
481
+ function PromptDetailValue({
482
+ detail,
483
+ previewMode
430
484
  }) {
431
485
  "use memo";
432
- const promptDetails = useMemo(
433
- () => formatToolDetails(prompt.input ?? null),
434
- [prompt.input]
486
+ if (detail.kind !== "command") {
487
+ return /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: detail.value });
488
+ }
489
+ return /* @__PURE__ */ jsx(
490
+ CommandTextWithTooltip,
491
+ {
492
+ value: detail.value,
493
+ testId: "agent-interactive-command-detail",
494
+ tooltipsEnabled: !previewMode
495
+ }
435
496
  );
436
- const [submittingOptionId, setSubmittingOptionId] = useState(
437
- null
497
+ }
498
+ function CommandTextWithTooltip({
499
+ value,
500
+ testId,
501
+ tooltipsEnabled = true
502
+ }) {
503
+ "use memo";
504
+ const content = /* @__PURE__ */ jsx(
505
+ "span",
506
+ {
507
+ className: `${AgentGUIConversation_styles_default.interactiveOptionDescription} ${AgentGUIConversation_styles_default.interactiveOptionCommandDescription}`,
508
+ "data-agent-interactive-command-detail": testId === "agent-interactive-command-detail" ? "true" : void 0,
509
+ "data-agent-interactive-command-prefix-option": testId === "agent-interactive-command-prefix-option" ? "true" : void 0,
510
+ children: value
511
+ }
438
512
  );
439
- const [pendingFeedbackOptionId, setPendingFeedbackOptionId] = useState(null);
440
- const [feedback, setFeedback] = useState("");
441
- const feedbackTextareaRef = useRef(null);
442
- const agentHostApi = useOptionalAgentHostApi() ?? getOptionalAgentHostApi();
513
+ if (!tooltipsEnabled) {
514
+ return content;
515
+ }
516
+ return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: COMMAND_TOOLTIP_DELAY_MS, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
517
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: content }),
518
+ /* @__PURE__ */ jsx(TooltipContent, { className: AgentGUIConversation_styles_default.interactiveOptionCommandTooltip, children: value })
519
+ ] }) });
520
+ }
521
+ function promptToolDetailLabel(kind) {
522
+ switch (kind) {
523
+ case "command":
524
+ return translate("agentHost.agentTool.details.command");
525
+ case "mcp":
526
+ return translate("agentHost.agentTool.details.mcp");
527
+ case "path":
528
+ return translate("agentHost.agentTool.details.path");
529
+ case "query":
530
+ return translate("agentHost.agentTool.details.query");
531
+ }
532
+ }
533
+ function isApprovalFeedbackOption(option) {
534
+ return isDenyApprovalOptionToken(option.id) || isDenyApprovalOptionToken(option.kind);
535
+ }
536
+ function approvalFeedbackOptionId(options) {
537
+ const explicitFeedbackOption = options.find(
538
+ (option) => isExplicitFeedbackDenyApprovalOption(option)
539
+ );
540
+ if (explicitFeedbackOption) {
541
+ return explicitFeedbackOption.id;
542
+ }
543
+ return options.find(isApprovalFeedbackOption)?.id ?? null;
544
+ }
545
+ function isExplicitFeedbackDenyApprovalOption(option) {
546
+ for (const value of [option.id, option.kind]) {
547
+ switch (normalizeApprovalOptionToken(value ?? "")) {
548
+ case "abort":
549
+ case "cancel":
550
+ case "cancelled":
551
+ case "canceled":
552
+ case "denywithfeedback":
553
+ case "rejectwithfeedback":
554
+ return true;
555
+ default:
556
+ break;
557
+ }
558
+ }
559
+ return false;
560
+ }
561
+ function isDenyApprovalOptionToken(value) {
562
+ switch (normalizeApprovalOptionToken(value ?? "")) {
563
+ case "abort":
564
+ case "cancel":
565
+ case "cancelled":
566
+ case "canceled":
567
+ case "deny":
568
+ case "denied":
569
+ case "reject":
570
+ case "rejected":
571
+ case "rejectonce":
572
+ case "disallow":
573
+ case "decline":
574
+ case "declined":
575
+ case "no":
576
+ return true;
577
+ default:
578
+ return false;
579
+ }
580
+ }
581
+ function stripPromptTitlePunctuation(value) {
582
+ return value.trim().replace(/[.。]+$/u, "");
583
+ }
584
+ function interactiveOptionLabel(label, description) {
585
+ const trimmedDescription = description?.trim();
586
+ return trimmedDescription ? `${label} ${trimmedDescription}` : label;
587
+ }
588
+
589
+ // shared/agentConversation/components/AgentInteractiveDecisionPromptSurfaces.tsx
590
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
591
+ function ApprovalPromptSurface({
592
+ prompt,
593
+ embedded = false,
594
+ edgeGlow = false,
595
+ keyboardShortcuts = true,
596
+ previewMode = false,
597
+ isSubmitting,
598
+ onSubmit,
599
+ labels
600
+ }) {
601
+ "use memo";
602
+ const promptDetails = useMemo(
603
+ () => formatToolDetails(prompt.input ?? null),
604
+ [prompt.input]
605
+ );
606
+ const [submittingOptionId, setSubmittingOptionId] = useState(
607
+ null
608
+ );
609
+ const [pendingFeedbackOptionId, setPendingFeedbackOptionId] = useState(null);
610
+ const [feedback, setFeedback] = useState("");
611
+ const feedbackTextareaRef = useRef(null);
612
+ const agentHostApi = useOptionalAgentHostApi() ?? getOptionalAgentHostApi();
443
613
  const isDarwin = isDarwinPlatform(agentHostApi?.meta?.platform);
444
614
  const feedbackOptionId = useMemo(
445
615
  () => approvalFeedbackOptionId(prompt.options),
@@ -451,6 +621,11 @@ function ApprovalPromptSurface({
451
621
  setPendingFeedbackOptionId(null);
452
622
  setFeedback("");
453
623
  }, [prompt.requestId]);
624
+ useEffect(() => {
625
+ if (!isSubmitting) {
626
+ setSubmittingOptionId(null);
627
+ }
628
+ }, [isSubmitting]);
454
629
  useEffect(() => {
455
630
  if (pendingFeedbackOptionId !== null) {
456
631
  feedbackTextareaRef.current?.focus();
@@ -506,21 +681,21 @@ function ApprovalPromptSurface({
506
681
  submitOption,
507
682
  submittingOptionId
508
683
  ]);
509
- return /* @__PURE__ */ jsx("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsxs("div", { className: interactivePromptCardClassName(edgeGlow), children: [
510
- /* @__PURE__ */ jsx("div", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(labels.approvalLead) }),
511
- promptDetails.length > 0 ? /* @__PURE__ */ jsx("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: promptDetails.map((detail) => /* @__PURE__ */ jsxs(
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(
512
687
  "div",
513
688
  {
514
689
  className: AgentGUIConversation_styles_default.interactiveOptionDisplay,
515
690
  children: [
516
- /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: detail.label }),
517
- /* @__PURE__ */ jsx(PromptDetailValue, { detail, previewMode }),
518
- detail.meta ? /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: detail.meta }) : null
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
519
694
  ]
520
695
  },
521
696
  `${detail.label}:${detail.value}`
522
697
  )) }) : null,
523
- /* @__PURE__ */ jsx("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: prompt.options.map((option, optionIndex) => {
698
+ /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: prompt.options.map((option, optionIndex) => {
524
699
  const showSpinner = submittingOptionId === option.id;
525
700
  const optionSupportsFeedback = feedbackOptionId === option.id;
526
701
  const optionLabel = approvalOptionDisplayLabel(option, {
@@ -536,12 +711,12 @@ function ApprovalPromptSurface({
536
711
  );
537
712
  const showFeedbackComposer = pendingFeedbackOptionId === option.id;
538
713
  if (showFeedbackComposer) {
539
- return /* @__PURE__ */ jsxs(
714
+ return /* @__PURE__ */ jsxs2(
540
715
  "div",
541
716
  {
542
717
  className: AgentGUIConversation_styles_default.interactiveFeedbackComposer,
543
718
  children: [
544
- /* @__PURE__ */ jsx(
719
+ /* @__PURE__ */ jsx2(
545
720
  "textarea",
546
721
  {
547
722
  ref: feedbackTextareaRef,
@@ -567,7 +742,7 @@ function ApprovalPromptSurface({
567
742
  }
568
743
  }
569
744
  ),
570
- /* @__PURE__ */ jsx(
745
+ /* @__PURE__ */ jsx2(
571
746
  "button",
572
747
  {
573
748
  type: "button",
@@ -583,7 +758,7 @@ function ApprovalPromptSurface({
583
758
  }
584
759
  submitOption(option.id);
585
760
  },
586
- children: showSpinner ? /* @__PURE__ */ jsx(InteractiveOptionSpinner, {}) : /* @__PURE__ */ jsx(SendFilledIcon, {})
761
+ children: showSpinner ? /* @__PURE__ */ jsx2(InteractiveOptionSpinner, {}) : /* @__PURE__ */ jsx2(SendFilledIcon, {})
587
762
  }
588
763
  )
589
764
  ]
@@ -591,7 +766,7 @@ function ApprovalPromptSurface({
591
766
  option.id
592
767
  );
593
768
  }
594
- return /* @__PURE__ */ jsxs(
769
+ return /* @__PURE__ */ jsxs2(
595
770
  "button",
596
771
  {
597
772
  type: "button",
@@ -603,8 +778,8 @@ function ApprovalPromptSurface({
603
778
  disabled: isSubmitting || submittingOptionId !== null,
604
779
  onClick: () => submitOption(option.id),
605
780
  children: [
606
- /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: optionPresentation.label }),
607
- optionPresentation.commandPrefix ? /* @__PURE__ */ jsx(
781
+ /* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: optionPresentation.label }),
782
+ optionPresentation.commandPrefix ? /* @__PURE__ */ jsx2(
608
783
  CommandTextWithTooltip,
609
784
  {
610
785
  value: optionPresentation.commandPrefix,
@@ -612,8 +787,8 @@ function ApprovalPromptSurface({
612
787
  tooltipsEnabled: !previewMode
613
788
  }
614
789
  ) : null,
615
- option.description ? /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: option.description }) : null,
616
- keyboardShortcuts && shortcutLabel && !showSpinner ? /* @__PURE__ */ jsx(
790
+ option.description ? /* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: option.description }) : null,
791
+ keyboardShortcuts && shortcutLabel && !showSpinner ? /* @__PURE__ */ jsx2(
617
792
  ShortcutBadge,
618
793
  {
619
794
  className: AgentGUIConversation_styles_default.interactiveOptionShortcut,
@@ -621,7 +796,7 @@ function ApprovalPromptSurface({
621
796
  children: shortcutLabel
622
797
  }
623
798
  ) : null,
624
- showSpinner ? /* @__PURE__ */ jsx(InteractiveOptionSpinner, {}) : null
799
+ showSpinner ? /* @__PURE__ */ jsx2(InteractiveOptionSpinner, {}) : null
625
800
  ]
626
801
  },
627
802
  option.id
@@ -657,11 +832,16 @@ function ExitPlanPromptSurface({
657
832
  useEffect(() => {
658
833
  setSubmittingOptionId(null);
659
834
  }, [prompt.requestId]);
660
- return /* @__PURE__ */ jsx("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsxs("div", { className: interactivePromptCardClassName(edgeGlow), children: [
661
- /* @__PURE__ */ jsx("div", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(labels.planLead) }),
662
- /* @__PURE__ */ jsx("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: modes.map((mode) => {
835
+ useEffect(() => {
836
+ if (!isSubmitting) {
837
+ setSubmittingOptionId(null);
838
+ }
839
+ }, [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) => {
663
843
  const showSpinner = submittingOptionId === mode.id;
664
- return /* @__PURE__ */ jsxs(
844
+ return /* @__PURE__ */ jsxs2(
665
845
  "button",
666
846
  {
667
847
  type: "button",
@@ -680,16 +860,16 @@ function ExitPlanPromptSurface({
680
860
  });
681
861
  },
682
862
  children: [
683
- /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: mode.label }),
684
- /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: mode.description }),
685
- showSpinner ? /* @__PURE__ */ jsx(InteractiveOptionSpinner, {}) : null
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
686
866
  ]
687
867
  },
688
868
  mode.id
689
869
  );
690
870
  }) }),
691
- showFeedbackFooter ? /* @__PURE__ */ jsxs("div", { className: AgentGUIConversation_styles_default.interactivePromptFooter, children: [
692
- /* @__PURE__ */ jsx(
871
+ showFeedbackFooter ? /* @__PURE__ */ jsxs2("div", { className: AgentGUIConversation_styles_default.interactivePromptFooter, children: [
872
+ /* @__PURE__ */ jsx2(
693
873
  "textarea",
694
874
  {
695
875
  value: feedback,
@@ -699,7 +879,7 @@ function ExitPlanPromptSurface({
699
879
  onChange: (event) => setFeedback(event.currentTarget.value)
700
880
  }
701
881
  ),
702
- /* @__PURE__ */ jsx("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: /* @__PURE__ */ jsx(
882
+ /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: /* @__PURE__ */ jsx2(
703
883
  "button",
704
884
  {
705
885
  type: "button",
@@ -721,7 +901,7 @@ function ExitPlanPromptSurface({
721
901
  // Compact (deck): no textarea, but keep declining reachable — the deck
722
902
  // must still let the user keep planning (refining/feedback is deferred
723
903
  // to the conversation via the card's "open conversation" jump).
724
- /* @__PURE__ */ jsx("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: /* @__PURE__ */ jsx(
904
+ /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: /* @__PURE__ */ jsx2(
725
905
  "button",
726
906
  {
727
907
  type: "button",
@@ -751,9 +931,9 @@ function PlanImplementationSurface({
751
931
  const trimmed = feedback.trim();
752
932
  const continueLabel = trimmed === "" ? labels.planImplementationSkip : labels.planImplementationSend;
753
933
  const showFeedbackFooter = variant !== "compact";
754
- return /* @__PURE__ */ jsx("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsxs("div", { className: interactivePromptCardClassName(edgeGlow), children: [
755
- /* @__PURE__ */ jsx("div", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(labels.planImplementationLead) }),
756
- /* @__PURE__ */ jsx("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: /* @__PURE__ */ jsx(
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(
757
937
  "button",
758
938
  {
759
939
  type: "button",
@@ -764,11 +944,11 @@ function PlanImplementationSurface({
764
944
  requestId: prompt.requestId,
765
945
  action: PLAN_IMPLEMENTATION_ACTION_IMPLEMENT
766
946
  }),
767
- children: /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: labels.planImplementationConfirm })
947
+ children: /* @__PURE__ */ jsx2("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: labels.planImplementationConfirm })
768
948
  }
769
949
  ) }),
770
- showFeedbackFooter ? /* @__PURE__ */ jsxs("div", { className: AgentGUIConversation_styles_default.interactivePromptFooter, children: [
771
- /* @__PURE__ */ jsx(
950
+ showFeedbackFooter ? /* @__PURE__ */ jsxs2("div", { className: AgentGUIConversation_styles_default.interactivePromptFooter, children: [
951
+ /* @__PURE__ */ jsx2(
772
952
  "textarea",
773
953
  {
774
954
  value: feedback,
@@ -779,7 +959,7 @@ function PlanImplementationSurface({
779
959
  onChange: (event) => setFeedback(event.currentTarget.value)
780
960
  }
781
961
  ),
782
- /* @__PURE__ */ jsx("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: /* @__PURE__ */ jsx(
962
+ /* @__PURE__ */ jsx2("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: /* @__PURE__ */ jsx2(
783
963
  "button",
784
964
  {
785
965
  type: "button",
@@ -796,6 +976,138 @@ function PlanImplementationSurface({
796
976
  ] }) : null
797
977
  ] }) });
798
978
  }
979
+
980
+ // shared/agentConversation/components/AgentInteractivePromptSurface.tsx
981
+ import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
982
+ function AgentInteractivePromptSurface({
983
+ prompt,
984
+ variant = "full",
985
+ edgeGlow = false,
986
+ embedded = false,
987
+ keyboardShortcuts = true,
988
+ previewMode = false,
989
+ isSubmitting,
990
+ onSubmit,
991
+ labels
992
+ }) {
993
+ "use memo";
994
+ if (prompt.kind === "approval") {
995
+ return /* @__PURE__ */ jsx3(
996
+ ApprovalPromptSurface,
997
+ {
998
+ prompt,
999
+ embedded,
1000
+ edgeGlow,
1001
+ keyboardShortcuts,
1002
+ previewMode,
1003
+ isSubmitting,
1004
+ onSubmit,
1005
+ labels
1006
+ }
1007
+ );
1008
+ }
1009
+ if (prompt.kind === "exit-plan") {
1010
+ return /* @__PURE__ */ jsx3(
1011
+ ExitPlanPromptSurface,
1012
+ {
1013
+ prompt,
1014
+ variant,
1015
+ embedded,
1016
+ edgeGlow,
1017
+ previewMode,
1018
+ isSubmitting,
1019
+ onSubmit,
1020
+ labels
1021
+ }
1022
+ );
1023
+ }
1024
+ if (prompt.kind === "plan-implementation") {
1025
+ return /* @__PURE__ */ jsx3(
1026
+ PlanImplementationSurface,
1027
+ {
1028
+ prompt,
1029
+ variant,
1030
+ embedded,
1031
+ edgeGlow,
1032
+ previewMode,
1033
+ isSubmitting,
1034
+ onSubmit,
1035
+ labels
1036
+ }
1037
+ );
1038
+ }
1039
+ return /* @__PURE__ */ jsx3(
1040
+ AskUserPromptSurface,
1041
+ {
1042
+ prompt,
1043
+ variant,
1044
+ embedded,
1045
+ 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
+ }
799
1111
  function AskUserPromptSurface({
800
1112
  prompt,
801
1113
  variant = "full",
@@ -807,7 +1119,7 @@ function AskUserPromptSurface({
807
1119
  }) {
808
1120
  "use memo";
809
1121
  if (variant === "compact") {
810
- return /* @__PURE__ */ jsx(
1122
+ return /* @__PURE__ */ jsx3(
811
1123
  CompactAskUserPromptSurface,
812
1124
  {
813
1125
  prompt,
@@ -819,7 +1131,7 @@ function AskUserPromptSurface({
819
1131
  }
820
1132
  );
821
1133
  }
822
- return /* @__PURE__ */ jsx(
1134
+ return /* @__PURE__ */ jsx3(
823
1135
  FullAskUserPromptSurface,
824
1136
  {
825
1137
  prompt,
@@ -840,15 +1152,15 @@ function FullAskUserPromptSurface({
840
1152
  labels
841
1153
  }) {
842
1154
  "use memo";
843
- const [index, setIndex] = useState(0);
844
- const [selectedByQuestionId, setSelectedByQuestionId] = useState({});
845
- const [freeTextByQuestionId, setFreeTextByQuestionId] = useState({});
1155
+ const [index, setIndex] = useState2(0);
1156
+ const [selectedByQuestionId, setSelectedByQuestionId] = useState2({});
1157
+ const [freeTextByQuestionId, setFreeTextByQuestionId] = useState2({});
846
1158
  const question = prompt.questions[index] ?? null;
847
1159
  const selected = question ? selectedByQuestionId[question.id] ?? [] : [];
848
1160
  const freeText = question ? freeTextByQuestionId[question.id] ?? "" : "";
849
1161
  const canAdvance = question !== null && (selected.length > 0 || freeText.trim() !== "" || question.options.length === 0);
850
1162
  const isLast = index >= prompt.questions.length - 1;
851
- const payload = useMemo(() => {
1163
+ const payload = useMemo2(() => {
852
1164
  const answersByQuestionId = {};
853
1165
  for (const current of prompt.questions) {
854
1166
  const chosen = selectedByQuestionId[current.id] ?? [];
@@ -868,12 +1180,12 @@ function FullAskUserPromptSurface({
868
1180
  return buildAskUserAnswerPayload(answersByQuestionId);
869
1181
  }, [freeTextByQuestionId, prompt.questions, selectedByQuestionId]);
870
1182
  if (!question) {
871
- return /* @__PURE__ */ jsx("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsx("div", { className: interactivePromptCardClassName(edgeGlow), children: /* @__PURE__ */ jsxs(
1183
+ return /* @__PURE__ */ jsx3("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsx3("div", { className: interactivePromptCardClassName(edgeGlow), children: /* @__PURE__ */ jsxs3(
872
1184
  "div",
873
1185
  {
874
1186
  className: `${AgentGUIConversation_styles_default.interactivePromptLead} inline-flex items-center gap-1.5`,
875
1187
  children: [
876
- /* @__PURE__ */ jsx(
1188
+ /* @__PURE__ */ jsx3(
877
1189
  MessageSquareMoreIcon,
878
1190
  {
879
1191
  size: 15,
@@ -887,19 +1199,19 @@ function FullAskUserPromptSurface({
887
1199
  }
888
1200
  ) }) });
889
1201
  }
890
- return /* @__PURE__ */ jsx("section", { className: interactivePromptClassName(embedded), children: /* @__PURE__ */ jsxs("div", { className: interactivePromptCardClassName(edgeGlow), children: [
891
- /* @__PURE__ */ jsxs("div", { className: AgentGUIConversation_styles_default.interactivePromptHeader, children: [
892
- /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactivePromptLead, children: stripPromptTitlePunctuation(question.header) }),
893
- /* @__PURE__ */ jsxs("span", { className: AgentGUIConversation_styles_default.interactivePromptMeta, children: [
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: [
894
1206
  index + 1,
895
1207
  "/",
896
1208
  prompt.questions.length
897
1209
  ] })
898
1210
  ] }),
899
- /* @__PURE__ */ jsx("div", { className: AgentGUIConversation_styles_default.interactivePromptQuestion, children: question.question }),
900
- question.options.length > 0 ? /* @__PURE__ */ jsx("div", { className: AgentGUIConversation_styles_default.interactivePromptOptions, children: question.options.map((option) => {
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) => {
901
1213
  const active = selected.includes(option.label);
902
- return /* @__PURE__ */ jsxs(
1214
+ return /* @__PURE__ */ jsxs3(
903
1215
  "button",
904
1216
  {
905
1217
  type: "button",
@@ -919,14 +1231,14 @@ function FullAskUserPromptSurface({
919
1231
  });
920
1232
  },
921
1233
  children: [
922
- /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: option.label }),
923
- /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: option.description })
1234
+ /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionTitle, children: option.label }),
1235
+ /* @__PURE__ */ jsx3("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: option.description })
924
1236
  ]
925
1237
  },
926
1238
  option.label
927
1239
  );
928
1240
  }) }) : null,
929
- /* @__PURE__ */ jsx(
1241
+ /* @__PURE__ */ jsx3(
930
1242
  "textarea",
931
1243
  {
932
1244
  value: freeText,
@@ -942,8 +1254,8 @@ function FullAskUserPromptSurface({
942
1254
  }
943
1255
  }
944
1256
  ),
945
- /* @__PURE__ */ jsxs("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: [
946
- prompt.questions.length > 1 ? /* @__PURE__ */ jsx(
1257
+ /* @__PURE__ */ jsxs3("div", { className: AgentGUIConversation_styles_default.interactivePromptActions, children: [
1258
+ prompt.questions.length > 1 ? /* @__PURE__ */ jsx3(
947
1259
  Button,
948
1260
  {
949
1261
  type: "button",
@@ -954,7 +1266,7 @@ function FullAskUserPromptSurface({
954
1266
  children: labels.previousQuestion
955
1267
  }
956
1268
  ) : null,
957
- isLast ? /* @__PURE__ */ jsx(
1269
+ isLast ? /* @__PURE__ */ jsx3(
958
1270
  Button,
959
1271
  {
960
1272
  type: "button",
@@ -968,7 +1280,7 @@ function FullAskUserPromptSurface({
968
1280
  }),
969
1281
  children: labels.submitAnswers
970
1282
  }
971
- ) : /* @__PURE__ */ jsx(
1283
+ ) : /* @__PURE__ */ jsx3(
972
1284
  Button,
973
1285
  {
974
1286
  type: "button",
@@ -984,192 +1296,20 @@ function FullAskUserPromptSurface({
984
1296
  ] })
985
1297
  ] }) });
986
1298
  }
987
- function isEnterLikeKey(event) {
988
- return event.key === "Enter" || event.code === "Enter" || event.code === "NumpadEnter";
989
- }
990
- function isEditableKeyboardTarget(target) {
991
- if (!(target instanceof HTMLElement)) {
992
- return false;
993
- }
994
- const tagName = target.tagName.toLowerCase();
995
- return tagName === "input" || tagName === "textarea" || tagName === "select" || target.isContentEditable;
996
- }
997
- function approvalOptionShortcutLabel(optionIndex, isDarwin) {
998
- if (optionIndex === 0) {
999
- return translate("agentHost.agentGui.shortcutEnter");
1000
- }
1001
- if (optionIndex === 1) {
1002
- return isDarwin ? translate("agentHost.agentGui.shortcutCmdEnter") : translate("agentHost.agentGui.shortcutCtrEnter");
1003
- }
1004
- return null;
1005
- }
1006
- function isDarwinPlatform(platform) {
1007
- if (platform) {
1008
- return platform === "darwin";
1009
- }
1010
- if (typeof navigator === "undefined") {
1011
- return false;
1012
- }
1013
- const userAgentPlatform = "userAgentData" in navigator ? navigator.userAgentData?.platform : void 0;
1014
- const navigatorPlatform = userAgentPlatform ?? navigator.platform ?? "";
1015
- return /mac/i.test(navigatorPlatform);
1016
- }
1017
- function InteractiveOptionSpinner() {
1018
- "use memo";
1019
- return /* @__PURE__ */ jsx(
1020
- Spinner,
1021
- {
1022
- className: AgentGUIConversation_styles_default.interactiveOptionSpinner,
1023
- testId: "agent-interactive-option-spinner"
1024
- }
1025
- );
1026
- }
1027
- function SendFilledIcon() {
1028
- "use memo";
1029
- return /* @__PURE__ */ jsx(
1030
- "svg",
1031
- {
1032
- width: "24",
1033
- height: "24",
1034
- viewBox: "0 0 24 24",
1035
- fill: "none",
1036
- "aria-hidden": "true",
1037
- children: /* @__PURE__ */ jsx(
1038
- "path",
1039
- {
1040
- d: "M2.74311 8.80587C2.84592 8.40096 3.14571 8.08844 3.54551 7.97033L18.5197 3.51569C18.9336 3.39383 19.3809 3.5054 19.6881 3.81262C19.9951 4.11984 20.1076 4.56798 19.9857 4.9817L15.5311 19.9559C15.413 20.3557 15.1005 20.6555 14.6956 20.7583C14.2895 20.8597 13.869 20.7438 13.5721 20.4469L10.455 15.1823C10.8585 14.6483 12.1563 12.9094 14.3475 9.96528C14.6086 9.70419 14.6382 9.31168 14.4138 9.08692C14.1891 8.86221 13.796 8.8913 13.5348 9.15252L8.31088 13.0423L3.05316 9.92799C2.7562 9.63104 2.64049 9.21071 2.74311 8.80587Z",
1041
- fill: "currentColor"
1042
- }
1043
- )
1044
- }
1045
- );
1046
- }
1047
- function interactivePromptClassName(embedded) {
1048
- return embedded ? `${AgentGUIConversation_styles_default.interactivePrompt} agent-gui-conversation__interactive-prompt--embedded` : AgentGUIConversation_styles_default.interactivePrompt;
1049
- }
1050
- function interactivePromptCardClassName(edgeGlow) {
1051
- return edgeGlow ? `${AgentGUIConversation_styles_default.interactivePromptCard} agent-gui-edge-glow` : AgentGUIConversation_styles_default.interactivePromptCard;
1052
- }
1053
- function formatToolDetails(input) {
1054
- return getPromptToolDetails(input).map((detail) => ({
1055
- kind: detail.kind,
1056
- label: promptToolDetailLabel(detail.kind),
1057
- value: detail.value,
1058
- ...detail.meta ? { meta: detail.meta } : {}
1059
- }));
1060
- }
1061
- function PromptDetailValue({
1062
- detail,
1063
- previewMode
1064
- }) {
1065
- "use memo";
1066
- if (detail.kind !== "command") {
1067
- return /* @__PURE__ */ jsx("span", { className: AgentGUIConversation_styles_default.interactiveOptionDescription, children: detail.value });
1068
- }
1069
- return /* @__PURE__ */ jsx(
1070
- CommandTextWithTooltip,
1071
- {
1072
- value: detail.value,
1073
- testId: "agent-interactive-command-detail",
1074
- tooltipsEnabled: !previewMode
1075
- }
1076
- );
1077
- }
1078
- function CommandTextWithTooltip({
1079
- value,
1080
- testId,
1081
- tooltipsEnabled = true
1082
- }) {
1083
- "use memo";
1084
- const content = /* @__PURE__ */ jsx(
1085
- "span",
1086
- {
1087
- className: `${AgentGUIConversation_styles_default.interactiveOptionDescription} ${AgentGUIConversation_styles_default.interactiveOptionCommandDescription}`,
1088
- "data-agent-interactive-command-detail": testId === "agent-interactive-command-detail" ? "true" : void 0,
1089
- "data-agent-interactive-command-prefix-option": testId === "agent-interactive-command-prefix-option" ? "true" : void 0,
1090
- children: value
1091
- }
1092
- );
1093
- if (!tooltipsEnabled) {
1094
- return content;
1095
- }
1096
- return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: COMMAND_TOOLTIP_DELAY_MS, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
1097
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: content }),
1098
- /* @__PURE__ */ jsx(TooltipContent, { className: AgentGUIConversation_styles_default.interactiveOptionCommandTooltip, children: value })
1099
- ] }) });
1100
- }
1101
- function promptToolDetailLabel(kind) {
1102
- switch (kind) {
1103
- case "command":
1104
- return translate("agentHost.agentTool.details.command");
1105
- case "mcp":
1106
- return translate("agentHost.agentTool.details.mcp");
1107
- case "path":
1108
- return translate("agentHost.agentTool.details.path");
1109
- case "query":
1110
- return translate("agentHost.agentTool.details.query");
1111
- }
1112
- }
1113
- function isApprovalFeedbackOption(option) {
1114
- return isDenyApprovalOptionToken(option.id) || isDenyApprovalOptionToken(option.kind);
1115
- }
1116
- function approvalFeedbackOptionId(options) {
1117
- const explicitFeedbackOption = options.find(
1118
- (option) => isExplicitFeedbackDenyApprovalOption(option)
1119
- );
1120
- if (explicitFeedbackOption) {
1121
- return explicitFeedbackOption.id;
1122
- }
1123
- return options.find(isApprovalFeedbackOption)?.id ?? null;
1124
- }
1125
- function isExplicitFeedbackDenyApprovalOption(option) {
1126
- for (const value of [option.id, option.kind]) {
1127
- switch (normalizeApprovalOptionToken(value ?? "")) {
1128
- case "abort":
1129
- case "cancel":
1130
- case "cancelled":
1131
- case "canceled":
1132
- case "denywithfeedback":
1133
- case "rejectwithfeedback":
1134
- return true;
1135
- default:
1136
- break;
1137
- }
1138
- }
1139
- return false;
1140
- }
1141
- function isDenyApprovalOptionToken(value) {
1142
- switch (normalizeApprovalOptionToken(value ?? "")) {
1143
- case "abort":
1144
- case "cancel":
1145
- case "cancelled":
1146
- case "canceled":
1147
- case "deny":
1148
- case "denied":
1149
- case "reject":
1150
- case "rejected":
1151
- case "rejectonce":
1152
- case "disallow":
1153
- case "decline":
1154
- case "declined":
1155
- case "no":
1156
- return true;
1157
- default:
1158
- return false;
1159
- }
1160
- }
1161
- function stripPromptTitlePunctuation(value) {
1162
- return value.trim().replace(/[.。]+$/u, "");
1163
- }
1164
- function interactiveOptionLabel(label, description) {
1165
- const trimmedDescription = description?.trim();
1166
- return trimmedDescription ? `${label} ${trimmedDescription}` : label;
1167
- }
1168
1299
 
1169
1300
  export {
1301
+ useEngineSelector,
1302
+ PLAN_IMPLEMENTATION_PROMPT,
1303
+ PLAN_IMPLEMENTATION_ACTION_IMPLEMENT,
1304
+ PLAN_IMPLEMENTATION_ACTION_FEEDBACK,
1305
+ PLAN_IMPLEMENTATION_ACTION_SKIP,
1306
+ planImplementationPromptFromPlanTurn,
1307
+ latestPlanTurnId,
1308
+ selectAgentPlanPromptTurn,
1309
+ dispatchAgentPlanPromptAction,
1170
1310
  approvalOptionDisplayLabel,
1171
1311
  getPromptToolDetails,
1172
1312
  isPromptRequestIdTitle,
1173
1313
  AgentInteractivePromptSurface
1174
1314
  };
1175
- //# sourceMappingURL=chunk-MATIJPGF.js.map
1315
+ //# sourceMappingURL=chunk-XPFHJMZP.js.map