@tutti-os/agent-gui 0.0.31 → 0.0.32

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/index.js CHANGED
@@ -17489,7 +17489,6 @@ var MENTION_PALETTE_MIN_HEIGHT_PX = 280;
17489
17489
  var MENTION_PALETTE_MAX_HEIGHT_PX = 320;
17490
17490
  var MENTION_PALETTE_GAP_PX = 8;
17491
17491
  var MENTION_PALETTE_VIEWPORT_PADDING_PX = 8;
17492
- var promptFileUploadUnsupportedError = "Prompt file uploads are not supported by this agent runtime.";
17493
17492
  var EMPTY_CONTEXT_MENTION_PROVIDERS = [];
17494
17493
  var EMPTY_PROMPT_TIPS = [];
17495
17494
  var EMPTY_PROVIDER_SKILLS = [];
@@ -18493,87 +18492,6 @@ function AgentComposer({
18493
18492
  },
18494
18493
  [onDraftContentChange]
18495
18494
  );
18496
- const addDraftFiles = useCallback9(
18497
- (attachments) => {
18498
- if (attachments.length === 0) {
18499
- return;
18500
- }
18501
- const uploadPromptContent = agentActivityRuntime?.uploadPromptContent;
18502
- const nextFiles = attachments.map((attachment) => ({
18503
- id: `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,
18504
- name: attachment.name,
18505
- mimeType: attachment.mimeType?.trim() || "application/octet-stream",
18506
- hostPath: attachment.hostPath,
18507
- uploading: Boolean(uploadPromptContent),
18508
- ...uploadPromptContent ? {} : { uploadError: promptFileUploadUnsupportedError }
18509
- }));
18510
- const nextDraftFiles = [...draftFilesRef.current, ...nextFiles];
18511
- draftFilesRef.current = nextDraftFiles;
18512
- onDraftContentChange({
18513
- prompt: draftPromptRef.current,
18514
- images: draftImagesRef.current,
18515
- files: nextDraftFiles
18516
- });
18517
- if (!uploadPromptContent) {
18518
- return;
18519
- }
18520
- for (const draftFile of nextFiles) {
18521
- void uploadPromptContent({
18522
- workspaceId,
18523
- content: [
18524
- {
18525
- type: "file",
18526
- mimeType: draftFile.mimeType,
18527
- hostPath: draftFile.hostPath,
18528
- name: draftFile.name,
18529
- kind: "file"
18530
- }
18531
- ]
18532
- }).then((result) => {
18533
- const uploadedFile = result.content.find(
18534
- (block) => block.type === "file"
18535
- );
18536
- const uploadedPath = uploadedFile?.path?.trim() ?? "";
18537
- if (!uploadedPath) {
18538
- throw new Error("Prompt file upload completed without path.");
18539
- }
18540
- const uploadedDraftFiles = draftFilesRef.current.map(
18541
- (file) => file.id === draftFile.id ? {
18542
- id: file.id,
18543
- name: uploadedFile?.name ?? file.name,
18544
- mimeType: uploadedFile?.mimeType ?? file.mimeType,
18545
- path: uploadedPath,
18546
- assetId: uploadedFile?.assetId,
18547
- sizeBytes: uploadedFile?.sizeBytes,
18548
- uploading: false
18549
- } : file
18550
- );
18551
- draftFilesRef.current = uploadedDraftFiles;
18552
- onDraftContentChange({
18553
- prompt: draftPromptRef.current,
18554
- images: draftImagesRef.current,
18555
- files: uploadedDraftFiles
18556
- });
18557
- }).catch((error) => {
18558
- const message = error instanceof Error ? error.message : String(error);
18559
- const failedDraftFiles = draftFilesRef.current.map(
18560
- (file) => file.id === draftFile.id ? {
18561
- ...file,
18562
- uploading: false,
18563
- uploadError: message
18564
- } : file
18565
- );
18566
- draftFilesRef.current = failedDraftFiles;
18567
- onDraftContentChange({
18568
- prompt: draftPromptRef.current,
18569
- images: draftImagesRef.current,
18570
- files: failedDraftFiles
18571
- });
18572
- });
18573
- }
18574
- },
18575
- [agentActivityRuntime, onDraftContentChange, workspaceId]
18576
- );
18577
18495
  const removeDraftFile = useCallback9(
18578
18496
  (id) => {
18579
18497
  const nextDraftFiles = draftFilesRef.current.filter(
@@ -18634,11 +18552,8 @@ function AgentComposer({
18634
18552
  if (result.mentionItems.length > 0) {
18635
18553
  editorHandleRef.current?.insertMentionItems(result.mentionItems);
18636
18554
  }
18637
- if (result.hostAttachments && result.hostAttachments.length > 0) {
18638
- addDraftFiles(result.hostAttachments);
18639
- }
18640
18555
  },
18641
- [addDraftFiles, agentActivityRuntime, workspaceId]
18556
+ [agentActivityRuntime, workspaceId]
18642
18557
  );
18643
18558
  const handleWorkspaceReferencePicker = useCallback9(async () => {
18644
18559
  if (!onRequestWorkspaceReferences) {
@@ -20195,7 +20110,7 @@ function AgentGUINodeView({
20195
20110
  );
20196
20111
  const workspaceReferencePickerResolverRef = useRef13(null);
20197
20112
  const emptyReferencePickResult = useMemo10(
20198
- () => ({ files: [], mentionItems: [], hostAttachments: [] }),
20113
+ () => ({ files: [], mentionItems: [] }),
20199
20114
  []
20200
20115
  );
20201
20116
  const hostLocalFileSourceId = "host-local-file";
@@ -20255,26 +20170,15 @@ function AgentGUINodeView({
20255
20170
  );
20256
20171
  const confirmWorkspaceReferencePicker = useCallback10(
20257
20172
  (refs) => {
20258
- settleReferencePicker(
20259
- { files: refs, mentionItems: [], hostAttachments: [] },
20260
- refs
20261
- );
20173
+ settleReferencePicker({ files: refs, mentionItems: [] }, refs);
20262
20174
  },
20263
20175
  [settleReferencePicker]
20264
20176
  );
20265
20177
  const confirmWorkspaceReferenceBundles = useCallback10(
20266
20178
  (result) => {
20267
- const hostSourceRefs = result.files.filter(
20268
- (ref) => ref.sourceId === hostLocalFileSourceId && ref.kind === "file"
20269
- );
20270
20179
  const workspaceRefs = result.files.filter(
20271
20180
  (ref) => ref.sourceId !== hostLocalFileSourceId
20272
20181
  );
20273
- const hostAttachments = hostSourceRefs.map((file) => ({
20274
- hostPath: file.path,
20275
- name: file.displayName || file.path.split("/").pop() || file.path,
20276
- mimeType: null
20277
- }));
20278
20182
  const mentionItems = result.bundles.filter((bundle) => bundle.handle != null).map((bundle) => {
20279
20183
  const handle = bundle.handle;
20280
20184
  const bundleIconUrl = bundle.iconUrl ?? void 0;
@@ -20302,7 +20206,7 @@ function AgentGUINodeView({
20302
20206
  };
20303
20207
  });
20304
20208
  settleReferencePicker(
20305
- { files: workspaceRefs, mentionItems, hostAttachments },
20209
+ { files: result.files, mentionItems },
20306
20210
  workspaceRefs
20307
20211
  );
20308
20212
  },