@tutti-os/agent-gui 0.0.71 → 0.0.73

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 (65) hide show
  1. package/README.md +5 -0
  2. package/dist/{AgentMentionSearchController-Po0KQLcL.d.ts → AgentMentionSearchController-DD_WOred.d.ts} +1 -0
  3. package/dist/agent-conversation/index.d.ts +2 -2
  4. package/dist/agent-conversation/index.js +6 -6
  5. package/dist/agent-message-center/index.d.ts +2 -1
  6. package/dist/agent-message-center/index.js +12 -10
  7. package/dist/agent-message-center/index.js.map +1 -1
  8. package/dist/{agentGuiNodeTypes-C0oBQn-F.d.ts → agentGuiNodeTypes-aJ3AX7u2.d.ts} +39 -18
  9. package/dist/app/renderer/agentactivity.css +156 -1
  10. package/dist/{chunk-KTIHLBCN.js → chunk-2I2WRI4F.js} +248 -4
  11. package/dist/chunk-2I2WRI4F.js.map +1 -0
  12. package/dist/{chunk-DXENDZEF.js → chunk-3PKRGSMH.js} +2 -2
  13. package/dist/{chunk-QDWV5VTD.js → chunk-466AWJTS.js} +6 -31
  14. package/dist/chunk-466AWJTS.js.map +1 -0
  15. package/dist/{chunk-SG6A35BU.js → chunk-5H6NINJY.js} +2 -2
  16. package/dist/{chunk-SC3PS7AT.js → chunk-C7K3EFGI.js} +2 -2
  17. package/dist/{chunk-DGNKXT3Q.js → chunk-G6BVEY7I.js} +69 -3
  18. package/dist/chunk-G6BVEY7I.js.map +1 -0
  19. package/dist/{chunk-KS35VKHM.js → chunk-GDFQXJMG.js} +1 -1
  20. package/dist/chunk-GDFQXJMG.js.map +1 -0
  21. package/dist/{chunk-WWY6MYMU.js → chunk-IVIXKAEH.js} +19 -9
  22. package/dist/chunk-IVIXKAEH.js.map +1 -0
  23. package/dist/{chunk-IZX2YQXY.js → chunk-KWQ4N4IZ.js} +117 -8
  24. package/dist/chunk-KWQ4N4IZ.js.map +1 -0
  25. package/dist/{chunk-ISQCYEUJ.js → chunk-OBJRIQPX.js} +411 -62
  26. package/dist/chunk-OBJRIQPX.js.map +1 -0
  27. package/dist/{chunk-QJ42HQ24.js → chunk-Q6AWM3RH.js} +4 -4
  28. package/dist/{chunk-MVPSFOJZ.js → chunk-SVGIWXNK.js} +2 -2
  29. package/dist/{chunk-Y3C5EHSW.js → chunk-SZF52NMJ.js} +173 -12
  30. package/dist/chunk-SZF52NMJ.js.map +1 -0
  31. package/dist/{chunk-FTSEVC6O.js → chunk-XZF4QNT4.js} +2 -2
  32. package/dist/context-mention-palette/index.d.ts +2 -2
  33. package/dist/context-mention-palette/index.js +7 -7
  34. package/dist/i18n/index.d.ts +68 -2
  35. package/dist/i18n/index.js +2 -2
  36. package/dist/index.d.ts +122 -102
  37. package/dist/index.js +2210 -1325
  38. package/dist/index.js.map +1 -1
  39. package/dist/queued-prompt-runtime.d.ts +1 -1
  40. package/dist/workbench/contribution.d.ts +7 -1
  41. package/dist/workbench/contribution.js +4 -4
  42. package/dist/workbench/index.js +5 -7
  43. package/dist/workbench/sessionTitle.js +3 -3
  44. package/dist/workbench/state.js +1 -2
  45. package/dist/workspace-agent-generated-files.js +3 -3
  46. package/dist/{workspaceLinkActions-Bjy_XfBm.d.ts → workspaceLinkActions-DS9LWqzI.d.ts} +1 -1
  47. package/package.json +14 -14
  48. package/dist/chunk-DGNKXT3Q.js.map +0 -1
  49. package/dist/chunk-ISQCYEUJ.js.map +0 -1
  50. package/dist/chunk-IZX2YQXY.js.map +0 -1
  51. package/dist/chunk-KS35VKHM.js.map +0 -1
  52. package/dist/chunk-KTIHLBCN.js.map +0 -1
  53. package/dist/chunk-N37A62BK.js +0 -250
  54. package/dist/chunk-N37A62BK.js.map +0 -1
  55. package/dist/chunk-NROZAN34.js +0 -173
  56. package/dist/chunk-NROZAN34.js.map +0 -1
  57. package/dist/chunk-QDWV5VTD.js.map +0 -1
  58. package/dist/chunk-WWY6MYMU.js.map +0 -1
  59. package/dist/chunk-Y3C5EHSW.js.map +0 -1
  60. /package/dist/{chunk-DXENDZEF.js.map → chunk-3PKRGSMH.js.map} +0 -0
  61. /package/dist/{chunk-SG6A35BU.js.map → chunk-5H6NINJY.js.map} +0 -0
  62. /package/dist/{chunk-SC3PS7AT.js.map → chunk-C7K3EFGI.js.map} +0 -0
  63. /package/dist/{chunk-QJ42HQ24.js.map → chunk-Q6AWM3RH.js.map} +0 -0
  64. /package/dist/{chunk-MVPSFOJZ.js.map → chunk-SVGIWXNK.js.map} +0 -0
  65. /package/dist/{chunk-FTSEVC6O.js.map → chunk-XZF4QNT4.js.map} +0 -0
