@tutti-os/agent-gui 0.0.47 → 0.0.49

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 (64) hide show
  1. package/dist/agent-conversation/index.d.ts +4 -4
  2. package/dist/agent-conversation/index.js +6 -6
  3. package/dist/agent-message-center/index.d.ts +2 -2
  4. package/dist/agent-message-center/index.js +35 -13
  5. package/dist/agent-message-center/index.js.map +1 -1
  6. package/dist/{agentConversationVM-BTMtRteS.d.ts → agentConversationVM-DSXrFL9v.d.ts} +5 -1
  7. package/dist/{agentGuiNodeTypes-B5Y6yDKy.d.ts → agentGuiNodeTypes-Bp1G8pOj.d.ts} +4 -4
  8. package/dist/app/renderer/agentactivity.css +102 -93
  9. package/dist/{chunk-7NCWSH7U.js → chunk-5HJWT6YN.js} +5 -5
  10. package/dist/{chunk-2FOBSURO.js → chunk-6KQHNUR5.js} +2 -2
  11. package/dist/{chunk-5QTC2L52.js → chunk-77UR4G7P.js} +2 -2
  12. package/dist/{chunk-HCS3HUUX.js → chunk-A2EN24OI.js} +37 -7
  13. package/dist/chunk-A2EN24OI.js.map +1 -0
  14. package/dist/{chunk-2RYZ4EBF.js → chunk-AKK7UOAS.js} +2 -2
  15. package/dist/{chunk-Q4X6Q4E6.js → chunk-AYEYXKLF.js} +2 -2
  16. package/dist/{chunk-J3SJZMI5.js → chunk-FSRS2JFR.js} +2 -2
  17. package/dist/{chunk-KACBTC7Y.js → chunk-K6SRLYC3.js} +17 -3
  18. package/dist/chunk-K6SRLYC3.js.map +1 -0
  19. package/dist/{chunk-MCH35MAX.js → chunk-Q3MOU4CD.js} +10 -6
  20. package/dist/chunk-Q3MOU4CD.js.map +1 -0
  21. package/dist/{chunk-R6GOICRO.js → chunk-QGBIGRZA.js} +56 -9
  22. package/dist/chunk-QGBIGRZA.js.map +1 -0
  23. package/dist/{chunk-XJXSR5XI.js → chunk-RJR2OZ6T.js} +125 -34
  24. package/dist/chunk-RJR2OZ6T.js.map +1 -0
  25. package/dist/{chunk-SD56WDSC.js → chunk-TG3ZXLPM.js} +42 -1
  26. package/dist/chunk-TG3ZXLPM.js.map +1 -0
  27. package/dist/{chunk-KUCWRSXU.js → chunk-TTDBLIQ3.js} +2 -2
  28. package/dist/{chunk-VE6JY2TH.js → chunk-U6JWW45G.js} +1 -1
  29. package/dist/chunk-U6JWW45G.js.map +1 -0
  30. package/dist/{chunk-ZAF4IVUT.js → chunk-XRJZCEOX.js} +462 -366
  31. package/dist/chunk-XRJZCEOX.js.map +1 -0
  32. package/dist/context-mention-palette/index.js +7 -7
  33. package/dist/i18n/index.d.ts +16 -2
  34. package/dist/i18n/index.js +2 -2
  35. package/dist/index.d.ts +290 -8
  36. package/dist/index.js +578 -830
  37. package/dist/index.js.map +1 -1
  38. package/dist/plan-decision-ops.d.ts +2 -2
  39. package/dist/queued-prompt-runtime.d.ts +4 -3
  40. package/dist/queued-prompt-runtime.js +1 -1
  41. package/dist/workbench/contribution.js +2 -2
  42. package/dist/workbench/index.js +5 -5
  43. package/dist/workbench/launch.d.ts +22 -1
  44. package/dist/workbench/launch.js +13 -3
  45. package/dist/workbench/sessionTitle.js +3 -3
  46. package/dist/workspace-agent-generated-files.d.ts +1 -1
  47. package/dist/workspace-agent-generated-files.js +3 -3
  48. package/dist/{workspaceAgentActivityListViewModel-DLnMBMoh.d.ts → workspaceAgentActivityListViewModel-B5viw5Da.d.ts} +1 -1
  49. package/package.json +12 -12
  50. package/dist/chunk-HCS3HUUX.js.map +0 -1
  51. package/dist/chunk-KACBTC7Y.js.map +0 -1
  52. package/dist/chunk-MCH35MAX.js.map +0 -1
  53. package/dist/chunk-R6GOICRO.js.map +0 -1
  54. package/dist/chunk-SD56WDSC.js.map +0 -1
  55. package/dist/chunk-VE6JY2TH.js.map +0 -1
  56. package/dist/chunk-XJXSR5XI.js.map +0 -1
  57. package/dist/chunk-ZAF4IVUT.js.map +0 -1
  58. /package/dist/{chunk-7NCWSH7U.js.map → chunk-5HJWT6YN.js.map} +0 -0
  59. /package/dist/{chunk-2FOBSURO.js.map → chunk-6KQHNUR5.js.map} +0 -0
  60. /package/dist/{chunk-5QTC2L52.js.map → chunk-77UR4G7P.js.map} +0 -0
  61. /package/dist/{chunk-2RYZ4EBF.js.map → chunk-AKK7UOAS.js.map} +0 -0
  62. /package/dist/{chunk-Q4X6Q4E6.js.map → chunk-AYEYXKLF.js.map} +0 -0
  63. /package/dist/{chunk-J3SJZMI5.js.map → chunk-FSRS2JFR.js.map} +0 -0
  64. /package/dist/{chunk-KUCWRSXU.js.map → chunk-TTDBLIQ3.js.map} +0 -0
package/dist/index.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  import {
23
23
  AgentInteractivePromptSurface,
24
24
  approvalOptionDisplayLabel
25
- } from "./chunk-HCS3HUUX.js";
25
+ } from "./chunk-A2EN24OI.js";
26
26
  import {
27
27
  PLAN_IMPLEMENTATION_ACTION_FEEDBACK,
28
28
  PLAN_IMPLEMENTATION_ACTION_IMPLEMENT,
@@ -41,7 +41,7 @@ import {
41
41
  resolveAgentGUIExplicitConversationTitle,
42
42
  resolveAgentGUIProviderDisplayLabel,
43
43
  resolveAgentGUIProviderIdentity
44
- } from "./chunk-KUCWRSXU.js";
44
+ } from "./chunk-TTDBLIQ3.js";
45
45
  import {
46
46
  AgentConversationFlow,
47
47
  Button,
@@ -60,13 +60,13 @@ import {
60
60
  skillTriggerForPrefix,
61
61
  toLocalShortDateTime,
62
62
  useProjectedAgentConversation
63
- } from "./chunk-ZAF4IVUT.js";
63
+ } from "./chunk-XRJZCEOX.js";
64
64
  import {
65
65
  AgentMessageMarkdown,
66
66
  ZoomableImage,
67
67
  cn,
68
68
  resolveWorkspaceLinkAction
69
- } from "./chunk-XJXSR5XI.js";
69
+ } from "./chunk-RJR2OZ6T.js";
70
70
  import {
71
71
  AGENT_MENTION_FILTER_TAB_ORDER,
72
72
  AgentFileMentionPalette,
@@ -74,7 +74,7 @@ import {
74
74
  DEFAULT_AGENT_MENTION_FILTER,
75
75
  agentMentionItemKey,
76
76
  preloadAgentMentionBrowse
77
- } from "./chunk-7NCWSH7U.js";
77
+ } from "./chunk-5HJWT6YN.js";
78
78
  import {
79
79
  WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN,
80
80
  buildWorkspaceAgentActivityListViewModel,
@@ -84,13 +84,13 @@ import {
84
84
  isWorkspaceAgentUntitledTask,
85
85
  mergeWorkspaceAgentActivityDurableAndOverlayMessages,
86
86
  selectWorkspaceAgentActivityOverlayMessages
87
- } from "./chunk-MCH35MAX.js";
87
+ } from "./chunk-Q3MOU4CD.js";
88
88
  import {
89
89
  MANAGED_AGENT_ICON_FALLBACK_URL,
90
90
  MANAGED_AGENT_ICON_URLS,
91
91
  Spinner,
92
92
  normalizeManagedAgentProvider
93
- } from "./chunk-Q4X6Q4E6.js";
93
+ } from "./chunk-AYEYXKLF.js";
94
94
  import {
95
95
  resolveWorkspaceAgentSessionSortTimeUnixMs
96
96
  } from "./chunk-IBIMGLCD.js";
@@ -102,7 +102,7 @@ import {
102
102
  mentionItemToAttrs,
103
103
  normalizeAgentSessionMentionTitle,
104
104
  parseMentionItemFromHref
105
- } from "./chunk-2FOBSURO.js";
105
+ } from "./chunk-6KQHNUR5.js";
106
106
  import "./chunk-Y35GDLP2.js";
107
107
  import "./chunk-LUGELG5V.js";
108
108
  import {
@@ -118,7 +118,7 @@ import {
118
118
  useAgentHostApi,
119
119
  useOptionalAgentActivityRuntime,
120
120
  useOptionalAgentHostApi
121
- } from "./chunk-VE6JY2TH.js";
121
+ } from "./chunk-U6JWW45G.js";
122
122
  import "./chunk-TYGL25EL.js";
123
123
  import "./chunk-PJP5BUU6.js";
124
124
  import {
@@ -127,15 +127,15 @@ import {
127
127
  import "./chunk-GCBDIQDX.js";
128
128
  import {
129
129
  createAgentQueuedPromptRuntime
130
- } from "./chunk-SD56WDSC.js";
130
+ } from "./chunk-TG3ZXLPM.js";
131
131
  import {
132
132
  AgentGuiI18nProvider,
133
133
  agentGuiI18nModule,
134
134
  agentGuiI18nResources,
135
135
  translate,
136
136
  useTranslation
137
- } from "./chunk-5QTC2L52.js";
138
- import "./chunk-KACBTC7Y.js";
137
+ } from "./chunk-77UR4G7P.js";
138
+ import "./chunk-K6SRLYC3.js";
139
139
 
140
140
  // shared/agentActivitySnapshotProjection.ts
141
141
  import {
@@ -301,7 +301,7 @@ import { memo as memo3 } from "react";
301
301
  import { TooltipProvider as TooltipProvider3 } from "@tutti-os/ui-system";
302
302
 
303
303
  // agent-gui/agentGuiNode/AgentGUINode.tsx
304
- import { memo as memo2, useCallback as useCallback13, useEffect as useEffect14, useMemo as useMemo11 } from "react";
304
+ import { memo as memo2, useCallback as useCallback12, useEffect as useEffect14, useMemo as useMemo11 } from "react";
305
305
  import { createWorkspaceUserProjectI18nRuntime } from "@tutti-os/workspace-user-project/i18n";
306
306
  import { createWorkspaceFileManagerI18nRuntime } from "@tutti-os/workspace-file-manager";
307
307
 
@@ -3261,6 +3261,24 @@ function normalizeOptionalWorkspaceAgentStatus(input) {
3261
3261
  }
3262
3262
  return { kind: "completed" };
3263
3263
  }
3264
+ const waitKind = waitingKindFromTokens([currentPhase, turnPhase]);
3265
+ if (waitKind) {
3266
+ return { kind: "waiting", waitKind };
3267
+ }
3268
+ if ([currentPhase, turnPhase].some((token) => WAITING_STATUS_TOKENS.has(token))) {
3269
+ return { kind: "waiting" };
3270
+ }
3271
+ if ([currentPhase, turnPhase].some((token) => WORKING_STATUS_TOKENS.has(token))) {
3272
+ return { kind: "working" };
3273
+ }
3274
+ if ([currentPhase, turnPhase].some((token) => CANCELED_STATUS_TOKENS.has(token))) {
3275
+ return { kind: "canceled" };
3276
+ }
3277
+ if ([currentPhase, turnPhase].some(
3278
+ (token) => COMPLETED_STATUS_TOKENS.has(token)
3279
+ )) {
3280
+ return { kind: "completed" };
3281
+ }
3264
3282
  if ([lifecycleStatus, effectiveStatus, sessionStatus, currentPhase].some(
3265
3283
  (token) => FAILED_STATUS_TOKENS.has(token)
3266
3284
  )) {
@@ -3276,14 +3294,14 @@ function normalizeOptionalWorkspaceAgentStatus(input) {
3276
3294
  )) {
3277
3295
  return { kind: "completed" };
3278
3296
  }
