@tutti-os/agent-gui 0.0.28 → 0.0.29

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 (37) hide show
  1. package/dist/{AgentMentionSearchController-2Vjvmzh3.d.ts → AgentMentionSearchController-D5ks45fN.d.ts} +1 -0
  2. package/dist/agent-conversation/index.js +5 -5
  3. package/dist/agent-message-center/index.js +4 -4
  4. package/dist/app/renderer/agentactivity.css +40 -9
  5. package/dist/{chunk-IBQO76IY.js → chunk-DY2EAW7B.js} +2 -2
  6. package/dist/{chunk-XAQQN6MP.js → chunk-FG66NW5M.js} +2 -2
  7. package/dist/{chunk-LHN26OIP.js → chunk-KAJRFXJK.js} +4 -4
  8. package/dist/{chunk-ILBFIZCI.js → chunk-O57DGCOA.js} +30 -39
  9. package/dist/chunk-O57DGCOA.js.map +1 -0
  10. package/dist/{chunk-GLDKFIWM.js → chunk-RQ3HEF42.js} +7 -7
  11. package/dist/chunk-RQ3HEF42.js.map +1 -0
  12. package/dist/{chunk-LKT3EFGR.js → chunk-UC73DDC5.js} +126 -45
  13. package/dist/chunk-UC73DDC5.js.map +1 -0
  14. package/dist/{chunk-F7XLV7M3.js → chunk-WPWZKKKV.js} +2 -2
  15. package/dist/{chunk-B7DTDZVT.js → chunk-XBRKN4EC.js} +5 -8
  16. package/dist/chunk-XBRKN4EC.js.map +1 -0
  17. package/dist/chunk-Y35GDLP2.js +88 -0
  18. package/dist/chunk-Y35GDLP2.js.map +1 -0
  19. package/dist/context-mention-palette/index.d.ts +4 -3
  20. package/dist/context-mention-palette/index.js +6 -6
  21. package/dist/i18n/index.d.ts +6 -6
  22. package/dist/i18n/index.js +1 -1
  23. package/dist/index.d.ts +2 -2
  24. package/dist/index.js +172 -66
  25. package/dist/index.js.map +1 -1
  26. package/dist/workspace-agent-generated-files.js +3 -3
  27. package/package.json +12 -12
  28. package/dist/chunk-B7DTDZVT.js.map +0 -1
  29. package/dist/chunk-GLDKFIWM.js.map +0 -1
  30. package/dist/chunk-ILBFIZCI.js.map +0 -1
  31. package/dist/chunk-LKT3EFGR.js.map +0 -1
  32. package/dist/chunk-XJ34OIEQ.js +0 -18
  33. package/dist/chunk-XJ34OIEQ.js.map +0 -1
  34. /package/dist/{chunk-IBQO76IY.js.map → chunk-DY2EAW7B.js.map} +0 -0
  35. /package/dist/{chunk-XAQQN6MP.js.map → chunk-FG66NW5M.js.map} +0 -0
  36. /package/dist/{chunk-LHN26OIP.js.map → chunk-KAJRFXJK.js.map} +0 -0
  37. /package/dist/{chunk-F7XLV7M3.js.map → chunk-WPWZKKKV.js.map} +0 -0
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  AgentInteractivePromptSurface,
15
15
  approvalOptionDisplayLabel