@@ -15,7 +15,7 @@ import {
15
15
  resolveWorkspaceFilePathCandidate,
16
16
  resolveWorkspaceLinkAction,
17
17
  useAgentTargetPresentations
18
- } from "./chunk-WWY6MYMU.js";
18
+ } from "./chunk-IVIXKAEH.js";
19
19
  import {
20
20
  classifyFailedAgentMessage,
21
21
  openAgentEnvPanel,
@@ -28,7 +28,7 @@ import {
28
28
  formatAgentMentionMarkdown,
29
29
  mentionItemToAttrs,
30
30
  parseAgentMentionMarkdown
31
- } from "./chunk-IZX2YQXY.js";
31
+ } from "./chunk-KWQ4N4IZ.js";
32
32
  import {
33
33
  fileChangeCountFromChanges,
34
34
  fileChangeEntriesFromChanges,
@@ -38,14 +38,18 @@ import {
38
38
  import {
39
39
  getOptionalAgentActivityRuntime,
40
40
  useOptionalAgentHostApi
41
- } from "./chunk-KS35VKHM.js";
41
+ } from "./chunk-GDFQXJMG.js";
42
42
  import {
43
43
  workspaceAgentProviderLabel
44
44
  } from "./chunk-4US2YHBY.js";
45
45
  import {
46
46
  getActiveUiLanguage,
47
47
  translate
48
- } from "./chunk-SC3PS7AT.js";
48
+ } from "./chunk-C7K3EFGI.js";
49
+
50
+ // agent-gui/agentGuiNode/model/agentGuiNodeTypes.ts
51
+ var AGENT_PASTED_TEXT_BLOCK_KIND = "pasted-text";
52
+ var AGENT_PASTED_TEXT_MENTION_KIND = "pasted-text";
49
53
 
50
54
  // shared/workspaceAgentTimelineCanonical.ts
51
55
  import { isLiveTurnLifecyclePhase } from "@tutti-os/agent-activity-core";
@@ -3851,6 +3855,388 @@ function hasSpecificProgressRow(rows) {
3851
3855
  });
3852
3856
  }
3853
3857
 
