@tutti-os/agent-gui 0.0.93 → 0.0.95
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 +48 -32
- package/dist/AgentGUI-CwBLYtv-.d.ts +992 -0
- package/dist/agent-conversation/index.d.ts +5 -7
- package/dist/agent-conversation/index.js +13 -9
- package/dist/agent-conversation/index.js.map +1 -1
- package/dist/agent-env/index.d.ts +14 -38
- 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 +145 -122
- package/dist/agent-message-center/index.js +1473 -1398
- package/dist/agent-message-center/index.js.map +1 -1
- package/dist/{agentConversationVM-CfXN_TQ2.d.ts → agentConversationVM-C335TR6S.d.ts} +112 -7
- package/dist/agentFileMentionContracts-Czvz6YMI.d.ts +107 -0
- package/dist/{agentGuiNodeTypes-rGaDqxVR.d.ts → agentGuiNodeTypes-DppADPHW.d.ts} +102 -149
- 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 +431 -75
- package/dist/app/renderer/assets/icons/agent-vinyl-player-chassis.png +0 -0
- package/dist/app/renderer/assets/icons/agent-vinyl-tonearm.png +0 -0
- package/dist/app/renderer/assets/icons/agent-vinyls/claude-vinyl.png +0 -0
- package/dist/app/renderer/assets/icons/agent-vinyls/codex-vinyl.png +0 -0
- package/dist/app/renderer/assets/icons/agent-vinyls/cursor-vinyl.png +0 -0
- package/dist/app/renderer/assets/icons/agent-vinyls/hermes-vinyl.png +0 -0
- package/dist/app/renderer/assets/icons/agent-vinyls/openclaw-vinyl.png +0 -0
- package/dist/app/renderer/assets/icons/agent-vinyls/opencode-vinyl.png +0 -0
- 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-7QHBFRG5.js → chunk-3R2D4E57.js} +3137 -3396
- package/dist/chunk-3R2D4E57.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-IBIMGLCD.js → chunk-7J4K6WKB.js} +1 -1
- package/dist/chunk-7J4K6WKB.js.map +1 -0
- package/dist/{chunk-KQE5KV2V.js → chunk-7PFDA2HQ.js} +505 -504
- package/dist/chunk-7PFDA2HQ.js.map +1 -0
- package/dist/{chunk-M2LWH54R.js → chunk-7RDD3EWP.js} +557 -569
- package/dist/chunk-7RDD3EWP.js.map +1 -0
- package/dist/{chunk-VWXFFSIM.js → chunk-AOS2VWU6.js} +1357 -1301
- package/dist/chunk-AOS2VWU6.js.map +1 -0
- package/dist/{chunk-3HARXLAZ.js → chunk-BFNJKTDV.js} +295 -255
- package/dist/chunk-BFNJKTDV.js.map +1 -0
- package/dist/{chunk-U7D7G3UU.js → chunk-BIHBXWK5.js} +2 -2
- package/dist/{chunk-XQUUELKF.js → chunk-C5FV4UGI.js} +2921 -2944
- package/dist/chunk-C5FV4UGI.js.map +1 -0
- package/dist/{chunk-HOSX5C5V.js → chunk-CRO2MV2Y.js} +36 -46
- package/dist/chunk-CRO2MV2Y.js.map +1 -0
- package/dist/chunk-FGLQZ6I4.js +9 -0
- package/dist/chunk-FGLQZ6I4.js.map +1 -0
- package/dist/chunk-H6IQ63DQ.js +14 -0
- package/dist/chunk-H6IQ63DQ.js.map +1 -0
- package/dist/{chunk-4SQNOOJ3.js → chunk-JX2SIXNL.js} +1293 -1702
- package/dist/chunk-JX2SIXNL.js.map +1 -0
- package/dist/chunk-KAL4XZMA.js +231 -0
- package/dist/chunk-KAL4XZMA.js.map +1 -0
- package/dist/chunk-KJQERFKX.js +259 -0
- package/dist/chunk-KJQERFKX.js.map +1 -0
- package/dist/chunk-LQVXBT65.js +491 -0
- package/dist/chunk-LQVXBT65.js.map +1 -0
- package/dist/{chunk-AOVPGJBC.js → chunk-NITOD7WF.js} +2 -2
- package/dist/{chunk-7LMJXF4R.js → chunk-NJAZ7LQM.js} +20 -16
- package/dist/chunk-NJAZ7LQM.js.map +1 -0
- package/dist/chunk-NX3CZJXW.js +25 -0
- package/dist/chunk-NX3CZJXW.js.map +1 -0
- package/dist/chunk-O6W72SEP.js +93 -0
- package/dist/chunk-O6W72SEP.js.map +1 -0
- package/dist/{chunk-PSLAWU25.js → chunk-R2EWECUP.js} +7 -1
- package/dist/chunk-R2EWECUP.js.map +1 -0
- package/dist/chunk-RY6GIO3K.js +31700 -0
- package/dist/chunk-RY6GIO3K.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-XW4CVBUH.js → chunk-UQJPV6HP.js} +18 -11
- package/dist/chunk-UQJPV6HP.js.map +1 -0
- package/dist/{chunk-GAPTLVII.js → chunk-VF22EG3F.js} +1 -1
- package/dist/{chunk-GAPTLVII.js.map → chunk-VF22EG3F.js.map} +1 -1
- package/dist/{chunk-45FF4DQU.js → chunk-WEDMAVX2.js} +22 -24
- package/dist/chunk-WEDMAVX2.js.map +1 -0
- package/dist/{chunk-SXDLSEHO.js → chunk-XMO45GKA.js} +531 -401
- package/dist/chunk-XMO45GKA.js.map +1 -0
- package/dist/{chunk-UNO7CEAF.js → chunk-YE25HN6T.js} +6 -9
- package/dist/chunk-YE25HN6T.js.map +1 -0
- package/dist/context-mention-palette/index.d.ts +3 -2
- package/dist/context-mention-palette/index.js +19 -14
- package/dist/custom-mention.d.ts +44 -0
- package/dist/custom-mention.js +17 -0
- package/dist/custom-mention.js.map +1 -0
- package/dist/dock-icons.d.ts +6 -0
- package/dist/dock-icons.js +11 -0
- package/dist/dock-icons.js.map +1 -0
- package/dist/i18n/index.d.ts +852 -837
- package/dist/i18n/index.js +2 -2
- package/dist/index.d.ts +52 -1061
- package/dist/index.js +72 -35254
- 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/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/{types-PLFZ8SBX.d.ts → types-DX2bxgB8.d.ts} +28 -83
- package/dist/workbench/contribution.d.ts +32 -40
- package/dist/workbench/contribution.js +10 -6
- package/dist/workbench/index.d.ts +6 -2
- package/dist/workbench/index.js +24 -20
- package/dist/workbench/launch.d.ts +2 -5
- package/dist/workbench/launch.js +4 -3
- package/dist/workbench/providerCatalog.js +2 -1
- package/dist/workbench/sessionTitle.d.ts +4 -3
- package/dist/workbench/sessionTitle.js +4 -3
- package/dist/workbench/state.d.ts +1 -1
- package/dist/workbench/state.js +3 -2
- package/dist/workbench/types.d.ts +0 -3
- package/dist/workbench/types.js +1 -1
- package/dist/workspace-agent-generated-files.d.ts +20 -2
- package/dist/workspace-agent-generated-files.js +7 -6
- package/dist/workspaceAgentActivityListTypes-C7gPWYiA.d.ts +71 -0
- package/package.json +65 -28
- package/dist/AgentMentionSearchController-DD_WOred.d.ts +0 -241
- package/dist/AgentMessageMarkdown-DeYPURtF.d.ts +0 -7
- package/dist/chunk-3HARXLAZ.js.map +0 -1
- 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-4SQNOOJ3.js.map +0 -1
- package/dist/chunk-7LMJXF4R.js.map +0 -1
- package/dist/chunk-7QHBFRG5.js.map +0 -1
- package/dist/chunk-HOSX5C5V.js.map +0 -1
- package/dist/chunk-IBIMGLCD.js.map +0 -1
- package/dist/chunk-KQE5KV2V.js.map +0 -1
- package/dist/chunk-LR4FA5X6.js +0 -368
- package/dist/chunk-LR4FA5X6.js.map +0 -1
- package/dist/chunk-M2LWH54R.js.map +0 -1
- package/dist/chunk-MKHDRIGN.js +0 -71
- package/dist/chunk-MKHDRIGN.js.map +0 -1
- package/dist/chunk-PSLAWU25.js.map +0 -1
- package/dist/chunk-SXDLSEHO.js.map +0 -1
- package/dist/chunk-UNO7CEAF.js.map +0 -1
- package/dist/chunk-VAKFNNKT.js +0 -410
- package/dist/chunk-VAKFNNKT.js.map +0 -1
- package/dist/chunk-VWXFFSIM.js.map +0 -1
- package/dist/chunk-XDV4ZRVK.js.map +0 -1
- package/dist/chunk-XQUUELKF.js.map +0 -1
- package/dist/chunk-XW4CVBUH.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/workspaceAgentActivityListViewModel-TXH1VXrk.d.ts +0 -339
- 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-U7D7G3UU.js.map → chunk-BIHBXWK5.js.map} +0 -0
- /package/dist/{chunk-AOVPGJBC.js.map → chunk-NITOD7WF.js.map} +0 -0
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
agentGuiWorkbenchDockIdentityFromIdentifier,
|
|
3
|
+
agentGuiWorkbenchProviderFromIdentifier,
|
|
4
|
+
agentGuiWorkbenchTypeId,
|
|
5
|
+
agentGuiWorkbenchUnifiedDockEntryId,
|
|
6
|
+
createAgentGuiWorkbenchLaunchDescriptor
|
|
7
|
+
} from "./chunk-NJAZ7LQM.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-WEDMAVX2.js";
|
|
16
16
|
import {
|
|
17
17
|
agentGuiWorkbenchDefaultDockProviders,
|
|
18
18
|
isAgentGuiWorkbenchProvider,
|
|
19
19
|
resolveAgentGuiWorkbenchProviderLabel
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-UQJPV6HP.js";
|
|
21
|
+
import {
|
|
22
|
+
normalizeAgentGUIAgents,
|
|
23
|
+
projectAgentGUIAgentsToInternalTargets
|
|
24
|
+
} from "./chunk-O6W72SEP.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) {
|
|
@@ -118,66 +118,18 @@ function resolveAgentGUIExpandedWindowFrame(input) {
|
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
120
|
|
|
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
121
|
// agentGuiSessionProviderIconUrls.ts
|
|
150
122
|
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
|
-
}
|
|
123
|
+
const identity = resolveAgentGUIProviderCatalogIdentity(
|
|
124
|
+
normalizeManagedAgentProvider(provider)
|
|
125
|
+
);
|
|
126
|
+
return resolveProviderIconAsset(identity?.iconKey, "sessionColorful");
|
|
165
127
|
}
|
|
166
128
|
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
|
-
}
|
|
129
|
+
const identity = resolveAgentGUIProviderCatalogIdentity(
|
|
130
|
+
normalizeManagedAgentProvider(provider)
|
|
131
|
+
);
|
|
132
|
+
return resolveProviderIconAsset(identity?.iconKey, "sessionFlat");
|
|
181
133
|
}
|
|
182
134
|
|
|
183
135
|
// workbench/bodyRenderErrorRegistry.ts
|
|
@@ -227,7 +179,6 @@ import {
|
|
|
227
179
|
createElement,
|
|
228
180
|
useState
|
|
229
181
|
} from "react";
|
|
230
|
-
import { ExternalLink } from "lucide-react";
|
|
231
182
|
import {
|
|
232
183
|
Button,
|
|
233
184
|
PanelIcon,
|
|
@@ -238,6 +189,11 @@ import {
|
|
|
238
189
|
cn
|
|
239
190
|
} from "@tutti-os/ui-system";
|
|
240
191
|
import { CreateChatIcon } from "@tutti-os/ui-system/icons";
|
|
192
|
+
|
|
193
|
+
// app/renderer/assets/icons/open-link-lined.svg
|
|
194
|
+
var open_link_lined_default = "./open-link-lined-JWEKUKME.svg";
|
|
195
|
+
|
|
196
|
+
// workbench/header.ts
|
|
241
197
|
var headerChromeIconButtonClassName = "agent-gui-workbench-header__icon-button";
|
|
242
198
|
var conversationRailToggleButtonClassName = "agent-gui-workbench-header__icon-button agent-gui-workbench-header__rail-toggle";
|
|
243
199
|
var detachedWindowButtonClassName = "agent-gui-workbench-header__icon-button agent-gui-workbench-header__detached-window";
|
|
@@ -253,11 +209,15 @@ function AgentGuiWorkbenchHeader({
|
|
|
253
209
|
conversationIconUrl,
|
|
254
210
|
conversationIconFallbackUrl,
|
|
255
211
|
providerRailWidthPx,
|
|
212
|
+
primaryAccessory,
|
|
213
|
+
secondaryAccessory,
|
|
256
214
|
conversationTitle,
|
|
257
215
|
nodeId,
|
|
258
216
|
onCreateConversation,
|
|
259
217
|
onOpenDetachedWindow,
|
|
260
218
|
onToggleConversationRail,
|
|
219
|
+
showAppTitle = true,
|
|
220
|
+
showConversationRailToggle = true,
|
|
261
221
|
showWindowControls = true,
|
|
262
222
|
title: _title,
|
|
263
223
|
windowActions,
|
|
@@ -327,7 +287,7 @@ function AgentGuiWorkbenchHeader({
|
|
|
327
287
|
tone: "maximize"
|
|
328
288
|
})
|
|
329
289
|
) : null,
|
|
330
|
-
!isConversationRailCollapsed ? createElement(
|
|
290
|
+
showAppTitle && !isConversationRailCollapsed ? createElement(
|
|
331
291
|
"div",
|
|
332
292
|
{
|
|
333
293
|
className: "agent-gui-workbench-header__agent-brand"
|
|
@@ -340,52 +300,27 @@ function AgentGuiWorkbenchHeader({
|
|
|
340
300
|
appTitle
|
|
341
301
|
)
|
|
342
302
|
) : null,
|
|
303
|
+
primaryAccessory ? createElement(
|
|
304
|
+
"div",
|
|
305
|
+
{
|
|
306
|
+
className: "agent-gui-workbench-header__primary-accessory"
|
|
307
|
+
},
|
|
308
|
+
primaryAccessory
|
|
309
|
+
) : null,
|
|
343
310
|
onOpenDetachedWindow && !hasBodyRenderError ? createDetachedWindowButton({
|
|
344
311
|
label: copy.openDetachedWindow ?? "Open in detached window",
|
|
345
312
|
onOpenDetachedWindow
|
|
346
313
|
}) : null,
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
type: "button",
|
|
358
|
-
variant: "ghost",
|
|
359
|
-
onClick: (event) => {
|
|
360
|
-
event.stopPropagation();
|
|
361
|
-
onToggleConversationRail(!isConversationRailCollapsed);
|
|
362
|
-
},
|
|
363
|
-
onDoubleClick: (event) => event.stopPropagation(),
|
|
364
|
-
onPointerDown: (event) => event.stopPropagation()
|
|
365
|
-
},
|
|
366
|
-
createElement(PanelIcon, { className: headerChromeIconClassName })
|
|
367
|
-
),
|
|
368
|
-
isConversationRailCollapsed && onCreateConversation ? createElement(
|
|
369
|
-
Button,
|
|
370
|
-
{
|
|
371
|
-
"aria-label": copy.newConversation,
|
|
372
|
-
className: headerChromeIconButtonClassName,
|
|
373
|
-
size: "icon-sm",
|
|
374
|
-
title: copy.newConversation,
|
|
375
|
-
type: "button",
|
|
376
|
-
variant: "ghost",
|
|
377
|
-
onClick: (event) => {
|
|
378
|
-
event.stopPropagation();
|
|
379
|
-
onCreateConversation();
|
|
380
|
-
},
|
|
381
|
-
onDoubleClick: (event) => event.stopPropagation(),
|
|
382
|
-
onPointerDown: (event) => event.stopPropagation()
|
|
383
|
-
},
|
|
384
|
-
createElement(CreateChatIcon, {
|
|
385
|
-
"aria-hidden": true,
|
|
386
|
-
className: headerChromeIconClassName
|
|
387
|
-
})
|
|
388
|
-
) : null,
|
|
314
|
+
showConversationRailToggle ? createConversationRailToggleButton({
|
|
315
|
+
isAutoCollapsed: isConversationRailAutoCollapsed,
|
|
316
|
+
isCollapsed: isConversationRailCollapsed,
|
|
317
|
+
label: toggleLabel,
|
|
318
|
+
onToggleConversationRail
|
|
319
|
+
}) : null,
|
|
320
|
+
isConversationRailCollapsed && onCreateConversation ? createNewConversationButton({
|
|
321
|
+
label: copy.newConversation,
|
|
322
|
+
onCreateConversation
|
|
323
|
+
}) : null,
|
|
389
324
|
isConversationRailCollapsed && sessionTitle ? createElement(
|
|
390
325
|
"span",
|
|
391
326
|
{
|
|
@@ -403,29 +338,86 @@ function AgentGuiWorkbenchHeader({
|
|
|
403
338
|
},
|
|
404
339
|
sessionTitle
|
|
405
340
|
)
|
|
341
|
+
) : null,
|
|
342
|
+
isConversationRailCollapsed && secondaryAccessory ? createElement(
|
|
343
|
+
"div",
|
|
344
|
+
{
|
|
345
|
+
className: "agent-gui-workbench-header__secondary-accessory"
|
|
346
|
+
},
|
|
347
|
+
secondaryAccessory
|
|
406
348
|
) : null
|
|
407
349
|
),
|
|
408
|
-
!isConversationRailCollapsed && sessionTitle ? createElement(
|
|
350
|
+
!isConversationRailCollapsed && (sessionTitle || secondaryAccessory) ? createElement(
|
|
409
351
|
"div",
|
|
410
352
|
{
|
|
411
|
-
className: "agent-gui-workbench-header__detail
|
|
412
|
-
"data-testid": "agent-gui-window-detail-title"
|
|
353
|
+
className: "agent-gui-workbench-header__detail"
|
|
413
354
|
},
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
src: sessionIconUrl,
|
|
417
|
-
testId: "agent-gui-window-detail-title-icon"
|
|
418
|
-
}),
|
|
419
|
-
createElement(
|
|
420
|
-
"span",
|
|
355
|
+
sessionTitle ? createElement(
|
|
356
|
+
"div",
|
|
421
357
|
{
|
|
422
|
-
className: "agent-gui-workbench-
|
|
358
|
+
className: "agent-gui-workbench-header__detail-title",
|
|
359
|
+
"data-testid": "agent-gui-window-detail-title"
|
|
423
360
|
},
|
|
424
|
-
|
|
425
|
-
|
|
361
|
+
createSessionHeaderIconSlot({
|
|
362
|
+
fallbackSrc: sessionIconFallbackUrl,
|
|
363
|
+
src: sessionIconUrl,
|
|
364
|
+
testId: "agent-gui-window-detail-title-icon"
|
|
365
|
+
}),
|
|
366
|
+
createElement(
|
|
367
|
+
"span",
|
|
368
|
+
{
|
|
369
|
+
className: "agent-gui-workbench-header__title-text"
|
|
370
|
+
},
|
|
371
|
+
sessionTitle
|
|
372
|
+
)
|
|
373
|
+
) : null,
|
|
374
|
+
secondaryAccessory ? createElement(
|
|
375
|
+
"div",
|
|
376
|
+
{
|
|
377
|
+
className: "agent-gui-workbench-header__secondary-accessory"
|
|
378
|
+
},
|
|
379
|
+
secondaryAccessory
|
|
380
|
+
) : null
|
|
426
381
|
) : null
|
|
427
382
|
);
|
|
428
383
|
}
|
|
384
|
+
function createConversationRailToggleButton({
|
|
385
|
+
isAutoCollapsed,
|
|
386
|
+
isCollapsed,
|
|
387
|
+
label,
|
|
388
|
+
onToggleConversationRail
|
|
389
|
+
}) {
|
|
390
|
+
const button = createElement(
|
|
391
|
+
Button,
|
|
392
|
+
{
|
|
393
|
+
"aria-label": label,
|
|
394
|
+
className: conversationRailToggleButtonClassName,
|
|
395
|
+
"data-agent-gui-conversation-rail-auto-collapsed": isAutoCollapsed ? "true" : void 0,
|
|
396
|
+
"data-agent-gui-conversation-rail-collapsed": isCollapsed ? "true" : void 0,
|
|
397
|
+
"data-testid": "agent-gui-toggle-conversation-rail",
|
|
398
|
+
size: "icon-sm",
|
|
399
|
+
type: "button",
|
|
400
|
+
variant: "ghost",
|
|
401
|
+
onClick: (event) => {
|
|
402
|
+
event.stopPropagation();
|
|
403
|
+
onToggleConversationRail(!isCollapsed);
|
|
404
|
+
},
|
|
405
|
+
onDoubleClick: (event) => event.stopPropagation(),
|
|
406
|
+
onPointerDown: (event) => event.stopPropagation()
|
|
407
|
+
},
|
|
408
|
+
createElement(PanelIcon, { className: headerChromeIconClassName })
|
|
409
|
+
);
|
|
410
|
+
return createElement(TooltipProvider, {
|
|
411
|
+
children: createElement(
|
|
412
|
+
Tooltip,
|
|
413
|
+
null,
|
|
414
|
+
createElement(TooltipTrigger, { asChild: true }, button),
|
|
415
|
+
createElement(TooltipContent, { side: "bottom" }, label)
|
|
416
|
+
),
|
|
417
|
+
delayDuration: 250,
|
|
418
|
+
skipDelayDuration: 0
|
|
419
|
+
});
|
|
420
|
+
}
|
|
429
421
|
function createDetachedWindowButton({
|
|
430
422
|
label,
|
|
431
423
|
onOpenDetachedWindow
|
|
@@ -446,7 +438,55 @@ function createDetachedWindowButton({
|
|
|
446
438
|
onDoubleClick: (event) => event.stopPropagation(),
|
|
447
439
|
onPointerDown: (event) => event.stopPropagation()
|
|
448
440
|
},
|
|
449
|
-
createElement(
|
|
441
|
+
createElement("span", {
|
|
442
|
+
"aria-hidden": true,
|
|
443
|
+
className: headerChromeIconClassName,
|
|
444
|
+
"data-agent-gui-icon": "open-link-lined",
|
|
445
|
+
style: {
|
|
446
|
+
backgroundColor: "currentColor",
|
|
447
|
+
display: "block",
|
|
448
|
+
WebkitMaskImage: `url("${open_link_lined_default}")`,
|
|
449
|
+
WebkitMaskPosition: "center",
|
|
450
|
+
WebkitMaskRepeat: "no-repeat",
|
|
451
|
+
WebkitMaskSize: "contain",
|
|
452
|
+
maskImage: `url("${open_link_lined_default}")`,
|
|
453
|
+
maskPosition: "center",
|
|
454
|
+
maskRepeat: "no-repeat",
|
|
455
|
+
maskSize: "contain"
|
|
456
|
+
}
|
|
457
|
+
})
|
|
458
|
+
);
|
|
459
|
+
return createElement(TooltipProvider, {
|
|
460
|
+
children: createElement(
|
|
461
|
+
Tooltip,
|
|
462
|
+
null,
|
|
463
|
+
createElement(TooltipTrigger, { asChild: true }, button),
|
|
464
|
+
createElement(TooltipContent, { side: "bottom" }, label)
|
|
465
|
+
),
|
|
466
|
+
delayDuration: 250,
|
|
467
|
+
skipDelayDuration: 0
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
function createNewConversationButton({
|
|
471
|
+
label,
|
|
472
|
+
onCreateConversation
|
|
473
|
+
}) {
|
|
474
|
+
const button = createElement(
|
|
475
|
+
Button,
|
|
476
|
+
{
|
|
477
|
+
"aria-label": label,
|
|
478
|
+
className: headerChromeIconButtonClassName,
|
|
479
|
+
size: "icon-sm",
|
|
480
|
+
type: "button",
|
|
481
|
+
variant: "ghost",
|
|
482
|
+
onClick: (event) => {
|
|
483
|
+
event.stopPropagation();
|
|
484
|
+
onCreateConversation();
|
|
485
|
+
},
|
|
486
|
+
onDoubleClick: (event) => event.stopPropagation(),
|
|
487
|
+
onPointerDown: (event) => event.stopPropagation()
|
|
488
|
+
},
|
|
489
|
+
createElement(CreateChatIcon, {
|
|
450
490
|
"aria-hidden": true,
|
|
451
491
|
className: headerChromeIconClassName
|
|
452
492
|
})
|
|
@@ -558,93 +598,11 @@ var trafficLightIconPathByName = {
|
|
|
558
598
|
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"
|
|
559
599
|
};
|
|
560
600
|
|
|
561
|
-
//
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
const agentTargetId = agent.agentTargetId.trim();
|
|
567
|
-
const name = agent.name.trim();
|
|
568
|
-
const iconUrl = agent.iconUrl.trim();
|
|
569
|
-
if (!agentTargetId || !name || !iconUrl || seenAgentTargetIds.has(agentTargetId)) {
|
|
570
|
-
continue;
|
|
571
|
-
}
|
|
572
|
-
seenAgentTargetIds.add(agentTargetId);
|
|
573
|
-
const ownerName = agent.owner?.name?.trim() ?? "";
|
|
574
|
-
const ownerAvatarUrl = agent.owner?.avatarUrl?.trim() ?? "";
|
|
575
|
-
const reason = agent.availability.reason?.trim() ?? "";
|
|
576
|
-
normalized.push({
|
|
577
|
-
agentTargetId,
|
|
578
|
-
name,
|
|
579
|
-
iconUrl,
|
|
580
|
-
...agent.description?.trim() ? { description: agent.description.trim() } : {},
|
|
581
|
-
...ownerName || ownerAvatarUrl ? {
|
|
582
|
-
owner: {
|
|
583
|
-
...ownerName ? { name: ownerName } : {},
|
|
584
|
-
...ownerAvatarUrl ? { avatarUrl: ownerAvatarUrl } : {}
|
|
585
|
-
}
|
|
586
|
-
} : {},
|
|
587
|
-
availability: {
|
|
588
|
-
status: normalizeAgentGUIAgentAvailabilityStatus(
|
|
589
|
-
agent.availability.status
|
|
590
|
-
),
|
|
591
|
-
...reason ? { reason } : {},
|
|
592
|
-
...agent.availability.pendingAction ? { pendingAction: agent.availability.pendingAction } : {}
|
|
593
|
-
},
|
|
594
|
-
provider: agent.provider
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
return normalized;
|
|
598
|
-
}
|
|
599
|
-
function agentGUIAgentIsReady(agent) {
|
|
600
|
-
return agent.availability.status === "ready";
|
|
601
|
-
}
|
|
602
|
-
function resolveAgentGUISelectedDirectoryAgent(input) {
|
|
603
|
-
const explicitAgentTargetId = input.agentTargetId?.trim() || input.defaultAgentTargetId?.trim() || "";
|
|
604
|
-
if (explicitAgentTargetId) {
|
|
605
|
-
return input.agents.find(
|
|
606
|
-
(agent) => agent.agentTargetId === explicitAgentTargetId
|
|
607
|
-
) ?? null;
|
|
608
|
-
}
|
|
609
|
-
return input.agents.find((agent) => agentGUIAgentIsReady(agent)) ?? input.agents[0] ?? null;
|
|
610
|
-
}
|
|
611
|
-
function projectAgentGUIAgentsToInternalTargets(agents) {
|
|
612
|
-
return agents.map((agent) => ({
|
|
613
|
-
targetId: agent.agentTargetId,
|
|
614
|
-
agentTargetId: agent.agentTargetId,
|
|
615
|
-
provider: agent.provider,
|
|
616
|
-
ref: {
|
|
617
|
-
kind: "agent-directory",
|
|
618
|
-
provider: agent.provider,
|
|
619
|
-
agentTargetId: agent.agentTargetId
|
|
620
|
-
},
|
|
621
|
-
label: agent.name,
|
|
622
|
-
...agent.description ? { description: agent.description } : {},
|
|
623
|
-
iconUrl: agent.iconUrl,
|
|
624
|
-
...agent.owner?.avatarUrl ? {
|
|
625
|
-
badge: {
|
|
626
|
-
iconUrl: agent.owner.avatarUrl,
|
|
627
|
-
...agent.owner.name ? { label: agent.owner.name } : {}
|
|
628
|
-
}
|
|
629
|
-
} : {},
|
|
630
|
-
...agent.owner?.name ? { ownerLabel: agent.owner.name } : {},
|
|
631
|
-
...agent.availability.status !== "ready" ? { disabled: true } : {},
|
|
632
|
-
...agent.availability.reason ? { unavailableReason: agent.availability.reason } : {}
|
|
633
|
-
}));
|
|
634
|
-
}
|
|
635
|
-
function normalizeAgentGUIAgentAvailabilityStatus(status) {
|
|
636
|
-
switch (status) {
|
|
637
|
-
case "ready":
|
|
638
|
-
case "checking":
|
|
639
|
-
case "coming_soon":
|
|
640
|
-
case "not_installed":
|
|
641
|
-
case "auth_required":
|
|
642
|
-
case "unavailable":
|
|
643
|
-
return status;
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
// workbench/contribution.ts
|
|
601
|
+
// workbench/contributionDock.tsx
|
|
602
|
+
import { createElement as createElement2 } from "react";
|
|
603
|
+
import {
|
|
604
|
+
getWorkbenchLayoutFrame
|
|
605
|
+
} from "@tutti-os/workbench-surface";
|
|
648
606
|
var agentGuiWorkbenchDefaultNodeFrame = {
|
|
649
607
|
height: 560,
|
|
650
608
|
width: 1040,
|
|
@@ -662,13 +620,10 @@ var agentGuiWorkbenchUnifiedDockTileProviders = [
|
|
|
662
620
|
"tutti-agent",
|
|
663
621
|
"hermes"
|
|
664
622
|
];
|
|
665
|
-
var AGENT_GUI_WORKBENCH_CONVERSATION_RAIL_TOGGLE_EVENT = "tutti:agent-gui-workbench-conversation-rail-toggle";
|
|
666
|
-
var AGENT_GUI_WORKBENCH_NEW_CONVERSATION_EVENT = "tutti:agent-gui-workbench-new-conversation";
|
|
667
|
-
var AGENT_GUI_WORKBENCH_OPEN_EXTERNAL_IMPORT_EVENT = "tutti:agent-gui-workbench-open-external-import";
|
|
668
623
|
var agentGuiWorkbenchDefaultCopy = {
|
|
669
|
-
collapseConversationRail: "
|
|
624
|
+
collapseConversationRail: "Hide sidebar",
|
|
670
625
|
close: "Close",
|
|
671
|
-
expandConversationRail: "
|
|
626
|
+
expandConversationRail: "Show sidebar",
|
|
672
627
|
fallbackAgentLabel: "Agent",
|
|
673
628
|
maximize: "Maximize",
|
|
674
629
|
minimize: "Minimize",
|
|
@@ -677,293 +632,26 @@ var agentGuiWorkbenchDefaultCopy = {
|
|
|
677
632
|
openDetachedWindow: "Open in detached window",
|
|
678
633
|
restore: "Restore"
|
|
679
634
|
};
|
|
680
|
-
function
|
|
681
|
-
const
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
const
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
}),
|
|
701
|
-
externalStateSource: nodeStateSource.externalStateSource,
|
|
702
|
-
id: input.id ?? "workspace-agent-gui",
|
|
703
|
-
nodes: [
|
|
704
|
-
{
|
|
705
|
-
frame,
|
|
706
|
-
instance: { mode: "multi" },
|
|
707
|
-
onBodyRenderErrorChange: ({ hasError, node }) => {
|
|
708
|
-
setAgentGuiWorkbenchBodyRenderError(node.id, hasError);
|
|
709
|
-
},
|
|
710
|
-
renderBody: (context) => input.renderBody(
|
|
711
|
-
context,
|
|
712
|
-
{
|
|
713
|
-
nodeTypeId: agentGuiWorkbenchTypeId,
|
|
714
|
-
onStateChange: (state) => {
|
|
715
|
-
nodeStateSource.writeNodeState({
|
|
716
|
-
instanceId: context.instanceId,
|
|
717
|
-
nodeId: context.node.id,
|
|
718
|
-
state,
|
|
719
|
-
typeId: agentGuiWorkbenchTypeId
|
|
720
|
-
});
|
|
721
|
-
},
|
|
722
|
-
provider: providerFromActivation(context.activation) ?? agentGuiWorkbenchProviderFromInstanceId(context.instanceId)
|
|
723
|
-
}
|
|
724
|
-
),
|
|
725
|
-
renderHeader: ({
|
|
726
|
-
activation,
|
|
727
|
-
dragHandleProps,
|
|
728
|
-
displayMode,
|
|
729
|
-
externalNodeState,
|
|
730
|
-
instanceId,
|
|
731
|
-
isFocused,
|
|
732
|
-
node,
|
|
733
|
-
surfaceSize,
|
|
734
|
-
windowActions
|
|
735
|
-
}) => {
|
|
736
|
-
const provider = providerFromActivation(activation) ?? agentGuiWorkbenchProviderFromInstanceId(instanceId);
|
|
737
|
-
const headerTitle = copy.nodeTitle;
|
|
738
|
-
const rawWorkbenchState = externalNodeState ?? node.data.runtimeNodeState;
|
|
739
|
-
const migratedWorkbenchState = migrateLegacyAgentGuiWorkbenchState(rawWorkbenchState);
|
|
740
|
-
const workbenchState = normalizeAgentGuiWorkbenchState(
|
|
741
|
-
migratedWorkbenchState
|
|
742
|
-
);
|
|
743
|
-
const nodeState = normalizeAgentGuiWorkbenchNodeState(
|
|
744
|
-
migratedWorkbenchState,
|
|
745
|
-
provider
|
|
746
|
-
);
|
|
747
|
-
const isConversationRailAutoCollapsed = shouldAutoCollapseAgentGUIConversationRail(node.frame.width);
|
|
748
|
-
const isConversationRailCollapsed = nodeState.conversationRailCollapsed === true || isConversationRailAutoCollapsed;
|
|
749
|
-
const conversationRailWidthPx = clampAgentGUIConversationRailWidthPx(
|
|
750
|
-
nodeState.conversationRailWidthPx,
|
|
751
|
-
node.frame.width
|
|
752
|
-
);
|
|
753
|
-
const conversationIdentity = input.resolveDockPopupIdentity?.(workbenchState) ?? null;
|
|
754
|
-
const conversationTitle = conversationIdentity?.title ?? input.resolveDockPopupTitle?.(workbenchState) ?? workbenchState.lastActiveConversationTitle ?? null;
|
|
755
|
-
const iconProvider = providerFromActivation(activation) ?? agentGuiWorkbenchProviderFromInstanceIdOrNull(instanceId);
|
|
756
|
-
const conversationIconFallbackUrl = iconProvider ? resolveAgentGuiSessionProviderIconUrl(iconProvider) ?? resolveAgentGuiWorkbenchProviderIconUrl({
|
|
757
|
-
dockIconUrls: input.dockIconUrls,
|
|
758
|
-
provider: iconProvider
|
|
759
|
-
}) : null;
|
|
760
|
-
const conversationIconUrl = conversationIdentity?.iconUrl ?? conversationIconFallbackUrl;
|
|
761
|
-
const persistConversationRailCollapsed = (collapsed) => {
|
|
762
|
-
nodeStateSource.writeNodeState({
|
|
763
|
-
instanceId,
|
|
764
|
-
nodeId: node.id,
|
|
765
|
-
state: {
|
|
766
|
-
...workbenchState,
|
|
767
|
-
conversationRailCollapsed: collapsed
|
|
768
|
-
},
|
|
769
|
-
typeId: agentGuiWorkbenchTypeId
|
|
770
|
-
});
|
|
771
|
-
};
|
|
772
|
-
const announceConversationRailCollapsed = (collapsed) => {
|
|
773
|
-
window.dispatchEvent(
|
|
774
|
-
new CustomEvent(
|
|
775
|
-
AGENT_GUI_WORKBENCH_CONVERSATION_RAIL_TOGGLE_EVENT,
|
|
776
|
-
{
|
|
777
|
-
detail: {
|
|
778
|
-
conversationRailCollapsed: collapsed,
|
|
779
|
-
instanceId
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
)
|
|
783
|
-
);
|
|
784
|
-
};
|
|
785
|
-
const announceNewConversation = () => {
|
|
786
|
-
window.dispatchEvent(
|
|
787
|
-
new CustomEvent(
|
|
788
|
-
AGENT_GUI_WORKBENCH_NEW_CONVERSATION_EVENT,
|
|
789
|
-
{
|
|
790
|
-
detail: {
|
|
791
|
-
instanceId
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
)
|
|
795
|
-
);
|
|
796
|
-
};
|
|
797
|
-
return createElement2(AgentGuiWorkbenchHeader, {
|
|
798
|
-
copy,
|
|
799
|
-
conversationIconUrl,
|
|
800
|
-
conversationIconFallbackUrl,
|
|
801
|
-
conversationTitle,
|
|
802
|
-
conversationRailWidthPx,
|
|
803
|
-
displayMode,
|
|
804
|
-
isConversationRailAutoCollapsed,
|
|
805
|
-
isConversationRailCollapsed,
|
|
806
|
-
nodeId: node.id,
|
|
807
|
-
providerRailWidthPx: agentGuiWorkbenchProviderRailWidthPx,
|
|
808
|
-
title: headerTitle,
|
|
809
|
-
windowActions: {
|
|
810
|
-
close: windowActions.close,
|
|
811
|
-
minimize: windowActions.minimize,
|
|
812
|
-
toggleDisplayMode: windowActions.toggleDisplayMode
|
|
813
|
-
},
|
|
814
|
-
...dragHandleProps,
|
|
815
|
-
onCreateConversation: announceNewConversation,
|
|
816
|
-
onOpenDetachedWindow: input.onOpenDetachedWindow ? () => {
|
|
817
|
-
void input.onOpenDetachedWindow?.({
|
|
818
|
-
agentSessionId: workbenchState.lastActiveAgentSessionId,
|
|
819
|
-
agentTargetId: nodeState.agentTargetId,
|
|
820
|
-
agents: input.agents ?? void 0,
|
|
821
|
-
provider,
|
|
822
|
-
workspaceId: input.workspaceId
|
|
823
|
-
});
|
|
824
|
-
} : void 0,
|
|
825
|
-
onPointerDown: (event) => {
|
|
826
|
-
dragHandleProps.onPointerDown?.(event);
|
|
827
|
-
if (!isFocused) {
|
|
828
|
-
windowActions.focus();
|
|
829
|
-
}
|
|
830
|
-
},
|
|
831
|
-
onToggleConversationRail: (nextCollapsed) => {
|
|
832
|
-
announceConversationRailCollapsed(nextCollapsed);
|
|
833
|
-
if (isConversationRailCollapsed && nextCollapsed === false && node.displayMode !== "fullscreen") {
|
|
834
|
-
const expandedFrame = resolveAgentGUIExpandedWindowFrame({
|
|
835
|
-
conversationRailWidthPx: nodeState.conversationRailWidthPx,
|
|
836
|
-
desktopSize: surfaceSize,
|
|
837
|
-
height: node.frame.height,
|
|
838
|
-
position: {
|
|
839
|
-
x: node.frame.x,
|
|
840
|
-
y: node.frame.y
|
|
841
|
-
},
|
|
842
|
-
width: node.frame.width
|
|
843
|
-
});
|
|
844
|
-
windowActions.resize({
|
|
845
|
-
...node.frame,
|
|
846
|
-
height: expandedFrame.size.height,
|
|
847
|
-
width: expandedFrame.size.width,
|
|
848
|
-
x: expandedFrame.position.x,
|
|
849
|
-
y: expandedFrame.position.y
|
|
850
|
-
});
|
|
851
|
-
}
|
|
852
|
-
persistConversationRailCollapsed(nextCollapsed);
|
|
853
|
-
}
|
|
854
|
-
});
|
|
855
|
-
},
|
|
856
|
-
title: copy.nodeTitle,
|
|
857
|
-
typeId: agentGuiWorkbenchTypeId,
|
|
858
|
-
window: {
|
|
859
|
-
closable: true,
|
|
860
|
-
defaultOpen: false,
|
|
861
|
-
minimizedDock: {
|
|
862
|
-
kind: "component",
|
|
863
|
-
providePreview: (item) => createAgentGuiWorkbenchPreviewContent({
|
|
864
|
-
item,
|
|
865
|
-
renderPreview: input.renderMinimizedPreview,
|
|
866
|
-
resolveDockPopupTitle: input.resolveDockPopupTitle
|
|
867
|
-
})
|
|
868
|
-
},
|
|
869
|
-
minimizable: true
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
],
|
|
873
|
-
onLaunchRequest: (request) => {
|
|
874
|
-
if (request.typeId !== agentGuiWorkbenchTypeId) {
|
|
875
|
-
return null;
|
|
876
|
-
}
|
|
877
|
-
const launchPayload = resolveAgentGuiWorkbenchLaunchPayload(request, {
|
|
878
|
-
resolveDockLaunchPayload: input.resolveDockLaunchPayload
|
|
879
|
-
});
|
|
880
|
-
const {
|
|
881
|
-
activation,
|
|
882
|
-
dockEntryId,
|
|
883
|
-
instanceId: descriptorInstanceId,
|
|
884
|
-
openInNewWindow,
|
|
885
|
-
reuseDockEntryNode,
|
|
886
|
-
reuseExistingSessionNode,
|
|
887
|
-
targetAgentSessionId
|
|
888
|
-
} = createAgentGuiWorkbenchLaunchDescriptor({
|
|
889
|
-
...request,
|
|
890
|
-
payload: launchPayload
|
|
891
|
-
});
|
|
892
|
-
const existingInstanceId = targetAgentSessionId && reuseExistingSessionNode ? nodeStateSource.findInstanceIdByAgentSessionId(targetAgentSessionId) : null;
|
|
893
|
-
const instanceId = existingInstanceId ?? descriptorInstanceId;
|
|
894
|
-
const title = copy.nodeTitle;
|
|
895
|
-
const launchTarget = agentTargetLaunchPayloadFromRequest(launchPayload);
|
|
896
|
-
const launchAgentTargetId = launchTarget.agentTargetId;
|
|
897
|
-
if (targetAgentSessionId) {
|
|
898
|
-
const previousState = nodeStateSource.readNodeState({
|
|
899
|
-
instanceId,
|
|
900
|
-
typeId: agentGuiWorkbenchTypeId
|
|
901
|
-
});
|
|
902
|
-
nodeStateSource.writeNodeState({
|
|
903
|
-
instanceId,
|
|
904
|
-
state: {
|
|
905
|
-
...normalizeAgentGuiWorkbenchState(previousState),
|
|
906
|
-
...targetAgentSessionId ? { lastActiveAgentSessionId: targetAgentSessionId } : {},
|
|
907
|
-
agentTargetId: launchAgentTargetId ?? null
|
|
908
|
-
},
|
|
909
|
-
typeId: agentGuiWorkbenchTypeId
|
|
910
|
-
});
|
|
911
|
-
} else if (launchAgentTargetId) {
|
|
912
|
-
const previousState = nodeStateSource.readNodeState({
|
|
913
|
-
instanceId,
|
|
914
|
-
typeId: agentGuiWorkbenchTypeId
|
|
915
|
-
});
|
|
916
|
-
nodeStateSource.writeNodeState({
|
|
917
|
-
instanceId,
|
|
918
|
-
state: {
|
|
919
|
-
...normalizeAgentGuiWorkbenchState(previousState),
|
|
920
|
-
lastActiveAgentSessionId: null,
|
|
921
|
-
agentTargetId: launchAgentTargetId
|
|
922
|
-
},
|
|
923
|
-
typeId: agentGuiWorkbenchTypeId
|
|
924
|
-
});
|
|
925
|
-
}
|
|
926
|
-
const defaultFrame = resolveAgentGuiWorkbenchDefaultLaunchFrame({
|
|
927
|
-
frame,
|
|
928
|
-
request
|
|
929
|
-
});
|
|
930
|
-
return {
|
|
931
|
-
activation,
|
|
932
|
-
...openInNewWindow ? { cascadeOffset: agentGuiWorkbenchNewWindowCascadeOffset } : {},
|
|
933
|
-
defaultFrame,
|
|
934
|
-
dockEntryId,
|
|
935
|
-
framePolicy: !openInNewWindow && isAgentGuiWorkbenchCompactVisibleFrame(defaultFrame, frame) ? "absolute" : "cascade-same-type-centered",
|
|
936
|
-
instanceId,
|
|
937
|
-
// Reusing the window already showing this specific conversation
|
|
938
|
-
// (e.g. clicking a completion notification) should just focus it,
|
|
939
|
-
// not reset it back to the default size/position.
|
|
940
|
-
preserveExistingNodeFrame: existingInstanceId !== null,
|
|
941
|
-
reuseDockEntryNode,
|
|
942
|
-
title,
|
|
943
|
-
typeId: agentGuiWorkbenchTypeId
|
|
944
|
-
};
|
|
945
|
-
}
|
|
946
|
-
};
|
|
947
|
-
}
|
|
948
|
-
function buildAgentGuiDockEntries(input) {
|
|
949
|
-
const sectionId = input.sectionId ?? "agents";
|
|
950
|
-
const launchPayload = resolveAgentGuiUnifiedDockLaunchPayload(input);
|
|
951
|
-
const provider = launchPayload.provider;
|
|
952
|
-
const unifiedTileIconUrls = resolveAgentGuiUnifiedDockTileIconUrls(
|
|
953
|
-
input.dockIconUrls
|
|
954
|
-
);
|
|
955
|
-
return [
|
|
956
|
-
createAgentGuiWorkbenchDockEntry({
|
|
957
|
-
aggregateProviders: agentGuiWorkbenchDefaultDockProviders,
|
|
958
|
-
icon: input.unifiedDockIconUrl ? createAgentGuiWorkbenchUnifiedDockIcon({
|
|
959
|
-
iconUrl: input.unifiedDockIconUrl
|
|
960
|
-
}) : createAgentGuiWorkbenchLaunchpadStyleDockIcon({
|
|
961
|
-
tileIconUrls: unifiedTileIconUrls
|
|
962
|
-
}),
|
|
963
|
-
label: input.label ?? agentGuiWorkbenchDefaultCopy.nodeTitle,
|
|
964
|
-
launchPayload,
|
|
965
|
-
order: 0,
|
|
966
|
-
provider,
|
|
635
|
+
function buildAgentGuiDockEntries(input) {
|
|
636
|
+
const sectionId = input.sectionId ?? "agents";
|
|
637
|
+
const launchPayload = resolveAgentGuiUnifiedDockLaunchPayload(input);
|
|
638
|
+
const provider = launchPayload.provider;
|
|
639
|
+
const unifiedTileIconUrls = resolveAgentGuiUnifiedDockTileIconUrls(
|
|
640
|
+
input.dockIconUrls
|
|
641
|
+
);
|
|
642
|
+
return [
|
|
643
|
+
createAgentGuiWorkbenchDockEntry({
|
|
644
|
+
agentDirectory: input.agentDirectory,
|
|
645
|
+
aggregateProviders: agentGuiWorkbenchDefaultDockProviders,
|
|
646
|
+
icon: input.unifiedDockIconUrl ? createAgentGuiWorkbenchUnifiedDockIcon({
|
|
647
|
+
iconUrl: input.unifiedDockIconUrl
|
|
648
|
+
}) : createAgentGuiWorkbenchLaunchpadStyleDockIcon({
|
|
649
|
+
tileIconUrls: unifiedTileIconUrls
|
|
650
|
+
}),
|
|
651
|
+
label: input.label ?? agentGuiWorkbenchDefaultCopy.nodeTitle,
|
|
652
|
+
launchPayload,
|
|
653
|
+
order: 0,
|
|
654
|
+
provider,
|
|
967
655
|
renderPreview: input.renderPreview,
|
|
968
656
|
resolveDockPopupIdentity: input.resolveDockPopupIdentity,
|
|
969
657
|
resolveDockPopupTitle: input.resolveDockPopupTitle,
|
|
@@ -977,7 +665,7 @@ function resolveAgentGuiUnifiedDockLaunchPayload(input) {
|
|
|
977
665
|
if (target) {
|
|
978
666
|
return {
|
|
979
667
|
provider: target.provider,
|
|
980
|
-
agentTargetId: target.agentTargetId
|
|
668
|
+
agentTargetId: target.agentTargetId ?? target.targetId
|
|
981
669
|
};
|
|
982
670
|
}
|
|
983
671
|
return {
|
|
@@ -1020,11 +708,6 @@ function createAgentGuiWorkbenchDockEntry(input) {
|
|
|
1020
708
|
label: input.label,
|
|
1021
709
|
launchBehavior: "enabled",
|
|
1022
710
|
launchPayload: input.launchPayload ?? { provider: input.provider },
|
|
1023
|
-
// A normal dock launch reuses the node already showing this provider/target
|
|
1024
|
-
// (its instanceId is target-keyed). The popup's explicit "New window" action
|
|
1025
|
-
// must instead always open a fresh window, so hand it a payload that flags
|
|
1026
|
-
// openInNewWindow — the launch descriptor then derives a unique panel
|
|
1027
|
-
// instanceId and cascades the new window off the existing one.
|
|
1028
711
|
newWindowLaunchPayload: {
|
|
1029
712
|
...input.launchPayload ?? { provider: input.provider },
|
|
1030
713
|
openInNewWindow: true
|
|
@@ -1033,6 +716,9 @@ function createAgentGuiWorkbenchDockEntry(input) {
|
|
|
1033
716
|
if (node.data.typeId !== agentGuiWorkbenchTypeId) {
|
|
1034
717
|
return false;
|
|
1035
718
|
}
|
|
719
|
+
if (input.aggregateProviders && (agentGuiWorkbenchDockIdentityFromIdentifier(node.data.instanceId)?.kind === "unifiedAggregate" || agentGuiWorkbenchDockIdentityFromIdentifier(node.data.dockEntryId)?.kind === "unifiedAggregate")) {
|
|
720
|
+
return true;
|
|
721
|
+
}
|
|
1036
722
|
const provider = resolveAgentGuiWorkbenchProviderFromNodeIdentityOrNull(node);
|
|
1037
723
|
if (!provider) {
|
|
1038
724
|
return false;
|
|
@@ -1041,6 +727,7 @@ function createAgentGuiWorkbenchDockEntry(input) {
|
|
|
1041
727
|
},
|
|
1042
728
|
order: input.order,
|
|
1043
729
|
providePopupItemPreview: (item) => input.renderPreview ? createAgentGuiWorkbenchPreviewContent({
|
|
730
|
+
agentDirectory: input.agentDirectory,
|
|
1044
731
|
item,
|
|
1045
732
|
label: input.label,
|
|
1046
733
|
provider: input.provider,
|
|
@@ -1125,45 +812,56 @@ function providerFromActivation(activation) {
|
|
|
1125
812
|
return providerFromState(payload);
|
|
1126
813
|
}
|
|
1127
814
|
function resolveAgentGuiWorkbenchLaunchPayload(request, input) {
|
|
1128
|
-
if (
|
|
815
|
+
if (hasAgentSessionId(request.payload)) {
|
|
1129
816
|
return request.payload;
|
|
1130
817
|
}
|
|
1131
|
-
const
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
if (
|
|
1137
|
-
|
|
818
|
+
const snapshot = input.agentDirectory.getSnapshot();
|
|
819
|
+
const agents = normalizeAgentGUIAgents(snapshot.agents);
|
|
820
|
+
const payload = isRecord(request.payload) ? request.payload : {};
|
|
821
|
+
const isUnifiedDockLaunch = request.reason === "dock" && agentGuiWorkbenchDockIdentityFromIdentifier(request.dockEntryId)?.kind === "unifiedAggregate";
|
|
822
|
+
const explicitAgentTargetId = isUnifiedDockLaunch ? null : readTrimmedString(payload.agentTargetId);
|
|
823
|
+
if (explicitAgentTargetId) {
|
|
824
|
+
const explicitAgent = agents.find(
|
|
825
|
+
(agent) => agent.agentTargetId === explicitAgentTargetId && agent.availability.status === "ready"
|
|
826
|
+
);
|
|
827
|
+
if (!explicitAgent || !isAgentGuiWorkbenchProvider(explicitAgent.provider)) {
|
|
828
|
+
return null;
|
|
829
|
+
}
|
|
830
|
+
return {
|
|
831
|
+
...payload,
|
|
832
|
+
agentTargetId: explicitAgent.agentTargetId,
|
|
833
|
+
provider: explicitAgent.provider
|
|
834
|
+
};
|
|
1138
835
|
}
|
|
1139
|
-
|
|
836
|
+
const requestedProvider = providerFromState(payload);
|
|
837
|
+
const resolved = resolveAgentGuiUnifiedDockLaunchPayload({
|
|
838
|
+
agentDirectory: input.agentDirectory,
|
|
839
|
+
defaultProvider: requestedProvider ?? input.defaultProvider,
|
|
840
|
+
providerAvailability: input.providerAvailability
|
|
841
|
+
});
|
|
842
|
+
if (!resolved.agentTargetId) {
|
|
843
|
+
return null;
|
|
844
|
+
}
|
|
845
|
+
return { ...payload, ...resolved };
|
|
1140
846
|
}
|
|
1141
|
-
function
|
|
1142
|
-
if (!
|
|
847
|
+
function hasAgentSessionId(payload) {
|
|
848
|
+
if (!isRecord(payload)) {
|
|
1143
849
|
return false;
|
|
1144
850
|
}
|
|
1145
|
-
return payload.
|
|
851
|
+
return readTrimmedString(payload.agentSessionId) !== null;
|
|
1146
852
|
}
|
|
1147
|
-
function
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
return typeof typed.agentSessionId !== "string" && typeof typed.draftPrompt !== "string";
|
|
853
|
+
function isRecord(value) {
|
|
854
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
855
|
+
}
|
|
856
|
+
function readTrimmedString(value) {
|
|
857
|
+
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
1153
858
|
}
|
|
1154
859
|
function resolveUnifiedAgentGuiDockTarget(input) {
|
|
1155
|
-
const targets =
|
|
1156
|
-
(
|
|
860
|
+
const targets = projectAgentGUIAgentsToInternalTargets(
|
|
861
|
+
normalizeAgentGUIAgents(input.agentDirectory.getSnapshot().agents)
|
|
862
|
+
).filter(
|
|
863
|
+
(target) => isAgentGuiWorkbenchProvider(target.provider) && isUnifiedAgentGuiDockProvider(target.provider) && target.disabled !== true && isAgentGuiProviderAvailable(target.provider, input.providerAvailability)
|
|
1157
864
|
);
|
|
1158
|
-
const defaultAgentTargetId = input.defaultAgentTargetId?.trim();
|
|
1159
|
-
if (defaultAgentTargetId) {
|
|
1160
|
-
const explicitTarget = targets.find(
|
|
1161
|
-
(target) => target.agentTargetId === defaultAgentTargetId
|
|
1162
|
-
);
|
|
1163
|
-
if (explicitTarget) {
|
|
1164
|
-
return explicitTarget;
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
865
|
if (input.defaultProvider && isUnifiedAgentGuiDockProvider(input.defaultProvider) && isAgentGuiProviderAvailable(
|
|
1168
866
|
input.defaultProvider,
|
|
1169
867
|
input.providerAvailability
|
|
@@ -1199,8 +897,8 @@ function isUnifiedAgentGuiDockProvider(provider) {
|
|
|
1199
897
|
);
|
|
1200
898
|
}
|
|
1201
899
|
function preferredAgentGuiDockTargetForProvider(targets, provider) {
|
|
1202
|
-
const
|
|
1203
|
-
return
|
|
900
|
+
const agentTargets = targets.filter((target) => target.provider === provider);
|
|
901
|
+
return agentTargets[0] ?? null;
|
|
1204
902
|
}
|
|
1205
903
|
function isAgentGuiProviderAvailable(provider, availability) {
|
|
1206
904
|
const value = availability?.[provider];
|
|
@@ -1218,15 +916,16 @@ function isAgentGuiProviderAvailable(provider, availability) {
|
|
|
1218
916
|
}
|
|
1219
917
|
return value.status === "ready" || value.status === "available";
|
|
1220
918
|
}
|
|
1221
|
-
function
|
|
919
|
+
function providerTargetLaunchPayloadFromRequest(payload, _expectedProvider) {
|
|
1222
920
|
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
1223
921
|
return {
|
|
1224
922
|
agentTargetId: null
|
|
1225
923
|
};
|
|
1226
924
|
}
|
|
1227
925
|
const agentTargetId = payload.agentTargetId;
|
|
926
|
+
const providerTargetId = payload.providerTargetId;
|
|
1228
927
|
return {
|
|
1229
|
-
agentTargetId: typeof agentTargetId === "string" && agentTargetId.trim() ? agentTargetId.trim() : null
|
|
928
|
+
agentTargetId: typeof agentTargetId === "string" && agentTargetId.trim() ? agentTargetId.trim() : typeof providerTargetId === "string" && providerTargetId.trim() ? providerTargetId.trim() : null
|
|
1230
929
|
};
|
|
1231
930
|
}
|
|
1232
931
|
function createAgentGuiWorkbenchPreviewContent(input) {
|
|
@@ -1242,6 +941,7 @@ function createAgentGuiWorkbenchPreviewContent(input) {
|
|
|
1242
941
|
element: input.renderPreview(
|
|
1243
942
|
createAgentGuiWorkbenchPreviewBodyContext(input.item),
|
|
1244
943
|
{
|
|
944
|
+
agentDirectory: input.agentDirectory,
|
|
1245
945
|
nodeTypeId: agentGuiWorkbenchTypeId,
|
|
1246
946
|
onStateChange: () => void 0,
|
|
1247
947
|
provider
|
|
@@ -1271,7 +971,301 @@ function createAgentGuiWorkbenchPreviewBodyContext(input) {
|
|
|
1271
971
|
};
|
|
1272
972
|
}
|
|
1273
973
|
|
|
974
|
+
// workbench/contribution.ts
|
|
975
|
+
var AGENT_GUI_WORKBENCH_CONVERSATION_RAIL_TOGGLE_EVENT = "tutti:agent-gui-workbench-conversation-rail-toggle";
|
|
976
|
+
var AGENT_GUI_WORKBENCH_NEW_CONVERSATION_EVENT = "tutti:agent-gui-workbench-new-conversation";
|
|
977
|
+
var AGENT_GUI_WORKBENCH_OPEN_EXTERNAL_IMPORT_EVENT = "tutti:agent-gui-workbench-open-external-import";
|
|
978
|
+
function createAgentGuiWorkbenchContribution(input) {
|
|
979
|
+
const nodeStateSource = createAgentGuiWorkbenchNodeStateSource({
|
|
980
|
+
workspaceId: input.workspaceId
|
|
981
|
+
});
|
|
982
|
+
const frame = input.frame ?? agentGuiWorkbenchDefaultNodeFrame;
|
|
983
|
+
const copy = resolveAgentGuiWorkbenchContributionCopy(input.copy);
|
|
984
|
+
return {
|
|
985
|
+
dockEntries: buildAgentGuiDockEntries({
|
|
986
|
+
agentDirectory: input.agentDirectory,
|
|
987
|
+
defaultProvider: input.defaultProvider,
|
|
988
|
+
dockIconUrls: input.dockIconUrls,
|
|
989
|
+
label: copy.nodeTitle,
|
|
990
|
+
providerAvailability: input.providerAvailability,
|
|
991
|
+
renderPreview: input.renderPreview,
|
|
992
|
+
resolveDockPopupIdentity: input.resolveDockPopupIdentity,
|
|
993
|
+
resolveDockPopupTitle: input.resolveDockPopupTitle,
|
|
994
|
+
sectionId: input.dockSectionId ?? "agents",
|
|
995
|
+
unifiedDockIconUrl: input.unifiedDockIconUrl
|
|
996
|
+
}),
|
|
997
|
+
externalStateSource: nodeStateSource.externalStateSource,
|
|
998
|
+
id: input.id ?? "workspace-agent-gui",
|
|
999
|
+
nodes: [
|
|
1000
|
+
{
|
|
1001
|
+
frame,
|
|
1002
|
+
instance: { mode: "multi" },
|
|
1003
|
+
onBodyRenderErrorChange: ({ hasError, node }) => {
|
|
1004
|
+
setAgentGuiWorkbenchBodyRenderError(node.id, hasError);
|
|
1005
|
+
},
|
|
1006
|
+
renderBody: (context) => input.renderBody(
|
|
1007
|
+
context,
|
|
1008
|
+
{
|
|
1009
|
+
agentDirectory: input.agentDirectory,
|
|
1010
|
+
nodeTypeId: agentGuiWorkbenchTypeId,
|
|
1011
|
+
onStateChange: (state) => {
|
|
1012
|
+
nodeStateSource.writeNodeState({
|
|
1013
|
+
instanceId: context.instanceId,
|
|
1014
|
+
nodeId: context.node.id,
|
|
1015
|
+
state,
|
|
1016
|
+
typeId: agentGuiWorkbenchTypeId
|
|
1017
|
+
});
|
|
1018
|
+
},
|
|
1019
|
+
provider: providerFromActivation(context.activation) ?? agentGuiWorkbenchProviderFromInstanceId(context.instanceId)
|
|
1020
|
+
}
|
|
1021
|
+
),
|
|
1022
|
+
renderHeader: ({
|
|
1023
|
+
activation,
|
|
1024
|
+
dragHandleProps,
|
|
1025
|
+
displayMode,
|
|
1026
|
+
externalNodeState,
|
|
1027
|
+
instanceId,
|
|
1028
|
+
isFocused,
|
|
1029
|
+
node,
|
|
1030
|
+
surfaceSize,
|
|
1031
|
+
windowActions
|
|
1032
|
+
}) => {
|
|
1033
|
+
const provider = providerFromActivation(activation) ?? agentGuiWorkbenchProviderFromInstanceId(instanceId);
|
|
1034
|
+
const headerTitle = copy.nodeTitle;
|
|
1035
|
+
const rawWorkbenchState = externalNodeState ?? node.data.runtimeNodeState;
|
|
1036
|
+
const migratedWorkbenchState = migrateLegacyAgentGuiWorkbenchState(rawWorkbenchState);
|
|
1037
|
+
const workbenchState = normalizeAgentGuiWorkbenchState(
|
|
1038
|
+
migratedWorkbenchState
|
|
1039
|
+
);
|
|
1040
|
+
const nodeState = normalizeAgentGuiWorkbenchNodeState(
|
|
1041
|
+
migratedWorkbenchState,
|
|
1042
|
+
provider
|
|
1043
|
+
);
|
|
1044
|
+
const isConversationRailAutoCollapsed = shouldAutoCollapseAgentGUIConversationRail(node.frame.width);
|
|
1045
|
+
const isConversationRailCollapsed = nodeState.conversationRailCollapsed === true || isConversationRailAutoCollapsed;
|
|
1046
|
+
const conversationRailWidthPx = clampAgentGUIConversationRailWidthPx(
|
|
1047
|
+
nodeState.conversationRailWidthPx,
|
|
1048
|
+
node.frame.width
|
|
1049
|
+
);
|
|
1050
|
+
const conversationIdentity = input.resolveDockPopupIdentity?.(workbenchState) ?? null;
|
|
1051
|
+
const conversationTitle = conversationIdentity?.title ?? input.resolveDockPopupTitle?.(workbenchState) ?? null;
|
|
1052
|
+
const iconProvider = providerFromActivation(activation) ?? agentGuiWorkbenchProviderFromInstanceIdOrNull(instanceId);
|
|
1053
|
+
const conversationIconFallbackUrl = iconProvider ? resolveAgentGuiSessionProviderIconUrl(iconProvider) ?? resolveAgentGuiWorkbenchProviderIconUrl({
|
|
1054
|
+
dockIconUrls: input.dockIconUrls,
|
|
1055
|
+
provider: iconProvider
|
|
1056
|
+
}) : null;
|
|
1057
|
+
const conversationIconUrl = conversationIdentity?.iconUrl ?? conversationIconFallbackUrl;
|
|
1058
|
+
const persistConversationRailCollapsed = (collapsed) => {
|
|
1059
|
+
nodeStateSource.writeNodeState({
|
|
1060
|
+
instanceId,
|
|
1061
|
+
nodeId: node.id,
|
|
1062
|
+
state: {
|
|
1063
|
+
...workbenchState,
|
|
1064
|
+
conversationRailCollapsed: collapsed
|
|
1065
|
+
},
|
|
1066
|
+
typeId: agentGuiWorkbenchTypeId
|
|
1067
|
+
});
|
|
1068
|
+
};
|
|
1069
|
+
const announceConversationRailCollapsed = (collapsed) => {
|
|
1070
|
+
window.dispatchEvent(
|
|
1071
|
+
new CustomEvent(
|
|
1072
|
+
AGENT_GUI_WORKBENCH_CONVERSATION_RAIL_TOGGLE_EVENT,
|
|
1073
|
+
{
|
|
1074
|
+
detail: {
|
|
1075
|
+
conversationRailCollapsed: collapsed,
|
|
1076
|
+
instanceId
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
)
|
|
1080
|
+
);
|
|
1081
|
+
};
|
|
1082
|
+
const announceNewConversation = () => {
|
|
1083
|
+
window.dispatchEvent(
|
|
1084
|
+
new CustomEvent(
|
|
1085
|
+
AGENT_GUI_WORKBENCH_NEW_CONVERSATION_EVENT,
|
|
1086
|
+
{
|
|
1087
|
+
detail: {
|
|
1088
|
+
instanceId
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
)
|
|
1092
|
+
);
|
|
1093
|
+
};
|
|
1094
|
+
return createElement3(AgentGuiWorkbenchHeader, {
|
|
1095
|
+
copy,
|
|
1096
|
+
conversationIconUrl,
|
|
1097
|
+
conversationIconFallbackUrl,
|
|
1098
|
+
conversationTitle,
|
|
1099
|
+
conversationRailWidthPx,
|
|
1100
|
+
displayMode,
|
|
1101
|
+
isConversationRailAutoCollapsed,
|
|
1102
|
+
isConversationRailCollapsed,
|
|
1103
|
+
nodeId: node.id,
|
|
1104
|
+
providerRailWidthPx: agentGuiWorkbenchProviderRailWidthPx,
|
|
1105
|
+
title: headerTitle,
|
|
1106
|
+
windowActions: {
|
|
1107
|
+
close: windowActions.close,
|
|
1108
|
+
minimize: windowActions.minimize,
|
|
1109
|
+
toggleDisplayMode: windowActions.toggleDisplayMode
|
|
1110
|
+
},
|
|
1111
|
+
...dragHandleProps,
|
|
1112
|
+
onCreateConversation: announceNewConversation,
|
|
1113
|
+
onOpenDetachedWindow: input.onOpenDetachedWindow ? () => {
|
|
1114
|
+
void input.onOpenDetachedWindow?.({
|
|
1115
|
+
agentSessionId: workbenchState.lastActiveAgentSessionId,
|
|
1116
|
+
agentTargetId: nodeState.agentTargetId,
|
|
1117
|
+
provider,
|
|
1118
|
+
workspaceId: input.workspaceId
|
|
1119
|
+
});
|
|
1120
|
+
} : void 0,
|
|
1121
|
+
onPointerDown: (event) => {
|
|
1122
|
+
dragHandleProps.onPointerDown?.(event);
|
|
1123
|
+
if (!isFocused) {
|
|
1124
|
+
windowActions.focus();
|
|
1125
|
+
}
|
|
1126
|
+
},
|
|
1127
|
+
onToggleConversationRail: (nextCollapsed) => {
|
|
1128
|
+
announceConversationRailCollapsed(nextCollapsed);
|
|
1129
|
+
if (isConversationRailCollapsed && nextCollapsed === false && node.displayMode !== "fullscreen") {
|
|
1130
|
+
const expandedFrame = resolveAgentGUIExpandedWindowFrame({
|
|
1131
|
+
conversationRailWidthPx: nodeState.conversationRailWidthPx,
|
|
1132
|
+
desktopSize: surfaceSize,
|
|
1133
|
+
height: node.frame.height,
|
|
1134
|
+
position: {
|
|
1135
|
+
x: node.frame.x,
|
|
1136
|
+
y: node.frame.y
|
|
1137
|
+
},
|
|
1138
|
+
width: node.frame.width
|
|
1139
|
+
});
|
|
1140
|
+
windowActions.resize({
|
|
1141
|
+
...node.frame,
|
|
1142
|
+
height: expandedFrame.size.height,
|
|
1143
|
+
width: expandedFrame.size.width,
|
|
1144
|
+
x: expandedFrame.position.x,
|
|
1145
|
+
y: expandedFrame.position.y
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1148
|
+
persistConversationRailCollapsed(nextCollapsed);
|
|
1149
|
+
}
|
|
1150
|
+
});
|
|
1151
|
+
},
|
|
1152
|
+
title: copy.nodeTitle,
|
|
1153
|
+
typeId: agentGuiWorkbenchTypeId,
|
|
1154
|
+
window: {
|
|
1155
|
+
closable: true,
|
|
1156
|
+
defaultOpen: false,
|
|
1157
|
+
minimizedDock: {
|
|
1158
|
+
kind: "component",
|
|
1159
|
+
providePreview: (item) => createAgentGuiWorkbenchPreviewContent({
|
|
1160
|
+
agentDirectory: input.agentDirectory,
|
|
1161
|
+
item,
|
|
1162
|
+
renderPreview: input.renderMinimizedPreview,
|
|
1163
|
+
resolveDockPopupTitle: input.resolveDockPopupTitle
|
|
1164
|
+
})
|
|
1165
|
+
},
|
|
1166
|
+
minimizable: true
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
],
|
|
1170
|
+
onLaunchRequest: (request) => {
|
|
1171
|
+
if (request.typeId !== agentGuiWorkbenchTypeId) {
|
|
1172
|
+
return null;
|
|
1173
|
+
}
|
|
1174
|
+
const launchPayload = resolveAgentGuiWorkbenchLaunchPayload(request, {
|
|
1175
|
+
agentDirectory: input.agentDirectory,
|
|
1176
|
+
defaultProvider: input.defaultProvider,
|
|
1177
|
+
providerAvailability: input.providerAvailability
|
|
1178
|
+
});
|
|
1179
|
+
if (!hasAgentSessionId2(launchPayload) && !providerTargetLaunchPayloadFromRequest(
|
|
1180
|
+
launchPayload,
|
|
1181
|
+
providerFromState(launchPayload) ?? "codex"
|
|
1182
|
+
).agentTargetId) {
|
|
1183
|
+
return null;
|
|
1184
|
+
}
|
|
1185
|
+
if (!providerFromState(launchPayload) && !agentGuiWorkbenchProviderFromIdentifier(request.dockEntryId)) {
|
|
1186
|
+
return null;
|
|
1187
|
+
}
|
|
1188
|
+
const {
|
|
1189
|
+
activation,
|
|
1190
|
+
dockEntryId,
|
|
1191
|
+
instanceId: descriptorInstanceId,
|
|
1192
|
+
openInNewWindow,
|
|
1193
|
+
provider,
|
|
1194
|
+
reuseDockEntryNode,
|
|
1195
|
+
reuseExistingSessionNode,
|
|
1196
|
+
targetAgentSessionId
|
|
1197
|
+
} = createAgentGuiWorkbenchLaunchDescriptor({
|
|
1198
|
+
...request,
|
|
1199
|
+
payload: launchPayload
|
|
1200
|
+
});
|
|
1201
|
+
const existingInstanceId = targetAgentSessionId && reuseExistingSessionNode ? nodeStateSource.findInstanceIdByAgentSessionId(targetAgentSessionId) : null;
|
|
1202
|
+
const instanceId = existingInstanceId ?? descriptorInstanceId;
|
|
1203
|
+
const title = copy.nodeTitle;
|
|
1204
|
+
const providerTarget = providerTargetLaunchPayloadFromRequest(
|
|
1205
|
+
launchPayload,
|
|
1206
|
+
provider
|
|
1207
|
+
);
|
|
1208
|
+
const launchAgentTargetId = providerTarget.agentTargetId;
|
|
1209
|
+
if (targetAgentSessionId) {
|
|
1210
|
+
const previousState = nodeStateSource.readNodeState({
|
|
1211
|
+
instanceId,
|
|
1212
|
+
typeId: agentGuiWorkbenchTypeId
|
|
1213
|
+
});
|
|
1214
|
+
nodeStateSource.writeNodeState({
|
|
1215
|
+
instanceId,
|
|
1216
|
+
state: {
|
|
1217
|
+
...normalizeAgentGuiWorkbenchState(previousState),
|
|
1218
|
+
...targetAgentSessionId ? { lastActiveAgentSessionId: targetAgentSessionId } : {},
|
|
1219
|
+
agentTargetId: launchAgentTargetId ?? null
|
|
1220
|
+
},
|
|
1221
|
+
typeId: agentGuiWorkbenchTypeId
|
|
1222
|
+
});
|
|
1223
|
+
} else if (providerTarget.agentTargetId) {
|
|
1224
|
+
const previousState = nodeStateSource.readNodeState({
|
|
1225
|
+
instanceId,
|
|
1226
|
+
typeId: agentGuiWorkbenchTypeId
|
|
1227
|
+
});
|
|
1228
|
+
nodeStateSource.writeNodeState({
|
|
1229
|
+
instanceId,
|
|
1230
|
+
state: {
|
|
1231
|
+
...normalizeAgentGuiWorkbenchState(previousState),
|
|
1232
|
+
lastActiveAgentSessionId: null,
|
|
1233
|
+
agentTargetId: providerTarget.agentTargetId
|
|
1234
|
+
},
|
|
1235
|
+
typeId: agentGuiWorkbenchTypeId
|
|
1236
|
+
});
|
|
1237
|
+
}
|
|
1238
|
+
const defaultFrame = resolveAgentGuiWorkbenchDefaultLaunchFrame({
|
|
1239
|
+
frame,
|
|
1240
|
+
request
|
|
1241
|
+
});
|
|
1242
|
+
return {
|
|
1243
|
+
activation,
|
|
1244
|
+
...openInNewWindow ? { cascadeOffset: agentGuiWorkbenchNewWindowCascadeOffset } : {},
|
|
1245
|
+
defaultFrame,
|
|
1246
|
+
dockEntryId,
|
|
1247
|
+
framePolicy: !openInNewWindow && isAgentGuiWorkbenchCompactVisibleFrame(defaultFrame, frame) ? "absolute" : "cascade-same-type-centered",
|
|
1248
|
+
instanceId,
|
|
1249
|
+
// Reusing the window already showing this specific conversation
|
|
1250
|
+
// (e.g. clicking a completion notification) should just focus it,
|
|
1251
|
+
// not reset it back to the default size/position.
|
|
1252
|
+
preserveExistingNodeFrame: existingInstanceId !== null,
|
|
1253
|
+
reuseDockEntryNode,
|
|
1254
|
+
title,
|
|
1255
|
+
typeId: agentGuiWorkbenchTypeId
|
|
1256
|
+
};
|
|
1257
|
+
}
|
|
1258
|
+
};
|
|
1259
|
+
}
|
|
1260
|
+
function hasAgentSessionId2(payload) {
|
|
1261
|
+
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
1262
|
+
return false;
|
|
1263
|
+
}
|
|
1264
|
+
return typeof payload.agentSessionId === "string" && payload.agentSessionId.trim().length > 0;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1274
1267
|
export {
|
|
1268
|
+
resolveAgentGuiSessionProviderFlatIconUrl,
|
|
1275
1269
|
AGENT_GUI_CONVERSATION_RAIL_MIN_WIDTH_PX,
|
|
1276
1270
|
AGENT_GUI_DETAIL_MIN_WIDTH_PX,
|
|
1277
1271
|
AGENT_GUI_COLLAPSED_MIN_WIDTH_PX,
|
|
@@ -1280,27 +1274,21 @@ export {
|
|
|
1280
1274
|
clampAgentGUIConversationRailWidthPx,
|
|
1281
1275
|
resolveNextAgentGUIConversationRailWidthPx,
|
|
1282
1276
|
resolveAgentGUIExpandedWindowFrame,
|
|
1283
|
-
agentGuiDockIconUrl,
|
|
1284
|
-
agentGuiDockIconUrls,
|
|
1285
|
-
resolveAgentGuiSessionProviderFlatIconUrl,
|
|
1286
1277
|
AgentGuiWorkbenchHeader,
|
|
1287
|
-
normalizeAgentGUIAgents,
|
|
1288
|
-
resolveAgentGUISelectedDirectoryAgent,
|
|
1289
|
-
projectAgentGUIAgentsToInternalTargets,
|
|
1290
1278
|
agentGuiWorkbenchDefaultNodeFrame,
|
|
1291
1279
|
agentGuiWorkbenchDefaultUsableWidthRatio,
|
|
1292
1280
|
agentGuiWorkbenchDefaultUsableHeightRatio,
|
|
1293
1281
|
agentGuiWorkbenchCompactVisibleAreaRatio,
|
|
1294
1282
|
agentGuiWorkbenchNewWindowCascadeOffset,
|
|
1295
1283
|
agentGuiWorkbenchProviderRailWidthPx,
|
|
1296
|
-
AGENT_GUI_WORKBENCH_CONVERSATION_RAIL_TOGGLE_EVENT,
|
|
1297
|
-
AGENT_GUI_WORKBENCH_NEW_CONVERSATION_EVENT,
|
|
1298
|
-
AGENT_GUI_WORKBENCH_OPEN_EXTERNAL_IMPORT_EVENT,
|
|
1299
1284
|
agentGuiWorkbenchDefaultCopy,
|
|
1300
|
-
createAgentGuiWorkbenchContribution,
|
|
1301
1285
|
buildAgentGuiDockEntries,
|
|
1302
1286
|
resolveAgentGuiUnifiedDockLaunchPayload,
|
|
1303
1287
|
resolveAgentGuiWorkbenchDefaultLaunchFrame,
|
|
1304
|
-
resolveAgentGuiWorkbenchContributionCopy
|
|
1288
|
+
resolveAgentGuiWorkbenchContributionCopy,
|
|
1289
|
+
AGENT_GUI_WORKBENCH_CONVERSATION_RAIL_TOGGLE_EVENT,
|
|
1290
|
+
AGENT_GUI_WORKBENCH_NEW_CONVERSATION_EVENT,
|
|
1291
|
+
AGENT_GUI_WORKBENCH_OPEN_EXTERNAL_IMPORT_EVENT,
|
|
1292
|
+
createAgentGuiWorkbenchContribution
|
|
1305
1293
|
};
|
|
1306
|
-
//# sourceMappingURL=chunk-
|
|
1294
|
+
//# sourceMappingURL=chunk-7RDD3EWP.js.map
|