@tutti-os/agent-gui 0.0.132 → 0.0.134
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/README.md +21 -4
- package/dist/{AgentRichTextReadonly-PEKCMRPE.js → AgentRichTextReadonly-HCKTNAYO.js} +7 -6
- package/dist/agent-conversation/index.d.ts +4 -6
- package/dist/agent-conversation/index.js +10 -10
- package/dist/agent-env/index.d.ts +10 -27
- package/dist/agent-env/index.js +14 -290
- package/dist/agent-env/index.js.map +1 -1
- package/dist/agent-gui.d.ts +1118 -20
- package/dist/agent-gui.js +18 -18
- package/dist/agent-message-center/index.d.ts +42 -7
- package/dist/agent-message-center/index.js +7 -7
- package/dist/{agentConversationVM-BD0-gg6C.d.ts → agentConversationVM-DWEy7jzx.d.ts} +41 -2
- package/dist/{agentFileMentionContracts-CWAeuL7S.d.ts → agentFileMentionContracts-B0yQizXB.d.ts} +5 -0
- package/dist/{agentGuiNodeTypes-5TL1hyCN.d.ts → agentGuiNodeTypes-DV7KvZRe.d.ts} +10 -26
- package/dist/agents.d.ts +1 -1
- package/dist/agents.js +1 -1
- package/dist/app/renderer/agentactivity.css +7 -0
- package/dist/app/renderer/assets/icons/@-lined.svg +1 -8
- package/dist/{chunk-PQJXWXTS.js → chunk-25VMCMAQ.js} +4 -4
- package/dist/{chunk-T2NICA5D.js → chunk-5WOCGIXJ.js} +7 -1
- package/dist/chunk-5WOCGIXJ.js.map +1 -0
- package/dist/chunk-DLCZJKCA.js +1 -0
- package/dist/chunk-DLCZJKCA.js.map +1 -0
- package/dist/{chunk-QQRTUHCH.js → chunk-EU7DCT4F.js} +2 -2
- package/dist/chunk-FM42UN2J.js +462 -0
- package/dist/chunk-FM42UN2J.js.map +1 -0
- package/dist/{chunk-SZOTLVH6.js → chunk-GIYGO2PB.js} +2 -2
- package/dist/{chunk-GCQYN7BR.js → chunk-IN3HXYOO.js} +4 -4
- package/dist/{chunk-YWHGCKMT.js → chunk-IYZ4GOSN.js} +10 -10
- package/dist/chunk-IYZ4GOSN.js.map +1 -0
- package/dist/{chunk-JZS4SWFJ.js → chunk-JI5KND3K.js} +60 -56
- package/dist/chunk-JI5KND3K.js.map +1 -0
- package/dist/{chunk-J4TTEMRW.js → chunk-KWGMK4IZ.js} +4 -4
- package/dist/{chunk-NE6H7S5Z.js → chunk-OFJNIQWR.js} +2 -2
- package/dist/{chunk-NE6H7S5Z.js.map → chunk-OFJNIQWR.js.map} +1 -1
- package/dist/{chunk-UARZZJJB.js → chunk-OI6BYC7P.js} +4 -4
- package/dist/{chunk-OBWM2RFE.js → chunk-QPEO4OQS.js} +308 -8
- package/dist/chunk-QPEO4OQS.js.map +1 -0
- package/dist/{chunk-XNE2ROCP.js → chunk-UA75CGAG.js} +3 -3
- package/dist/{chunk-PVTAFUDS.js → chunk-VGS7S7YT.js} +2 -2
- package/dist/{chunk-OQR3HXPF.js → chunk-VUNVGEQG.js} +7 -1
- package/dist/chunk-VUNVGEQG.js.map +1 -0
- package/dist/{chunk-G75CPIVV.js → chunk-Y5HD6XHP.js} +1040 -797
- package/dist/chunk-Y5HD6XHP.js.map +1 -0
- package/dist/{chunk-KPMQGPYU.js → chunk-ZVYUTXQJ.js} +1 -1
- package/dist/chunk-ZVYUTXQJ.js.map +1 -0
- package/dist/context-mention-palette/index.d.ts +1 -1
- package/dist/context-mention-palette/index.js +8 -7
- package/dist/{contribution-yc4CGJmy.d.ts → contribution-CDdwTppn.d.ts} +54 -1
- package/dist/custom-mention.d.ts +4 -2
- package/dist/custom-mention.js +1 -0
- package/dist/i18n/index.d.ts +17 -6
- package/dist/i18n/index.js +2 -2
- package/dist/index.d.ts +8026 -33
- package/dist/index.js +21 -21
- package/dist/index.js.map +1 -1
- package/dist/mention-search.d.ts +1 -1
- package/dist/mention-search.js +6 -5
- package/dist/runtime-Dwf44VKc.d.ts +7 -0
- package/dist/{types-BicfRVrV.d.ts → types-ee3zJ6Cc.d.ts} +6 -5
- package/dist/workbench/browser-element-context/index.d.ts +37 -0
- package/dist/workbench/browser-element-context/index.js +750 -0
- package/dist/workbench/browser-element-context/index.js.map +1 -0
- package/dist/workbench/contribution.d.ts +1 -2
- package/dist/workbench/contribution.js +4 -4
- package/dist/workbench/index.d.ts +1 -2
- package/dist/workbench/index.js +4 -4
- package/dist/workbench/sessionTitle.js +2 -2
- package/dist/workbench/tool-sidebar/index.d.ts +189 -0
- package/dist/workbench/tool-sidebar/index.js +1492 -0
- package/dist/workbench/tool-sidebar/index.js.map +1 -0
- package/dist/workspace-agent-generated-files.d.ts +12 -1
- package/package.json +28 -13
- package/dist/AgentGUI-DxypmD7b.d.ts +0 -1080
- package/dist/agentPlanPromptDispatch-C7cCMjve.d.ts +0 -37
- package/dist/chunk-G75CPIVV.js.map +0 -1
- package/dist/chunk-JZS4SWFJ.js.map +0 -1
- package/dist/chunk-KPMQGPYU.js.map +0 -1
- package/dist/chunk-OBWM2RFE.js.map +0 -1
- package/dist/chunk-OQR3HXPF.js.map +0 -1
- package/dist/chunk-T2NICA5D.js.map +0 -1
- package/dist/chunk-VMQNG2KI.js +0 -178
- package/dist/chunk-VMQNG2KI.js.map +0 -1
- package/dist/chunk-YWHGCKMT.js.map +0 -1
- package/dist/pastedTextKinds-D-XuInaS.d.ts +0 -4
- package/dist/runtime-BBNdWgDU.d.ts +0 -10
- package/dist/workspaceAgentActivityListTypes-DZfS_HgG.d.ts +0 -48
- /package/dist/{AgentRichTextReadonly-PEKCMRPE.js.map → AgentRichTextReadonly-HCKTNAYO.js.map} +0 -0
- /package/dist/{chunk-PQJXWXTS.js.map → chunk-25VMCMAQ.js.map} +0 -0
- /package/dist/{chunk-QQRTUHCH.js.map → chunk-EU7DCT4F.js.map} +0 -0
- /package/dist/{chunk-SZOTLVH6.js.map → chunk-GIYGO2PB.js.map} +0 -0
- /package/dist/{chunk-GCQYN7BR.js.map → chunk-IN3HXYOO.js.map} +0 -0
- /package/dist/{chunk-J4TTEMRW.js.map → chunk-KWGMK4IZ.js.map} +0 -0
- /package/dist/{chunk-UARZZJJB.js.map → chunk-OI6BYC7P.js.map} +0 -0
- /package/dist/{chunk-XNE2ROCP.js.map → chunk-UA75CGAG.js.map} +0 -0
- /package/dist/{chunk-PVTAFUDS.js.map → chunk-VGS7S7YT.js.map} +0 -0
|
@@ -2,13 +2,16 @@ import {
|
|
|
2
2
|
resolveAgentMentionFileThumbnailUrl,
|
|
3
3
|
resolveAgentMentionFileVisualKind
|
|
4
4
|
} from "./chunk-5QPOMKMQ.js";
|
|
5
|
+
import {
|
|
6
|
+
AGENT_PASTED_TEXT_BLOCK_KIND
|
|
7
|
+
} from "./chunk-FGLQZ6I4.js";
|
|
5
8
|
import {
|
|
6
9
|
managedAgentRoundedIconUrl
|
|
7
10
|
} from "./chunk-EDNJMG5T.js";
|
|
8
11
|
import {
|
|
9
12
|
translate,
|
|
10
13
|
useTranslation
|
|
11
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-GIYGO2PB.js";
|
|
12
15
|
import {
|
|
13
16
|
getAgentCustomMentionKind
|
|
14
17
|
} from "./chunk-D2JUDUYY.js";
|
|
@@ -32,6 +35,7 @@ import {
|
|
|
32
35
|
} from "react";
|
|
33
36
|
import { NodeViewWrapper } from "@tiptap/react";
|
|
34
37
|
import { MentionPill } from "@tutti-os/ui-system/components";
|
|
38
|
+
import { Spinner } from "@tutti-os/ui-system";
|
|
35
39
|
import { CloseIcon } from "@tutti-os/ui-system/icons";
|
|
36
40
|
|
|
37
41
|
// agent-gui/agentGuiNode/agentRichText/agentMentionMarkdown.ts
|
|
@@ -43,6 +47,18 @@ import {
|
|
|
43
47
|
isRichTextMentionHref,
|
|
44
48
|
parseRichTextMentionHref
|
|
45
49
|
} from "@tutti-os/ui-rich-text/core";
|
|
50
|
+
var AGENT_COMPOSER_FILE_MENTION_KIND = "composer-file";
|
|
51
|
+
function createAgentComposerFileMentionMarkdown(input) {
|
|
52
|
+
return createRichTextMentionMarkdown({
|
|
53
|
+
providerId: AGENT_COMPOSER_FILE_MENTION_KIND,
|
|
54
|
+
entityId: input.id,
|
|
55
|
+
label: input.name,
|
|
56
|
+
scope: {
|
|
57
|
+
...input.errorCode?.trim() ? { errorCode: input.errorCode.trim() } : {},
|
|
58
|
+
status: input.status
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
46
62
|
function dirnameFromPath(path) {
|
|
47
63
|
const parts = path.split("/").filter(Boolean);
|
|
48
64
|
if (parts.length <= 1) {
|
|
@@ -55,6 +71,16 @@ function normalizeAgentSessionMentionTitle(value) {
|
|
|
55
71
|
const withoutMentionPrefix = trimmed.replace(/^@+/, "").trim();
|
|
56
72
|
return withoutMentionPrefix || trimmed;
|
|
57
73
|
}
|
|
74
|
+
function formatAgentFileMentionMarkdown(name, path) {
|
|
75
|
+
return formatAgentMentionMarkdown({
|
|
76
|
+
kind: "file",
|
|
77
|
+
href: path,
|
|
78
|
+
path,
|
|
79
|
+
name,
|
|
80
|
+
entryKind: "unknown",
|
|
81
|
+
directoryPath: ""
|
|
82
|
+
});
|
|
83
|
+
}
|
|
58
84
|
function createAgentSessionMentionHref(input) {
|
|
59
85
|
const label = normalizeAgentSessionMarkdownLabel(input.label);
|
|
60
86
|
const agentTargetId = input.agentTargetId?.trim() ?? "";
|
|
@@ -83,6 +109,14 @@ function createAgentSessionMarkdownLink(input) {
|
|
|
83
109
|
}
|
|
84
110
|
function formatAgentMentionMarkdown(item) {
|
|
85
111
|
if (item.kind === "file") {
|
|
112
|
+
if (item.attachmentId) {
|
|
113
|
+
return createAgentComposerFileMentionMarkdown({
|
|
114
|
+
errorCode: item.attachmentErrorCode,
|
|
115
|
+
id: item.attachmentId,
|
|
116
|
+
name: item.name,
|
|
117
|
+
status: item.attachmentStatus ?? "ready"
|
|
118
|
+
});
|
|
119
|
+
}
|
|
86
120
|
const label = item.name.trim().startsWith("@") ? item.name : `@${item.name}`;
|
|
87
121
|
return createRichTextLinkMarkdown({
|
|
88
122
|
kind: "file",
|
|
@@ -254,6 +288,25 @@ function parseMentionItemFromHref(input) {
|
|
|
254
288
|
const targetId = mention.entityId.trim();
|
|
255
289
|
const workspaceId = mention.scope?.workspaceId?.trim() ?? "";
|
|
256
290
|
const name = mention.label;
|
|
291
|
+
if (resource === AGENT_COMPOSER_FILE_MENTION_KIND) {
|
|
292
|
+
if (!targetId) {
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
const status = normalizeAgentComposerFileMentionStatus(
|
|
296
|
+
mention.scope?.status
|
|
297
|
+
);
|
|
298
|
+
return {
|
|
299
|
+
kind: "file",
|
|
300
|
+
href,
|
|
301
|
+
path: "",
|
|
302
|
+
name,
|
|
303
|
+
entryKind: "file",
|
|
304
|
+
directoryPath: "",
|
|
305
|
+
attachmentId: targetId,
|
|
306
|
+
attachmentStatus: status,
|
|
307
|
+
attachmentErrorCode: mention.scope?.errorCode?.trim() || void 0
|
|
308
|
+
};
|
|
309
|
+
}
|
|
257
310
|
if (resource === "agent-session") {
|
|
258
311
|
if (!workspaceId) {
|
|
259
312
|
return null;
|
|
@@ -362,6 +415,51 @@ function parseMentionItemFromHref(input) {
|
|
|
362
415
|
}
|
|
363
416
|
return null;
|
|
364
417
|
}
|
|
418
|
+
function agentComposerFileMentionReferences(value) {
|
|
419
|
+
const references = [];
|
|
420
|
+
let cursor = 0;
|
|
421
|
+
while (cursor < value.length) {
|
|
422
|
+
const start = value.indexOf("[", cursor);
|
|
423
|
+
if (start < 0) break;
|
|
424
|
+
const parsed = parseAgentMentionMarkdown(value, start);
|
|
425
|
+
if (parsed?.item.kind === "file" && parsed.item.attachmentId) {
|
|
426
|
+
references.push({
|
|
427
|
+
start,
|
|
428
|
+
end: parsed.end,
|
|
429
|
+
errorCode: parsed.item.attachmentErrorCode,
|
|
430
|
+
id: parsed.item.attachmentId,
|
|
431
|
+
name: parsed.item.name,
|
|
432
|
+
status: parsed.item.attachmentStatus ?? "ready"
|
|
433
|
+
});
|
|
434
|
+
cursor = parsed.end;
|
|
435
|
+
continue;
|
|
436
|
+
}
|
|
437
|
+
cursor = start + 1;
|
|
438
|
+
}
|
|
439
|
+
return references;
|
|
440
|
+
}
|
|
441
|
+
function updateAgentComposerFileMentions(value, updates) {
|
|
442
|
+
const references = agentComposerFileMentionReferences(value);
|
|
443
|
+
if (references.length === 0) return value;
|
|
444
|
+
let cursor = 0;
|
|
445
|
+
let result = "";
|
|
446
|
+
for (const reference of references) {
|
|
447
|
+
const update = updates.get(reference.id);
|
|
448
|
+
const status = update?.status ?? reference.status;
|
|
449
|
+
result += value.slice(cursor, reference.start);
|
|
450
|
+
result += createAgentComposerFileMentionMarkdown({
|
|
451
|
+
...status === "error" ? { errorCode: update?.errorCode ?? reference.errorCode } : {},
|
|
452
|
+
id: reference.id,
|
|
453
|
+
name: reference.name,
|
|
454
|
+
status
|
|
455
|
+
});
|
|
456
|
+
cursor = reference.end;
|
|
457
|
+
}
|
|
458
|
+
return result + value.slice(cursor);
|
|
459
|
+
}
|
|
460
|
+
function normalizeAgentComposerFileMentionStatus(value) {
|
|
461
|
+
return value === "uploading" || value === "error" ? value : "ready";
|
|
462
|
+
}
|
|
365
463
|
function isLocalDirectoryMentionHref(href) {
|
|
366
464
|
return href.endsWith("/") && !/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(href);
|
|
367
465
|
}
|
|
@@ -428,6 +526,170 @@ function mentionVisual(item) {
|
|
|
428
526
|
};
|
|
429
527
|
}
|
|
430
528
|
|
|
529
|
+
// agent-gui/agentGuiNode/model/agentExternalPromptFiles.ts
|
|
530
|
+
function remainingAgentComposerPromptAssetSlots(input) {
|
|
531
|
+
if (typeof input.limit !== "number" || !Number.isFinite(input.limit) || input.limit < 0) {
|
|
532
|
+
return Number.POSITIVE_INFINITY;
|
|
533
|
+
}
|
|
534
|
+
return Math.max(
|
|
535
|
+
0,
|
|
536
|
+
Math.floor(input.limit) - input.files - input.images - input.largeTexts
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
function createAgentExternalPromptFilePreparation(files) {
|
|
540
|
+
const pendingFiles = files.map((file) => ({
|
|
541
|
+
id: crypto.randomUUID(),
|
|
542
|
+
name: file.name || "file",
|
|
543
|
+
...file.type ? { mimeType: file.type } : {},
|
|
544
|
+
...Number.isFinite(file.size) ? { sizeBytes: file.size } : {},
|
|
545
|
+
uploading: true
|
|
546
|
+
}));
|
|
547
|
+
return {
|
|
548
|
+
pendingFiles,
|
|
549
|
+
async complete(prepareExternalPromptFiles) {
|
|
550
|
+
let results;
|
|
551
|
+
try {
|
|
552
|
+
results = await prepareExternalPromptFiles(files);
|
|
553
|
+
} catch {
|
|
554
|
+
return pendingFiles.map(
|
|
555
|
+
(file) => failedDraftFile(file, "preparation_failed")
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
const resultByIndex = new Map(
|
|
559
|
+
results.map((result) => [result.sourceIndex, result])
|
|
560
|
+
);
|
|
561
|
+
return pendingFiles.map((pendingFile, sourceIndex) => {
|
|
562
|
+
const result = resultByIndex.get(sourceIndex);
|
|
563
|
+
if (!result) {
|
|
564
|
+
return failedDraftFile(pendingFile, "preparation_failed");
|
|
565
|
+
}
|
|
566
|
+
if (result.status === "error") {
|
|
567
|
+
return failedDraftFile(pendingFile, result.errorCode, {
|
|
568
|
+
retryable: result.retryable
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
const prepared = normalizePreparedFile(result.file);
|
|
572
|
+
if (!hasPreparedFileLocator(prepared)) {
|
|
573
|
+
return failedDraftFile(pendingFile, "preparation_failed");
|
|
574
|
+
}
|
|
575
|
+
return {
|
|
576
|
+
id: pendingFile.id,
|
|
577
|
+
name: prepared.name || pendingFile.name,
|
|
578
|
+
...prepared.mimeType ? { mimeType: prepared.mimeType } : pendingFile.mimeType ? { mimeType: pendingFile.mimeType } : {},
|
|
579
|
+
...prepared.path ? { path: prepared.path } : {},
|
|
580
|
+
...prepared.url ? { url: prepared.url } : {},
|
|
581
|
+
...prepared.uri ? { uri: prepared.uri } : {},
|
|
582
|
+
...prepared.assetId ? { assetId: prepared.assetId } : {},
|
|
583
|
+
...prepared.uploadStatus ? { uploadStatus: prepared.uploadStatus } : {},
|
|
584
|
+
...typeof prepared.sizeBytes === "number" ? { sizeBytes: prepared.sizeBytes } : typeof pendingFile.sizeBytes === "number" ? { sizeBytes: pendingFile.sizeBytes } : {},
|
|
585
|
+
uploading: false
|
|
586
|
+
};
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
function agentPreparedPromptFileToDraftFile(file, idPrefix, index) {
|
|
592
|
+
return {
|
|
593
|
+
id: `${idPrefix}:file:${index}`,
|
|
594
|
+
name: file.name?.trim() || `file-${index + 1}`,
|
|
595
|
+
mimeType: file.mimeType,
|
|
596
|
+
path: file.path,
|
|
597
|
+
hostPath: file.hostPath,
|
|
598
|
+
url: file.url,
|
|
599
|
+
uri: file.uri,
|
|
600
|
+
assetId: file.assetId,
|
|
601
|
+
uploadStatus: file.uploadStatus,
|
|
602
|
+
sizeBytes: file.sizeBytes
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
function agentPromptContentToComposerPrompt(content, files) {
|
|
606
|
+
let fileIndex = 0;
|
|
607
|
+
const parts = [];
|
|
608
|
+
for (const block of content) {
|
|
609
|
+
if (block.type === "text") {
|
|
610
|
+
parts.push(block.text?.trim() ?? "");
|
|
611
|
+
continue;
|
|
612
|
+
}
|
|
613
|
+
if (block.type !== "file" || block.kind === AGENT_PASTED_TEXT_BLOCK_KIND) {
|
|
614
|
+
continue;
|
|
615
|
+
}
|
|
616
|
+
const file = files[fileIndex];
|
|
617
|
+
fileIndex += 1;
|
|
618
|
+
if (!file) continue;
|
|
619
|
+
parts.push(
|
|
620
|
+
createAgentComposerFileMentionMarkdown({
|
|
621
|
+
id: file.id,
|
|
622
|
+
name: file.name,
|
|
623
|
+
status: "ready"
|
|
624
|
+
})
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
return parts.join("");
|
|
628
|
+
}
|
|
629
|
+
function agentPromptFileBlocks(content) {
|
|
630
|
+
return content.filter(
|
|
631
|
+
(block) => block.type === "file" && block.kind !== AGENT_PASTED_TEXT_BLOCK_KIND && (typeof block.path === "string" || typeof block.hostPath === "string" || typeof block.url === "string" || typeof block.uri === "string" || typeof block.assetId === "string")
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
function agentPromptPastedTextBlocks(content) {
|
|
635
|
+
return content.filter(
|
|
636
|
+
(block) => block.type === "file" && block.kind === AGENT_PASTED_TEXT_BLOCK_KIND && typeof block.path === "string"
|
|
637
|
+
);
|
|
638
|
+
}
|
|
639
|
+
function materializeAgentComposerFileMentions(prompt, files) {
|
|
640
|
+
const references = agentComposerFileMentionReferences(prompt);
|
|
641
|
+
if (references.length === 0) return prompt;
|
|
642
|
+
const fileById = new Map(files.map((file) => [file.id, file]));
|
|
643
|
+
let result = "";
|
|
644
|
+
let cursor = 0;
|
|
645
|
+
for (const reference of references) {
|
|
646
|
+
result += prompt.slice(cursor, reference.start);
|
|
647
|
+
const file = fileById.get(reference.id);
|
|
648
|
+
if (file && !file.uploading && !file.uploadError) {
|
|
649
|
+
const locator = file.path?.trim() || file.url?.trim() || "";
|
|
650
|
+
if (locator) {
|
|
651
|
+
result += formatAgentFileMentionMarkdown(file.name, locator);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
cursor = reference.end;
|
|
655
|
+
}
|
|
656
|
+
return result + prompt.slice(cursor);
|
|
657
|
+
}
|
|
658
|
+
function normalizePreparedFile(file) {
|
|
659
|
+
return {
|
|
660
|
+
name: file.name.trim(),
|
|
661
|
+
...file.mimeType?.trim() ? { mimeType: file.mimeType.trim() } : {},
|
|
662
|
+
...file.path?.trim() ? { path: file.path.trim() } : {},
|
|
663
|
+
...file.url?.trim() ? { url: file.url.trim() } : {},
|
|
664
|
+
...file.uri?.trim() ? { uri: file.uri.trim() } : {},
|
|
665
|
+
...file.assetId?.trim() ? { assetId: file.assetId.trim() } : {},
|
|
666
|
+
...file.uploadStatus?.trim() ? { uploadStatus: file.uploadStatus.trim() } : {},
|
|
667
|
+
...typeof file.sizeBytes === "number" && Number.isFinite(file.sizeBytes) ? { sizeBytes: file.sizeBytes } : {}
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
function hasPreparedFileLocator(file) {
|
|
671
|
+
return Boolean(file.path || file.url);
|
|
672
|
+
}
|
|
673
|
+
function failedDraftFile(file, errorCode, options = {}) {
|
|
674
|
+
return {
|
|
675
|
+
...file,
|
|
676
|
+
uploading: false,
|
|
677
|
+
uploadError: errorCode,
|
|
678
|
+
uploadErrorCode: errorCode,
|
|
679
|
+
...typeof options.retryable === "boolean" ? { uploadRetryable: options.retryable } : {}
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
function agentExternalPromptFileErrorI18nKey(errorCode) {
|
|
683
|
+
switch (errorCode) {
|
|
684
|
+
case "file_too_large":
|
|
685
|
+
return "agentHost.agentGui.composerFileTooLarge";
|
|
686
|
+
case "folder_unsupported":
|
|
687
|
+
return "agentHost.agentGui.composerFileFolderUnsupported";
|
|
688
|
+
default:
|
|
689
|
+
return "agentHost.agentGui.composerFilePreparationFailed";
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
|
|
431
693
|
// agent-gui/agentGuiNode/agentRichText/AgentMentionNodeView.tsx
|
|
432
694
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
433
695
|
function parseFileCountAttr(value) {
|
|
@@ -561,6 +823,12 @@ function mentionViewModel(attrs, t) {
|
|
|
561
823
|
const path = attrString(attrs, "path") || href;
|
|
562
824
|
const entryKind = attrString(attrs, "entryKind") || "unknown";
|
|
563
825
|
return {
|
|
826
|
+
attachmentStatus: attrString(attrs, "attachmentStatus") === "uploading" || attrString(attrs, "attachmentStatus") === "error" ? attrString(attrs, "attachmentStatus") : attrString(attrs, "attachmentId") ? "ready" : void 0,
|
|
827
|
+
attachmentErrorLabel: attrString(attrs, "attachmentStatus") === "error" ? t(
|
|
828
|
+
agentExternalPromptFileErrorI18nKey(
|
|
829
|
+
attrString(attrs, "attachmentErrorCode")
|
|
830
|
+
)
|
|
831
|
+
) : void 0,
|
|
564
832
|
ariaLabel: name,
|
|
565
833
|
directoryPath: attrString(attrs, "directoryPath") || dirnameFromPath2(path),
|
|
566
834
|
entryKind,
|
|
@@ -604,7 +872,8 @@ function AgentMentionLegacyFileNodeView({
|
|
|
604
872
|
node,
|
|
605
873
|
selected
|
|
606
874
|
}) {
|
|
607
|
-
const
|
|
875
|
+
const { t } = useTranslation();
|
|
876
|
+
const mention = mentionViewModel(node.attrs ?? {}, t);
|
|
608
877
|
const [isEditable, setIsEditable] = useState(editor.isEditable);
|
|
609
878
|
const extensionOptions = extension.options;
|
|
610
879
|
const removeActionAriaLabel = typeof extensionOptions.removeActionAriaLabel === "string" ? extensionOptions.removeActionAriaLabel : void 0;
|
|
@@ -635,7 +904,7 @@ function AgentMentionLegacyFileNodeView({
|
|
|
635
904
|
NodeViewWrapper,
|
|
636
905
|
{
|
|
637
906
|
as: "span",
|
|
638
|
-
"aria-label": mention.ariaLabel,
|
|
907
|
+
"aria-label": mention.attachmentErrorLabel ? `${mention.ariaLabel}, ${mention.attachmentErrorLabel}` : mention.ariaLabel,
|
|
639
908
|
className: `agent-rich-text-mention-node group tsh-agent-object-token tsh-agent-object-token--file ${selected ? "is-selected" : ""}`,
|
|
640
909
|
contentEditable: false,
|
|
641
910
|
"data-agent-file-directory-path": mention.directoryPath,
|
|
@@ -649,6 +918,9 @@ function AgentMentionLegacyFileNodeView({
|
|
|
649
918
|
},
|
|
650
919
|
"data-agent-mention-href": mention.href,
|
|
651
920
|
"data-agent-mention-kind": mention.kind,
|
|
921
|
+
"data-uploading": mention.attachmentStatus === "uploading" ? "true" : void 0,
|
|
922
|
+
"data-upload-error": mention.attachmentStatus === "error" ? "true" : void 0,
|
|
923
|
+
title: mention.attachmentErrorLabel ?? void 0,
|
|
652
924
|
...mention.thumbnailUrl ? { "data-agent-mention-thumbnail-url": mention.thumbnailUrl } : {},
|
|
653
925
|
children: [
|
|
654
926
|
mention.thumbnailUrl ? /* @__PURE__ */ jsxs(
|
|
@@ -687,7 +959,16 @@ function AgentMentionLegacyFileNodeView({
|
|
|
687
959
|
className: "relative grid size-4 shrink-0 place-items-center",
|
|
688
960
|
"aria-hidden": isEditable ? void 0 : true,
|
|
689
961
|
children: [
|
|
690
|
-
/* @__PURE__ */ jsx(
|
|
962
|
+
mention.attachmentStatus === "uploading" ? /* @__PURE__ */ jsx(
|
|
963
|
+
Spinner,
|
|
964
|
+
{
|
|
965
|
+
className: isEditable ? "transition-opacity group-hover:opacity-0 group-focus-within:opacity-0" : void 0,
|
|
966
|
+
size: 14,
|
|
967
|
+
strokeWidth: 2.4,
|
|
968
|
+
trackColor: "var(--transparency-hover)",
|
|
969
|
+
testId: "agent-gui-composer-file-upload-spinner"
|
|
970
|
+
}
|
|
971
|
+
) : /* @__PURE__ */ jsx(
|
|
691
972
|
"span",
|
|
692
973
|
{
|
|
693
974
|
className: `tsh-agent-object-token__icon transition-opacity ${isEditable ? "group-hover:opacity-0 group-focus-within:opacity-0" : ""}`,
|
|
@@ -891,7 +1172,10 @@ function mentionItemToAttrs(item) {
|
|
|
891
1172
|
path: item.path,
|
|
892
1173
|
entryKind: item.entryKind,
|
|
893
1174
|
directoryPath: item.directoryPath,
|
|
894
|
-
thumbnailUrl: resolveAgentMentionFileThumbnailUrl(item) ?? ""
|
|
1175
|
+
thumbnailUrl: resolveAgentMentionFileThumbnailUrl(item) ?? "",
|
|
1176
|
+
...item.attachmentId ? { attachmentId: item.attachmentId } : {},
|
|
1177
|
+
...item.attachmentStatus ? { attachmentStatus: item.attachmentStatus } : {},
|
|
1178
|
+
...item.attachmentErrorCode ? { attachmentErrorCode: item.attachmentErrorCode } : {}
|
|
895
1179
|
};
|
|
896
1180
|
}
|
|
897
1181
|
if (item.kind === "session") {
|
|
@@ -1126,6 +1410,9 @@ function attrsToMentionItem(attrs) {
|
|
|
1126
1410
|
name,
|
|
1127
1411
|
entryKind: normalizeEntryKind(attrs.entryKind),
|
|
1128
1412
|
directoryPath: typeof attrs.directoryPath === "string" && attrs.directoryPath.trim() ? attrs.directoryPath : dirnameFromPath(path),
|
|
1413
|
+
attachmentId: typeof attrs.attachmentId === "string" && attrs.attachmentId.trim() ? attrs.attachmentId.trim() : void 0,
|
|
1414
|
+
attachmentStatus: attrs.attachmentStatus === "uploading" || attrs.attachmentStatus === "error" ? attrs.attachmentStatus : attrs.attachmentId ? "ready" : void 0,
|
|
1415
|
+
attachmentErrorCode: typeof attrs.attachmentErrorCode === "string" && attrs.attachmentErrorCode.trim() ? attrs.attachmentErrorCode.trim() : void 0,
|
|
1129
1416
|
thumbnailUrl: resolveAgentMentionFileThumbnailUrl({
|
|
1130
1417
|
entryKind: normalizeEntryKind(attrs.entryKind),
|
|
1131
1418
|
href: href || path,
|
|
@@ -1298,7 +1585,10 @@ function createAgentFileMentionExtension(options = {}) {
|
|
|
1298
1585
|
fileCount: { default: "" },
|
|
1299
1586
|
customKind: { default: "" },
|
|
1300
1587
|
sourceLabel: { default: "" },
|
|
1301
|
-
preview: { default: "" }
|
|
1588
|
+
preview: { default: "" },
|
|
1589
|
+
attachmentId: { default: "" },
|
|
1590
|
+
attachmentStatus: { default: "" },
|
|
1591
|
+
attachmentErrorCode: { default: "" }
|
|
1302
1592
|
};
|
|
1303
1593
|
},
|
|
1304
1594
|
parseHTML() {
|
|
@@ -1487,7 +1777,6 @@ function createAgentFileMentionExtension(options = {}) {
|
|
|
1487
1777
|
}
|
|
1488
1778
|
|
|
1489
1779
|
export {
|
|
1490
|
-
AGENT_RICH_TEXT_CARET_ANCHOR,
|
|
1491
1780
|
normalizeAgentSessionMentionTitle,
|
|
1492
1781
|
createAgentSessionMentionHref,
|
|
1493
1782
|
createAgentSessionMarkdownLink,
|
|
@@ -1495,9 +1784,20 @@ export {
|
|
|
1495
1784
|
materializeAgentCustomMentionPromptText,
|
|
1496
1785
|
parseAgentMentionMarkdown,
|
|
1497
1786
|
parseMentionItemFromHref,
|
|
1787
|
+
agentComposerFileMentionReferences,
|
|
1788
|
+
updateAgentComposerFileMentions,
|
|
1789
|
+
remainingAgentComposerPromptAssetSlots,
|
|
1790
|
+
createAgentExternalPromptFilePreparation,
|
|
1791
|
+
agentPreparedPromptFileToDraftFile,
|
|
1792
|
+
agentPromptContentToComposerPrompt,
|
|
1793
|
+
agentPromptFileBlocks,
|
|
1794
|
+
agentPromptPastedTextBlocks,
|
|
1795
|
+
materializeAgentComposerFileMentions,
|
|
1796
|
+
agentExternalPromptFileErrorI18nKey,
|
|
1797
|
+
AGENT_RICH_TEXT_CARET_ANCHOR,
|
|
1498
1798
|
mentionItemToAttrs,
|
|
1499
1799
|
attrsToMentionItem,
|
|
1500
1800
|
exitAgentFileMentionSuggestion,
|
|
1501
1801
|
createAgentFileMentionExtension
|
|
1502
1802
|
};
|
|
1503
|
-
//# sourceMappingURL=chunk-
|
|
1803
|
+
//# sourceMappingURL=chunk-QPEO4OQS.js.map
|