3858
+ // agent-gui/agentGuiNode/model/agentComposerDraft.ts
3859
+ import { createRichTextMentionMarkdown } from "@tutti-os/ui-rich-text/core";
3860
+
3861
+ // agent-gui/agentGuiNode/model/agentSkillOptions.ts
3862
+ function skillTriggerForPrefix(skill, prefix) {
3863
+ const trigger = skill.trigger.trim();
3864
+ if (!trigger) {
3865
+ return "";
3866
+ }
3867
+ if (prefix === void 0 || trigger.startsWith(prefix)) {
3868
+ return trigger;
3869
+ }
3870
+ if (trigger.startsWith("$") || trigger.startsWith("/")) {
3871
+ return `${prefix}${trigger.slice(1)}`;
3872
+ }
3873
+ return `${prefix}${trigger}`;
3874
+ }
3875
+ function labelForProviderSkill(skill, prefix) {
3876
+ return stripSkillTriggerPrefix(skillTriggerForPrefix(skill, prefix));
3877
+ }
3878
+ function promptForProviderSkills(input) {
3879
+ const nativePrefix = input.provider.trim() === "codex" ? "$" : "/";
3880
+ let prompt = input.prompt;
3881
+ for (const skill of input.skills) {
3882
+ const nativeTrigger = skillTriggerForPrefix(skill, nativePrefix);
3883
+ const aliasPrefix = nativePrefix === "$" ? "/" : "$";
3884
+ const aliasTrigger = skillTriggerForPrefix(skill, aliasPrefix);
3885
+ if (!nativeTrigger || !aliasTrigger || nativeTrigger === aliasTrigger) {
3886
+ continue;
3887
+ }
3888
+ prompt = replaceSkillTriggerToken(prompt, aliasTrigger, nativeTrigger);
3889
+ }
3890
+ return prompt;
3891
+ }
3892
+ function skillDescriptionForDisplay(description) {
3893
+ const line = description?.split(/\r?\n/).map((part) => part.trim()).find((part) => part !== "");
3894
+ return line || void 0;
3895
+ }
3896
+ function replaceSkillTriggerToken(prompt, from, to) {
3897
+ return prompt.replace(
3898
+ new RegExp(`(^|\\s)${escapeRegExp(from)}(?=$|\\s)`, "g"),
3899
+ (_match, separator) => `${separator}${to}`
3900
+ );
3901
+ }
3902
+ function escapeRegExp(value) {
3903
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3904
+ }
3905
+ function stripSkillTriggerPrefix(trigger) {
3906
+ if (trigger.startsWith("$") || trigger.startsWith("/")) {
3907
+ return trigger.slice(1);
3908
+ }
3909
+ return trigger;
3910
+ }
3911
+
3912
+ // agent-gui/agentGuiNode/model/agentComposerDraft.ts
3913
+ var PASTED_TEXT_MENTION_PREVIEW_MAX_CHARS = 10;
3914
+ function pastedTextPreview(text) {
3915
+ const collapsed = text.replace(/\s+/g, " ").trim().replace(/[[\]()]/g, "");
3916
+ if (collapsed.length <= PASTED_TEXT_MENTION_PREVIEW_MAX_CHARS) {
3917
+ return collapsed;
3918
+ }
3919
+ return `${collapsed.slice(0, PASTED_TEXT_MENTION_PREVIEW_MAX_CHARS)}\u2026`;
3920
+ }
3921
+ function pastedTextPreviewLabel(item, index) {
3922
+ return pastedTextPreview(item.text) || item.name.trim() || pastedTextDraftDisplayName(index);
3923
+ }
3924
+ function pastedTextMentionMarkdown(item, index) {
3925
+ const path = item.path?.trim();
3926
+ if (!path) {
3927
+ return "";
3928
+ }
3929
+ return createRichTextMentionMarkdown({
3930
+ providerId: AGENT_PASTED_TEXT_MENTION_KIND,
3931
+ entityId: item.id,
3932
+ label: pastedTextPreviewLabel(item, index),
3933
+ scope: {
3934
+ path,
3935
+ ...typeof item.sizeBytes === "number" && Number.isFinite(item.sizeBytes) ? { size: String(item.sizeBytes) } : {}
3936
+ }
3937
+ });
3938
+ }
3939
+ var MAX_AGENT_COMPOSER_DRAFT_IMAGES = 8;
3940
+ function emptyAgentComposerDraft() {
3941
+ return { prompt: "", images: [], files: [] };
3942
+ }
3943
+ function agentComposerDraftHasContent(draft) {
3944
+ return draft.prompt.trim() !== "" || draft.images.length > 0 || (draft.files?.length ?? 0) > 0 || (draft.largeTexts?.some(
3945
+ (item) => item.text.trim() !== "" || Boolean(item.path)
3946
+ ) ?? false);
3947
+ }
3948
+ function normalizeAgentPromptContentBlocks(content) {
3949
+ const result = [];
3950
+ for (const block of content) {
3951
+ if (block.type === "text") {
3952
+ const text = block.text?.trim() ?? "";
3953
+ if (text) {
3954
+ result.push({ type: "text", text });
3955
+ }
3956
+ continue;
3957
+ }
3958
+ if (block.type === "image") {
3959
+ const mimeType = block.mimeType?.trim();
3960
+ const data = block.data?.trim();
3961
+ const imagePath = block.path?.trim();
3962
+ if (!data && !imagePath || mimeType !== "image/png" && mimeType !== "image/jpeg" && mimeType !== "image/webp") {
3963
+ continue;
3964
+ }
3965
+ result.push({
3966
+ type: "image",
3967
+ mimeType,
3968
+ ...imagePath ? { path: imagePath } : { data },
3969
+ ...block.name?.trim() ? { name: block.name.trim() } : {}
3970
+ });
3971
+ continue;
3972
+ }
3973
+ if (block.type === "file") {
3974
+ const filePath = block.path?.trim();
3975
+ const hostPath = block.hostPath?.trim();
3976
+ if (!filePath && !hostPath) {
3977
+ continue;
3978
+ }
3979
+ result.push({
3980
+ type: "file",
3981
+ ...block.mimeType?.trim() ? { mimeType: block.mimeType.trim() } : {},
3982
+ ...filePath ? { path: filePath } : {},
3983
+ ...hostPath ? { hostPath } : {},
3984
+ ...block.name?.trim() ? { name: block.name.trim() } : {},
3985
+ ...block.uri?.trim() ? { uri: block.uri.trim() } : {},
3986
+ ...block.uploadStatus?.trim() ? { uploadStatus: block.uploadStatus.trim() } : {},
3987
+ ...block.assetId?.trim() ? { assetId: block.assetId.trim() } : {},
3988
+ ...typeof block.sizeBytes === "number" ? { sizeBytes: block.sizeBytes } : {},
3989
+ kind: block.kind === AGENT_PASTED_TEXT_BLOCK_KIND ? AGENT_PASTED_TEXT_BLOCK_KIND : "file"
3990
+ });
3991
+ continue;
3992
+ }
3993
+ if (block.type === "skill" || block.type === "mention") {
3994
+ const name = block.name?.trim();
3995
+ const path = block.path?.trim();
3996
+ if (name && path) {
3997
+ result.push({ type: block.type, name, path });
3998
+ }
3999
+ }
4000
+ }
4001
+ return result;
4002
+ }
4003
+ function agentPromptContentDisplayText(content) {
4004
+ return content.filter((block) => block.type === "text").map((block) => block.text?.trim() ?? "").filter(Boolean).join("\n");
4005
+ }
4006
+ function agentPromptContentHasImage(content) {
4007
+ return content.some((block) => block.type === "image");
4008
+ }
4009
+ function agentPromptContentImageBlocks(content) {
4010
+ return normalizeAgentPromptContentBlocks(content).filter(
4011
+ (block) => block.type === "image" && (typeof block.data === "string" || typeof block.path === "string") && typeof block.mimeType === "string"
4012
+ );
4013
+ }
4014
+ function agentPromptContentToComposerDraft(content, idPrefix) {
4015
+ const normalizedContent = normalizeAgentPromptContentBlocks(content);
4016
+ const largeTexts = agentPromptPastedTextBlocks(normalizedContent).map(
4017
+ (block) => agentPromptPastedTextBlockToDraftLargeText(block)
4018
+ );
4019
+ return {
4020
+ prompt: agentPromptContentDisplayText(normalizedContent),
4021
+ images: agentPromptContentImageBlocks(normalizedContent).slice(0, MAX_AGENT_COMPOSER_DRAFT_IMAGES).map(
4022
+ (image, index) => agentPromptImageBlockToDraftImage(image, idPrefix, index)
4023
+ ),
4024
+ files: agentPromptFileBlocks(normalizedContent).map(
4025
+ (file, index) => agentPromptFileBlockToDraftFile(file, idPrefix, index)
4026
+ ),
4027
+ ...largeTexts.length > 0 ? { largeTexts } : {}
4028
+ };
4029
+ }
4030
+ function agentPromptPastedTextBlockToDraftLargeText(block) {
4031
+ return {
4032
+ id: crypto.randomUUID(),
4033
+ name: block.name?.trim() || "pasted-text.txt",
4034
+ text: "",
4035
+ ...block.path ? { path: block.path } : {},
4036
+ ...typeof block.sizeBytes === "number" ? { sizeBytes: block.sizeBytes } : {}
4037
+ };
4038
+ }
4039
+ function agentComposerDraftToPromptContent(input) {
4040
+ const prompt = promptForProviderSkills({
4041
+ prompt: input.draft.prompt,
4042
+ provider: input.provider,
4043
+ skills: input.skills
4044
+ });
4045
+ return normalizeAgentPromptContentBlocks([
4046
+ ...textPromptContent(prompt),
4047
+ ...promptItemBlocksForProviderSkills({
4048
+ prompt,
4049
+ provider: input.provider,
4050
+ skills: input.skills
4051
+ }),
4052
+ ...input.draft.images.slice(0, MAX_AGENT_COMPOSER_DRAFT_IMAGES).filter((image) => !image.uploading && !image.uploadError).map((image) => ({
4053
+ type: "image",
4054
+ mimeType: image.mimeType,
4055
+ ...image.attachmentId ? { attachmentId: image.attachmentId } : image.path ? { path: image.path } : { data: image.data },
4056
+ name: image.name
4057
+ })),
4058
+ ...(input.draft.files ?? []).filter((file) => !file.uploading && !file.uploadError).map((file) => ({
4059
+ type: "file",
4060
+ ...file.mimeType ? { mimeType: file.mimeType } : {},
4061
+ ...file.path ? { path: file.path } : {},
4062
+ ...!file.path && file.hostPath ? { hostPath: file.hostPath } : {},
4063
+ ...file.assetId ? { assetId: file.assetId } : {},
4064
+ ...file.sizeBytes ? { sizeBytes: file.sizeBytes } : {},
4065
+ name: file.name,
4066
+ kind: "file"
4067
+ })),
4068
+ ...largeTextPromptContent(input.draft.largeTexts ?? [])
4069
+ ]);
4070
+ }
4071
+ function agentComposerDraftSubmittedText(draft) {
4072
+ return agentPromptContentDisplayText(
4073
+ normalizeAgentPromptContentBlocks([
4074
+ ...textPromptContent(draft.prompt),
4075
+ ...largeTextPromptContent(draft.largeTexts ?? [])
4076
+ ])
4077
+ );
4078
+ }
4079
+ function agentComposerDraftDisplayPrompt(draft) {
4080
+ const largeTexts = draft.largeTexts?.filter(
4081
+ (item) => Boolean(item.path) && !item.uploading && !item.uploadError
4082
+ );
4083
+ if (!largeTexts?.length) {
4084
+ return void 0;
4085
+ }
4086
+ const parts = [draft.prompt.trim()].filter(Boolean);
4087
+ parts.push(
4088
+ ...largeTexts.map((item, index) => pastedTextMentionMarkdown(item, index)).filter(Boolean)
4089
+ );
4090
+ return parts.join("\n");
4091
+ }
4092
+ function agentPromptFileBlocks(content) {
4093
+ return normalizeAgentPromptContentBlocks(content).filter(
4094
+ (block) => block.type === "file" && !isPastedTextPromptBlock(block) && (typeof block.path === "string" || typeof block.hostPath === "string")
4095
+ );
4096
+ }
4097
+ function agentPromptPastedTextBlocks(content) {
4098
+ return normalizeAgentPromptContentBlocks(content).filter(
4099
+ (block) => isPastedTextPromptBlock(block) && typeof block.path === "string"
4100
+ );
4101
+ }
4102
+ function promptItemBlocksForProviderSkills(input) {
4103
+ if (input.provider.trim() !== "codex") {
4104
+ return [];
4105
+ }
4106
+ const result = [];
4107
+ for (const skill of input.skills) {
4108
+ const path = skill.path?.trim();
4109
+ if (!path) {
4110
+ continue;
4111
+ }
4112
+ const trigger = skillTriggerForPrefix(skill, "$");
4113
+ if (!trigger || !promptHasTrigger(input.prompt, trigger)) {
4114
+ continue;
4115
+ }
4116
+ result.push({
4117
+ type: skill.kind === "connector" ? "mention" : "skill",
4118
+ name: skill.name,
4119
+ path
4120
+ });
4121
+ }
4122
+ return result;
4123
+ }
4124
+ function promptHasTrigger(prompt, trigger) {
4125
+ return new RegExp(`(^|\\s)${escapeRegExp2(trigger)}(?=$|\\s)`).test(prompt);
4126
+ }
4127
+ function escapeRegExp2(value) {
4128
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4129
+ }
4130
+ function textPromptContent(prompt) {
4131
+ const text = prompt.trim();
4132
+ return text ? [{ type: "text", text }] : [];
4133
+ }
4134
+ function pastedTextDraftDisplayName(index) {
4135
+ return `pasted-text-${index + 1}.txt`;
4136
+ }
4137
+ var PASTED_TEXT_ARCHIVE_PATH_RE = /(?:\/|[A-Za-z]:\\)[^\n]*?agent-prompt-assets[^\n]*?\.txt/;
4138
+ function firstPastedTextArchivePath(line) {
4139
+ return line.match(PASTED_TEXT_ARCHIVE_PATH_RE)?.[0].trim() ?? null;
4140
+ }
4141
+ function pastedTextReferenceMentionMarkdown(preview, path, index) {
4142
+ return createRichTextMentionMarkdown({
4143
+ providerId: AGENT_PASTED_TEXT_MENTION_KIND,
4144
+ entityId: `ref-${index}`,
4145
+ label: preview.trim() || pastedTextDraftDisplayName(index),
4146
+ scope: { path }
4147
+ });
4148
+ }
4149
+ function firstQuotedPreview(line) {
4150
+ return line.match(/"([^"]*)"/)?.[1]?.trim() ?? "";
4151
+ }
4152
+ function linkifyPastedTextReferences(text) {
4153
+ if (!PASTED_TEXT_ARCHIVE_PATH_RE.test(text)) {
4154
+ return text;
4155
+ }
4156
+ const lines = text.split("\n");
4157
+ const out = [];
4158
+ let refIndex = 0;
4159
+ for (let i = 0; i < lines.length; i++) {
4160
+ const line = lines[i] ?? "";
4161
+ const path = firstPastedTextArchivePath(line);
4162
+ if (path) {
4163
+ out.push(
4164
+ pastedTextReferenceMentionMarkdown(
4165
+ firstQuotedPreview(line),
4166
+ path,
4167
+ refIndex
4168
+ )
4169
+ );
4170
+ refIndex += 1;
4171
+ continue;
4172
+ }
4173
+ const next = lines[i + 1];
4174
+ if (next != null && firstPastedTextArchivePath(next)) {
4175
+ continue;
4176
+ }
4177
+ out.push(line);
4178
+ }
4179
+ return out.join("\n").trim();
4180
+ }
4181
+ function largeTextPromptContent(largeTexts) {
4182
+ return largeTexts.filter((item) => {
4183
+ const path = item.path?.trim();
4184
+ return Boolean(path) && !item.uploading && !item.uploadError;
4185
+ }).map((item, index) => ({
4186
+ type: "file",
4187
+ kind: AGENT_PASTED_TEXT_BLOCK_KIND,
4188
+ path: item.path,
4189
+ // The preview (first chars of the pasted body) is the chip label; carry it
4190
+ // as the block name so the send-time instruction persists it in content.
4191
+ name: pastedTextPreviewLabel(item, index),
4192
+ ...typeof item.sizeBytes === "number" ? { sizeBytes: item.sizeBytes } : {}
4193
+ }));
4194
+ }
4195
+ function isPastedTextPromptBlock(block) {
4196
+ return block.type === "file" && block.kind === AGENT_PASTED_TEXT_BLOCK_KIND;
4197
+ }
4198
+ function materializePastedTextInstructions(content, format) {
4199
+ const pastedRefs = content.filter(isPastedTextPromptBlock).map((block) => ({
4200
+ preview: sanitizePastedTextPreviewForContent(block.name),
4201
+ path: block.path?.trim() ?? ""
4202
+ })).filter((ref) => ref.path !== "");
4203
+ if (pastedRefs.length === 0) {
4204
+ return [...content];
4205
+ }
4206
+ const withoutPastedText = content.filter(
4207
+ (block) => !isPastedTextPromptBlock(block)
4208
+ );
4209
+ const instruction = [
4210
+ format.header(),
4211
+ ...pastedRefs.map((ref) => format.line(ref.preview, ref.path))
4212
+ ].join("\n");
4213
+ return [...withoutPastedText, { type: "text", text: instruction }];
4214
+ }
4215
+ function sanitizePastedTextPreviewForContent(name) {
4216
+ return (name ?? "").replace(/["\n\r]/g, " ").trim();
4217
+ }
4218
+ function agentPromptImageBlockToDraftImage(image, idPrefix, index) {
4219
+ return {
4220
+ id: `${idPrefix}:image:${index}`,
4221
+ name: image.name?.trim() || `image-${index + 1}`,
4222
+ mimeType: image.mimeType,
4223
+ ...image.data ? { data: image.data } : {},
4224
+ ...image.path ? { path: image.path } : {},
4225
+ previewUrl: typeof image.data === "string" && image.data ? `data:${image.mimeType};base64,${image.data}` : image.path ?? ""
4226
+ };
4227
+ }
4228
+ function agentPromptFileBlockToDraftFile(file, idPrefix, index) {
4229
+ return {
4230
+ id: `${idPrefix}:file:${index}`,
4231
+ name: file.name?.trim() || `file-${index + 1}`,
4232
+ mimeType: file.mimeType,
4233
+ path: file.path,
4234
+ hostPath: file.hostPath,
4235
+ assetId: file.assetId,
4236
+ sizeBytes: file.sizeBytes
4237
+ };
4238
+ }
4239
+
3854
4240
  // shared/agentConversation/rules/agentPatchMetadata.ts
3855
4241
  function normalizeAgentPatchText(text) {
3856
4242
  if (!text) {
@@ -5341,7 +5727,7 @@ function userPromptContentBlocks(message, fallbackWorkspaceId) {
5341
5727
  if (displayPrompt) {
5342
5728
  return [];
5343
5729
  }
5344
- return [{ type: "text", text: block.text }];
5730
+ return [{ type: "text", text: linkifyPastedTextReferences(block.text) }];
5345
5731
  }
5346
5732
  if (block.type !== "image") {
5347
5733
  return [];
@@ -5953,59 +6339,6 @@ import { EditorContent, useEditor } from "@tiptap/react";
5953
6339
 
5954
6340
  // agent-gui/agentGuiNode/agentRichText/agentSkillTokenExtension.ts
5955
6341
  import { mergeAttributes, Node as Node2 } from "@tiptap/core";
5956
-
5957
- // agent-gui/agentGuiNode/model/agentSkillOptions.ts
5958
- function skillTriggerForPrefix(skill, prefix) {
5959
- const trigger = skill.trigger.trim();
5960
- if (!trigger) {
5961
- return "";
5962
- }
5963
- if (prefix === void 0 || trigger.startsWith(prefix)) {
5964
- return trigger;
5965
- }
5966
- if (trigger.startsWith("$") || trigger.startsWith("/")) {
5967
- return `${prefix}${trigger.slice(1)}`;
5968
- }
5969
- return `${prefix}${trigger}`;
5970
- }
5971
- function labelForProviderSkill(skill, prefix) {
5972
- return stripSkillTriggerPrefix(skillTriggerForPrefix(skill, prefix));
5973
- }
5974
- function promptForProviderSkills(input) {
5975
- const nativePrefix = input.provider.trim() === "codex" ? "$" : "/";
5976
- let prompt = input.prompt;
5977
- for (const skill of input.skills) {
5978
- const nativeTrigger = skillTriggerForPrefix(skill, nativePrefix);
5979
- const aliasPrefix = nativePrefix === "$" ? "/" : "$";
5980
- const aliasTrigger = skillTriggerForPrefix(skill, aliasPrefix);
5981
- if (!nativeTrigger || !aliasTrigger || nativeTrigger === aliasTrigger) {
5982
- continue;
5983
- }
5984
- prompt = replaceSkillTriggerToken(prompt, aliasTrigger, nativeTrigger);
5985
- }
5986
- return prompt;
5987
- }
5988
- function skillDescriptionForDisplay(description) {
5989
- const line = description?.split(/\r?\n/).map((part) => part.trim()).find((part) => part !== "");
5990
- return line || void 0;
5991
- }
5992
- function replaceSkillTriggerToken(prompt, from, to) {
5993
- return prompt.replace(
5994
- new RegExp(`(^|\\s)${escapeRegExp(from)}(?=$|\\s)`, "g"),
5995
- (_match, separator) => `${separator}${to}`
5996
- );
5997
- }
5998
- function escapeRegExp(value) {
5999
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
6000
- }
6001
- function stripSkillTriggerPrefix(trigger) {
6002
- if (trigger.startsWith("$") || trigger.startsWith("/")) {
6003
- return trigger.slice(1);
6004
- }
6005
- return trigger;
6006
- }
6007
-
6008
- // agent-gui/agentGuiNode/agentRichText/agentSkillTokenExtension.ts
6009
6342
  function createAgentSkillTokenExtension(options = {}) {
6010
6343
  return Node2.create({
6011
6344
  name: "agentSkillToken",
@@ -15073,6 +15406,8 @@ function useProjectedAgentConversation({
15073
15406
  }
15074
15407
 
15075
15408
  export {
15409
+ AGENT_PASTED_TEXT_BLOCK_KIND,
15410
+ AGENT_PASTED_TEXT_MENTION_KIND,
15076
15411
  getAppErrorCode,
15077
15412
  toLocalShortDateTime,
15078
15413
  Button,
@@ -15080,12 +15415,26 @@ export {
15080
15415
  buildSubAgentLanesByCallId,
15081
15416
  attachSubAgentLanesToConversationVM,
15082
15417
  buildWorkspaceAgentSessionDetailViewModel,
15083
- projectAgentConversationVM,
15084
- reconcileProjectedAgentConversationVM,
15085
15418
  skillTriggerForPrefix,
15086
15419
  labelForProviderSkill,
15087
- promptForProviderSkills,
15088
15420
  skillDescriptionForDisplay,
15421
+ pastedTextPreview,
15422
+ MAX_AGENT_COMPOSER_DRAFT_IMAGES,
15423
+ emptyAgentComposerDraft,
15424
+ agentComposerDraftHasContent,
15425
+ normalizeAgentPromptContentBlocks,
15426
+ agentPromptContentDisplayText,
15427
+ agentPromptContentHasImage,
15428
+ agentPromptContentImageBlocks,
15429
+ agentPromptContentToComposerDraft,
15430
+ agentComposerDraftToPromptContent,
15431
+ agentComposerDraftSubmittedText,
15432
+ agentComposerDraftDisplayPrompt,
15433
+ textPromptContent,
15434
+ isPastedTextPromptBlock,
15435
+ materializePastedTextInstructions,
15436
+ projectAgentConversationVM,
15437
+ reconcileProjectedAgentConversationVM,
15089
15438
  AgentTranscriptSkeleton,
15090
15439
  plainTextToAgentRichTextDoc,
15091
15440
  plainTextToAgentRichTextInlineContent,
@@ -15096,4 +15445,4 @@ export {
15096
15445
  AgentConversationFlow,
15097
15446
  useProjectedAgentConversation
15098
15447
  };
15099
- //# sourceMappingURL=chunk-ISQCYEUJ.js.map
15448
+ //# sourceMappingURL=chunk-OBJRIQPX.js.map