@tutti-os/agent-gui 0.0.145 → 0.0.146

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.
@@ -12,7 +12,7 @@ import {
12
12
  resolveAgentGuiSessionProviderFlatIconUrl,
13
13
  resolveNextAgentGUIConversationRailWidthPx,
14
14
  shouldAutoCollapseAgentGUIConversationRail
15
- } from "./chunk-EGEYJLG2.js";
15
+ } from "./chunk-ZF65NZ4B.js";
16
16
  import {
17
17
  AGENT_PROVIDERS,
18
18
  AGENT_PROVIDER_LABEL,
@@ -51,6 +51,7 @@ import {
51
51
  emptyAgentComposerDraft,
52
52
  getAppErrorCode,
53
53
  isWorkspaceAgentToolCallItem,
54
+ loadCompleteAgentConversationMessages,
54
55
  materializePastedTextInstructions,
55
56
  normalizeAgentPromptContentBlocks,
56
57
  pastedTextPreview,
@@ -58,12 +59,13 @@ import {
58
59
  projectAgentConversationVM,
59
60
  resolveWorkspaceAgentNoticeCommandSemantics,
60
61
  resolveWorkspaceAgentToolName,
62
+ serializeAgentConversationForClipboard,
61
63
  snapshotAgentComposerDraft,
62
64
  textPromptContent,
63
65
  toLocalShortDateTime,
64
66
  updateAgentComposerDraft,
65
67
  useProjectedAgentConversation
66
- } from "./chunk-4DIYEFHH.js";
68
+ } from "./chunk-3CZYC2YN.js";
67
69
  import {
68
70
  agentRichTextContentToPromptText,
69
71
  createAgentRichTextInputExtensions,
@@ -97,9 +99,6 @@ import {
97
99
  agentGuiScheduler,
98
100
  buildWorkspaceAgentActivityListViewModel
99
101
  } from "./chunk-HMSN264L.js";
100
- import {
101
- isLocalImagePath
102
- } from "./chunk-JDVP33S5.js";
103
102
  import {
104
103
  AGENT_RICH_TEXT_CARET_ANCHOR,
105
104
  agentComposerFileMentionReferences,
@@ -181,7 +180,7 @@ import {
181
180
 
182
181
  // AgentGUI.tsx
183
182
  import { memo as memo15, useMemo as useMemo45 } from "react";
184
- import { TooltipProvider as TooltipProvider6 } from "@tutti-os/ui-system";
183
+ import { TooltipProvider as TooltipProvider7 } from "@tutti-os/ui-system";
185
184
 
186
185
  // agent-gui/agentGuiNode/AgentGUINode.tsx
187
186
  import { memo as memo14, useCallback as useCallback60, useEffect as useEffect40, useMemo as useMemo44, useRef as useRef51 } from "react";
@@ -13321,7 +13320,7 @@ import {
13321
13320
  useRef as useRef49,
13322
13321
  useState as useState41
13323
13322
  } from "react";
13324
- import { TooltipProvider as TooltipProvider5 } from "@tutti-os/ui-system";
13323
+ import { TooltipProvider as TooltipProvider6 } from "@tutti-os/ui-system";
13325
13324
 
13326
13325
  // shared/workspaceSettingsPanel/workspaceSettingsPanelStore.ts
13327
13326
  import { useSnapshot } from "valtio";
@@ -14255,7 +14254,7 @@ import {
14255
14254
  useRef as useRef36,
14256
14255
  useState as useState27
14257
14256
  } from "react";
14258
- import { Tooltip as Tooltip5, TooltipContent as TooltipContent5, TooltipTrigger as TooltipTrigger5 } from "@tutti-os/ui-system";
14257
+ import { Tooltip as Tooltip6, TooltipContent as TooltipContent6, TooltipTrigger as TooltipTrigger6 } from "@tutti-os/ui-system";
14259
14258
 
14260
14259
  // agent-gui/agentGuiNode/model/agentGuiProviderRailOrder.ts
14261
14260
  var AGENT_GUI_PROVIDER_RAIL_PREFERENCES_STORAGE_KEY = "agent-gui:provider-rail-preferences";
@@ -19663,10 +19662,10 @@ import { createPortal as createPortal4 } from "react-dom";
19663
19662
  import {
19664
19663
  Popover as Popover3,
19665
19664
  PopoverAnchor as PopoverAnchor2,
19666
- Tooltip as Tooltip4,
19667
- TooltipContent as TooltipContent4,
19668
- TooltipProvider as TooltipProvider4,
19669
- TooltipTrigger as TooltipTrigger4
19665
+ Tooltip as Tooltip5,
19666
+ TooltipContent as TooltipContent5,
19667
+ TooltipProvider as TooltipProvider5,
19668
+ TooltipTrigger as TooltipTrigger5
19670
19669
  } from "@tutti-os/ui-system";
19671
19670
 
19672
19671
  // agent-gui/agentGuiNode/AgentQueuedPromptPanel.tsx
@@ -23890,10 +23889,10 @@ import {
23890
23889
  SelectContent as SelectContent3,
23891
23890
  SelectItem as SelectItem3,
23892
23891
  SelectTrigger as SelectTrigger3,
23893
- Tooltip as Tooltip3,
23894
- TooltipContent as TooltipContent3,
23895
- TooltipProvider as TooltipProvider3,
23896
- TooltipTrigger as TooltipTrigger3
23892
+ Tooltip as Tooltip4,
23893
+ TooltipContent as TooltipContent4,
23894
+ TooltipProvider as TooltipProvider4,
23895
+ TooltipTrigger as TooltipTrigger4
23897
23896
  } from "@tutti-os/ui-system";
23898
23897
 
23899
23898
  // app/renderer/assets/icons/add-lined.svg
@@ -23908,7 +23907,11 @@ import {
23908
23907
  Select as Select2,
23909
23908
  SelectContent as SelectContent2,
23910
23909
  SelectItem as SelectItem2,
23911
- SelectTrigger as SelectTrigger2
23910
+ SelectTrigger as SelectTrigger2,
23911
+ Tooltip as Tooltip3,
23912
+ TooltipContent as TooltipContent3,
23913
+ TooltipProvider as TooltipProvider3,
23914
+ TooltipTrigger as TooltipTrigger3
23912
23915
  } from "@tutti-os/ui-system";
23913
23916
 
23914
23917
  // agent-gui/agentGuiNode/composer/handoffTargetPresentation.ts
@@ -23968,53 +23971,55 @@ function AgentHandoffMenu({
23968
23971
  onSelect(target);
23969
23972
  },
23970
23973
  children: [
23971
- /* @__PURE__ */ jsx36(
23972
- SelectTrigger2,
23973
- {
23974
- size: "sm",
23975
- "aria-label": labels.action,
23976
- title: labels.tooltip,
23977
- "data-testid": testId,
23978
- onClick: isolateTriggerEvents ? (event) => {
23979
- event.stopPropagation();
23980
- } : void 0,
23981
- onKeyDown: isolateTriggerEvents ? (event) => {
23982
- event.stopPropagation();
23983
- } : void 0,
23984
- onPointerDown: isolateTriggerEvents ? (event) => {
23985
- event.stopPropagation();
23986
- } : void 0,
23987
- onBlur: () => {
23988
- setIsIconPlaying(false);
23989
- },
23990
- onFocus: () => {
23991
- setIsIconPlaying(true);
23992
- },
23993
- onMouseEnter: () => {
23994
- setIsIconPlaying(true);
23995
- },
23996
- onMouseLeave: () => {
23997
- setIsIconPlaying(false);
23998
- },
23999
- className: cn(
24000
- AgentGUINode_styles_default.composerMenuTrigger,
24001
- AgentGUINode_styles_default.composerProviderSelect,
24002
- AgentGUINode_styles_default.composerHandoffTrigger,
24003
- "w-auto max-w-[180px] [&>svg:last-child]:hidden",
24004
- triggerClassName
24005
- ),
24006
- children: /* @__PURE__ */ jsxs26("span", { className: "flex min-w-0 items-center gap-1.5", children: [
24007
- /* @__PURE__ */ jsx36(
24008
- AgentComposerHandoffIcon,
24009
- {
24010
- disabled: menuDisabled,
24011
- isPlaying: isIconPlaying
24012
- }
23974
+ /* @__PURE__ */ jsx36(TooltipProvider3, { delayDuration: 120, children: /* @__PURE__ */ jsxs26(Tooltip3, { children: [
23975
+ /* @__PURE__ */ jsx36(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx36("span", { className: "inline-flex", children: /* @__PURE__ */ jsx36(
23976
+ SelectTrigger2,
23977
+ {
23978
+ size: "sm",
23979
+ "aria-label": labels.action,
23980
+ "data-testid": testId,
23981
+ onClick: isolateTriggerEvents ? (event) => {
23982
+ event.stopPropagation();
23983
+ } : void 0,
23984
+ onKeyDown: isolateTriggerEvents ? (event) => {
23985
+ event.stopPropagation();
23986
+ } : void 0,
23987
+ onPointerDown: isolateTriggerEvents ? (event) => {
23988
+ event.stopPropagation();
23989
+ } : void 0,
23990
+ onBlur: () => {
23991
+ setIsIconPlaying(false);
23992
+ },
23993
+ onFocus: () => {
23994
+ setIsIconPlaying(true);
23995
+ },
23996
+ onMouseEnter: () => {
23997
+ setIsIconPlaying(true);
23998
+ },
23999
+ onMouseLeave: () => {
24000
+ setIsIconPlaying(false);
24001
+ },
24002
+ className: cn(
24003
+ AgentGUINode_styles_default.composerMenuTrigger,
24004
+ AgentGUINode_styles_default.composerProviderSelect,
24005
+ AgentGUINode_styles_default.composerHandoffTrigger,
24006
+ "w-auto max-w-[180px] [&>svg:last-child]:hidden",
24007
+ triggerClassName
24013
24008
  ),
24014
- !iconOnly ? /* @__PURE__ */ jsx36("span", { className: "min-w-0 truncate", children: triggerLabel }) : null
24015
- ] })
24016
- }
24017
- ),
24009
+ children: /* @__PURE__ */ jsxs26("span", { className: "flex min-w-0 items-center gap-1.5", children: [
24010
+ /* @__PURE__ */ jsx36(
24011
+ AgentComposerHandoffIcon,
24012
+ {
24013
+ disabled: menuDisabled,
24014
+ isPlaying: isIconPlaying
24015
+ }
24016
+ ),
24017
+ !iconOnly ? /* @__PURE__ */ jsx36("span", { className: "min-w-0 truncate", children: triggerLabel }) : null
24018
+ ] })
24019
+ }
24020
+ ) }) }),
24021
+ /* @__PURE__ */ jsx36(TooltipContent3, { side: "top", children: labels.tooltip })
24022
+ ] }) }),
24018
24023
  /* @__PURE__ */ jsx36(
24019
24024
  SelectContent2,
24020
24025
  {
@@ -24119,8 +24124,8 @@ function ComposerFooter({
24119
24124
  return /* @__PURE__ */ jsx37(Fragment10, { children: /* @__PURE__ */ jsxs27("div", { className: AgentGUINode_styles_default.composerFooter, children: [
24120
24125
  /* @__PURE__ */ jsxs27("div", { className: composerStyles.footerGroup, children: [
24121
24126
  /* @__PURE__ */ jsxs27("div", { className: "inline-flex shrink-0 items-center gap-1", children: [
24122
- previewMode ? /* @__PURE__ */ jsx37(TooltipProvider3, { delayDuration: 120, children: /* @__PURE__ */ jsxs27(Tooltip3, { children: [
24123
- /* @__PURE__ */ jsx37(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx37(
24127
+ previewMode ? /* @__PURE__ */ jsx37(TooltipProvider4, { delayDuration: 120, children: /* @__PURE__ */ jsxs27(Tooltip4, { children: [
24128
+ /* @__PURE__ */ jsx37(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx37(
24124
24129
  "button",
24125
24130
  {
24126
24131
  type: "button",
@@ -24139,7 +24144,7 @@ function ComposerFooter({
24139
24144
  )
24140
24145
  }
24141
24146
  ) }),
24142
- /* @__PURE__ */ jsx37(TooltipContent3, { side: "top", children: labels.addContent })
24147
+ /* @__PURE__ */ jsx37(TooltipContent4, { side: "top", children: labels.addContent })
24143
24148
  ] }) }) : /* @__PURE__ */ jsx37(
24144
24149
  Select3,
24145
24150
  {
@@ -24156,30 +24161,32 @@ function ComposerFooter({
24156
24161
  void handleWorkspaceReferencePicker();
24157
24162
  }
24158
24163
  },
24159
- children: /* @__PURE__ */ jsx37(
24160
- SelectTrigger3,
24161
- {
24162
- size: "sm",
24163
- "aria-label": labels.referenceWorkspaceFiles,
24164
- title: labels.addContent,
24165
- className: cn(
24166
- AgentGUINode_styles_default.composerMenuTrigger,
24167
- AgentGUINode_styles_default.composerReferenceTrigger,
24168
- "group w-auto justify-center text-[var(--agent-gui-text-secondary)] [&>svg:last-child]:hidden"
24169
- ),
24170
- children: /* @__PURE__ */ jsx37(
24171
- AgentComposerMaskIcon,
24172
- {
24173
- iconUrl: add_lined_default,
24174
- marker: "reference-add"
24175
- }
24176
- )
24177
- }
24178
- )
24164
+ children: /* @__PURE__ */ jsx37(TooltipProvider4, { delayDuration: 120, children: /* @__PURE__ */ jsxs27(Tooltip4, { children: [
24165
+ /* @__PURE__ */ jsx37(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx37("span", { className: "inline-flex", children: /* @__PURE__ */ jsx37(
24166
+ SelectTrigger3,
24167
+ {
24168
+ size: "sm",
24169
+ "aria-label": labels.referenceWorkspaceFiles,
24170
+ className: cn(
24171
+ AgentGUINode_styles_default.composerMenuTrigger,
24172
+ AgentGUINode_styles_default.composerReferenceTrigger,
24173
+ "group w-auto justify-center text-[var(--agent-gui-text-secondary)] [&>svg:last-child]:hidden"
24174
+ ),
24175
+ children: /* @__PURE__ */ jsx37(
24176
+ AgentComposerMaskIcon,
24177
+ {
24178
+ iconUrl: add_lined_default,
24179
+ marker: "reference-add"
24180
+ }
24181
+ )
24182
+ }
24183
+ ) }) }),
24184
+ /* @__PURE__ */ jsx37(TooltipContent4, { side: "top", children: labels.addContent })
24185
+ ] }) })
24179
24186
  }
24180
24187
  ),
24181
- /* @__PURE__ */ jsx37(TooltipProvider3, { delayDuration: 120, children: /* @__PURE__ */ jsxs27(Tooltip3, { children: [
24182
- /* @__PURE__ */ jsx37(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx37(
24188
+ /* @__PURE__ */ jsx37(TooltipProvider4, { delayDuration: 120, children: /* @__PURE__ */ jsxs27(Tooltip4, { children: [
24189
+ /* @__PURE__ */ jsx37(TooltipTrigger4, { asChild: true, children: /* @__PURE__ */ jsx37(
24183
24190
  "button",
24184
24191
  {
24185
24192
  type: "button",
@@ -24211,7 +24218,7 @@ function ComposerFooter({
24211
24218
  )
24212
24219
  }
24213
24220
  ) }),
24214
- /* @__PURE__ */ jsx37(TooltipContent3, { side: "top", children: labels.mentionPalette })
24221
+ /* @__PURE__ */ jsx37(TooltipContent4, { side: "top", children: labels.mentionPalette })
24215
24222
  ] }) })
24216
24223
  ] }),
24217
24224
  showHandoffSelect ? /* @__PURE__ */ jsx37(
@@ -25012,10 +25019,10 @@ function AgentComposerView(input) {
25012
25019
  {
25013
25020
  className: AgentGUINode_styles_default.composerPromptTips,
25014
25021
  "data-testid": "agent-gui-prompt-tips",
25015
- children: !previewMode && input.isPromptTipOverflowing && promptTipNode ? /* @__PURE__ */ jsx38(TooltipProvider4, { delayDuration: 0, children: /* @__PURE__ */ jsxs28(Tooltip4, { children: [
25016
- /* @__PURE__ */ jsx38(TooltipTrigger4, { asChild: true, children: promptTipNode }),
25022
+ children: !previewMode && input.isPromptTipOverflowing && promptTipNode ? /* @__PURE__ */ jsx38(TooltipProvider5, { delayDuration: 0, children: /* @__PURE__ */ jsxs28(Tooltip5, { children: [
25023
+ /* @__PURE__ */ jsx38(TooltipTrigger5, { asChild: true, children: promptTipNode }),
25017
25024
  /* @__PURE__ */ jsx38(
25018
- TooltipContent4,
25025
+ TooltipContent5,
25019
25026
  {
25020
25027
  align: "end",
25021
25028
  className: AgentGUINode_styles_default.composerPromptTipTooltip,
@@ -28081,9 +28088,9 @@ var AgentGUIProviderRail = memo4(function AgentGUIProviderRail2({
28081
28088
  if (previewMode) {
28082
28089
  return tile;
28083
28090
  }
28084
- return /* @__PURE__ */ jsxs35(Tooltip5, { children: [
28085
- /* @__PURE__ */ jsx47(TooltipTrigger5, { asChild: true, children: tile }),
28086
- /* @__PURE__ */ jsx47(TooltipContent5, { side: "right", sideOffset: -4, children: label })
28091
+ return /* @__PURE__ */ jsxs35(Tooltip6, { children: [
28092
+ /* @__PURE__ */ jsx47(TooltipTrigger6, { asChild: true, children: tile }),
28093
+ /* @__PURE__ */ jsx47(TooltipContent6, { side: "right", sideOffset: -4, children: label })
28087
28094
  ] }, `${target.provider}:${target.targetId}:tooltip`);
28088
28095
  })
28089
28096
  ]
@@ -29308,372 +29315,6 @@ import {
29308
29315
  import { BareIconButton } from "@tutti-os/ui-system/components";
29309
29316
  import { resolveWorkspaceImageMimeType } from "@tutti-os/workspace-file-manager/services";
29310
29317
 
29311
- // agent-gui/agentGuiNode/model/agentConversationCopy.ts
29312
- var COPY_PAGE_SIZE = 200;
29313
- var MAX_COPY_PAGES = 1e3;
29314
- var AGENT_CONVERSATION_COPY_MAX_EMBEDDED_IMAGE_BYTES = 2 * 1024 * 1024;
29315
- async function loadCompleteAgentConversationMessages(input) {
29316
- const messagesById = /* @__PURE__ */ new Map();
29317
- let beforeVersion;
29318
- for (let pageIndex = 0; pageIndex < MAX_COPY_PAGES; pageIndex += 1) {
29319
- const page = await input.runtime.listSessionMessages({
29320
- agentSessionId: input.agentSessionId,
29321
- ...beforeVersion === void 0 ? {} : { beforeVersion },
29322
- cache: false,
29323
- limit: COPY_PAGE_SIZE,
29324
- order: "desc",
29325
- workspaceId: input.workspaceId
29326
- });
29327
- for (const message of page.messages) {
29328
- const key = message.messageId.trim() || `${message.version}`;
29329
- const existing = messagesById.get(key);
29330
- if (!existing || message.version >= existing.version) {
29331
- messagesById.set(key, message);
29332
- }
29333
- }
29334
- if (!page.hasMore) {
29335
- return [...messagesById.values()].sort(compareMessagesAscending);
29336
- }
29337
- const nextBeforeVersion = minimumPositiveVersion(page.messages);
29338
- if (nextBeforeVersion === null || beforeVersion !== void 0 && nextBeforeVersion >= beforeVersion) {
29339
- throw new Error("Conversation message pagination did not advance.");
29340
- }
29341
- beforeVersion = nextBeforeVersion;
29342
- }
29343
- throw new Error("Conversation message pagination exceeded the safety limit.");
29344
- }
29345
- async function serializeAgentConversationForClipboard(input) {
29346
- const context = {
29347
- labels: input.labels,
29348
- readAttachment: input.readAttachment,
29349
- readLocalImage: input.readLocalImage,
29350
- stats: { omittedImages: 0 }
29351
- };
29352
- const kept = [];
29353
- for (const message of [...input.messages].sort(compareMessagesAscending)) {
29354
- if (isSystemNoticeMessage(message)) {
29355
- continue;
29356
- }
29357
- if (isToolMessage(message)) {
29358
- const body2 = await serializeImagesOnly(message.payload ?? {}, context);
29359
- if (body2.plain) {
29360
- kept.push({ body: body2, isToolImage: true, role: "assistant" });
29361
- }
29362
- continue;
29363
- }
29364
- const role = keptMessageRole(message);
29365
- if (!role) {
29366
- continue;
29367
- }
29368
- const body = await serializeMessageContent(message.payload ?? {}, context);
29369
- if (body.plain) {
29370
- kept.push({ body, role });
29371
- }
29372
- }
29373
- const markdownBlocks = [`# ${singleLine(input.title)}`];
29374
- const hydratedBlocks = [`# ${singleLine(input.title)}`];
29375
- const pushBlock = (plain, hydrated) => {
29376
- markdownBlocks.push(plain);
29377
- hydratedBlocks.push(hydrated);
29378
- };
29379
- let index = 0;
29380
- while (index < kept.length) {
29381
- const entry = kept[index];
29382
- if (entry.role === "user") {
29383
- pushBlock(
29384
- blockquoteMarkdown(entry.body.plain),
29385
- blockquoteMarkdown(entry.body.hydrated)
29386
- );
29387
- index += 1;
29388
- continue;
29389
- }
29390
- let last = index;
29391
- while (last + 1 < kept.length && kept[last + 1].role === "assistant") {
29392
- last += 1;
29393
- }
29394
- const run = kept.slice(index, last + 1);
29395
- const textEntries = run.filter((item) => !item.isToolImage);
29396
- const interim = textEntries.slice(0, -1);
29397
- const finalText = textEntries.at(-1);
29398
- if (interim.length > 0) {
29399
- const summary = input.labels.previousMessages.replace(
29400
- "{{count}}",
29401
- `${interim.length}`
29402
- );
29403
- const detailsBlock = (side) => [
29404
- `<details><summary>${summary}</summary>`,
29405
- ...interim.map((item) => blockquoteMarkdown(item.body[side])),
29406
- "</details>"
29407
- ].join("\n\n");
29408
- pushBlock(detailsBlock("plain"), detailsBlock("hydrated"));
29409
- }
29410
- for (const item of run) {
29411
- if (item.isToolImage || item === finalText) {
29412
- pushBlock(item.body.plain, item.body.hydrated);
29413
- }
29414
- }
29415
- index = last + 1;
29416
- }
29417
- return {
29418
- hydratedMarkdown: hydratedBlocks.join("\n\n").trim(),
29419
- markdown: markdownBlocks.join("\n\n").trim(),
29420
- omittedImages: context.stats.omittedImages
29421
- };
29422
- }
29423
- function sameBody(value) {
29424
- return { hydrated: value, plain: value };
29425
- }
29426
- function joinBodies(bodies) {
29427
- return {
29428
- hydrated: bodies.map((body) => body.hydrated).filter(Boolean).join("\n\n").trim(),
29429
- plain: bodies.map((body) => body.plain).filter(Boolean).join("\n\n").trim()
29430
- };
29431
- }
29432
- function keptMessageRole(message) {
29433
- const role = normalizedRole(message.role);
29434
- if (role === "user") {
29435
- return "user";
29436
- }
29437
- if (role === "assistant" || role === "agent") {
29438
- return "assistant";
29439
- }
29440
- return null;
29441
- }
29442
- function blockquoteMarkdown(value) {
29443
- const quoted = value.replace(
29444
- /\n(.?)/g,
29445
- (_match, next) => next ? `
29446
- > ${next}` : "\n>"
29447
- );
29448
- return `> ${quoted}`;
29449
- }
29450
- async function serializeMessageContent(payload, context) {
29451
- const content = payload.content;
29452
- if (Array.isArray(content)) {
29453
- const blocks = await Promise.all(
29454
- content.map((block) => serializeContentValue(block, context))
29455
- );
29456
- const serialized = joinBodies(blocks);
29457
- if (serialized.plain) {
29458
- return serialized;
29459
- }
29460
- } else if (typeof content === "string" && content.trim()) {
29461
- return sameBody(content.trim());
29462
- }
29463
- return sameBody(
29464
- firstString2(
29465
- payload.displayPrompt,
29466
- payload.text,
29467
- payload.detail,
29468
- payload.title,
29469
- payload.summary
29470
- ) ?? ""
29471
- );
29472
- }
29473
- async function serializeContentValue(value, context) {
29474
- if (typeof value === "string") {
29475
- return sameBody(value.trim());
29476
- }
29477
- if (!isRecord3(value)) {
29478
- return sameBody("");
29479
- }
29480
- if (value.type === "content" && value.content !== void 0) {
29481
- return serializeContentValue(value.content, context);
29482
- }
29483
- const block = value;
29484
- switch (block.type) {
29485
- case "text":
29486
- return sameBody(typeof block.text === "string" ? block.text.trim() : "");
29487
- case "image":
29488
- return serializeImageBlock(block, context);
29489
- case "file":
29490
- return sameBody(serializeFileBlock(block, context.labels));
29491
- case "mention":
29492
- return sameBody(serializeMentionBlock(block, context.labels));
29493
- case "skill":
29494
- return sameBody(serializeSkillBlock(block));
29495
- default: {
29496
- const nested = await Promise.all(
29497
- [value.content, value.output, value.result].filter((candidate) => candidate !== void 0).map((candidate) => serializeContentValue(candidate, context))
29498
- );
29499
- return joinBodies(nested);
29500
- }
29501
- }
29502
- }
29503
- async function serializeImagesOnly(value, context) {
29504
- if (Array.isArray(value)) {
29505
- const nested = await Promise.all(
29506
- value.map((item) => serializeImagesOnly(item, context))
29507
- );
29508
- return joinBodies(nested);
29509
- }
29510
- if (!isRecord3(value)) {
29511
- return sameBody("");
29512
- }
29513
- if (value.type === "content" && value.content !== void 0) {
29514
- return serializeImagesOnly(value.content, context);
29515
- }
29516
- const block = value;
29517
- switch (block.type) {
29518
- case "image":
29519
- return serializeImageBlock(block, context);
29520
- case "text":
29521
- case "file":
29522
- case "mention":
29523
- case "skill":
29524
- return sameBody("");
29525
- default: {
29526
- const nested = await Promise.all(
29527
- [value.content, value.output, value.result].filter((candidate) => candidate !== void 0).map((candidate) => serializeImagesOnly(candidate, context))
29528
- );
29529
- return joinBodies(nested);
29530
- }
29531
- }
29532
- }
29533
- async function serializeImageBlock(block, context) {
29534
- const attachmentId = firstString2(block.attachmentId);
29535
- const blockMimeType = firstString2(block.mimeType);
29536
- const name = firstString2(block.name) ?? context.labels.image;
29537
- const source = firstString2(block.url, block.uri, block.path, block.hostPath);
29538
- const inlineData = typeof block.data === "string" && block.data.trim() ? block.data.trim() : null;
29539
- const isDataSource = source?.startsWith("data:") ?? false;
29540
- const plain = source && !isDataSource ? imageLinkMarkdown(name, source) : attachmentId ? imageLinkMarkdown(name, `attachment:${attachmentId}`) : `**${name}**`;
29541
- let hydrated = plain;
29542
- if (source && isDataSource) {
29543
- const payload = source.slice(source.indexOf(",") + 1);
29544
- if (base64BinaryByteSize(payload) <= AGENT_CONVERSATION_COPY_MAX_EMBEDDED_IMAGE_BYTES) {
29545
- hydrated = imageLinkMarkdown(name, source);
29546
- } else {
29547
- context.stats.omittedImages += 1;
29548
- }
29549
- } else if (source) {
29550
- const localPath = localImagePathFromSource(source);
29551
- if (localPath && context.readLocalImage) {
29552
- try {
29553
- const attachment = await context.readLocalImage({
29554
- mimeType: blockMimeType,
29555
- path: localPath
29556
- });
29557
- hydrated = embedWithinLimit(name, attachment, plain, context);
29558
- } catch {
29559
- context.stats.omittedImages += 1;
29560
- }
29561
- }
29562
- } else if (inlineData) {
29563
- const dataUri = inlineData.startsWith("data:") ? inlineData : `data:${blockMimeType ?? "image/png"};base64,${inlineData}`;
29564
- const payload = dataUri.slice(dataUri.indexOf(",") + 1);
29565
- if (base64BinaryByteSize(payload) <= AGENT_CONVERSATION_COPY_MAX_EMBEDDED_IMAGE_BYTES) {
29566
- hydrated = imageLinkMarkdown(name, dataUri);
29567
- } else {
29568
- context.stats.omittedImages += 1;
29569
- }
29570
- } else if (attachmentId && context.readAttachment) {
29571
- try {
29572
- const attachment = await context.readAttachment(attachmentId);
29573
- hydrated = embedWithinLimit(name, attachment, plain, context);
29574
- } catch {
29575
- context.stats.omittedImages += 1;
29576
- }
29577
- }
29578
- return { hydrated, plain };
29579
- }
29580
- function embedWithinLimit(name, attachment, fallback, context) {
29581
- if (base64BinaryByteSize(attachment.data) > AGENT_CONVERSATION_COPY_MAX_EMBEDDED_IMAGE_BYTES) {
29582
- context.stats.omittedImages += 1;
29583
- return fallback;
29584
- }
29585
- return imageLinkMarkdown(
29586
- name,
29587
- `data:${attachment.mimeType};base64,${attachment.data}`
29588
- );
29589
- }
29590
- function imageLinkMarkdown(name, target) {
29591
- return `![${escapeMarkdownLabel(name)}](<${escapeMarkdownTarget(target)}>)`;
29592
- }
29593
- function base64BinaryByteSize(value) {
29594
- const trimmed = value.trim();
29595
- const padding = trimmed.endsWith("==") ? 2 : trimmed.endsWith("=") ? 1 : 0;
29596
- return Math.max(0, Math.floor(trimmed.length * 3 / 4) - padding);
29597
- }
29598
- function localImagePathFromSource(source) {
29599
- const trimmed = source.trim();
29600
- if (isLocalImagePath(trimmed)) {
29601
- return trimmed;
29602
- }
29603
- if (!/^file:\/\//i.test(trimmed)) {
29604
- return null;
29605
- }
29606
- try {
29607
- const pathname = decodeURIComponent(new URL(trimmed).pathname);
29608
- return /^\/[a-zA-Z]:[\\/]/.test(pathname) ? pathname.slice(1) : pathname;
29609
- } catch {
29610
- return null;
29611
- }
29612
- }
29613
- function serializeFileBlock(block, labels) {
29614
- const source = firstString2(block.uri, block.path, block.hostPath, block.url);
29615
- const name = firstString2(block.name) ?? source ?? labels.file;
29616
- return source ? `[${escapeMarkdownLabel(name)}](<${escapeMarkdownTarget(source)}>)` : `**${labels.file}:** ${escapeMarkdownLabel(name)}`;
29617
- }
29618
- function serializeMentionBlock(block, labels) {
29619
- const text = firstString2(block.text, block.name);
29620
- if (text) {
29621
- return text.startsWith(labels.mentionPrefix) ? text : `${labels.mentionPrefix}${text}`;
29622
- }
29623
- return firstString2(block.uri, block.path) ?? "";
29624
- }
29625
- function serializeSkillBlock(block) {
29626
- const name = firstString2(block.name, block.text);
29627
- return name ? name.startsWith("/") ? name : `/${name}` : "";
29628
- }
29629
- function isSystemNoticeMessage(message) {
29630
- return firstString2(message.payload.kind) === "agent_system_notice";
29631
- }
29632
- function isToolMessage(message) {
29633
- const kind = message.kind.trim().toLowerCase();
29634
- return kind.includes("tool") || kind.includes("call") || firstString2(message.payload.callType, message.payload.toolName) !== null;
29635
- }
29636
- function compareMessagesAscending(left, right) {
29637
- const leftSequence = left.sequence ?? 0;
29638
- const rightSequence = right.sequence ?? 0;
29639
- if (leftSequence > 0 && rightSequence > 0 && leftSequence !== rightSequence) {
29640
- return leftSequence - rightSequence;
29641
- }
29642
- return left.occurredAtUnixMs - right.occurredAtUnixMs || left.version - right.version || left.messageId.localeCompare(right.messageId);
29643
- }
29644
- function minimumPositiveVersion(messages) {
29645
- let minimum = Number.POSITIVE_INFINITY;
29646
- for (const message of messages) {
29647
- if (Number.isFinite(message.version) && message.version > 0) {
29648
- minimum = Math.min(minimum, message.version);
29649
- }
29650
- }
29651
- return Number.isFinite(minimum) ? minimum : null;
29652
- }
29653
- function normalizedRole(role) {
29654
- return role.trim().toLowerCase();
29655
- }
29656
- function firstString2(...values) {
29657
- for (const value of values) {
29658
- if (typeof value === "string" && value.trim()) {
29659
- return value.trim();
29660
- }
29661
- }
29662
- return null;
29663
- }
29664
- function singleLine(value) {
29665
- return value.trim().replace(/\s+/g, " ");
29666
- }
29667
- function escapeMarkdownLabel(value) {
29668
- return value.replaceAll("\\", "\\\\").replaceAll("[", "\\[").replaceAll("]", "\\]");
29669
- }
29670
- function escapeMarkdownTarget(value) {
29671
- return value.replace(/>/g, "%3E");
29672
- }
29673
- function isRecord3(value) {
29674
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
29675
- }
29676
-
29677
29318
  // agent-gui/agentGuiNode/model/agentConversationCopyHtml.ts
29678
29319
  import { createElement } from "react";
29679
29320
  import { renderToStaticMarkup } from "react-dom/server";
@@ -30419,9 +30060,9 @@ import {
30419
30060
  DropdownMenuContent as DropdownMenuContent5,
30420
30061
  DropdownMenuItem as DropdownMenuItem4,
30421
30062
  DropdownMenuTrigger as DropdownMenuTrigger5,
30422
- Tooltip as Tooltip6,
30423
- TooltipContent as TooltipContent6,
30424
- TooltipTrigger as TooltipTrigger6
30063
+ Tooltip as Tooltip7,
30064
+ TooltipContent as TooltipContent7,
30065
+ TooltipTrigger as TooltipTrigger7
30425
30066
  } from "@tutti-os/ui-system";
30426
30067
  import {
30427
30068
  BareIconButton as BareIconButton3
@@ -30581,10 +30222,10 @@ var CreateAction = memo6(function CreateAction2({
30581
30222
  if (previewMode) {
30582
30223
  return /* @__PURE__ */ jsx57("span", { className: AgentGUINode_styles_default.conversationSectionActionTooltipWrap, children: button });
30583
30224
  }
30584
- return /* @__PURE__ */ jsxs40(Tooltip6, { children: [
30585
- /* @__PURE__ */ jsx57(TooltipTrigger6, { asChild: true, children: /* @__PURE__ */ jsx57("span", { className: AgentGUINode_styles_default.conversationSectionActionTooltipWrap, children: button }) }),
30225
+ return /* @__PURE__ */ jsxs40(Tooltip7, { children: [
30226
+ /* @__PURE__ */ jsx57(TooltipTrigger7, { asChild: true, children: /* @__PURE__ */ jsx57("span", { className: AgentGUINode_styles_default.conversationSectionActionTooltipWrap, children: button }) }),
30586
30227
  /* @__PURE__ */ jsx57(
30587
- TooltipContent6,
30228
+ TooltipContent7,
30588
30229
  {
30589
30230
  side: "top",
30590
30231
  sideOffset: 6,
@@ -30620,10 +30261,10 @@ function ProjectMenuTrigger({
30620
30261
  if (previewMode) {
30621
30262
  return /* @__PURE__ */ jsx57(DropdownMenuTrigger5, { asChild: true, children: /* @__PURE__ */ jsx57("span", { className: AgentGUINode_styles_default.conversationSectionActionTooltipWrap, children: /* @__PURE__ */ jsx57(ProjectMenuButton, { accessibleName }) }) });
30622
30263
  }
30623
- return /* @__PURE__ */ jsxs40(Tooltip6, { children: [
30624
- /* @__PURE__ */ jsx57(TooltipTrigger6, { asChild: true, children: /* @__PURE__ */ jsx57("span", { className: AgentGUINode_styles_default.conversationSectionActionTooltipWrap, children: /* @__PURE__ */ jsx57(DropdownMenuTrigger5, { asChild: true, children: /* @__PURE__ */ jsx57(ProjectMenuButton, { accessibleName }) }) }) }),
30264
+ return /* @__PURE__ */ jsxs40(Tooltip7, { children: [
30265
+ /* @__PURE__ */ jsx57(TooltipTrigger7, { asChild: true, children: /* @__PURE__ */ jsx57("span", { className: AgentGUINode_styles_default.conversationSectionActionTooltipWrap, children: /* @__PURE__ */ jsx57(DropdownMenuTrigger5, { asChild: true, children: /* @__PURE__ */ jsx57(ProjectMenuButton, { accessibleName }) }) }) }),
30625
30266
  /* @__PURE__ */ jsx57(
30626
- TooltipContent6,
30267
+ TooltipContent7,
30627
30268
  {
30628
30269
  side: "right",
30629
30270
  sideOffset: 6,
@@ -30736,8 +30377,8 @@ function ConversationMenuTrigger({
30736
30377
  }
30737
30378
  ) }) });
30738
30379
  }
30739
- return /* @__PURE__ */ jsxs40(Tooltip6, { children: [
30740
- /* @__PURE__ */ jsx57(TooltipTrigger6, { asChild: true, children: /* @__PURE__ */ jsx57("span", { className: AgentGUINode_styles_default.conversationSectionActionTooltipWrap, children: /* @__PURE__ */ jsx57(DropdownMenuTrigger5, { asChild: true, children: /* @__PURE__ */ jsx57(
30380
+ return /* @__PURE__ */ jsxs40(Tooltip7, { children: [
30381
+ /* @__PURE__ */ jsx57(TooltipTrigger7, { asChild: true, children: /* @__PURE__ */ jsx57("span", { className: AgentGUINode_styles_default.conversationSectionActionTooltipWrap, children: /* @__PURE__ */ jsx57(DropdownMenuTrigger5, { asChild: true, children: /* @__PURE__ */ jsx57(
30741
30382
  BareIconButton3,
30742
30383
  {
30743
30384
  className: AgentGUINode_styles_default.conversationSectionMoreButton,
@@ -30747,7 +30388,7 @@ function ConversationMenuTrigger({
30747
30388
  }
30748
30389
  ) }) }) }),
30749
30390
  /* @__PURE__ */ jsx57(
30750
- TooltipContent6,
30391
+ TooltipContent7,
30751
30392
  {
30752
30393
  side: "right",
30753
30394
  sideOffset: 6,
@@ -36638,7 +36279,7 @@ function AgentGUINodeView({
36638
36279
  ]
36639
36280
  }
36640
36281
  ) });
36641
- return previewMode ? content : /* @__PURE__ */ jsx72(TooltipProvider5, { children: content });
36282
+ return previewMode ? content : /* @__PURE__ */ jsx72(TooltipProvider6, { children: content });
36642
36283
  }
36643
36284
 
36644
36285
  // agent-gui/workspaceDesktop/view/desktopDockAgentProbeTooltipModel.ts
@@ -38718,7 +38359,7 @@ var AgentGUI = memo15(function AgentGUI2({
38718
38359
  children: /* @__PURE__ */ jsx76(AgentGUINode, { ...nodeProps })
38719
38360
  }
38720
38361
  ) });
38721
- return props.frame.previewMode ? content : /* @__PURE__ */ jsx76(TooltipProvider6, { delayDuration: 120, skipDelayDuration: 0, children: content });
38362
+ return props.frame.previewMode ? content : /* @__PURE__ */ jsx76(TooltipProvider7, { delayDuration: 120, skipDelayDuration: 0, children: content });
38722
38363
  });
38723
38364
 
38724
38365
  export {
@@ -38732,4 +38373,4 @@ export {
38732
38373
  AgentHandoffMenu,
38733
38374
  AgentGUI
38734
38375
  };
38735
- //# sourceMappingURL=chunk-57W6N7EW.js.map
38376
+ //# sourceMappingURL=chunk-4WSWPMV7.js.map