@tutti-os/agent-gui 0.0.94 → 0.0.96
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 +86 -38
- package/dist/AgentGUI-DWdvUV4x.d.ts +1038 -0
- package/dist/agent-conversation/index.d.ts +6 -7
- package/dist/agent-conversation/index.js +15 -10
- package/dist/agent-conversation/index.js.map +1 -1
- package/dist/agent-env/index.d.ts +10 -36
- package/dist/agent-env/index.js +2 -57
- package/dist/agent-env/index.js.map +1 -1
- package/dist/agent-gui.d.ts +21 -0
- package/dist/agent-gui.js +39 -0
- package/dist/agent-message-center/index.d.ts +156 -124
- package/dist/agent-message-center/index.js +1656 -1463
- package/dist/agent-message-center/index.js.map +1 -1
- package/dist/{agentConversationVM-Cl4G0Lln.d.ts → agentConversationVM-C335TR6S.d.ts} +112 -7
- package/dist/agentFileMentionContracts-58IjMU-u.d.ts +108 -0
- package/dist/{agentGuiNodeTypes-CAioPXK9.d.ts → agentGuiNodeTypes-B9X4aWfv.d.ts} +123 -163
- package/dist/agentPlanPromptDispatch-C7cCMjve.d.ts +37 -0
- package/dist/agents.d.ts +13 -0
- package/dist/agents.js +13 -0
- package/dist/app/renderer/agentactivity.css +276 -83
- package/dist/app/renderer/assets/icons/agent-vinyls/tutti-vinyl.png +0 -0
- package/dist/app/renderer/assets/icons/open-link-lined.svg +4 -0
- package/dist/{chunk-7BUYFVRI.js → chunk-2HJEOO7W.js} +2931 -2946
- package/dist/chunk-2HJEOO7W.js.map +1 -0
- package/dist/{chunk-E5FOXRUM.js → chunk-3XXBDYAI.js} +293 -258
- package/dist/chunk-3XXBDYAI.js.map +1 -0
- package/dist/{chunk-ZUW4B5AT.js → chunk-3Y3F7CS5.js} +21 -32
- package/dist/chunk-3Y3F7CS5.js.map +1 -0
- package/dist/{chunk-SCLLP5DO.js → chunk-4PQPJ5OY.js} +50 -155
- package/dist/chunk-4PQPJ5OY.js.map +1 -0
- package/dist/chunk-4YG7YK7S.js +23 -0
- package/dist/chunk-4YG7YK7S.js.map +1 -0
- package/dist/chunk-5X7YDOC6.js +42 -0
- package/dist/chunk-5X7YDOC6.js.map +1 -0
- package/dist/{chunk-R2EWECUP.js → chunk-7BXWPI4F.js} +17 -2
- package/dist/{chunk-R2EWECUP.js.map → chunk-7BXWPI4F.js.map} +1 -1
- package/dist/chunk-AGT7MUTV.js +491 -0
- package/dist/chunk-AGT7MUTV.js.map +1 -0
- package/dist/chunk-C35SNDVZ.js +96 -0
- package/dist/chunk-C35SNDVZ.js.map +1 -0
- package/dist/{chunk-5FE7M42A.js → chunk-E4HQUTM3.js} +2 -2
- package/dist/chunk-FGLQZ6I4.js +9 -0
- package/dist/chunk-FGLQZ6I4.js.map +1 -0
- package/dist/chunk-H5F3QSCF.js +25 -0
- package/dist/chunk-H5F3QSCF.js.map +1 -0
- package/dist/chunk-H6IQ63DQ.js +14 -0
- package/dist/chunk-H6IQ63DQ.js.map +1 -0
- package/dist/{chunk-45FF4DQU.js → chunk-IYEXLOUE.js} +22 -27
- package/dist/chunk-IYEXLOUE.js.map +1 -0
- package/dist/{chunk-P72YLKC6.js → chunk-JKIZA7EJ.js} +3573 -3755
- package/dist/chunk-JKIZA7EJ.js.map +1 -0
- package/dist/chunk-KJQERFKX.js +259 -0
- package/dist/chunk-KJQERFKX.js.map +1 -0
- package/dist/{chunk-XW4CVBUH.js → chunk-L3GMMGRS.js} +25 -16
- package/dist/chunk-L3GMMGRS.js.map +1 -0
- package/dist/chunk-MASXZENX.js +231 -0
- package/dist/chunk-MASXZENX.js.map +1 -0
- package/dist/{chunk-BXVPOGYK.js → chunk-O3Q5SIJH.js} +505 -504
- package/dist/chunk-O3Q5SIJH.js.map +1 -0
- package/dist/{chunk-554VG7ZW.js → chunk-QVBF5BN5.js} +2 -2
- package/dist/{chunk-AWAIUYG4.js → chunk-RE4AXS27.js} +532 -565
- package/dist/chunk-RE4AXS27.js.map +1 -0
- package/dist/{chunk-7LMJXF4R.js → chunk-TVIGLNNI.js} +20 -16
- package/dist/chunk-TVIGLNNI.js.map +1 -0
- package/dist/{chunk-XDV4ZRVK.js → chunk-UGVI47X6.js} +98 -37
- package/dist/chunk-UGVI47X6.js.map +1 -0
- package/dist/{chunk-GAPTLVII.js → chunk-UHBCM6RO.js} +1 -1
- package/dist/chunk-UHBCM6RO.js.map +1 -0
- package/dist/{chunk-UBDPV34P.js → chunk-W6WAGPMD.js} +1385 -1305
- package/dist/chunk-W6WAGPMD.js.map +1 -0
- package/dist/chunk-WKSFPJHZ.js +33054 -0
- package/dist/chunk-WKSFPJHZ.js.map +1 -0
- package/dist/{chunk-IGY4ASUF.js → chunk-WMNS4MAQ.js} +1288 -1696
- package/dist/chunk-WMNS4MAQ.js.map +1 -0
- package/dist/{chunk-MATIJPGF.js → chunk-XPFHJMZP.js} +541 -401
- package/dist/chunk-XPFHJMZP.js.map +1 -0
- package/dist/chunk-YMXYBG7U.js +12 -0
- package/dist/chunk-YMXYBG7U.js.map +1 -0
- package/dist/context-mention-palette/index.d.ts +3 -2
- package/dist/context-mention-palette/index.js +17 -12
- package/dist/custom-mention.d.ts +42 -0
- package/dist/custom-mention.js +17 -0
- package/dist/custom-mention.js.map +1 -0
- package/dist/dock-icons.d.ts +4 -0
- package/dist/dock-icons.js +11 -0
- package/dist/dock-icons.js.map +1 -0
- package/dist/i18n/index.d.ts +880 -841
- package/dist/i18n/index.js +2 -2
- package/dist/index.d.ts +56 -1063
- package/dist/index.js +78 -35532
- package/dist/index.js.map +1 -1
- package/dist/mention-search.d.ts +226 -0
- package/dist/mention-search.js +29 -0
- package/dist/mention-search.js.map +1 -0
- package/dist/open-link-lined-JWEKUKME.svg +4 -0
- package/dist/pastedTextKinds-D-XuInaS.d.ts +4 -0
- package/dist/provider-icons.d.ts +6 -0
- package/dist/provider-icons.js +12 -0
- package/dist/provider-icons.js.map +1 -0
- package/dist/provider-identity.d.ts +9 -0
- package/dist/provider-identity.js +21 -0
- package/dist/provider-identity.js.map +1 -0
- package/dist/runtime-BBNdWgDU.d.ts +10 -0
- package/dist/startup-shell.d.ts +8 -0
- package/dist/startup-shell.js +184 -0
- package/dist/startup-shell.js.map +1 -0
- package/dist/{types-PLFZ8SBX.d.ts → types-CnT8rNUI.d.ts} +43 -87
- package/dist/workbench/contribution.d.ts +34 -41
- package/dist/workbench/contribution.js +10 -6
- package/dist/workbench/index.d.ts +5 -4
- package/dist/workbench/index.js +27 -25
- package/dist/workbench/launch.d.ts +4 -7
- package/dist/workbench/launch.js +4 -3
- package/dist/workbench/providerCatalog.d.ts +2 -2
- package/dist/workbench/providerCatalog.js +2 -1
- package/dist/workbench/sessionTitle.d.ts +11 -14
- package/dist/workbench/sessionTitle.js +6 -7
- package/dist/workbench/state.d.ts +1 -1
- package/dist/workbench/state.js +3 -2
- package/dist/workbench/types.d.ts +2 -4
- package/dist/workbench/types.js +1 -1
- package/dist/workspace-agent-generated-files.d.ts +20 -2
- package/dist/workspace-agent-generated-files.js +6 -5
- package/dist/workspaceAgentActivityListTypes-C7gPWYiA.d.ts +71 -0
- package/package.json +70 -26
- package/dist/AgentMentionSearchController-DD_WOred.d.ts +0 -241
- package/dist/AgentMessageMarkdown-DeYPURtF.d.ts +0 -7
- package/dist/chunk-45FF4DQU.js.map +0 -1
- package/dist/chunk-4HP6V2YA.js +0 -207
- package/dist/chunk-4HP6V2YA.js.map +0 -1
- package/dist/chunk-7BUYFVRI.js.map +0 -1
- package/dist/chunk-7LMJXF4R.js.map +0 -1
- package/dist/chunk-AWAIUYG4.js.map +0 -1
- package/dist/chunk-BXVPOGYK.js.map +0 -1
- package/dist/chunk-E5FOXRUM.js.map +0 -1
- package/dist/chunk-GAPTLVII.js.map +0 -1
- package/dist/chunk-IBIMGLCD.js +0 -66
- package/dist/chunk-IBIMGLCD.js.map +0 -1
- package/dist/chunk-IGY4ASUF.js.map +0 -1
- package/dist/chunk-LR4FA5X6.js +0 -368
- package/dist/chunk-LR4FA5X6.js.map +0 -1
- package/dist/chunk-MATIJPGF.js.map +0 -1
- package/dist/chunk-MKHDRIGN.js +0 -71
- package/dist/chunk-MKHDRIGN.js.map +0 -1
- package/dist/chunk-P72YLKC6.js.map +0 -1
- package/dist/chunk-SCLLP5DO.js.map +0 -1
- package/dist/chunk-UBDPV34P.js.map +0 -1
- package/dist/chunk-VAKFNNKT.js +0 -410
- package/dist/chunk-VAKFNNKT.js.map +0 -1
- package/dist/chunk-XDV4ZRVK.js.map +0 -1
- package/dist/chunk-XW4CVBUH.js.map +0 -1
- package/dist/chunk-ZUW4B5AT.js.map +0 -1
- package/dist/plan-decision-ops.d.ts +0 -70
- package/dist/plan-decision-ops.js +0 -19
- package/dist/queued-prompt-runtime.d.ts +0 -115
- package/dist/queued-prompt-runtime.js +0 -9
- package/dist/uiSettings-BQS9r2eo.d.ts +0 -6
- package/dist/workspaceAgentActivityListViewModel-BzV-cf0D.d.ts +0 -340
- package/dist/workspaceLinkActions-DS9LWqzI.d.ts +0 -74
- /package/dist/{plan-decision-ops.js.map → agent-gui.js.map} +0 -0
- /package/dist/{queued-prompt-runtime.js.map → agents.js.map} +0 -0
- /package/dist/{chunk-5FE7M42A.js.map → chunk-E4HQUTM3.js.map} +0 -0
- /package/dist/{chunk-554VG7ZW.js.map → chunk-QVBF5BN5.js.map} +0 -0
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
agentGuiWorkbenchDockIdentityFromIdentifier,
|
|
3
|
+
agentGuiWorkbenchProviderFromIdentifier,
|
|
4
|
+
agentGuiWorkbenchTypeId,
|
|
5
|
+
agentGuiWorkbenchUnifiedDockEntryId,
|
|
6
|
+
createAgentGuiWorkbenchLaunchDescriptor
|
|
7
|
+
} from "./chunk-TVIGLNNI.js";
|
|
1
8
|
import {
|
|
2
9
|
agentGuiWorkbenchProviderFromInstanceId,
|
|
3
10
|
agentGuiWorkbenchProviderFromInstanceIdOrNull,
|
|
@@ -5,38 +12,31 @@ import {
|
|
|
5
12
|
migrateLegacyAgentGuiWorkbenchState,
|
|
6
13
|
normalizeAgentGuiWorkbenchNodeState,
|
|
7
14
|
normalizeAgentGuiWorkbenchState
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import {
|
|
10
|
-
agentGuiWorkbenchDockIdentityFromIdentifier,
|
|
11
|
-
agentGuiWorkbenchProviderFromIdentifier,
|
|
12
|
-
agentGuiWorkbenchTypeId,
|
|
13
|
-
agentGuiWorkbenchUnifiedDockEntryId,
|
|
14
|
-
createAgentGuiWorkbenchLaunchDescriptor
|
|
15
|
-
} from "./chunk-7LMJXF4R.js";
|
|
15
|
+
} from "./chunk-IYEXLOUE.js";
|
|
16
16
|
import {
|
|
17
17
|
agentGuiWorkbenchDefaultDockProviders,
|
|
18
18
|
isAgentGuiWorkbenchProvider,
|
|
19
19
|
resolveAgentGuiWorkbenchProviderLabel
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-L3GMMGRS.js";
|
|
21
|
+
import {
|
|
22
|
+
normalizeAgentGUIAgents,
|
|
23
|
+
projectAgentGUIAgentsToInternalTargets
|
|
24
|
+
} from "./chunk-C35SNDVZ.js";
|
|
25
|
+
import {
|
|
26
|
+
agentGuiDockIconUrls
|
|
27
|
+
} from "./chunk-4YG7YK7S.js";
|
|
28
|
+
import {
|
|
29
|
+
normalizeManagedAgentProvider
|
|
30
|
+
} from "./chunk-H6IQ63DQ.js";
|
|
21
31
|
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
manageAgentClaudeCodeUrl,
|
|
28
|
-
manageAgentTuttiUrl,
|
|
29
|
-
normalizeManagedAgentProvider,
|
|
30
|
-
openclawRoundedUrl,
|
|
31
|
-
opencodeRoundedUrl,
|
|
32
|
-
tuttiAgentRoundedUrl
|
|
33
|
-
} from "./chunk-XDV4ZRVK.js";
|
|
32
|
+
resolveAgentGUIProviderCatalogIdentity
|
|
33
|
+
} from "./chunk-KJQERFKX.js";
|
|
34
|
+
import {
|
|
35
|
+
resolveProviderIconAsset
|
|
36
|
+
} from "./chunk-UGVI47X6.js";
|
|
34
37
|
|
|
35
38
|
// workbench/contribution.ts
|
|
36
|
-
import { createElement as
|
|
37
|
-
import {
|
|
38
|
-
getWorkbenchLayoutFrame
|
|
39
|
-
} from "@tutti-os/workbench-surface";
|
|
39
|
+
import { createElement as createElement3 } from "react";
|
|
40
40
|
|
|
41
41
|
// agent-gui/agentGuiNode/model/agentGuiRailLayout.ts
|
|
42
42
|
function clamp(value, min, max) {
|
|
@@ -50,9 +50,10 @@ var AGENT_GUI_RAIL_RESIZE_HANDLE_WIDTH_PX = 10;
|
|
|
50
50
|
var AGENT_GUI_COLLAPSED_MIN_WIDTH_PX = 460;
|
|
51
51
|
var AGENT_GUI_EXPANDED_MIN_WIDTH_PX = AGENT_GUI_CONVERSATION_RAIL_MIN_WIDTH_PX + AGENT_GUI_DETAIL_MIN_WIDTH_PX + AGENT_GUI_RAIL_RESIZE_HANDLE_WIDTH_PX;
|
|
52
52
|
var AGENT_GUI_AUTO_COLLAPSE_WIDTH_PX = 610;
|
|
53
|
+
var AGENT_GUI_STANDALONE_AUTO_COLLAPSE_WIDTH_PX = 720;
|
|
53
54
|
var AGENT_GUI_EXPANDED_TARGET_WIDTH_PX = 800;
|
|
54
|
-
function shouldAutoCollapseAgentGUIConversationRail(containerWidthPx) {
|
|
55
|
-
return Number.isFinite(containerWidthPx) && containerWidthPx > 0 && containerWidthPx <=
|
|
55
|
+
function shouldAutoCollapseAgentGUIConversationRail(containerWidthPx, autoCollapseWidthPx = AGENT_GUI_AUTO_COLLAPSE_WIDTH_PX) {
|
|
56
|
+
return Number.isFinite(containerWidthPx) && containerWidthPx > 0 && containerWidthPx <= autoCollapseWidthPx;
|
|
56
57
|
}
|
|
57
58
|
function resolveAgentGUIConversationRailMaxWidthPx(containerWidthPx) {
|
|
58
59
|
const safeContainerWidth = Number.isFinite(containerWidthPx) && containerWidthPx > 0 ? containerWidthPx : AGENT_GUI_CONVERSATION_RAIL_DEFAULT_WIDTH_PX + AGENT_GUI_DETAIL_MIN_WIDTH_PX + AGENT_GUI_RAIL_RESIZE_HANDLE_WIDTH_PX;
|
|
@@ -118,66 +119,18 @@ function resolveAgentGUIExpandedWindowFrame(input) {
|
|
|
118
119
|
};
|
|
119
120
|
}
|
|
120
121
|
|
|
121
|
-
// dockIcons.ts
|
|
122
|
-
var agentGuiDockIconUrl = codexRoundedUrl;
|
|
123
|
-
var agentGuiDockIconUrls = {
|
|
124
|
-
"claude-code": manageAgentClaudeCodeUrl,
|
|
125
|
-
codex: codexRoundedUrl,
|
|
126
|
-
cursor: cursorRoundedUrl,
|
|
127
|
-
hermes: hermesRoundedUrl,
|
|
128
|
-
nexight: manageAgentTuttiUrl,
|
|
129
|
-
openclaw: openclawRoundedUrl,
|
|
130
|
-
opencode: opencodeRoundedUrl,
|
|
131
|
-
"tutti-agent": tuttiAgentRoundedUrl
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
// app/renderer/assets/icons/agents/claudecode-flat-filled.svg
|
|
135
|
-
var claudecode_flat_filled_default = "./claudecode-flat-filled-NHO4JCVK.svg";
|
|
136
|
-
|
|
137
|
-
// app/renderer/assets/icons/agents/codex-flat-filled.svg
|
|
138
|
-
var codex_flat_filled_default = "./codex-flat-filled-WYHCF5VR.svg";
|
|
139
|
-
|
|
140
|
-
// app/renderer/assets/icons/agents/cursor-flat-filled.svg
|
|
141
|
-
var cursor_flat_filled_default = "./cursor-flat-filled-CL7N3BTZ.svg";
|
|
142
|
-
|
|
143
|
-
// app/renderer/assets/icons/agents/opencode-flat-filled.svg
|
|
144
|
-
var opencode_flat_filled_default = "./opencode-flat-filled-CYAJPX45.svg";
|
|
145
|
-
|
|
146
|
-
// app/renderer/assets/icons/agents/tutti-flat-filled.svg
|
|
147
|
-
var tutti_flat_filled_default = "./tutti-flat-filled-K32QBTZE.svg";
|
|
148
|
-
|
|
149
122
|
// agentGuiSessionProviderIconUrls.ts
|
|
150
123
|
function resolveAgentGuiSessionProviderIconUrl(provider) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
return codexRoundedUrl;
|
|
156
|
-
case "cursor":
|
|
157
|
-
return cursorColorfulUrl;
|
|
158
|
-
case "opencode":
|
|
159
|
-
return opencodeRoundedUrl;
|
|
160
|
-
case "tutti":
|
|
161
|
-
return manageAgentTuttiUrl;
|
|
162
|
-
default:
|
|
163
|
-
return null;
|
|
164
|
-
}
|
|
124
|
+
const identity = resolveAgentGUIProviderCatalogIdentity(
|
|
125
|
+
normalizeManagedAgentProvider(provider)
|
|
126
|
+
);
|
|
127
|
+
return resolveProviderIconAsset(identity?.iconKey, "sessionColorful");
|
|
165
128
|
}
|
|
166
129
|
function resolveAgentGuiSessionProviderFlatIconUrl(provider) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
return codex_flat_filled_default;
|
|
172
|
-
case "cursor":
|
|
173
|
-
return cursor_flat_filled_default;
|
|
174
|
-
case "opencode":
|
|
175
|
-
return opencode_flat_filled_default;
|
|
176
|
-
case "tutti":
|
|
177
|
-
return tutti_flat_filled_default;
|
|
178
|
-
default:
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
130
|
+
const identity = resolveAgentGUIProviderCatalogIdentity(
|
|
131
|
+
normalizeManagedAgentProvider(provider)
|
|
132
|
+
);
|
|
133
|
+
return resolveProviderIconAsset(identity?.iconKey, "sessionFlat");
|
|
181
134
|
}
|
|
182
135
|
|
|
183
136
|
// workbench/bodyRenderErrorRegistry.ts
|
|
@@ -227,7 +180,6 @@ import {
|
|
|
227
180
|
createElement,
|
|
228
181
|
useState
|
|
229
182
|
} from "react";
|
|
230
|
-
import { ExternalLink } from "lucide-react";
|
|
231
183
|
import {
|
|
232
184
|
Button,
|
|
233
185
|
PanelIcon,
|
|
@@ -238,6 +190,11 @@ import {
|
|
|
238
190
|
cn
|
|
239
191
|
} from "@tutti-os/ui-system";
|
|
240
192
|
import { CreateChatIcon } from "@tutti-os/ui-system/icons";
|
|
193
|
+
|
|
194
|
+
// app/renderer/assets/icons/open-link-lined.svg
|
|
195
|
+
var open_link_lined_default = "./open-link-lined-JWEKUKME.svg";
|
|
196
|
+
|
|
197
|
+
// workbench/header.ts
|
|
241
198
|
var headerChromeIconButtonClassName = "agent-gui-workbench-header__icon-button";
|
|
242
199
|
var conversationRailToggleButtonClassName = "agent-gui-workbench-header__icon-button agent-gui-workbench-header__rail-toggle";
|
|
243
200
|
var detachedWindowButtonClassName = "agent-gui-workbench-header__icon-button agent-gui-workbench-header__detached-window";
|
|
@@ -245,6 +202,7 @@ var headerChromeIconClassName = "agent-gui-workbench-header__icon";
|
|
|
245
202
|
function AgentGuiWorkbenchHeader({
|
|
246
203
|
className,
|
|
247
204
|
copy,
|
|
205
|
+
agentTitle,
|
|
248
206
|
defaultActions: _defaultActions,
|
|
249
207
|
displayMode,
|
|
250
208
|
isConversationRailAutoCollapsed,
|
|
@@ -261,6 +219,7 @@ function AgentGuiWorkbenchHeader({
|
|
|
261
219
|
onOpenDetachedWindow,
|
|
262
220
|
onToggleConversationRail,
|
|
263
221
|
showAppTitle = true,
|
|
222
|
+
showConversationRailToggle = true,
|
|
264
223
|
showWindowControls = true,
|
|
265
224
|
title: _title,
|
|
266
225
|
windowActions,
|
|
@@ -270,8 +229,12 @@ function AgentGuiWorkbenchHeader({
|
|
|
270
229
|
const toggleLabel = isConversationRailCollapsed ? copy.expandConversationRail : copy.collapseConversationRail;
|
|
271
230
|
const appTitle = _title?.trim() || copy.fallbackAgentLabel;
|
|
272
231
|
const sessionTitle = hasBodyRenderError ? "" : conversationTitle?.trim() || "";
|
|
232
|
+
const collapsedTitle = agentTitle?.trim() || sessionTitle;
|
|
273
233
|
const sessionIconUrl = conversationIconUrl?.trim() || "";
|
|
274
234
|
const sessionIconFallbackUrl = conversationIconFallbackUrl?.trim() || "";
|
|
235
|
+
const hasExpandedIdentity = Boolean(
|
|
236
|
+
collapsedTitle || sessionIconUrl || sessionIconFallbackUrl
|
|
237
|
+
);
|
|
275
238
|
const safeDisplayMode = displayMode ?? "floating";
|
|
276
239
|
const safeWindowActions = windowActions ?? {
|
|
277
240
|
close: () => void 0,
|
|
@@ -354,49 +317,17 @@ function AgentGuiWorkbenchHeader({
|
|
|
354
317
|
label: copy.openDetachedWindow ?? "Open in detached window",
|
|
355
318
|
onOpenDetachedWindow
|
|
356
319
|
}) : null,
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
variant: "ghost",
|
|
369
|
-
onClick: (event) => {
|
|
370
|
-
event.stopPropagation();
|
|
371
|
-
onToggleConversationRail(!isConversationRailCollapsed);
|
|
372
|
-
},
|
|
373
|
-
onDoubleClick: (event) => event.stopPropagation(),
|
|
374
|
-
onPointerDown: (event) => event.stopPropagation()
|
|
375
|
-
},
|
|
376
|
-
createElement(PanelIcon, { className: headerChromeIconClassName })
|
|
377
|
-
),
|
|
378
|
-
isConversationRailCollapsed && onCreateConversation ? createElement(
|
|
379
|
-
Button,
|
|
380
|
-
{
|
|
381
|
-
"aria-label": copy.newConversation,
|
|
382
|
-
className: headerChromeIconButtonClassName,
|
|
383
|
-
size: "icon-sm",
|
|
384
|
-
title: copy.newConversation,
|
|
385
|
-
type: "button",
|
|
386
|
-
variant: "ghost",
|
|
387
|
-
onClick: (event) => {
|
|
388
|
-
event.stopPropagation();
|
|
389
|
-
onCreateConversation();
|
|
390
|
-
},
|
|
391
|
-
onDoubleClick: (event) => event.stopPropagation(),
|
|
392
|
-
onPointerDown: (event) => event.stopPropagation()
|
|
393
|
-
},
|
|
394
|
-
createElement(CreateChatIcon, {
|
|
395
|
-
"aria-hidden": true,
|
|
396
|
-
className: headerChromeIconClassName
|
|
397
|
-
})
|
|
398
|
-
) : null,
|
|
399
|
-
isConversationRailCollapsed && sessionTitle ? createElement(
|
|
320
|
+
showConversationRailToggle ? createConversationRailToggleButton({
|
|
321
|
+
isAutoCollapsed: isConversationRailAutoCollapsed,
|
|
322
|
+
isCollapsed: isConversationRailCollapsed,
|
|
323
|
+
label: toggleLabel,
|
|
324
|
+
onToggleConversationRail
|
|
325
|
+
}) : null,
|
|
326
|
+
isConversationRailCollapsed && onCreateConversation ? createNewConversationButton({
|
|
327
|
+
label: copy.newConversation,
|
|
328
|
+
onCreateConversation
|
|
329
|
+
}) : null,
|
|
330
|
+
isConversationRailCollapsed && collapsedTitle ? createElement(
|
|
400
331
|
"span",
|
|
401
332
|
{
|
|
402
333
|
className: "agent-gui-workbench-header__session-title"
|
|
@@ -411,7 +342,7 @@ function AgentGuiWorkbenchHeader({
|
|
|
411
342
|
{
|
|
412
343
|
className: "agent-gui-workbench-header__title-text"
|
|
413
344
|
},
|
|
414
|
-
|
|
345
|
+
collapsedTitle
|
|
415
346
|
)
|
|
416
347
|
) : null,
|
|
417
348
|
isConversationRailCollapsed && secondaryAccessory ? createElement(
|
|
@@ -422,12 +353,12 @@ function AgentGuiWorkbenchHeader({
|
|
|
422
353
|
secondaryAccessory
|
|
423
354
|
) : null
|
|
424
355
|
),
|
|
425
|
-
!isConversationRailCollapsed && (
|
|
356
|
+
!isConversationRailCollapsed && (hasExpandedIdentity || secondaryAccessory) ? createElement(
|
|
426
357
|
"div",
|
|
427
358
|
{
|
|
428
359
|
className: "agent-gui-workbench-header__detail"
|
|
429
360
|
},
|
|
430
|
-
|
|
361
|
+
hasExpandedIdentity ? createElement(
|
|
431
362
|
"div",
|
|
432
363
|
{
|
|
433
364
|
className: "agent-gui-workbench-header__detail-title",
|
|
@@ -438,13 +369,13 @@ function AgentGuiWorkbenchHeader({
|
|
|
438
369
|
src: sessionIconUrl,
|
|
439
370
|
testId: "agent-gui-window-detail-title-icon"
|
|
440
371
|
}),
|
|
441
|
-
createElement(
|
|
372
|
+
sessionTitle ? createElement(
|
|
442
373
|
"span",
|
|
443
374
|
{
|
|
444
375
|
className: "agent-gui-workbench-header__title-text"
|
|
445
376
|
},
|
|
446
377
|
sessionTitle
|
|
447
|
-
)
|
|
378
|
+
) : null
|
|
448
379
|
) : null,
|
|
449
380
|
secondaryAccessory ? createElement(
|
|
450
381
|
"div",
|
|
@@ -456,6 +387,43 @@ function AgentGuiWorkbenchHeader({
|
|
|
456
387
|
) : null
|
|
457
388
|
);
|
|
458
389
|
}
|
|
390
|
+
function createConversationRailToggleButton({
|
|
391
|
+
isAutoCollapsed,
|
|
392
|
+
isCollapsed,
|
|
393
|
+
label,
|
|
394
|
+
onToggleConversationRail
|
|
395
|
+
}) {
|
|
396
|
+
const button = createElement(
|
|
397
|
+
Button,
|
|
398
|
+
{
|
|
399
|
+
"aria-label": label,
|
|
400
|
+
className: conversationRailToggleButtonClassName,
|
|
401
|
+
"data-agent-gui-conversation-rail-auto-collapsed": isAutoCollapsed ? "true" : void 0,
|
|
402
|
+
"data-agent-gui-conversation-rail-collapsed": isCollapsed ? "true" : void 0,
|
|
403
|
+
"data-testid": "agent-gui-toggle-conversation-rail",
|
|
404
|
+
size: "icon-sm",
|
|
405
|
+
type: "button",
|
|
406
|
+
variant: "ghost",
|
|
407
|
+
onClick: (event) => {
|
|
408
|
+
event.stopPropagation();
|
|
409
|
+
onToggleConversationRail(!isCollapsed);
|
|
410
|
+
},
|
|
411
|
+
onDoubleClick: (event) => event.stopPropagation(),
|
|
412
|
+
onPointerDown: (event) => event.stopPropagation()
|
|
413
|
+
},
|
|
414
|
+
createElement(PanelIcon, { className: headerChromeIconClassName })
|
|
415
|
+
);
|
|
416
|
+
return createElement(TooltipProvider, {
|
|
417
|
+
children: createElement(
|
|
418
|
+
Tooltip,
|
|
419
|
+
null,
|
|
420
|
+
createElement(TooltipTrigger, { asChild: true }, button),
|
|
421
|
+
createElement(TooltipContent, { side: "bottom" }, label)
|
|
422
|
+
),
|
|
423
|
+
delayDuration: 250,
|
|
424
|
+
skipDelayDuration: 0
|
|
425
|
+
});
|
|
426
|
+
}
|
|
459
427
|
function createDetachedWindowButton({
|
|
460
428
|
label,
|
|
461
429
|
onOpenDetachedWindow
|
|
@@ -476,7 +444,55 @@ function createDetachedWindowButton({
|
|
|
476
444
|
onDoubleClick: (event) => event.stopPropagation(),
|
|
477
445
|
onPointerDown: (event) => event.stopPropagation()
|
|
478
446
|
},
|
|
479
|
-
createElement(
|
|
447
|
+
createElement("span", {
|
|
448
|
+
"aria-hidden": true,
|
|
449
|
+
className: headerChromeIconClassName,
|
|
450
|
+
"data-agent-gui-icon": "open-link-lined",
|
|
451
|
+
style: {
|
|
452
|
+
backgroundColor: "currentColor",
|
|
453
|
+
display: "block",
|
|
454
|
+
WebkitMaskImage: `url("${open_link_lined_default}")`,
|
|
455
|
+
WebkitMaskPosition: "center",
|
|
456
|
+
WebkitMaskRepeat: "no-repeat",
|
|
457
|
+
WebkitMaskSize: "contain",
|
|
458
|
+
maskImage: `url("${open_link_lined_default}")`,
|
|
459
|
+
maskPosition: "center",
|
|
460
|
+
maskRepeat: "no-repeat",
|
|
461
|
+
maskSize: "contain"
|
|
462
|
+
}
|
|
463
|
+
})
|
|
464
|
+
);
|
|
465
|
+
return createElement(TooltipProvider, {
|
|
466
|
+
children: createElement(
|
|
467
|
+
Tooltip,
|
|
468
|
+
null,
|
|
469
|
+
createElement(TooltipTrigger, { asChild: true }, button),
|
|
470
|
+
createElement(TooltipContent, { side: "bottom" }, label)
|
|
471
|
+
),
|
|
472
|
+
delayDuration: 250,
|
|
473
|
+
skipDelayDuration: 0
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
function createNewConversationButton({
|
|
477
|
+
label,
|
|
478
|
+
onCreateConversation
|
|
479
|
+
}) {
|
|
480
|
+
const button = createElement(
|
|
481
|
+
Button,
|
|
482
|
+
{
|
|
483
|
+
"aria-label": label,
|
|
484
|
+
className: headerChromeIconButtonClassName,
|
|
485
|
+
size: "icon-sm",
|
|
486
|
+
type: "button",
|
|
487
|
+
variant: "ghost",
|
|
488
|
+
onClick: (event) => {
|
|
489
|
+
event.stopPropagation();
|
|
490
|
+
onCreateConversation();
|
|
491
|
+
},
|
|
492
|
+
onDoubleClick: (event) => event.stopPropagation(),
|
|
493
|
+
onPointerDown: (event) => event.stopPropagation()
|
|
494
|
+
},
|
|
495
|
+
createElement(CreateChatIcon, {
|
|
480
496
|
"aria-hidden": true,
|
|
481
497
|
className: headerChromeIconClassName
|
|
482
498
|
})
|
|
@@ -588,100 +604,18 @@ var trafficLightIconPathByName = {
|
|
|
588
604
|
unfullscreen: "M20.793 12C21.2384 12.0001 21.4614 12.5386 21.1465 12.8536L12.8536 21.1465C12.5386 21.4614 12.0001 21.2384 12.0001 20.793V12.5C12.0001 12.2239 12.2239 12 12.5001 12H20.793ZM11.1465 2.85356C11.4615 2.53864 12 2.76166 12.0001 3.20708V11.5C12 11.7761 11.7762 12 11.5001 12H3.20708C2.76166 12 2.53864 11.4615 2.85357 11.1465L11.1465 2.85356Z"
|
|
589
605
|
};
|
|
590
606
|
|
|
591
|
-
//
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
const agentTargetId = agent.agentTargetId.trim();
|
|
597
|
-
const name = agent.name.trim();
|
|
598
|
-
const iconUrl = agent.iconUrl.trim();
|
|
599
|
-
if (!agentTargetId || !name || !iconUrl || seenAgentTargetIds.has(agentTargetId)) {
|
|
600
|
-
continue;
|
|
601
|
-
}
|
|
602
|
-
seenAgentTargetIds.add(agentTargetId);
|
|
603
|
-
const ownerName = agent.owner?.name?.trim() ?? "";
|
|
604
|
-
const ownerAvatarUrl = agent.owner?.avatarUrl?.trim() ?? "";
|
|
605
|
-
const reason = agent.availability.reason?.trim() ?? "";
|
|
606
|
-
normalized.push({
|
|
607
|
-
agentTargetId,
|
|
608
|
-
name,
|
|
609
|
-
iconUrl,
|
|
610
|
-
...agent.description?.trim() ? { description: agent.description.trim() } : {},
|
|
611
|
-
...ownerName || ownerAvatarUrl ? {
|
|
612
|
-
owner: {
|
|
613
|
-
...ownerName ? { name: ownerName } : {},
|
|
614
|
-
...ownerAvatarUrl ? { avatarUrl: ownerAvatarUrl } : {}
|
|
615
|
-
}
|
|
616
|
-
} : {},
|
|
617
|
-
availability: {
|
|
618
|
-
status: normalizeAgentGUIAgentAvailabilityStatus(
|
|
619
|
-
agent.availability.status
|
|
620
|
-
),
|
|
621
|
-
...reason ? { reason } : {},
|
|
622
|
-
...agent.availability.pendingAction ? { pendingAction: agent.availability.pendingAction } : {}
|
|
623
|
-
},
|
|
624
|
-
provider: agent.provider
|
|
625
|
-
});
|
|
626
|
-
}
|
|
627
|
-
return normalized;
|
|
628
|
-
}
|
|
629
|
-
function agentGUIAgentIsReady(agent) {
|
|
630
|
-
return agent.availability.status === "ready";
|
|
631
|
-
}
|
|
632
|
-
function resolveAgentGUISelectedDirectoryAgent(input) {
|
|
633
|
-
const explicitAgentTargetId = input.agentTargetId?.trim() || input.defaultAgentTargetId?.trim() || "";
|
|
634
|
-
if (explicitAgentTargetId) {
|
|
635
|
-
return input.agents.find(
|
|
636
|
-
(agent) => agent.agentTargetId === explicitAgentTargetId
|
|
637
|
-
) ?? null;
|
|
638
|
-
}
|
|
639
|
-
return input.agents.find((agent) => agentGUIAgentIsReady(agent)) ?? input.agents[0] ?? null;
|
|
640
|
-
}
|
|
641
|
-
function projectAgentGUIAgentsToInternalTargets(agents) {
|
|
642
|
-
return agents.map((agent) => ({
|
|
643
|
-
targetId: agent.agentTargetId,
|
|
644
|
-
agentTargetId: agent.agentTargetId,
|
|
645
|
-
provider: agent.provider,
|
|
646
|
-
ref: {
|
|
647
|
-
kind: "agent-directory",
|
|
648
|
-
provider: agent.provider,
|
|
649
|
-
agentTargetId: agent.agentTargetId
|
|
650
|
-
},
|
|
651
|
-
label: agent.name,
|
|
652
|
-
...agent.description ? { description: agent.description } : {},
|
|
653
|
-
iconUrl: agent.iconUrl,
|
|
654
|
-
...agent.owner?.avatarUrl ? {
|
|
655
|
-
badge: {
|
|
656
|
-
iconUrl: agent.owner.avatarUrl,
|
|
657
|
-
...agent.owner.name ? { label: agent.owner.name } : {}
|
|
658
|
-
}
|
|
659
|
-
} : {},
|
|
660
|
-
...agent.owner?.name ? { ownerLabel: agent.owner.name } : {},
|
|
661
|
-
...agent.availability.status !== "ready" ? { disabled: true } : {},
|
|
662
|
-
...agent.availability.reason ? { unavailableReason: agent.availability.reason } : {}
|
|
663
|
-
}));
|
|
664
|
-
}
|
|
665
|
-
function normalizeAgentGUIAgentAvailabilityStatus(status) {
|
|
666
|
-
switch (status) {
|
|
667
|
-
case "ready":
|
|
668
|
-
case "checking":
|
|
669
|
-
case "coming_soon":
|
|
670
|
-
case "not_installed":
|
|
671
|
-
case "auth_required":
|
|
672
|
-
case "unavailable":
|
|
673
|
-
return status;
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
// workbench/contribution.ts
|
|
607
|
+
// workbench/contributionDock.tsx
|
|
608
|
+
import { createElement as createElement2 } from "react";
|
|
609
|
+
import {
|
|
610
|
+
getWorkbenchLayoutFrame
|
|
611
|
+
} from "@tutti-os/workbench-surface";
|
|
678
612
|
var agentGuiWorkbenchDefaultNodeFrame = {
|
|
679
613
|
height: 560,
|
|
680
614
|
width: 1040,
|
|
681
615
|
x: 140,
|
|
682
616
|
y: 48
|
|
683
617
|
};
|
|
684
|
-
var agentGuiWorkbenchDefaultUsableWidthRatio = 0.
|
|
618
|
+
var agentGuiWorkbenchDefaultUsableWidthRatio = 0.9;
|
|
685
619
|
var agentGuiWorkbenchDefaultUsableHeightRatio = 0.9;
|
|
686
620
|
var agentGuiWorkbenchCompactVisibleAreaRatio = 0.9;
|
|
687
621
|
var agentGuiWorkbenchNewWindowCascadeOffset = { x: 180, y: 88 };
|
|
@@ -692,13 +626,10 @@ var agentGuiWorkbenchUnifiedDockTileProviders = [
|
|
|
692
626
|
"tutti-agent",
|
|
693
627
|
"hermes"
|
|
694
628
|
];
|
|
695
|
-
var AGENT_GUI_WORKBENCH_CONVERSATION_RAIL_TOGGLE_EVENT = "tutti:agent-gui-workbench-conversation-rail-toggle";
|
|
696
|
-
var AGENT_GUI_WORKBENCH_NEW_CONVERSATION_EVENT = "tutti:agent-gui-workbench-new-conversation";
|
|
697
|
-
var AGENT_GUI_WORKBENCH_OPEN_EXTERNAL_IMPORT_EVENT = "tutti:agent-gui-workbench-open-external-import";
|
|
698
629
|
var agentGuiWorkbenchDefaultCopy = {
|
|
699
|
-
collapseConversationRail: "
|
|
630
|
+
collapseConversationRail: "Hide sidebar",
|
|
700
631
|
close: "Close",
|
|
701
|
-
expandConversationRail: "
|
|
632
|
+
expandConversationRail: "Show sidebar",
|
|
702
633
|
fallbackAgentLabel: "Agent",
|
|
703
634
|
maximize: "Maximize",
|
|
704
635
|
minimize: "Minimize",
|
|
@@ -707,293 +638,26 @@ var agentGuiWorkbenchDefaultCopy = {
|
|
|
707
638
|
openDetachedWindow: "Open in detached window",
|
|
708
639
|
restore: "Restore"
|
|
709
640
|
};
|
|
710
|
-
function
|
|
711
|
-
const
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
const
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
}),
|
|
731
|
-
externalStateSource: nodeStateSource.externalStateSource,
|
|
732
|
-
id: input.id ?? "workspace-agent-gui",
|
|
733
|
-
nodes: [
|
|
734
|
-
{
|
|
735
|
-
frame,
|
|
736
|
-
instance: { mode: "multi" },
|
|
737
|
-
onBodyRenderErrorChange: ({ hasError, node }) => {
|
|
738
|
-
setAgentGuiWorkbenchBodyRenderError(node.id, hasError);
|
|
739
|
-
},
|
|
740
|
-
renderBody: (context) => input.renderBody(
|
|
741
|
-
context,
|
|
742
|
-
{
|
|
743
|
-
nodeTypeId: agentGuiWorkbenchTypeId,
|
|
744
|
-
onStateChange: (state) => {
|
|
745
|
-
nodeStateSource.writeNodeState({
|
|
746
|
-
instanceId: context.instanceId,
|
|
747
|
-
nodeId: context.node.id,
|
|
748
|
-
state,
|
|
749
|
-
typeId: agentGuiWorkbenchTypeId
|
|
750
|
-
});
|
|
751
|
-
},
|
|
752
|
-
provider: providerFromActivation(context.activation) ?? agentGuiWorkbenchProviderFromInstanceId(context.instanceId)
|
|
753
|
-
}
|
|
754
|
-
),
|
|
755
|
-
renderHeader: ({
|
|
756
|
-
activation,
|
|
757
|
-
dragHandleProps,
|
|
758
|
-
displayMode,
|
|
759
|
-
externalNodeState,
|
|
760
|
-
instanceId,
|
|
761
|
-
isFocused,
|
|
762
|
-
node,
|
|
763
|
-
surfaceSize,
|
|
764
|
-
windowActions
|
|
765
|
-
}) => {
|
|
766
|
-
const provider = providerFromActivation(activation) ?? agentGuiWorkbenchProviderFromInstanceId(instanceId);
|
|
767
|
-
const headerTitle = copy.nodeTitle;
|
|
768
|
-
const rawWorkbenchState = externalNodeState ?? node.data.runtimeNodeState;
|
|
769
|
-
const migratedWorkbenchState = migrateLegacyAgentGuiWorkbenchState(rawWorkbenchState);
|
|
770
|
-
const workbenchState = normalizeAgentGuiWorkbenchState(
|
|
771
|
-
migratedWorkbenchState
|
|
772
|
-
);
|
|
773
|
-
const nodeState = normalizeAgentGuiWorkbenchNodeState(
|
|
774
|
-
migratedWorkbenchState,
|
|
775
|
-
provider
|
|
776
|
-
);
|
|
777
|
-
const isConversationRailAutoCollapsed = shouldAutoCollapseAgentGUIConversationRail(node.frame.width);
|
|
778
|
-
const isConversationRailCollapsed = nodeState.conversationRailCollapsed === true || isConversationRailAutoCollapsed;
|
|
779
|
-
const conversationRailWidthPx = clampAgentGUIConversationRailWidthPx(
|
|
780
|
-
nodeState.conversationRailWidthPx,
|
|
781
|
-
node.frame.width
|
|
782
|
-
);
|
|
783
|
-
const conversationIdentity = input.resolveDockPopupIdentity?.(workbenchState) ?? null;
|
|
784
|
-
const conversationTitle = conversationIdentity?.title ?? input.resolveDockPopupTitle?.(workbenchState) ?? workbenchState.lastActiveConversationTitle ?? null;
|
|
785
|
-
const iconProvider = providerFromActivation(activation) ?? agentGuiWorkbenchProviderFromInstanceIdOrNull(instanceId);
|
|
786
|
-
const conversationIconFallbackUrl = iconProvider ? resolveAgentGuiSessionProviderIconUrl(iconProvider) ?? resolveAgentGuiWorkbenchProviderIconUrl({
|
|
787
|
-
dockIconUrls: input.dockIconUrls,
|
|
788
|
-
provider: iconProvider
|
|
789
|
-
}) : null;
|
|
790
|
-
const conversationIconUrl = conversationIdentity?.iconUrl ?? conversationIconFallbackUrl;
|
|
791
|
-
const persistConversationRailCollapsed = (collapsed) => {
|
|
792
|
-
nodeStateSource.writeNodeState({
|
|
793
|
-
instanceId,
|
|
794
|
-
nodeId: node.id,
|
|
795
|
-
state: {
|
|
796
|
-
...workbenchState,
|
|
797
|
-
conversationRailCollapsed: collapsed
|
|
798
|
-
},
|
|
799
|
-
typeId: agentGuiWorkbenchTypeId
|
|
800
|
-
});
|
|
801
|
-
};
|
|
802
|
-
const announceConversationRailCollapsed = (collapsed) => {
|
|
803
|
-
window.dispatchEvent(
|
|
804
|
-
new CustomEvent(
|
|
805
|
-
AGENT_GUI_WORKBENCH_CONVERSATION_RAIL_TOGGLE_EVENT,
|
|
806
|
-
{
|
|
807
|
-
detail: {
|
|
808
|
-
conversationRailCollapsed: collapsed,
|
|
809
|
-
instanceId
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
)
|
|
813
|
-
);
|
|
814
|
-
};
|
|
815
|
-
const announceNewConversation = () => {
|
|
816
|
-
window.dispatchEvent(
|
|
817
|
-
new CustomEvent(
|
|
818
|
-
AGENT_GUI_WORKBENCH_NEW_CONVERSATION_EVENT,
|
|
819
|
-
{
|
|
820
|
-
detail: {
|
|
821
|
-
instanceId
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
)
|
|
825
|
-
);
|
|
826
|
-
};
|
|
827
|
-
return createElement2(AgentGuiWorkbenchHeader, {
|
|
828
|
-
copy,
|
|
829
|
-
conversationIconUrl,
|
|
830
|
-
conversationIconFallbackUrl,
|
|
831
|
-
conversationTitle,
|
|
832
|
-
conversationRailWidthPx,
|
|
833
|
-
displayMode,
|
|
834
|
-
isConversationRailAutoCollapsed,
|
|
835
|
-
isConversationRailCollapsed,
|
|
836
|
-
nodeId: node.id,
|
|
837
|
-
providerRailWidthPx: agentGuiWorkbenchProviderRailWidthPx,
|
|
838
|
-
title: headerTitle,
|
|
839
|
-
windowActions: {
|
|
840
|
-
close: windowActions.close,
|
|
841
|
-
minimize: windowActions.minimize,
|
|
842
|
-
toggleDisplayMode: windowActions.toggleDisplayMode
|
|
843
|
-
},
|
|
844
|
-
...dragHandleProps,
|
|
845
|
-
onCreateConversation: announceNewConversation,
|
|
846
|
-
onOpenDetachedWindow: input.onOpenDetachedWindow ? () => {
|
|
847
|
-
void input.onOpenDetachedWindow?.({
|
|
848
|
-
agentSessionId: workbenchState.lastActiveAgentSessionId,
|
|
849
|
-
agentTargetId: nodeState.agentTargetId,
|
|
850
|
-
agents: input.agents ?? void 0,
|
|
851
|
-
provider,
|
|
852
|
-
workspaceId: input.workspaceId
|
|
853
|
-
});
|
|
854
|
-
} : void 0,
|
|
855
|
-
onPointerDown: (event) => {
|
|
856
|
-
dragHandleProps.onPointerDown?.(event);
|
|
857
|
-
if (!isFocused) {
|
|
858
|
-
windowActions.focus();
|
|
859
|
-
}
|
|
860
|
-
},
|
|
861
|
-
onToggleConversationRail: (nextCollapsed) => {
|
|
862
|
-
announceConversationRailCollapsed(nextCollapsed);
|
|
863
|
-
if (isConversationRailCollapsed && nextCollapsed === false && node.displayMode !== "fullscreen") {
|
|
864
|
-
const expandedFrame = resolveAgentGUIExpandedWindowFrame({
|
|
865
|
-
conversationRailWidthPx: nodeState.conversationRailWidthPx,
|
|
866
|
-
desktopSize: surfaceSize,
|
|
867
|
-
height: node.frame.height,
|
|
868
|
-
position: {
|
|
869
|
-
x: node.frame.x,
|
|
870
|
-
y: node.frame.y
|
|
871
|
-
},
|
|
872
|
-
width: node.frame.width
|
|
873
|
-
});
|
|
874
|
-
windowActions.resize({
|
|
875
|
-
...node.frame,
|
|
876
|
-
height: expandedFrame.size.height,
|
|
877
|
-
width: expandedFrame.size.width,
|
|
878
|
-
x: expandedFrame.position.x,
|
|
879
|
-
y: expandedFrame.position.y
|
|
880
|
-
});
|
|
881
|
-
}
|
|
882
|
-
persistConversationRailCollapsed(nextCollapsed);
|
|
883
|
-
}
|
|
884
|
-
});
|
|
885
|
-
},
|
|
886
|
-
title: copy.nodeTitle,
|
|
887
|
-
typeId: agentGuiWorkbenchTypeId,
|
|
888
|
-
window: {
|
|
889
|
-
closable: true,
|
|
890
|
-
defaultOpen: false,
|
|
891
|
-
minimizedDock: {
|
|
892
|
-
kind: "component",
|
|
893
|
-
providePreview: (item) => createAgentGuiWorkbenchPreviewContent({
|
|
894
|
-
item,
|
|
895
|
-
renderPreview: input.renderMinimizedPreview,
|
|
896
|
-
resolveDockPopupTitle: input.resolveDockPopupTitle
|
|
897
|
-
})
|
|
898
|
-
},
|
|
899
|
-
minimizable: true
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
],
|
|
903
|
-
onLaunchRequest: (request) => {
|
|
904
|
-
if (request.typeId !== agentGuiWorkbenchTypeId) {
|
|
905
|
-
return null;
|
|
906
|
-
}
|
|
907
|
-
const launchPayload = resolveAgentGuiWorkbenchLaunchPayload(request, {
|
|
908
|
-
resolveDockLaunchPayload: input.resolveDockLaunchPayload
|
|
909
|
-
});
|
|
910
|
-
const {
|
|
911
|
-
activation,
|
|
912
|
-
dockEntryId,
|
|
913
|
-
instanceId: descriptorInstanceId,
|
|
914
|
-
openInNewWindow,
|
|
915
|
-
reuseDockEntryNode,
|
|
916
|
-
reuseExistingSessionNode,
|
|
917
|
-
targetAgentSessionId
|
|
918
|
-
} = createAgentGuiWorkbenchLaunchDescriptor({
|
|
919
|
-
...request,
|
|
920
|
-
payload: launchPayload
|
|
921
|
-
});
|
|
922
|
-
const existingInstanceId = targetAgentSessionId && reuseExistingSessionNode ? nodeStateSource.findInstanceIdByAgentSessionId(targetAgentSessionId) : null;
|
|
923
|
-
const instanceId = existingInstanceId ?? descriptorInstanceId;
|
|
924
|
-
const title = copy.nodeTitle;
|
|
925
|
-
const launchTarget = agentTargetLaunchPayloadFromRequest(launchPayload);
|
|
926
|
-
const launchAgentTargetId = launchTarget.agentTargetId;
|
|
927
|
-
if (targetAgentSessionId) {
|
|
928
|
-
const previousState = nodeStateSource.readNodeState({
|
|
929
|
-
instanceId,
|
|
930
|
-
typeId: agentGuiWorkbenchTypeId
|
|
931
|
-
});
|
|
932
|
-
nodeStateSource.writeNodeState({
|
|
933
|
-
instanceId,
|
|
934
|
-
state: {
|
|
935
|
-
...normalizeAgentGuiWorkbenchState(previousState),
|
|
936
|
-
...targetAgentSessionId ? { lastActiveAgentSessionId: targetAgentSessionId } : {},
|
|
937
|
-
agentTargetId: launchAgentTargetId ?? null
|
|
938
|
-
},
|
|
939
|
-
typeId: agentGuiWorkbenchTypeId
|
|
940
|
-
});
|
|
941
|
-
} else if (launchAgentTargetId) {
|
|
942
|
-
const previousState = nodeStateSource.readNodeState({
|
|
943
|
-
instanceId,
|
|
944
|
-
typeId: agentGuiWorkbenchTypeId
|
|
945
|
-
});
|
|
946
|
-
nodeStateSource.writeNodeState({
|
|
947
|
-
instanceId,
|
|
948
|
-
state: {
|
|
949
|
-
...normalizeAgentGuiWorkbenchState(previousState),
|
|
950
|
-
lastActiveAgentSessionId: null,
|
|
951
|
-
agentTargetId: launchAgentTargetId
|
|
952
|
-
},
|
|
953
|
-
typeId: agentGuiWorkbenchTypeId
|
|
954
|
-
});
|
|
955
|
-
}
|
|
956
|
-
const defaultFrame = resolveAgentGuiWorkbenchDefaultLaunchFrame({
|
|
957
|
-
frame,
|
|
958
|
-
request
|
|
959
|
-
});
|
|
960
|
-
return {
|
|
961
|
-
activation,
|
|
962
|
-
...openInNewWindow ? { cascadeOffset: agentGuiWorkbenchNewWindowCascadeOffset } : {},
|
|
963
|
-
defaultFrame,
|
|
964
|
-
dockEntryId,
|
|
965
|
-
framePolicy: !openInNewWindow && isAgentGuiWorkbenchCompactVisibleFrame(defaultFrame, frame) ? "absolute" : "cascade-same-type-centered",
|
|
966
|
-
instanceId,
|
|
967
|
-
// Reusing the window already showing this specific conversation
|
|
968
|
-
// (e.g. clicking a completion notification) should just focus it,
|
|
969
|
-
// not reset it back to the default size/position.
|
|
970
|
-
preserveExistingNodeFrame: existingInstanceId !== null,
|
|
971
|
-
reuseDockEntryNode,
|
|
972
|
-
title,
|
|
973
|
-
typeId: agentGuiWorkbenchTypeId
|
|
974
|
-
};
|
|
975
|
-
}
|
|
976
|
-
};
|
|
977
|
-
}
|
|
978
|
-
function buildAgentGuiDockEntries(input) {
|
|
979
|
-
const sectionId = input.sectionId ?? "agents";
|
|
980
|
-
const launchPayload = resolveAgentGuiUnifiedDockLaunchPayload(input);
|
|
981
|
-
const provider = launchPayload.provider;
|
|
982
|
-
const unifiedTileIconUrls = resolveAgentGuiUnifiedDockTileIconUrls(
|
|
983
|
-
input.dockIconUrls
|
|
984
|
-
);
|
|
985
|
-
return [
|
|
986
|
-
createAgentGuiWorkbenchDockEntry({
|
|
987
|
-
aggregateProviders: agentGuiWorkbenchDefaultDockProviders,
|
|
988
|
-
icon: input.unifiedDockIconUrl ? createAgentGuiWorkbenchUnifiedDockIcon({
|
|
989
|
-
iconUrl: input.unifiedDockIconUrl
|
|
990
|
-
}) : createAgentGuiWorkbenchLaunchpadStyleDockIcon({
|
|
991
|
-
tileIconUrls: unifiedTileIconUrls
|
|
992
|
-
}),
|
|
993
|
-
label: input.label ?? agentGuiWorkbenchDefaultCopy.nodeTitle,
|
|
994
|
-
launchPayload,
|
|
995
|
-
order: 0,
|
|
996
|
-
provider,
|
|
641
|
+
function buildAgentGuiDockEntries(input) {
|
|
642
|
+
const sectionId = input.sectionId ?? "agents";
|
|
643
|
+
const launchPayload = resolveAgentGuiUnifiedDockLaunchPayload(input);
|
|
644
|
+
const provider = launchPayload.provider;
|
|
645
|
+
const unifiedTileIconUrls = resolveAgentGuiUnifiedDockTileIconUrls(
|
|
646
|
+
input.dockIconUrls
|
|
647
|
+
);
|
|
648
|
+
return [
|
|
649
|
+
createAgentGuiWorkbenchDockEntry({
|
|
650
|
+
agentDirectory: input.agentDirectory,
|
|
651
|
+
aggregateProviders: agentGuiWorkbenchDefaultDockProviders,
|
|
652
|
+
icon: input.unifiedDockIconUrl ? createAgentGuiWorkbenchUnifiedDockIcon({
|
|
653
|
+
iconUrl: input.unifiedDockIconUrl
|
|
654
|
+
}) : createAgentGuiWorkbenchLaunchpadStyleDockIcon({
|
|
655
|
+
tileIconUrls: unifiedTileIconUrls
|
|
656
|
+
}),
|
|
657
|
+
label: input.label ?? agentGuiWorkbenchDefaultCopy.nodeTitle,
|
|
658
|
+
launchPayload,
|
|
659
|
+
order: 0,
|
|
660
|
+
provider,
|
|
997
661
|
renderPreview: input.renderPreview,
|
|
998
662
|
resolveDockPopupIdentity: input.resolveDockPopupIdentity,
|
|
999
663
|
resolveDockPopupTitle: input.resolveDockPopupTitle,
|
|
@@ -1007,7 +671,7 @@ function resolveAgentGuiUnifiedDockLaunchPayload(input) {
|
|
|
1007
671
|
if (target) {
|
|
1008
672
|
return {
|
|
1009
673
|
provider: target.provider,
|
|
1010
|
-
agentTargetId: target.agentTargetId
|
|
674
|
+
agentTargetId: target.agentTargetId ?? target.targetId
|
|
1011
675
|
};
|
|
1012
676
|
}
|
|
1013
677
|
return {
|
|
@@ -1050,11 +714,6 @@ function createAgentGuiWorkbenchDockEntry(input) {
|
|
|
1050
714
|
label: input.label,
|
|
1051
715
|
launchBehavior: "enabled",
|
|
1052
716
|
launchPayload: input.launchPayload ?? { provider: input.provider },
|
|
1053
|
-
// A normal dock launch reuses the node already showing this provider/target
|
|
1054
|
-
// (its instanceId is target-keyed). The popup's explicit "New window" action
|
|
1055
|
-
// must instead always open a fresh window, so hand it a payload that flags
|
|
1056
|
-
// openInNewWindow — the launch descriptor then derives a unique panel
|
|
1057
|
-
// instanceId and cascades the new window off the existing one.
|
|
1058
717
|
newWindowLaunchPayload: {
|
|
1059
718
|
...input.launchPayload ?? { provider: input.provider },
|
|
1060
719
|
openInNewWindow: true
|
|
@@ -1063,6 +722,9 @@ function createAgentGuiWorkbenchDockEntry(input) {
|
|
|
1063
722
|
if (node.data.typeId !== agentGuiWorkbenchTypeId) {
|
|
1064
723
|
return false;
|
|
1065
724
|
}
|
|
725
|
+
if (input.aggregateProviders && (agentGuiWorkbenchDockIdentityFromIdentifier(node.data.instanceId)?.kind === "unifiedAggregate" || agentGuiWorkbenchDockIdentityFromIdentifier(node.data.dockEntryId)?.kind === "unifiedAggregate")) {
|
|
726
|
+
return true;
|
|
727
|
+
}
|
|
1066
728
|
const provider = resolveAgentGuiWorkbenchProviderFromNodeIdentityOrNull(node);
|
|
1067
729
|
if (!provider) {
|
|
1068
730
|
return false;
|
|
@@ -1071,6 +733,7 @@ function createAgentGuiWorkbenchDockEntry(input) {
|
|
|
1071
733
|
},
|
|
1072
734
|
order: input.order,
|
|
1073
735
|
providePopupItemPreview: (item) => input.renderPreview ? createAgentGuiWorkbenchPreviewContent({
|
|
736
|
+
agentDirectory: input.agentDirectory,
|
|
1074
737
|
item,
|
|
1075
738
|
label: input.label,
|
|
1076
739
|
provider: input.provider,
|
|
@@ -1098,7 +761,7 @@ function resolveAgentGuiUnifiedDockTileIconUrls(dockIconUrls) {
|
|
|
1098
761
|
);
|
|
1099
762
|
}
|
|
1100
763
|
function resolveAgentGuiWorkbenchProviderIconUrl(input) {
|
|
1101
|
-
return input.dockIconUrls?.[input.provider] ?? agentGuiDockIconUrls[input.provider];
|
|
764
|
+
return input.dockIconUrls?.[input.provider] ?? agentGuiDockIconUrls[input.provider] ?? "";
|
|
1102
765
|
}
|
|
1103
766
|
function createAgentGuiWorkbenchLaunchpadStyleDockIcon(input) {
|
|
1104
767
|
return createElement2(
|
|
@@ -1155,45 +818,56 @@ function providerFromActivation(activation) {
|
|
|
1155
818
|
return providerFromState(payload);
|
|
1156
819
|
}
|
|
1157
820
|
function resolveAgentGuiWorkbenchLaunchPayload(request, input) {
|
|
1158
|
-
if (
|
|
821
|
+
if (hasAgentSessionId(request.payload)) {
|
|
1159
822
|
return request.payload;
|
|
1160
823
|
}
|
|
1161
|
-
const
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
if (
|
|
1167
|
-
|
|
824
|
+
const snapshot = input.agentDirectory.getSnapshot();
|
|
825
|
+
const agents = normalizeAgentGUIAgents(snapshot.agents);
|
|
826
|
+
const payload = isRecord(request.payload) ? request.payload : {};
|
|
827
|
+
const isUnifiedDockLaunch = request.reason === "dock" && agentGuiWorkbenchDockIdentityFromIdentifier(request.dockEntryId)?.kind === "unifiedAggregate";
|
|
828
|
+
const explicitAgentTargetId = isUnifiedDockLaunch ? null : readTrimmedString(payload.agentTargetId);
|
|
829
|
+
if (explicitAgentTargetId) {
|
|
830
|
+
const explicitAgent = agents.find(
|
|
831
|
+
(agent) => agent.agentTargetId === explicitAgentTargetId && agent.availability.status === "ready"
|
|
832
|
+
);
|
|
833
|
+
if (!explicitAgent || !isAgentGuiWorkbenchProvider(explicitAgent.provider)) {
|
|
834
|
+
return null;
|
|
835
|
+
}
|
|
836
|
+
return {
|
|
837
|
+
...payload,
|
|
838
|
+
agentTargetId: explicitAgent.agentTargetId,
|
|
839
|
+
provider: explicitAgent.provider
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
const requestedProvider = providerFromState(payload);
|
|
843
|
+
const resolved = resolveAgentGuiUnifiedDockLaunchPayload({
|
|
844
|
+
agentDirectory: input.agentDirectory,
|
|
845
|
+
defaultProvider: requestedProvider ?? input.defaultProvider,
|
|
846
|
+
providerAvailability: input.providerAvailability
|
|
847
|
+
});
|
|
848
|
+
if (!resolved.agentTargetId) {
|
|
849
|
+
return null;
|
|
1168
850
|
}
|
|
1169
|
-
return resolved;
|
|
851
|
+
return { ...payload, ...resolved };
|
|
1170
852
|
}
|
|
1171
|
-
function
|
|
1172
|
-
if (!
|
|
853
|
+
function hasAgentSessionId(payload) {
|
|
854
|
+
if (!isRecord(payload)) {
|
|
1173
855
|
return false;
|
|
1174
856
|
}
|
|
1175
|
-
return payload.
|
|
857
|
+
return readTrimmedString(payload.agentSessionId) !== null;
|
|
1176
858
|
}
|
|
1177
|
-
function
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
return typeof typed.agentSessionId !== "string" && typeof typed.draftPrompt !== "string";
|
|
859
|
+
function isRecord(value) {
|
|
860
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
861
|
+
}
|
|
862
|
+
function readTrimmedString(value) {
|
|
863
|
+
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
1183
864
|
}
|
|
1184
865
|
function resolveUnifiedAgentGuiDockTarget(input) {
|
|
1185
|
-
const targets =
|
|
1186
|
-
(
|
|
866
|
+
const targets = projectAgentGUIAgentsToInternalTargets(
|
|
867
|
+
normalizeAgentGUIAgents(input.agentDirectory.getSnapshot().agents)
|
|
868
|
+
).filter(
|
|
869
|
+
(target) => isAgentGuiWorkbenchProvider(target.provider) && isUnifiedAgentGuiDockProvider(target.provider) && target.disabled !== true && isAgentGuiProviderAvailable(target.provider, input.providerAvailability)
|
|
1187
870
|
);
|
|
1188
|
-
const defaultAgentTargetId = input.defaultAgentTargetId?.trim();
|
|
1189
|
-
if (defaultAgentTargetId) {
|
|
1190
|
-
const explicitTarget = targets.find(
|
|
1191
|
-
(target) => target.agentTargetId === defaultAgentTargetId
|
|
1192
|
-
);
|
|
1193
|
-
if (explicitTarget) {
|
|
1194
|
-
return explicitTarget;
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
871
|
if (input.defaultProvider && isUnifiedAgentGuiDockProvider(input.defaultProvider) && isAgentGuiProviderAvailable(
|
|
1198
872
|
input.defaultProvider,
|
|
1199
873
|
input.providerAvailability
|
|
@@ -1229,8 +903,8 @@ function isUnifiedAgentGuiDockProvider(provider) {
|
|
|
1229
903
|
);
|
|
1230
904
|
}
|
|
1231
905
|
function preferredAgentGuiDockTargetForProvider(targets, provider) {
|
|
1232
|
-
const
|
|
1233
|
-
return
|
|
906
|
+
const agentTargets = targets.filter((target) => target.provider === provider);
|
|
907
|
+
return agentTargets[0] ?? null;
|
|
1234
908
|
}
|
|
1235
909
|
function isAgentGuiProviderAvailable(provider, availability) {
|
|
1236
910
|
const value = availability?.[provider];
|
|
@@ -1248,15 +922,16 @@ function isAgentGuiProviderAvailable(provider, availability) {
|
|
|
1248
922
|
}
|
|
1249
923
|
return value.status === "ready" || value.status === "available";
|
|
1250
924
|
}
|
|
1251
|
-
function
|
|
925
|
+
function providerTargetLaunchPayloadFromRequest(payload, _expectedProvider) {
|
|
1252
926
|
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
1253
927
|
return {
|
|
1254
928
|
agentTargetId: null
|
|
1255
929
|
};
|
|
1256
930
|
}
|
|
1257
931
|
const agentTargetId = payload.agentTargetId;
|
|
932
|
+
const providerTargetId = payload.providerTargetId;
|
|
1258
933
|
return {
|
|
1259
|
-
agentTargetId: typeof agentTargetId === "string" && agentTargetId.trim() ? agentTargetId.trim() : null
|
|
934
|
+
agentTargetId: typeof agentTargetId === "string" && agentTargetId.trim() ? agentTargetId.trim() : typeof providerTargetId === "string" && providerTargetId.trim() ? providerTargetId.trim() : null
|
|
1260
935
|
};
|
|
1261
936
|
}
|
|
1262
937
|
function createAgentGuiWorkbenchPreviewContent(input) {
|
|
@@ -1272,6 +947,7 @@ function createAgentGuiWorkbenchPreviewContent(input) {
|
|
|
1272
947
|
element: input.renderPreview(
|
|
1273
948
|
createAgentGuiWorkbenchPreviewBodyContext(input.item),
|
|
1274
949
|
{
|
|
950
|
+
agentDirectory: input.agentDirectory,
|
|
1275
951
|
nodeTypeId: agentGuiWorkbenchTypeId,
|
|
1276
952
|
onStateChange: () => void 0,
|
|
1277
953
|
provider
|
|
@@ -1301,36 +977,327 @@ function createAgentGuiWorkbenchPreviewBodyContext(input) {
|
|
|
1301
977
|
};
|
|
1302
978
|
}
|
|
1303
979
|
|
|
980
|
+
// workbench/contribution.ts
|
|
981
|
+
var AGENT_GUI_WORKBENCH_CONVERSATION_RAIL_TOGGLE_EVENT = "tutti:agent-gui-workbench-conversation-rail-toggle";
|
|
982
|
+
var AGENT_GUI_WORKBENCH_NEW_CONVERSATION_EVENT = "tutti:agent-gui-workbench-new-conversation";
|
|
983
|
+
var AGENT_GUI_WORKBENCH_OPEN_EXTERNAL_IMPORT_EVENT = "tutti:agent-gui-workbench-open-external-import";
|
|
984
|
+
function createAgentGuiWorkbenchContribution(input) {
|
|
985
|
+
const nodeStateSource = createAgentGuiWorkbenchNodeStateSource({
|
|
986
|
+
workspaceId: input.workspaceId
|
|
987
|
+
});
|
|
988
|
+
const frame = input.frame ?? agentGuiWorkbenchDefaultNodeFrame;
|
|
989
|
+
const copy = resolveAgentGuiWorkbenchContributionCopy(input.copy);
|
|
990
|
+
return {
|
|
991
|
+
dockEntries: buildAgentGuiDockEntries({
|
|
992
|
+
agentDirectory: input.agentDirectory,
|
|
993
|
+
defaultProvider: input.defaultProvider,
|
|
994
|
+
dockIconUrls: input.dockIconUrls,
|
|
995
|
+
label: copy.nodeTitle,
|
|
996
|
+
providerAvailability: input.providerAvailability,
|
|
997
|
+
renderPreview: input.renderPreview,
|
|
998
|
+
resolveDockPopupIdentity: input.resolveDockPopupIdentity,
|
|
999
|
+
resolveDockPopupTitle: input.resolveDockPopupTitle,
|
|
1000
|
+
sectionId: input.dockSectionId ?? "agents",
|
|
1001
|
+
unifiedDockIconUrl: input.unifiedDockIconUrl
|
|
1002
|
+
}),
|
|
1003
|
+
externalStateSource: nodeStateSource.externalStateSource,
|
|
1004
|
+
id: input.id ?? "workspace-agent-gui",
|
|
1005
|
+
nodes: [
|
|
1006
|
+
{
|
|
1007
|
+
frame,
|
|
1008
|
+
instance: { mode: "multi" },
|
|
1009
|
+
onBodyRenderErrorChange: ({ hasError, node }) => {
|
|
1010
|
+
setAgentGuiWorkbenchBodyRenderError(node.id, hasError);
|
|
1011
|
+
},
|
|
1012
|
+
renderBody: (context) => input.renderBody(
|
|
1013
|
+
context,
|
|
1014
|
+
{
|
|
1015
|
+
agentDirectory: input.agentDirectory,
|
|
1016
|
+
nodeTypeId: agentGuiWorkbenchTypeId,
|
|
1017
|
+
onStateChange: (state) => {
|
|
1018
|
+
nodeStateSource.writeNodeState({
|
|
1019
|
+
instanceId: context.instanceId,
|
|
1020
|
+
nodeId: context.node.id,
|
|
1021
|
+
state,
|
|
1022
|
+
typeId: agentGuiWorkbenchTypeId
|
|
1023
|
+
});
|
|
1024
|
+
},
|
|
1025
|
+
provider: providerFromActivation(context.activation) ?? agentGuiWorkbenchProviderFromInstanceId(context.instanceId)
|
|
1026
|
+
}
|
|
1027
|
+
),
|
|
1028
|
+
renderHeader: ({
|
|
1029
|
+
activation,
|
|
1030
|
+
dragHandleProps,
|
|
1031
|
+
displayMode,
|
|
1032
|
+
externalNodeState,
|
|
1033
|
+
instanceId,
|
|
1034
|
+
isFocused,
|
|
1035
|
+
node,
|
|
1036
|
+
surfaceSize,
|
|
1037
|
+
windowActions
|
|
1038
|
+
}) => {
|
|
1039
|
+
const provider = providerFromActivation(activation) ?? agentGuiWorkbenchProviderFromInstanceId(instanceId);
|
|
1040
|
+
const headerTitle = copy.nodeTitle;
|
|
1041
|
+
const rawWorkbenchState = externalNodeState ?? node.data.runtimeNodeState;
|
|
1042
|
+
const migratedWorkbenchState = migrateLegacyAgentGuiWorkbenchState(rawWorkbenchState);
|
|
1043
|
+
const workbenchState = normalizeAgentGuiWorkbenchState(
|
|
1044
|
+
migratedWorkbenchState
|
|
1045
|
+
);
|
|
1046
|
+
const nodeState = normalizeAgentGuiWorkbenchNodeState(
|
|
1047
|
+
migratedWorkbenchState,
|
|
1048
|
+
provider
|
|
1049
|
+
);
|
|
1050
|
+
const isConversationRailAutoCollapsed = shouldAutoCollapseAgentGUIConversationRail(node.frame.width);
|
|
1051
|
+
const isConversationRailCollapsed = nodeState.conversationRailCollapsed === true || isConversationRailAutoCollapsed;
|
|
1052
|
+
const conversationRailWidthPx = clampAgentGUIConversationRailWidthPx(
|
|
1053
|
+
nodeState.conversationRailWidthPx,
|
|
1054
|
+
node.frame.width
|
|
1055
|
+
);
|
|
1056
|
+
const conversationIdentity = input.resolveDockPopupIdentity?.(workbenchState) ?? null;
|
|
1057
|
+
const conversationTitle = conversationIdentity?.title ?? input.resolveDockPopupTitle?.(workbenchState) ?? null;
|
|
1058
|
+
const iconProvider = providerFromActivation(activation) ?? agentGuiWorkbenchProviderFromInstanceIdOrNull(instanceId);
|
|
1059
|
+
const conversationIconFallbackUrl = iconProvider ? resolveAgentGuiSessionProviderIconUrl(iconProvider) ?? resolveAgentGuiWorkbenchProviderIconUrl({
|
|
1060
|
+
dockIconUrls: input.dockIconUrls,
|
|
1061
|
+
provider: iconProvider
|
|
1062
|
+
}) : null;
|
|
1063
|
+
const conversationIconUrl = conversationIdentity?.iconUrl ?? conversationIconFallbackUrl;
|
|
1064
|
+
const persistConversationRailCollapsed = (collapsed) => {
|
|
1065
|
+
nodeStateSource.writeNodeState({
|
|
1066
|
+
instanceId,
|
|
1067
|
+
nodeId: node.id,
|
|
1068
|
+
state: {
|
|
1069
|
+
...workbenchState,
|
|
1070
|
+
conversationRailCollapsed: collapsed
|
|
1071
|
+
},
|
|
1072
|
+
typeId: agentGuiWorkbenchTypeId
|
|
1073
|
+
});
|
|
1074
|
+
};
|
|
1075
|
+
const announceConversationRailCollapsed = (collapsed) => {
|
|
1076
|
+
window.dispatchEvent(
|
|
1077
|
+
new CustomEvent(
|
|
1078
|
+
AGENT_GUI_WORKBENCH_CONVERSATION_RAIL_TOGGLE_EVENT,
|
|
1079
|
+
{
|
|
1080
|
+
detail: {
|
|
1081
|
+
conversationRailCollapsed: collapsed,
|
|
1082
|
+
instanceId
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
)
|
|
1086
|
+
);
|
|
1087
|
+
};
|
|
1088
|
+
const announceNewConversation = () => {
|
|
1089
|
+
window.dispatchEvent(
|
|
1090
|
+
new CustomEvent(
|
|
1091
|
+
AGENT_GUI_WORKBENCH_NEW_CONVERSATION_EVENT,
|
|
1092
|
+
{
|
|
1093
|
+
detail: {
|
|
1094
|
+
instanceId
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
)
|
|
1098
|
+
);
|
|
1099
|
+
};
|
|
1100
|
+
return createElement3(AgentGuiWorkbenchHeader, {
|
|
1101
|
+
agentTitle: conversationIdentity?.agentTitle,
|
|
1102
|
+
copy,
|
|
1103
|
+
conversationIconUrl,
|
|
1104
|
+
conversationIconFallbackUrl,
|
|
1105
|
+
conversationTitle,
|
|
1106
|
+
conversationRailWidthPx,
|
|
1107
|
+
displayMode,
|
|
1108
|
+
isConversationRailAutoCollapsed,
|
|
1109
|
+
isConversationRailCollapsed,
|
|
1110
|
+
nodeId: node.id,
|
|
1111
|
+
providerRailWidthPx: agentGuiWorkbenchProviderRailWidthPx,
|
|
1112
|
+
title: headerTitle,
|
|
1113
|
+
windowActions: {
|
|
1114
|
+
close: windowActions.close,
|
|
1115
|
+
minimize: windowActions.minimize,
|
|
1116
|
+
toggleDisplayMode: windowActions.toggleDisplayMode
|
|
1117
|
+
},
|
|
1118
|
+
...dragHandleProps,
|
|
1119
|
+
onCreateConversation: announceNewConversation,
|
|
1120
|
+
onOpenDetachedWindow: input.onOpenDetachedWindow ? () => {
|
|
1121
|
+
void input.onOpenDetachedWindow?.({
|
|
1122
|
+
agentSessionId: workbenchState.lastActiveAgentSessionId,
|
|
1123
|
+
agentTargetId: nodeState.agentTargetId,
|
|
1124
|
+
provider,
|
|
1125
|
+
workspaceId: input.workspaceId
|
|
1126
|
+
});
|
|
1127
|
+
} : void 0,
|
|
1128
|
+
onPointerDown: (event) => {
|
|
1129
|
+
dragHandleProps.onPointerDown?.(event);
|
|
1130
|
+
if (!isFocused) {
|
|
1131
|
+
windowActions.focus();
|
|
1132
|
+
}
|
|
1133
|
+
},
|
|
1134
|
+
onToggleConversationRail: (nextCollapsed) => {
|
|
1135
|
+
announceConversationRailCollapsed(nextCollapsed);
|
|
1136
|
+
if (isConversationRailCollapsed && nextCollapsed === false && node.displayMode !== "fullscreen") {
|
|
1137
|
+
const expandedFrame = resolveAgentGUIExpandedWindowFrame({
|
|
1138
|
+
conversationRailWidthPx: nodeState.conversationRailWidthPx,
|
|
1139
|
+
desktopSize: surfaceSize,
|
|
1140
|
+
height: node.frame.height,
|
|
1141
|
+
position: {
|
|
1142
|
+
x: node.frame.x,
|
|
1143
|
+
y: node.frame.y
|
|
1144
|
+
},
|
|
1145
|
+
width: node.frame.width
|
|
1146
|
+
});
|
|
1147
|
+
windowActions.resize({
|
|
1148
|
+
...node.frame,
|
|
1149
|
+
height: expandedFrame.size.height,
|
|
1150
|
+
width: expandedFrame.size.width,
|
|
1151
|
+
x: expandedFrame.position.x,
|
|
1152
|
+
y: expandedFrame.position.y
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
persistConversationRailCollapsed(nextCollapsed);
|
|
1156
|
+
}
|
|
1157
|
+
});
|
|
1158
|
+
},
|
|
1159
|
+
title: copy.nodeTitle,
|
|
1160
|
+
typeId: agentGuiWorkbenchTypeId,
|
|
1161
|
+
window: {
|
|
1162
|
+
closable: true,
|
|
1163
|
+
defaultOpen: false,
|
|
1164
|
+
minimizedDock: {
|
|
1165
|
+
kind: "component",
|
|
1166
|
+
providePreview: (item) => createAgentGuiWorkbenchPreviewContent({
|
|
1167
|
+
agentDirectory: input.agentDirectory,
|
|
1168
|
+
item,
|
|
1169
|
+
renderPreview: input.renderMinimizedPreview,
|
|
1170
|
+
resolveDockPopupTitle: input.resolveDockPopupTitle
|
|
1171
|
+
})
|
|
1172
|
+
},
|
|
1173
|
+
minimizable: true
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
],
|
|
1177
|
+
onLaunchRequest: (request) => {
|
|
1178
|
+
if (request.typeId !== agentGuiWorkbenchTypeId) {
|
|
1179
|
+
return null;
|
|
1180
|
+
}
|
|
1181
|
+
const launchPayload = resolveAgentGuiWorkbenchLaunchPayload(request, {
|
|
1182
|
+
agentDirectory: input.agentDirectory,
|
|
1183
|
+
defaultProvider: input.defaultProvider,
|
|
1184
|
+
providerAvailability: input.providerAvailability
|
|
1185
|
+
});
|
|
1186
|
+
if (!hasAgentSessionId2(launchPayload) && !providerTargetLaunchPayloadFromRequest(
|
|
1187
|
+
launchPayload,
|
|
1188
|
+
providerFromState(launchPayload) ?? "codex"
|
|
1189
|
+
).agentTargetId) {
|
|
1190
|
+
return null;
|
|
1191
|
+
}
|
|
1192
|
+
if (!providerFromState(launchPayload) && !agentGuiWorkbenchProviderFromIdentifier(request.dockEntryId)) {
|
|
1193
|
+
return null;
|
|
1194
|
+
}
|
|
1195
|
+
const {
|
|
1196
|
+
activation,
|
|
1197
|
+
dockEntryId,
|
|
1198
|
+
instanceId: descriptorInstanceId,
|
|
1199
|
+
openInNewWindow,
|
|
1200
|
+
provider,
|
|
1201
|
+
reuseDockEntryNode,
|
|
1202
|
+
reuseExistingSessionNode,
|
|
1203
|
+
targetAgentSessionId
|
|
1204
|
+
} = createAgentGuiWorkbenchLaunchDescriptor({
|
|
1205
|
+
...request,
|
|
1206
|
+
payload: launchPayload
|
|
1207
|
+
});
|
|
1208
|
+
const existingInstanceId = targetAgentSessionId && reuseExistingSessionNode ? nodeStateSource.findInstanceIdByAgentSessionId(targetAgentSessionId) : null;
|
|
1209
|
+
const instanceId = existingInstanceId ?? descriptorInstanceId;
|
|
1210
|
+
const title = copy.nodeTitle;
|
|
1211
|
+
const providerTarget = providerTargetLaunchPayloadFromRequest(
|
|
1212
|
+
launchPayload,
|
|
1213
|
+
provider
|
|
1214
|
+
);
|
|
1215
|
+
const launchAgentTargetId = providerTarget.agentTargetId;
|
|
1216
|
+
if (targetAgentSessionId) {
|
|
1217
|
+
const previousState = nodeStateSource.readNodeState({
|
|
1218
|
+
instanceId,
|
|
1219
|
+
typeId: agentGuiWorkbenchTypeId
|
|
1220
|
+
});
|
|
1221
|
+
nodeStateSource.writeNodeState({
|
|
1222
|
+
instanceId,
|
|
1223
|
+
state: {
|
|
1224
|
+
...normalizeAgentGuiWorkbenchState(previousState),
|
|
1225
|
+
...targetAgentSessionId ? { lastActiveAgentSessionId: targetAgentSessionId } : {},
|
|
1226
|
+
agentTargetId: launchAgentTargetId ?? null
|
|
1227
|
+
},
|
|
1228
|
+
typeId: agentGuiWorkbenchTypeId
|
|
1229
|
+
});
|
|
1230
|
+
} else if (providerTarget.agentTargetId) {
|
|
1231
|
+
const previousState = nodeStateSource.readNodeState({
|
|
1232
|
+
instanceId,
|
|
1233
|
+
typeId: agentGuiWorkbenchTypeId
|
|
1234
|
+
});
|
|
1235
|
+
nodeStateSource.writeNodeState({
|
|
1236
|
+
instanceId,
|
|
1237
|
+
state: {
|
|
1238
|
+
...normalizeAgentGuiWorkbenchState(previousState),
|
|
1239
|
+
lastActiveAgentSessionId: null,
|
|
1240
|
+
agentTargetId: providerTarget.agentTargetId
|
|
1241
|
+
},
|
|
1242
|
+
typeId: agentGuiWorkbenchTypeId
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
const defaultFrame = resolveAgentGuiWorkbenchDefaultLaunchFrame({
|
|
1246
|
+
frame,
|
|
1247
|
+
request
|
|
1248
|
+
});
|
|
1249
|
+
return {
|
|
1250
|
+
activation,
|
|
1251
|
+
...openInNewWindow ? { cascadeOffset: agentGuiWorkbenchNewWindowCascadeOffset } : {},
|
|
1252
|
+
defaultFrame,
|
|
1253
|
+
dockEntryId,
|
|
1254
|
+
framePolicy: !openInNewWindow && isAgentGuiWorkbenchCompactVisibleFrame(defaultFrame, frame) ? "absolute" : "cascade-same-type-centered",
|
|
1255
|
+
instanceId,
|
|
1256
|
+
// Reusing the window already showing this specific conversation
|
|
1257
|
+
// (e.g. clicking a completion notification) should just focus it,
|
|
1258
|
+
// not reset it back to the default size/position.
|
|
1259
|
+
preserveExistingNodeFrame: existingInstanceId !== null,
|
|
1260
|
+
reuseDockEntryNode,
|
|
1261
|
+
title,
|
|
1262
|
+
typeId: agentGuiWorkbenchTypeId
|
|
1263
|
+
};
|
|
1264
|
+
}
|
|
1265
|
+
};
|
|
1266
|
+
}
|
|
1267
|
+
function hasAgentSessionId2(payload) {
|
|
1268
|
+
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
1269
|
+
return false;
|
|
1270
|
+
}
|
|
1271
|
+
return typeof payload.agentSessionId === "string" && payload.agentSessionId.trim().length > 0;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1304
1274
|
export {
|
|
1275
|
+
resolveAgentGuiSessionProviderFlatIconUrl,
|
|
1305
1276
|
AGENT_GUI_CONVERSATION_RAIL_MIN_WIDTH_PX,
|
|
1306
1277
|
AGENT_GUI_DETAIL_MIN_WIDTH_PX,
|
|
1307
1278
|
AGENT_GUI_COLLAPSED_MIN_WIDTH_PX,
|
|
1279
|
+
AGENT_GUI_STANDALONE_AUTO_COLLAPSE_WIDTH_PX,
|
|
1280
|
+
AGENT_GUI_EXPANDED_TARGET_WIDTH_PX,
|
|
1308
1281
|
shouldAutoCollapseAgentGUIConversationRail,
|
|
1309
1282
|
resolveAgentGUIConversationRailMaxWidthPx,
|
|
1310
1283
|
clampAgentGUIConversationRailWidthPx,
|
|
1311
1284
|
resolveNextAgentGUIConversationRailWidthPx,
|
|
1312
1285
|
resolveAgentGUIExpandedWindowFrame,
|
|
1313
|
-
agentGuiDockIconUrl,
|
|
1314
|
-
agentGuiDockIconUrls,
|
|
1315
|
-
resolveAgentGuiSessionProviderFlatIconUrl,
|
|
1316
1286
|
AgentGuiWorkbenchHeader,
|
|
1317
|
-
normalizeAgentGUIAgents,
|
|
1318
|
-
resolveAgentGUISelectedDirectoryAgent,
|
|
1319
|
-
projectAgentGUIAgentsToInternalTargets,
|
|
1320
1287
|
agentGuiWorkbenchDefaultNodeFrame,
|
|
1321
1288
|
agentGuiWorkbenchDefaultUsableWidthRatio,
|
|
1322
1289
|
agentGuiWorkbenchDefaultUsableHeightRatio,
|
|
1323
1290
|
agentGuiWorkbenchCompactVisibleAreaRatio,
|
|
1324
1291
|
agentGuiWorkbenchNewWindowCascadeOffset,
|
|
1325
1292
|
agentGuiWorkbenchProviderRailWidthPx,
|
|
1326
|
-
AGENT_GUI_WORKBENCH_CONVERSATION_RAIL_TOGGLE_EVENT,
|
|
1327
|
-
AGENT_GUI_WORKBENCH_NEW_CONVERSATION_EVENT,
|
|
1328
|
-
AGENT_GUI_WORKBENCH_OPEN_EXTERNAL_IMPORT_EVENT,
|
|
1329
1293
|
agentGuiWorkbenchDefaultCopy,
|
|
1330
|
-
createAgentGuiWorkbenchContribution,
|
|
1331
1294
|
buildAgentGuiDockEntries,
|
|
1332
1295
|
resolveAgentGuiUnifiedDockLaunchPayload,
|
|
1333
1296
|
resolveAgentGuiWorkbenchDefaultLaunchFrame,
|
|
1334
|
-
resolveAgentGuiWorkbenchContributionCopy
|
|
1297
|
+
resolveAgentGuiWorkbenchContributionCopy,
|
|
1298
|
+
AGENT_GUI_WORKBENCH_CONVERSATION_RAIL_TOGGLE_EVENT,
|
|
1299
|
+
AGENT_GUI_WORKBENCH_NEW_CONVERSATION_EVENT,
|
|
1300
|
+
AGENT_GUI_WORKBENCH_OPEN_EXTERNAL_IMPORT_EVENT,
|
|
1301
|
+
createAgentGuiWorkbenchContribution
|
|
1335
1302
|
};
|
|
1336
|
-
//# sourceMappingURL=chunk-
|
|
1303
|
+
//# sourceMappingURL=chunk-RE4AXS27.js.map
|