3279
- const waitKind = waitingKindFromTokens([
3297
+ const fallbackWaitKind = waitingKindFromTokens([
3280
3298
  currentPhase,
3281
3299
  turnPhase,
3282
3300
  effectiveStatus,
3283
3301
  sessionStatus
3284
3302
  ]);
3285
- if (waitKind) {
3286
- return { kind: "waiting", waitKind };
3303
+ if (fallbackWaitKind) {
3304
+ return { kind: "waiting", waitKind: fallbackWaitKind };
3287
3305
  }
3288
3306
  if ([currentPhase, turnPhase, effectiveStatus, sessionStatus].some(
3289
3307
  (token) => WAITING_STATUS_TOKENS.has(token)
@@ -6310,8 +6328,9 @@ function resolveEffectiveComposerSettings(input) {
6310
6328
  input.settings.speed
6311
6329
  ) ?? null,
6312
6330
  planMode: Boolean(input.settings.planMode),
6313
- // Browser use defaults on; preserve an explicit opt-out, default unset to on.
6331
+ // Browser/computer use default on; preserve explicit opt-outs.
6314
6332
  browserUse: input.settings.browserUse ?? true,
6333
+ computerUse: input.settings.computerUse ?? true,
6315
6334
  permissionModeId: normalizePermissionModeId(input.settings.permissionModeId)
6316
6335
  };
6317
6336
  }
@@ -6400,7 +6419,7 @@ function cloneComposerSettings(settings) {
6400
6419
  return { ...settings };
6401
6420
  }
6402
6421
  function sameComposerSettings(left, right) {
6403
- return (left?.model ?? null) === (right?.model ?? null) && (left?.reasoningEffort ?? null) === (right?.reasoningEffort ?? null) && (left?.speed ?? null) === (right?.speed ?? null) && Boolean(left?.planMode) === Boolean(right?.planMode) && (left?.browserUse ?? true) === (right?.browserUse ?? true) && (left?.permissionModeId ?? null) === (right?.permissionModeId ?? null);
6422
+ return (left?.model ?? null) === (right?.model ?? null) && (left?.reasoningEffort ?? null) === (right?.reasoningEffort ?? null) && (left?.speed ?? null) === (right?.speed ?? null) && Boolean(left?.planMode) === Boolean(right?.planMode) && (left?.browserUse ?? true) === (right?.browserUse ?? true) && (left?.computerUse ?? true) === (right?.computerUse ?? true) && (left?.permissionModeId ?? null) === (right?.permissionModeId ?? null);
6404
6423
  }
6405
6424
  function buildNodeDefaultComposerSettings(data, options) {
6406
6425
  const composerOverrides = nodeComposerOverridesForProvider(data) ?? {};
@@ -6414,6 +6433,7 @@ function buildNodeDefaultComposerSettings(data, options) {
6414
6433
  ) ?? options?.defaultSpeed ?? null,
6415
6434
  planMode: Boolean(composerOverrides.planMode),
6416
6435
  browserUse: composerOverrides.browserUse ?? true,
6436
+ computerUse: composerOverrides.computerUse ?? true,
6417
6437
  permissionModeId: normalizePermissionModeId(
6418
6438
  composerOverrides.permissionModeId
6419
6439
  )
@@ -6449,6 +6469,7 @@ function nodeDataFromComposerSettings(current, settings) {
6449
6469
  // Raw passthrough (no Boolean coercion): undefined means "default on", so
6450
6470
  // only an explicit false persists as an opt-out.
6451
6471
  browserUse: settings.browserUse,
6472
+ computerUse: settings.computerUse,
6452
6473
  permissionModeId: normalizePermissionModeId(settings.permissionModeId)
6453
6474
  };
6454
6475
  return {
@@ -6488,7 +6509,6 @@ var AGENT_PROVIDER_SESSION_NOT_FOUND_ERROR = "agent.provider_session_not_found";
6488
6509
  var AGENT_RESUME_SESSION_NOT_LOCAL_ERROR = "agent.resume_session_not_local";
6489
6510
  var AGENT_SETTINGS_REQUIRE_NEW_SESSION_ERROR = "agent.settings_require_new_session";
6490
6511
  var AGENT_SESSION_NOT_FOUND_ERROR = "session.not_found";
6491
- var AGENT_SESSION_ACTIVE_TURN_CONFLICT_MESSAGE = "agent session already has an active turn";
6492
6512
  var AGENT_PROVIDER_SESSION_NOT_FOUND_FALLBACK_MESSAGE = "The previous agent session can no longer be restored.";
6493
6513
  var AGENT_RESUME_SESSION_NOT_LOCAL_FALLBACK_MESSAGE = "The previous agent session is not available on this machine.";
6494
6514
  var AGENT_GUI_CAUGHT_ERROR_STACK_LIMIT = 4e3;
@@ -7082,10 +7102,6 @@ function buildContinueInNewConversationPrompt(input) {
7082
7102
  }
7083
7103
  return `${mention} ${existingDraftPrompt}`;
7084
7104
  }
7085
- function isAgentSessionActiveTurnConflictError(error) {
7086
- const message = getAgentGUIRawErrorMessage(error);
7087
- return message?.toLowerCase().includes(AGENT_SESSION_ACTIVE_TURN_CONFLICT_MESSAGE) ?? false;
7088
- }
7089
7105
  function resolveConversationUpdatedAtUnixMsFromSessionState(input) {
7090
7106
  if (input.source === "conversation-selected") {
7091
7107
  return input.currentUpdatedAtUnixMs;
@@ -8451,15 +8467,6 @@ function useAgentGUINodeController({
8451
8467
  );
8452
8468
  const pendingCreateOwnerKey = nodeId?.trim() ?? "";
8453
8469
  const conversationListActiveOwnerKey = pendingCreateOwnerKey || generatedControllerOwnerKey;
8454
- const queuedPromptOwnerId = conversationListActiveOwnerKey;
8455
- useEffect4(() => {
8456
- if (previewMode) {
8457
- return;
8458
- }
8459
- return () => {
8460
- agentQueuedPromptRuntime.releaseOwner(queuedPromptOwnerId);
8461
- };
8462
- }, [agentQueuedPromptRuntime, previewMode, queuedPromptOwnerId]);
8463
8470
  const resolvePendingCreateConversationId = useCallback4(
8464
8471
  () => conversationListQuery && pendingCreateOwnerKey ? getAgentGUIConversationCreatePending({
8465
8472
  query: conversationListQuery,
@@ -8508,9 +8515,6 @@ function useAgentGUINodeController({
8508
8515
  });
8509
8516
  const activeQueuedPrompts = activeQueuedPromptSnapshot?.prompts ?? EMPTY_QUEUED_PROMPTS;
8510
8517
  const activeQueuedPromptClaim = activeQueuedPromptSnapshot?.claim ?? null;
8511
- const activeFailedQueuedPromptId = activeQueuedPromptSnapshot?.failedPromptId ?? null;
8512
- const activeQueuedPromptRetryBlock = activeQueuedPromptSnapshot?.retryBlock ?? null;
8513
- const activeSendNextQueuedPromptId = activeQueuedPromptSnapshot?.sendNextPromptId ?? null;
8514
8518
  const [interruptingSessionIds, setInterruptingSessionIds] = useState4({});
8515
8519
  const [pendingInterruptSessionIds, setPendingInterruptSessionIds] = useState4({});
8516
8520
  const [
@@ -8972,6 +8976,9 @@ function useAgentGUINodeController({
8972
8976
  if (externalId === (activeConversationIdRef.current ?? "")) return;
8973
8977
  if (!externalId) {
8974
8978
  const previous = activeConversationIdRef.current;
8979
+ if (!previous && isComposerHomeRef.current && intent.tag === "home") {
8980
+ return;
8981
+ }
8975
8982
  reportAgentGUIActiveConversationCleared({
8976
8983
  details: {
8977
8984
  dataLastActiveAgentSessionId: data.lastActiveAgentSessionId ?? null,
@@ -11276,7 +11283,7 @@ function useAgentGUINodeController({
11276
11283
  });
11277
11284
  persistActiveConversation(conversation2.id);
11278
11285
  setIsLoadingMessages(true);
11279
- void refreshMessagesFromSnapshot(conversation2.id);
11286
+ void loadSelectedConversationMessages(conversation2.id);
11280
11287
  void loadSessionState(conversation2.id);
11281
11288
  void syncConversationListProjection(conversation2.id);
11282
11289
  }).catch((error) => {
@@ -11288,7 +11295,7 @@ function useAgentGUINodeController({
11288
11295
  conversationId: pendingCreateAgentSessionId ?? agentSessionId
11289
11296
  });
11290
11297
  }
11291
- const shouldShowErrorOnHome = startingConversationIdRef.current === agentSessionId || activeConversationIdRef.current === null && isComposerHomeRef.current;
11298
+ const shouldShowErrorOnHome = startingConversationIdRef.current === agentSessionId || activeConversationIdRef.current === null;
11292
11299
  const submitTrace = submitTraceBySessionIdRef.current[agentSessionId];
11293
11300
  if (submitTrace) {
11294
11301
  const nextTraces = { ...submitTraceBySessionIdRef.current };
@@ -11363,6 +11370,7 @@ function useAgentGUINodeController({
11363
11370
  isCreatingConversation,
11364
11371
  openclawGateway?.status,
11365
11372
  syncConversationListProjection,
11373
+ loadSelectedConversationMessages,
11366
11374
  loadSessionState,
11367
11375
  refreshMessagesFromSnapshot,
11368
11376
  persistActiveConversation,
@@ -11607,18 +11615,19 @@ function useAgentGUINodeController({
11607
11615
  workspaceId
11608
11616
  ]);
11609
11617
  const executePrompt = useCallback4(
11610
- (agentSessionId, content, queuedPromptId, displayPrompt, queuedPromptClaim) => {
11618
+ (agentSessionId, content, displayPrompt) => {
11611
11619
  const normalizedContent = normalizeAgentPromptContentBlocks(content);
11612
11620
  if (!agentSessionId || normalizedContent.length === 0) {
11613
11621
  return;
11614
11622
  }
11623
+ const targetIsActiveConversation = activeConversationIdRef.current === agentSessionId;
11615
11624
  const submittedPromptText = displayPrompt && displayPrompt.trim() ? displayPrompt : agentPromptContentDisplayText(normalizedContent);
11616
11625
  const submittedAtUnixMs = Date.now();
11617
11626
  const submitTrace = createAgentSubmitTraceState({
11618
11627
  agentSessionId,
11619
11628
  content: normalizedContent,
11620
11629
  prompt: submittedPromptText,
11621
- queued: queuedPromptId !== void 0,
11630
+ queued: false,
11622
11631
  startedAtUnixMs: submittedAtUnixMs
11623
11632
  });
11624
11633
  const targetConversation = resolveConversationSummaryById(
@@ -11641,7 +11650,7 @@ function useAgentGUINodeController({
11641
11650
  conversationKnown: targetConversation !== null,
11642
11651
  conversationStatus: previousConversationStatus,
11643
11652
  isComposerHome: isComposerHomeRef.current,
11644
- targetIsActiveConversation: activeConversationIdRef.current === agentSessionId,
11653
+ targetIsActiveConversation,
11645
11654
  targetMode: "existing"
11646
11655
  }
11647
11656
  });
@@ -11696,28 +11705,24 @@ function useAgentGUINodeController({
11696
11705
  trace: submitTrace,
11697
11706
  workspaceId
11698
11707
  });
11699
- let queuedPromptClaimCompleted = false;
11700
- const shouldRecordPendingOptimisticPrompt = queuedPromptId === void 0;
11701
- if (shouldRecordPendingOptimisticPrompt) {
11702
- recordLocalMessages(agentSessionId, [
11703
- createOptimisticPromptMessage({
11704
- workspaceId,
11705
- agentSessionId,
11706
- turnId: pendingOptimisticTurnId,
11707
- clientSubmitId: submitTrace.clientSubmitId,
11708
- userId: currentUserId?.trim() || "user",
11709
- prompt: submittedPromptText,
11710
- content: normalizedContent,
11711
- occurredAtUnixMs: submittedAtUnixMs
11712
- })
11713
- ]);
11714
- reportAgentSubmitTraceDiagnostic({
11715
- event: "optimistic_user_message_recorded",
11716
- runtime: agentActivityRuntime,
11717
- trace: submitTrace,
11718
- workspaceId
11719
- });
11720
- }
11708
+ recordLocalMessages(agentSessionId, [
11709
+ createOptimisticPromptMessage({
11710
+ workspaceId,
11711
+ agentSessionId,
11712
+ turnId: pendingOptimisticTurnId,
11713
+ clientSubmitId: submitTrace.clientSubmitId,
11714
+ userId: currentUserId?.trim() || "user",
11715
+ prompt: submittedPromptText,
11716
+ content: normalizedContent,
11717
+ occurredAtUnixMs: submittedAtUnixMs
11718
+ })
11719
+ ]);
11720
+ reportAgentSubmitTraceDiagnostic({
11721
+ event: "optimistic_user_message_recorded",
11722
+ runtime: agentActivityRuntime,
11723
+ trace: submitTrace,
11724
+ workspaceId
11725
+ });
11721
11726
  void Promise.resolve().then(() => {
11722
11727
  reportAgentSubmitTraceDiagnostic({
11723
11728
  event: "send_input.requested",
@@ -11777,63 +11782,30 @@ function useAgentGUINodeController({
11777
11782
  updatedAtUnixMs: Date.now()
11778
11783
  });
11779
11784
  }
11780
- if (!queuedPromptId) {
11781
- setDraftBySessionId((current) => {
11782
- const currentDraft = current[agentSessionId];
11783
- if (!shouldClearSubmittedDraft({
11784
- currentDraft,
11785
- submittedContent: normalizedContent
11786
- })) {
11787
- return current;
11788
- }
11789
- return {
11790
- ...current,
11791
- [agentSessionId]: emptyAgentComposerDraft()
11792
- };
11793
- });
11794
- }
11795
- if (queuedPromptId) {
11796
- if (queuedPromptClaim) {
11797
- queuedPromptClaimCompleted = agentQueuedPromptRuntime.completeClaim({
11798
- workspaceId,
11799
- agentSessionId,
11800
- ownerId: queuedPromptClaim.ownerId,
11801
- claimId: queuedPromptClaim.claimId
11802
- });
11785
+ setDraftBySessionId((current) => {
11786
+ const currentDraft = current[agentSessionId];
11787
+ if (!shouldClearSubmittedDraft({
11788
+ currentDraft,
11789
+ submittedContent: normalizedContent
11790
+ })) {
11791
+ return current;
11803
11792
  }
11804
- }
11793
+ return {
11794
+ ...current,
11795
+ [agentSessionId]: emptyAgentComposerDraft()
11796
+ };
11797
+ });
11805
11798
  const submittedTurnId = result.turnId.trim();
11806
11799
  if (submittedTurnId) {
11807
11800
  pendingTurnIdBySessionIdRef.current = {
11808
11801
  ...pendingTurnIdBySessionIdRef.current,
11809
11802
  [agentSessionId]: submittedTurnId
11810
11803
  };
11811
- if (shouldRecordPendingOptimisticPrompt) {
11812
- retargetOptimisticPromptTurn(
11813
- agentSessionId,
11814
- submitTrace.clientSubmitId,
11815
- submittedTurnId
11816
- );
11817
- } else {
11818
- recordLocalMessages(agentSessionId, [
11819
- createOptimisticPromptMessage({
11820
- workspaceId,
11821
- agentSessionId,
11822
- turnId: submittedTurnId,
11823
- clientSubmitId: submitTrace.clientSubmitId,
11824
- userId: currentUserId?.trim() || "user",
11825
- prompt: submittedPromptText,
11826
- content: normalizedContent,
11827
- occurredAtUnixMs: Date.now()
11828
- })
11829
- ]);
11830
- reportAgentSubmitTraceDiagnostic({
11831
- event: "optimistic_user_message_recorded",
11832
- runtime: agentActivityRuntime,
11833
- trace: submitTrace,
11834
- workspaceId
11835
- });
11836
- }
11804
+ retargetOptimisticPromptTurn(
11805
+ agentSessionId,
11806
+ submitTrace.clientSubmitId,
11807
+ submittedTurnId
11808
+ );
11837
11809
  scheduleAgentSubmitTracePaint({
11838
11810
  runtime: agentActivityRuntime,
11839
11811
  trace: submitTrace,
@@ -11851,9 +11823,7 @@ function useAgentGUINodeController({
11851
11823
  const nextTraces = { ...submitTraceBySessionIdRef.current };
11852
11824
  delete nextTraces[agentSessionId];
11853
11825
  submitTraceBySessionIdRef.current = nextTraces;
11854
- if (shouldRecordPendingOptimisticPrompt) {
11855
- removeOptimisticPrompt(agentSessionId, submitTrace.clientSubmitId);
11856
- }
11826
+ removeOptimisticPrompt(agentSessionId, submitTrace.clientSubmitId);
11857
11827
  const nextPendingTurns = { ...pendingTurnIdBySessionIdRef.current };
11858
11828
  delete nextPendingTurns[agentSessionId];
11859
11829
  pendingTurnIdBySessionIdRef.current = nextPendingTurns;
@@ -11866,14 +11836,7 @@ function useAgentGUINodeController({
11866
11836
  errorCode: getAgentGUIErrorCode(error)
11867
11837
  }
11868
11838
  });
11869
- const currentSessionState = getAgentSessionView(sessionViewRef(agentSessionId))?.controlState ?? null;
11870
- const currentConversationSummary = resolveConversationSummaryById(
11871
- conversations,
11872
- agentSessionId,
11873
- transientConversationRef.current
11874
- );
11875
- const shouldRetryQueuedPromptOnNextActivity = queuedPromptId !== void 0 && isAgentSessionActiveTurnConflictError(error);
11876
- if (!shouldRetryQueuedPromptOnNextActivity && previousConversationStatus && previousConversationStatus !== "working") {
11839
+ if (previousConversationStatus && previousConversationStatus !== "working") {
11877
11840
  patchConversation(
11878
11841
  agentSessionId,
11879
11842
  (conversation2) => conversation2.status === "working" ? {
@@ -11890,13 +11853,9 @@ function useAgentGUINodeController({
11890
11853
  });
11891
11854
  }
11892
11855
  }
11893
- if (isCurrentConversation(agentSessionId) && !shouldRetryQueuedPromptOnNextActivity) {
11856
+ if (isCurrentConversation(agentSessionId)) {
11894
11857
  reportAgentGUIRuntimeError({
11895
11858
  agentSessionId,
11896
- context: {
11897
- queuedPrompt: queuedPromptId !== void 0,
11898
- retryQueuedPromptOnNextActivity: shouldRetryQueuedPromptOnNextActivity
11899
- },
11900
11859
  error,
11901
11860
  phase: "send_prompt",
11902
11861
  provider: dataRef.current.provider,
@@ -11905,25 +11864,6 @@ function useAgentGUINodeController({
11905
11864
  });
11906
11865
  setDetailError(getAgentGUIErrorMessage(error));
11907
11866
  }
11908
- if (queuedPromptId) {
11909
- if (shouldRetryQueuedPromptOnNextActivity) {
11910
- agentQueuedPromptRuntime.setRetryBlock({
11911
- workspaceId,
11912
- agentSessionId,
11913
- retryBlock: {
11914
- queuedPromptId,
11915
- sessionStateUpdatedAtUnixMs: currentSessionState?.updatedAtUnixMs ?? null,
11916
- conversationUpdatedAtUnixMs: currentConversationSummary?.updatedAtUnixMs ?? null
11917
- }
11918
- });
11919
- } else {
11920
- agentQueuedPromptRuntime.markPromptFailed({
11921
- workspaceId,
11922
- agentSessionId,
11923
- promptId: queuedPromptId
11924
- });
11925
- }
11926
- }
11927
11867
  }).finally(() => {
11928
11868
  if (conversationListQuery) {
11929
11869
  clearAgentGUIConversationSubmitPending({
@@ -11932,22 +11872,12 @@ function useAgentGUINodeController({
11932
11872
  });
11933
11873
  }
11934
11874
  setLocalIsSubmitting(false);
11935
- if (queuedPromptClaim && !queuedPromptClaimCompleted) {
11936
- agentQueuedPromptRuntime.releaseClaim({
11937
- workspaceId,
11938
- agentSessionId,
11939
- ownerId: queuedPromptClaim.ownerId,
11940
- claimId: queuedPromptClaim.claimId
11941
- });
11942
- }
11943
11875
  });
11944
11876
  },
11945
11877
  [
11946
- agentQueuedPromptRuntime,
11947
11878
  currentUserId,
11948
11879
  isCurrentConversation,
11949
11880
  applyStatePatch,
11950
- conversations,
11951
11881
  conversationListQuery,
11952
11882
  syncConversationListProjection,
11953
11883
  loadSessionState,
@@ -12045,12 +11975,7 @@ function useAgentGUINodeController({
12045
11975
  );
12046
11976
  return;
12047
11977
  }
12048
- executePrompt(
12049
- agentSessionId,
12050
- normalizedContent,
12051
- void 0,
12052
- displayPromptText
12053
- );
11978
+ executePrompt(agentSessionId, normalizedContent, displayPromptText);
12054
11979
  },
12055
11980
  [
12056
11981
  activation,
@@ -12202,7 +12127,6 @@ function useAgentGUINodeController({
12202
12127
  }
12203
12128
  setIsRespondingApproval(true);
12204
12129
  setDetailError(null);
12205
- const submittedPrompt = activePendingPromptRef.current;
12206
12130
  void Promise.resolve().then(() => {
12207
12131
  if (!isCurrentConversation(agentSessionId)) {
12208
12132
  return null;
@@ -12219,12 +12143,6 @@ function useAgentGUINodeController({
12219
12143
  if (!result || !isCurrentConversation(agentSessionId)) {
12220
12144
  return;
12221
12145
  }
12222
- if (submittedPrompt?.requestId === normalizedRequestId && submittedPrompt.kind === "exit-plan" && input.action === "allow") {
12223
- updateComposerSettingsRef.current({
12224
- planMode: false,
12225
- ...normalizedOptionId ? { permissionModeId: normalizedOptionId } : {}
12226
- });
12227
- }
12228
12146
  void refreshMessagesFromSnapshot(agentSessionId);
12229
12147
  void loadSessionState(agentSessionId);
12230
12148
  void syncConversationListProjection(agentSessionId);
@@ -12704,155 +12622,6 @@ function useAgentGUINodeController({
12704
12622
  feedback: submitPlanFeedback,
12705
12623
  skip: dismissPlanImplementation
12706
12624
  };
12707
- useEffect4(() => {
12708
- if (previewMode) {
12709
- return;
12710
- }
12711
- if (!activeConversationId) {
12712
- return;
12713
- }
12714
- const queuedPrompt = activeQueuedPrompts[0] ?? null;
12715
- const activeSessionState2 = getAgentSessionView(sessionViewRef(activeConversationId))?.controlState ?? null;
12716
- const activeConversationSummary = resolveConversationSummaryById(
12717
- conversations,
12718
- activeConversationId,
12719
- transientConversationRef.current
12720
- );
12721
- const blockedByStaleActiveTurnConflict = queuedPrompt !== null && activeQueuedPromptRetryBlock?.queuedPromptId === queuedPrompt.id && activeQueuedPromptRetryBlock.sessionStateUpdatedAtUnixMs === (activeSessionState2?.updatedAtUnixMs ?? null) && activeQueuedPromptRetryBlock.conversationUpdatedAtUnixMs === (activeConversationSummary?.updatedAtUnixMs ?? null);
12722
- const canDrainQueuedPrompt = queuedPrompt !== null && queuedPrompt.id !== activeFailedQueuedPromptId && !blockedByStaleActiveTurnConflict && activeQueuedPromptClaim === null && !isSubmitting && !isRespondingApproval && !activeSessionState2?.pendingInteractive && !agentActivityDisplayStatusBusy(
12723
- agentActivityDisplayStatuses.get(activeConversationId)
12724
- );
12725
- if (!canDrainQueuedPrompt) {
12726
- return;
12727
- }
12728
- const claimResult = agentQueuedPromptRuntime.claimNextToDrain({
12729
- workspaceId,
12730
- agentSessionId: activeConversationId,
12731
- ownerId: queuedPromptOwnerId
12732
- });
12733
- if (!claimResult) {
12734
- return;
12735
- }
12736
- executePrompt(
12737
- activeConversationId,
12738
- claimResult.prompt.content,
12739
- claimResult.prompt.id,
12740
- claimResult.prompt.displayPrompt,
12741
- claimResult.claim
12742
- );
12743
- }, [
12744
- activeConversationId,
12745
- activeFailedQueuedPromptId,
12746
- activeQueuedPromptClaim,
12747
- activeQueuedPromptRetryBlock,
12748
- activeQueuedPrompts,
12749
- agentQueuedPromptRuntime,
12750
- agentActivityDisplayStatuses,
12751
- conversations,
12752
- executePrompt,
12753
- isRespondingApproval,
12754
- isSubmitting,
12755
- previewMode,
12756
- queuedPromptOwnerId,
12757
- workspaceId
12758
- ]);
12759
- useEffect4(() => {
12760
- if (previewMode) {
12761
- return;
12762
- }
12763
- if (!activeConversationId) {
12764
- return;
12765
- }
12766
- if (!activeSendNextQueuedPromptId || activeQueuedPrompts[0]?.id !== activeSendNextQueuedPromptId) {
12767
- return;
12768
- }
12769
- const activeSessionState2 = getAgentSessionView(sessionViewRef(activeConversationId))?.controlState ?? null;
12770
- const activeConversationSummary = resolveConversationSummaryById(
12771
- conversations,
12772
- activeConversationId,
12773
- transientConversationRef.current
12774
- );
12775
- const activeActivityDisplayStatus2 = agentActivityDisplayStatuses.get(activeConversationId) ?? null;
12776
- const shouldInterrupt = activeQueuedPromptClaim === null && !isSubmitting && activeActivityDisplayStatus2 === "working";
12777
- if (!shouldInterrupt || interruptingSessionIds[activeConversationId]) {
12778
- return;
12779
- }
12780
- setInterruptingSessionIds((current) => ({
12781
- ...current,
12782
- [activeConversationId]: true
12783
- }));
12784
- setDetailError(null);
12785
- void Promise.resolve().then(() => {
12786
- if (!isCurrentConversation(activeConversationId)) {
12787
- return null;
12788
- }
12789
- return agentActivityRuntime.cancelSession({
12790
- workspaceId,
12791
- agentSessionId: activeConversationId
12792
- });
12793
- }).then((result) => {
12794
- if (!result || !isCurrentConversation(activeConversationId)) {
12795
- return;
12796
- }
12797
- reportAgentGUICancelDiagnostic({
12798
- agentSessionId: activeConversationId,
12799
- busySource: cancelBusySource({
12800
- conversationStatus: activeConversationSummary?.status ?? null,
12801
- hasActivePrompt: false,
12802
- runtimeSessionStatus: runtimeSessionsBySessionId.get(activeConversationId)?.status ?? null,
12803
- sessionStateStatus: activeSessionState2?.status ?? null
12804
- }),
12805
- currentSessionStatus: activeSessionState2?.status ?? null,
12806
- phase: "drain_queued_prompt_interrupt",
12807
- provider: dataRef.current.provider,
12808
- result,
12809
- runtime: agentActivityRuntime,
12810
- workspaceId
12811
- });
12812
- void refreshMessagesFromSnapshot(activeConversationId);
12813
- void loadSessionState(activeConversationId);
12814
- void syncConversationListProjection(activeConversationId);
12815
- }).catch((error) => {
12816
- if (isCurrentConversation(activeConversationId)) {
12817
- reportAgentGUIRuntimeError({
12818
- agentSessionId: activeConversationId,
12819
- error,
12820
- phase: "drain_queued_prompt_interrupt",
12821
- provider: dataRef.current.provider,
12822
- runtime: agentActivityRuntime,
12823
- workspaceId
12824
- });
12825
- setDetailError(getAgentGUIErrorMessage(error));
12826
- }
12827
- }).finally(() => {
12828
- setInterruptingSessionIds((current) => {
12829
- if (!current[activeConversationId]) {
12830
- return current;
12831
- }
12832
- const next = { ...current };
12833
- delete next[activeConversationId];
12834
- return next;
12835
- });
12836
- });
12837
- }, [
12838
- activeConversationId,
12839
- activeQueuedPromptClaim,
12840
- activeQueuedPrompts,
12841
- activeSendNextQueuedPromptId,
12842
- agentActivityDisplayStatuses,
12843
- conversations,
12844
- interruptingSessionIds,
12845
- isCurrentConversation,
12846
- isSubmitting,
12847
- syncConversationListProjection,
12848
- loadSessionState,
12849
- refreshMessagesFromSnapshot,
12850
- previewMode,
12851
- runtimeSessionsBySessionId,
12852
- workspaceId,
12853
- sessionViewRef,
12854
- agentActivityRuntime
12855
- ]);
12856
12625
  const requestDeleteConversation = useCallback4(
12857
12626
  (agentSessionId) => {
12858
12627
  const normalized = agentSessionId.trim();
@@ -14282,7 +14051,10 @@ function interactivePromptFromSessionState(state) {
14282
14051
  return {
14283
14052
  kind: "exit-plan",
14284
14053
  requestId: prompt.requestId.trim(),
14285
- title: prompt.toolName?.trim() || "Exit plan mode"
14054
+ title: prompt.toolName?.trim() || "Exit plan mode",
14055
+ // Legacy exitplanmode session-state prompt carries no runtime mode
14056
+ // options; the surface falls back to the curated default list.
14057
+ options: []
14286
14058
  };
14287
14059
  }
14288
14060
  if (toolName !== "askuserquestion") {
@@ -14384,12 +14156,12 @@ function normalizeInteractiveQuestions(value) {
14384
14156
  import {
14385
14157
  Fragment as Fragment7,
14386
14158
  memo,
14387
- useCallback as useCallback11,
14159
+ useCallback as useCallback10,
14388
14160
  useEffect as useEffect12,
14389
- useLayoutEffect as useLayoutEffect5,
14161
+ useLayoutEffect as useLayoutEffect4,
14390
14162
  useMemo as useMemo10,
14391
- useRef as useRef13,
14392
- useState as useState12
14163
+ useRef as useRef12,
14164
+ useState as useState11
14393
14165
  } from "react";
14394
14166
  import { useSnapshot } from "valtio";
14395
14167
  import { proxy as proxy2 } from "valtio/vanilla";
@@ -14969,12 +14741,6 @@ function isTaskSearchImeComposing(event) {
14969
14741
  }
14970
14742
 
14971
14743
  // agent-gui/agentGuiNode/AgentSessionChrome.tsx
14972
- import {
14973
- useCallback as useCallback6,
14974
- useLayoutEffect,
14975
- useRef as useRef6,
14976
- useState as useState5
14977
- } from "react";
14978
14744
  import { Button as Button2 } from "@tutti-os/ui-system";
14979
14745
 
14980
14746
  // app/renderer/components/icons/CastIcon.tsx
@@ -15118,8 +14884,14 @@ var CastIcon = forwardRef2(
15118
14884
  );
15119
14885
  CastIcon.displayName = "CastIcon";
15120
14886
 
15121
- // agent-gui/agentGuiNode/AgentSessionChrome.tsx
15122
- import { ChevronDown } from "lucide-react";
14887
+ // app/renderer/components/ui/tooltip.tsx
14888
+ import {
14889
+ Tooltip,
14890
+ TooltipContent,
14891
+ TooltipPortal,
14892
+ TooltipProvider,
14893
+ TooltipTrigger
14894
+ } from "@tutti-os/ui-system";
15123
14895
 
15124
14896
  // agent-gui/agentGuiNode/AgentGUIChrome.styles.ts
15125
14897
  var styles2 = {
@@ -15131,8 +14903,8 @@ var styles2 = {
15131
14903
  chromeCardConnecting: "agent-gui-chrome__card--connecting",
15132
14904
  chromeCardDanger: "agent-gui-chrome__card--danger",
15133
14905
  chromeIcon: "agent-gui-chrome__icon",
15134
- chromeExpandCue: "agent-gui-chrome__expand-cue",
15135
14906
  chromeMessageSlot: "agent-gui-chrome__message-slot",
14907
+ chromeMessageTooltip: "agent-gui-chrome__message-tooltip",
15136
14908
  chromeInlineActions: "agent-gui-chrome__inline-actions",
15137
14909
  chromeNoticeDescription: "agent-gui-chrome__notice-description",
15138
14910
  chromeNoticeMessage: "agent-gui-chrome__notice-message",
@@ -15166,6 +14938,24 @@ function LoadingEllipsis() {
15166
14938
  /* @__PURE__ */ jsx19("span", {})
15167
14939
  ] });
15168
14940
  }
14941
+ function ChromeMessageTooltip({
14942
+ message,
14943
+ children
14944
+ }) {
14945
+ "use memo";
14946
+ return /* @__PURE__ */ jsx19(TooltipProvider, { delayDuration: 250, children: /* @__PURE__ */ jsxs7(Tooltip, { children: [
14947
+ /* @__PURE__ */ jsx19(TooltipTrigger, { asChild: true, children }),
14948
+ /* @__PURE__ */ jsx19(
14949
+ TooltipContent,
14950
+ {
14951
+ className: AgentGUIChrome_styles_default.chromeMessageTooltip,
14952
+ side: "top",
14953
+ sideOffset: 6,
14954
+ children: message
14955
+ }
14956
+ )
14957
+ ] }) });
14958
+ }
15169
14959
  function AgentChromeNotice({
15170
14960
  tone,
15171
14961
  title,
@@ -15183,8 +14973,6 @@ function AgentChromeNotice({
15183
14973
  AgentGUIChrome_styles_default.chromeCard,
15184
14974
  tone === "danger" ? AgentGUIChrome_styles_default.chromeCardDanger : AgentGUIChrome_styles_default.chromeCardWarning
15185
14975
  ),
15186
- "data-expandable": "false",
15187
- "data-expanded": "false",
15188
14976
  role,
15189
14977
  "data-testid": testId,
15190
14978
  children: /* @__PURE__ */ jsx19("div", { className: AgentGUIChrome_styles_default.chromeMetaRow, children: /* @__PURE__ */ jsxs7("div", { className: AgentGUIChrome_styles_default.chromeMessageSlot, children: [
@@ -15204,44 +14992,6 @@ function AgentChromeNotice({
15204
14992
  }
15205
14993
  ) });
15206
14994
  }
15207
- var compactChromeCardHeightPx = 36;
15208
- var chromeCardExpandedHeightProperty = "--agent-gui-chrome-card-expanded-height";
15209
- function hasElementOverflow(element) {
15210
- if (!element) {
15211
- return false;
15212
- }
15213
- return element.scrollWidth > element.clientWidth + 1 || element.scrollHeight > element.clientHeight + 1;
15214
- }
15215
- function areCardSetsEqual(left, right) {
15216
- if (left.size !== right.size) {
15217
- return false;
15218
- }
15219
- for (const card of left) {
15220
- if (!right.has(card)) {
15221
- return false;
15222
- }
15223
- }
15224
- return true;
15225
- }
15226
- function parseCssPixelValue(value) {
15227
- const parsedValue = Number.parseFloat(value);
15228
- return Number.isFinite(parsedValue) ? parsedValue : 0;
15229
- }
15230
- function measureExpandedChromeCardHeight(element) {
15231
- if (!element || element.dataset.expanded !== "true") {
15232
- return;
15233
- }
15234
- const computedStyle = window.getComputedStyle(element);
15235
- const borderBlockPx = parseCssPixelValue(computedStyle.borderTopWidth) + parseCssPixelValue(computedStyle.borderBottomWidth);
15236
- const measuredHeightPx = Math.max(
15237
- compactChromeCardHeightPx,
15238
- Math.ceil(element.scrollHeight + borderBlockPx)
15239
- );
15240
- const nextHeight = `${measuredHeightPx}px`;
15241
- if (element.style.getPropertyValue(chromeCardExpandedHeightProperty) !== nextHeight) {
15242
- element.style.setProperty(chromeCardExpandedHeightProperty, nextHeight);
15243
- }
15244
- }
15245
14995
  function AgentSessionChrome({
15246
14996
  chrome,
15247
14997
  isRespondingApproval,
@@ -15252,163 +15002,41 @@ function AgentSessionChrome({
15252
15002
  labels
15253
15003
  }) {
15254
15004
  "use memo";
15255
- const [expandedCards, setExpandedCards] = useState5(() => /* @__PURE__ */ new Set());
15256
- const [expandableCards, setExpandableCards] = useState5(() => /* @__PURE__ */ new Set());
15257
- const expandedCardsRef = useRef6(expandedCards);
15258
- expandedCardsRef.current = expandedCards;
15259
- const authCardRef = useRef6(null);
15260
- const recoveryCardRef = useRef6(null);
15261
- const authMessageRef = useRef6(null);
15262
- const recoveryMessageRef = useRef6(null);
15263
15005
  const visibleAuth = chrome.recovery?.kind === "activating" ? null : chrome.auth;
15264
15006
  const visibleRecovery = chrome.recovery;
15265
15007
  const recoveryMessage = visibleRecovery?.kind === "activating" ? labels.activatingSession : visibleRecovery?.message ?? "";
15266
15008
  const recoveryHasInlineAction = visibleRecovery?.kind === "failed" && (visibleRecovery.followupAction === "continue-in-new-conversation" || visibleRecovery.canRetry !== false);
15267
15009
  const activatingMessage = splitTrailingEllipsis(recoveryMessage);
15268
- const measureExpandableCards = useCallback6(() => {
15269
- const nextExpandableCards = /* @__PURE__ */ new Set();
15270
- if (expandedCardsRef.current.has("auth") || hasElementOverflow(authMessageRef.current)) {
15271
- nextExpandableCards.add("auth");
15272
- }
15273
- if (expandedCardsRef.current.has("recovery") || hasElementOverflow(recoveryMessageRef.current)) {
15274
- nextExpandableCards.add("recovery");
15275
- }
15276
- setExpandableCards(
15277
- (current) => areCardSetsEqual(current, nextExpandableCards) ? current : nextExpandableCards
15278
- );
15279
- setExpandedCards((current) => {
15280
- const nextExpandedCards = new Set(
15281
- [...current].filter((card) => nextExpandableCards.has(card))
15282
- );
15283
- return areCardSetsEqual(current, nextExpandedCards) ? current : nextExpandedCards;
15284
- });
15285
- }, []);
15286
- const measureChromeLayout = useCallback6(() => {
15287
- measureExpandedChromeCardHeight(authCardRef.current);
15288
- measureExpandedChromeCardHeight(recoveryCardRef.current);
15289
- measureExpandableCards();
15290
- }, [measureExpandableCards]);
15291
- useLayoutEffect(() => {
15292
- measureChromeLayout();
15293
- const ResizeObserverConstructor = window.ResizeObserver;
15294
- if (ResizeObserverConstructor) {
15295
- const resizeObserver = new ResizeObserverConstructor(measureChromeLayout);
15296
- for (const element of [
15297
- authCardRef.current,
15298
- recoveryCardRef.current,
15299
- authMessageRef.current,
15300
- recoveryMessageRef.current
15301
- ]) {
15302
- if (element) {
15303
- resizeObserver.observe(element);
15304
- if (element.parentElement) {
15305
- resizeObserver.observe(element.parentElement);
15306
- }
15307
- }
15308
- }
15309
- return () => resizeObserver.disconnect();
15310
- }
15311
- window.addEventListener("resize", measureChromeLayout);
15312
- return () => window.removeEventListener("resize", measureChromeLayout);
15313
- }, [
15314
- expandedCards,
15315
- visibleAuth?.message,
15316
- measureChromeLayout,
15317
- recoveryMessage
15318
- ]);
15319
15010
  const hasContent = visibleAuth !== null || chrome.approval !== null || visibleRecovery !== null;
15320
15011
  if (!hasContent) {
15321
15012
  return null;
15322
15013
  }
15323
- const toggleExpandedCard = (card) => {
15324
- if (!expandableCards.has(card)) {
15325
- return;
15326
- }
15327
- setExpandedCards((current) => {
15328
- const next = new Set(current);
15329
- if (next.has(card)) {
15330
- next.delete(card);
15331
- } else {
15332
- next.add(card);
15333
- }
15334
- return next;
15335
- });
15336
- };
15337
- const handleExpandableCardKeyDown = (card) => (event) => {
15338
- if (event.key !== "Enter" && event.key !== " ") {
15339
- return;
15340
- }
15341
- event.preventDefault();
15342
- toggleExpandedCard(card);
15343
- };
15344
- const stopCardToggle = (event) => {
15345
- event.stopPropagation();
15346
- };
15347
15014
  return /* @__PURE__ */ jsxs7("div", { className: AgentGUIChrome_styles_default.sessionChrome, children: [
15348
- visibleAuth ? /* @__PURE__ */ jsx19(
15349
- "section",
15350
- {
15351
- ref: authCardRef,
15352
- className: cn(AgentGUIChrome_styles_default.chromeCard, AgentGUIChrome_styles_default.chromeCardWarning),
15353
- "data-expandable": expandableCards.has("auth") ? "true" : "false",
15354
- "data-expanded": expandedCards.has("auth") && expandableCards.has("auth") ? "true" : "false",
15355
- tabIndex: expandableCards.has("auth") ? 0 : void 0,
15356
- onClick: () => toggleExpandedCard("auth"),
15357
- onKeyDown: handleExpandableCardKeyDown("auth"),
15358
- children: /* @__PURE__ */ jsxs7("div", { className: AgentGUIChrome_styles_default.chromeMetaRow, children: [
15359
- /* @__PURE__ */ jsxs7("div", { className: AgentGUIChrome_styles_default.chromeMessageSlot, children: [
15360
- /* @__PURE__ */ jsx19(
15361
- "p",
15362
- {
15363
- ref: authMessageRef,
15364
- className: AgentGUIChrome_styles_default.chromeMessage,
15365
- title: visibleAuth.message,
15366
- children: visibleAuth.message
15367
- }
15368
- ),
15369
- /* @__PURE__ */ jsx19(
15370
- ChevronDown,
15371
- {
15372
- "aria-hidden": "true",
15373
- className: AgentGUIChrome_styles_default.chromeExpandCue,
15374
- "data-visible": expandableCards.has("auth") ? "true" : "false",
15375
- "data-testid": "agent-session-chrome-auth-expand-cue",
15376
- size: 16,
15377
- strokeWidth: 2
15378
- }
15379
- )
15380
- ] }),
15381
- /* @__PURE__ */ jsxs7("div", { className: AgentGUIChrome_styles_default.chromeInlineActions, children: [
15382
- onAuthLogin ? /* @__PURE__ */ jsx19(
15383
- Button2,
15384
- {
15385
- type: "button",
15386
- variant: "ghost",
15387
- size: "sm",
15388
- onClick: (event) => {
15389
- stopCardToggle(event);
15390
- onAuthLogin();
15391
- },
15392
- children: labels.authLogin ?? labels.retryActivation
15393
- }
15394
- ) : null,
15395
- /* @__PURE__ */ jsx19(
15396
- Button2,
15397
- {
15398
- type: "button",
15399
- variant: "ghost",
15400
- size: "sm",
15401
- onClick: (event) => {
15402
- stopCardToggle(event);
15403
- onRetryActivation();
15404
- },
15405
- children: labels.retryActivation
15406
- }
15407
- )
15408
- ] })
15409
- ] })
15410
- }
15411
- ) : null,
15015
+ visibleAuth ? /* @__PURE__ */ jsx19("section", { className: cn(AgentGUIChrome_styles_default.chromeCard, AgentGUIChrome_styles_default.chromeCardWarning), children: /* @__PURE__ */ jsxs7("div", { className: AgentGUIChrome_styles_default.chromeMetaRow, children: [
15016
+ /* @__PURE__ */ jsx19("div", { className: AgentGUIChrome_styles_default.chromeMessageSlot, children: /* @__PURE__ */ jsx19(ChromeMessageTooltip, { message: visibleAuth.message, children: /* @__PURE__ */ jsx19("p", { className: AgentGUIChrome_styles_default.chromeMessage, tabIndex: 0, children: visibleAuth.message }) }) }),
15017
+ /* @__PURE__ */ jsxs7("div", { className: AgentGUIChrome_styles_default.chromeInlineActions, children: [
15018
+ onAuthLogin ? /* @__PURE__ */ jsx19(
15019
+ Button2,
15020
+ {
15021
+ type: "button",
15022
+ variant: "ghost",
15023
+ size: "sm",
15024
+ onClick: () => onAuthLogin(),
15025
+ children: labels.authLogin ?? labels.retryActivation
15026
+ }
15027
+ ) : null,
15028
+ /* @__PURE__ */ jsx19(
15029
+ Button2,
15030
+ {
15031
+ type: "button",
15032
+ variant: "ghost",
15033
+ size: "sm",
15034
+ onClick: () => onRetryActivation(),
15035
+ children: labels.retryActivation
15036
+ }
15037
+ )
15038
+ ] })
15039
+ ] }) }) : null,
15412
15040
  chrome.approval ? /* @__PURE__ */ jsxs7("section", { className: cn(AgentGUIChrome_styles_default.chromeCard, AgentGUIChrome_styles_default.chromeCardAction), children: [
15413
15041
  /* @__PURE__ */ jsx19("div", { className: AgentGUIChrome_styles_default.chromeTitle, children: labels.approvalRequired }),
15414
15042
  /* @__PURE__ */ jsx19("p", { className: AgentGUIChrome_styles_default.chromeMessage, children: chrome.approval.title }),
@@ -15429,19 +15057,13 @@ function AgentSessionChrome({
15429
15057
  visibleRecovery ? /* @__PURE__ */ jsx19(
15430
15058
  "section",
15431
15059
  {
15432
- ref: recoveryCardRef,
15433
15060
  role: visibleRecovery.kind === "failed" ? "alert" : void 0,
15434
15061
  "aria-live": visibleRecovery.kind === "failed" ? "assertive" : void 0,
15435
- "data-expandable": expandableCards.has("recovery") ? "true" : "false",
15436
- "data-expanded": expandedCards.has("recovery") && expandableCards.has("recovery") ? "true" : "false",
15437
15062
  "data-has-inline-actions": recoveryHasInlineAction ? "true" : "false",
15438
- tabIndex: expandableCards.has("recovery") ? 0 : void 0,
15439
15063
  className: cn(
15440
15064
  AgentGUIChrome_styles_default.chromeCard,
15441
15065
  visibleRecovery.kind === "failed" ? AgentGUIChrome_styles_default.chromeCardDanger : visibleRecovery.kind === "warning" ? AgentGUIChrome_styles_default.chromeCardDanger : visibleRecovery.kind === "activating" ? AgentGUIChrome_styles_default.chromeCardConnecting : AgentGUIChrome_styles_default.chromeCardMuted
15442
15066
  ),
15443
- onClick: () => toggleExpandedCard("recovery"),
15444
- onKeyDown: handleExpandableCardKeyDown("recovery"),
15445
15067
  children: /* @__PURE__ */ jsxs7("div", { className: AgentGUIChrome_styles_default.chromeMetaRow, children: [
15446
15068
  /* @__PURE__ */ jsxs7("div", { className: AgentGUIChrome_styles_default.chromeMessageSlot, children: [
15447
15069
  visibleRecovery.kind === "activating" ? /* @__PURE__ */ jsx19(
@@ -15454,30 +15076,18 @@ function AgentSessionChrome({
15454
15076
  size: 16
15455
15077
  }
15456
15078
  ) : null,
15457
- /* @__PURE__ */ jsx19(
15079
+ /* @__PURE__ */ jsx19(ChromeMessageTooltip, { message: recoveryMessage, children: /* @__PURE__ */ jsx19(
15458
15080
  "p",
15459
15081
  {
15460
- ref: recoveryMessageRef,
15461
15082
  className: AgentGUIChrome_styles_default.chromeMessage,
15462
15083
  "aria-label": visibleRecovery.kind === "activating" ? recoveryMessage : void 0,
15463
- title: recoveryMessage,
15084
+ tabIndex: 0,
15464
15085
  children: visibleRecovery.kind === "activating" ? /* @__PURE__ */ jsxs7(Fragment2, { children: [
15465
15086
  /* @__PURE__ */ jsx19("span", { className: "tsh-inline-loading-label", children: activatingMessage.label }),
15466
15087
  activatingMessage.ellipsis ? /* @__PURE__ */ jsx19(LoadingEllipsis, {}) : null
15467
15088
  ] }) : recoveryMessage
15468
15089
  }
15469
- ),
15470
- /* @__PURE__ */ jsx19(
15471
- ChevronDown,
15472
- {
15473
- "aria-hidden": "true",
15474
- className: AgentGUIChrome_styles_default.chromeExpandCue,
15475
- "data-visible": expandableCards.has("recovery") ? "true" : "false",
15476
- "data-testid": "agent-session-chrome-recovery-expand-cue",
15477
- size: 16,
15478
- strokeWidth: 2
15479
- }
15480
- )
15090
+ ) })
15481
15091
  ] }),
15482
15092
  /* @__PURE__ */ jsx19("div", { className: AgentGUIChrome_styles_default.chromeInlineActions, children: visibleRecovery.kind === "failed" && visibleRecovery.followupAction === "continue-in-new-conversation" ? /* @__PURE__ */ jsx19(
15483
15093
  Button2,
@@ -15486,10 +15096,7 @@ function AgentSessionChrome({
15486
15096
  variant: "ghost",
15487
15097
  size: "sm",
15488
15098
  className: AgentGUIChrome_styles_default.chromeDangerGhostButton,
15489
- onClick: (event) => {
15490
- stopCardToggle(event);
15491
- onContinueInNewConversation();
15492
- },
15099
+ onClick: () => onContinueInNewConversation(),
15493
15100
  children: labels.continueInNewConversation
15494
15101
  }
15495
15102
  ) : visibleRecovery.kind === "failed" && visibleRecovery.canRetry !== false ? /* @__PURE__ */ jsx19(
@@ -15499,10 +15106,7 @@ function AgentSessionChrome({
15499
15106
  variant: "ghost",
15500
15107
  size: "sm",
15501
15108
  className: AgentGUIChrome_styles_default.chromeDangerGhostButton,
15502
- onClick: (event) => {
15503
- stopCardToggle(event);
15504
- onRetryActivation();
15505
- },
15109
+ onClick: () => onRetryActivation(),
15506
15110
  children: labels.retryActivation
15507
15111
  }
15508
15112
  ) : null })
@@ -15572,8 +15176,6 @@ function AgentGoalBanner({
15572
15176
  "section",
15573
15177
  {
15574
15178
  className: cn(AgentGUIChrome_styles_default.chromeCard, AgentGUIChrome_styles_default.chromeCardMuted),
15575
- "data-expandable": "false",
15576
- "data-expanded": "false",
15577
15179
  role: "status",
15578
15180
  "data-testid": "agent-gui-goal-banner",
15579
15181
  children: /* @__PURE__ */ jsxs8("div", { className: AgentGUIChrome_styles_default.chromeMetaRow, children: [
@@ -15606,25 +15208,14 @@ function AgentGoalBanner({
15606
15208
 
15607
15209
  // agent-gui/agentGuiNode/AgentComposer.tsx
15608
15210
  import {
15609
- useCallback as useCallback10,
15211
+ useCallback as useCallback9,
15610
15212
  useEffect as useEffect11,
15611
- useLayoutEffect as useLayoutEffect4,
15213
+ useLayoutEffect as useLayoutEffect3,
15612
15214
  useMemo as useMemo9,
15613
- useRef as useRef12,
15614
- useState as useState11
15215
+ useRef as useRef11,
15216
+ useState as useState10
15615
15217
  } from "react";
15616
15218
  import { createPortal as createPortal3 } from "react-dom";
15617
-
15618
- // app/renderer/components/ui/tooltip.tsx
15619
- import {
15620
- Tooltip,
15621
- TooltipContent,
15622
- TooltipPortal,
15623
- TooltipProvider,
15624
- TooltipTrigger
15625
- } from "@tutti-os/ui-system";
15626
-
15627
- // agent-gui/agentGuiNode/AgentComposer.tsx
15628
15219
  import { AddIcon, Button as Button3, Select as Select2, SelectTrigger as SelectTrigger2 } from "@tutti-os/ui-system";
15629
15220
  import { ListChecks as ListChecks2, Target as Target3, X } from "lucide-react";
15630
15221
  import {
@@ -16068,7 +15659,7 @@ function filterUnavailableSlashCommands(commands, input) {
16068
15659
  }
16069
15660
 
16070
15661
  // agent-gui/agentGuiNode/AgentSlashCommandPalette.tsx
16071
- import { Fragment as Fragment3, useEffect as useEffect6, useRef as useRef7 } from "react";
15662
+ import { Fragment as Fragment3, useEffect as useEffect6, useRef as useRef6 } from "react";
16072
15663
  import {
16073
15664
  Globe,
16074
15665
  Info,
@@ -16082,7 +15673,7 @@ import {
16082
15673
  import { jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
16083
15674
  var paletteStyles = {
16084
15675
  palette: "nodrag agent-gui-node__mention-palette flex h-full min-h-0 flex-col gap-1 overflow-y-auto px-1 pb-1 pt-2 [-webkit-app-region:no-drag]",
16085
- option: "nodrag relative flex min-h-9 w-full min-w-0 cursor-pointer select-none items-center gap-2 overflow-hidden rounded-[6px] border-0 bg-transparent px-2.5 py-2 text-left text-[13px] text-[var(--text-primary)] outline-hidden transition-colors duration-200 [-webkit-app-region:no-drag] focus-visible:outline-none active:bg-[var(--transparency-active)] data-[highlighted]:bg-[var(--transparency-block)] data-[highlighted]:text-[var(--text-primary)] [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
15676
+ option: "nodrag relative flex min-h-9 w-full min-w-0 cursor-pointer select-none items-center gap-2 overflow-hidden rounded-[6px] border-0 bg-transparent px-2.5 py-2 text-left text-[13px] text-[var(--text-primary)] outline-hidden transition-colors duration-200 [-webkit-app-region:no-drag] hover:bg-[var(--transparency-block)] focus-visible:bg-[var(--transparency-block)] focus-visible:outline-none active:bg-[var(--transparency-active)] data-[highlighted]:bg-[var(--transparency-block)] data-[highlighted]:text-[var(--text-primary)] [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
16086
15677
  icon: "flex w-3 shrink-0 items-center justify-center self-center text-[var(--text-secondary)]",
16087
15678
  copy: "flex min-w-0 flex-1 items-center gap-1 overflow-hidden leading-[16px]",
16088
15679
  name: "flex min-w-0 max-w-[48%] shrink-0 items-center gap-1 overflow-hidden",
@@ -16111,7 +15702,7 @@ function AgentSlashCommandPalette({
16111
15702
  onSelectSkill
16112
15703
  }) {
16113
15704
  "use memo";
16114
- const highlightedOptionRef = useRef7(null);
15705
+ const highlightedOptionRef = useRef6(null);
16115
15706
  useEffect6(() => {
16116
15707
  highlightedOptionRef.current?.scrollIntoView({ block: "nearest" });
16117
15708
  }, [highlightedIndex]);
@@ -16268,9 +15859,9 @@ function slashPaletteEntryIcon(entry) {
16268
15859
 
16269
15860
  // agent-gui/agentGuiNode/AgentQueuedPromptPanel.tsx
16270
15861
  import {
16271
- useLayoutEffect as useLayoutEffect2,
16272
- useRef as useRef8,
16273
- useState as useState6
15862
+ useLayoutEffect,
15863
+ useRef as useRef7,
15864
+ useState as useState5
16274
15865
  } from "react";
16275
15866
  import { ChevronRight } from "lucide-react";
16276
15867
 
@@ -16436,12 +16027,12 @@ function AgentQueuedPromptPanel({
16436
16027
  workspaceAppIcons = EMPTY_WORKSPACE_APP_ICONS
16437
16028
  }) {
16438
16029
  "use memo";
16439
- const [isExpanded, setIsExpanded] = useState6(false);
16440
- const singlePromptTextRef = useRef8(null);
16441
- const queuedPromptListRef = useRef8(null);
16442
- const pointerHandledEditPromptIdRef = useRef8(null);
16443
- const [isSinglePromptOverflowing, setIsSinglePromptOverflowing] = useState6(false);
16444
- const [expandedListMaxHeightPx, setExpandedListMaxHeightPx] = useState6(280);
16030
+ const [isExpanded, setIsExpanded] = useState5(false);
16031
+ const singlePromptTextRef = useRef7(null);
16032
+ const queuedPromptListRef = useRef7(null);
16033
+ const pointerHandledEditPromptIdRef = useRef7(null);
16034
+ const [isSinglePromptOverflowing, setIsSinglePromptOverflowing] = useState5(false);
16035
+ const [expandedListMaxHeightPx, setExpandedListMaxHeightPx] = useState5(280);
16445
16036
  const singlePromptHasImages = queuedPrompts.length === 1 && queuedPromptImages(queuedPrompts[0]).length > 0;
16446
16037
  const canExpand = queuedPrompts.length > 1 || singlePromptHasImages || isSinglePromptOverflowing;
16447
16038
  const panelStyle = {
@@ -16481,7 +16072,7 @@ function AgentQueuedPromptPanel({
16481
16072
  }
16482
16073
  editQueuedPrompt(queuedPromptId);
16483
16074
  };
16484
- useLayoutEffect2(() => {
16075
+ useLayoutEffect(() => {
16485
16076
  if (queuedPrompts.length !== 1) {
16486
16077
  setIsSinglePromptOverflowing(false);
16487
16078
  return;
@@ -16503,12 +16094,12 @@ function AgentQueuedPromptPanel({
16503
16094
  resizeObserver?.disconnect();
16504
16095
  };
16505
16096
  }, [queuedPrompts]);
16506
- useLayoutEffect2(() => {
16097
+ useLayoutEffect(() => {
16507
16098
  if (!canExpand && isExpanded) {
16508
16099
  setIsExpanded(false);
16509
16100
  }
16510
16101
  }, [canExpand, isExpanded]);
16511
- useLayoutEffect2(() => {
16102
+ useLayoutEffect(() => {
16512
16103
  const element = queuedPromptListRef.current;
16513
16104
  if (!element) {
16514
16105
  return;
@@ -16682,9 +16273,9 @@ import {
16682
16273
  cloneElement,
16683
16274
  useEffect as useEffect7,
16684
16275
  useMemo as useMemo5,
16685
- useState as useState7
16276
+ useState as useState6
16686
16277
  } from "react";
16687
- import { ChevronDown as ChevronDown2, ZapIcon as ZapIcon2 } from "lucide-react";
16278
+ import { ChevronDown, ZapIcon as ZapIcon2 } from "lucide-react";
16688
16279
  import {
16689
16280
  WorkspaceUserProjectSelect,
16690
16281
  resolveWorkspaceUserProjectSelectLabels
@@ -17107,7 +16698,7 @@ function AgentProjectDropdown({
17107
16698
  ]
17108
16699
  }
17109
16700
  ),
17110
- /* @__PURE__ */ jsx23(ChevronDown2, { "aria-hidden": "true", className: "shrink-0", size: 16 })
16701
+ /* @__PURE__ */ jsx23(ChevronDown, { "aria-hidden": "true", className: "shrink-0", size: 16 })
17111
16702
  ]
17112
16703
  }
17113
16704
  );
@@ -17155,7 +16746,7 @@ function AgentPermissionModeDropdown({
17155
16746
  onSettingsChange
17156
16747
  }) {
17157
16748
  "use memo";
17158
- const [isSelectOpen, setIsSelectOpen] = useState7(false);
16749
+ const [isSelectOpen, setIsSelectOpen] = useState6(false);
17159
16750
  const isLoading = composerSettings.isSettingsLoading || composerSettings.isModelOptionsLoading === true;
17160
16751
  const availableOptions = composerSettings.availablePermissionModes ?? [];
17161
16752
  const selectedValue = composerSettings.selectedPermissionModeValue ?? composerSettings.draftSettings.permissionModeId;
@@ -17197,7 +16788,7 @@ function AgentPermissionModeDropdown({
17197
16788
  "data-permission-tone": triggerTone,
17198
16789
  children: [
17199
16790
  /* @__PURE__ */ jsx23("span", { className: "flex min-w-0 flex-1 items-center", children: /* @__PURE__ */ jsx23("span", { className: "truncate", children: triggerLabel }) }),
17200
- /* @__PURE__ */ jsx23(ChevronDown2, { "aria-hidden": "true", className: "shrink-0", size: 16 })
16791
+ /* @__PURE__ */ jsx23(ChevronDown, { "aria-hidden": "true", className: "shrink-0", size: 16 })
17201
16792
  ]
17202
16793
  }
17203
16794
  );
@@ -17385,7 +16976,7 @@ function AgentModelReasoningDropdown({
17385
16976
  onSettingsChange
17386
16977
  }) {
17387
16978
  "use memo";
17388
- const [menuOpen, setMenuOpen] = useState7(false);
16979
+ const [menuOpen, setMenuOpen] = useState6(false);
17389
16980
  const menu = buildComposerModelMenuModel(composerSettings, labels);
17390
16981
  const menuDisabled = disabled || menu.disabled;
17391
16982
  const isModelLoading = composerSettings.isModelOptionsLoading || composerSettings.isSettingsLoading;
@@ -17421,7 +17012,7 @@ function AgentModelReasoningDropdown({
17421
17012
  /* @__PURE__ */ jsx23("span", { className: "shrink-0", children: menu.trigger.reasoningLabel })
17422
17013
  ] })
17423
17014
  ] }),
17424
- /* @__PURE__ */ jsx23(ChevronDown2, { "aria-hidden": "true", className: "shrink-0", size: 16 })
17015
+ /* @__PURE__ */ jsx23(ChevronDown, { "aria-hidden": "true", className: "shrink-0", size: 16 })
17425
17016
  ]
17426
17017
  }
17427
17018
  );
@@ -17652,12 +17243,12 @@ function ComposerModelOptionTooltip({
17652
17243
  // agent-gui/agentGuiNode/agentRichText/AgentRichTextEditor.tsx
17653
17244
  import {
17654
17245
  forwardRef as forwardRef3,
17655
- useCallback as useCallback7,
17246
+ useCallback as useCallback6,
17656
17247
  useEffect as useEffect8,
17657
17248
  useImperativeHandle as useImperativeHandle2,
17658
17249
  useMemo as useMemo6,
17659
- useRef as useRef9,
17660
- useState as useState8
17250
+ useRef as useRef8,
17251
+ useState as useState7
17661
17252
  } from "react";
17662
17253
  import { createPortal } from "react-dom";
17663
17254
  import { Extension } from "@tiptap/core";
@@ -17709,7 +17300,7 @@ function createAgentFileMentionContent(items, options = {}) {
17709
17300
  return [
17710
17301
  ...index === 0 && options.prefixCaretAnchor ? [
17711
17302
  { type: "text", text: AGENT_RICH_TEXT_CARET_ANCHOR }
17712
- ] : index > 0 ? [{ type: "text", text: " " }] : [],
17303
+ ] : [],
17713
17304
  {
17714
17305
  type: "agentFileMention",
17715
17306
  attrs: {
@@ -17870,6 +17461,37 @@ function nonImageFilesFromDataTransfer(dataTransfer) {
17870
17461
  }
17871
17462
  return files;
17872
17463
  }
17464
+ function systemFileDragInfoFromDataTransfer(dataTransfer) {
17465
+ if (!dataTransfer) {
17466
+ return { hasImageFiles: false, hasRegularFiles: false };
17467
+ }
17468
+ const items = dataTransfer.items;
17469
+ if (items) {
17470
+ let hasImageFiles2 = false;
17471
+ let hasRegularFiles2 = false;
17472
+ for (const item of Array.from(items)) {
17473
+ if (item.kind !== "file") {
17474
+ continue;
17475
+ }
17476
+ if (supportedPromptImageMimeType(item.type)) {
17477
+ hasImageFiles2 = true;
17478
+ } else {
17479
+ hasRegularFiles2 = true;
17480
+ }
17481
+ }
17482
+ return { hasImageFiles: hasImageFiles2, hasRegularFiles: hasRegularFiles2 };
17483
+ }
17484
+ let hasImageFiles = false;
17485
+ let hasRegularFiles = false;
17486
+ for (const file of Array.from(dataTransfer.files ?? [])) {
17487
+ if (supportedPromptImageMimeType(file.type) || supportedPromptImageFileName(file.name)) {
17488
+ hasImageFiles = true;
17489
+ } else {
17490
+ hasRegularFiles = true;
17491
+ }
17492
+ }
17493
+ return { hasImageFiles, hasRegularFiles };
17494
+ }
17873
17495
  function supportedPromptImageMimeType(value) {
17874
17496
  return value === "image/png" || value === "image/jpeg" || value === "image/webp";
17875
17497
  }
@@ -18180,37 +17802,39 @@ var AgentRichTextEditor = forwardRef3(function AgentRichTextEditor2({
18180
17802
  promptImagesSupported = true,
18181
17803
  onPromptImagesUnsupported,
18182
17804
  onPasteImages,
18183
- getReferenceForFile
17805
+ getReferenceForFile,
17806
+ onDropFiles
18184
17807
  }, ref) {
18185
17808
  "use memo";
18186
17809
  const { t } = useTranslation();
18187
- const lastEmittedPromptRef = useRef9(value);
18188
- const editorRef = useRef9(null);
18189
- const onChangeRef = useRef9(onChange);
18190
- const onSubmitRef = useRef9(onSubmit);
18191
- const onSubmitGuidanceRef = useRef9(onSubmitGuidance);
18192
- const onKeyDownForPaletteRef = useRef9(onKeyDownForPalette);
18193
- const onFileMentionSuggestionChangeRef = useRef9(
17810
+ const lastEmittedPromptRef = useRef8(value);
17811
+ const editorRef = useRef8(null);
17812
+ const onChangeRef = useRef8(onChange);
17813
+ const onSubmitRef = useRef8(onSubmit);
17814
+ const onSubmitGuidanceRef = useRef8(onSubmitGuidance);
17815
+ const onKeyDownForPaletteRef = useRef8(onKeyDownForPalette);
17816
+ const onFileMentionSuggestionChangeRef = useRef8(
18194
17817
  onFileMentionSuggestionChange
18195
17818
  );
18196
- const onFileMentionSuggestionKeyDownRef = useRef9(
17819
+ const onFileMentionSuggestionKeyDownRef = useRef8(
18197
17820
  onFileMentionSuggestionKeyDown
18198
17821
  );
18199
- const onLinkClickRef = useRef9(onLinkClick);
18200
- const onPromptImagesUnsupportedRef = useRef9(onPromptImagesUnsupported);
18201
- const onPasteImagesRef = useRef9(onPasteImages);
18202
- const promptImagesSupportedRef = useRef9(promptImagesSupported);
18203
- const getReferenceForFileRef = useRef9(getReferenceForFile);
18204
- const placeholderRef = useRef9(placeholder);
18205
- const removeMentionLabelRef = useRef9(removeMentionLabel);
18206
- const availableSkillsRef = useRef9(availableSkills);
18207
- const availableCapabilitiesRef = useRef9(availableCapabilities);
18208
- const scrollFrameRef = useRef9(null);
18209
- const [contextMenu, setContextMenu] = useState8(null);
18210
- const closeContextMenu = useCallback7(() => {
17822
+ const onLinkClickRef = useRef8(onLinkClick);
17823
+ const onPromptImagesUnsupportedRef = useRef8(onPromptImagesUnsupported);
17824
+ const onPasteImagesRef = useRef8(onPasteImages);
17825
+ const onDropFilesRef = useRef8(onDropFiles);
17826
+ const promptImagesSupportedRef = useRef8(promptImagesSupported);
17827
+ const getReferenceForFileRef = useRef8(getReferenceForFile);
17828
+ const placeholderRef = useRef8(placeholder);
17829
+ const removeMentionLabelRef = useRef8(removeMentionLabel);
17830
+ const availableSkillsRef = useRef8(availableSkills);
17831
+ const availableCapabilitiesRef = useRef8(availableCapabilities);
17832
+ const scrollFrameRef = useRef8(null);
17833
+ const [contextMenu, setContextMenu] = useState7(null);
17834
+ const closeContextMenu = useCallback6(() => {
18211
17835
  setContextMenu(null);
18212
17836
  }, []);
18213
- const insertPlainText = useCallback7((text) => {
17837
+ const insertPlainText = useCallback6((text) => {
18214
17838
  const currentEditor = editorRef.current;
18215
17839
  if (!currentEditor || currentEditor.isDestroyed || !text) {
18216
17840
  return;
@@ -18222,7 +17846,7 @@ var AgentRichTextEditor = forwardRef3(function AgentRichTextEditor2({
18222
17846
  })
18223
17847
  ).run();
18224
17848
  }, []);
18225
- const copySelection = useCallback7(async () => {
17849
+ const copySelection = useCallback6(async () => {
18226
17850
  const currentEditor = editorRef.current;
18227
17851
  const selectedText = contextMenu && contextMenu.hasSelection && currentEditor ? readPromptTextRange(
18228
17852
  currentEditor,
@@ -18235,7 +17859,7 @@ var AgentRichTextEditor = forwardRef3(function AgentRichTextEditor2({
18235
17859
  }
18236
17860
  await writePlainTextToClipboard(selectedText);
18237
17861
  }, [closeContextMenu, contextMenu]);
18238
- const cutSelection = useCallback7(async () => {
17862
+ const cutSelection = useCallback6(async () => {
18239
17863
  const currentEditor = editorRef.current;
18240
17864
  const selectionFrom = contextMenu?.selectionFrom ?? null;
18241
17865
  const selectionTo = contextMenu?.selectionTo ?? null;
@@ -18254,7 +17878,7 @@ var AgentRichTextEditor = forwardRef3(function AgentRichTextEditor2({
18254
17878
  const { from, to } = selectionFrom !== null && selectionTo !== null && selectionFrom < selectionTo ? { from: selectionFrom, to: selectionTo } : currentEditor.state.selection;
18255
17879
  currentEditor.chain().focus().deleteRange({ from, to }).run();
18256
17880
  }, [closeContextMenu, contextMenu, disabled]);
18257
- const pasteClipboardText = useCallback7(async () => {
17881
+ const pasteClipboardText = useCallback6(async () => {
18258
17882
  closeContextMenu();
18259
17883
  if (disabled) {
18260
17884
  return;
@@ -18307,6 +17931,7 @@ var AgentRichTextEditor = forwardRef3(function AgentRichTextEditor2({
18307
17931
  onLinkClickRef.current = onLinkClick;
18308
17932
  onPromptImagesUnsupportedRef.current = onPromptImagesUnsupported;
18309
17933
  onPasteImagesRef.current = onPasteImages;
17934
+ onDropFilesRef.current = onDropFiles;
18310
17935
  promptImagesSupportedRef.current = promptImagesSupported;
18311
17936
  getReferenceForFileRef.current = getReferenceForFile;
18312
17937
  placeholderRef.current = placeholder;
@@ -18516,10 +18141,11 @@ var AgentRichTextEditor = forwardRef3(function AgentRichTextEditor2({
18516
18141
  if (!dataTransfer || disabled) {
18517
18142
  return false;
18518
18143
  }
18519
- const imageFiles = imageFilesFromDataTransfer(dataTransfer);
18520
- if (imageFiles.length > 0) {
18144
+ const systemFileDragInfo = systemFileDragInfoFromDataTransfer(dataTransfer);
18145
+ const canDropRegularSystemFiles = systemFileDragInfo.hasRegularFiles && Boolean(onDropFilesRef.current);
18146
+ if (systemFileDragInfo.hasImageFiles || canDropRegularSystemFiles) {
18521
18147
  event.preventDefault();
18522
- dataTransfer.dropEffect = promptImagesSupportedRef.current ? "copy" : "none";
18148
+ dataTransfer.dropEffect = canDropRegularSystemFiles || systemFileDragInfo.hasImageFiles && promptImagesSupportedRef.current ? "copy" : "none";
18523
18149
  return true;
18524
18150
  }
18525
18151
  if (!hasWorkspaceFileDropData(dataTransfer)) {
@@ -18541,8 +18167,27 @@ var AgentRichTextEditor = forwardRef3(function AgentRichTextEditor2({
18541
18167
  return false;
18542
18168
  }
18543
18169
  const imageFiles = imageFilesFromDataTransfer(dataTransfer);
18544
- if (imageFiles.length > 0) {
18170
+ const imageFileSet = new Set(imageFiles);
18171
+ const regularFiles = nonImageFilesFromDataTransfer(
18172
+ dataTransfer
18173
+ ).filter((file) => !imageFileSet.has(file));
18174
+ const canHandleRegularFiles = Boolean(onDropFilesRef.current);
18175
+ if (imageFiles.length > 0 || regularFiles.length > 0 && canHandleRegularFiles) {
18545
18176
  event.preventDefault();
18177
+ const currentEditor2 = editorRef.current;
18178
+ if (regularFiles.length > 0 && onDropFilesRef.current && currentEditor2 && !currentEditor2.isDestroyed) {
18179
+ const coordinatePosition2 = currentEditor2.view.posAtCoords({
18180
+ left: event.clientX,
18181
+ top: event.clientY
18182
+ })?.pos;
18183
+ const fallbackSelectionPosition2 = currentEditor2.state.selection.from;
18184
+ const insertPosition2 = coordinatePosition2 ?? (Number.isInteger(fallbackSelectionPosition2) ? fallbackSelectionPosition2 : null) ?? currentEditor2.state.doc.content.size;
18185
+ currentEditor2.chain().focus().setTextSelection(insertPosition2).run();
18186
+ onDropFilesRef.current(regularFiles);
18187
+ }
18188
+ if (imageFiles.length === 0) {
18189
+ return true;
18190
+ }
18546
18191
  if (!promptImagesSupportedRef.current) {
18547
18192
  onPromptImagesUnsupportedRef.current?.();
18548
18193
  return true;
@@ -18847,8 +18492,8 @@ function AgentRichTextContextMenuButton({
18847
18492
  label,
18848
18493
  onSelect
18849
18494
  }) {
18850
- const selectionStartedRef = useRef9(false);
18851
- const select = useCallback7(() => {
18495
+ const selectionStartedRef = useRef8(false);
18496
+ const select = useCallback6(() => {
18852
18497
  if (disabled || selectionStartedRef.current) {
18853
18498
  return;
18854
18499
  }
@@ -19005,7 +18650,7 @@ function AgentSlashStatusPanel({
19005
18650
  }
19006
18651
 
19007
18652
  // agent-gui/agentGuiNode/AgentReviewPickerPanel.tsx
19008
- import { useCallback as useCallback8, useEffect as useEffect9, useMemo as useMemo7, useRef as useRef10, useState as useState9 } from "react";
18653
+ import { useCallback as useCallback7, useEffect as useEffect9, useMemo as useMemo7, useRef as useRef9, useState as useState8 } from "react";
19009
18654
  import { menuItemClassName } from "@tutti-os/ui-system";
19010
18655
 
19011
18656
  // agent-gui/agentGuiNode/AgentReviewBranchController.ts
@@ -19120,15 +18765,15 @@ function AgentReviewPickerPanel({
19120
18765
  onSubmitReview,
19121
18766
  onClose
19122
18767
  }) {
19123
- const [stage, setStage] = useState9("root");
19124
- const [query, setQuery] = useState9("");
19125
- const [highlightedIndex, setHighlightedIndex] = useState9(0);
19126
- const searchInputRef = useRef10(null);
19127
- const highlightedOptionRef = useRef10(null);
19128
- const reviewBranchControllerRef = useRef10(
18768
+ const [stage, setStage] = useState8("root");
18769
+ const [query, setQuery] = useState8("");
18770
+ const [highlightedIndex, setHighlightedIndex] = useState8(0);
18771
+ const searchInputRef = useRef9(null);
18772
+ const highlightedOptionRef = useRef9(null);
18773
+ const reviewBranchControllerRef = useRef9(
19129
18774
  null
19130
18775
  );
19131
- const [branchState, setBranchState] = useState9({
18776
+ const [branchState, setBranchState] = useState8({
19132
18777
  status: "idle",
19133
18778
  branches: [],
19134
18779
  currentBranch: null,
@@ -19157,18 +18802,18 @@ function AgentReviewPickerPanel({
19157
18802
  useEffect9(() => {
19158
18803
  searchInputRef.current?.focus();
19159
18804
  }, [stage]);
19160
- const submit = useCallback8(
18805
+ const submit = useCallback7(
19161
18806
  (command) => {
19162
18807
  onSubmitReview(command);
19163
18808
  },
19164
18809
  [onSubmitReview]
19165
18810
  );
19166
- const goToStage = useCallback8((next) => {
18811
+ const goToStage = useCallback7((next) => {
19167
18812
  setStage(next);
19168
18813
  setQuery("");
19169
18814
  setHighlightedIndex(0);
19170
18815
  }, []);
19171
- const goBackToRoot = useCallback8(() => {
18816
+ const goBackToRoot = useCallback7(() => {
19172
18817
  setStage("root");
19173
18818
  setQuery("");
19174
18819
  setHighlightedIndex(0);
@@ -19256,7 +18901,7 @@ function AgentReviewPickerPanel({
19256
18901
  emptyMessage = labels.branchEmpty;
19257
18902
  }
19258
18903
  }
19259
- const handleKeyDown = useCallback8(
18904
+ const handleKeyDown = useCallback7(
19260
18905
  (event) => {
19261
18906
  if (event.key === "ArrowDown") {
19262
18907
  event.preventDefault();
@@ -19366,12 +19011,12 @@ function AgentReviewPickerPanel({
19366
19011
  // agent-gui/agentGuiNode/composerFloatingMenu/ComposerFloatingMenuSurface.tsx
19367
19012
  import {
19368
19013
  forwardRef as forwardRef4,
19369
- useCallback as useCallback9,
19014
+ useCallback as useCallback8,
19370
19015
  useEffect as useEffect10,
19371
- useLayoutEffect as useLayoutEffect3,
19016
+ useLayoutEffect as useLayoutEffect2,
19372
19017
  useMemo as useMemo8,
19373
- useRef as useRef11,
19374
- useState as useState10
19018
+ useRef as useRef10,
19019
+ useState as useState9
19375
19020
  } from "react";
19376
19021
  import { createPortal as createPortal2 } from "react-dom";
19377
19022
  import { jsx as jsx27 } from "react/jsx-runtime";
@@ -19448,8 +19093,8 @@ function useComposerAnchoredMenuFrame({
19448
19093
  maxHeight,
19449
19094
  open
19450
19095
  }) {
19451
- const [frame, setFrame] = useState10(null);
19452
- const syncFrame = useCallback9(() => {
19096
+ const [frame, setFrame] = useState9(null);
19097
+ const syncFrame = useCallback8(() => {
19453
19098
  const anchor = anchorRef.current;
19454
19099
  if (!anchor || typeof window === "undefined") {
19455
19100
  setFrame(null);
@@ -19460,7 +19105,7 @@ function useComposerAnchoredMenuFrame({
19460
19105
  (previous) => sameComposerAnchoredMenuFrame(previous, nextFrame) ? previous : nextFrame
19461
19106
  );
19462
19107
  }, [anchorRef, maxHeight]);
19463
- useLayoutEffect3(() => {
19108
+ useLayoutEffect2(() => {
19464
19109
  if (!open) {
19465
19110
  setFrame(null);
19466
19111
  return;
@@ -19502,13 +19147,13 @@ var ComposerFloatingMenuSurface = forwardRef4(function ComposerFloatingMenuSurfa
19502
19147
  surfaceRef,
19503
19148
  testId
19504
19149
  }, forwardedRef) {
19505
- const localSurfaceRef = useRef11(null);
19150
+ const localSurfaceRef = useRef10(null);
19506
19151
  const frame = useComposerAnchoredMenuFrame({
19507
19152
  anchorRef,
19508
19153
  maxHeight,
19509
19154
  open
19510
19155
  });
19511
- const setSurfaceRef = useCallback9(
19156
+ const setSurfaceRef = useCallback8(
19512
19157
  (node) => {
19513
19158
  localSurfaceRef.current = node;
19514
19159
  assignRef(surfaceRef, node);
@@ -19650,32 +19295,32 @@ function AgentUsageChip({
19650
19295
  compactDisabled
19651
19296
  }) {
19652
19297
  "use memo";
19653
- const [usagePopoverOpen, setUsagePopoverOpen] = useState11(false);
19654
- const usagePopoverHoverTimerRef = useRef12(null);
19298
+ const [usagePopoverOpen, setUsagePopoverOpen] = useState10(false);
19299
+ const usagePopoverHoverTimerRef = useRef11(null);
19655
19300
  const clampedPercent = Math.max(0, Math.min(100, percentUsed));
19656
19301
  const chipLabel = labels.usageChipLabel({ percent: clampedPercent });
19657
19302
  const showTokens = usedTokens !== null && totalTokens !== null;
19658
19303
  const usageLevel = agentUsageChipLevel(clampedPercent);
19659
19304
  const ringColor = agentUsageRingColor(usageLevel);
19660
- const usagePopoverCloseTimerRef = useRef12(null);
19661
- const clearUsagePopoverHoverTimer = useCallback10(() => {
19305
+ const usagePopoverCloseTimerRef = useRef11(null);
19306
+ const clearUsagePopoverHoverTimer = useCallback9(() => {
19662
19307
  if (usagePopoverHoverTimerRef.current) {
19663
19308
  clearTimeout(usagePopoverHoverTimerRef.current);
19664
19309
  usagePopoverHoverTimerRef.current = null;
19665
19310
  }
19666
19311
  }, []);
19667
- const clearUsagePopoverCloseTimer = useCallback10(() => {
19312
+ const clearUsagePopoverCloseTimer = useCallback9(() => {
19668
19313
  if (usagePopoverCloseTimerRef.current) {
19669
19314
  clearTimeout(usagePopoverCloseTimerRef.current);
19670
19315
  usagePopoverCloseTimerRef.current = null;
19671
19316
  }
19672
19317
  }, []);
19673
- const openUsagePopover = useCallback10(() => {
19318
+ const openUsagePopover = useCallback9(() => {
19674
19319
  clearUsagePopoverHoverTimer();
19675
19320
  clearUsagePopoverCloseTimer();
19676
19321
  setUsagePopoverOpen(true);
19677
19322
  }, [clearUsagePopoverCloseTimer, clearUsagePopoverHoverTimer]);
19678
- const openUsagePopoverAfterHoverDelay = useCallback10(() => {
19323
+ const openUsagePopoverAfterHoverDelay = useCallback9(() => {
19679
19324
  clearUsagePopoverHoverTimer();
19680
19325
  clearUsagePopoverCloseTimer();
19681
19326
  usagePopoverHoverTimerRef.current = setTimeout(() => {
@@ -19683,12 +19328,12 @@ function AgentUsageChip({
19683
19328
  setUsagePopoverOpen(true);
19684
19329
  }, USAGE_POPOVER_HOVER_DELAY_MS);
19685
19330
  }, [clearUsagePopoverCloseTimer, clearUsagePopoverHoverTimer]);
19686
- const closeUsagePopover = useCallback10(() => {
19331
+ const closeUsagePopover = useCallback9(() => {
19687
19332
  clearUsagePopoverHoverTimer();
19688
19333
  clearUsagePopoverCloseTimer();
19689
19334
  setUsagePopoverOpen(false);
19690
19335
  }, [clearUsagePopoverCloseTimer, clearUsagePopoverHoverTimer]);
19691
- const scheduleUsagePopoverClose = useCallback10(() => {
19336
+ const scheduleUsagePopoverClose = useCallback9(() => {
19692
19337
  clearUsagePopoverHoverTimer();
19693
19338
  clearUsagePopoverCloseTimer();
19694
19339
  usagePopoverCloseTimerRef.current = setTimeout(() => {
@@ -19696,7 +19341,7 @@ function AgentUsageChip({
19696
19341
  setUsagePopoverOpen(false);
19697
19342
  }, 140);
19698
19343
  }, [clearUsagePopoverCloseTimer, clearUsagePopoverHoverTimer]);
19699
- const handleUsagePopoverOpenChange = useCallback10(
19344
+ const handleUsagePopoverOpenChange = useCallback9(
19700
19345
  (open) => {
19701
19346
  if (open) {
19702
19347
  openUsagePopover();
@@ -19910,6 +19555,7 @@ function AgentComposer({
19910
19555
  onCapabilitySettingsRequest,
19911
19556
  onLinkAction,
19912
19557
  onRequestWorkspaceReferences = null,
19558
+ resolveDroppedFileReferences = null,
19913
19559
  selectProjectDirectory,
19914
19560
  onRequestGitBranches = null,
19915
19561
  contextMentionProviders = EMPTY_CONTEXT_MENTION_PROVIDERS
@@ -19923,28 +19569,34 @@ function AgentComposer({
19923
19569
  const agentActivityRuntime = useOptionalAgentActivityRuntime();
19924
19570
  const agentHostApi = useOptionalAgentHostApi();
19925
19571
  const getReferenceForFile = agentHostApi?.workspace.getReferenceForFile;
19926
- const [isPaletteOpen, setIsPaletteOpen] = useState11(true);
19927
- const [isReviewPickerOpen, setIsReviewPickerOpen] = useState11(false);
19928
- const [highlightedIndex, setHighlightedIndex] = useState11(0);
19929
- const [mentionHighlightedKey, setMentionHighlightedKey] = useState11(null);
19930
- const [shouldCenterMentionHighlight, setShouldCenterMentionHighlight] = useState11(false);
19572
+ const promptFileUploadSupported = Boolean(
19573
+ agentActivityRuntime?.uploadPromptContent && (agentActivityRuntime.promptContentUploadSupport?.file ?? true)
19574
+ );
19575
+ const promptFilesSupported = Boolean(
19576
+ resolveDroppedFileReferences && promptFileUploadSupported
19577
+ );
19578
+ const [isPaletteOpen, setIsPaletteOpen] = useState10(true);
19579
+ const [isReviewPickerOpen, setIsReviewPickerOpen] = useState10(false);
19580
+ const [highlightedIndex, setHighlightedIndex] = useState10(0);
19581
+ const [mentionHighlightedKey, setMentionHighlightedKey] = useState10(null);
19582
+ const [shouldCenterMentionHighlight, setShouldCenterMentionHighlight] = useState10(false);
19931
19583
  const [
19932
19584
  shouldResetMentionHighlightToFilter,
19933
19585
  setShouldResetMentionHighlightToFilter
19934
- ] = useState11(false);
19935
- const [paletteDraftPrompt, setPaletteDraftPrompt] = useState11(
19586
+ ] = useState10(false);
19587
+ const [paletteDraftPrompt, setPaletteDraftPrompt] = useState10(
19936
19588
  goalDraftObjective ?? draftPrompt
19937
19589
  );
19938
- const [fileMentionSuggestion, setFileMentionSuggestion] = useState11(null);
19939
- const [isSelectedProjectMissing, setIsSelectedProjectMissing] = useState11(false);
19940
- const [isSlashStatusPanelOpen, setIsSlashStatusPanelOpen] = useState11(false);
19590
+ const [fileMentionSuggestion, setFileMentionSuggestion] = useState10(null);
19591
+ const [isSelectedProjectMissing, setIsSelectedProjectMissing] = useState10(false);
19592
+ const [isSlashStatusPanelOpen, setIsSlashStatusPanelOpen] = useState10(false);
19941
19593
  const slashStatusAgentSessionId = slashStatus?.agentSessionId ?? null;
19942
- const previousSlashStatusAgentSessionIdRef = useRef12(
19594
+ const previousSlashStatusAgentSessionIdRef = useRef11(
19943
19595
  slashStatusAgentSessionId
19944
19596
  );
19945
19597
  const selectedProjectPath = composerSettings.selectedProjectPath?.trim() ?? "";
19946
- const previousSelectedProjectPathRef = useRef12(selectedProjectPath);
19947
- const [mentionSearchState, setMentionSearchState] = useState11({
19598
+ const previousSelectedProjectPathRef = useRef11(selectedProjectPath);
19599
+ const [mentionSearchState, setMentionSearchState] = useState10({
19948
19600
  status: "idle",
19949
19601
  query: "",
19950
19602
  mode: "browse",
@@ -19953,30 +19605,30 @@ function AgentComposer({
19953
19605
  groups: [],
19954
19606
  error: null
19955
19607
  });
19956
- const composerRef = useRef12(null);
19957
- const inputShellRef = useRef12(null);
19958
- const promptInputAreaRef = useRef12(null);
19959
- const paletteContentRef = useRef12(null);
19960
- const draftPromptRef = useRef12(draftPrompt);
19961
- const draftImagesRef = useRef12(draftImages);
19962
- const draftFilesRef = useRef12(draftFiles);
19963
- const promptTipRef = useRef12(null);
19964
- const mentionControllerRef = useRef12(
19608
+ const composerRef = useRef11(null);
19609
+ const inputShellRef = useRef11(null);
19610
+ const promptInputAreaRef = useRef11(null);
19611
+ const paletteContentRef = useRef11(null);
19612
+ const draftPromptRef = useRef11(draftPrompt);
19613
+ const draftImagesRef = useRef11(draftImages);
19614
+ const draftFilesRef = useRef11(draftFiles);
19615
+ const promptTipRef = useRef11(null);
19616
+ const mentionControllerRef = useRef11(
19965
19617
  null
19966
19618
  );
19967
- const editorHandleRef = useRef12(null);
19968
- const wasActiveRef = useRef12(isActive);
19969
- const lastComposerFocusRequestRef = useRef12(null);
19970
- const autoMentionHighlightedKeyRef = useRef12(null);
19971
- const [isPromptTipOverflowing, setIsPromptTipOverflowing] = useState11(false);
19972
- const [dockComposerInputHeight, setDockComposerInputHeight] = useState11(
19619
+ const editorHandleRef = useRef11(null);
19620
+ const wasActiveRef = useRef11(isActive);
19621
+ const lastComposerFocusRequestRef = useRef11(null);
19622
+ const autoMentionHighlightedKeyRef = useRef11(null);
19623
+ const [isPromptTipOverflowing, setIsPromptTipOverflowing] = useState10(false);
19624
+ const [dockComposerInputHeight, setDockComposerInputHeight] = useState10(
19973
19625
  DOCK_COMPOSER_INPUT_MIN_HEIGHT
19974
19626
  );
19975
- const [dockComposerInputMaxHeight, setDockComposerInputMaxHeight] = useState11(
19627
+ const [dockComposerInputMaxHeight, setDockComposerInputMaxHeight] = useState10(
19976
19628
  DOCK_COMPOSER_INPUT_MAX_HEIGHT
19977
19629
  );
19978
- const [dockComposerAttachmentHeight, setDockComposerAttachmentHeight] = useState11(0);
19979
- const [dockComposerTextHeight, setDockComposerTextHeight] = useState11(
19630
+ const [dockComposerAttachmentHeight, setDockComposerAttachmentHeight] = useState10(0);
19631
+ const [dockComposerTextHeight, setDockComposerTextHeight] = useState10(
19980
19632
  DOCK_COMPOSER_INPUT_MIN_HEIGHT
19981
19633
  );
19982
19634
  const slashQuery = isGoalModeActive ? null : getPromptStartSlashCommandQuery(paletteDraftPrompt);
@@ -20136,7 +19788,7 @@ function AgentComposer({
20136
19788
  highlightedIndex,
20137
19789
  slashPaletteEntries.length
20138
19790
  );
20139
- const [mentionPaletteFrame, setMentionPaletteFrame] = useState11(null);
19791
+ const [mentionPaletteFrame, setMentionPaletteFrame] = useState10(null);
20140
19792
  useEffect11(() => {
20141
19793
  setHighlightedIndex(0);
20142
19794
  }, [skillQueryMatch?.prefix, skillQueryMatch?.query, slashQuery]);
@@ -20209,26 +19861,26 @@ function AgentComposer({
20209
19861
  previousSlashStatusAgentSessionIdRef.current = slashStatusAgentSessionId;
20210
19862
  setIsSlashStatusPanelOpen(false);
20211
19863
  }, [slashStatusAgentSessionId]);
20212
- const clearSlashCommandDraft = useCallback10(() => {
19864
+ const clearSlashCommandDraft = useCallback9(() => {
20213
19865
  draftPromptRef.current = "";
20214
19866
  setPaletteDraftPrompt("");
20215
19867
  setIsPaletteOpen(false);
20216
19868
  onDraftContentChange(emptyAgentComposerDraft());
20217
19869
  }, [onDraftContentChange]);
20218
- const closeSlashStatusPanel = useCallback10(() => {
19870
+ const closeSlashStatusPanel = useCallback9(() => {
20219
19871
  setIsSlashStatusPanelOpen(false);
20220
19872
  }, []);
20221
19873
  const settingsControlsDisabled = isSendingTurn || isSubmittingPrompt || showStopButton;
20222
19874
  const composerControlsHardDisabled = isSelectedProjectMissing || isSubmittingPrompt || disabled && !isSendingTurn && !showStopButton;
20223
- const closeReviewPicker = useCallback10(() => {
19875
+ const closeReviewPicker = useCallback9(() => {
20224
19876
  setIsReviewPickerOpen(false);
20225
19877
  }, []);
20226
- const closeSlashFloatingMenu = useCallback10(() => {
19878
+ const closeSlashFloatingMenu = useCallback9(() => {
20227
19879
  setIsSlashStatusPanelOpen(false);
20228
19880
  setIsReviewPickerOpen(false);
20229
19881
  setIsPaletteOpen(false);
20230
19882
  }, []);
20231
- const submitReviewCommand = useCallback10(
19883
+ const submitReviewCommand = useCallback9(
20232
19884
  (command) => {
20233
19885
  setIsReviewPickerOpen(false);
20234
19886
  clearSlashCommandDraft();
@@ -20248,7 +19900,7 @@ function AgentComposer({
20248
19900
  }
20249
19901
  return null;
20250
19902
  }, [onRequestGitBranches, selectedProjectPath, slashStatusAgentSessionId]);
20251
- const executeSlashCommandEffect = useCallback10(
19903
+ const executeSlashCommandEffect = useCallback9(
20252
19904
  (effect) => {
20253
19905
  if (effect.kind === "submitPrompt") {
20254
19906
  clearSlashCommandDraft();
@@ -20344,7 +19996,7 @@ function AgentComposer({
20344
19996
  settingsControlsDisabled
20345
19997
  ]
20346
19998
  );
20347
- const selectCommand = useCallback10(
19999
+ const selectCommand = useCallback9(
20348
20000
  (command) => {
20349
20001
  const selectionEffect = resolveSlashCommandSelectionEffect({
20350
20002
  provider,
@@ -20355,7 +20007,7 @@ function AgentComposer({
20355
20007
  },
20356
20008
  [executeSlashCommandEffect, provider]
20357
20009
  );
20358
- const selectCapability = useCallback10(
20010
+ const selectCapability = useCallback9(
20359
20011
  (capability) => {
20360
20012
  const selectionEffect = resolveSlashCommandSelectionEffect({
20361
20013
  provider,
@@ -20366,14 +20018,14 @@ function AgentComposer({
20366
20018
  },
20367
20019
  [executeSlashCommandEffect, provider]
20368
20020
  );
20369
- const selectCapabilitySettings = useCallback10(
20021
+ const selectCapabilitySettings = useCallback9(
20370
20022
  (capability) => {
20371
20023
  onCapabilitySettingsRequest?.(capability.capability);
20372
20024
  setIsPaletteOpen(false);
20373
20025
  },
20374
20026
  [onCapabilitySettingsRequest]
20375
20027
  );
20376
- const selectSkill = useCallback10(
20028
+ const selectSkill = useCallback9(
20377
20029
  (skill) => {
20378
20030
  const trigger = skillTriggerForPrefix(skill, skillQueryMatch?.prefix);
20379
20031
  const replacedDraft = trigger && skillQueryMatch && promptBeforeSelection !== "" ? editorHandleRef.current?.replaceTextBeforeSelection(
@@ -20465,7 +20117,7 @@ function AgentComposer({
20465
20117
  onDraftContentChange(emptyAgentComposerDraft());
20466
20118
  }
20467
20119
  );
20468
- const submit = useCallback10(
20120
+ const submit = useCallback9(
20469
20121
  (event) => {
20470
20122
  event.preventDefault();
20471
20123
  submitCurrentPrompt();
@@ -20525,7 +20177,7 @@ function AgentComposer({
20525
20177
  return true;
20526
20178
  }
20527
20179
  );
20528
- const selectFileMention = useCallback10(
20180
+ const selectFileMention = useCallback9(
20529
20181
  (entry) => {
20530
20182
  if (entry.kind === "file" && entry.mentionNavigation === "agent-generated-folder-back" && mentionControllerRef.current?.selectAgentGeneratedMentionItem(entry)) {
20531
20183
  return;
@@ -20540,7 +20192,7 @@ function AgentComposer({
20540
20192
  },
20541
20193
  [fileMentionSuggestion]
20542
20194
  );
20543
- const closeFileMentionPalette = useCallback10(() => {
20195
+ const closeFileMentionPalette = useCallback9(() => {
20544
20196
  if (fileMentionSuggestion) {
20545
20197
  exitAgentFileMentionSuggestion(fileMentionSuggestion.editor);
20546
20198
  }
@@ -20548,7 +20200,7 @@ function AgentComposer({
20548
20200
  setFileMentionSuggestion(null);
20549
20201
  setIsPaletteOpen(false);
20550
20202
  }, [fileMentionSuggestion]);
20551
- const clearActiveFileMentionTrigger = useCallback10(() => {
20203
+ const clearActiveFileMentionTrigger = useCallback9(() => {
20552
20204
  if (!fileMentionSuggestion) {
20553
20205
  return;
20554
20206
  }
@@ -20564,14 +20216,14 @@ function AgentComposer({
20564
20216
  setPaletteDraftPrompt(nextDraft);
20565
20217
  onDraftContentChange({ ...draftContent, prompt: nextDraft });
20566
20218
  }, [draftContent, fileMentionSuggestion, onDraftContentChange]);
20567
- const closeOpenPalette = useCallback10(() => {
20219
+ const closeOpenPalette = useCallback9(() => {
20568
20220
  if (showFileMentionPalette) {
20569
20221
  closeFileMentionPalette();
20570
20222
  return;
20571
20223
  }
20572
20224
  setIsPaletteOpen(false);
20573
20225
  }, [closeFileMentionPalette, showFileMentionPalette]);
20574
- const createFileMentionPaletteAdapter = useCallback10(
20226
+ const createFileMentionPaletteAdapter = useCallback9(
20575
20227
  (highlightedKey = mentionHighlightedKey) => createMentionPaletteStateAdapter({
20576
20228
  state: mentionSearchState,
20577
20229
  highlightedKey,
@@ -20600,23 +20252,23 @@ function AgentComposer({
20600
20252
  }),
20601
20253
  [mentionHighlightedKey, mentionSearchState, selectFileMention]
20602
20254
  );
20603
- const moveFileMentionSelection = useCallback10(
20255
+ const moveFileMentionSelection = useCallback9(
20604
20256
  (delta) => {
20605
20257
  createFileMentionPaletteAdapter().moveSelection(delta);
20606
20258
  },
20607
20259
  [createFileMentionPaletteAdapter]
20608
20260
  );
20609
- const handleMentionHighlightChange = useCallback10((key) => {
20261
+ const handleMentionHighlightChange = useCallback9((key) => {
20610
20262
  autoMentionHighlightedKeyRef.current = null;
20611
20263
  setMentionHighlightedKey(key);
20612
20264
  }, []);
20613
- const cycleFileMentionFilter = useCallback10(
20265
+ const cycleFileMentionFilter = useCallback9(
20614
20266
  (delta = 1) => {
20615
20267
  createFileMentionPaletteAdapter().cycleCategory(delta);
20616
20268
  },
20617
20269
  [createFileMentionPaletteAdapter]
20618
20270
  );
20619
- const navigateFileMentionHierarchy = useCallback10(
20271
+ const navigateFileMentionHierarchy = useCallback9(
20620
20272
  (delta) => {
20621
20273
  if (delta === -1) {
20622
20274
  return mentionControllerRef.current?.exitAgentGeneratedBrowse() ?? false;
@@ -20632,13 +20284,13 @@ function AgentComposer({
20632
20284
  },
20633
20285
  [createFileMentionPaletteAdapter]
20634
20286
  );
20635
- const navigateIntoFileMentionItem = useCallback10(
20287
+ const navigateIntoFileMentionItem = useCallback9(
20636
20288
  (item) => {
20637
20289
  mentionControllerRef.current?.selectAgentGeneratedMentionItem(item);
20638
20290
  },
20639
20291
  []
20640
20292
  );
20641
- const handleFileMentionKeyDown = useCallback10(
20293
+ const handleFileMentionKeyDown = useCallback9(
20642
20294
  (event) => {
20643
20295
  if (!showFileMentionPalette) {
20644
20296
  return false;
@@ -20662,7 +20314,7 @@ function AgentComposer({
20662
20314
  showFileMentionPalette
20663
20315
  ]
20664
20316
  );
20665
- const handlePlanModeToggleKeyDown = useCallback10(
20317
+ const handlePlanModeToggleKeyDown = useCallback9(
20666
20318
  (event) => {
20667
20319
  if (event.key !== "Tab" || !event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) {
20668
20320
  return false;
@@ -20717,7 +20369,7 @@ function AgentComposer({
20717
20369
  });
20718
20370
  };
20719
20371
  }, [handlePaletteKeyDown, showPalette]);
20720
- const handleFileMentionSuggestionChange = useCallback10(
20372
+ const handleFileMentionSuggestionChange = useCallback9(
20721
20373
  (state) => {
20722
20374
  setFileMentionSuggestion(state);
20723
20375
  if (!state) {
@@ -20734,8 +20386,8 @@ function AgentComposer({
20734
20386
  },
20735
20387
  [currentUserId, selectedProjectPath, workspaceId]
20736
20388
  );
20737
- const openReferencesForEntityRef = useRef12(null);
20738
- const handleLinkClick = useCallback10(
20389
+ const openReferencesForEntityRef = useRef11(null);
20390
+ const handleLinkClick = useCallback9(
20739
20391
  (href) => {
20740
20392
  const item = parseMentionItemFromHref({ name: "", href });
20741
20393
  if (item?.kind === "workspace-reference") {
@@ -20810,7 +20462,7 @@ function AgentComposer({
20810
20462
  onDraftContentChange({ ...draftContent, prompt: nextDraft });
20811
20463
  }
20812
20464
  );
20813
- const clearGoalModeBadge = useCallback10(() => {
20465
+ const clearGoalModeBadge = useCallback9(() => {
20814
20466
  if (!isGoalModeActive) {
20815
20467
  return;
20816
20468
  }
@@ -20824,7 +20476,7 @@ function AgentComposer({
20824
20476
  isGoalModeActive,
20825
20477
  onDraftContentChange
20826
20478
  ]);
20827
- const addDraftImages = useCallback10(
20479
+ const addDraftImages = useCallback9(
20828
20480
  (images) => {
20829
20481
  if (images.length === 0) {
20830
20482
  return;
@@ -20841,7 +20493,7 @@ function AgentComposer({
20841
20493
  if (remainingSlots === 0) {
20842
20494
  return;
20843
20495
  }
20844
- const uploadPromptContent = agentActivityRuntime?.uploadPromptContent;
20496
+ const uploadPromptContent = agentActivityRuntime?.uploadPromptContent && (agentActivityRuntime.promptContentUploadSupport?.image ?? true) ? agentActivityRuntime.uploadPromptContent : void 0;
20845
20497
  const nextImages = images.slice(0, remainingSlots).map((image) => ({
20846
20498
  id: `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,
20847
20499
  name: image.name,
@@ -20921,7 +20573,7 @@ function AgentComposer({
20921
20573
  workspaceId
20922
20574
  ]
20923
20575
  );
20924
- const removeDraftImage = useCallback10(
20576
+ const removeDraftImage = useCallback9(
20925
20577
  (id) => {
20926
20578
  const nextDraftImages = draftImagesRef.current.filter(
20927
20579
  (image) => image.id !== id
@@ -20935,7 +20587,7 @@ function AgentComposer({
20935
20587
  },
20936
20588
  [onDraftContentChange]
20937
20589
  );
20938
- const removeDraftFile = useCallback10(
20590
+ const removeDraftFile = useCallback9(
20939
20591
  (id) => {
20940
20592
  const nextDraftFiles = draftFilesRef.current.filter(
20941
20593
  (file) => file.id !== id
@@ -20949,10 +20601,10 @@ function AgentComposer({
20949
20601
  },
20950
20602
  [onDraftContentChange]
20951
20603
  );
20952
- const applyReferencePickResult = useCallback10(
20604
+ const applyReferencePickResult = useCallback9(
20953
20605
  async (result) => {
20954
20606
  if (result.files.length > 0) {
20955
- const uploadPromptContent = agentActivityRuntime?.uploadPromptContent;
20607
+ const uploadPromptContent = promptFileUploadSupported ? agentActivityRuntime?.uploadPromptContent : void 0;
20956
20608
  const uploadedFiles = await Promise.all(
20957
20609
  result.files.map(async (file) => {
20958
20610
  const hostPath = file.hostPath?.trim() ?? "";
@@ -20996,15 +20648,32 @@ function AgentComposer({
20996
20648
  editorHandleRef.current?.insertMentionItems(result.mentionItems);
20997
20649
  }
20998
20650
  },
20999
- [agentActivityRuntime, workspaceId]
20651
+ [agentActivityRuntime, promptFileUploadSupported, workspaceId]
21000
20652
  );
21001
- const handleWorkspaceReferencePicker = useCallback10(async () => {
20653
+ const handleWorkspaceReferencePicker = useCallback9(async () => {
21002
20654
  if (!onRequestWorkspaceReferences) {
21003
20655
  return;
21004
20656
  }
21005
20657
  await applyReferencePickResult(await onRequestWorkspaceReferences());
21006
20658
  }, [applyReferencePickResult, onRequestWorkspaceReferences]);
21007
- const handleOpenReferencesForEntity = useCallback10(
20659
+ const applyDroppedFileReferences = useCallback9(
20660
+ async (files) => {
20661
+ if (!promptFilesSupported || !resolveDroppedFileReferences || files.length === 0) {
20662
+ return;
20663
+ }
20664
+ const references = await resolveDroppedFileReferences(files);
20665
+ if (references.length === 0) {
20666
+ return;
20667
+ }
20668
+ await applyReferencePickResult({ files: references, mentionItems: [] });
20669
+ },
20670
+ [
20671
+ applyReferencePickResult,
20672
+ promptFilesSupported,
20673
+ resolveDroppedFileReferences
20674
+ ]
20675
+ );
20676
+ const handleOpenReferencesForEntity = useCallback9(
21008
20677
  (entity) => {
21009
20678
  clearActiveFileMentionTrigger();
21010
20679
  closeFileMentionPalette();
@@ -21023,7 +20692,7 @@ function AgentComposer({
21023
20692
  ]
21024
20693
  );
21025
20694
  openReferencesForEntityRef.current = handleOpenReferencesForEntity;
21026
- const syncMentionPaletteFrame = useCallback10(() => {
20695
+ const syncMentionPaletteFrame = useCallback9(() => {
21027
20696
  const anchor = inputShellRef.current;
21028
20697
  if (!anchor || typeof window === "undefined") {
21029
20698
  setMentionPaletteFrame(null);
@@ -21063,7 +20732,7 @@ function AgentComposer({
21063
20732
  zIndex: resolveMentionPaletteZIndex(anchor)
21064
20733
  });
21065
20734
  }, []);
21066
- useLayoutEffect4(() => {
20735
+ useLayoutEffect3(() => {
21067
20736
  if (!showFileMentionPalette) {
21068
20737
  setMentionPaletteFrame(null);
21069
20738
  return;
@@ -21107,7 +20776,7 @@ function AgentComposer({
21107
20776
  isHeroLayout && AgentGUINode_styles_default.composerInputShellHero
21108
20777
  );
21109
20778
  const inputDisabled = isSelectedProjectMissing || disabled && !canQueueWhileBusy;
21110
- const scheduleComposerFocus = useCallback10(() => {
20779
+ const scheduleComposerFocus = useCallback9(() => {
21111
20780
  if (inputDisabled) {
21112
20781
  return;
21113
20782
  }
@@ -21117,7 +20786,7 @@ function AgentComposer({
21117
20786
  });
21118
20787
  });
21119
20788
  }, [inputDisabled]);
21120
- const handlePastedImages = useCallback10(
20789
+ const handlePastedImages = useCallback9(
21121
20790
  (images) => {
21122
20791
  addDraftImages(images);
21123
20792
  scheduleComposerFocus();
@@ -21136,21 +20805,41 @@ function AgentComposer({
21136
20805
  const target = event.target;
21137
20806
  return target instanceof Node && dropTarget.contains(target);
21138
20807
  };
21139
- const hasPromptImageFiles = (event) => {
20808
+ const systemFileDrag = (event) => {
21140
20809
  if (event.defaultPrevented || inputDisabled || !containsEventTarget(event) || hasWorkspaceFileDropData(event.dataTransfer)) {
21141
- return false;
20810
+ return null;
20811
+ }
20812
+ const dragInfo = systemFileDragInfoFromDataTransfer(event.dataTransfer);
20813
+ const hasRegularFiles = dragInfo.hasRegularFiles && promptFilesSupported;
20814
+ if (!dragInfo.hasImageFiles && !hasRegularFiles) {
20815
+ return null;
20816
+ }
20817
+ return { hasImageFiles: dragInfo.hasImageFiles, hasRegularFiles };
20818
+ };
20819
+ const systemFileDrop = (event) => {
20820
+ if (event.defaultPrevented || inputDisabled || !containsEventTarget(event) || hasWorkspaceFileDropData(event.dataTransfer)) {
20821
+ return null;
21142
20822
  }
21143
- return imageFilesFromDataTransfer(event.dataTransfer).length > 0;
20823
+ const imageFiles = imageFilesFromDataTransfer(event.dataTransfer);
20824
+ const imageFileSet = new Set(imageFiles);
20825
+ const regularFiles = promptFilesSupported ? nonImageFilesFromDataTransfer(event.dataTransfer).filter(
20826
+ (file) => !imageFileSet.has(file)
20827
+ ) : [];
20828
+ if (imageFiles.length === 0 && regularFiles.length === 0) {
20829
+ return null;
20830
+ }
20831
+ return { imageFiles, regularFiles };
21144
20832
  };
21145
20833
  const handleDragOver = (event) => {
21146
20834
  if (!isDragEvent(event)) {
21147
20835
  return;
21148
20836
  }
21149
- if (!hasPromptImageFiles(event)) {
20837
+ const drag = systemFileDrag(event);
20838
+ if (!drag) {
21150
20839
  return;
21151
20840
  }
21152
20841
  event.preventDefault();
21153
- if (!promptImagesSupported) {
20842
+ if (!drag.hasRegularFiles && drag.hasImageFiles && !promptImagesSupported) {
21154
20843
  return;
21155
20844
  }
21156
20845
  if (event.dataTransfer) {
@@ -21161,17 +20850,28 @@ function AgentComposer({
21161
20850
  if (!isDragEvent(event)) {
21162
20851
  return;
21163
20852
  }
21164
- if (!hasPromptImageFiles(event)) {
20853
+ const drop = systemFileDrop(event);
20854
+ if (!drop) {
21165
20855
  return;
21166
20856
  }
21167
20857
  event.preventDefault();
21168
20858
  event.stopPropagation();
20859
+ if (drop.regularFiles.length > 0) {
20860
+ editorHandleRef.current?.focusAtEnd();
20861
+ void applyDroppedFileReferences(drop.regularFiles).then(() => {
20862
+ if (!isDisposed) {
20863
+ scheduleComposerFocus();
20864
+ }
20865
+ });
20866
+ }
20867
+ if (drop.imageFiles.length === 0) {
20868
+ return;
20869
+ }
21169
20870
  if (!promptImagesSupported) {
21170
20871
  onPromptImagesUnsupported?.();
21171
20872
  return;
21172
20873
  }
21173
- const imageFiles = imageFilesFromDataTransfer(event.dataTransfer);
21174
- void readAgentRichTextPromptImages(imageFiles).then((images) => {
20874
+ void readAgentRichTextPromptImages(drop.imageFiles).then((images) => {
21175
20875
  if (isDisposed || images.length === 0) {
21176
20876
  return;
21177
20877
  }
@@ -21188,8 +20888,10 @@ function AgentComposer({
21188
20888
  };
21189
20889
  }, [
21190
20890
  addDraftImages,
20891
+ applyDroppedFileReferences,
21191
20892
  inputDisabled,
21192
20893
  onPromptImagesUnsupported,
20894
+ promptFilesSupported,
21193
20895
  promptImagesSupported,
21194
20896
  scheduleComposerFocus
21195
20897
  ]);
@@ -21223,7 +20925,7 @@ function AgentComposer({
21223
20925
  "--agent-gui-prompt-tip-count": promptTips.length,
21224
20926
  "--agent-gui-prompt-tip-cycle-duration": `${promptTips.length * PROMPT_TIP_CYCLE_STEP_MS}ms`
21225
20927
  } : void 0;
21226
- useLayoutEffect4(() => {
20928
+ useLayoutEffect3(() => {
21227
20929
  if (previewMode) {
21228
20930
  setIsPromptTipOverflowing(false);
21229
20931
  return;
@@ -21257,7 +20959,7 @@ function AgentComposer({
21257
20959
  isPromptTipOverflowing,
21258
20960
  previewMode
21259
20961
  ]);
21260
- useLayoutEffect4(() => {
20962
+ useLayoutEffect3(() => {
21261
20963
  if (isHeroLayout) {
21262
20964
  setDockComposerInputHeight(DOCK_COMPOSER_INPUT_MIN_HEIGHT);
21263
20965
  setDockComposerInputMaxHeight(DOCK_COMPOSER_INPUT_MAX_HEIGHT);
@@ -21404,7 +21106,7 @@ function AgentComposer({
21404
21106
  const sendButtonState = isQueueMode ? "queue" : shouldShowStopButton ? isInterrupting ? "stopping" : "interrupt" : isSendingTurn ? "loading" : "send";
21405
21107
  const sendButtonBusy = isSendingTurn && !isQueueMode;
21406
21108
  const activePromptRequestId = activePrompt?.requestId ?? null;
21407
- const [dismissedPromptRequestId, setDismissedPromptRequestId] = useState11(null);
21109
+ const [dismissedPromptRequestId, setDismissedPromptRequestId] = useState10(null);
21408
21110
  const visibleActivePrompt = activePrompt && dismissedPromptRequestId !== activePromptRequestId ? activePrompt : null;
21409
21111
  const disabledReasonText = disabledReason?.trim() ?? "";
21410
21112
  const effectivePlaceholder = disabledReasonText || placeholder;
@@ -21428,7 +21130,7 @@ function AgentComposer({
21428
21130
  useEffect11(() => {
21429
21131
  setDismissedPromptRequestId(null);
21430
21132
  }, [activePromptRequestId]);
21431
- const submitInteractivePromptAndDismiss = useCallback10(
21133
+ const submitInteractivePromptAndDismiss = useCallback9(
21432
21134
  (input) => {
21433
21135
  onSubmitInteractivePrompt(input);
21434
21136
  setDismissedPromptRequestId(input.requestId);
@@ -21739,7 +21441,8 @@ function AgentComposer({
21739
21441
  promptImagesSupported,
21740
21442
  onPromptImagesUnsupported,
21741
21443
  onPasteImages: handlePastedImages,
21742
- getReferenceForFile
21444
+ getReferenceForFile,
21445
+ onDropFiles: promptFilesSupported ? applyDroppedFileReferences : void 0
21743
21446
  }
21744
21447
  ),
21745
21448
  !isHeroLayout ? composerActionButton : null
@@ -22154,7 +21857,7 @@ function AgentComposerDraftImagePreview({
22154
21857
  removeLabel,
22155
21858
  onRemove
22156
21859
  }) {
22157
- const [aspectRatio, setAspectRatio] = useState11(1);
21860
+ const [aspectRatio, setAspectRatio] = useState10(1);
22158
21861
  const previewWidth = Math.round(
22159
21862
  Math.min(
22160
21863
  DRAFT_IMAGE_PREVIEW_MAX_WIDTH_PX,
@@ -22304,9 +22007,9 @@ function isSlashCommandCapability(command) {
22304
22007
  return "kind" in command && command.kind === "capability";
22305
22008
  }
22306
22009
  function useStableEventCallback(callback) {
22307
- const callbackRef = useRef12(callback);
22010
+ const callbackRef = useRef11(callback);
22308
22011
  callbackRef.current = callback;
22309
- return useCallback10((...args) => callbackRef.current(...args), []);
22012
+ return useCallback9((...args) => callbackRef.current(...args), []);
22310
22013
  }
22311
22014
  function SendFilledIcon() {
22312
22015
  "use memo";
@@ -22803,7 +22506,7 @@ function slashStatusesEqual(left, right) {
22803
22506
  return (left.agentSessionId ?? null) === (right.agentSessionId ?? null) && (left.baseUrl ?? null) === (right.baseUrl ?? null) && (left.contextWindow?.usedTokens ?? null) === (right.contextWindow?.usedTokens ?? null) && (left.contextWindow?.totalTokens ?? null) === (right.contextWindow?.totalTokens ?? null) && slashStatusLimitsEqual(left.limits, right.limits) && Boolean(left.limitsLoading) === Boolean(right.limitsLoading);
22804
22507
  }
22805
22508
  function useStableSlashStatus(status) {
22806
- const statusRef = useRef13(null);
22509
+ const statusRef = useRef12(null);
22807
22510
  if (statusRef.current === null || !slashStatusesEqual(statusRef.current, status)) {
22808
22511
  statusRef.current = status;
22809
22512
  }
@@ -22872,6 +22575,7 @@ function AgentGUINodeView({
22872
22575
  detailMinWidthPx,
22873
22576
  uiLanguage,
22874
22577
  onWorkspaceFileReferencesAdded,
22578
+ resolveDroppedFileReferences = null,
22875
22579
  onConversationRailWidthChanged,
22876
22580
  labels,
22877
22581
  workspaceUserProjectI18n,
@@ -22883,37 +22587,38 @@ function AgentGUINodeView({
22883
22587
  onRequestGitBranches = null,
22884
22588
  contextMentionProviders,
22885
22589
  referenceSourceAggregator = null,
22590
+ resolveWorkspaceReferenceEntryIconUrl,
22886
22591
  resolveMentionReferenceTarget = null,
22887
22592
  resolveWorkspaceReferenceInitialTarget = null,
22888
22593
  workspaceAppIcons = EMPTY_WORKSPACE_APP_ICONS3
22889
22594
  }) {
22890
22595
  "use memo";
22891
- const layoutElementRef = useRef13(null);
22892
- const railResizeInteractionRef = useRef13(null);
22893
- const [isRailResizing, setIsRailResizing] = useState12(false);
22894
- const [railResizeWidthPx, setRailResizeWidthPx] = useState12(
22596
+ const layoutElementRef = useRef12(null);
22597
+ const railResizeInteractionRef = useRef12(null);
22598
+ const [isRailResizing, setIsRailResizing] = useState11(false);
22599
+ const [railResizeWidthPx, setRailResizeWidthPx] = useState11(
22895
22600
  null
22896
22601
  );
22897
- const [workspaceReferencePickerOpen, setWorkspaceReferencePickerOpen] = useState12(false);
22898
- const [workspaceReferencePickerTarget, setWorkspaceReferencePickerTarget] = useState12(null);
22602
+ const [workspaceReferencePickerOpen, setWorkspaceReferencePickerOpen] = useState11(false);
22603
+ const [workspaceReferencePickerTarget, setWorkspaceReferencePickerTarget] = useState11(null);
22899
22604
  const [
22900
22605
  localComposerFocusRequestSequence,
22901
22606
  setLocalComposerFocusRequestSequence
22902
- ] = useState12(0);
22903
- const handledNewConversationRequestSequenceRef = useRef13(
22607
+ ] = useState11(0);
22608
+ const handledNewConversationRequestSequenceRef = useRef12(
22904
22609
  newConversationRequestSequence
22905
22610
  );
22906
- const workspaceReferencePickerResolverRef = useRef13(null);
22611
+ const workspaceReferencePickerResolverRef = useRef12(null);
22907
22612
  const emptyReferencePickResult = useMemo10(
22908
22613
  () => ({ files: [], mentionItems: [] }),
22909
22614
  []
22910
22615
  );
22911
22616
  const hostLocalFileSourceId = "host-local-file";
22912
- const isWorkspaceReferencePickerNodeSelectable = useCallback11(
22617
+ const isWorkspaceReferencePickerNodeSelectable = useCallback10(
22913
22618
  (node) => node.ref.sourceId !== hostLocalFileSourceId || node.kind === "file",
22914
22619
  [hostLocalFileSourceId]
22915
22620
  );
22916
- const requestWorkspaceReferences = useCallback11(
22621
+ const requestWorkspaceReferences = useCallback10(
22917
22622
  async (entity) => {
22918
22623
  if (previewMode) {
22919
22624
  return emptyReferencePickResult;
@@ -22945,13 +22650,13 @@ function AgentGUINodeView({
22945
22650
  workspaceFileReferenceCopy
22946
22651
  ]
22947
22652
  );
22948
- const closeWorkspaceReferencePicker = useCallback11(() => {
22653
+ const closeWorkspaceReferencePicker = useCallback10(() => {
22949
22654
  workspaceReferencePickerResolverRef.current?.(emptyReferencePickResult);
22950
22655
  workspaceReferencePickerResolverRef.current = null;
22951
22656
  setWorkspaceReferencePickerOpen(false);
22952
22657
  setWorkspaceReferencePickerTarget(null);
22953
22658
  }, [emptyReferencePickResult]);
22954
- const settleReferencePicker = useCallback11(
22659
+ const settleReferencePicker = useCallback10(
22955
22660
  (result, addedFiles) => {
22956
22661
  workspaceReferencePickerResolverRef.current?.(result);
22957
22662
  workspaceReferencePickerResolverRef.current = null;
@@ -22963,13 +22668,13 @@ function AgentGUINodeView({
22963
22668
  },
22964
22669
  [onWorkspaceFileReferencesAdded]
22965
22670
  );
22966
- const confirmWorkspaceReferencePicker = useCallback11(
22671
+ const confirmWorkspaceReferencePicker = useCallback10(
22967
22672
  (refs) => {
22968
22673
  settleReferencePicker({ files: refs, mentionItems: [] }, refs);
22969
22674
  },
22970
22675
  [settleReferencePicker]
22971
22676
  );
22972
- const confirmWorkspaceReferenceBundles = useCallback11(
22677
+ const confirmWorkspaceReferenceBundles = useCallback10(
22973
22678
  (result) => {
22974
22679
  const workspaceRefs = result.files.filter(
22975
22680
  (ref) => ref.sourceId !== hostLocalFileSourceId
@@ -23043,7 +22748,7 @@ function AgentGUINodeView({
23043
22748
  );
23044
22749
  const openProjectFiles = useOptionalStableEventCallback(onLinkAction);
23045
22750
  const detailComposerFocusRequestSequence = localComposerFocusRequestSequence === 0 ? composerFocusRequestSequence : (composerFocusRequestSequence ?? 0) + localComposerFocusRequestSequence;
23046
- const requestCreateConversation = useCallback11(
22751
+ const requestCreateConversation = useCallback10(
23047
22752
  (options) => {
23048
22753
  if (previewMode) {
23049
22754
  return;
@@ -23088,14 +22793,14 @@ function AgentGUINodeView({
23088
22793
  }),
23089
22794
  [viewModel.availableCommands, viewModel.workspaceId, workspaceAppIcons]
23090
22795
  );
23091
- const clampConversationRailWidth = useCallback11(
22796
+ const clampConversationRailWidth = useCallback10(
23092
22797
  (widthPx) => Math.min(
23093
22798
  conversationRailMaxWidthPx,
23094
22799
  Math.max(conversationRailMinWidthPx, widthPx)
23095
22800
  ),
23096
22801
  [conversationRailMaxWidthPx, conversationRailMinWidthPx]
23097
22802
  );
23098
- const handleConversationRailResizePointerDown = useCallback11(
22803
+ const handleConversationRailResizePointerDown = useCallback10(
23099
22804
  (event) => {
23100
22805
  if (previewMode) {
23101
22806
  return;
@@ -23116,7 +22821,7 @@ function AgentGUINodeView({
23116
22821
  },
23117
22822
  [conversationRailCollapsed, conversationRailWidthPx, previewMode]
23118
22823
  );
23119
- const handleConversationRailResizePointerMove = useCallback11(
22824
+ const handleConversationRailResizePointerMove = useCallback10(
23120
22825
  (event) => {
23121
22826
  if (previewMode) {
23122
22827
  return;
@@ -23139,7 +22844,7 @@ function AgentGUINodeView({
23139
22844
  },
23140
22845
  [clampConversationRailWidth, previewMode]
23141
22846
  );
23142
- const endConversationRailResize = useCallback11(
22847
+ const endConversationRailResize = useCallback10(
23143
22848
  (event) => {
23144
22849
  const resizeState = railResizeInteractionRef.current;
23145
22850
  if (event && resizeState?.pointerId === event.pointerId && event.currentTarget.hasPointerCapture?.(event.pointerId)) {
@@ -23170,7 +22875,7 @@ function AgentGUINodeView({
23170
22875
  isRailResizing,
23171
22876
  railResizeWidthPx
23172
22877
  ]);
23173
- const handleConversationRailResizeKeyDown = useCallback11(
22878
+ const handleConversationRailResizeKeyDown = useCallback10(
23174
22879
  (event) => {
23175
22880
  if (previewMode) {
23176
22881
  return;
@@ -23202,7 +22907,7 @@ function AgentGUINodeView({
23202
22907
  "--agent-gui-detail-min-width": `${detailMinWidthPx}px`,
23203
22908
  gridTemplateColumns: conversationRailCollapsed ? "0 minmax(var(--agent-gui-detail-min-width), 1fr)" : "var(--agent-gui-conversation-rail-width) minmax(var(--agent-gui-detail-min-width), 1fr)"
23204
22909
  };
23205
- const openAgentEnvSetup = useCallback11(() => {
22910
+ const openAgentEnvSetup = useCallback10(() => {
23206
22911
  openAgentEnvPanel({ provider: viewModel.data.provider, focus: null });
23207
22912
  }, [viewModel.data.provider]);
23208
22913
  const conversationRailStoreState = useMemo10(
@@ -23265,7 +22970,7 @@ function AgentGUINodeView({
23265
22970
  workspaceUserProjectI18n
23266
22971
  ]
23267
22972
  );
23268
- const conversationRailStoreRef = useRef13(
22973
+ const conversationRailStoreRef = useRef12(
23269
22974
  null
23270
22975
  );
23271
22976
  if (conversationRailStoreRef.current === null) {
@@ -23349,6 +23054,7 @@ function AgentGUINodeView({
23349
23054
  onCapabilitySettingsRequest,
23350
23055
  onAgentProviderLogin,
23351
23056
  onRequestWorkspaceReferences: requestWorkspaceReferences,
23057
+ resolveDroppedFileReferences,
23352
23058
  selectProjectDirectory,
23353
23059
  onRequestGitBranches,
23354
23060
  contextMentionProviders,
@@ -23369,6 +23075,7 @@ function AgentGUINodeView({
23369
23075
  isNodeSelectable: isWorkspaceReferencePickerNodeSelectable,
23370
23076
  fileManagerCopy: workspaceFileManagerCopy ?? void 0,
23371
23077
  open: workspaceReferencePickerOpen,
23078
+ resolveEntryIconUrl: resolveWorkspaceReferenceEntryIconUrl,
23372
23079
  workspaceId: viewModel.workspaceId,
23373
23080
  onClose: closeWorkspaceReferencePicker,
23374
23081
  onConfirm: confirmWorkspaceReferencePicker,
@@ -23466,21 +23173,23 @@ var AgentGUIDetailPane = memo(function AgentGUIDetailPane2({
23466
23173
  onCapabilitySettingsRequest,
23467
23174
  onAgentProviderLogin,
23468
23175
  onRequestWorkspaceReferences,
23176
+ resolveDroppedFileReferences = null,
23469
23177
  selectProjectDirectory,
23470
23178
  onRequestGitBranches,
23471
23179
  contextMentionProviders,
23472
23180
  workspaceAppIcons = EMPTY_WORKSPACE_APP_ICONS3
23473
23181
  }) {
23474
23182
  "use memo";
23475
- const timelineRef = useRef13(null);
23476
- const bottomDockRef = useRef13(null);
23477
- const timelineScrollAnchorRef = useRef13(null);
23478
- const pendingPrependScrollAnchorRef = useRef13(null);
23479
- const [isTimelineScrolledToTop, setIsTimelineScrolledToTop] = useState12(true);
23183
+ const timelineRef = useRef12(null);
23184
+ const bottomDockRef = useRef12(null);
23185
+ const timelineScrollAnchorRef = useRef12(null);
23186
+ const submittedPromptScrollConversationRef = useRef12(null);
23187
+ const pendingPrependScrollAnchorRef = useRef12(null);
23188
+ const [isTimelineScrolledToTop, setIsTimelineScrolledToTop] = useState11(true);
23480
23189
  const [
23481
23190
  bottomDockDismissedPromptRequestId,
23482
23191
  setBottomDockDismissedPromptRequestId
23483
- ] = useState12(null);
23192
+ ] = useState11(null);
23484
23193
  const conversation = useProjectedAgentConversation({
23485
23194
  conversation: viewModel.conversation,
23486
23195
  detail: viewModel.conversationDetail,
@@ -23914,7 +23623,7 @@ var AgentGUIDetailPane = memo(function AgentGUIDetailPane2({
23914
23623
  labels.stopping
23915
23624
  ]
23916
23625
  );
23917
- const handleInterruptCurrentTurn = useCallback11(() => {
23626
+ const handleInterruptCurrentTurn = useCallback10(() => {
23918
23627
  actions.interruptCurrentTurn(labels.noRunningResponse);
23919
23628
  }, [actions.interruptCurrentTurn, labels.noRunningResponse]);
23920
23629
  const submitApprovalOption = useStableEventCallback2(
@@ -23935,6 +23644,28 @@ var AgentGUIDetailPane = memo(function AgentGUIDetailPane2({
23935
23644
  const submitGuidancePrompt = useStableEventCallback2(
23936
23645
  actions.submitGuidancePrompt
23937
23646
  );
23647
+ const requestSubmittedPromptScrollToBottom = useCallback10(() => {
23648
+ const activeConversationId = viewModel.activeConversationId;
23649
+ if (!activeConversationId) {
23650
+ return;
23651
+ }
23652
+ submittedPromptScrollConversationRef.current = activeConversationId;
23653
+ pendingPrependScrollAnchorRef.current = null;
23654
+ }, [viewModel.activeConversationId]);
23655
+ const submitPromptAndScrollToBottom = useCallback10(
23656
+ (content, displayPrompt) => {
23657
+ requestSubmittedPromptScrollToBottom();
23658
+ submitPrompt(content, displayPrompt);
23659
+ },
23660
+ [requestSubmittedPromptScrollToBottom, submitPrompt]
23661
+ );
23662
+ const submitGuidancePromptAndScrollToBottom = useCallback10(
23663
+ (content, displayPrompt) => {
23664
+ requestSubmittedPromptScrollToBottom();
23665
+ submitGuidancePrompt(content, displayPrompt);
23666
+ },
23667
+ [requestSubmittedPromptScrollToBottom, submitGuidancePrompt]
23668
+ );
23938
23669
  const showPromptImagesUnsupported = useStableEventCallback2(
23939
23670
  actions.showPromptImagesUnsupported
23940
23671
  );
@@ -23955,7 +23686,7 @@ var AgentGUIDetailPane = memo(function AgentGUIDetailPane2({
23955
23686
  );
23956
23687
  const stableRequestGitBranches = useOptionalStableEventCallback(onRequestGitBranches);
23957
23688
  const authLogin = useOptionalStableEventCallback(onAgentProviderLogin);
23958
- const submitBottomDockInteractivePrompt = useCallback11(
23689
+ const submitBottomDockInteractivePrompt = useCallback10(
23959
23690
  (input) => {
23960
23691
  submitInteractivePrompt(input);
23961
23692
  setBottomDockDismissedPromptRequestId(input.requestId);
@@ -24004,8 +23735,8 @@ var AgentGUIDetailPane = memo(function AgentGUIDetailPane2({
24004
23735
  onDraftContentChange: updateDraftContent,
24005
23736
  onProjectPathChange: updateSelectedProjectPath,
24006
23737
  onSettingsChange: updateComposerSettings,
24007
- onSubmit: submitPrompt,
24008
- onSubmitGuidance: submitGuidancePrompt,
23738
+ onSubmit: submitPromptAndScrollToBottom,
23739
+ onSubmitGuidance: submitGuidancePromptAndScrollToBottom,
24009
23740
  onPromptImagesUnsupported: showPromptImagesUnsupported,
24010
23741
  onSendQueuedPromptNext: sendQueuedPromptNext,
24011
23742
  onRemoveQueuedPrompt: removeQueuedPrompt,
@@ -24015,6 +23746,7 @@ var AgentGUIDetailPane = memo(function AgentGUIDetailPane2({
24015
23746
  onCapabilitySettingsRequest,
24016
23747
  onLinkAction: stableLinkAction,
24017
23748
  onRequestWorkspaceReferences: stableRequestWorkspaceReferences,
23749
+ resolveDroppedFileReferences,
24018
23750
  selectProjectDirectory: stableSelectProjectDirectory,
24019
23751
  onRequestGitBranches: stableRequestGitBranches,
24020
23752
  contextMentionProviders
@@ -24038,14 +23770,15 @@ var AgentGUIDetailPane = memo(function AgentGUIDetailPane2({
24038
23770
  onCapabilitySettingsRequest,
24039
23771
  contextMentionProviders,
24040
23772
  removeQueuedPrompt,
23773
+ resolveDroppedFileReferences,
24041
23774
  sendQueuedPromptNext,
24042
23775
  showPromptImagesUnsupported,
24043
23776
  showStopButton,
24044
23777
  slashStatus,
24045
23778
  submitDisabled,
24046
23779
  submitInteractivePrompt,
24047
- submitPrompt,
24048
- submitGuidancePrompt,
23780
+ submitPromptAndScrollToBottom,
23781
+ submitGuidancePromptAndScrollToBottom,
24049
23782
  uiLanguage,
24050
23783
  stableLinkAction,
24051
23784
  stableRequestGitBranches,
@@ -24100,7 +23833,7 @@ var AgentGUIDetailPane = memo(function AgentGUIDetailPane2({
24100
23833
  viewModel.isRespondingApproval
24101
23834
  ]
24102
23835
  );
24103
- const bottomDockStoreRef = useRef13(null);
23836
+ const bottomDockStoreRef = useRef12(null);
24104
23837
  if (bottomDockStoreRef.current === null) {
24105
23838
  bottomDockStoreRef.current = createAgentGUIBottomDockStore(bottomDockStoreState);
24106
23839
  }
@@ -24120,7 +23853,7 @@ var AgentGUIDetailPane = memo(function AgentGUIDetailPane2({
24120
23853
  useEffect12(() => {
24121
23854
  setBottomDockDismissedPromptRequestId(null);
24122
23855
  }, [activePromptRequestId]);
24123
- useLayoutEffect5(() => {
23856
+ useLayoutEffect4(() => {
24124
23857
  const timeline = timelineRef.current;
24125
23858
  if (!timeline) {
24126
23859
  return;
@@ -24129,6 +23862,7 @@ var AgentGUIDetailPane = memo(function AgentGUIDetailPane2({
24129
23862
  if (!activeConversationId) {
24130
23863
  timelineScrollAnchorRef.current = null;
24131
23864
  pendingPrependScrollAnchorRef.current = null;
23865
+ submittedPromptScrollConversationRef.current = null;
24132
23866
  setIsTimelineScrolledToTop(true);
24133
23867
  return;
24134
23868
  }
@@ -24138,10 +23872,15 @@ var AgentGUIDetailPane = memo(function AgentGUIDetailPane2({
24138
23872
  );
24139
23873
  const anchor = timelineScrollAnchorRef.current;
24140
23874
  const prependAnchor = pendingPrependScrollAnchorRef.current;
23875
+ const shouldScrollSubmittedPromptToBottom = submittedPromptScrollConversationRef.current === activeConversationId;
24141
23876
  let nextScrollTop = timeline.scrollTop;
24142
- if (!anchor || anchor.conversationId !== activeConversationId) {
24143
- timeline.scrollTop = maxScrollTop;
23877
+ if (!anchor || anchor.conversationId !== activeConversationId || shouldScrollSubmittedPromptToBottom) {
23878
+ setTimelineScrollTopInstantly(timeline, maxScrollTop);
24144
23879
  nextScrollTop = maxScrollTop;
23880
+ submittedPromptScrollConversationRef.current = null;
23881
+ if (shouldScrollSubmittedPromptToBottom) {
23882
+ pendingPrependScrollAnchorRef.current = null;
23883
+ }
24145
23884
  } else if (prependAnchor?.conversationId === activeConversationId) {
24146
23885
  const nextScrollHeight = timeline.scrollHeight;
24147
23886
  const delta = nextScrollHeight - prependAnchor.scrollHeight;
@@ -24181,7 +23920,7 @@ var AgentGUIDetailPane = memo(function AgentGUIDetailPane2({
24181
23920
  viewModel.activeConversationId,
24182
23921
  viewModel.isLoadingOlderMessages
24183
23922
  ]);
24184
- useLayoutEffect5(() => {
23923
+ useLayoutEffect4(() => {
24185
23924
  const timeline = timelineRef.current;
24186
23925
  const bottomDock = bottomDockRef.current;
24187
23926
  const activeConversationId = viewModel.activeConversationId;
@@ -24485,15 +24224,15 @@ function AgentRunPathInfo({
24485
24224
  ] });
24486
24225
  }
24487
24226
  function useStableEventCallback2(callback) {
24488
- const callbackRef = useRef13(callback);
24489
- useLayoutEffect5(() => {
24227
+ const callbackRef = useRef12(callback);
24228
+ useLayoutEffect4(() => {
24490
24229
  callbackRef.current = callback;
24491
24230
  }, [callback]);
24492
- return useCallback11((...args) => callbackRef.current(...args), []);
24231
+ return useCallback10((...args) => callbackRef.current(...args), []);
24493
24232
  }
24494
24233
  function useOptionalStableEventCallback(callback) {
24495
- const callbackRef = useRef13(callback);
24496
- useLayoutEffect5(() => {
24234
+ const callbackRef = useRef12(callback);
24235
+ useLayoutEffect4(() => {
24497
24236
  callbackRef.current = callback;
24498
24237
  }, [callback]);
24499
24238
  return useMemo10(() => {
@@ -24816,16 +24555,16 @@ var AgentGUIConversationRailPane = memo(
24816
24555
  onConfirmDeleteConversation
24817
24556
  }) {
24818
24557
  "use memo";
24819
- const [conversationQuery, setConversationQuery] = useState12("");
24820
- const [collapsedProjectSectionIds, setCollapsedProjectSectionIds] = useState12(() => /* @__PURE__ */ new Set());
24821
- const [currentTimeMs, setCurrentTimeMs] = useState12(() => Date.now());
24822
- const [pendingProjectAction, setPendingProjectAction] = useState12(null);
24823
- const railElementRef = useRef13(null);
24824
- const conversationListRef = useRef13(null);
24825
- const conversationItemElementsRef = useRef13(
24558
+ const [conversationQuery, setConversationQuery] = useState11("");
24559
+ const [collapsedProjectSectionIds, setCollapsedProjectSectionIds] = useState11(() => /* @__PURE__ */ new Set());
24560
+ const [currentTimeMs, setCurrentTimeMs] = useState11(() => Date.now());
24561
+ const [pendingProjectAction, setPendingProjectAction] = useState11(null);
24562
+ const railElementRef = useRef12(null);
24563
+ const conversationListRef = useRef12(null);
24564
+ const conversationItemElementsRef = useRef12(
24826
24565
  /* @__PURE__ */ new Map()
24827
24566
  );
24828
- const groupedConversationsRef = useRef13(null);
24567
+ const groupedConversationsRef = useRef12(null);
24829
24568
  useEffect12(() => {
24830
24569
  const timer = window.setInterval(() => {
24831
24570
  setCurrentTimeMs(Date.now());
@@ -24865,7 +24604,7 @@ var AgentGUIConversationRailPane = memo(
24865
24604
  };
24866
24605
  }, [conversationQuery, filteredConversations, labels, userProjects]);
24867
24606
  const groupedConversations = groupedConversationResult.groups;
24868
- const toggleProjectSectionCollapsed = useCallback11((sectionId) => {
24607
+ const toggleProjectSectionCollapsed = useCallback10((sectionId) => {
24869
24608
  setCollapsedProjectSectionIds((current) => {
24870
24609
  const next = new Set(current);
24871
24610
  if (next.has(sectionId)) {
@@ -24895,7 +24634,7 @@ var AgentGUIConversationRailPane = memo(
24895
24634
  }
24896
24635
  return counts;
24897
24636
  }, [conversations]);
24898
- const registerConversationItemElement = useCallback11(
24637
+ const registerConversationItemElement = useCallback10(
24899
24638
  (itemId, element) => {
24900
24639
  if (element) {
24901
24640
  conversationItemElementsRef.current.set(itemId, element);
@@ -24905,7 +24644,7 @@ var AgentGUIConversationRailPane = memo(
24905
24644
  },
24906
24645
  []
24907
24646
  );
24908
- useLayoutEffect5(() => {
24647
+ useLayoutEffect4(() => {
24909
24648
  if (!activeConversationId) {
24910
24649
  return;
24911
24650
  }
@@ -25079,7 +24818,7 @@ var AgentGUIConversationRailPane = memo(
25079
24818
  {
25080
24819
  type: "button",
25081
24820
  "data-testid": "agent-gui-config-env-setup",
25082
- className: "nodrag -mx-1 flex w-[calc(100%+0.5rem)] items-center gap-2 rounded-[6px] px-2 py-1 text-[13px] text-[var(--text-secondary)] transition-colors hover:bg-background-hover hover:text-[var(--text-primary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [-webkit-app-region:no-drag]",
24821
+ className: "nodrag -mx-1 flex w-[calc(100%+0.5rem)] items-center gap-2 rounded-[6px] px-2 py-1 text-[13px] text-[var(--text-primary)] transition-colors hover:bg-[var(--transparency-hover)] hover:text-[var(--text-primary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--border-focus)] disabled:text-[var(--text-tertiary)] [-webkit-app-region:no-drag]",
25083
24822
  disabled: previewMode,
25084
24823
  onClick: () => onOpenAgentEnvSetup(),
25085
24824
  children: [
@@ -25169,14 +24908,14 @@ var AgentGUIConversationRailSection = memo(
25169
24908
  }) {
25170
24909
  "use memo";
25171
24910
  const isProjectSection = section.kind === "project";
25172
- const [visibleItemLimit, setVisibleItemLimit] = useState12(
24911
+ const [visibleItemLimit, setVisibleItemLimit] = useState11(
25173
24912
  AGENT_GUI_CONVERSATION_RAIL_SECTION_PAGE_SIZE
25174
24913
  );
25175
24914
  const visibleItemCount = isSectionCollapsed ? 0 : Math.min(visibleItemLimit, section.items.length);
25176
24915
  const visibleItems = isSectionCollapsed ? [] : section.items.slice(0, visibleItemCount);
25177
24916
  const canShowMore = !isSectionCollapsed && visibleItemCount < section.items.length;
25178
24917
  const canShowLess = !isSectionCollapsed && visibleItemCount > AGENT_GUI_CONVERSATION_RAIL_SECTION_PAGE_SIZE;
25179
- const showMoreConversations = useCallback11(() => {
24918
+ const showMoreConversations = useCallback10(() => {
25180
24919
  setVisibleItemLimit(
25181
24920
  (current) => Math.min(
25182
24921
  section.items.length,
@@ -25184,12 +24923,12 @@ var AgentGUIConversationRailSection = memo(
25184
24923
  )
25185
24924
  );
25186
24925
  }, [section.items.length]);
25187
- const showLessConversations = useCallback11(() => {
24926
+ const showLessConversations = useCallback10(() => {
25188
24927
  setVisibleItemLimit(AGENT_GUI_CONVERSATION_RAIL_SECTION_PAGE_SIZE);
25189
24928
  }, []);
25190
24929
  const canCreateConversationFromSection = section.kind === "conversations" || Boolean(projectPath);
25191
24930
  const createConversationLabel = projectPath ? labels.projectSectionEdit : labels.newConversation;
25192
- const handleCreateConversation = useCallback11(() => {
24931
+ const handleCreateConversation = useCallback10(() => {
25193
24932
  if (projectPath) {
25194
24933
  onCreateConversation({ projectPath, source: "project_section" });
25195
24934
  return;
@@ -25518,27 +25257,27 @@ var AgentGUIConversationRailItem = memo(
25518
25257
  }) {
25519
25258
  "use memo";
25520
25259
  const pinned = (item.pinnedAtUnixMs ?? 0) > 0;
25521
- const setItemElement = useCallback11(
25260
+ const setItemElement = useCallback10(
25522
25261
  (element) => {
25523
25262
  registerItemElement(item.id, element);
25524
25263
  },
25525
25264
  [item.id, registerItemElement]
25526
25265
  );
25527
- const handleMouseLeave = useCallback11(() => {
25266
+ const handleMouseLeave = useCallback10(() => {
25528
25267
  if (isPendingDeleteConversation) {
25529
25268
  onCancelDeleteConversation();
25530
25269
  }
25531
25270
  }, [isPendingDeleteConversation, onCancelDeleteConversation]);
25532
- const handleSelect = useCallback11(() => {
25271
+ const handleSelect = useCallback10(() => {
25533
25272
  onSelectConversation(item.id);
25534
25273
  }, [item.id, onSelectConversation]);
25535
- const handleTogglePinned = useCallback11(() => {
25274
+ const handleTogglePinned = useCallback10(() => {
25536
25275
  onToggleConversationPinned(item.id, !pinned);
25537
25276
  }, [item.id, onToggleConversationPinned, pinned]);
25538
- const handleOpenConversationWindow = useCallback11(() => {
25277
+ const handleOpenConversationWindow = useCallback10(() => {
25539
25278
  onOpenConversationWindow?.(item.id);
25540
25279
  }, [item.id, onOpenConversationWindow]);
25541
- const handleRequestDelete = useCallback11(() => {
25280
+ const handleRequestDelete = useCallback10(() => {
25542
25281
  onRequestDeleteConversation(item.id);
25543
25282
  }, [item.id, onRequestDeleteConversation]);
25544
25283
  return /* @__PURE__ */ jsxs17(
@@ -25963,11 +25702,11 @@ function appendDockProbeUsageLines(probe, lines, isLoadingUsage, t) {
25963
25702
  // agent-gui/workspaceDesktop/view/AgentProbeInfoPopover.tsx
25964
25703
  import { Info as Info3 } from "lucide-react";
25965
25704
  import {
25966
- useCallback as useCallback12,
25705
+ useCallback as useCallback11,
25967
25706
  useEffect as useEffect13,
25968
- useLayoutEffect as useLayoutEffect6,
25969
- useRef as useRef14,
25970
- useState as useState13
25707
+ useLayoutEffect as useLayoutEffect5,
25708
+ useRef as useRef13,
25709
+ useState as useState12
25971
25710
  } from "react";
25972
25711
  import { createPortal as createPortal4 } from "react-dom";
25973
25712
  import { Fragment as Fragment9, jsx as jsx32, jsxs as jsxs18 } from "react/jsx-runtime";
@@ -26003,18 +25742,18 @@ function AgentProbeInfoPopover({
26003
25742
  className
26004
25743
  }) {
26005
25744
  "use memo";
26006
- const anchorRef = useRef14(null);
26007
- const popoverRef = useRef14(null);
26008
- const [isOpen, setIsOpen] = useState13(false);
26009
- const [popoverStyle, setPopoverStyle] = useState13(null);
26010
- const closeIfPointerLeavesPopover = useCallback12((event) => {
25745
+ const anchorRef = useRef13(null);
25746
+ const popoverRef = useRef13(null);
25747
+ const [isOpen, setIsOpen] = useState12(false);
25748
+ const [popoverStyle, setPopoverStyle] = useState12(null);
25749
+ const closeIfPointerLeavesPopover = useCallback11((event) => {
26011
25750
  const nextTarget = event.relatedTarget;
26012
25751
  if (nextTarget instanceof Node && (anchorRef.current?.contains(nextTarget) || popoverRef.current?.contains(nextTarget))) {
26013
25752
  return;
26014
25753
  }
26015
25754
  setIsOpen(false);
26016
25755
  }, []);
26017
- const updatePopoverPosition = useCallback12(() => {
25756
+ const updatePopoverPosition = useCallback11(() => {
26018
25757
  const anchor = anchorRef.current;
26019
25758
  if (!anchor) {
26020
25759
  return;
@@ -26046,7 +25785,7 @@ function AgentProbeInfoPopover({
26046
25785
  }
26047
25786
  updatePopoverPosition();
26048
25787
  }, [isOpen, lines, updatePopoverPosition]);
26049
- useLayoutEffect6(() => {
25788
+ useLayoutEffect5(() => {
26050
25789
  if (!isOpen) {
26051
25790
  return;
26052
25791
  }
@@ -26460,7 +26199,7 @@ function composerOverridesByProviderEqual(left, right) {
26460
26199
  return true;
26461
26200
  }
26462
26201
  function areAgentGUINodePropsEqual(previous, next) {
26463
- return previous.nodeId === next.nodeId && previous.workspaceId === next.workspaceId && previous.currentUserId === next.currentUserId && previous.workspacePath === next.workspacePath && previous.workspaceFileReferenceAdapter === next.workspaceFileReferenceAdapter && previous.selectProjectDirectory === next.selectProjectDirectory && previous.referenceSourceAggregator === next.referenceSourceAggregator && previous.resolveMentionReferenceTarget === next.resolveMentionReferenceTarget && previous.resolveWorkspaceReferenceInitialTarget === next.resolveWorkspaceReferenceInitialTarget && previous.onWorkspaceFileReferencesAdded === next.onWorkspaceFileReferencesAdded && previous.agentSettings.avoidGroupingEdits === next.agentSettings.avoidGroupingEdits && previous.title === next.title && agentGuiStateEquals(previous.state, next.state) && previous.position.x === next.position.x && previous.position.y === next.position.y && previous.width === next.width && previous.height === next.height && previous.desktopSize.width === next.desktopSize.width && previous.desktopSize.height === next.desktopSize.height && previous.onLinkAction === next.onLinkAction && previous.onCapabilitySettingsRequest === next.onCapabilitySettingsRequest && previous.onAgentProviderLogin === next.onAgentProviderLogin && previous.providerTargets === next.providerTargets && previous.defaultProviderTargetId === next.defaultProviderTargetId && previous.onClose === next.onClose && previous.onResize === next.onResize && previous.onUpdateNode === next.onUpdateNode && previous.onRememberComposerDefaults === next.onRememberComposerDefaults && previous.onOpenConversationWindow === next.onOpenConversationWindow && previous.isMaximized === next.isMaximized && previous.isMuted === next.isMuted && previous.onMinimize === next.onMinimize && previous.onToggleMaximize === next.onToggleMaximize && previous.onShowMessage === next.onShowMessage && workspaceAgentProbeRenderStateEqualsForProvider(
26202
+ return previous.nodeId === next.nodeId && previous.workspaceId === next.workspaceId && previous.currentUserId === next.currentUserId && previous.workspacePath === next.workspacePath && previous.workspaceFileReferenceAdapter === next.workspaceFileReferenceAdapter && previous.resolveDroppedFileReferences === next.resolveDroppedFileReferences && previous.selectProjectDirectory === next.selectProjectDirectory && previous.referenceSourceAggregator === next.referenceSourceAggregator && previous.resolveWorkspaceReferenceEntryIconUrl === next.resolveWorkspaceReferenceEntryIconUrl && previous.resolveMentionReferenceTarget === next.resolveMentionReferenceTarget && previous.resolveWorkspaceReferenceInitialTarget === next.resolveWorkspaceReferenceInitialTarget && previous.onWorkspaceFileReferencesAdded === next.onWorkspaceFileReferencesAdded && previous.agentSettings.avoidGroupingEdits === next.agentSettings.avoidGroupingEdits && previous.title === next.title && agentGuiStateEquals(previous.state, next.state) && previous.position.x === next.position.x && previous.position.y === next.position.y && previous.width === next.width && previous.height === next.height && previous.desktopSize.width === next.desktopSize.width && previous.desktopSize.height === next.desktopSize.height && previous.onLinkAction === next.onLinkAction && previous.onCapabilitySettingsRequest === next.onCapabilitySettingsRequest && previous.onAgentProviderLogin === next.onAgentProviderLogin && previous.providerTargets === next.providerTargets && previous.defaultProviderTargetId === next.defaultProviderTargetId && previous.onClose === next.onClose && previous.onResize === next.onResize && previous.onUpdateNode === next.onUpdateNode && previous.onRememberComposerDefaults === next.onRememberComposerDefaults && previous.onOpenConversationWindow === next.onOpenConversationWindow && previous.isMaximized === next.isMaximized && previous.isMuted === next.isMuted && previous.onMinimize === next.onMinimize && previous.onToggleMaximize === next.onToggleMaximize && previous.onShowMessage === next.onShowMessage && workspaceAgentProbeRenderStateEqualsForProvider(
26464
26203
  previous.workspaceAgentProbes,
26465
26204
  next.workspaceAgentProbes,
26466
26205
  previous.state.provider
@@ -26474,7 +26213,9 @@ var AgentGUINode = memo2(function AgentGUINode2({
26474
26213
  workspaceFileReferenceAdapter = null,
26475
26214
  onRequestGitBranches = null,
26476
26215
  selectProjectDirectory,
26216
+ resolveDroppedFileReferences = null,
26477
26217
  referenceSourceAggregator = null,
26218
+ resolveWorkspaceReferenceEntryIconUrl,
26478
26219
  resolveMentionReferenceTarget = null,
26479
26220
  resolveWorkspaceReferenceInitialTarget = null,
26480
26221
  agentSettings,
@@ -26524,7 +26265,7 @@ var AgentGUINode = memo2(function AgentGUINode2({
26524
26265
  () => typeof i18n?.t === "function" ? createWorkspaceFileManagerI18nRuntime(i18n) : null,
26525
26266
  [i18n]
26526
26267
  );
26527
- const handleLinkAction = useCallback13(
26268
+ const handleLinkAction = useCallback12(
26528
26269
  (action) => {
26529
26270
  onLinkAction?.(
26530
26271
  action.type === "open-agent-session" && !action.provider ? { ...action, provider: state.provider } : action
@@ -26532,7 +26273,7 @@ var AgentGUINode = memo2(function AgentGUINode2({
26532
26273
  },
26533
26274
  [onLinkAction, state.provider]
26534
26275
  );
26535
- const handleAgentProviderLogin = useCallback13(
26276
+ const handleAgentProviderLogin = useCallback12(
26536
26277
  (provider) => {
26537
26278
  const resolvedProvider = normalizeAgentGUIProviderIdentity(provider);
26538
26279
  onAgentProviderLogin?.(
@@ -26541,7 +26282,7 @@ var AgentGUINode = memo2(function AgentGUINode2({
26541
26282
  },
26542
26283
  [onAgentProviderLogin, state.provider]
26543
26284
  );
26544
- const handleWorkspaceFileReferencesAdded = useCallback13(
26285
+ const handleWorkspaceFileReferencesAdded = useCallback12(
26545
26286
  (references) => {
26546
26287
  onWorkspaceFileReferencesAdded?.({
26547
26288
  provider: state.provider,
@@ -26550,7 +26291,7 @@ var AgentGUINode = memo2(function AgentGUINode2({
26550
26291
  },
26551
26292
  [onWorkspaceFileReferencesAdded, state.provider]
26552
26293
  );
26553
- const handleDataChange = useCallback13(
26294
+ const handleDataChange = useCallback12(
26554
26295
  (updater) => {
26555
26296
  if (previewMode) {
26556
26297
  return;
@@ -26559,7 +26300,7 @@ var AgentGUINode = memo2(function AgentGUINode2({
26559
26300
  },
26560
26301
  [onUpdateNode, previewMode]
26561
26302
  );
26562
- const handleConversationRailWidthChanged = useCallback13(
26303
+ const handleConversationRailWidthChanged = useCallback12(
26563
26304
  (widthPx) => {
26564
26305
  if (previewMode) {
26565
26306
  return;
@@ -26591,7 +26332,7 @@ var AgentGUINode = memo2(function AgentGUINode2({
26591
26332
  }),
26592
26333
  []
26593
26334
  );
26594
- const toggleConversationRailCollapsed = useCallback13(() => {
26335
+ const toggleConversationRailCollapsed = useCallback12(() => {
26595
26336
  if (previewMode) {
26596
26337
  return;
26597
26338
  }
@@ -26600,7 +26341,7 @@ var AgentGUINode = memo2(function AgentGUINode2({
26600
26341
  conversationRailCollapsed: current.conversationRailCollapsed !== true
26601
26342
  }));
26602
26343
  }, [onUpdateNode, previewMode]);
26603
- const handleConversationRailToggle = useCallback13(() => {
26344
+ const handleConversationRailToggle = useCallback12(() => {
26604
26345
  if (previewMode) {
26605
26346
  return;
26606
26347
  }
@@ -26654,7 +26395,7 @@ var AgentGUINode = memo2(function AgentGUINode2({
26654
26395
  onRememberComposerDefaults,
26655
26396
  onShowMessage
26656
26397
  });
26657
- const handleCreateConversation = useCallback13(
26398
+ const handleCreateConversation = useCallback12(
26658
26399
  (...args) => {
26659
26400
  if (!previewMode) {
26660
26401
  onUpdateNode(
@@ -26914,6 +26655,11 @@ var AgentGUINode = memo2(function AgentGUINode2({
26914
26655
  id: "bypassPermissions",
26915
26656
  label: t("agentHost.agentGui.planModes.allowAll.label"),
26916
26657
  description: t("agentHost.agentGui.planModes.allowAll.description")
26658
+ },
26659
+ {
26660
+ id: "auto",
26661
+ label: t("agentHost.agentGui.planModes.auto.label"),
26662
+ description: t("agentHost.agentGui.planModes.auto.description")
26917
26663
  }
26918
26664
  ],
26919
26665
  stayInPlan: t("agentHost.agentGui.stayInPlan"),
@@ -27332,6 +27078,7 @@ var AgentGUINode = memo2(function AgentGUINode2({
27332
27078
  detailMinWidthPx: AGENT_GUI_DETAIL_MIN_WIDTH_PX,
27333
27079
  uiLanguage: locale,
27334
27080
  onWorkspaceFileReferencesAdded: onWorkspaceFileReferencesAdded ? handleWorkspaceFileReferencesAdded : void 0,
27081
+ resolveDroppedFileReferences,
27335
27082
  onConversationRailWidthChanged: handleConversationRailWidthChanged,
27336
27083
  labels,
27337
27084
  workspaceUserProjectI18n,
@@ -27341,6 +27088,7 @@ var AgentGUINode = memo2(function AgentGUINode2({
27341
27088
  onRequestGitBranches,
27342
27089
  selectProjectDirectory,
27343
27090
  referenceSourceAggregator,
27091
+ resolveWorkspaceReferenceEntryIconUrl,
27344
27092
  resolveMentionReferenceTarget,
27345
27093
  resolveWorkspaceReferenceInitialTarget,
27346
27094
  workspaceFileReferenceCopy,