16
- } from "./chunk-LHN26OIP.js";
16
+ } from "./chunk-KAJRFXJK.js";
17
17
  import {
18
18
  PLAN_IMPLEMENTATION_ACTION_FEEDBACK,
19
19
  PLAN_IMPLEMENTATION_ACTION_IMPLEMENT,
@@ -36,13 +36,13 @@ import {
36
36
  skillDescriptionForDisplay,
37
37
  skillTriggerForPrefix,
38
38
  useProjectedAgentConversation
39
- } from "./chunk-LKT3EFGR.js";
39
+ } from "./chunk-UC73DDC5.js";
40
40
  import {
41
41
  AgentMessageMarkdown,
42
42
  ZoomableImage,
43
43
  cn,
44
44
  resolveWorkspaceLinkAction
45
- } from "./chunk-IBQO76IY.js";
45
+ } from "./chunk-DY2EAW7B.js";
46
46
  import {
47
47
  AGENT_MENTION_FILTER_TAB_ORDER,
48
48
  AgentFileMentionPalette,
@@ -50,7 +50,7 @@ import {
50
50
  DEFAULT_AGENT_MENTION_FILTER,
51
51
  agentMentionItemKey,
52
52
  preloadAgentMentionBrowse
53
- } from "./chunk-ILBFIZCI.js";
53
+ } from "./chunk-O57DGCOA.js";
54
54
  import {
55
55
  WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN,
56
56
  buildWorkspaceAgentActivityListViewModel,
@@ -59,13 +59,13 @@ import {
59
59
  mergeWorkspaceAgentActivityDurableAndOverlayMessages,
60
60
  normalizeOptionalWorkspaceAgentStatus,
61
61
  selectWorkspaceAgentActivityOverlayMessages
62
- } from "./chunk-B7DTDZVT.js";
62
+ } from "./chunk-XBRKN4EC.js";
63
63
  import {
64
64
  MANAGED_AGENT_ICON_FALLBACK_URL,
65
65
  MANAGED_AGENT_ICON_URLS,
66
66
  Spinner,
67
67
  normalizeManagedAgentProvider
68
- } from "./chunk-F7XLV7M3.js";
68
+ } from "./chunk-WPWZKKKV.js";
69
69
  import "./chunk-MTFSQWZ6.js";
70
70
  import {
71
71
  resolveWorkspaceAgentSessionSortTimeUnixMs
@@ -76,8 +76,8 @@ import {
76
76
  mentionItemToAttrs,
77
77
  normalizeAgentSessionMentionTitle,
78
78
  parseMentionItemFromHref
79
- } from "./chunk-XAQQN6MP.js";
80
- import "./chunk-XJ34OIEQ.js";
79
+ } from "./chunk-FG66NW5M.js";
80
+ import "./chunk-Y35GDLP2.js";
81
81
  import {
82
82
  AgentActivityHostProvider,
83
83
  AgentActivityRuntimeProvider,
@@ -105,7 +105,7 @@ import {
105
105
  getActiveUiLanguage,
106
106
  translate,
107
107
  useTranslation
108
- } from "./chunk-GLDKFIWM.js";
108
+ } from "./chunk-RQ3HEF42.js";
109
109
  import "./chunk-LUGELG5V.js";
110
110
  import "./chunk-PJP5BUU6.js";
111
111
 
@@ -3277,7 +3277,7 @@ function agentComposerDraftToPromptContent(input) {
3277
3277
  type: "file",
3278
3278
  ...file.mimeType ? { mimeType: file.mimeType } : {},
3279
3279
  ...file.path ? { path: file.path } : {},
3280
- ...file.hostPath ? { hostPath: file.hostPath } : {},
3280
+ ...!file.path && file.hostPath ? { hostPath: file.hostPath } : {},
3281
3281
  ...file.assetId ? { assetId: file.assetId } : {},
3282
3282
  ...file.sizeBytes ? { sizeBytes: file.sizeBytes } : {},
3283
3283
  name: file.name,
@@ -6347,6 +6347,64 @@ function cancelResultSessionStatusIsNonBusy(result) {
6347
6347
  });
6348
6348
  return status !== null && status.kind !== "working" && status.kind !== "waiting";
6349
6349
  }
