@tutti-os/agent-gui 0.0.66 → 0.0.67

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 (86) hide show
  1. package/dist/agent-conversation/index.d.ts +2 -2
  2. package/dist/agent-conversation/index.js +8 -8
  3. package/dist/agent-message-center/index.js +10 -10
  4. package/dist/{agentGuiNodeTypes-B9Aq3UEU.d.ts → agentGuiNodeTypes-DNXndXhV.d.ts} +1 -1
  5. package/dist/app/renderer/agentactivity.css +66 -0
  6. package/dist/app/renderer/assets/icons/agents/tutti-flat-filled.svg +12 -0
  7. package/dist/{chunk-N4I3TD4G.js → chunk-BX4UBTOI.js} +70 -2
  8. package/dist/chunk-BX4UBTOI.js.map +1 -0
  9. package/dist/{chunk-T3KGZV35.js → chunk-CTYXJGSW.js} +3 -3
  10. package/dist/{chunk-P5C3ED3V.js → chunk-DP2X4J2D.js} +3 -3
  11. package/dist/{chunk-LJE2W4EM.js → chunk-DQTBWOIK.js} +27 -4
  12. package/dist/chunk-DQTBWOIK.js.map +1 -0
  13. package/dist/chunk-IL2ORY23.js +193 -0
  14. package/dist/chunk-IL2ORY23.js.map +1 -0
  15. package/dist/{chunk-NOTZW5WH.js → chunk-JGU2VMDA.js} +3 -3
  16. package/dist/{chunk-DL6BMEHI.js → chunk-JWWHS34V.js} +3 -3
  17. package/dist/{chunk-6ULTMCKP.js → chunk-KS4ULVGM.js} +2 -2
  18. package/dist/{chunk-KRJF7WLJ.js → chunk-MA254MXR.js} +41 -7
  19. package/dist/chunk-MA254MXR.js.map +1 -0
  20. package/dist/{chunk-2IMBPRKV.js → chunk-NCAVJEHI.js} +1 -1
  21. package/dist/chunk-NCAVJEHI.js.map +1 -0
  22. package/dist/{chunk-R2NGSPQS.js → chunk-OEJQJP65.js} +3 -1
  23. package/dist/{chunk-R2NGSPQS.js.map → chunk-OEJQJP65.js.map} +1 -1
  24. package/dist/{chunk-UBBHWDMP.js → chunk-PFKY5W76.js} +9 -9
  25. package/dist/chunk-PFKY5W76.js.map +1 -0
  26. package/dist/{chunk-JTFWT6DK.js → chunk-QZYGCZNQ.js} +4 -4
  27. package/dist/{chunk-CKCUEHBW.js → chunk-RNFP7CUO.js} +9 -8
  28. package/dist/chunk-RNFP7CUO.js.map +1 -0
  29. package/dist/{chunk-UI3YDJTC.js → chunk-SKWDZTEV.js} +6 -4
  30. package/dist/chunk-SKWDZTEV.js.map +1 -0
  31. package/dist/{chunk-LQHYHF36.js → chunk-UAXKJNM2.js} +14 -7
  32. package/dist/chunk-UAXKJNM2.js.map +1 -0
  33. package/dist/{chunk-CTJQTUQ3.js → chunk-VIJQ5C33.js} +5 -5
  34. package/dist/{chunk-VBTPXEFH.js → chunk-XBR7D7X2.js} +2 -2
  35. package/dist/{chunk-DXVMRZHH.js → chunk-YU3XLPLC.js} +2 -2
  36. package/dist/{chunk-Z26P2QNT.js → chunk-YYAP6IK7.js} +4 -166
  37. package/dist/chunk-YYAP6IK7.js.map +1 -0
  38. package/dist/{chunk-HNODQVG2.js → chunk-ZABN3POD.js} +6 -2
  39. package/dist/chunk-ZABN3POD.js.map +1 -0
  40. package/dist/context-mention-palette/index.js +9 -9
  41. package/dist/cursor-flat-filled-CL7N3BTZ.svg +3 -0
  42. package/dist/i18n/index.d.ts +40 -6
  43. package/dist/i18n/index.js +2 -2
  44. package/dist/index.d.ts +48 -6
  45. package/dist/index.js +1420 -921
  46. package/dist/index.js.map +1 -1
  47. package/dist/queued-prompt-runtime.d.ts +2 -2
  48. package/dist/tutti-flat-filled-K32QBTZE.svg +12 -0
  49. package/dist/{types-Bxn8bLEp.d.ts → types-BxOwnK7K.d.ts} +3 -3
  50. package/dist/workbench/contribution.d.ts +1 -1
  51. package/dist/workbench/contribution.js +8 -8
  52. package/dist/workbench/index.d.ts +1 -1
  53. package/dist/workbench/index.js +11 -11
  54. package/dist/workbench/launch.d.ts +1 -1
  55. package/dist/workbench/launch.js +3 -3
  56. package/dist/workbench/providerCatalog.d.ts +4 -4
  57. package/dist/workbench/providerCatalog.js +1 -1
  58. package/dist/workbench/sessionTitle.d.ts +1 -1
  59. package/dist/workbench/sessionTitle.js +3 -3
  60. package/dist/workbench/state.d.ts +1 -1
  61. package/dist/workbench/state.js +3 -3
  62. package/dist/workbench/types.d.ts +2 -2
  63. package/dist/workbench/types.js +1 -1
  64. package/dist/workspace-agent-generated-files.js +4 -4
  65. package/package.json +12 -12
  66. package/dist/chunk-2IMBPRKV.js.map +0 -1
  67. package/dist/chunk-CKCUEHBW.js.map +0 -1
  68. package/dist/chunk-HNODQVG2.js.map +0 -1
  69. package/dist/chunk-KRJF7WLJ.js.map +0 -1
  70. package/dist/chunk-LJE2W4EM.js.map +0 -1
  71. package/dist/chunk-LQHYHF36.js.map +0 -1
  72. package/dist/chunk-N4I3TD4G.js.map +0 -1
  73. package/dist/chunk-TYGL25EL.js +0 -30
  74. package/dist/chunk-TYGL25EL.js.map +0 -1
  75. package/dist/chunk-UBBHWDMP.js.map +0 -1
  76. package/dist/chunk-UI3YDJTC.js.map +0 -1
  77. package/dist/chunk-Z26P2QNT.js.map +0 -1
  78. /package/dist/{chunk-T3KGZV35.js.map → chunk-CTYXJGSW.js.map} +0 -0
  79. /package/dist/{chunk-P5C3ED3V.js.map → chunk-DP2X4J2D.js.map} +0 -0
  80. /package/dist/{chunk-NOTZW5WH.js.map → chunk-JGU2VMDA.js.map} +0 -0
  81. /package/dist/{chunk-DL6BMEHI.js.map → chunk-JWWHS34V.js.map} +0 -0
  82. /package/dist/{chunk-6ULTMCKP.js.map → chunk-KS4ULVGM.js.map} +0 -0
  83. /package/dist/{chunk-JTFWT6DK.js.map → chunk-QZYGCZNQ.js.map} +0 -0
  84. /package/dist/{chunk-CTJQTUQ3.js.map → chunk-VIJQ5C33.js.map} +0 -0
  85. /package/dist/{chunk-VBTPXEFH.js.map → chunk-XBR7D7X2.js.map} +0 -0
  86. /package/dist/{chunk-DXVMRZHH.js.map → chunk-YU3XLPLC.js.map} +0 -0
