@tutti-os/agent-gui 0.0.94 → 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.
Files changed (153) hide show
  1. package/README.md +48 -32
  2. package/dist/AgentGUI-CwBLYtv-.d.ts +992 -0
  3. package/dist/agent-conversation/index.d.ts +5 -7
  4. package/dist/agent-conversation/index.js +12 -8
  5. package/dist/agent-conversation/index.js.map +1 -1
  6. package/dist/agent-env/index.d.ts +10 -36
  7. package/dist/agent-env/index.js +1 -56
  8. package/dist/agent-env/index.js.map +1 -1
  9. package/dist/agent-gui.d.ts +21 -0
  10. package/dist/agent-gui.js +39 -0
  11. package/dist/agent-message-center/index.d.ts +145 -124
  12. package/dist/agent-message-center/index.js +1374 -1316
  13. package/dist/agent-message-center/index.js.map +1 -1
  14. package/dist/{agentConversationVM-Cl4G0Lln.d.ts → agentConversationVM-C335TR6S.d.ts} +112 -7
  15. package/dist/agentFileMentionContracts-Czvz6YMI.d.ts +107 -0
  16. package/dist/{agentGuiNodeTypes-CAioPXK9.d.ts → agentGuiNodeTypes-DppADPHW.d.ts} +96 -148
  17. package/dist/agentPlanPromptDispatch-C7cCMjve.d.ts +37 -0
  18. package/dist/agents.d.ts +13 -0
  19. package/dist/agents.js +13 -0
  20. package/dist/app/renderer/agentactivity.css +126 -80
  21. package/dist/app/renderer/assets/icons/agent-vinyls/tutti-vinyl.png +0 -0
  22. package/dist/app/renderer/assets/icons/open-link-lined.svg +4 -0
  23. package/dist/{chunk-P72YLKC6.js → chunk-3R2D4E57.js} +3127 -3398
  24. package/dist/chunk-3R2D4E57.js.map +1 -0
  25. package/dist/chunk-4YG7YK7S.js +23 -0
  26. package/dist/chunk-4YG7YK7S.js.map +1 -0
  27. package/dist/chunk-5X7YDOC6.js +42 -0
  28. package/dist/chunk-5X7YDOC6.js.map +1 -0
  29. package/dist/{chunk-IBIMGLCD.js → chunk-7J4K6WKB.js} +1 -1
  30. package/dist/chunk-7J4K6WKB.js.map +1 -0
  31. package/dist/{chunk-BXVPOGYK.js → chunk-7PFDA2HQ.js} +505 -504
  32. package/dist/chunk-7PFDA2HQ.js.map +1 -0
  33. package/dist/{chunk-AWAIUYG4.js → chunk-7RDD3EWP.js} +513 -555
  34. package/dist/chunk-7RDD3EWP.js.map +1 -0
  35. package/dist/{chunk-UBDPV34P.js → chunk-AOS2VWU6.js} +1355 -1305
  36. package/dist/chunk-AOS2VWU6.js.map +1 -0
  37. package/dist/{chunk-E5FOXRUM.js → chunk-BFNJKTDV.js} +295 -255
  38. package/dist/chunk-BFNJKTDV.js.map +1 -0
  39. package/dist/{chunk-5FE7M42A.js → chunk-BIHBXWK5.js} +2 -2
  40. package/dist/{chunk-7BUYFVRI.js → chunk-C5FV4UGI.js} +2921 -2944
  41. package/dist/chunk-C5FV4UGI.js.map +1 -0
  42. package/dist/{chunk-SCLLP5DO.js → chunk-CRO2MV2Y.js} +36 -46
  43. package/dist/chunk-CRO2MV2Y.js.map +1 -0
  44. package/dist/chunk-FGLQZ6I4.js +9 -0
  45. package/dist/chunk-FGLQZ6I4.js.map +1 -0
  46. package/dist/chunk-H6IQ63DQ.js +14 -0
  47. package/dist/chunk-H6IQ63DQ.js.map +1 -0
  48. package/dist/{chunk-IGY4ASUF.js → chunk-JX2SIXNL.js} +1293 -1702
  49. package/dist/chunk-JX2SIXNL.js.map +1 -0
  50. package/dist/chunk-KAL4XZMA.js +231 -0
  51. package/dist/chunk-KAL4XZMA.js.map +1 -0
  52. package/dist/chunk-KJQERFKX.js +259 -0
  53. package/dist/chunk-KJQERFKX.js.map +1 -0
  54. package/dist/chunk-LQVXBT65.js +491 -0
  55. package/dist/chunk-LQVXBT65.js.map +1 -0
  56. package/dist/{chunk-554VG7ZW.js → chunk-NITOD7WF.js} +2 -2
  57. package/dist/{chunk-7LMJXF4R.js → chunk-NJAZ7LQM.js} +20 -16
  58. package/dist/chunk-NJAZ7LQM.js.map +1 -0
  59. package/dist/chunk-NX3CZJXW.js +25 -0
  60. package/dist/chunk-NX3CZJXW.js.map +1 -0
  61. package/dist/chunk-O6W72SEP.js +93 -0
  62. package/dist/chunk-O6W72SEP.js.map +1 -0
  63. package/dist/chunk-RY6GIO3K.js +31700 -0
  64. package/dist/chunk-RY6GIO3K.js.map +1 -0
  65. package/dist/{chunk-XDV4ZRVK.js → chunk-UGVI47X6.js} +98 -37
  66. package/dist/chunk-UGVI47X6.js.map +1 -0
  67. package/dist/{chunk-XW4CVBUH.js → chunk-UQJPV6HP.js} +18 -11
  68. package/dist/chunk-UQJPV6HP.js.map +1 -0
  69. package/dist/{chunk-GAPTLVII.js → chunk-VF22EG3F.js} +1 -1
  70. package/dist/{chunk-GAPTLVII.js.map → chunk-VF22EG3F.js.map} +1 -1
  71. package/dist/{chunk-45FF4DQU.js → chunk-WEDMAVX2.js} +22 -24
  72. package/dist/chunk-WEDMAVX2.js.map +1 -0
  73. package/dist/{chunk-MATIJPGF.js → chunk-XMO45GKA.js} +531 -401
  74. package/dist/chunk-XMO45GKA.js.map +1 -0
  75. package/dist/{chunk-ZUW4B5AT.js → chunk-YE25HN6T.js} +6 -9
  76. package/dist/chunk-YE25HN6T.js.map +1 -0
  77. package/dist/context-mention-palette/index.d.ts +3 -2
  78. package/dist/context-mention-palette/index.js +19 -14
  79. package/dist/custom-mention.d.ts +44 -0
  80. package/dist/custom-mention.js +17 -0
  81. package/dist/custom-mention.js.map +1 -0
  82. package/dist/dock-icons.d.ts +6 -0
  83. package/dist/dock-icons.js +11 -0
  84. package/dist/dock-icons.js.map +1 -0
  85. package/dist/i18n/index.d.ts +850 -841
  86. package/dist/i18n/index.js +2 -2
  87. package/dist/index.d.ts +52 -1061
  88. package/dist/index.js +72 -35530
  89. package/dist/index.js.map +1 -1
  90. package/dist/mention-search.d.ts +226 -0
  91. package/dist/mention-search.js +29 -0
  92. package/dist/mention-search.js.map +1 -0
  93. package/dist/open-link-lined-JWEKUKME.svg +4 -0
  94. package/dist/provider-icons.d.ts +6 -0
  95. package/dist/provider-icons.js +12 -0
  96. package/dist/provider-icons.js.map +1 -0
  97. package/dist/provider-identity.d.ts +9 -0
  98. package/dist/provider-identity.js +21 -0
  99. package/dist/provider-identity.js.map +1 -0
  100. package/dist/runtime-BBNdWgDU.d.ts +10 -0
  101. package/dist/{types-PLFZ8SBX.d.ts → types-DX2bxgB8.d.ts} +28 -83
  102. package/dist/workbench/contribution.d.ts +32 -40
  103. package/dist/workbench/contribution.js +10 -6
  104. package/dist/workbench/index.d.ts +3 -2
  105. package/dist/workbench/index.js +24 -20
  106. package/dist/workbench/launch.d.ts +2 -5
  107. package/dist/workbench/launch.js +4 -3
  108. package/dist/workbench/providerCatalog.js +2 -1
  109. package/dist/workbench/sessionTitle.d.ts +4 -3
  110. package/dist/workbench/sessionTitle.js +4 -3
  111. package/dist/workbench/state.d.ts +1 -1
  112. package/dist/workbench/state.js +3 -2
  113. package/dist/workbench/types.d.ts +0 -3
  114. package/dist/workbench/types.js +1 -1
  115. package/dist/workspace-agent-generated-files.d.ts +20 -2
  116. package/dist/workspace-agent-generated-files.js +7 -6
  117. package/dist/workspaceAgentActivityListTypes-C7gPWYiA.d.ts +71 -0
  118. package/package.json +63 -26
  119. package/dist/AgentMentionSearchController-DD_WOred.d.ts +0 -241
  120. package/dist/AgentMessageMarkdown-DeYPURtF.d.ts +0 -7
  121. package/dist/chunk-45FF4DQU.js.map +0 -1
  122. package/dist/chunk-4HP6V2YA.js +0 -207
  123. package/dist/chunk-4HP6V2YA.js.map +0 -1
  124. package/dist/chunk-7BUYFVRI.js.map +0 -1
  125. package/dist/chunk-7LMJXF4R.js.map +0 -1
  126. package/dist/chunk-AWAIUYG4.js.map +0 -1
  127. package/dist/chunk-BXVPOGYK.js.map +0 -1
  128. package/dist/chunk-E5FOXRUM.js.map +0 -1
  129. package/dist/chunk-IBIMGLCD.js.map +0 -1
  130. package/dist/chunk-IGY4ASUF.js.map +0 -1
  131. package/dist/chunk-LR4FA5X6.js +0 -368
  132. package/dist/chunk-LR4FA5X6.js.map +0 -1
  133. package/dist/chunk-MATIJPGF.js.map +0 -1
  134. package/dist/chunk-MKHDRIGN.js +0 -71
  135. package/dist/chunk-MKHDRIGN.js.map +0 -1
  136. package/dist/chunk-P72YLKC6.js.map +0 -1
  137. package/dist/chunk-SCLLP5DO.js.map +0 -1
  138. package/dist/chunk-UBDPV34P.js.map +0 -1
  139. package/dist/chunk-VAKFNNKT.js +0 -410
  140. package/dist/chunk-VAKFNNKT.js.map +0 -1
  141. package/dist/chunk-XDV4ZRVK.js.map +0 -1
  142. package/dist/chunk-XW4CVBUH.js.map +0 -1
  143. package/dist/chunk-ZUW4B5AT.js.map +0 -1
  144. package/dist/plan-decision-ops.d.ts +0 -70
  145. package/dist/plan-decision-ops.js +0 -19
  146. package/dist/queued-prompt-runtime.d.ts +0 -115
  147. package/dist/queued-prompt-runtime.js +0 -9
  148. package/dist/workspaceAgentActivityListViewModel-BzV-cf0D.d.ts +0 -340
  149. package/dist/workspaceLinkActions-DS9LWqzI.d.ts +0 -74
  150. /package/dist/{plan-decision-ops.js.map → agent-gui.js.map} +0 -0
  151. /package/dist/{queued-prompt-runtime.js.map → agents.js.map} +0 -0
  152. /package/dist/{chunk-5FE7M42A.js.map → chunk-BIHBXWK5.js.map} +0 -0
  153. /package/dist/{chunk-554VG7ZW.js.map → chunk-NITOD7WF.js.map} +0 -0