6350
+ function shouldClearSubmittedDraft(input) {
6351
+ const currentDraft = input.currentDraft;
6352
+ if (!currentDraft) {
6353
+ return false;
6354
+ }
6355
+ const submittedPrompt = agentPromptContentDisplayText(
6356
+ input.submittedContent
6357
+ ).trim();
6358
+ if (currentDraft.prompt.trim() !== submittedPrompt) {
6359
+ return false;
6360
+ }
6361
+ const submittedImages = input.submittedContent.filter(
6362
+ (block) => block.type === "image"
6363
+ );
6364
+ if (currentDraft.images.length !== submittedImages.length) {
6365
+ return false;
6366
+ }
6367
+ const imagesMatch = currentDraft.images.every((image, index) => {
6368
+ const submittedImage = submittedImages[index];
6369
+ if (!submittedImage || image.mimeType !== submittedImage.mimeType) {
6370
+ return false;
6371
+ }
6372
+ const draftPath = image.path?.trim() ?? "";
6373
+ const submittedPath = submittedImage.path?.trim() ?? "";
6374
+ const draftData = image.data?.trim() ?? "";
6375
+ const submittedData = submittedImage.data?.trim() ?? "";
6376
+ const draftName = image.name.trim();
6377
+ const submittedName = submittedImage.name?.trim() ?? "";
6378
+ return draftPath === submittedPath && draftData === submittedData && draftName === submittedName;
6379
+ });
6380
+ if (!imagesMatch) {
6381
+ return false;
6382
+ }
6383
+ const currentFiles = currentDraft.files ?? [];
6384
+ const submittedFiles = input.submittedContent.filter(
6385
+ (block) => block.type === "file"
6386
+ );
6387
+ if (currentFiles.length !== submittedFiles.length) {
6388
+ return false;
6389
+ }
6390
+ return currentFiles.every((file, index) => {
6391
+ const submittedFile = submittedFiles[index];
6392
+ if (!submittedFile) {
6393
+ return false;
6394
+ }
6395
+ const draftPath = file.path?.trim() ?? "";
6396
+ const submittedPath = submittedFile.path?.trim() ?? "";
6397
+ const draftHostPath = file.hostPath?.trim() ?? "";
6398
+ const submittedHostPath = submittedFile.hostPath?.trim() ?? "";
6399
+ const draftAssetId = file.assetId?.trim() ?? "";
6400
+ const submittedAssetId = submittedFile.assetId?.trim() ?? "";
6401
+ const draftMimeType = file.mimeType?.trim() ?? "";
6402
+ const submittedMimeType = submittedFile.mimeType?.trim() ?? "";
6403
+ const draftName = file.name.trim();
6404
+ const submittedName = submittedFile.name?.trim() ?? "";
6405
+ return draftPath === submittedPath && draftHostPath === submittedHostPath && draftAssetId === submittedAssetId && draftMimeType === submittedMimeType && draftName === submittedName && file.sizeBytes === submittedFile.sizeBytes;
6406
+ });
6407
+ }
6350
6408
  function cancelBusySource(input) {
6351
6409
  if (input.hasActivePrompt) {
6352
6410
  return "interactive_prompt";
@@ -9977,7 +10035,10 @@ function useAgentGUINodeController({
9977
10035
  if (!queuedPromptId) {
9978
10036
  setDraftBySessionId((current) => {
9979
10037
  const currentDraft = current[agentSessionId];
9980
- if (currentDraft?.prompt.trim() !== submittedPromptText || currentDraft.images.length > 0) {
10038
+ if (!shouldClearSubmittedDraft({
10039
+ currentDraft,
10040
+ submittedContent: normalizedContent
10041
+ })) {
9981
10042
  return current;
9982
10043
  }
9983
10044
  return {
@@ -17172,7 +17233,6 @@ function AgentComposer({
17172
17233
  const [paletteDraftPrompt, setPaletteDraftPrompt] = useState10(draftPrompt);
17173
17234
  const [fileMentionSuggestion, setFileMentionSuggestion] = useState10(null);
17174
17235
  const [isSelectedProjectMissing, setIsSelectedProjectMissing] = useState10(false);
17175
- const [submittedImagePreview, setSubmittedImagePreview] = useState10([]);
17176
17236
  const [isSlashStatusPanelOpen, setIsSlashStatusPanelOpen] = useState10(false);
17177
17237
  const slashStatusAgentSessionId = slashStatus?.agentSessionId ?? null;
17178
17238
  const previousSlashStatusAgentSessionIdRef = useRef12(
@@ -17196,7 +17256,6 @@ function AgentComposer({
17196
17256
  const draftPromptRef = useRef12(draftPrompt);
17197
17257
  const draftImagesRef = useRef12(draftImages);
17198
17258
  const draftFilesRef = useRef12(draftFiles);
17199
- const submittedImagePreviewObservedBusyRef = useRef12(false);
17200
17259
  const promptTipRef = useRef12(null);
17201
17260
  const mentionControllerRef = useRef12(
17202
17261
  null
@@ -17584,19 +17643,30 @@ function AgentComposer({
17584
17643
  );
17585
17644
  const submitCurrentPrompt = useStableEventCallback(() => {
17586
17645
  const canSubmitWhileSending = canQueueWhileBusy && isSendingTurn;
17587
- const hasUploadingImages = draftImages.some((image) => image.uploading);
17588
- const hasFailedImages = draftImages.some((image) => image.uploadError);
17589
- const hasUploadingFiles = draftFiles.some((file) => file.uploading);
17590
- const hasFailedFiles = draftFiles.some((file) => file.uploadError);
17646
+ const currentDraftImages = draftImagesRef.current;
17647
+ const currentDraftFiles = draftFilesRef.current;
17648
+ const hasUploadingImages = currentDraftImages.some(
17649
+ (image) => image.uploading
17650
+ );
17651
+ const hasFailedImages = currentDraftImages.some(
17652
+ (image) => image.uploadError
17653
+ );
17654
+ const hasUploadingFiles = currentDraftFiles.some((file) => file.uploading);
17655
+ const hasFailedFiles = currentDraftFiles.some((file) => file.uploadError);
17591
17656
  if (isSelectedProjectMissing || submitDisabled || hasUploadingImages || hasFailedImages || hasUploadingFiles || hasFailedFiles || disabled && !canQueueWhileBusy || isSendingTurn && !canSubmitWhileSending) {
17592
17657
  return;
17593
17658
  }
17594
17659
  const nextPrompt = draftPromptRef.current;
17595
- const nextDraftContent = { ...draftContent, prompt: nextPrompt };
17660
+ const nextDraftContent = {
17661
+ ...draftContent,
17662
+ prompt: nextPrompt,
17663
+ images: currentDraftImages,
17664
+ files: currentDraftFiles
17665
+ };
17596
17666
  if (!agentComposerDraftHasContent(nextDraftContent)) {
17597
17667
  return;
17598
17668
  }
17599
- if (draftImages.length > 0 && !promptImagesSupported) {
17669
+ if (currentDraftImages.length > 0 && !promptImagesSupported) {
17600
17670
  onPromptImagesUnsupported?.();
17601
17671
  return;
17602
17672
  }
@@ -17625,14 +17695,9 @@ function AgentComposer({
17625
17695
  skills: availableSkills
17626
17696
  });
17627
17697
  onSubmit(submitContent);
17628
- if (draftImages.length > 0 && !canQueueWhileBusy) {
17629
- setSubmittedImagePreview(draftImages);
17630
- submittedImagePreviewObservedBusyRef.current = false;
17631
- } else {
17632
- setSubmittedImagePreview([]);
17633
- submittedImagePreviewObservedBusyRef.current = false;
17634
- }
17635
17698
  draftPromptRef.current = "";
17699
+ draftImagesRef.current = [];
17700
+ draftFilesRef.current = [];
17636
17701
  setPaletteDraftPrompt("");
17637
17702
  onDraftContentChange(emptyAgentComposerDraft());
17638
17703
  });
@@ -17698,7 +17763,7 @@ function AgentComposer({
17698
17763
  );
17699
17764
  const selectFileMention = useCallback9(
17700
17765
  (entry) => {
17701
- if (mentionControllerRef.current?.selectAgentGeneratedMentionItem(entry)) {
17766
+ if (entry.kind === "file" && entry.mentionNavigation === "agent-generated-folder-back" && mentionControllerRef.current?.selectAgentGeneratedMentionItem(entry)) {
17702
17767
  return;
17703
17768
  }
17704
17769
  fileMentionSuggestion?.command(entry);
@@ -17771,6 +17836,22 @@ function AgentComposer({
17771
17836
  },
17772
17837
  [createFileMentionPaletteAdapter]
17773
17838
  );
17839
+ const navigateFileMentionHierarchy = useCallback9(
17840
+ (delta) => {
17841
+ if (delta === -1) {
17842
+ return mentionControllerRef.current?.exitAgentGeneratedBrowse() ?? false;
17843
+ }
17844
+ const item = createFileMentionPaletteAdapter().selectedItem;
17845
+ if (!item || item.kind !== "file") {
17846
+ return false;
17847
+ }
17848
+ if (item.mentionNavigation !== "agent-generated-folder") {
17849
+ return false;
17850
+ }
17851
+ return mentionControllerRef.current?.selectAgentGeneratedMentionItem(item) ?? false;
17852
+ },
17853
+ [createFileMentionPaletteAdapter]
17854
+ );
17774
17855
  const handleFileMentionKeyDown = useCallback9(
17775
17856
  (event) => {
17776
17857
  if (!showFileMentionPalette) {
@@ -17782,7 +17863,8 @@ function AgentComposer({
17782
17863
  createFileMentionPaletteAdapter().commitHighlighted();
17783
17864
  },
17784
17865
  cycleFilter: cycleFileMentionFilter,
17785
- moveSelection: moveFileMentionSelection
17866
+ moveSelection: moveFileMentionSelection,
17867
+ navigateHierarchy: navigateFileMentionHierarchy
17786
17868
  })(event);
17787
17869
  },
17788
17870
  [
@@ -17790,6 +17872,7 @@ function AgentComposer({
17790
17872
  createFileMentionPaletteAdapter,
17791
17873
  cycleFileMentionFilter,
17792
17874
  moveFileMentionSelection,
17875
+ navigateFileMentionHierarchy,
17793
17876
  showFileMentionPalette
17794
17877
  ]
17795
17878
  );
@@ -17921,8 +18004,6 @@ function AgentComposer({
17921
18004
  draftPromptRef.current = nextDraft;
17922
18005
  setPaletteDraftPrompt(nextDraft);
17923
18006
  setIsPaletteOpen(true);
17924
- setSubmittedImagePreview([]);
17925
- submittedImagePreviewObservedBusyRef.current = false;
17926
18007
  onDraftContentChange({ ...draftContent, prompt: nextDraft });
17927
18008
  }
17928
18009
  );
@@ -17935,8 +18016,6 @@ function AgentComposer({
17935
18016
  onPromptImagesUnsupported?.();
17936
18017
  return;
17937
18018
  }
17938
- setSubmittedImagePreview([]);
17939
- submittedImagePreviewObservedBusyRef.current = false;
17940
18019
  const currentDraftImages = draftImagesRef.current;
17941
18020
  const remainingSlots = Math.max(
17942
18021
  0,
@@ -18095,7 +18174,6 @@ function AgentComposer({
18095
18174
  name: uploadedFile?.name ?? file.name,
18096
18175
  mimeType: uploadedFile?.mimeType ?? file.mimeType,
18097
18176
  path: uploadedPath,
18098
- hostPath: uploadedFile?.hostPath ?? file.hostPath,
18099
18177
  assetId: uploadedFile?.assetId,
18100
18178
  sizeBytes: uploadedFile?.sizeBytes,
18101
18179
  uploading: false
@@ -18420,24 +18498,7 @@ function AgentComposer({
18420
18498
  const visibleActivePrompt = activePrompt && dismissedPromptRequestId !== activePromptRequestId ? activePrompt : null;
18421
18499
  const disabledReasonText = disabledReason?.trim() ?? "";
18422
18500
  const effectivePlaceholder = disabledReasonText || placeholder;
18423
- const showingSubmittedImagePreview = draftImages.length === 0 && submittedImagePreview.length > 0;
18424
- const visibleDraftImages = draftImages.length > 0 ? draftImages : submittedImagePreview;
18425
18501
  const visibleDraftFiles = draftFiles;
18426
- useEffect11(() => {
18427
- if (submittedImagePreview.length === 0) {
18428
- submittedImagePreviewObservedBusyRef.current = false;
18429
- return;
18430
- }
18431
- const busy = isSubmittingPrompt || isSendingTurn;
18432
- if (busy) {
18433
- submittedImagePreviewObservedBusyRef.current = true;
18434
- return;
18435
- }
18436
- if (submittedImagePreviewObservedBusyRef.current) {
18437
- submittedImagePreviewObservedBusyRef.current = false;
18438
- setSubmittedImagePreview([]);
18439
- }
18440
- }, [isSendingTurn, isSubmittingPrompt, submittedImagePreview.length]);
18441
18502
  useEffect11(() => {
18442
18503
  if (previousSelectedProjectPathRef.current === selectedProjectPath) {
18443
18504
  return;
@@ -18604,13 +18665,12 @@ function AgentComposer({
18604
18665
  modal: false,
18605
18666
  children: [
18606
18667
  /* @__PURE__ */ jsx26(PopoverAnchor, { asChild: true, children: /* @__PURE__ */ jsxs13("div", { ref: promptInputAreaRef, className: "min-w-0 self-start", children: [
18607
- visibleDraftImages.length > 0 ? /* @__PURE__ */ jsx26(
18668
+ draftImages.length > 0 ? /* @__PURE__ */ jsx26(
18608
18669
  "div",
18609
18670
  {
18610
18671
  className: "mb-2 grid max-w-[320px] grid-cols-[repeat(auto-fill,minmax(56px,1fr))] gap-2",
18611
18672
  "data-testid": "agent-gui-composer-image-drafts",
18612
- "data-submitted-preview": showingSubmittedImagePreview ? "true" : void 0,
18613
- children: visibleDraftImages.map((image) => /* @__PURE__ */ jsxs13(
18673
+ children: draftImages.map((image) => /* @__PURE__ */ jsxs13(
18614
18674
  "div",
18615
18675
  {
18616
18676
  className: cn(
@@ -18648,7 +18708,7 @@ function AgentComposer({
18648
18708
  )
18649
18709
  }
18650
18710
  ) : null,
18651
- showingSubmittedImagePreview ? null : /* @__PURE__ */ jsx26(
18711
+ /* @__PURE__ */ jsx26(
18652
18712
  "button",
18653
18713
  {
18654
18714
  type: "button",
@@ -18766,6 +18826,7 @@ function AgentComposer({
18766
18826
  onSelectCategory: (filter) => mentionControllerRef.current?.setFilter(filter),
18767
18827
  onSelectFilter: (filter) => mentionControllerRef.current?.setFilter(filter),
18768
18828
  onExpandGroup: (groupId) => mentionControllerRef.current?.expandGroup(groupId),
18829
+ onNavigateHierarchy: navigateFileMentionHierarchy,
18769
18830
  onOpenReferences: onRequestWorkspaceReferences ? handleOpenReferencesForEntity : void 0
18770
18831
  }
18771
18832
  )
@@ -19728,12 +19789,13 @@ function AgentGUINodeView({
19728
19789
  );
19729
19790
  const hostLocalFileLabel = uiLanguage === "zh-CN" ? "\u672C\u5730\u6587\u4EF6(\u5BBF\u4E3B\u673A)" : "Local files (Host)";
19730
19791
  const hostLocalFileSelectLabel = uiLanguage === "zh-CN" ? "\u4ECE\u7535\u8111\u9009\u62E9\u2026" : "Choose from computer\u2026";
19792
+ const hostLocalFileSourceId = "host-local-file";
19731
19793
  const hostLocalFileActionPath = "host-local-file://select";
19732
19794
  const referenceSourceAggregatorWithHostLocalFile = useMemo10(() => {
19733
19795
  if (!referenceSourceAggregator) {
19734
19796
  return null;
19735
19797
  }
19736
- const sourceId = "host-local-file";
19798
+ const sourceId = hostLocalFileSourceId;
19737
19799
  const actionNode = {
19738
19800
  ref: { sourceId, nodeId: "select-files" },
19739
19801
  kind: "file",
@@ -19834,7 +19896,16 @@ function AgentGUINodeView({
19834
19896
  return referenceSourceAggregator.getLoadedSource(currentSourceId);
19835
19897
  }
19836
19898
  };
19837
- }, [hostLocalFileLabel, hostLocalFileSelectLabel, referenceSourceAggregator]);
19899
+ }, [
19900
+ hostLocalFileLabel,
19901
+ hostLocalFileSelectLabel,
19902
+ hostLocalFileSourceId,
19903
+ referenceSourceAggregator
19904
+ ]);
19905
+ const isWorkspaceReferencePickerNodeSelectable = useCallback10(
19906
+ (node) => node.ref.sourceId !== hostLocalFileSourceId || node.kind === "file",
19907
+ [hostLocalFileSourceId]
19908
+ );
19838
19909
  const requestWorkspaceReferences = useCallback10(
19839
19910
  async (entity) => {
19840
19911
  if (previewMode) {
@@ -19890,7 +19961,13 @@ function AgentGUINodeView({
19890
19961
  const wantsHostFiles = refs.some(
19891
19962
  (ref) => ref.path === hostLocalFileActionPath
19892
19963
  );
19893
- if (!wantsHostFiles) {
19964
+ const hostSourceRefs = refs.filter(
19965
+ (ref) => ref.sourceId === hostLocalFileSourceId && ref.path !== hostLocalFileActionPath
19966
+ );
19967
+ const hostSourceFileRefs = hostSourceRefs.filter(
19968
+ (ref) => ref.kind === "file"
19969
+ );
19970
+ if (!wantsHostFiles && hostSourceRefs.length === 0) {
19894
19971
  settleReferencePicker(
19895
19972
  { files: refs, mentionItems: [], hostAttachments: [] },
19896
19973
  refs
@@ -19898,25 +19975,53 @@ function AgentGUINodeView({
19898
19975
  return;
19899
19976
  }
19900
19977
  const workspaceRefs = refs.filter(
19901
- (ref) => ref.path !== hostLocalFileActionPath
19978
+ (ref) => ref.path !== hostLocalFileActionPath && ref.sourceId !== hostLocalFileSourceId
19902
19979
  );
19903
- const selected = await agentHostApi.workspace.selectFiles({
19980
+ const selected = wantsHostFiles ? await agentHostApi.workspace.selectFiles({
19904
19981
  allowDirectories: false
19905
- });
19906
- const hostAttachments = selected.map((file) => ({
19982
+ }) : [];
19983
+ const selectedHostAttachments = selected.map((file) => ({
19907
19984
  hostPath: file.path,
19908
19985
  name: file.name || file.path.split("/").pop() || file.path,
19909
19986
  mimeType: null
19910
19987
  }));
19988
+ const browsedHostAttachments = hostSourceFileRefs.map((file) => ({
19989
+ hostPath: file.path,
19990
+ name: file.displayName || file.path.split("/").pop() || file.path,
19991
+ mimeType: null
19992
+ }));
19911
19993
  settleReferencePicker(
19912
- { files: workspaceRefs, mentionItems: [], hostAttachments },
19994
+ {
19995
+ files: workspaceRefs,
19996
+ mentionItems: [],
19997
+ hostAttachments: [
19998
+ ...selectedHostAttachments,
19999
+ ...browsedHostAttachments
20000
+ ]
20001
+ },
19913
20002
  workspaceRefs
19914
20003
  );
19915
20004
  },
19916
- [agentHostApi.workspace, settleReferencePicker]
20005
+ [
20006
+ agentHostApi.workspace,
20007
+ hostLocalFileActionPath,
20008
+ hostLocalFileSourceId,
20009
+ settleReferencePicker
20010
+ ]
19917
20011
  );
19918
20012
  const confirmWorkspaceReferenceBundles = useCallback10(
19919
20013
  (result) => {
20014
+ const hostSourceRefs = result.files.filter(
20015
+ (ref) => ref.sourceId === hostLocalFileSourceId && ref.kind === "file"
20016
+ );
20017
+ const workspaceRefs = result.files.filter(
20018
+ (ref) => ref.sourceId !== hostLocalFileSourceId
20019
+ );
20020
+ const hostAttachments = hostSourceRefs.map((file) => ({
20021
+ hostPath: file.path,
20022
+ name: file.displayName || file.path.split("/").pop() || file.path,
20023
+ mimeType: null
20024
+ }));
19920
20025
  const mentionItems = result.bundles.filter((bundle) => bundle.handle != null).map((bundle) => {
19921
20026
  const handle = bundle.handle;
19922
20027
  const bundleIconUrl = bundle.iconUrl ?? void 0;
@@ -19944,11 +20049,11 @@ function AgentGUINodeView({
19944
20049
  };
19945
20050
  });
19946
20051
  settleReferencePicker(
19947
- { files: result.files, mentionItems, hostAttachments: [] },
19948
- result.files
20052
+ { files: workspaceRefs, mentionItems, hostAttachments },
20053
+ workspaceRefs
19949
20054
  );
19950
20055
  },
19951
- [settleReferencePicker, viewModel.workspaceId]
20056
+ [hostLocalFileSourceId, settleReferencePicker]
19952
20057
  );
19953
20058
  const openclawGateway = useMemo10(
19954
20059
  () => viewModel.openclawGateway ?? (viewModel.data.provider === "openclaw" ? { status: "starting", error: null } : null),
@@ -20296,6 +20401,7 @@ function AgentGUINodeView({
20296
20401
  aggregator: referenceSourceAggregatorWithHostLocalFile,
20297
20402
  copy: workspaceFileReferenceCopy ?? fallbackWorkspaceFileReferenceCopy,
20298
20403
  initialTarget: workspaceReferencePickerTarget,
20404
+ isNodeSelectable: isWorkspaceReferencePickerNodeSelectable,
20299
20405
  open: workspaceReferencePickerOpen,
20300
20406
  workspaceId: viewModel.workspaceId,
20301
20407
  onClose: closeWorkspaceReferencePicker,