@tutti-os/agent-gui 0.0.23 → 0.0.25
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.
- package/dist/AgentMessageMarkdown-BnpM_dCB.d.ts +658 -0
- package/dist/agent-conversation/index.d.ts +5 -14
- package/dist/agent-conversation/index.js +3 -3
- package/dist/agent-message-center/index.d.ts +2 -2
- package/dist/agent-message-center/index.js +3 -3
- package/dist/{agentConversationVM-CGYkOuOP.d.ts → agentConversationVM-BvlmCNOm.d.ts} +2 -2
- package/dist/app/renderer/agentactivity.css +21 -28
- package/dist/{chunk-MQAGIHYM.js → chunk-3QDLVPMJ.js} +36 -4
- package/dist/chunk-3QDLVPMJ.js.map +1 -0
- package/dist/{chunk-3LVEFR2N.js → chunk-5PIXN7UF.js} +15 -14
- package/dist/{chunk-3LVEFR2N.js.map → chunk-5PIXN7UF.js.map} +1 -1
- package/dist/{chunk-ZC4E2QJU.js → chunk-OSBLVO4N.js} +3 -3
- package/dist/{chunk-7Q3JKSQ5.js → chunk-VNRRXUI3.js} +125 -44
- package/dist/chunk-VNRRXUI3.js.map +1 -0
- package/dist/{chunk-CCI6EK5W.js → chunk-YHRJD6HA.js} +1 -1
- package/dist/chunk-YHRJD6HA.js.map +1 -0
- package/dist/context-mention-palette/index.d.ts +1 -3
- package/dist/context-mention-palette/index.js +2 -2
- package/dist/index.d.ts +29 -417
- package/dist/index.js +473 -130
- package/dist/index.js.map +1 -1
- package/dist/plan-decision-ops.d.ts +2 -2
- package/dist/workspace-agent-generated-files.d.ts +1 -1
- package/dist/{workspaceAgentActivityListViewModel-BK_J3aNX.d.ts → workspaceAgentActivityListViewModel-jRF8cP37.d.ts} +2 -2
- package/package.json +12 -12
- package/dist/AgentMessageMarkdown-DeYPURtF.d.ts +0 -7
- package/dist/chunk-7Q3JKSQ5.js.map +0 -1
- package/dist/chunk-CCI6EK5W.js.map +0 -1
- package/dist/chunk-MQAGIHYM.js.map +0 -1
- /package/dist/{chunk-ZC4E2QJU.js.map → chunk-OSBLVO4N.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-
|
|
16
|
+
} from "./chunk-OSBLVO4N.js";
|
|
17
17
|
import {
|
|
18
18
|
PLAN_IMPLEMENTATION_ACTION_FEEDBACK,
|
|
19
19
|
PLAN_IMPLEMENTATION_ACTION_IMPLEMENT,
|
|
@@ -36,21 +36,21 @@ import {
|
|
|
36
36
|
skillDescriptionForDisplay,
|
|
37
37
|
skillTriggerForPrefix,
|
|
38
38
|
useProjectedAgentConversation
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-3QDLVPMJ.js";
|
|
40
40
|
import {
|
|
41
41
|
AgentMessageMarkdown,
|
|
42
42
|
ZoomableImage,
|
|
43
43
|
cn,
|
|
44
44
|
resolveWorkspaceLinkAction
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-VNRRXUI3.js";
|
|
46
46
|
import {
|
|
47
47
|
AGENT_MENTION_FILTER_TAB_ORDER,
|
|
48
48
|
AgentFileMentionPalette,
|
|
49
49
|
AgentMentionSearchController,
|
|
50
50
|
DEFAULT_AGENT_MENTION_FILTER,
|
|
51
|
-
|
|
51
|
+
agentMentionItemKey,
|
|
52
52
|
preloadAgentMentionBrowse
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-5PIXN7UF.js";
|
|
54
54
|
import {
|
|
55
55
|
WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN,
|
|
56
56
|
buildWorkspaceAgentActivityListViewModel,
|
|
@@ -90,7 +90,7 @@ import {
|
|
|
90
90
|
useAgentActivitySnapshot,
|
|
91
91
|
useAgentHostApi,
|
|
92
92
|
useOptionalAgentActivityRuntime
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-YHRJD6HA.js";
|
|
94
94
|
import "./chunk-TYGL25EL.js";
|
|
95
95
|
import {
|
|
96
96
|
AGENT_CONTEXT_MENTION_PROVIDER_IDS
|
|
@@ -3171,10 +3171,10 @@ function compareTimelineItemsForMerge(left, right) {
|
|
|
3171
3171
|
// agent-gui/agentGuiNode/model/agentComposerDraft.ts
|
|
3172
3172
|
var MAX_AGENT_COMPOSER_DRAFT_IMAGES = 8;
|
|
3173
3173
|
function emptyAgentComposerDraft() {
|
|
3174
|
-
return { prompt: "", images: [] };
|
|
3174
|
+
return { prompt: "", images: [], files: [] };
|
|
3175
3175
|
}
|
|
3176
3176
|
function agentComposerDraftHasContent(draft) {
|
|
3177
|
-
return draft.prompt.trim() !== "" || draft.images.length > 0;
|
|
3177
|
+
return draft.prompt.trim() !== "" || draft.images.length > 0 || (draft.files?.length ?? 0) > 0;
|
|
3178
3178
|
}
|
|
3179
3179
|
function normalizeAgentPromptContentBlocks(content) {
|
|
3180
3180
|
const result = [];
|
|
@@ -3201,6 +3201,26 @@ function normalizeAgentPromptContentBlocks(content) {
|
|
|
3201
3201
|
});
|
|
3202
3202
|
continue;
|
|
3203
3203
|
}
|
|
3204
|
+
if (block.type === "file") {
|
|
3205
|
+
const filePath = block.path?.trim();
|
|
3206
|
+
const hostPath = block.hostPath?.trim();
|
|
3207
|
+
if (!filePath && !hostPath) {
|
|
3208
|
+
continue;
|
|
3209
|
+
}
|
|
3210
|
+
result.push({
|
|
3211
|
+
type: "file",
|
|
3212
|
+
...block.mimeType?.trim() ? { mimeType: block.mimeType.trim() } : {},
|
|
3213
|
+
...filePath ? { path: filePath } : {},
|
|
3214
|
+
...hostPath ? { hostPath } : {},
|
|
3215
|
+
...block.name?.trim() ? { name: block.name.trim() } : {},
|
|
3216
|
+
...block.uri?.trim() ? { uri: block.uri.trim() } : {},
|
|
3217
|
+
...block.uploadStatus?.trim() ? { uploadStatus: block.uploadStatus.trim() } : {},
|
|
3218
|
+
...block.assetId?.trim() ? { assetId: block.assetId.trim() } : {},
|
|
3219
|
+
...typeof block.sizeBytes === "number" ? { sizeBytes: block.sizeBytes } : {},
|
|
3220
|
+
kind: "file"
|
|
3221
|
+
});
|
|
3222
|
+
continue;
|
|
3223
|
+
}
|
|
3204
3224
|
if (block.type === "skill" || block.type === "mention") {
|
|
3205
3225
|
const name = block.name?.trim();
|
|
3206
3226
|
const path = block.path?.trim();
|
|
@@ -3228,6 +3248,9 @@ function agentPromptContentToComposerDraft(content, idPrefix) {
|
|
|
3228
3248
|
prompt: agentPromptContentDisplayText(normalizedContent),
|
|
3229
3249
|
images: agentPromptContentImageBlocks(normalizedContent).slice(0, MAX_AGENT_COMPOSER_DRAFT_IMAGES).map(
|
|
3230
3250
|
(image, index) => agentPromptImageBlockToDraftImage(image, idPrefix, index)
|
|
3251
|
+
),
|
|
3252
|
+
files: agentPromptFileBlocks(normalizedContent).map(
|
|
3253
|
+
(file, index) => agentPromptFileBlockToDraftFile(file, idPrefix, index)
|
|
3231
3254
|
)
|
|
3232
3255
|
};
|
|
3233
3256
|
}
|
|
@@ -3249,9 +3272,24 @@ function agentComposerDraftToPromptContent(input) {
|
|
|
3249
3272
|
mimeType: image.mimeType,
|
|
3250
3273
|
...image.path ? { path: image.path } : { data: image.data },
|
|
3251
3274
|
name: image.name
|
|
3275
|
+
})),
|
|
3276
|
+
...(input.draft.files ?? []).filter((file) => !file.uploading && !file.uploadError).map((file) => ({
|
|
3277
|
+
type: "file",
|
|
3278
|
+
...file.mimeType ? { mimeType: file.mimeType } : {},
|
|
3279
|
+
...file.path ? { path: file.path } : {},
|
|
3280
|
+
...file.hostPath ? { hostPath: file.hostPath } : {},
|
|
3281
|
+
...file.assetId ? { assetId: file.assetId } : {},
|
|
3282
|
+
...file.sizeBytes ? { sizeBytes: file.sizeBytes } : {},
|
|
3283
|
+
name: file.name,
|
|
3284
|
+
kind: "file"
|
|
3252
3285
|
}))
|
|
3253
3286
|
]);
|
|
3254
3287
|
}
|
|
3288
|
+
function agentPromptFileBlocks(content) {
|
|
3289
|
+
return normalizeAgentPromptContentBlocks(content).filter(
|
|
3290
|
+
(block) => block.type === "file" && (typeof block.path === "string" || typeof block.hostPath === "string")
|
|
3291
|
+
);
|
|
3292
|
+
}
|
|
3255
3293
|
function promptItemBlocksForProviderSkills(input) {
|
|
3256
3294
|
if (input.provider.trim() !== "codex") {
|
|
3257
3295
|
return [];
|
|
@@ -3289,11 +3327,22 @@ function agentPromptImageBlockToDraftImage(image, idPrefix, index) {
|
|
|
3289
3327
|
id: `${idPrefix}:image:${index}`,
|
|
3290
3328
|
name: image.name?.trim() || `image-${index + 1}`,
|
|
3291
3329
|
mimeType: image.mimeType,
|
|
3292
|
-
data: image.data,
|
|
3293
|
-
path: image.path,
|
|
3330
|
+
...image.data ? { data: image.data } : {},
|
|
3331
|
+
...image.path ? { path: image.path } : {},
|
|
3294
3332
|
previewUrl: typeof image.data === "string" && image.data ? `data:${image.mimeType};base64,${image.data}` : image.path ?? ""
|
|
3295
3333
|
};
|
|
3296
3334
|
}
|
|
3335
|
+
function agentPromptFileBlockToDraftFile(file, idPrefix, index) {
|
|
3336
|
+
return {
|
|
3337
|
+
id: `${idPrefix}:file:${index}`,
|
|
3338
|
+
name: file.name?.trim() || `file-${index + 1}`,
|
|
3339
|
+
mimeType: file.mimeType,
|
|
3340
|
+
path: file.path,
|
|
3341
|
+
hostPath: file.hostPath,
|
|
3342
|
+
assetId: file.assetId,
|
|
3343
|
+
sizeBytes: file.sizeBytes
|
|
3344
|
+
};
|
|
3345
|
+
}
|
|
3297
3346
|
|
|
3298
3347
|
// shared/agentConversation/projection/workspaceAgentMessageProjection.ts
|
|
3299
3348
|
function projectWorkspaceAgentMessagesToTimelineItems(messages) {
|
|
@@ -13486,7 +13535,11 @@ import {
|
|
|
13486
13535
|
// agent-gui/agentGuiNode/AgentComposer.tsx
|
|
13487
13536
|
import { AddIcon, Select as Select2, SelectTrigger as SelectTrigger2 } from "@tutti-os/ui-system";
|
|
13488
13537
|
import { ListChecks, X } from "lucide-react";
|
|
13489
|
-
import {
|
|
13538
|
+
import {
|
|
13539
|
+
createMentionPaletteStateAdapter,
|
|
13540
|
+
makeAtPanelKeyDown,
|
|
13541
|
+
repairMentionPaletteHighlight
|
|
13542
|
+
} from "@tutti-os/ui-rich-text/at-panel";
|
|
13490
13543
|
|
|
13491
13544
|
// agent-gui/agentGuiNode/model/agentComposerTriggerQueries.ts
|
|
13492
13545
|
import { findRichTextTriggerQuery } from "@tutti-os/ui-rich-text/editor";
|
|
@@ -17104,6 +17157,7 @@ function AgentComposer({
|
|
|
17104
17157
|
"use memo";
|
|
17105
17158
|
const draftPrompt = draftContent.prompt;
|
|
17106
17159
|
const draftImages = draftContent.images;
|
|
17160
|
+
const draftFiles = draftContent.files ?? [];
|
|
17107
17161
|
const agentActivityRuntime = useOptionalAgentActivityRuntime();
|
|
17108
17162
|
const [isPaletteOpen, setIsPaletteOpen] = useState10(true);
|
|
17109
17163
|
const [isReviewPickerOpen, setIsReviewPickerOpen] = useState10(false);
|
|
@@ -17140,6 +17194,7 @@ function AgentComposer({
|
|
|
17140
17194
|
const paletteContentRef = useRef12(null);
|
|
17141
17195
|
const draftPromptRef = useRef12(draftPrompt);
|
|
17142
17196
|
const draftImagesRef = useRef12(draftImages);
|
|
17197
|
+
const draftFilesRef = useRef12(draftFiles);
|
|
17143
17198
|
const submittedImagePreviewObservedBusyRef = useRef12(false);
|
|
17144
17199
|
const promptTipRef = useRef12(null);
|
|
17145
17200
|
const mentionControllerRef = useRef12(
|
|
@@ -17283,40 +17338,40 @@ function AgentComposer({
|
|
|
17283
17338
|
highlightedIndex,
|
|
17284
17339
|
slashPaletteEntries.length
|
|
17285
17340
|
);
|
|
17286
|
-
const mentionPaletteEntries = useMemo9(
|
|
17287
|
-
() => flattenAgentMentionPaletteEntries(mentionSearchState),
|
|
17288
|
-
[mentionSearchState]
|
|
17289
|
-
);
|
|
17290
17341
|
const [mentionPaletteFrame, setMentionPaletteFrame] = useState10(null);
|
|
17291
17342
|
useEffect11(() => {
|
|
17292
17343
|
setHighlightedIndex(0);
|
|
17293
17344
|
}, [skillQueryMatch?.prefix, skillQueryMatch?.query, slashQuery]);
|
|
17294
17345
|
useEffect11(() => {
|
|
17295
|
-
const
|
|
17296
|
-
if (!firstKey) {
|
|
17297
|
-
autoMentionHighlightedKeyRef.current = null;
|
|
17298
|
-
setMentionHighlightedKey(null);
|
|
17299
|
-
return;
|
|
17300
|
-
}
|
|
17346
|
+
const preferredKey = shouldResetMentionHighlightToFilter && mentionSearchState.mode === "browse" ? `category:${mentionSearchState.filter}` : null;
|
|
17301
17347
|
if (shouldResetMentionHighlightToFilter) {
|
|
17302
|
-
const
|
|
17303
|
-
|
|
17304
|
-
|
|
17348
|
+
const nextKey = repairMentionPaletteHighlight({
|
|
17349
|
+
state: mentionSearchState,
|
|
17350
|
+
currentKey: null,
|
|
17351
|
+
preferredKey,
|
|
17352
|
+
getItemKey: agentMentionItemKey
|
|
17353
|
+
});
|
|
17354
|
+
autoMentionHighlightedKeyRef.current = nextKey;
|
|
17355
|
+
setMentionHighlightedKey(nextKey);
|
|
17305
17356
|
setShouldResetMentionHighlightToFilter(false);
|
|
17306
17357
|
return;
|
|
17307
17358
|
}
|
|
17308
17359
|
setMentionHighlightedKey((current) => {
|
|
17309
|
-
const
|
|
17310
|
-
|
|
17360
|
+
const nextKey = repairMentionPaletteHighlight({
|
|
17361
|
+
state: mentionSearchState,
|
|
17362
|
+
currentKey: current,
|
|
17363
|
+
getItemKey: agentMentionItemKey
|
|
17364
|
+
});
|
|
17365
|
+
if (nextKey === current && current !== autoMentionHighlightedKeyRef.current) {
|
|
17311
17366
|
return current;
|
|
17312
17367
|
}
|
|
17313
|
-
autoMentionHighlightedKeyRef.current =
|
|
17314
|
-
return
|
|
17368
|
+
autoMentionHighlightedKeyRef.current = nextKey;
|
|
17369
|
+
return nextKey;
|
|
17315
17370
|
});
|
|
17316
17371
|
}, [
|
|
17317
|
-
mentionPaletteEntries,
|
|
17318
17372
|
mentionSearchState.filter,
|
|
17319
17373
|
mentionSearchState.mode,
|
|
17374
|
+
mentionSearchState,
|
|
17320
17375
|
shouldResetMentionHighlightToFilter
|
|
17321
17376
|
]);
|
|
17322
17377
|
useEffect11(() => {
|
|
@@ -17346,6 +17401,9 @@ function AgentComposer({
|
|
|
17346
17401
|
useEffect11(() => {
|
|
17347
17402
|
draftImagesRef.current = draftImages;
|
|
17348
17403
|
}, [draftImages]);
|
|
17404
|
+
useEffect11(() => {
|
|
17405
|
+
draftFilesRef.current = draftFiles;
|
|
17406
|
+
}, [draftFiles]);
|
|
17349
17407
|
useEffect11(() => {
|
|
17350
17408
|
if (previousSlashStatusAgentSessionIdRef.current === slashStatusAgentSessionId) {
|
|
17351
17409
|
return;
|
|
@@ -17665,22 +17723,40 @@ function AgentComposer({
|
|
|
17665
17723
|
}
|
|
17666
17724
|
setIsPaletteOpen(false);
|
|
17667
17725
|
}, [closeFileMentionPalette, showFileMentionPalette]);
|
|
17726
|
+
const createFileMentionPaletteAdapter = useCallback9(
|
|
17727
|
+
(highlightedKey = mentionHighlightedKey) => createMentionPaletteStateAdapter({
|
|
17728
|
+
state: mentionSearchState,
|
|
17729
|
+
highlightedKey,
|
|
17730
|
+
categoryCycleOrder: mentionSearchState.mode === "browse" ? mentionSearchState.categories : AGENT_MENTION_FILTER_TAB_ORDER,
|
|
17731
|
+
getItemKey: agentMentionItemKey,
|
|
17732
|
+
callbacks: {
|
|
17733
|
+
onHighlightChange: (key) => {
|
|
17734
|
+
setShouldCenterMentionHighlight(true);
|
|
17735
|
+
autoMentionHighlightedKeyRef.current = null;
|
|
17736
|
+
setMentionHighlightedKey(key);
|
|
17737
|
+
},
|
|
17738
|
+
onActiveCategoryIdChange: (categoryId) => {
|
|
17739
|
+
mentionControllerRef.current?.setFilter(
|
|
17740
|
+
categoryId
|
|
17741
|
+
);
|
|
17742
|
+
setShouldResetMentionHighlightToFilter(true);
|
|
17743
|
+
setShouldCenterMentionHighlight(false);
|
|
17744
|
+
},
|
|
17745
|
+
onExpandGroup: (groupId) => {
|
|
17746
|
+
mentionControllerRef.current?.expandGroup(
|
|
17747
|
+
groupId
|
|
17748
|
+
);
|
|
17749
|
+
},
|
|
17750
|
+
onSelectItem: selectFileMention
|
|
17751
|
+
}
|
|
17752
|
+
}),
|
|
17753
|
+
[mentionHighlightedKey, mentionSearchState, selectFileMention]
|
|
17754
|
+
);
|
|
17668
17755
|
const moveFileMentionSelection = useCallback9(
|
|
17669
17756
|
(delta) => {
|
|
17670
|
-
|
|
17671
|
-
if (focusableEntries.length === 0) {
|
|
17672
|
-
return;
|
|
17673
|
-
}
|
|
17674
|
-
const currentIndex = mentionHighlightedKey ? focusableEntries.findIndex(
|
|
17675
|
-
(entry) => entry.key === mentionHighlightedKey
|
|
17676
|
-
) : -1;
|
|
17677
|
-
const baseIndex = currentIndex >= 0 ? currentIndex : delta > 0 ? -1 : 0;
|
|
17678
|
-
const nextIndex = (baseIndex + delta + focusableEntries.length) % focusableEntries.length;
|
|
17679
|
-
setShouldCenterMentionHighlight(true);
|
|
17680
|
-
autoMentionHighlightedKeyRef.current = null;
|
|
17681
|
-
setMentionHighlightedKey(focusableEntries[nextIndex]?.key ?? null);
|
|
17757
|
+
createFileMentionPaletteAdapter().moveSelection(delta);
|
|
17682
17758
|
},
|
|
17683
|
-
[
|
|
17759
|
+
[createFileMentionPaletteAdapter]
|
|
17684
17760
|
);
|
|
17685
17761
|
const handleMentionHighlightChange = useCallback9((key) => {
|
|
17686
17762
|
autoMentionHighlightedKeyRef.current = null;
|
|
@@ -17688,57 +17764,19 @@ function AgentComposer({
|
|
|
17688
17764
|
}, []);
|
|
17689
17765
|
const cycleFileMentionFilter = useCallback9(
|
|
17690
17766
|
(delta = 1) => {
|
|
17691
|
-
|
|
17692
|
-
if (filters.length === 0) {
|
|
17693
|
-
return;
|
|
17694
|
-
}
|
|
17695
|
-
const currentFilterIndex = filters.findIndex(
|
|
17696
|
-
(filter) => filter === mentionSearchState.filter
|
|
17697
|
-
);
|
|
17698
|
-
const baseIndex = currentFilterIndex >= 0 ? currentFilterIndex : delta > 0 ? -1 : 0;
|
|
17699
|
-
const nextIndex = (baseIndex + delta + filters.length) % filters.length;
|
|
17700
|
-
const nextFilter = filters[nextIndex];
|
|
17701
|
-
if (!nextFilter) {
|
|
17702
|
-
return;
|
|
17703
|
-
}
|
|
17704
|
-
mentionControllerRef.current?.setFilter(nextFilter);
|
|
17705
|
-
setShouldResetMentionHighlightToFilter(true);
|
|
17706
|
-
setShouldCenterMentionHighlight(false);
|
|
17767
|
+
createFileMentionPaletteAdapter().cycleCategory(delta);
|
|
17707
17768
|
},
|
|
17708
|
-
[
|
|
17769
|
+
[createFileMentionPaletteAdapter]
|
|
17709
17770
|
);
|
|
17710
17771
|
const handleFileMentionKeyDown = useCallback9(
|
|
17711
17772
|
(event) => {
|
|
17712
17773
|
if (!showFileMentionPalette) {
|
|
17713
17774
|
return false;
|
|
17714
17775
|
}
|
|
17715
|
-
const focusableEntries = flattenAgentMentionPaletteEntries(mentionSearchState);
|
|
17716
17776
|
return makeAtPanelKeyDown({
|
|
17717
17777
|
close: closeFileMentionPalette,
|
|
17718
17778
|
commitSelection: () => {
|
|
17719
|
-
|
|
17720
|
-
(entry) => entry.key === mentionHighlightedKey
|
|
17721
|
-
);
|
|
17722
|
-
if (!activeEntry) {
|
|
17723
|
-
const highlightedCategoryId = mentionHighlightedKey?.startsWith(
|
|
17724
|
-
"category:"
|
|
17725
|
-
) ? mentionHighlightedKey.slice("category:".length) : null;
|
|
17726
|
-
if (highlightedCategoryId && mentionSearchState.categories.some(
|
|
17727
|
-
(category) => category.id === highlightedCategoryId
|
|
17728
|
-
)) {
|
|
17729
|
-
mentionControllerRef.current?.setFilter(
|
|
17730
|
-
highlightedCategoryId
|
|
17731
|
-
);
|
|
17732
|
-
}
|
|
17733
|
-
return;
|
|
17734
|
-
}
|
|
17735
|
-
if (activeEntry.type === "category" && activeEntry.categoryId) {
|
|
17736
|
-
mentionControllerRef.current?.setFilter(activeEntry.categoryId);
|
|
17737
|
-
} else if (activeEntry.type === "expand" && activeEntry.groupId) {
|
|
17738
|
-
mentionControllerRef.current?.expandGroup(activeEntry.groupId);
|
|
17739
|
-
} else if (activeEntry.type === "item" && activeEntry.item) {
|
|
17740
|
-
selectFileMention(activeEntry.item);
|
|
17741
|
-
}
|
|
17779
|
+
createFileMentionPaletteAdapter().commitHighlighted();
|
|
17742
17780
|
},
|
|
17743
17781
|
cycleFilter: cycleFileMentionFilter,
|
|
17744
17782
|
moveSelection: moveFileMentionSelection
|
|
@@ -17746,11 +17784,9 @@ function AgentComposer({
|
|
|
17746
17784
|
},
|
|
17747
17785
|
[
|
|
17748
17786
|
closeFileMentionPalette,
|
|
17787
|
+
createFileMentionPaletteAdapter,
|
|
17749
17788
|
cycleFileMentionFilter,
|
|
17750
|
-
mentionHighlightedKey,
|
|
17751
|
-
mentionSearchState,
|
|
17752
17789
|
moveFileMentionSelection,
|
|
17753
|
-
selectFileMention,
|
|
17754
17790
|
showFileMentionPalette
|
|
17755
17791
|
]
|
|
17756
17792
|
);
|
|
@@ -17919,7 +17955,8 @@ function AgentComposer({
|
|
|
17919
17955
|
draftImagesRef.current = nextDraftImages;
|
|
17920
17956
|
onDraftContentChange({
|
|
17921
17957
|
prompt: draftPromptRef.current,
|
|
17922
|
-
images: nextDraftImages
|
|
17958
|
+
images: nextDraftImages,
|
|
17959
|
+
files: draftFilesRef.current
|
|
17923
17960
|
});
|
|
17924
17961
|
if (!uploadPromptContent) {
|
|
17925
17962
|
return;
|
|
@@ -17956,7 +17993,8 @@ function AgentComposer({
|
|
|
17956
17993
|
draftImagesRef.current = uploadedDraftImages;
|
|
17957
17994
|
onDraftContentChange({
|
|
17958
17995
|
prompt: draftPromptRef.current,
|
|
17959
|
-
images: uploadedDraftImages
|
|
17996
|
+
images: uploadedDraftImages,
|
|
17997
|
+
files: draftFilesRef.current
|
|
17960
17998
|
});
|
|
17961
17999
|
}).catch((error) => {
|
|
17962
18000
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -17970,7 +18008,8 @@ function AgentComposer({
|
|
|
17970
18008
|
draftImagesRef.current = failedDraftImages;
|
|
17971
18009
|
onDraftContentChange({
|
|
17972
18010
|
prompt: draftPromptRef.current,
|
|
17973
|
-
images: failedDraftImages
|
|
18011
|
+
images: failedDraftImages,
|
|
18012
|
+
files: draftFilesRef.current
|
|
17974
18013
|
});
|
|
17975
18014
|
});
|
|
17976
18015
|
}
|
|
@@ -17997,7 +18036,103 @@ function AgentComposer({
|
|
|
17997
18036
|
draftImagesRef.current = nextDraftImages;
|
|
17998
18037
|
onDraftContentChange({
|
|
17999
18038
|
prompt: draftPromptRef.current,
|
|
18000
|
-
images: nextDraftImages
|
|
18039
|
+
images: nextDraftImages,
|
|
18040
|
+
files: draftFilesRef.current
|
|
18041
|
+
});
|
|
18042
|
+
},
|
|
18043
|
+
[onDraftContentChange]
|
|
18044
|
+
);
|
|
18045
|
+
const addDraftFiles = useCallback9(
|
|
18046
|
+
(attachments) => {
|
|
18047
|
+
if (attachments.length === 0) {
|
|
18048
|
+
return;
|
|
18049
|
+
}
|
|
18050
|
+
const uploadPromptContent = agentActivityRuntime?.uploadPromptContent;
|
|
18051
|
+
const nextFiles = attachments.map((attachment) => ({
|
|
18052
|
+
id: `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,
|
|
18053
|
+
name: attachment.name,
|
|
18054
|
+
mimeType: attachment.mimeType?.trim() || "application/octet-stream",
|
|
18055
|
+
hostPath: attachment.hostPath,
|
|
18056
|
+
uploading: Boolean(uploadPromptContent)
|
|
18057
|
+
}));
|
|
18058
|
+
const nextDraftFiles = [...draftFilesRef.current, ...nextFiles];
|
|
18059
|
+
draftFilesRef.current = nextDraftFiles;
|
|
18060
|
+
onDraftContentChange({
|
|
18061
|
+
prompt: draftPromptRef.current,
|
|
18062
|
+
images: draftImagesRef.current,
|
|
18063
|
+
files: nextDraftFiles
|
|
18064
|
+
});
|
|
18065
|
+
if (!uploadPromptContent) {
|
|
18066
|
+
return;
|
|
18067
|
+
}
|
|
18068
|
+
for (const draftFile of nextFiles) {
|
|
18069
|
+
void uploadPromptContent({
|
|
18070
|
+
workspaceId,
|
|
18071
|
+
content: [
|
|
18072
|
+
{
|
|
18073
|
+
type: "file",
|
|
18074
|
+
mimeType: draftFile.mimeType,
|
|
18075
|
+
hostPath: draftFile.hostPath,
|
|
18076
|
+
name: draftFile.name,
|
|
18077
|
+
kind: "file"
|
|
18078
|
+
}
|
|
18079
|
+
]
|
|
18080
|
+
}).then((result) => {
|
|
18081
|
+
const uploadedFile = result.content.find(
|
|
18082
|
+
(block) => block.type === "file"
|
|
18083
|
+
);
|
|
18084
|
+
const uploadedPath = uploadedFile?.path?.trim() ?? "";
|
|
18085
|
+
if (!uploadedPath) {
|
|
18086
|
+
throw new Error("Prompt file upload completed without path.");
|
|
18087
|
+
}
|
|
18088
|
+
const uploadedDraftFiles = draftFilesRef.current.map(
|
|
18089
|
+
(file) => file.id === draftFile.id ? {
|
|
18090
|
+
id: file.id,
|
|
18091
|
+
name: uploadedFile?.name ?? file.name,
|
|
18092
|
+
mimeType: uploadedFile?.mimeType ?? file.mimeType,
|
|
18093
|
+
path: uploadedPath,
|
|
18094
|
+
hostPath: uploadedFile?.hostPath ?? file.hostPath,
|
|
18095
|
+
assetId: uploadedFile?.assetId,
|
|
18096
|
+
sizeBytes: uploadedFile?.sizeBytes,
|
|
18097
|
+
uploading: false
|
|
18098
|
+
} : file
|
|
18099
|
+
);
|
|
18100
|
+
draftFilesRef.current = uploadedDraftFiles;
|
|
18101
|
+
onDraftContentChange({
|
|
18102
|
+
prompt: draftPromptRef.current,
|
|
18103
|
+
images: draftImagesRef.current,
|
|
18104
|
+
files: uploadedDraftFiles
|
|
18105
|
+
});
|
|
18106
|
+
}).catch((error) => {
|
|
18107
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
18108
|
+
const failedDraftFiles = draftFilesRef.current.map(
|
|
18109
|
+
(file) => file.id === draftFile.id ? {
|
|
18110
|
+
...file,
|
|
18111
|
+
uploading: false,
|
|
18112
|
+
uploadError: message
|
|
18113
|
+
} : file
|
|
18114
|
+
);
|
|
18115
|
+
draftFilesRef.current = failedDraftFiles;
|
|
18116
|
+
onDraftContentChange({
|
|
18117
|
+
prompt: draftPromptRef.current,
|
|
18118
|
+
images: draftImagesRef.current,
|
|
18119
|
+
files: failedDraftFiles
|
|
18120
|
+
});
|
|
18121
|
+
});
|
|
18122
|
+
}
|
|
18123
|
+
},
|
|
18124
|
+
[agentActivityRuntime, onDraftContentChange, workspaceId]
|
|
18125
|
+
);
|
|
18126
|
+
const removeDraftFile = useCallback9(
|
|
18127
|
+
(id) => {
|
|
18128
|
+
const nextDraftFiles = draftFilesRef.current.filter(
|
|
18129
|
+
(file) => file.id !== id
|
|
18130
|
+
);
|
|
18131
|
+
draftFilesRef.current = nextDraftFiles;
|
|
18132
|
+
onDraftContentChange({
|
|
18133
|
+
prompt: draftPromptRef.current,
|
|
18134
|
+
images: draftImagesRef.current,
|
|
18135
|
+
files: nextDraftFiles
|
|
18001
18136
|
});
|
|
18002
18137
|
},
|
|
18003
18138
|
[onDraftContentChange]
|
|
@@ -18010,8 +18145,11 @@ function AgentComposer({
|
|
|
18010
18145
|
if (result.mentionItems.length > 0) {
|
|
18011
18146
|
editorHandleRef.current?.insertMentionItems(result.mentionItems);
|
|
18012
18147
|
}
|
|
18148
|
+
if (result.hostAttachments && result.hostAttachments.length > 0) {
|
|
18149
|
+
addDraftFiles(result.hostAttachments);
|
|
18150
|
+
}
|
|
18013
18151
|
},
|
|
18014
|
-
[]
|
|
18152
|
+
[addDraftFiles]
|
|
18015
18153
|
);
|
|
18016
18154
|
const handleWorkspaceReferencePicker = useCallback9(async () => {
|
|
18017
18155
|
if (!onRequestWorkspaceReferences) {
|
|
@@ -18278,6 +18416,7 @@ function AgentComposer({
|
|
|
18278
18416
|
const effectivePlaceholder = disabledReasonText || placeholder;
|
|
18279
18417
|
const showingSubmittedImagePreview = draftImages.length === 0 && submittedImagePreview.length > 0;
|
|
18280
18418
|
const visibleDraftImages = draftImages.length > 0 ? draftImages : submittedImagePreview;
|
|
18419
|
+
const visibleDraftFiles = draftFiles;
|
|
18281
18420
|
useEffect11(() => {
|
|
18282
18421
|
if (submittedImagePreview.length === 0) {
|
|
18283
18422
|
submittedImagePreviewObservedBusyRef.current = false;
|
|
@@ -18520,6 +18659,56 @@ function AgentComposer({
|
|
|
18520
18659
|
))
|
|
18521
18660
|
}
|
|
18522
18661
|
) : null,
|
|
18662
|
+
visibleDraftFiles.length > 0 ? /* @__PURE__ */ jsx26(
|
|
18663
|
+
"div",
|
|
18664
|
+
{
|
|
18665
|
+
className: "mb-2 flex max-w-[520px] flex-wrap gap-2",
|
|
18666
|
+
"data-testid": "agent-gui-composer-file-drafts",
|
|
18667
|
+
children: visibleDraftFiles.map((file) => /* @__PURE__ */ jsxs13(
|
|
18668
|
+
"div",
|
|
18669
|
+
{
|
|
18670
|
+
className: cn(
|
|
18671
|
+
"group inline-flex max-w-full items-center gap-2 rounded-[6px] border border-[var(--line-1)] bg-[var(--background-fronted)] px-2 py-1 text-xs text-[var(--text-primary)]",
|
|
18672
|
+
file.uploadError && "border-[color:color-mix(in_srgb,var(--danger)_55%,var(--line-1))]"
|
|
18673
|
+
),
|
|
18674
|
+
"data-uploading": file.uploading ? "true" : void 0,
|
|
18675
|
+
"data-upload-error": file.uploadError ? "true" : void 0,
|
|
18676
|
+
title: file.hostPath ?? file.path ?? file.name,
|
|
18677
|
+
children: [
|
|
18678
|
+
file.uploading ? /* @__PURE__ */ jsx26(
|
|
18679
|
+
Spinner,
|
|
18680
|
+
{
|
|
18681
|
+
className: "shrink-0 text-[var(--text-primary)]",
|
|
18682
|
+
size: 14,
|
|
18683
|
+
strokeWidth: 2.4,
|
|
18684
|
+
trackColor: "var(--transparency-hover)",
|
|
18685
|
+
testId: "agent-gui-composer-file-upload-spinner"
|
|
18686
|
+
}
|
|
18687
|
+
) : /* @__PURE__ */ jsx26(
|
|
18688
|
+
"span",
|
|
18689
|
+
{
|
|
18690
|
+
className: "size-2 shrink-0 rounded-full bg-[var(--text-tertiary)]",
|
|
18691
|
+
"aria-hidden": true
|
|
18692
|
+
}
|
|
18693
|
+
),
|
|
18694
|
+
/* @__PURE__ */ jsx26("span", { className: "min-w-0 max-w-[220px] truncate", children: file.name }),
|
|
18695
|
+
/* @__PURE__ */ jsx26(
|
|
18696
|
+
"button",
|
|
18697
|
+
{
|
|
18698
|
+
type: "button",
|
|
18699
|
+
className: "inline-flex size-5 shrink-0 items-center justify-center rounded-full text-[var(--text-secondary)] transition hover:bg-[var(--transparency-hover)] hover:text-[var(--text-primary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color:color-mix(in_srgb,var(--text-primary)_34%,transparent)]",
|
|
18700
|
+
"aria-label": labels.removeMention,
|
|
18701
|
+
title: labels.removeMention,
|
|
18702
|
+
onClick: () => removeDraftFile(file.id),
|
|
18703
|
+
children: /* @__PURE__ */ jsx26(X, { size: 12, strokeWidth: 2.4, "aria-hidden": true })
|
|
18704
|
+
}
|
|
18705
|
+
)
|
|
18706
|
+
]
|
|
18707
|
+
},
|
|
18708
|
+
file.id
|
|
18709
|
+
))
|
|
18710
|
+
}
|
|
18711
|
+
) : null,
|
|
18523
18712
|
/* @__PURE__ */ jsx26(
|
|
18524
18713
|
AgentRichTextEditor,
|
|
18525
18714
|
{
|
|
@@ -18571,8 +18760,6 @@ function AgentComposer({
|
|
|
18571
18760
|
onSelectCategory: (filter) => mentionControllerRef.current?.setFilter(filter),
|
|
18572
18761
|
onSelectFilter: (filter) => mentionControllerRef.current?.setFilter(filter),
|
|
18573
18762
|
onExpandGroup: (groupId) => mentionControllerRef.current?.expandGroup(groupId),
|
|
18574
|
-
onCycleFilter: cycleFileMentionFilter,
|
|
18575
|
-
onMoveSelection: moveFileMentionSelection,
|
|
18576
18763
|
onOpenReferences: onRequestWorkspaceReferences ? handleOpenReferencesForEntity : void 0
|
|
18577
18764
|
}
|
|
18578
18765
|
)
|
|
@@ -19508,9 +19695,11 @@ function AgentGUINodeView({
|
|
|
19508
19695
|
contextMentionProviders,
|
|
19509
19696
|
referenceSourceAggregator = null,
|
|
19510
19697
|
resolveMentionReferenceTarget = null,
|
|
19698
|
+
resolveWorkspaceReferenceInitialTarget = null,
|
|
19511
19699
|
workspaceAppIcons = EMPTY_WORKSPACE_APP_ICONS3
|
|
19512
19700
|
}) {
|
|
19513
19701
|
"use memo";
|
|
19702
|
+
const agentHostApi = useAgentHostApi();
|
|
19514
19703
|
const layoutElementRef = useRef13(null);
|
|
19515
19704
|
const railResizeInteractionRef = useRef13(null);
|
|
19516
19705
|
const [isRailResizing, setIsRailResizing] = useState11(false);
|
|
@@ -19528,18 +19717,121 @@ function AgentGUINodeView({
|
|
|
19528
19717
|
);
|
|
19529
19718
|
const workspaceReferencePickerResolverRef = useRef13(null);
|
|
19530
19719
|
const emptyReferencePickResult = useMemo10(
|
|
19531
|
-
() => ({ files: [], mentionItems: [] }),
|
|
19720
|
+
() => ({ files: [], mentionItems: [], hostAttachments: [] }),
|
|
19532
19721
|
[]
|
|
19533
19722
|
);
|
|
19723
|
+
const hostLocalFileLabel = uiLanguage === "zh-CN" ? "\u672C\u5730\u6587\u4EF6(\u5BBF\u4E3B\u673A)" : "Local files (Host)";
|
|
19724
|
+
const hostLocalFileSelectLabel = uiLanguage === "zh-CN" ? "\u4ECE\u7535\u8111\u9009\u62E9\u2026" : "Choose from computer\u2026";
|
|
19725
|
+
const hostLocalFileActionPath = "host-local-file://select";
|
|
19726
|
+
const referenceSourceAggregatorWithHostLocalFile = useMemo10(() => {
|
|
19727
|
+
if (!referenceSourceAggregator) {
|
|
19728
|
+
return null;
|
|
19729
|
+
}
|
|
19730
|
+
const sourceId = "host-local-file";
|
|
19731
|
+
const actionNode = {
|
|
19732
|
+
ref: { sourceId, nodeId: "select-files" },
|
|
19733
|
+
kind: "file",
|
|
19734
|
+
displayName: hostLocalFileSelectLabel
|
|
19735
|
+
};
|
|
19736
|
+
const rootNode = {
|
|
19737
|
+
ref: { sourceId, nodeId: "\0source-root" },
|
|
19738
|
+
kind: "folder",
|
|
19739
|
+
displayName: hostLocalFileLabel,
|
|
19740
|
+
hasChildren: true
|
|
19741
|
+
};
|
|
19742
|
+
return {
|
|
19743
|
+
...referenceSourceAggregator,
|
|
19744
|
+
async listSources(scope) {
|
|
19745
|
+
const sources = await referenceSourceAggregator.listSources(scope);
|
|
19746
|
+
return [
|
|
19747
|
+
...sources,
|
|
19748
|
+
{
|
|
19749
|
+
sourceId,
|
|
19750
|
+
label: hostLocalFileLabel,
|
|
19751
|
+
icon: "file",
|
|
19752
|
+
capabilities: {
|
|
19753
|
+
searchable: false,
|
|
19754
|
+
previewable: false,
|
|
19755
|
+
paginated: false,
|
|
19756
|
+
navigable: false,
|
|
19757
|
+
filterable: false
|
|
19758
|
+
}
|
|
19759
|
+
}
|
|
19760
|
+
];
|
|
19761
|
+
},
|
|
19762
|
+
async listRoot(scope) {
|
|
19763
|
+
const root = await referenceSourceAggregator.listRoot(scope);
|
|
19764
|
+
return [...root, rootNode];
|
|
19765
|
+
},
|
|
19766
|
+
async listChildren(scope, node, input) {
|
|
19767
|
+
if (node.sourceId === sourceId) {
|
|
19768
|
+
return { entries: [actionNode], nextCursor: null };
|
|
19769
|
+
}
|
|
19770
|
+
return await referenceSourceAggregator.listChildren(scope, node, input);
|
|
19771
|
+
},
|
|
19772
|
+
async search(scope, currentSourceId, input) {
|
|
19773
|
+
if (currentSourceId === sourceId) {
|
|
19774
|
+
return { entries: [], nextCursor: null };
|
|
19775
|
+
}
|
|
19776
|
+
return await referenceSourceAggregator.search(
|
|
19777
|
+
scope,
|
|
19778
|
+
currentSourceId,
|
|
19779
|
+
input
|
|
19780
|
+
);
|
|
19781
|
+
},
|
|
19782
|
+
async open(scope, node) {
|
|
19783
|
+
if (node.ref.sourceId === sourceId) {
|
|
19784
|
+
return;
|
|
19785
|
+
}
|
|
19786
|
+
await referenceSourceAggregator.open(scope, node);
|
|
19787
|
+
},
|
|
19788
|
+
async readPreview(scope, node) {
|
|
19789
|
+
if (node.ref.sourceId === sourceId) {
|
|
19790
|
+
return null;
|
|
19791
|
+
}
|
|
19792
|
+
return await referenceSourceAggregator.readPreview(scope, node);
|
|
19793
|
+
},
|
|
19794
|
+
resolveSelection(node) {
|
|
19795
|
+
if (node.ref.sourceId === sourceId) {
|
|
19796
|
+
return {
|
|
19797
|
+
path: hostLocalFileActionPath,
|
|
19798
|
+
kind: "file",
|
|
19799
|
+
displayName: actionNode.displayName
|
|
19800
|
+
};
|
|
19801
|
+
}
|
|
19802
|
+
return referenceSourceAggregator.resolveSelection(node);
|
|
19803
|
+
},
|
|
19804
|
+
async locateTarget(scope, currentSourceId, params) {
|
|
19805
|
+
if (currentSourceId === sourceId) {
|
|
19806
|
+
return null;
|
|
19807
|
+
}
|
|
19808
|
+
return await referenceSourceAggregator.locateTarget(
|
|
19809
|
+
scope,
|
|
19810
|
+
currentSourceId,
|
|
19811
|
+
params
|
|
19812
|
+
);
|
|
19813
|
+
},
|
|
19814
|
+
getLoadedSource(currentSourceId) {
|
|
19815
|
+
if (currentSourceId === sourceId) {
|
|
19816
|
+
return void 0;
|
|
19817
|
+
}
|
|
19818
|
+
return referenceSourceAggregator.getLoadedSource(currentSourceId);
|
|
19819
|
+
}
|
|
19820
|
+
};
|
|
19821
|
+
}, [hostLocalFileLabel, hostLocalFileSelectLabel, referenceSourceAggregator]);
|
|
19534
19822
|
const requestWorkspaceReferences = useCallback10(
|
|
19535
19823
|
async (entity) => {
|
|
19536
19824
|
if (previewMode) {
|
|
19537
19825
|
return emptyReferencePickResult;
|
|
19538
19826
|
}
|
|
19539
|
-
if (!workspaceFileReferenceAdapter && !
|
|
19827
|
+
if (!workspaceFileReferenceAdapter && !referenceSourceAggregatorWithHostLocalFile || !workspaceFileReferenceCopy) {
|
|
19540
19828
|
return emptyReferencePickResult;
|
|
19541
19829
|
}
|
|
19542
|
-
const target = entity &&
|
|
19830
|
+
const target = entity && referenceSourceAggregatorWithHostLocalFile ? resolveMentionReferenceTarget?.(entity) ?? null : referenceSourceAggregatorWithHostLocalFile ? resolveWorkspaceReferenceInitialTarget?.({
|
|
19831
|
+
activeConversation: viewModel.activeConversation,
|
|
19832
|
+
composerSelectedProjectPath: viewModel.composerSettings.selectedProjectPath ?? null,
|
|
19833
|
+
userProjects: viewModel.userProjects
|
|
19834
|
+
}) ?? null : null;
|
|
19543
19835
|
setWorkspaceReferencePickerTarget(target);
|
|
19544
19836
|
setWorkspaceReferencePickerOpen(true);
|
|
19545
19837
|
return await new Promise((resolve) => {
|
|
@@ -19549,8 +19841,12 @@ function AgentGUINodeView({
|
|
|
19549
19841
|
[
|
|
19550
19842
|
emptyReferencePickResult,
|
|
19551
19843
|
previewMode,
|
|
19552
|
-
|
|
19844
|
+
referenceSourceAggregatorWithHostLocalFile,
|
|
19553
19845
|
resolveMentionReferenceTarget,
|
|
19846
|
+
resolveWorkspaceReferenceInitialTarget,
|
|
19847
|
+
viewModel.activeConversation,
|
|
19848
|
+
viewModel.composerSettings.selectedProjectPath,
|
|
19849
|
+
viewModel.userProjects,
|
|
19554
19850
|
workspaceFileReferenceAdapter,
|
|
19555
19851
|
workspaceFileReferenceCopy
|
|
19556
19852
|
]
|
|
@@ -19574,10 +19870,32 @@ function AgentGUINodeView({
|
|
|
19574
19870
|
[onWorkspaceFileReferencesAdded]
|
|
19575
19871
|
);
|
|
19576
19872
|
const confirmWorkspaceReferencePicker = useCallback10(
|
|
19577
|
-
(refs) => {
|
|
19578
|
-
|
|
19873
|
+
async (refs) => {
|
|
19874
|
+
const wantsHostFiles = refs.some(
|
|
19875
|
+
(ref) => ref.path === hostLocalFileActionPath
|
|
19876
|
+
);
|
|
19877
|
+
if (!wantsHostFiles) {
|
|
19878
|
+
settleReferencePicker(
|
|
19879
|
+
{ files: refs, mentionItems: [], hostAttachments: [] },
|
|
19880
|
+
refs
|
|
19881
|
+
);
|
|
19882
|
+
return;
|
|
19883
|
+
}
|
|
19884
|
+
const workspaceRefs = refs.filter(
|
|
19885
|
+
(ref) => ref.path !== hostLocalFileActionPath
|
|
19886
|
+
);
|
|
19887
|
+
const selected = await agentHostApi.workspace.selectFiles();
|
|
19888
|
+
const hostAttachments = selected.map((file) => ({
|
|
19889
|
+
hostPath: file.path,
|
|
19890
|
+
name: file.name || file.path.split("/").pop() || file.path,
|
|
19891
|
+
mimeType: null
|
|
19892
|
+
}));
|
|
19893
|
+
settleReferencePicker(
|
|
19894
|
+
{ files: workspaceRefs, mentionItems: [], hostAttachments },
|
|
19895
|
+
workspaceRefs
|
|
19896
|
+
);
|
|
19579
19897
|
},
|
|
19580
|
-
[settleReferencePicker]
|
|
19898
|
+
[agentHostApi.workspace, settleReferencePicker]
|
|
19581
19899
|
);
|
|
19582
19900
|
const confirmWorkspaceReferenceBundles = useCallback10(
|
|
19583
19901
|
(result) => {
|
|
@@ -19608,7 +19926,7 @@ function AgentGUINodeView({
|
|
|
19608
19926
|
};
|
|
19609
19927
|
});
|
|
19610
19928
|
settleReferencePicker(
|
|
19611
|
-
{ files: result.files, mentionItems },
|
|
19929
|
+
{ files: result.files, mentionItems, hostAttachments: [] },
|
|
19612
19930
|
result.files
|
|
19613
19931
|
);
|
|
19614
19932
|
},
|
|
@@ -19655,12 +19973,20 @@ function AgentGUINodeView({
|
|
|
19655
19973
|
}
|
|
19656
19974
|
if (options) {
|
|
19657
19975
|
createConversationAction(options);
|
|
19976
|
+
} else if (viewModel.composerSettings.selectedProjectPath) {
|
|
19977
|
+
createConversationAction({
|
|
19978
|
+
projectPath: viewModel.composerSettings.selectedProjectPath
|
|
19979
|
+
});
|
|
19658
19980
|
} else {
|
|
19659
19981
|
createConversationAction();
|
|
19660
19982
|
}
|
|
19661
19983
|
setLocalComposerFocusRequestSequence((current) => current + 1);
|
|
19662
19984
|
},
|
|
19663
|
-
[
|
|
19985
|
+
[
|
|
19986
|
+
createConversationAction,
|
|
19987
|
+
previewMode,
|
|
19988
|
+
viewModel.composerSettings.selectedProjectPath
|
|
19989
|
+
]
|
|
19664
19990
|
);
|
|
19665
19991
|
useEffect12(() => {
|
|
19666
19992
|
if (newConversationRequestSequence === null || handledNewConversationRequestSequenceRef.current === newConversationRequestSequence) {
|
|
@@ -19946,10 +20272,10 @@ function AgentGUINodeView({
|
|
|
19946
20272
|
]
|
|
19947
20273
|
}
|
|
19948
20274
|
),
|
|
19949
|
-
|
|
20275
|
+
referenceSourceAggregatorWithHostLocalFile ? /* @__PURE__ */ jsx29(
|
|
19950
20276
|
ReferenceSourcePicker,
|
|
19951
20277
|
{
|
|
19952
|
-
aggregator:
|
|
20278
|
+
aggregator: referenceSourceAggregatorWithHostLocalFile,
|
|
19953
20279
|
copy: workspaceFileReferenceCopy ?? fallbackWorkspaceFileReferenceCopy,
|
|
19954
20280
|
initialTarget: workspaceReferencePickerTarget,
|
|
19955
20281
|
open: workspaceReferencePickerOpen,
|
|
@@ -21630,6 +21956,15 @@ var AgentGUIConversationRailSection = memo(
|
|
|
21630
21956
|
const showLessConversations = useCallback10(() => {
|
|
21631
21957
|
setVisibleItemLimit(AGENT_GUI_CONVERSATION_RAIL_SECTION_PAGE_SIZE);
|
|
21632
21958
|
}, []);
|
|
21959
|
+
const canCreateConversationFromSection = section.kind === "conversations" || Boolean(projectPath);
|
|
21960
|
+
const createConversationLabel = projectPath ? labels.projectSectionEdit : labels.newConversation;
|
|
21961
|
+
const handleCreateConversation = useCallback10(() => {
|
|
21962
|
+
if (projectPath) {
|
|
21963
|
+
onCreateConversation({ projectPath });
|
|
21964
|
+
return;
|
|
21965
|
+
}
|
|
21966
|
+
onCreateConversation({ projectPath: null });
|
|
21967
|
+
}, [onCreateConversation, projectPath]);
|
|
21633
21968
|
return /* @__PURE__ */ jsxs15(
|
|
21634
21969
|
"section",
|
|
21635
21970
|
{
|
|
@@ -21666,16 +22001,16 @@ var AgentGUIConversationRailSection = memo(
|
|
|
21666
22001
|
]
|
|
21667
22002
|
}
|
|
21668
22003
|
) : /* @__PURE__ */ jsx29("div", { className: AgentGUINode_styles_default.conversationSectionToggle, children: /* @__PURE__ */ jsx29("span", { className: AgentGUINode_styles_default.conversationSectionLabel, children: /* @__PURE__ */ jsx29("span", { children: section.label }) }) }),
|
|
21669
|
-
|
|
22004
|
+
canCreateConversationFromSection ? /* @__PURE__ */ jsxs15("div", { className: AgentGUINode_styles_default.conversationSectionActions, children: [
|
|
21670
22005
|
/* @__PURE__ */ jsxs15("span", { className: AgentGUINode_styles_default.conversationSectionActionTooltipWrap, children: [
|
|
21671
22006
|
/* @__PURE__ */ jsx29(
|
|
21672
22007
|
BareIconButton,
|
|
21673
22008
|
{
|
|
21674
22009
|
className: AgentGUINode_styles_default.conversationSectionMoreButton,
|
|
21675
|
-
"aria-label":
|
|
22010
|
+
"aria-label": createConversationLabel,
|
|
21676
22011
|
size: "sm",
|
|
21677
22012
|
disabled: createConversationDisabled,
|
|
21678
|
-
onClick:
|
|
22013
|
+
onClick: handleCreateConversation,
|
|
21679
22014
|
children: /* @__PURE__ */ jsx29(EditIcon, { "aria-hidden": "true" })
|
|
21680
22015
|
}
|
|
21681
22016
|
),
|
|
@@ -21684,30 +22019,36 @@ var AgentGUIConversationRailSection = memo(
|
|
|
21684
22019
|
{
|
|
21685
22020
|
"aria-hidden": "true",
|
|
21686
22021
|
className: AgentGUINode_styles_default.conversationSectionActionTooltip,
|
|
21687
|
-
children:
|
|
22022
|
+
children: createConversationLabel
|
|
21688
22023
|
}
|
|
21689
22024
|
)
|
|
21690
22025
|
] }),
|
|
21691
|
-
/* @__PURE__ */ jsxs15(DropdownMenu, { children: [
|
|
21692
|
-
/* @__PURE__ */ jsx29(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs15(
|
|
21693
|
-
|
|
21694
|
-
|
|
21695
|
-
|
|
21696
|
-
|
|
21697
|
-
|
|
21698
|
-
|
|
21699
|
-
|
|
21700
|
-
|
|
21701
|
-
|
|
21702
|
-
|
|
21703
|
-
|
|
21704
|
-
|
|
21705
|
-
|
|
21706
|
-
|
|
21707
|
-
|
|
21708
|
-
|
|
21709
|
-
|
|
21710
|
-
|
|
22026
|
+
projectPath ? /* @__PURE__ */ jsxs15(DropdownMenu, { children: [
|
|
22027
|
+
/* @__PURE__ */ jsx29(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs15(
|
|
22028
|
+
"span",
|
|
22029
|
+
{
|
|
22030
|
+
className: AgentGUINode_styles_default.conversationSectionActionTooltipWrap,
|
|
22031
|
+
children: [
|
|
22032
|
+
/* @__PURE__ */ jsx29(
|
|
22033
|
+
BareIconButton,
|
|
22034
|
+
{
|
|
22035
|
+
className: AgentGUINode_styles_default.conversationSectionMoreButton,
|
|
22036
|
+
"aria-label": labels.projectSectionMoreActions,
|
|
22037
|
+
size: "sm",
|
|
22038
|
+
children: /* @__PURE__ */ jsx29(MoreHorizontalIcon, { "aria-hidden": "true" })
|
|
22039
|
+
}
|
|
22040
|
+
),
|
|
22041
|
+
/* @__PURE__ */ jsx29(
|
|
22042
|
+
"span",
|
|
22043
|
+
{
|
|
22044
|
+
"aria-hidden": "true",
|
|
22045
|
+
className: AgentGUINode_styles_default.conversationSectionActionTooltip,
|
|
22046
|
+
children: labels.projectSectionMoreActions
|
|
22047
|
+
}
|
|
22048
|
+
)
|
|
22049
|
+
]
|
|
22050
|
+
}
|
|
22051
|
+
) }),
|
|
21711
22052
|
/* @__PURE__ */ jsxs15(
|
|
21712
22053
|
DropdownMenuContent,
|
|
21713
22054
|
{
|
|
@@ -21767,7 +22108,7 @@ var AgentGUIConversationRailSection = memo(
|
|
|
21767
22108
|
]
|
|
21768
22109
|
}
|
|
21769
22110
|
)
|
|
21770
|
-
] })
|
|
22111
|
+
] }) : null
|
|
21771
22112
|
] }) : null
|
|
21772
22113
|
] }),
|
|
21773
22114
|
/* @__PURE__ */ jsx29(
|
|
@@ -22768,7 +23109,7 @@ function composerOverridesByProviderEqual(left, right) {
|
|
|
22768
23109
|
return true;
|
|
22769
23110
|
}
|
|
22770
23111
|
function areAgentGUINodePropsEqual(previous, next) {
|
|
22771
|
-
return previous.nodeId === next.nodeId && previous.workspaceId === next.workspaceId && previous.currentUserId === next.currentUserId && previous.workspacePath === next.workspacePath && previous.workspaceFileReferenceAdapter === next.workspaceFileReferenceAdapter && previous.referenceSourceAggregator === next.referenceSourceAggregator && previous.resolveMentionReferenceTarget === next.resolveMentionReferenceTarget && 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.onClose === next.onClose && previous.onResize === next.onResize && previous.onUpdateNode === next.onUpdateNode && 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(
|
|
23112
|
+
return previous.nodeId === next.nodeId && previous.workspaceId === next.workspaceId && previous.currentUserId === next.currentUserId && previous.workspacePath === next.workspacePath && previous.workspaceFileReferenceAdapter === next.workspaceFileReferenceAdapter && 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.onClose === next.onClose && previous.onResize === next.onResize && previous.onUpdateNode === next.onUpdateNode && 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(
|
|
22772
23113
|
previous.workspaceAgentProbes,
|
|
22773
23114
|
next.workspaceAgentProbes,
|
|
22774
23115
|
previous.state.provider
|
|
@@ -22783,6 +23124,7 @@ var AgentGUINode = memo2(function AgentGUINode2({
|
|
|
22783
23124
|
onRequestGitBranches = null,
|
|
22784
23125
|
referenceSourceAggregator = null,
|
|
22785
23126
|
resolveMentionReferenceTarget = null,
|
|
23127
|
+
resolveWorkspaceReferenceInitialTarget = null,
|
|
22786
23128
|
agentSettings,
|
|
22787
23129
|
title,
|
|
22788
23130
|
state,
|
|
@@ -23553,6 +23895,7 @@ var AgentGUINode = memo2(function AgentGUINode2({
|
|
|
23553
23895
|
onRequestGitBranches,
|
|
23554
23896
|
referenceSourceAggregator,
|
|
23555
23897
|
resolveMentionReferenceTarget,
|
|
23898
|
+
resolveWorkspaceReferenceInitialTarget,
|
|
23556
23899
|
workspaceFileReferenceCopy,
|
|
23557
23900
|
contextMentionProviders,
|
|
23558
23901
|
workspaceAppIcons
|