@@ -1,368 +0,0 @@
1
- import {
2
- WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN
3
- } from "./chunk-4HP6V2YA.js";
4
- import {
5
- claudeRoundedUrl,
6
- codexRoundedUrl,
7
- cursorColorfulUrl,
8
- cursorRoundedUrl,
9
- hermesRoundedUrl,
10
- manageAgentClaudeCodeUrl,
11
- manageAgentCodexUrl,
12
- manageAgentHermesUrl,
13
- manageAgentOpenCodeUrl,
14
- manageAgentOpenclawUrl,
15
- manageAgentTuttiUrl,
16
- normalizeManagedAgentProvider,
17
- openclawRoundedUrl,
18
- opencodeRoundedUrl,
19
- providerRailClaudeCodeColorfulUrl,
20
- providerRailCodexColorfulUrl,
21
- providerRailHermesColorfulUrl,
22
- providerRailOpenCodeColorfulUrl,
23
- providerRailTuttiUrl,
24
- tuttiDocRoundedUrl
25
- } from "./chunk-XDV4ZRVK.js";
26
-
27
- // shared/agentCustomMentionKinds.ts
28
- var registry = /* @__PURE__ */ new Map();
29
- var RESERVED_AGENT_MENTION_PROVIDER_IDS = /* @__PURE__ */ new Set([
30
- "agent-session",
31
- "agent-target",
32
- "custom",
33
- "file",
34
- "issue",
35
- "session",
36
- "task",
37
- "workspace-app",
38
- "workspace-app-factory",
39
- "workspace-issue",
40
- "workspace-reference"
41
- ]);
42
- function registerAgentCustomMentionKind(definition) {
43
- const kind = definition.kind.trim().toLowerCase();
44
- if (!kind) {
45
- throw new Error(
46
- "[agent-gui] custom mention kind must be a non-empty provider id"
47
- );
48
- }
49
- if (RESERVED_AGENT_MENTION_PROVIDER_IDS.has(kind)) {
50
- throw new Error(
51
- `[agent-gui] custom mention kind "${kind}" collides with a built-in provider id`
52
- );
53
- }
54
- registry.set(kind, definition);
55
- }
56
- function getAgentCustomMentionKind(kind) {
57
- return registry.get(kind.trim().toLowerCase());
58
- }
59
- function resetAgentCustomMentionKindsForTests() {
60
- registry.clear();
61
- }
62
-
63
- // agentActivityRuntime.tsx
64
- import {
65
- createContext,
66
- useContext,
67
- useEffect,
68
- useSyncExternalStore
69
- } from "react";
70
- import { jsx } from "react/jsx-runtime";
71
- function agentActivityRuntimeCapabilityEnabled(runtime, capability) {
72
- return runtime?.capabilities?.[capability] ?? true;
73
- }
74
- var AgentActivityRuntimeContext = createContext(
75
- null
76
- );
77
- var currentAgentActivityRuntime = null;
78
- var runtimesByOrigin = /* @__PURE__ */ new Map();
79
- function normalizeRuntimeOrigin(origin) {
80
- return origin?.trim() || WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN;
81
- }
82
- function AgentActivityRuntimeProvider({
83
- children,
84
- runtime
85
- }) {
86
- currentAgentActivityRuntime = runtime ?? null;
87
- const origin = normalizeRuntimeOrigin(runtime?.origin);
88
- if (origin && runtime) {
89
- runtimesByOrigin.set(origin, runtime);
90
- }
91
- useEffect(() => {
92
- if (!origin || !runtime) {
93
- return;
94
- }
95
- runtimesByOrigin.set(origin, runtime);
96
- return () => {
97
- if (runtimesByOrigin.get(origin) === runtime) {
98
- runtimesByOrigin.delete(origin);
99
- }
100
- };
101
- }, [origin, runtime]);
102
- return /* @__PURE__ */ jsx(AgentActivityRuntimeContext.Provider, { value: runtime ?? null, children });
103
- }
104
- function useAgentActivityRuntime() {
105
- const runtime = useContext(AgentActivityRuntimeContext) ?? getTestAgentActivityRuntime();
106
- if (!runtime) {
107
- throw new Error(
108
- "AgentActivityRuntimeProvider is missing an AgentActivityRuntime instance."
109
- );
110
- }
111
- return runtime;
112
- }
113
- function useOptionalAgentActivityRuntime() {
114
- return useContext(AgentActivityRuntimeContext) ?? getTestAgentActivityRuntime();
115
- }
116
- function useAgentActivitySnapshot(workspaceId) {
117
- const runtime = useAgentActivityRuntime();
118
- const normalizedWorkspaceId = workspaceId.trim();
119
- return useSyncExternalStore(
120
- (listener) => runtime.subscribe(normalizedWorkspaceId, listener),
121
- () => runtime.getSnapshot(normalizedWorkspaceId),
122
- () => runtime.getSnapshot(normalizedWorkspaceId)
123
- );
124
- }
125
- function getAgentActivityRuntime() {
126
- const runtime = getExplicitWindowTestAgentActivityRuntime() ?? currentAgentActivityRuntime ?? getTestAgentActivityRuntime();
127
- if (!runtime) {
128
- throw new Error(
129
- "AgentActivityRuntimeProvider is missing an AgentActivityRuntime instance."
130
- );
131
- }
132
- return runtime;
133
- }
134
- function getOptionalAgentActivityRuntime() {
135
- return getExplicitWindowTestAgentActivityRuntime() ?? currentAgentActivityRuntime ?? getTestAgentActivityRuntime();
136
- }
137
- function getAgentActivityRuntimeByOrigin(origin) {
138
- const normalizedOrigin = normalizeRuntimeOrigin(origin);
139
- const runtime = runtimesByOrigin.get(normalizedOrigin);
140
- if (runtime) {
141
- return runtime;
142
- }
143
- if (normalizedOrigin === WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN) {
144
- return getOptionalAgentActivityRuntime();
145
- }
146
- return null;
147
- }
148
- function resetAgentActivityRuntimeForTests() {
149
- if (process.env.NODE_ENV === "test") {
150
- currentAgentActivityRuntime = null;
151
- runtimesByOrigin.clear();
152
- }
153
- }
154
- function setAgentActivityRuntimeForTests(runtime) {
155
- if (process.env.NODE_ENV === "test") {
156
- currentAgentActivityRuntime = runtime;
157
- }
158
- }
159
- function getTestAgentActivityRuntime() {
160
- if (process.env.NODE_ENV !== "test") {
161
- return null;
162
- }
163
- if (typeof window === "undefined") {
164
- return null;
165
- }
166
- const explicitRuntime = getExplicitWindowTestAgentActivityRuntime();
167
- if (explicitRuntime) {
168
- return explicitRuntime;
169
- }
170
- if (currentAgentActivityRuntime) {
171
- return currentAgentActivityRuntime;
172
- }
173
- const testRuntime = window.agentActivityRuntime;
174
- return testRuntime ?? null;
175
- }
176
- function getExplicitWindowTestAgentActivityRuntime() {
177
- if (process.env.NODE_ENV !== "test" || typeof window === "undefined") {
178
- return null;
179
- }
180
- const testDescriptor = Object.getOwnPropertyDescriptor(
181
- window,
182
- "agentActivityRuntime"
183
- );
184
- if (!testDescriptor || !("value" in testDescriptor)) {
185
- return null;
186
- }
187
- return testDescriptor.value ?? null;
188
- }
189
-
190
- // agentActivityHost.tsx
191
- import {
192
- createContext as createContext2,
193
- useContext as useContext2,
194
- useEffect as useEffect2,
195
- useMemo
196
- } from "react";
197
-
198
- // host/agentHostApi.ts
199
- function toAgentHostRuntimeApi(hostApi) {
200
- return {
201
- account: hostApi.account,
202
- clipboard: hostApi.clipboard,
203
- debug: hostApi.debug,
204
- filesystem: hostApi.filesystem,
205
- meta: hostApi.meta,
206
- onHostEvent: hostApi.onHostEvent,
207
- persistence: hostApi.persistence,
208
- runtime: hostApi.runtime,
209
- toast: hostApi.toast,
210
- userProjects: hostApi.userProjects,
211
- workspace: hostApi.workspace,
212
- workspaceAgentProbes: hostApi.workspaceAgentProbes
213
- };
214
- }
215
-
216
- // agentActivityHost.tsx
217
- import { jsx as jsx2 } from "react/jsx-runtime";
218
- var AgentActivityHostContext = createContext2(
219
- null
220
- );
221
- var currentAgentHostApi = null;
222
- var hostApiByOrigin = /* @__PURE__ */ new Map();
223
- function resolveHostOrigin(runtime) {
224
- return runtime?.origin?.trim() || WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN;
225
- }
226
- function AgentActivityHostProvider({
227
- agentActivityRuntime,
228
- agentHostApi,
229
- children
230
- }) {
231
- const resolvedAgentHostApi = useMemo(
232
- () => agentHostApi ? toAgentHostRuntimeApi(agentHostApi) : null,
233
- [agentHostApi]
234
- );
235
- currentAgentHostApi = resolvedAgentHostApi;
236
- const origin = resolveHostOrigin(agentActivityRuntime);
237
- if (resolvedAgentHostApi) {
238
- hostApiByOrigin.set(origin, resolvedAgentHostApi);
239
- }
240
- useEffect2(() => {
241
- if (!resolvedAgentHostApi) {
242
- return;
243
- }
244
- hostApiByOrigin.set(origin, resolvedAgentHostApi);
245
- return () => {
246
- if (hostApiByOrigin.get(origin) === resolvedAgentHostApi) {
247
- hostApiByOrigin.delete(origin);
248
- }
249
- };
250
- }, [origin, resolvedAgentHostApi]);
251
- return /* @__PURE__ */ jsx2(AgentActivityRuntimeProvider, { runtime: agentActivityRuntime, children: /* @__PURE__ */ jsx2(AgentActivityHostContext.Provider, { value: resolvedAgentHostApi, children }) });
252
- }
253
- function useAgentHostApi() {
254
- const agentHostApi = useContext2(AgentActivityHostContext) ?? getTestAgentHostApi();
255
- if (!agentHostApi) {
256
- throw new Error(
257
- "AgentActivityHostProvider is missing an agentHostApi instance."
258
- );
259
- }
260
- return agentHostApi;
261
- }
262
- function useOptionalAgentHostApi() {
263
- return useContext2(AgentActivityHostContext) ?? getTestAgentHostApi();
264
- }
265
- function getOptionalAgentHostApi() {
266
- return getExplicitWindowTestAgentHostApi() ?? currentAgentHostApi ?? getTestAgentHostApi();
267
- }
268
- function getAgentHostApiByOrigin(origin) {
269
- const normalizedOrigin = origin?.trim() || WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN;
270
- const hostApi = hostApiByOrigin.get(normalizedOrigin);
271
- if (hostApi) {
272
- return hostApi;
273
- }
274
- if (normalizedOrigin === WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN) {
275
- return getOptionalAgentHostApi();
276
- }
277
- return null;
278
- }
279
- function getTestAgentHostApi() {
280
- if (process.env.NODE_ENV !== "test") {
281
- return null;
282
- }
283
- if (typeof window === "undefined") {
284
- return null;
285
- }
286
- const explicitAgentHostApi = getExplicitWindowTestAgentHostApi();
287
- if (explicitAgentHostApi) {
288
- return explicitAgentHostApi;
289
- }
290
- if (currentAgentHostApi) {
291
- return currentAgentHostApi;
292
- }
293
- const testAgentHostApi = window.agentHostApi;
294
- return testAgentHostApi ? toAgentHostRuntimeApi(testAgentHostApi) : null;
295
- }
296
- function getExplicitWindowTestAgentHostApi() {
297
- if (process.env.NODE_ENV !== "test" || typeof window === "undefined") {
298
- return null;
299
- }
300
- const testDescriptor = Object.getOwnPropertyDescriptor(
301
- window,
302
- "agentHostApi"
303
- );
304
- if (!testDescriptor || !("value" in testDescriptor)) {
305
- return null;
306
- }
307
- const testAgentHostApi = testDescriptor.value;
308
- return testAgentHostApi ? toAgentHostRuntimeApi(testAgentHostApi) : null;
309
- }
310
-
311
- // shared/managedAgentIcons.ts
312
- var MANAGED_AGENT_ICON_URLS = {
313
- "claude-code": manageAgentClaudeCodeUrl,
314
- codex: manageAgentCodexUrl,
315
- cursor: cursorRoundedUrl,
316
- hermes: manageAgentHermesUrl,
317
- tutti: manageAgentTuttiUrl,
318
- openclaw: manageAgentOpenclawUrl,
319
- opencode: manageAgentOpenCodeUrl
320
- };
321
- var MANAGED_AGENT_PROVIDER_RAIL_ICON_URLS = {
322
- "claude-code": providerRailClaudeCodeColorfulUrl,
323
- codex: providerRailCodexColorfulUrl,
324
- cursor: cursorColorfulUrl,
325
- hermes: providerRailHermesColorfulUrl,
326
- tutti: providerRailTuttiUrl,
327
- opencode: providerRailOpenCodeColorfulUrl
328
- };
329
- var MANAGED_AGENT_ICON_ROUNDED_URLS = {
330
- "claude-code": claudeRoundedUrl,
331
- codex: codexRoundedUrl,
332
- cursor: cursorColorfulUrl,
333
- hermes: hermesRoundedUrl,
334
- tutti: tuttiDocRoundedUrl,
335
- openclaw: openclawRoundedUrl,
336
- opencode: opencodeRoundedUrl
337
- };
338
- var MANAGED_AGENT_ROUNDED_ICON_FALLBACK_URL = tuttiDocRoundedUrl;
339
- var MANAGED_AGENT_ICON_FALLBACK_URL = manageAgentTuttiUrl;
340
- function managedAgentRoundedIconUrl(provider) {
341
- return MANAGED_AGENT_ICON_ROUNDED_URLS[normalizeManagedAgentProvider(provider)] ?? MANAGED_AGENT_ROUNDED_ICON_FALLBACK_URL;
342
- }
343
-
344
- export {
345
- registerAgentCustomMentionKind,
346
- getAgentCustomMentionKind,
347
- resetAgentCustomMentionKindsForTests,
348
- agentActivityRuntimeCapabilityEnabled,
349
- AgentActivityRuntimeProvider,
350
- useAgentActivityRuntime,
351
- useOptionalAgentActivityRuntime,
352
- useAgentActivitySnapshot,
353
- getAgentActivityRuntime,
354
- getOptionalAgentActivityRuntime,
355
- getAgentActivityRuntimeByOrigin,
356
- resetAgentActivityRuntimeForTests,
357
- setAgentActivityRuntimeForTests,
358
- AgentActivityHostProvider,
359
- useAgentHostApi,
360
- useOptionalAgentHostApi,
361
- getOptionalAgentHostApi,
362
- getAgentHostApiByOrigin,
363
- MANAGED_AGENT_ICON_URLS,
364
- MANAGED_AGENT_PROVIDER_RAIL_ICON_URLS,
365
- MANAGED_AGENT_ICON_FALLBACK_URL,
366
- managedAgentRoundedIconUrl
367
- };
368
- //# sourceMappingURL=chunk-LR4FA5X6.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../shared/agentCustomMentionKinds.ts","../agentActivityRuntime.tsx","../agentActivityHost.tsx","../host/agentHostApi.ts","../shared/managedAgentIcons.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\n\n// 自定义 mention kind 注册表:让宿主(如 tsh)从外部注册 mention://<kind>/... 链接的\n// 解析与 composer 内 chip 渲染,包内不内置任何具体业务 kind。\n//\n// 管线接点:\n// - 解析:agentFileMentionExtension.parseMentionItemFromHref 命中注册 kind 时产出\n// AgentMentionCustomItem(展示字段由 present() 提取;href 是完整信息源,round-trip 无损)\n// - 渲染:AgentMentionNodeView 对 kind===\"custom\" 调 renderChip(),缺省用包内通用双行卡\n// - 点击:clickable 的 kind 经 resolveWorkspaceMentionLinkAction 上抛\n// open-custom-mention 链接动作(携带原始 href,宿主自行二次解析)\n//\n// 注册时机:宿主渲染进程 bootstrap(早于首个 composer 挂载);模块级单例,重复注册以\n// 后者为准(HMR 友好)。\n\nexport interface AgentCustomMentionIdentity {\n entityId: string;\n label: string;\n scope?: Readonly<Record<string, string>>;\n}\n\nexport interface AgentCustomMentionPresentation {\n /** chip 第一行(缺省用链接 label)。 */\n name: string;\n /** chip 第二行(可选,通用双行卡的次要文案)。 */\n summary?: string;\n /** 所属 workspace(可选;custom kind 的 scope 键由注册方约定)。 */\n workspaceId?: string;\n}\n\nexport interface AgentCustomMentionChipContext {\n href: string;\n name: string;\n summary?: string;\n isEditable: boolean;\n /** 可编辑态的移除按钮,由 NodeView 注入;自定义渲染需自行摆放。 */\n removeAction?: ReactNode;\n}\n\nexport interface AgentCustomMentionKindDefinition {\n /** mention://<kind>/... 的 providerId(URL hostname,小写)。 */\n kind: string;\n /**\n * 从 canonical mention 链接提取展示字段;返回 null 表示链接无效,\n * 退化为普通链接/字面文本。\n */\n present(\n mention: AgentCustomMentionIdentity,\n href: string\n ): AgentCustomMentionPresentation | null;\n /** 自定义 chip 渲染;缺省用包内通用双行卡(name + summary)。 */\n renderChip?(context: AgentCustomMentionChipContext): ReactNode;\n /** 点击是否上抛 open-custom-mention 链接动作;缺省 false(chip 只展示)。 */\n clickable?: boolean;\n}\n\nconst registry = new Map<string, AgentCustomMentionKindDefinition>();\n\n// 包内管线已内置处理的 providerId(agentFileMentionExtension /\n// resolveWorkspaceMentionLinkAction),以及宿主侧沿用的 legacy 短名与内部 kind。\n// 注册表查找在部分链路先于内置分支执行,若放行同名注册会静默劫持内置 mention\n// 的解析——注册发生在宿主 bootstrap,直接抛错 fail-fast。\nconst RESERVED_AGENT_MENTION_PROVIDER_IDS = new Set([\n \"agent-session\",\n \"agent-target\",\n \"custom\",\n \"file\",\n \"issue\",\n \"session\",\n \"task\",\n \"workspace-app\",\n \"workspace-app-factory\",\n \"workspace-issue\",\n \"workspace-reference\"\n]);\n\nexport function registerAgentCustomMentionKind(\n definition: AgentCustomMentionKindDefinition\n): void {\n const kind = definition.kind.trim().toLowerCase();\n if (!kind) {\n throw new Error(\n \"[agent-gui] custom mention kind must be a non-empty provider id\"\n );\n }\n if (RESERVED_AGENT_MENTION_PROVIDER_IDS.has(kind)) {\n throw new Error(\n `[agent-gui] custom mention kind \"${kind}\" collides with a built-in provider id`\n );\n }\n registry.set(kind, definition);\n}\n\nexport function getAgentCustomMentionKind(\n kind: string\n): AgentCustomMentionKindDefinition | undefined {\n return registry.get(kind.trim().toLowerCase());\n}\n\nexport function resetAgentCustomMentionKindsForTests(): void {\n registry.clear();\n}\n","import {\n createContext,\n useContext,\n useEffect,\n useSyncExternalStore,\n type JSX,\n type PropsWithChildren\n} from \"react\";\nimport type {\n AgentActivityCancelSessionInput,\n AgentActivityCancelSessionResult,\n AgentActivityGoalControlInput,\n AgentActivityGoalControlResult,\n AgentActivityCreateSessionInput,\n AgentActivityDeleteSessionInput,\n AgentActivityDeleteSessionResult,\n AgentActivityMessageOrder,\n AgentActivityMessagePage,\n AgentActivityRenameSessionInput,\n AgentActivitySendInput,\n AgentActivitySendInputResult,\n AgentActivitySession,\n AgentActivitySnapshot,\n AgentActivitySnapshotListener,\n AgentActivitySubmitInteractiveInput\n} from \"@tutti-os/agent-activity-core\";\nimport type {\n AgentHostAgentSessionComposerSettings,\n AgentHostActivateAgentSessionResult,\n AgentHostRuntimeOpenclawGatewayWarmupResult,\n AgentHostUpdateAgentSessionSettingsResult,\n AgentHostUnactivateAgentSessionResult,\n AgentHostAgentSessionState\n} from \"./shared/contracts/dto\";\nimport { WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN } from \"./shared/workspaceAgentActivityTypes\";\n\nexport interface AgentActivityRuntimeListSessionMessagesInput {\n afterVersion?: number;\n beforeVersion?: number;\n cache?: boolean;\n agentSessionId: string;\n limit?: number;\n order?: AgentActivityMessageOrder;\n signal?: AbortSignal;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeListGeneratedFilesInput {\n limit?: number;\n query?: string;\n sessionCwd?: string;\n signal?: AbortSignal;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeListSessionsPageInput {\n limit?: number;\n searchQuery?: string;\n signal?: AbortSignal;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeSessionPageResult {\n hasMore: boolean;\n nextCursor?: string;\n sessions: AgentActivitySession[];\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeListSessionSectionsInput {\n agentTargetId?: string | null;\n limitPerSection?: number;\n signal?: AbortSignal;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeListSessionSectionPageInput {\n agentTargetId?: string | null;\n cursor?: string;\n limit?: number;\n sectionKey: string;\n signal?: AbortSignal;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeSessionSectionScopeInput {\n agentTargetId?: string | null;\n sectionKey: string;\n signal?: AbortSignal;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeSessionSectionCount {\n agentTargetId?: string | null;\n count: number;\n sectionKey: string;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeDeleteSessionSectionResult {\n agentTargetId?: string | null;\n removedMessages: number;\n removedSessionIds: string[];\n removedSessions: number;\n sectionKey: string;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeListPinnedSessionsPageInput {\n agentTargetId?: string | null;\n cursor?: string;\n limit?: number;\n signal?: AbortSignal;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeUserProject {\n createdAtUnixMs: number;\n id: string;\n label: string;\n lastUsedAtUnixMs?: number;\n path: string;\n sectionKey: string;\n updatedAtUnixMs: number;\n}\n\nexport interface AgentActivityRuntimeSessionSection {\n kind: \"conversations\" | \"project\";\n sectionKey: string;\n userProject?: AgentActivityRuntimeUserProject;\n sessions: AgentActivitySession[];\n hasMore: boolean;\n nextCursor?: string;\n}\n\nexport interface AgentActivityRuntimeSessionPage {\n sessions: AgentActivitySession[];\n hasMore: boolean;\n nextCursor?: string;\n}\n\nexport interface AgentActivityRuntimeSessionSectionsResult {\n pinned?: AgentActivityRuntimeSessionPage;\n sections: AgentActivityRuntimeSessionSection[];\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeGeneratedFile {\n label: string;\n path: string;\n}\n\nexport interface AgentActivityRuntimeGeneratedFileList {\n entries: AgentActivityRuntimeGeneratedFile[];\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeEnsureSessionSynchronizedInput {\n afterVersion?: number;\n agentSessionId: string;\n onError?: (error: unknown) => void;\n workspaceId: string;\n}\n\nexport type AgentActivityRuntimeRetainSessionEventsInput =\n AgentActivityRuntimeEnsureSessionSynchronizedInput;\n\nexport interface AgentActivityRuntimeSetSessionPinnedInput {\n agentSessionId: string;\n pinned: boolean;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeTrackSettingsProjectChangeInput {\n action: \"clear\" | \"create_new\" | \"select_existing\";\n agentSessionId: string;\n provider?: string | null;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeGetSessionControlStateInput {\n agentSessionId: string;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeGetComposerOptionsInput {\n agentTargetId?: string | null;\n cwd?: string | null;\n force?: boolean;\n provider?: string;\n settings?: AgentHostAgentSessionComposerSettings | null;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeUpdateSessionSettingsInput {\n agentSessionId: string;\n settings: AgentHostAgentSessionComposerSettings;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeTrackDraftComposerSettingsChangeInput {\n nextSettings: AgentHostAgentSessionComposerSettings;\n previousSettings: AgentHostAgentSessionComposerSettings;\n provider: string;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeWarmupOpenclawGatewayInput {\n workspaceId?: string | null;\n}\n\nexport interface AgentActivityRuntimeDiagnosticInput {\n details?: Record<string, unknown>;\n event: string;\n level?: \"debug\" | \"info\" | \"warn\" | \"error\";\n source?: string;\n workspaceId?: string | null;\n}\n\nexport interface AgentActivityRuntimeCapabilities {\n canCancel?: boolean;\n canSubmitInteractive?: boolean;\n canGoalControl?: boolean;\n canUploadAttachment?: boolean;\n}\n\nexport type AgentActivityRuntimeCapabilityKey =\n keyof AgentActivityRuntimeCapabilities;\n\ninterface AgentActivityRuntimeActivateSessionInputBase {\n agentSessionId: string;\n cwd?: string;\n initialContent?: AgentActivitySendInput[\"content\"];\n /** 仅展示用首轮文本(bundle 折叠成一个 chip);initialContent 仍带展开后的文件。 */\n initialDisplayPrompt?: string | null;\n metadata?: Record<string, unknown>;\n openclawGatewayReady?: boolean;\n settings?: AgentHostAgentSessionComposerSettings;\n title?: string;\n visible?: boolean;\n workspaceId: string;\n}\n\nexport type AgentActivityRuntimeActivateSessionInput =\n | (AgentActivityRuntimeActivateSessionInputBase & {\n agentTargetId: string;\n mode: \"new\";\n })\n | (AgentActivityRuntimeActivateSessionInputBase & {\n agentTargetId?: string | null;\n mode: \"existing\";\n });\n\nexport interface AgentActivityRuntimeUnactivateSessionInput {\n agentSessionId: string;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeReadSessionAttachmentInput {\n agentSessionId: string;\n attachmentId: string;\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeReadPromptAssetInput {\n agentSessionId?: string | null;\n assetId?: string | null;\n hostPath?: string | null;\n kind?: string | null;\n mimeType: string;\n name?: string | null;\n path?: string | null;\n sha256?: string | null;\n uploadStatus?: string | null;\n uri?: string | null;\n workspaceId: string;\n}\n\nexport type AgentActivityRuntimePromptContentBlock =\n AgentActivitySendInput[\"content\"][number] & {\n assetId?: string;\n hostPath?: string;\n kind?: string;\n path?: string;\n sizeBytes?: number;\n uploadStatus?: string;\n uri?: string;\n };\n\nexport interface AgentActivityRuntimeUploadPromptContentInput {\n content: AgentActivityRuntimePromptContentBlock[];\n workspaceId: string;\n}\n\nexport interface AgentActivityRuntimeUploadPromptContentResult {\n content: AgentActivityRuntimePromptContentBlock[];\n}\n\nexport interface AgentActivityRuntimeSessionAttachment {\n attachmentId: string;\n mimeType: string;\n name?: string;\n data: string;\n}\n\nexport interface AgentActivityRuntimePromptAsset {\n assetId?: string;\n hostPath?: string;\n kind?: string;\n mimeType: string;\n name?: string;\n path: string;\n uploadStatus?: string;\n uri?: string;\n data: string;\n}\n\nexport interface AgentActivityRuntime {\n /**\n * Stable identity of this runtime instance (e.g. a local origin vs a\n * shared/room origin). When present, the conversation-list and session-view\n * stores key their query state, runtime resolution, and subscriptions by this\n * value, so multiple runtimes can coexist for the same workspace without\n * fighting over a single module-global slot. Absent => legacy single-runtime\n * behaviour resolved via the module-global.\n */\n origin?: string;\n /**\n * The session cwd is not resolvable on the local filesystem (e.g. a\n * shared/cloud sandbox not mounted locally), so AgentGUI must not run its\n * local stat-based \"working directory missing\" existence check — it would\n * always false-positive. Absent/false (default) => local, legacy behaviour.\n * Only that one guard is gated; project selection/listing is unaffected.\n */\n projectPathIsRemote?: boolean;\n promptContentUploadSupport?: {\n file?: boolean;\n image?: boolean;\n };\n /**\n * Host-declared command surface. Missing capability keys default to true for\n * backwards compatibility with older runtimes.\n */\n capabilities?: AgentActivityRuntimeCapabilities;\n /**\n * When reportDiagnostic is absent, development builds emit AgentGUI\n * diagnostics to console by default. Set false to keep a dev runtime silent.\n */\n devDiagnosticConsoleSink?: boolean;\n cancelSession(\n input: AgentActivityCancelSessionInput\n ): Promise<AgentActivityCancelSessionResult>;\n goalControl(\n input: AgentActivityGoalControlInput\n ): Promise<AgentActivityGoalControlResult>;\n createSession(\n input: AgentActivityCreateSessionInput\n ): Promise<AgentActivitySession>;\n deleteSession(\n input: AgentActivityDeleteSessionInput\n ): Promise<AgentActivityDeleteSessionResult>;\n activateSession(\n input: AgentActivityRuntimeActivateSessionInput\n ): Promise<AgentHostActivateAgentSessionResult>;\n getSession(\n workspaceId: string,\n agentSessionId: string\n ): Promise<AgentActivitySession>;\n getComposerOptions(\n input: AgentActivityRuntimeGetComposerOptionsInput\n ): Promise<unknown>;\n updateSessionSettings(\n input: AgentActivityRuntimeUpdateSessionSettingsInput\n ): Promise<AgentHostUpdateAgentSessionSettingsResult>;\n warmupOpenclawGateway?(\n input?: AgentActivityRuntimeWarmupOpenclawGatewayInput\n ): Promise<AgentHostRuntimeOpenclawGatewayWarmupResult>;\n getSessionControlState(\n input: AgentActivityRuntimeGetSessionControlStateInput\n ): Promise<AgentHostAgentSessionState>;\n getSnapshot(workspaceId: string): AgentActivitySnapshot;\n listSessionMessages(\n input: AgentActivityRuntimeListSessionMessagesInput\n ): Promise<AgentActivityMessagePage>;\n listAgentGeneratedFiles?(\n input: AgentActivityRuntimeListGeneratedFilesInput\n ): Promise<AgentActivityRuntimeGeneratedFileList>;\n listSessionsPage?(\n input: AgentActivityRuntimeListSessionsPageInput\n ): Promise<AgentActivityRuntimeSessionPageResult>;\n listSessionSections?(\n input: AgentActivityRuntimeListSessionSectionsInput\n ): Promise<AgentActivityRuntimeSessionSectionsResult>;\n listSessionSectionPage?(\n input: AgentActivityRuntimeListSessionSectionPageInput\n ): Promise<AgentActivityRuntimeSessionSection>;\n countSessionSection?(\n input: AgentActivityRuntimeSessionSectionScopeInput\n ): Promise<AgentActivityRuntimeSessionSectionCount>;\n deleteSessionSection?(\n input: AgentActivityRuntimeSessionSectionScopeInput\n ): Promise<AgentActivityRuntimeDeleteSessionSectionResult>;\n listPinnedSessionsPage?(\n input: AgentActivityRuntimeListPinnedSessionsPageInput\n ): Promise<AgentActivityRuntimeSessionPage>;\n load(\n workspaceId: string,\n signal?: AbortSignal\n ): Promise<AgentActivitySnapshot>;\n ensureSessionSynchronized(\n input: AgentActivityRuntimeEnsureSessionSynchronizedInput\n ): () => void;\n /** @deprecated Use ensureSessionSynchronized. */\n retainSessionEvents?(\n input: AgentActivityRuntimeRetainSessionEventsInput\n ): () => void;\n sendInput(\n input: AgentActivitySendInput\n ): Promise<AgentActivitySendInputResult>;\n uploadPromptContent?(\n input: AgentActivityRuntimeUploadPromptContentInput\n ): Promise<AgentActivityRuntimeUploadPromptContentResult>;\n readSessionAttachment?(\n input: AgentActivityRuntimeReadSessionAttachmentInput\n ): Promise<AgentActivityRuntimeSessionAttachment>;\n readPromptAsset?(\n input: AgentActivityRuntimeReadPromptAssetInput\n ): Promise<AgentActivityRuntimePromptAsset>;\n renameSession(\n input: AgentActivityRenameSessionInput\n ): Promise<AgentActivitySession>;\n setSessionPinned(\n input: AgentActivityRuntimeSetSessionPinnedInput\n ): Promise<AgentActivitySession>;\n trackSettingsProjectChange?(\n input: AgentActivityRuntimeTrackSettingsProjectChangeInput\n ): Promise<void>;\n trackDraftComposerSettingsChange?(\n input: AgentActivityRuntimeTrackDraftComposerSettingsChangeInput\n ): Promise<void>;\n reportDiagnostic?(\n input: AgentActivityRuntimeDiagnosticInput\n ): Promise<void> | void;\n unactivateSession(\n input: AgentActivityRuntimeUnactivateSessionInput\n ): Promise<AgentHostUnactivateAgentSessionResult>;\n submitInteractive(\n input: AgentActivitySubmitInteractiveInput\n ): Promise<unknown>;\n subscribeSessionEvents(\n workspaceId: string,\n listener: (event: unknown) => void\n ): () => void;\n subscribe(\n workspaceId: string,\n listener: AgentActivitySnapshotListener\n ): () => void;\n}\n\nexport function agentActivityRuntimeCapabilityEnabled(\n runtime: Pick<AgentActivityRuntime, \"capabilities\"> | null | undefined,\n capability: AgentActivityRuntimeCapabilityKey\n): boolean {\n return runtime?.capabilities?.[capability] ?? true;\n}\n\nconst AgentActivityRuntimeContext = createContext<AgentActivityRuntime | null>(\n null\n);\n\nlet currentAgentActivityRuntime: AgentActivityRuntime | null = null;\n\n// Registry of runtimes indexed by their stable `origin`. Non-React module\n// singletons (the conversation-list and session-view stores) resolve the\n// correct runtime for a query's origin from here instead of reading the\n// last-mounted module-global — the single slot two runtimes used to fight over.\nconst runtimesByOrigin = new Map<string, AgentActivityRuntime>();\n\n// A runtime without an explicit origin is the default (local) runtime. It\n// registers under this canonical origin — the same value the conversation-list\n// query and session-view refs fall back to — so the local window resolves to it\n// by origin instead of depending on the last-mounted module-global. A shared/\n// room runtime opts in by setting a distinct `origin`; no host wiring needed for\n// the local case.\nfunction normalizeRuntimeOrigin(origin: string | null | undefined): string {\n return origin?.trim() || WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN;\n}\n\nexport interface AgentActivityRuntimeProviderProps extends PropsWithChildren {\n runtime?: AgentActivityRuntime | null;\n}\n\nexport function AgentActivityRuntimeProvider({\n children,\n runtime\n}: AgentActivityRuntimeProviderProps): JSX.Element {\n currentAgentActivityRuntime = runtime ?? null;\n const origin = normalizeRuntimeOrigin(runtime?.origin);\n // Register during render to close the gap before the effect runs (parity with\n // the module-global write above); the effect owns cleanup on unmount.\n if (origin && runtime) {\n runtimesByOrigin.set(origin, runtime);\n }\n useEffect(() => {\n if (!origin || !runtime) {\n return;\n }\n runtimesByOrigin.set(origin, runtime);\n return () => {\n // Only clear if a newer provider hasn't already re-registered this origin.\n if (runtimesByOrigin.get(origin) === runtime) {\n runtimesByOrigin.delete(origin);\n }\n };\n }, [origin, runtime]);\n return (\n <AgentActivityRuntimeContext.Provider value={runtime ?? null}>\n {children}\n </AgentActivityRuntimeContext.Provider>\n );\n}\n\nexport function useAgentActivityRuntime(): AgentActivityRuntime {\n const runtime =\n useContext(AgentActivityRuntimeContext) ?? getTestAgentActivityRuntime();\n if (!runtime) {\n throw new Error(\n \"AgentActivityRuntimeProvider is missing an AgentActivityRuntime instance.\"\n );\n }\n return runtime;\n}\n\nexport function useOptionalAgentActivityRuntime(): AgentActivityRuntime | null {\n return (\n useContext(AgentActivityRuntimeContext) ?? getTestAgentActivityRuntime()\n );\n}\n\nexport function useAgentActivitySnapshot(\n workspaceId: string\n): AgentActivitySnapshot {\n const runtime = useAgentActivityRuntime();\n const normalizedWorkspaceId = workspaceId.trim();\n return useSyncExternalStore(\n (listener) => runtime.subscribe(normalizedWorkspaceId, listener),\n () => runtime.getSnapshot(normalizedWorkspaceId),\n () => runtime.getSnapshot(normalizedWorkspaceId)\n );\n}\n\nexport function getAgentActivityRuntime(): AgentActivityRuntime {\n const runtime =\n getExplicitWindowTestAgentActivityRuntime() ??\n currentAgentActivityRuntime ??\n getTestAgentActivityRuntime();\n if (!runtime) {\n throw new Error(\n \"AgentActivityRuntimeProvider is missing an AgentActivityRuntime instance.\"\n );\n }\n return runtime;\n}\n\nexport function getOptionalAgentActivityRuntime(): AgentActivityRuntime | null {\n return (\n getExplicitWindowTestAgentActivityRuntime() ??\n currentAgentActivityRuntime ??\n getTestAgentActivityRuntime()\n );\n}\n\n/**\n * Resolve the runtime for a given origin. When the origin is registered (two\n * runtimes coexisting for one workspace), returns that exact instance.\n *\n * Only the default (local) origin falls back to legacy single-runtime\n * resolution. An explicit non-default origin that is not registered returns null\n * rather than cross-routing to a different runtime via the module-global slot —\n * e.g. a shared query must never silently load from the local runtime.\n */\nexport function getAgentActivityRuntimeByOrigin(\n origin: string | null | undefined\n): AgentActivityRuntime | null {\n const normalizedOrigin = normalizeRuntimeOrigin(origin);\n const runtime = runtimesByOrigin.get(normalizedOrigin);\n if (runtime) {\n return runtime;\n }\n if (normalizedOrigin === WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN) {\n return getOptionalAgentActivityRuntime();\n }\n return null;\n}\n\nexport function resetAgentActivityRuntimeForTests(): void {\n if (process.env.NODE_ENV === \"test\") {\n currentAgentActivityRuntime = null;\n runtimesByOrigin.clear();\n }\n}\n\nexport function setAgentActivityRuntimeForTests(\n runtime: AgentActivityRuntime | null\n): void {\n if (process.env.NODE_ENV === \"test\") {\n currentAgentActivityRuntime = runtime;\n }\n}\n\nfunction getTestAgentActivityRuntime(): AgentActivityRuntime | null {\n if (process.env.NODE_ENV !== \"test\") {\n return null;\n }\n if (typeof window === \"undefined\") {\n return null;\n }\n const explicitRuntime = getExplicitWindowTestAgentActivityRuntime();\n if (explicitRuntime) {\n return explicitRuntime;\n }\n if (currentAgentActivityRuntime) {\n return currentAgentActivityRuntime;\n }\n const testRuntime = (\n window as unknown as Window & {\n agentActivityRuntime?: AgentActivityRuntime;\n }\n ).agentActivityRuntime;\n return testRuntime ?? null;\n}\n\nfunction getExplicitWindowTestAgentActivityRuntime(): AgentActivityRuntime | null {\n if (process.env.NODE_ENV !== \"test\" || typeof window === \"undefined\") {\n return null;\n }\n const testDescriptor = Object.getOwnPropertyDescriptor(\n window,\n \"agentActivityRuntime\"\n );\n if (!testDescriptor || !(\"value\" in testDescriptor)) {\n return null;\n }\n return (testDescriptor.value as AgentActivityRuntime | undefined) ?? null;\n}\n","import {\n createContext,\n useContext,\n useEffect,\n useMemo,\n type JSX,\n type PropsWithChildren\n} from \"react\";\nimport {\n toAgentHostRuntimeApi,\n type AgentHostInputApi,\n type AgentHostRuntimeApi\n} from \"./host/agentHostApi\";\nimport {\n AgentActivityRuntimeProvider,\n type AgentActivityRuntime\n} from \"./agentActivityRuntime\";\nimport { WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN } from \"./shared/workspaceAgentActivityTypes\";\n\nconst AgentActivityHostContext = createContext<AgentHostRuntimeApi | null>(\n null\n);\n\nlet currentAgentHostApi: AgentHostRuntimeApi | null = null;\n\n// Host APIs indexed by their runtime origin, mirroring the runtime registry.\n// Read-state persistence resolves the host API by the query's origin so a\n// local window persists to the local host and a shared/cloud window persists to\n// its own cloud host — each backend keyed by (roomId, userId) with no origin\n// needed on the record itself.\nconst hostApiByOrigin = new Map<string, AgentHostRuntimeApi>();\n\nfunction resolveHostOrigin(\n runtime: AgentActivityRuntime | null | undefined\n): string {\n return (\n runtime?.origin?.trim() || WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN\n );\n}\n\nexport interface AgentActivityHostProviderProps extends PropsWithChildren {\n agentActivityRuntime?: AgentActivityRuntime | null;\n agentHostApi?: AgentHostInputApi | null;\n}\n\nexport function AgentActivityHostProvider({\n agentActivityRuntime,\n agentHostApi,\n children\n}: AgentActivityHostProviderProps): JSX.Element {\n const resolvedAgentHostApi = useMemo(\n () => (agentHostApi ? toAgentHostRuntimeApi(agentHostApi) : null),\n [agentHostApi]\n );\n currentAgentHostApi = resolvedAgentHostApi;\n const origin = resolveHostOrigin(agentActivityRuntime);\n // Register during render to close the gap before the effect runs; the effect\n // owns cleanup on unmount.\n if (resolvedAgentHostApi) {\n hostApiByOrigin.set(origin, resolvedAgentHostApi);\n }\n useEffect(() => {\n if (!resolvedAgentHostApi) {\n return;\n }\n hostApiByOrigin.set(origin, resolvedAgentHostApi);\n return () => {\n if (hostApiByOrigin.get(origin) === resolvedAgentHostApi) {\n hostApiByOrigin.delete(origin);\n }\n };\n }, [origin, resolvedAgentHostApi]);\n return (\n <AgentActivityRuntimeProvider runtime={agentActivityRuntime}>\n <AgentActivityHostContext.Provider value={resolvedAgentHostApi}>\n {children}\n </AgentActivityHostContext.Provider>\n </AgentActivityRuntimeProvider>\n );\n}\n\nexport function useAgentHostApi(): AgentHostRuntimeApi {\n const agentHostApi =\n useContext(AgentActivityHostContext) ?? getTestAgentHostApi();\n if (!agentHostApi) {\n throw new Error(\n \"AgentActivityHostProvider is missing an agentHostApi instance.\"\n );\n }\n return agentHostApi;\n}\n\nexport function useOptionalAgentHostApi(): AgentHostRuntimeApi | null {\n return useContext(AgentActivityHostContext) ?? getTestAgentHostApi();\n}\n\nexport function getOptionalAgentHostApi(): AgentHostRuntimeApi | null {\n return (\n getExplicitWindowTestAgentHostApi() ??\n currentAgentHostApi ??\n getTestAgentHostApi()\n );\n}\n\n/**\n * Resolve the host API for a given runtime origin. When the origin is registered\n * (local vs shared/cloud host), returns that exact host API so its persistence\n * (read-state, etc.) targets the matching backend; otherwise falls back to\n * legacy single-host resolution.\n */\nexport function getAgentHostApiByOrigin(\n origin: string | null | undefined\n): AgentHostRuntimeApi | null {\n const normalizedOrigin =\n origin?.trim() || WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN;\n const hostApi = hostApiByOrigin.get(normalizedOrigin);\n if (hostApi) {\n return hostApi;\n }\n // Only the default (local) origin falls back to the legacy single-host slot.\n // An explicit non-default origin that is not registered returns null so its\n // persistence never lands in a different host's store (e.g. shared read-state\n // must not be written to the local backend).\n if (normalizedOrigin === WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN) {\n return getOptionalAgentHostApi();\n }\n return null;\n}\n\nexport function resetAgentHostApiForTests(): void {\n if (process.env.NODE_ENV === \"test\") {\n currentAgentHostApi = null;\n hostApiByOrigin.clear();\n }\n}\n\nexport function setAgentHostApiForTests(\n agentHostApi: AgentHostInputApi | AgentHostRuntimeApi | null\n): void {\n if (process.env.NODE_ENV === \"test\") {\n currentAgentHostApi = agentHostApi\n ? toAgentHostRuntimeApi(agentHostApi)\n : null;\n }\n}\n\nfunction getTestAgentHostApi(): AgentHostRuntimeApi | null {\n if (process.env.NODE_ENV !== \"test\") {\n return null;\n }\n if (typeof window === \"undefined\") {\n return null;\n }\n const explicitAgentHostApi = getExplicitWindowTestAgentHostApi();\n if (explicitAgentHostApi) {\n return explicitAgentHostApi;\n }\n if (currentAgentHostApi) {\n return currentAgentHostApi;\n }\n const testAgentHostApi = (\n window as unknown as Window & {\n agentHostApi?: AgentHostInputApi | AgentHostRuntimeApi;\n }\n ).agentHostApi;\n return testAgentHostApi ? toAgentHostRuntimeApi(testAgentHostApi) : null;\n}\n\nfunction getExplicitWindowTestAgentHostApi(): AgentHostRuntimeApi | null {\n if (process.env.NODE_ENV !== \"test\" || typeof window === \"undefined\") {\n return null;\n }\n const testDescriptor = Object.getOwnPropertyDescriptor(\n window,\n \"agentHostApi\"\n );\n if (!testDescriptor || !(\"value\" in testDescriptor)) {\n return null;\n }\n const testAgentHostApi = testDescriptor.value as\n | AgentHostInputApi\n | AgentHostRuntimeApi\n | undefined;\n return testAgentHostApi ? toAgentHostRuntimeApi(testAgentHostApi) : null;\n}\n","import type {\n AgentHostBatchUserInfoInput,\n AgentHostBatchUserInfoResult,\n AgentHostDeleteWorkspaceAgentSessionInput,\n AgentHostWorkspaceAgentListInput as AgentHostListWorkspaceAgentsInput,\n AgentHostListWorkspaceAgentProbesInput,\n AgentHostWorkspaceAgentSessionMessages,\n AgentHostWorkspaceAgentSessionMessagesInput,\n AgentHostWorkspaceAgentSessionSummary,\n AgentHostWorkspaceAgentSessionSummaryInput,\n AgentHostWorkspaceAgentProbesResult,\n AgentHostWorkspaceAgentSnapshot,\n PersistWriteResult,\n ReadWorkspaceAgentReadStateInput,\n ReadWorkspaceFileResult as AgentHostReadWorkspaceFileResult,\n WorkspaceAgentReadStateSnapshot,\n WriteWorkspaceAgentReadStateInput\n} from \"../shared/contracts/dto\";\nimport type { WorkspaceUserProjectService } from \"@tutti-os/workspace-user-project/contracts\";\n\ntype AgentHostAsyncResult<T = any> = Promise<T>;\ntype AgentHostRecord = Record<string, unknown>;\ntype AgentHostUnsubscribe = () => void;\ntype AgentHostWorkspaceScopedInput<\n T extends {\n workspaceId?: string | null;\n }\n> = Omit<T, \"workspaceId\"> & {\n workspaceId: string;\n};\ntype AgentHostWorkspaceAgentsListInput =\n AgentHostWorkspaceScopedInput<AgentHostListWorkspaceAgentsInput>;\ntype AgentHostWorkspaceAgentSessionMessagesRuntimeInput =\n AgentHostWorkspaceScopedInput<AgentHostWorkspaceAgentSessionMessagesInput>;\ntype AgentHostWorkspaceAgentSessionSummaryRuntimeInput =\n AgentHostWorkspaceScopedInput<AgentHostWorkspaceAgentSessionSummaryInput>;\ntype AgentHostDeleteWorkspaceAgentSessionRuntimeInput =\n AgentHostWorkspaceScopedInput<AgentHostDeleteWorkspaceAgentSessionInput>;\n\nexport type AgentHostClipboardApi = {\n writeImage?: (input: {\n data: string;\n mimeType: \"image/png\";\n }) => AgentHostAsyncResult<void>;\n writeText: (text: string) => AgentHostAsyncResult<void>;\n};\n\nexport type AgentHostDebugApi = {\n logRuntimeDiagnostics: (\n payload: unknown\n ) => AgentHostAsyncResult<void> | void;\n logTerminalDiagnostics?: (\n payload: unknown\n ) => AgentHostAsyncResult<void> | void;\n};\n\nexport type AgentHostFilesystemApi = AgentHostRecord & {\n readFileText: (payload: {\n path?: string;\n uri?: string;\n }) => AgentHostAsyncResult<{\n content: string;\n name?: string;\n path?: string;\n }>;\n};\n\nexport type AgentHostMetaApi = AgentHostRecord & {\n appVersion?: string | null;\n isPackaged?: boolean;\n isTest?: boolean;\n mainPid?: number | null;\n platform?: string;\n workspaceId?: string;\n};\n\nexport type AgentHostEnvironmentApi = AgentHostRecord & {\n getBaseUrl?: () => AgentHostAsyncResult<string>;\n warmupOpenclawGateway?: (input?: unknown) => AgentHostAsyncResult<unknown>;\n};\n\nexport type AgentHostPersistenceApi = AgentHostRecord & {\n readWorkspaceAgentReadState: (\n input: ReadWorkspaceAgentReadStateInput\n ) => AgentHostAsyncResult<WorkspaceAgentReadStateSnapshot>;\n writeWorkspaceAgentReadState: (\n input: WriteWorkspaceAgentReadStateInput\n ) => AgentHostAsyncResult<PersistWriteResult>;\n};\n\nexport type AgentHostToastApi = AgentHostRecord & {\n error: (title: string, description?: string) => void;\n info?: (title: string, description?: string) => void;\n success?: (title: string, description?: string) => void;\n};\n\nexport interface AgentHostSelectedFile {\n name?: string;\n path: string;\n}\n\nexport interface AgentHostSelectFilesInput {\n allowDirectories?: boolean;\n}\n\nexport interface AgentHostApplyWorkspaceGitPatchInput {\n allowBinary?: boolean;\n atomic?: boolean;\n cwd: string;\n diff: string;\n revert?: boolean;\n target?: \"unstaged\" | \"staged\" | \"staged-and-unstaged\";\n}\n\nexport interface AgentHostApplyWorkspaceGitPatchResult {\n status: \"success\" | \"partial-success\" | \"error\";\n appliedPaths: string[];\n skippedPaths: string[];\n conflictedPaths: string[];\n errorCode?: \"not-git-repo\" | string;\n execOutput?: {\n command: string;\n stdout: string;\n stderr: string;\n };\n}\n\nexport interface AgentHostResolveWorkspaceGitPatchSupportInput {\n cwd: string;\n}\n\nexport interface AgentHostResolveWorkspaceGitPatchSupportResult {\n supported: boolean;\n root?: string;\n errorCode?: \"not-git-repo\" | string;\n}\n\nexport type AgentHostWorkspaceApi = AgentHostRecord & {\n applyGitPatch?: (\n input: AgentHostApplyWorkspaceGitPatchInput\n ) => AgentHostAsyncResult<AgentHostApplyWorkspaceGitPatchResult>;\n resolveGitPatchSupport?: (\n input: AgentHostResolveWorkspaceGitPatchSupportInput\n ) => AgentHostAsyncResult<AgentHostResolveWorkspaceGitPatchSupportResult>;\n copyPath?: (input: { path: string }) => AgentHostAsyncResult<void>;\n ensureDirectory: (input: { path: string }) => AgentHostAsyncResult<void>;\n getReferenceForFile?: (file: File) => {\n kind: \"file\" | \"folder\";\n path: string;\n };\n readFile: (input: {\n path: string;\n }) => AgentHostAsyncResult<AgentHostReadWorkspaceFileResult>;\n selectContextEntries?: () => AgentHostAsyncResult<{ entries: unknown[] }>;\n selectDirectory: () => AgentHostAsyncResult<{ path: string } | null>;\n selectFiles: (\n input?: AgentHostSelectFilesInput\n ) => AgentHostAsyncResult<AgentHostSelectedFile[]>;\n writeFileText: (input: {\n content: string;\n path: string;\n }) => AgentHostAsyncResult<unknown>;\n};\n\nexport interface AgentHostInputApi {\n account?: AgentHostAccountApi;\n agentSessions?: AgentHostAgentSessionsApi;\n clipboard: AgentHostClipboardApi;\n debug?: AgentHostDebugApi;\n filesystem: AgentHostFilesystemApi;\n meta?: AgentHostMetaApi;\n onHostEvent?: (listener: (event: any) => void) => AgentHostUnsubscribe;\n persistence?: AgentHostPersistenceApi;\n runtime?: AgentHostEnvironmentApi;\n toast?: AgentHostToastApi;\n userProjects?: AgentHostUserProjectsApi;\n workspace: AgentHostWorkspaceApi;\n workspaceAgentProbes?: AgentHostWorkspaceAgentProbesApi;\n workspaceAgents?: AgentHostWorkspaceAgentsApi;\n}\n\nexport type AgentHostApi = AgentHostInputApi;\n\nexport type AgentHostAccountApi = AgentHostRecord & {\n batchGetUserInfo: (\n input: AgentHostBatchUserInfoInput\n ) => AgentHostAsyncResult<AgentHostBatchUserInfoResult>;\n ensureProfiles?: (input: any) => AgentHostAsyncResult<any>;\n};\n\nexport type AgentHostWorkspaceAgentProbesApi = AgentHostRecord & {\n list: (\n input: AgentHostListWorkspaceAgentProbesInput\n ) => AgentHostAsyncResult<AgentHostWorkspaceAgentProbesResult>;\n};\n\nexport type AgentProviderProbeListInput =\n AgentHostListWorkspaceAgentProbesInput;\nexport type AgentProviderProbeListResult = AgentHostWorkspaceAgentProbesResult;\n\nexport interface AgentHostUserProject {\n id: string;\n path: string;\n label: string;\n sectionKey?: string;\n createdAtUnixMs?: number;\n updatedAtUnixMs?: number;\n lastUsedAtUnixMs?: number;\n}\n\nexport type AgentHostUserProjectsApi = AgentHostRecord & {\n service?: WorkspaceUserProjectService;\n checkPath?: (input: { path: string }) => AgentHostAsyncResult<{\n exists: boolean;\n isDirectory: boolean;\n path: string;\n }>;\n create?: (input: {\n name: string;\n }) => AgentHostAsyncResult<AgentHostUserProject>;\n getDefaultSelection?: () => AgentHostAsyncResult<{\n path: string | null;\n } | null>;\n list: () => AgentHostAsyncResult<{\n projects: AgentHostUserProject[];\n }>;\n subscribe?: (listener: () => void) => AgentHostUnsubscribe;\n prepareSelection?: (input: {\n projectLocked: boolean;\n selectedPath: string | null;\n }) => AgentHostAsyncResult<{\n isSelectedPathMissing: boolean;\n projects: AgentHostUserProject[];\n selection:\n | {\n kind: \"clear\";\n suppressedPath: string;\n }\n | {\n kind: \"none\";\n }\n | {\n kind: \"select\";\n path: string;\n };\n }>;\n remove?: (input: { path: string }) => AgentHostAsyncResult<void>;\n isNoProjectPath?: (input: { path: string }) => boolean;\n rememberDefaultSelection?: (input: {\n path: string | null;\n }) => AgentHostAsyncResult<void>;\n use: (input: { path: string }) => AgentHostAsyncResult<AgentHostUserProject>;\n};\n\nexport type AgentHostAgentSessionsApi = AgentHostRecord & {\n activate: (input: any) => AgentHostAsyncResult<any>;\n /**\n * @deprecated AgentGUI production writes must use AgentActivityRuntime.cancelSession.\n */\n cancel: (input: any) => AgentHostAsyncResult<any>;\n /**\n * @deprecated AgentGUI production writes must use AgentActivityRuntime.sendInput.\n */\n exec: (input: any) => AgentHostAsyncResult<any>;\n getComposerOptions?: (input: any) => AgentHostAsyncResult<any>;\n getState: (input: any) => AgentHostAsyncResult<any>;\n onEvent?: (listener: (event: any) => void) => AgentHostUnsubscribe;\n /**\n * @deprecated AgentGUI production writes must use AgentActivityRuntime.setSessionPinned.\n */\n pinSession?: (input: any) => AgentHostAsyncResult<any>;\n /**\n * @deprecated AgentGUI production sync must use AgentActivityRuntime.ensureSessionSynchronized.\n */\n releaseEventStream?: (input?: any) => AgentHostAsyncResult;\n /**\n * @deprecated AgentGUI production sync must use AgentActivityRuntime.ensureSessionSynchronized.\n */\n retainEventStream?: (input: any) => AgentHostAsyncResult;\n /**\n * @deprecated AgentGUI production writes must use AgentActivityRuntime.submitInteractive.\n */\n submitInteractive: (input: any) => AgentHostAsyncResult<any>;\n /**\n * @deprecated AgentGUI production UI must derive events from AgentActivityRuntime snapshots.\n */\n trackSettingsProjectChange?: (input: {\n action: \"clear\" | \"create_new\" | \"select_existing\";\n agentSessionId: string;\n provider?: string | null;\n }) => AgentHostAsyncResult<void>;\n subscribeEvents: (\n input: any,\n listener: (event: any) => void\n ) => AgentHostUnsubscribe;\n unactivate: (input: any) => AgentHostAsyncResult<any>;\n updateSettings: (input: any) => AgentHostAsyncResult<any>;\n};\n\n/**\n * @deprecated Legacy host DTO projection. AgentGUI production reads and writes\n * must use AgentActivityRuntime and AgentActivity* models.\n */\nexport type AgentHostWorkspaceAgentsApi = AgentHostRecord & {\n /**\n * @deprecated Use AgentActivityRuntime.deleteSession.\n */\n deleteSession: (\n input: AgentHostDeleteWorkspaceAgentSessionRuntimeInput\n ) => AgentHostAsyncResult<any>;\n /**\n * @deprecated Derive summaries from AgentActivitySnapshot/session messages.\n */\n getSessionSummary: (\n input: AgentHostWorkspaceAgentSessionSummaryRuntimeInput\n ) => AgentHostAsyncResult<AgentHostWorkspaceAgentSessionSummary>;\n /**\n * @deprecated Use AgentActivityRuntime.load/getSnapshot.\n */\n list: (\n input: string | AgentHostWorkspaceAgentsListInput\n ) => AgentHostAsyncResult<AgentHostWorkspaceAgentSnapshot>;\n /**\n * @deprecated Use AgentActivityRuntime.listSessionMessages.\n */\n listSessionMessages: (\n input: AgentHostWorkspaceAgentSessionMessagesRuntimeInput\n ) => AgentHostAsyncResult<AgentHostWorkspaceAgentSessionMessages>;\n};\n\nexport interface AgentHostRuntimeApi {\n account?: AgentHostAccountApi;\n clipboard: AgentHostClipboardApi;\n debug?: AgentHostDebugApi;\n filesystem: AgentHostFilesystemApi;\n meta?: AgentHostMetaApi;\n onHostEvent?: (listener: (event: any) => void) => AgentHostUnsubscribe;\n persistence?: AgentHostPersistenceApi;\n runtime?: AgentHostEnvironmentApi;\n toast?: AgentHostToastApi;\n userProjects?: AgentHostUserProjectsApi;\n workspace: AgentHostWorkspaceApi;\n workspaceAgentProbes?: AgentHostWorkspaceAgentProbesApi;\n}\n\nexport function toAgentHostRuntimeApi(\n hostApi: AgentHostInputApi | AgentHostRuntimeApi\n): AgentHostRuntimeApi {\n return {\n account: hostApi.account,\n clipboard: hostApi.clipboard,\n debug: hostApi.debug,\n filesystem: hostApi.filesystem,\n meta: hostApi.meta,\n onHostEvent: hostApi.onHostEvent,\n persistence: hostApi.persistence,\n runtime: hostApi.runtime,\n toast: hostApi.toast,\n userProjects: hostApi.userProjects,\n workspace: hostApi.workspace,\n workspaceAgentProbes: hostApi.workspaceAgentProbes\n };\n}\n","import { normalizeManagedAgentProvider } from \"./managedAgentProviders\";\nimport {\n claudeRoundedUrl,\n codexRoundedUrl,\n cursorColorfulUrl,\n cursorRoundedUrl,\n hermesRoundedUrl,\n manageAgentClaudeCodeUrl,\n manageAgentCodexUrl,\n manageAgentHermesUrl,\n manageAgentOpenCodeUrl,\n manageAgentTuttiUrl,\n manageAgentOpenclawUrl,\n providerRailClaudeCodeColorfulUrl,\n providerRailCodexColorfulUrl,\n providerRailHermesColorfulUrl,\n providerRailOpenCodeColorfulUrl,\n providerRailTuttiUrl,\n tuttiDocRoundedUrl,\n opencodeRoundedUrl,\n openclawRoundedUrl\n} from \"../managedAgentIconAssets\";\n\n/** Square avatar art for the managed toolchain agents (used by Manage Agents and Launch home Agents floor). */\nexport const MANAGED_AGENT_ICON_URLS: Record<string, string> = {\n \"claude-code\": manageAgentClaudeCodeUrl,\n codex: manageAgentCodexUrl,\n cursor: cursorRoundedUrl,\n hermes: manageAgentHermesUrl,\n tutti: manageAgentTuttiUrl,\n openclaw: manageAgentOpenclawUrl,\n opencode: manageAgentOpenCodeUrl\n};\n\n/** Colorful provider rail icons used by AgentGUI's left provider filter. */\nexport const MANAGED_AGENT_PROVIDER_RAIL_ICON_URLS: Record<string, string> = {\n \"claude-code\": providerRailClaudeCodeColorfulUrl,\n codex: providerRailCodexColorfulUrl,\n cursor: cursorColorfulUrl,\n hermes: providerRailHermesColorfulUrl,\n tutti: providerRailTuttiUrl,\n opencode: providerRailOpenCodeColorfulUrl\n};\n\n/** Rounded avatars for Room status / room activity panel only. */\nexport const MANAGED_AGENT_ICON_ROUNDED_URLS: Record<string, string> = {\n \"claude-code\": claudeRoundedUrl,\n codex: codexRoundedUrl,\n cursor: cursorColorfulUrl,\n hermes: hermesRoundedUrl,\n tutti: tuttiDocRoundedUrl,\n openclaw: openclawRoundedUrl,\n opencode: opencodeRoundedUrl\n};\n\n/** 与 Manage Agents 列表用的方图区分;房间预览弹幕条等仅用圆图 */\nconst MANAGED_AGENT_ROUNDED_ICON_FALLBACK_URL = tuttiDocRoundedUrl;\n\nexport const MANAGED_AGENT_ICON_FALLBACK_URL = manageAgentTuttiUrl;\n\nexport function managedAgentRoundedIconUrl(\n provider: string | undefined\n): string {\n return (\n MANAGED_AGENT_ICON_ROUNDED_URLS[normalizeManagedAgentProvider(provider)] ??\n MANAGED_AGENT_ROUNDED_ICON_FALLBACK_URL\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,IAAM,WAAW,oBAAI,IAA8C;AAMnE,IAAM,sCAAsC,oBAAI,IAAI;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,SAAS,+BACd,YACM;AACN,QAAM,OAAO,WAAW,KAAK,KAAK,EAAE,YAAY;AAChD,MAAI,CAAC,MAAM;AACT,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,MAAI,oCAAoC,IAAI,IAAI,GAAG;AACjD,UAAM,IAAI;AAAA,MACR,oCAAoC,IAAI;AAAA,IAC1C;AAAA,EACF;AACA,WAAS,IAAI,MAAM,UAAU;AAC/B;AAEO,SAAS,0BACd,MAC8C;AAC9C,SAAO,SAAS,IAAI,KAAK,KAAK,EAAE,YAAY,CAAC;AAC/C;AAEO,SAAS,uCAA6C;AAC3D,WAAS,MAAM;AACjB;;;ACrGA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AA6fH;AAzDG,SAAS,sCACd,SACA,YACS;AACT,SAAO,SAAS,eAAe,UAAU,KAAK;AAChD;AAEA,IAAM,8BAA8B;AAAA,EAClC;AACF;AAEA,IAAI,8BAA2D;AAM/D,IAAM,mBAAmB,oBAAI,IAAkC;AAQ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EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,UAAU;AACZ;AAGO,IAAM,kCAA0D;AAAA,EACrE,eAAe;AAAA,EACf,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AACZ;AAGA,IAAM,0CAA0C;AAEzC,IAAM,kCAAkC;AAExC,SAAS,2BACd,UACQ;AACR,SACE,gCAAgC,8BAA8B,QAAQ,CAAC,KACvE;AAEJ;","names":["createContext","useContext","useEffect","jsx","createContext","useEffect","useContext"]}