@@ -4,11 +4,11 @@ import { W as WorkspaceLinkAction } from '../workspaceLinkActions-Bjy_XfBm.js';
4
4
  import { A as AgentMessageMarkdownWorkspaceAppIcon } from '../AgentMessageMarkdown-DeYPURtF.js';
5
5
  import { c as AgentConversationVM, W as WorkspaceAgentSessionDetailViewModel } from '../agentConversationVM-DPAgUJlR.js';
6
6
  export { B as BuildWorkspaceAgentSessionDetailInput, d as buildWorkspaceAgentSessionDetailViewModel } from '../agentConversationVM-DPAgUJlR.js';
7
- import { c as AgentGUIProviderSkillOption } from '../agentGuiNodeTypes-B9Aq3UEU.js';
7
+ import { c as AgentGUIProviderSkillOption } from '../agentGuiNodeTypes-DNXndXhV.js';
8
8
  export { W as WorkspaceAgentActivityCard, n as WorkspaceAgentActivitySession, q as WorkspaceAgentActivityTimelineItem } from '../workspaceAgentActivityListViewModel-DJvAqZso.js';
9
9
  import '@tutti-os/workspace-issue-manager/core';
10
10
  import '@tutti-os/agent-activity-core';
11
- import '../types-Bxn8bLEp.js';
11
+ import '../types-BxOwnK7K.js';
12
12
  import '@tutti-os/workspace-user-project/contracts';
13
13
 
14
14
  interface AgentConversationFlowProps {
@@ -6,20 +6,20 @@ import {
6
6
  projectAgentConversationVM,
7
7
  reconcileProjectedAgentConversationVM,
8
8
  useProjectedAgentConversation
9
- } from "../chunk-UBBHWDMP.js";
10
- import "../chunk-T3KGZV35.js";
9
+ } from "../chunk-PFKY5W76.js";
10
+ import "../chunk-CTYXJGSW.js";
11
11
  import "../chunk-PSLAWU25.js";
12
- import "../chunk-NOTZW5WH.js";
12
+ import "../chunk-JGU2VMDA.js";
13
13
  import "../chunk-Y35GDLP2.js";
14
14
  import "../chunk-LUGELG5V.js";
15
- import "../chunk-N4I3TD4G.js";
16
- import "../chunk-TYGL25EL.js";
15
+ import "../chunk-BX4UBTOI.js";
16
+ import "../chunk-IL2ORY23.js";
17
17
  import {
18
18
  translate
19
- } from "../chunk-6ULTMCKP.js";
19
+ } from "../chunk-KS4ULVGM.js";
20
20
  import "../chunk-PJP5BUU6.js";
21
- import "../chunk-R2NGSPQS.js";
22
- import "../chunk-KRJF7WLJ.js";
21
+ import "../chunk-OEJQJP65.js";
22
+ import "../chunk-MA254MXR.js";
23
23
 
24
24
  // shared/WorkspaceAgentSessionDetail.tsx
25
25
  import { useMemo } from "react";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  formatAgentGuiConversationPlainTitle
3
- } from "../chunk-VBTPXEFH.js";
3
+ } from "../chunk-XBR7D7X2.js";
4
4
  import {
5
5
  AgentInteractivePromptSurface,
6
6
  approvalOptionDisplayLabel,
7
7
  getPromptToolDetails,
8
8
  isPromptRequestIdTitle
9
- } from "../chunk-JTFWT6DK.js";
9
+ } from "../chunk-QZYGCZNQ.js";
10
10
  import {
11
11
  PLAN_IMPLEMENTATION_ACTION_IMPLEMENT,
12
12
  PLAN_IMPLEMENTATION_PROMPT,
@@ -15,7 +15,7 @@ import {
15
15
  } from "../chunk-MKHDRIGN.js";
16
16
  import {
17
17
  formatAgentSessionMentionText
18
- } from "../chunk-HNODQVG2.js";
18
+ } from "../chunk-ZABN3POD.js";
19
19
  import {
20
20
  AgentMessageMarkdown,
21
21
  CustomScrollArea,
@@ -25,28 +25,28 @@ import {
25
25
  extractExitPlanModeOptions,
26
26
  isExitPlanSwitchModeInput,
27
27
  normalizeAskUserQuestions
28
- } from "../chunk-T3KGZV35.js";
28
+ } from "../chunk-CTYXJGSW.js";
29
29
  import {
30
30
  userAvatarPlaceholderUrl,
31
31
  workspaceAgentActivityStatusLabel
32
- } from "../chunk-DXVMRZHH.js";
32
+ } from "../chunk-YU3XLPLC.js";
33
33
  import {
34
34
  resolveWorkspaceAgentSessionSortTimeUnixMs
35
35
  } from "../chunk-IBIMGLCD.js";
36
36
  import {
37
37
  managedAgentRoundedIconUrl
38
- } from "../chunk-N4I3TD4G.js";
38
+ } from "../chunk-BX4UBTOI.js";
39
39
  import {
40
40
  workspaceAgentProviderLabel
41
- } from "../chunk-TYGL25EL.js";
41
+ } from "../chunk-IL2ORY23.js";
42
42
  import {
43
43
  AgentGuiI18nProvider,
44
44
  getActiveUiLanguage,
45
45
  useTranslation
46
- } from "../chunk-6ULTMCKP.js";
46
+ } from "../chunk-KS4ULVGM.js";
47
47
  import "../chunk-PJP5BUU6.js";
48
- import "../chunk-R2NGSPQS.js";
49
- import "../chunk-KRJF7WLJ.js";
48
+ import "../chunk-OEJQJP65.js";
49
+ import "../chunk-MA254MXR.js";
50
50
  import "../chunk-GCBDIQDX.js";
51
51
 
52
52
  // agent-message-center/WorkspaceAgentMessageCenterPanel.tsx
@@ -1,5 +1,5 @@
1
1
  import { AgentActivityUsage } from '@tutti-os/agent-activity-core';
2
- import { i as AgentHostAgentSessionCommand, j as AgentHostAgentSessionComposerSettings, l as AgentHostAgentSessionReasoningEffort, m as AgentHostAgentSessionSpeed, k as AgentHostAgentSessionPermissionConfig, n as AgentHostAgentSessionState, a as AgentGUIProvider, q as AgentPromptContentBlock, A as AgentGUINodeData, f as AgentGUIProviderTarget, b as AgentGUIProviderRailMode, c as AgentGUIProviderReadinessGate } from './types-Bxn8bLEp.js';
2
+ import { i as AgentHostAgentSessionCommand, j as AgentHostAgentSessionComposerSettings, l as AgentHostAgentSessionReasoningEffort, m as AgentHostAgentSessionSpeed, k as AgentHostAgentSessionPermissionConfig, n as AgentHostAgentSessionState, a as AgentGUIProvider, q as AgentPromptContentBlock, A as AgentGUINodeData, f as AgentGUIProviderTarget, b as AgentGUIProviderRailMode, c as AgentGUIProviderReadinessGate } from './types-BxOwnK7K.js';
3
3
  import { A as AgentHostBatchUserInfoInput, a as AgentHostBatchUserInfoResult, b as AgentHostDeleteWorkspaceAgentSessionInput, k as AgentHostWorkspaceAgentSessionSummaryInput, j as AgentHostWorkspaceAgentSessionSummary, e as AgentHostWorkspaceAgentListInput, l as AgentHostWorkspaceAgentSnapshot, i as AgentHostWorkspaceAgentSessionMessagesInput, h as AgentHostWorkspaceAgentSessionMessages, p as WorkspaceAgentActivitySyncState } from './workspaceAgentActivityListViewModel-DJvAqZso.js';
4
4
  import { A as AgentApprovalItemVM, a as AgentAskUserQuestionVM, b as AgentConversationPromptVM, c as AgentConversationVM, W as WorkspaceAgentSessionDetailViewModel } from './agentConversationVM-DPAgUJlR.js';
5
5
  import { WorkspaceUserProjectService } from '@tutti-os/workspace-user-project/contracts';
@@ -4611,6 +4611,7 @@ aside.workspace-agents-status-panel
4611
4611
  max-width: min(100%, var(--agent-gui-workbench-header-title-max-width));
4612
4612
  min-width: 0;
4613
4613
  align-items: center;
4614
+ gap: 8px;
4614
4615
  padding: 0 20px;
4615
4616
  pointer-events: none;
4616
4617
  }
@@ -5175,6 +5176,36 @@ aside.workspace-agents-status-panel
5175
5176
  );
5176
5177
  }
5177
5178
 
5179
+ .agent-gui-node__account-reward-toast {
5180
+ border: 1px solid rgba(218, 233, 255, 0.62);
5181
+ background:
5182
+ linear-gradient(
5183
+ 90deg,
5184
+ rgba(18, 60, 142, 0.08),
5185
+ rgba(20, 66, 160, 0.2) 58%,
5186
+ rgba(12, 32, 92, 0.34)
5187
+ ),
5188
+ url("./assets/commercial/registration-credits-bg.png") center / cover
5189
+ no-repeat;
5190
+ box-shadow:
5191
+ 0 14px 28px rgba(0, 0, 0, 0.2),
5192
+ inset 0 0 0 1px rgba(255, 255, 255, 0.24);
5193
+ }
5194
+
5195
+ .agent-gui-node__account-reward-toast::before {
5196
+ content: "";
5197
+ position: absolute;
5198
+ inset: 0;
5199
+ pointer-events: none;
5200
+ background:
5201
+ radial-gradient(
5202
+ circle at 17% 28%,
5203
+ rgba(255, 255, 255, 0.5),
5204
+ transparent 24%
5205
+ ),
5206
+ linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 54%);
5207
+ }
5208
+
5178
5209
  .agent-gui-node__conversation-list {
5179
5210
  display: flex;
5180
5211
  flex-direction: column;
@@ -8401,11 +8432,46 @@ html[data-theme="light"] [data-message-center-item-id].agent-gui-edge-glow {
8401
8432
  width: 52px;
8402
8433
  min-width: 0;
8403
8434
  flex: 0 0 auto;
8435
+ flex-direction: column;
8436
+ align-items: center;
8404
8437
  justify-content: center;
8438
+ gap: 8px;
8405
8439
  padding: 0 0 12px;
8406
8440
  -webkit-app-region: no-drag;
8407
8441
  }
8408
8442
 
8443
+ .agent-gui-node__provider-rail-config-button {
8444
+ display: grid;
8445
+ width: 32px;
8446
+ height: 32px;
8447
+ place-items: center;
8448
+ border: 0;
8449
+ border-radius: 8px;
8450
+ background: transparent;
8451
+ color: var(--text-secondary);
8452
+ padding: 0;
8453
+ transition:
8454
+ background 120ms ease,
8455
+ color 120ms ease;
8456
+ -webkit-app-region: no-drag;
8457
+ }
8458
+
8459
+ .agent-gui-node__provider-rail-config-button:hover:not(:disabled),
8460
+ .agent-gui-node__provider-rail-config-button[data-state="open"] {
8461
+ background: var(--transparency-hover);
8462
+ color: var(--text-primary);
8463
+ }
8464
+
8465
+ .agent-gui-node__provider-rail-config-button:focus-visible {
8466
+ outline: none;
8467
+ box-shadow: 0 0 0 2px var(--border-focus);
8468
+ }
8469
+
8470
+ .agent-gui-node__provider-rail-config-button:disabled {
8471
+ color: var(--text-tertiary);
8472
+ cursor: not-allowed;
8473
+ }
8474
+
8409
8475
  .agent-gui-node__provider-rail-tile {
8410
8476
  display: grid;
8411
8477
  width: 52px;
@@ -0,0 +1,12 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_4006_12727)">
3
+ <path d="M11.211 0.548002C15.073 0.543295 17.9345 1.81179 19.9296 3.83278L20.0239 3.92959C23.0552 7.07998 23.023 10.8748 22.9943 11.9018C22.8951 15.489 21.1542 19.394 18.0294 21.4325C15.586 23.0268 12.2832 23.8613 9.04026 23.2149C5.73648 22.5563 2.62419 20.3848 0.625961 16.2234L3.20797 14.9835C4.83801 18.3782 7.22765 19.933 9.60024 20.4059C12.0336 20.891 14.5815 20.2622 16.4644 19.0336L16.4645 19.0335C18.641 17.6137 20.0521 14.6807 20.1311 11.8223V11.8219C20.1548 10.9733 20.1554 8.19731 17.96 5.91559C16.5591 4.45982 14.4443 3.40834 11.2145 3.41226C6.37955 3.4188 3.86602 6.76421 3.83019 9.29717L3.82979 9.35691C3.83105 10.3775 4.17276 11.3212 4.80308 11.8258C5.35665 12.269 6.54025 12.6884 9.00181 11.7756C9.74148 11.5012 10.4014 11.1957 11.0683 10.8751C11.7204 10.5617 12.4153 10.2154 13.1403 9.91163C14.6484 9.2797 16.3347 8.80763 18.7078 8.80454L18.7115 11.6688C16.7745 11.6713 15.463 12.0439 14.2473 12.5533C13.6103 12.8202 13.0118 13.1188 12.3092 13.4566C11.6213 13.7872 10.8653 14.1393 9.99793 14.4611H9.99777C7.01416 15.5675 4.64823 15.3711 3.01281 14.0617C1.45417 12.8137 0.967387 10.8679 0.965528 9.36047L0.965609 9.36039C0.960216 5.06707 4.93334 0.55642 11.2108 0.548002H11.211Z" fill="black"/>
4
+ <path d="M6.97341 14.9505V6.38824H9.83775V14.9505C9.83775 15.3767 9.92837 15.571 9.98458 15.6564C10.0386 15.7384 10.1373 15.8367 10.3693 15.9334C10.9249 16.1648 11.8087 16.2252 13.1098 16.2252V19.0894C11.9066 19.0894 10.4383 19.065 9.26781 18.5774C8.63685 18.3146 8.02895 17.8947 7.59224 17.2314C7.15772 16.5714 6.97341 15.793 6.97341 14.9505Z" fill="black"/>
5
+ <path d="M12.918 14.9505V6.38824H15.7824V14.9505C15.7824 15.3767 15.873 15.571 15.9292 15.6564C15.9832 15.7384 16.0819 15.8367 16.3139 15.9334C16.8695 16.1648 17.7533 16.2252 19.0544 16.2252V19.0894C17.8512 19.0894 16.3829 19.065 15.2124 18.5774C14.5815 18.3146 13.9736 17.8947 13.5369 17.2314C13.1023 16.5714 12.918 15.793 12.918 14.9505Z" fill="black"/>
6
+ </g>
7
+ <defs>
8
+ <clipPath id="clip0_4006_12727">
9
+ <rect width="24" height="24" fill="white"/>
10
+ </clipPath>
11
+ </defs>
12
+ </svg>
@@ -1,3 +1,6 @@
1
+ import {
2
+ WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN
3
+ } from "./chunk-IL2ORY23.js";
1
4
  import {
2
5
  claudeRoundedUrl,
3
6
  codexRoundedUrl,
@@ -18,7 +21,7 @@ import {
18
21
  providerRailHermesColorfulUrl,
19
22
  providerRailTuttiUrl,
20
23
  tuttiDocRoundedUrl
21
- } from "./chunk-R2NGSPQS.js";
24
+ } from "./chunk-OEJQJP65.js";
22
25
 
23
26
  // shared/agentCustomMentionKinds.ts
24
27
  var registry = /* @__PURE__ */ new Map();
@@ -60,6 +63,7 @@ function resetAgentCustomMentionKindsForTests() {
60
63
  import {
61
64
  createContext,
62
65
  useContext,
66
+ useEffect,
63
67
  useSyncExternalStore
64
68
  } from "react";
65
69
  import { jsx } from "react/jsx-runtime";
@@ -67,11 +71,30 @@ var AgentActivityRuntimeContext = createContext(
67
71
  null
68
72
  );
69
73
  var currentAgentActivityRuntime = null;
74
+ var runtimesByOrigin = /* @__PURE__ */ new Map();
75
+ function normalizeRuntimeOrigin(origin) {
76
+ return origin?.trim() || WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN;
77
+ }
70
78
  function AgentActivityRuntimeProvider({
71
79
  children,
72
80
  runtime
73
81
  }) {
74
82
  currentAgentActivityRuntime = runtime ?? null;
83
+ const origin = normalizeRuntimeOrigin(runtime?.origin);
84
+ if (origin && runtime) {
85
+ runtimesByOrigin.set(origin, runtime);
86
+ }
87
+ useEffect(() => {
88
+ if (!origin || !runtime) {
89
+ return;
90
+ }
91
+ runtimesByOrigin.set(origin, runtime);
92
+ return () => {
93
+ if (runtimesByOrigin.get(origin) === runtime) {
94
+ runtimesByOrigin.delete(origin);
95
+ }
96
+ };
97
+ }, [origin, runtime]);
75
98
  return /* @__PURE__ */ jsx(AgentActivityRuntimeContext.Provider, { value: runtime ?? null, children });
76
99
  }
77
100
  function useAgentActivityRuntime() {
@@ -107,9 +130,21 @@ function getAgentActivityRuntime() {
107
130
  function getOptionalAgentActivityRuntime() {
108
131
  return getExplicitWindowTestAgentActivityRuntime() ?? currentAgentActivityRuntime ?? getTestAgentActivityRuntime();
109
132
  }
133
+ function getAgentActivityRuntimeByOrigin(origin) {
134
+ const normalizedOrigin = normalizeRuntimeOrigin(origin);
135
+ const runtime = runtimesByOrigin.get(normalizedOrigin);
136
+ if (runtime) {
137
+ return runtime;
138
+ }
139
+ if (normalizedOrigin === WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN) {
140
+ return getOptionalAgentActivityRuntime();
141
+ }
142
+ return null;
143
+ }
110
144
  function resetAgentActivityRuntimeForTests() {
111
145
  if (process.env.NODE_ENV === "test") {
112
146
  currentAgentActivityRuntime = null;
147
+ runtimesByOrigin.clear();
113
148
  }
114
149
  }
115
150
  function setAgentActivityRuntimeForTests(runtime) {
@@ -152,6 +187,7 @@ function getExplicitWindowTestAgentActivityRuntime() {
152
187
  import {
153
188
  createContext as createContext2,
154
189
  useContext as useContext2,
190
+ useEffect as useEffect2,
155
191
  useMemo
156
192
  } from "react";
157
193
 
@@ -180,6 +216,10 @@ var AgentActivityHostContext = createContext2(
180
216
  null
181
217
  );
182
218
  var currentAgentHostApi = null;
219
+ var hostApiByOrigin = /* @__PURE__ */ new Map();
220
+ function resolveHostOrigin(runtime) {
221
+ return runtime?.origin?.trim() || WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN;
222
+ }
183
223
  function AgentActivityHostProvider({
184
224
  agentActivityRuntime,
185
225
  agentHostApi,
@@ -190,6 +230,21 @@ function AgentActivityHostProvider({
190
230
  [agentHostApi]
191
231
  );
192
232
  currentAgentHostApi = resolvedAgentHostApi;
233
+ const origin = resolveHostOrigin(agentActivityRuntime);
234
+ if (resolvedAgentHostApi) {
235
+ hostApiByOrigin.set(origin, resolvedAgentHostApi);
236
+ }
237
+ useEffect2(() => {
238
+ if (!resolvedAgentHostApi) {
239
+ return;
240
+ }
241
+ hostApiByOrigin.set(origin, resolvedAgentHostApi);
242
+ return () => {
243
+ if (hostApiByOrigin.get(origin) === resolvedAgentHostApi) {
244
+ hostApiByOrigin.delete(origin);
245
+ }
246
+ };
247
+ }, [origin, resolvedAgentHostApi]);
193
248
  return /* @__PURE__ */ jsx2(AgentActivityRuntimeProvider, { runtime: agentActivityRuntime, children: /* @__PURE__ */ jsx2(AgentActivityHostContext.Provider, { value: resolvedAgentHostApi, children }) });
194
249
  }
195
250
  function useAgentHostApi() {
@@ -207,6 +262,17 @@ function useOptionalAgentHostApi() {
207
262
  function getOptionalAgentHostApi() {
208
263
  return getExplicitWindowTestAgentHostApi() ?? currentAgentHostApi ?? getTestAgentHostApi();
209
264
  }
265
+ function getAgentHostApiByOrigin(origin) {
266
+ const normalizedOrigin = origin?.trim() || WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN;
267
+ const hostApi = hostApiByOrigin.get(normalizedOrigin);
268
+ if (hostApi) {
269
+ return hostApi;
270
+ }
271
+ if (normalizedOrigin === WORKSPACE_AGENT_ACTIVITY_RUNTIME_SESSION_ORIGIN) {
272
+ return getOptionalAgentHostApi();
273
+ }
274
+ return null;
275
+ }
210
276
  function getTestAgentHostApi() {
211
277
  if (process.env.NODE_ENV !== "test") {
212
278
  return null;
@@ -281,15 +347,17 @@ export {
281
347
  useAgentActivitySnapshot,
282
348
  getAgentActivityRuntime,
283
349
  getOptionalAgentActivityRuntime,
350
+ getAgentActivityRuntimeByOrigin,
284
351
  resetAgentActivityRuntimeForTests,
285
352
  setAgentActivityRuntimeForTests,
286
353
  AgentActivityHostProvider,
287
354
  useAgentHostApi,
288
355
  useOptionalAgentHostApi,
289
356
  getOptionalAgentHostApi,
357
+ getAgentHostApiByOrigin,
290
358
  MANAGED_AGENT_ICON_URLS,
291
359
  MANAGED_AGENT_PROVIDER_RAIL_ICON_URLS,
292
360
  MANAGED_AGENT_ICON_FALLBACK_URL,
293
361
  managedAgentRoundedIconUrl
294
362
  };
295
- //# sourceMappingURL=chunk-N4I3TD4G.js.map
363
+ //# sourceMappingURL=chunk-BX4UBTOI.js.map
@@ -0,0 +1 @@
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 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 type { AgentGUIProviderTargetRef } from \"./types\";\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 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 AgentActivityRuntimeSessionSectionsResult {\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 AgentActivityRuntimeActivateSessionInput {\n agentSessionId: string;\n agentTargetId?: string | null;\n cwd?: string;\n initialContent?: AgentActivitySendInput[\"content\"];\n /** 仅展示用首轮文本(bundle 折叠成一个 chip);initialContent 仍带展开后的文件。 */\n initialDisplayPrompt?: string | null;\n metadata?: Record<string, unknown>;\n mode: \"existing\" | \"new\";\n openclawGatewayReady?: boolean;\n provider?: string;\n /**\n * Opaque host-owned target reference. AgentGUI passes this through only; hosts\n * must not treat it as authority and must re-authenticate before launch.\n */\n providerTargetRef?: AgentGUIProviderTargetRef | null;\n settings?: AgentHostAgentSessionComposerSettings;\n title?: string;\n visible?: boolean;\n workspaceId: string;\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 promptContentUploadSupport?: {\n file?: boolean;\n image?: boolean;\n };\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 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 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\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 agentGuiBatch?: AgentHostAgentGuiBatchApi;\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 AgentHostAgentGuiBatchApi = AgentHostRecord & {\n exportRun: (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 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 agentGuiBatch: AgentHostAgentGuiBatchApi;\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 agentGuiBatch: hostApi.agentGuiBatch ?? ({} as AgentHostAgentGuiBatchApi),\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 geminiRoundedUrl,\n hermesRoundedUrl,\n manageAgentClaudeCodeUrl,\n manageAgentCodexUrl,\n manageAgentGeminiUrl,\n manageAgentHermesUrl,\n manageAgentTuttiUrl,\n manageAgentOpenclawUrl,\n providerRailClaudeCodeColorfulUrl,\n providerRailCodexColorfulUrl,\n providerRailHermesColorfulUrl,\n providerRailTuttiUrl,\n tuttiDocRoundedUrl,\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 gemini: manageAgentGeminiUrl,\n hermes: manageAgentHermesUrl,\n tutti: manageAgentTuttiUrl,\n openclaw: manageAgentOpenclawUrl\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};\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 gemini: geminiRoundedUrl,\n hermes: hermesRoundedUrl,\n tutti: tuttiDocRoundedUrl,\n openclaw: openclawRoundedUrl\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;AAsaH;AAlDJ,IAAM,8BAA8B;AAAA,EAClC;AACF;AAEA,IAAI,8BAA2D;AAM/D,IAAM,mBAAmB,oBAAI,IAAkC;AAQ/D,SAAS,uBAAuB,QAA2C;AACzE,SAAO,QAAQ,KAAK,KAAK;AAC3B;AAMO,SAAS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AAGO,IAAM,kCAA0D;AAAA,EACrE,eAAe;AAAA,EACf,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,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"]}
@@ -3,11 +3,11 @@ import {
3
3
  getOptionalAgentHostApi,
4
4
  managedAgentRoundedIconUrl,
5
5
  useOptionalAgentHostApi
6
- } from "./chunk-N4I3TD4G.js";
6
+ } from "./chunk-BX4UBTOI.js";
7
7
  import {
8
8
  translate,
9
9
  useTranslation
10
- } from "./chunk-6ULTMCKP.js";
10
+ } from "./chunk-KS4ULVGM.js";
11
11
  import {
12
12
  resolveAgentWorkspaceFileVisualKind
13
13
  } from "./chunk-PJP5BUU6.js";
@@ -3697,4 +3697,4 @@ export {
3697
3697
  CustomScrollArea,
3698
3698
  MessageSquareMoreIcon
3699
3699
  };
3700
- //# sourceMappingURL=chunk-T3KGZV35.js.map
3700
+ //# sourceMappingURL=chunk-CTYXJGSW.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  agentGuiWorkbenchOpenSessionActivationType,
3
3
  agentGuiWorkbenchPrefillPromptActivationType
4
- } from "./chunk-2IMBPRKV.js";
4
+ } from "./chunk-NCAVJEHI.js";
5
5
  import {
6
6
  isAgentGuiWorkbenchProvider,
7
7
  normalizeAgentGuiWorkbenchProvider
8
- } from "./chunk-CKCUEHBW.js";
8
+ } from "./chunk-RNFP7CUO.js";
9
9
 
10
10
  // workbench/launch.ts
11
11
  var agentGuiWorkbenchTypeId = "agent-gui";
@@ -237,4 +237,4 @@ export {
237
237
  resolveAgentGuiWorkbenchLaunchDockEntryId,
238
238
  shouldReuseAgentGuiWorkbenchDockEntryNode
239
239
  };
240
- //# sourceMappingURL=chunk-P5C3ED3V.js.map
240
+ //# sourceMappingURL=chunk-DP2X4J2D.js.map
@@ -7,8 +7,9 @@ import {
7
7
  manageAgentClaudeCodeUrl,
8
8
  manageAgentTuttiUrl,
9
9
  normalizeManagedAgentProvider,
10
- openclawRoundedUrl
11
- } from "./chunk-R2NGSPQS.js";
10
+ openclawRoundedUrl,
11
+ tuttiAgentRoundedUrl
12
+ } from "./chunk-OEJQJP65.js";
12
13
 
13
14
  // app/renderer/assets/icons/agents/claudecode-flat-filled.svg
14
15
  var claudecode_flat_filled_default = "./claudecode-flat-filled-NHO4JCVK.svg";
@@ -16,6 +17,12 @@ var claudecode_flat_filled_default = "./claudecode-flat-filled-NHO4JCVK.svg";
16
17
  // app/renderer/assets/icons/agents/codex-flat-filled.svg
17
18
  var codex_flat_filled_default = "./codex-flat-filled-WYHCF5VR.svg";
18
19
 
20
+ // app/renderer/assets/icons/agents/cursor-flat-filled.svg
21
+ var cursor_flat_filled_default = "./cursor-flat-filled-CL7N3BTZ.svg";
22
+
23
+ // app/renderer/assets/icons/agents/tutti-flat-filled.svg
24
+ var tutti_flat_filled_default = "./tutti-flat-filled-K32QBTZE.svg";
25
+
19
26
  // agentGuiSessionProviderIconUrls.ts
20
27
  function resolveAgentGuiSessionProviderIconUrl(provider) {
21
28
  switch (normalizeManagedAgentProvider(provider)) {
@@ -29,6 +36,20 @@ function resolveAgentGuiSessionProviderIconUrl(provider) {
29
36
  return null;
30
37
  }
31
38
  }
39
+ function resolveAgentGuiSessionProviderFlatIconUrl(provider) {
40
+ switch (normalizeManagedAgentProvider(provider)) {
41
+ case "claude-code":
42
+ return claudecode_flat_filled_default;
43
+ case "codex":
44
+ return codex_flat_filled_default;
45
+ case "cursor":
46
+ return cursor_flat_filled_default;
47
+ case "tutti":
48
+ return tutti_flat_filled_default;
49
+ default:
50
+ return null;
51
+ }
52
+ }
32
53
 
33
54
  // agent-gui/agentGuiNode/model/agentGuiRailLayout.ts
34
55
  function clamp(value, min, max) {
@@ -119,11 +140,13 @@ var agentGuiDockIconUrls = {
119
140
  gemini: geminiRoundedUrl,
120
141
  hermes: hermesRoundedUrl,
121
142
  nexight: manageAgentTuttiUrl,
122
- openclaw: openclawRoundedUrl
143
+ openclaw: openclawRoundedUrl,
144
+ "tutti-agent": tuttiAgentRoundedUrl
123
145
  };
124
146
 
125
147
  export {
126
148
  resolveAgentGuiSessionProviderIconUrl,
149
+ resolveAgentGuiSessionProviderFlatIconUrl,
127
150
  AGENT_GUI_CONVERSATION_RAIL_MIN_WIDTH_PX,
128
151
  AGENT_GUI_DETAIL_MIN_WIDTH_PX,
129
152
  AGENT_GUI_COLLAPSED_MIN_WIDTH_PX,
@@ -135,4 +158,4 @@ export {
135
158
  agentGuiDockIconUrl,
136
159
  agentGuiDockIconUrls
137
160
  };
138
- //# sourceMappingURL=chunk-LJE2W4EM.js.map
161
+ //# sourceMappingURL=chunk-DQTBWOIK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../agentGuiSessionProviderIconUrls.ts","../agent-gui/agentGuiNode/model/agentGuiRailLayout.ts","../dockIcons.ts"],"sourcesContent":["import claudeCodeFlatFilledIconUrl from \"./app/renderer/assets/icons/agents/claudecode-flat-filled.svg\";\nimport codexFlatFilledIconUrl from \"./app/renderer/assets/icons/agents/codex-flat-filled.svg\";\nimport cursorFlatFilledIconUrl from \"./app/renderer/assets/icons/agents/cursor-flat-filled.svg\";\nimport tuttiFlatFilledIconUrl from \"./app/renderer/assets/icons/agents/tutti-flat-filled.svg\";\nimport { cursorColorfulUrl } from \"./managedAgentIconAssets\";\nimport { normalizeManagedAgentProvider } from \"./shared/managedAgentProviders\";\n\nexport {\n claudeCodeFlatFilledIconUrl,\n codexFlatFilledIconUrl,\n cursorColorfulUrl,\n cursorFlatFilledIconUrl,\n tuttiFlatFilledIconUrl\n};\n\n/**\n * Colorful session icons, used where the icon renders as a real <img> avatar\n * (collapsed workbench header, dock popup). Colorful assets keep their fill.\n */\nexport function resolveAgentGuiSessionProviderIconUrl(\n provider: string | undefined\n): string | null {\n switch (normalizeManagedAgentProvider(provider)) {\n case \"claude-code\":\n return claudeCodeFlatFilledIconUrl;\n case \"codex\":\n return codexFlatFilledIconUrl;\n case \"cursor\":\n return cursorColorfulUrl;\n default:\n return null;\n }\n}\n\n/**\n * Flat monochrome session icons, used where the icon renders through a CSS\n * mask (e.g. the conversation rail rows). Colorful assets would collapse to a\n * solid square under a mask, so these must be single-color glyphs with a\n * transparent background.\n */\nexport function resolveAgentGuiSessionProviderFlatIconUrl(\n provider: string | undefined\n): string | null {\n switch (normalizeManagedAgentProvider(provider)) {\n case \"claude-code\":\n return claudeCodeFlatFilledIconUrl;\n case \"codex\":\n return codexFlatFilledIconUrl;\n case \"cursor\":\n return cursorFlatFilledIconUrl;\n case \"tutti\":\n return tuttiFlatFilledIconUrl;\n default:\n return null;\n }\n}\n","function clamp(value: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, value));\n}\n\n// Keep aligned with the issue manager task-list rail dimensions.\nexport const AGENT_GUI_CONVERSATION_RAIL_DEFAULT_WIDTH_PX = 280;\nexport const AGENT_GUI_CONVERSATION_RAIL_MIN_WIDTH_PX = 248;\nexport const AGENT_GUI_CONVERSATION_RAIL_MAX_WIDTH_PX = 520;\nexport const AGENT_GUI_DETAIL_MIN_WIDTH_PX = 220;\nexport const AGENT_GUI_RAIL_RESIZE_HANDLE_WIDTH_PX = 10;\nexport const AGENT_GUI_COLLAPSED_MIN_WIDTH_PX = 460;\nexport const AGENT_GUI_EXPANDED_MIN_WIDTH_PX =\n AGENT_GUI_CONVERSATION_RAIL_MIN_WIDTH_PX +\n AGENT_GUI_DETAIL_MIN_WIDTH_PX +\n AGENT_GUI_RAIL_RESIZE_HANDLE_WIDTH_PX;\nexport const AGENT_GUI_AUTO_COLLAPSE_WIDTH_PX = 610;\nexport const AGENT_GUI_EXPANDED_TARGET_WIDTH_PX = 800;\n\nexport interface AgentGUIExpandedWindowFrameInput {\n position: { x: number; y: number };\n width: number;\n height: number;\n desktopSize: { width: number; height: number };\n conversationRailWidthPx: number | null | undefined;\n}\n\nexport function shouldAutoCollapseAgentGUIConversationRail(\n containerWidthPx: number\n): boolean {\n return (\n Number.isFinite(containerWidthPx) &&\n containerWidthPx > 0 &&\n containerWidthPx <= AGENT_GUI_AUTO_COLLAPSE_WIDTH_PX\n );\n}\n\nexport function resolveAgentGUIConversationRailMaxWidthPx(\n containerWidthPx: number\n): number {\n const safeContainerWidth =\n Number.isFinite(containerWidthPx) && containerWidthPx > 0\n ? containerWidthPx\n : AGENT_GUI_CONVERSATION_RAIL_DEFAULT_WIDTH_PX +\n AGENT_GUI_DETAIL_MIN_WIDTH_PX +\n AGENT_GUI_RAIL_RESIZE_HANDLE_WIDTH_PX;\n\n return Math.max(\n AGENT_GUI_CONVERSATION_RAIL_MIN_WIDTH_PX,\n Math.min(\n AGENT_GUI_CONVERSATION_RAIL_MAX_WIDTH_PX,\n safeContainerWidth -\n AGENT_GUI_DETAIL_MIN_WIDTH_PX -\n AGENT_GUI_RAIL_RESIZE_HANDLE_WIDTH_PX\n )\n );\n}\n\nexport function clampAgentGUIConversationRailWidthPx(\n widthPx: number | null | undefined,\n containerWidthPx: number\n): number {\n const preferredWidthPx =\n typeof widthPx === \"number\" && Number.isFinite(widthPx)\n ? Math.round(widthPx)\n : null;\n\n return clamp(\n preferredWidthPx ?? AGENT_GUI_CONVERSATION_RAIL_DEFAULT_WIDTH_PX,\n AGENT_GUI_CONVERSATION_RAIL_MIN_WIDTH_PX,\n resolveAgentGUIConversationRailMaxWidthPx(containerWidthPx)\n );\n}\n\nexport function resolveNextAgentGUIConversationRailWidthPx(input: {\n currentWidthPx: number | null | undefined;\n requestedWidthPx: number;\n containerWidthPx: number;\n}): number | null {\n const nextWidthPx = clampAgentGUIConversationRailWidthPx(\n input.requestedWidthPx,\n input.containerWidthPx\n );\n if (input.currentWidthPx === nextWidthPx) {\n return input.currentWidthPx;\n }\n\n if (input.currentWidthPx === null || input.currentWidthPx === undefined) {\n const defaultWidthPx = clampAgentGUIConversationRailWidthPx(\n null,\n input.containerWidthPx\n );\n if (nextWidthPx === defaultWidthPx) {\n return null;\n }\n }\n\n return nextWidthPx;\n}\n\nexport function resolveAgentGUIExpandedWindowFrame(\n input: AgentGUIExpandedWindowFrameInput\n): {\n position: { x: number; y: number };\n size: { width: number; height: number };\n} {\n const desiredRailWidthPx = clampAgentGUIConversationRailWidthPx(\n input.conversationRailWidthPx,\n AGENT_GUI_CONVERSATION_RAIL_MAX_WIDTH_PX +\n AGENT_GUI_DETAIL_MIN_WIDTH_PX +\n AGENT_GUI_RAIL_RESIZE_HANDLE_WIDTH_PX\n );\n const desiredWidthPx = Math.max(\n Math.round(input.width),\n desiredRailWidthPx +\n AGENT_GUI_DETAIL_MIN_WIDTH_PX +\n AGENT_GUI_RAIL_RESIZE_HANDLE_WIDTH_PX,\n AGENT_GUI_EXPANDED_MIN_WIDTH_PX,\n AGENT_GUI_EXPANDED_TARGET_WIDTH_PX\n );\n const desktopWidthPx =\n Number.isFinite(input.desktopSize.width) && input.desktopSize.width > 0\n ? Math.round(input.desktopSize.width)\n : desiredWidthPx;\n const nextWidthPx = Math.min(desiredWidthPx, desktopWidthPx);\n const maxX = Math.max(0, desktopWidthPx - nextWidthPx);\n const nextX = clamp(Math.round(input.position.x), 0, maxX);\n\n return {\n position: {\n x: nextX,\n y: input.position.y\n },\n size: {\n width: nextWidthPx,\n height: input.height\n }\n };\n}\n","import {\n codexRoundedUrl,\n cursorRoundedUrl,\n geminiRoundedUrl,\n hermesRoundedUrl,\n manageAgentClaudeCodeUrl,\n manageAgentTuttiUrl,\n openclawRoundedUrl,\n tuttiAgentRoundedUrl\n} from \"./managedAgentIconAssets.ts\";\n\nexport const agentGuiDockIconUrl = codexRoundedUrl;\n\nexport const agentGuiDockIconUrls = {\n \"claude-code\": manageAgentClaudeCodeUrl,\n codex: codexRoundedUrl,\n cursor: cursorRoundedUrl,\n gemini: geminiRoundedUrl,\n hermes: hermesRoundedUrl,\n nexight: manageAgentTuttiUrl,\n openclaw: openclawRoundedUrl,\n \"tutti-agent\": tuttiAgentRoundedUrl\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAmBO,SAAS,sCACd,UACe;AACf,UAAQ,8BAA8B,QAAQ,GAAG;AAAA,IAC/C,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAQO,SAAS,0CACd,UACe;AACf,UAAQ,8BAA8B,QAAQ,GAAG;AAAA,IAC/C,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;;;ACvDA,SAAS,MAAM,OAAe,KAAa,KAAqB;AAC9D,SAAO,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAC3C;AAGO,IAAM,+CAA+C;AACrD,IAAM,2CAA2C;AACjD,IAAM,2CAA2C;AACjD,IAAM,gCAAgC;AACtC,IAAM,wCAAwC;AAC9C,IAAM,mCAAmC;AACzC,IAAM,kCACX,2CACA,gCACA;AACK,IAAM,mCAAmC;AACzC,IAAM,qCAAqC;AAU3C,SAAS,2CACd,kBACS;AACT,SACE,OAAO,SAAS,gBAAgB,KAChC,mBAAmB,KACnB,oBAAoB;AAExB;AAEO,SAAS,0CACd,kBACQ;AACR,QAAM,qBACJ,OAAO,SAAS,gBAAgB,KAAK,mBAAmB,IACpD,mBACA,+CACA,gCACA;AAEN,SAAO,KAAK;AAAA,IACV;AAAA,IACA,KAAK;AAAA,MACH;AAAA,MACA,qBACE,gCACA;AAAA,IACJ;AAAA,EACF;AACF;AAEO,SAAS,qCACd,SACA,kBACQ;AACR,QAAM,mBACJ,OAAO,YAAY,YAAY,OAAO,SAAS,OAAO,IAClD,KAAK,MA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