@tutti-os/agent-gui 0.0.99 → 0.0.101

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 (95) hide show
  1. package/dist/{AgentGUI-Bkk2TRS0.d.ts → AgentGUI-FECh2x1p.d.ts} +19 -37
  2. package/dist/agent-conversation/index.d.ts +4 -4
  3. package/dist/agent-conversation/index.js +8 -9
  4. package/dist/agent-conversation/index.js.map +1 -1
  5. package/dist/agent-gui.d.ts +5 -4
  6. package/dist/agent-gui.js +19 -19
  7. package/dist/agent-message-center/index.d.ts +4 -6
  8. package/dist/agent-message-center/index.js +13 -52
  9. package/dist/agent-message-center/index.js.map +1 -1
  10. package/dist/agent-title-text.js +1 -1
  11. package/dist/{agentConversationVM-C335TR6S.d.ts → agentConversationVM-BzHZhwFP.d.ts} +1 -1
  12. package/dist/{agentGuiNodeTypes-DAsluxjv.d.ts → agentGuiNodeTypes-BH3lz6gn.d.ts} +21 -5
  13. package/dist/app/renderer/agentactivity.css +142 -72
  14. package/dist/chunk-2RQM7PJN.js +16 -0
  15. package/dist/chunk-2RQM7PJN.js.map +1 -0
  16. package/dist/{chunk-FSKGEGGX.js → chunk-4E3QCW6L.js} +17 -3
  17. package/dist/chunk-4E3QCW6L.js.map +1 -0
  18. package/dist/{chunk-63BE6RGM.js → chunk-4YCCATI4.js} +14 -374
  19. package/dist/chunk-4YCCATI4.js.map +1 -0
  20. package/dist/{chunk-IYEXLOUE.js → chunk-4YVKAPKW.js} +5 -8
  21. package/dist/chunk-4YVKAPKW.js.map +1 -0
  22. package/dist/{chunk-MRRICFWA.js → chunk-D7HMQLBO.js} +159 -55
  23. package/dist/chunk-D7HMQLBO.js.map +1 -0
  24. package/dist/{chunk-OTRZBTFQ.js → chunk-DWUVRWXD.js} +2 -2
  25. package/dist/{chunk-RHTZAODZ.js → chunk-E5AD46HP.js} +2 -2
  26. package/dist/{chunk-3NOJFKDV.js → chunk-EUW6VPIK.js} +414 -49
  27. package/dist/chunk-EUW6VPIK.js.map +1 -0
  28. package/dist/{chunk-Y35GDLP2.js → chunk-F5UR6EJG.js} +2 -17
  29. package/dist/chunk-F5UR6EJG.js.map +1 -0
  30. package/dist/{chunk-J7ZYAUPC.js → chunk-FAE7CXZO.js} +8 -6
  31. package/dist/chunk-FAE7CXZO.js.map +1 -0
  32. package/dist/{chunk-CPUEPDF7.js → chunk-GCW57WYQ.js} +646 -595
  33. package/dist/chunk-GCW57WYQ.js.map +1 -0
  34. package/dist/{chunk-4ROALW3K.js → chunk-KAV2WHTG.js} +82 -61
  35. package/dist/chunk-KAV2WHTG.js.map +1 -0
  36. package/dist/chunk-MIJXEELH.js +96 -0
  37. package/dist/chunk-MIJXEELH.js.map +1 -0
  38. package/dist/{chunk-T6PEJFRP.js → chunk-MJOQP2ED.js} +392 -452
  39. package/dist/chunk-MJOQP2ED.js.map +1 -0
  40. package/dist/{chunk-QWGJ5TEG.js → chunk-QY22OBJS.js} +28 -30
  41. package/dist/chunk-QY22OBJS.js.map +1 -0
  42. package/dist/{chunk-SPZJCTBV.js → chunk-TDVYZEUI.js} +348 -322
  43. package/dist/chunk-TDVYZEUI.js.map +1 -0
  44. package/dist/{chunk-MASXZENX.js → chunk-UESYITH6.js} +21 -2
  45. package/dist/chunk-UESYITH6.js.map +1 -0
  46. package/dist/{chunk-PLCHNOXL.js → chunk-VQOPBBBI.js} +1288 -1141
  47. package/dist/chunk-VQOPBBBI.js.map +1 -0
  48. package/dist/{chunk-7M77BK6K.js → chunk-ZPKPIHMZ.js} +196 -156
  49. package/dist/chunk-ZPKPIHMZ.js.map +1 -0
  50. package/dist/context-mention-palette/index.d.ts +5 -1
  51. package/dist/context-mention-palette/index.js +10 -11
  52. package/dist/contribution-CTVBPN0R.d.ts +119 -0
  53. package/dist/i18n/index.d.ts +16 -2
  54. package/dist/i18n/index.js +2 -2
  55. package/dist/index.d.ts +8 -7
  56. package/dist/index.js +21 -20
  57. package/dist/index.js.map +1 -1
  58. package/dist/mention-search.d.ts +18 -6
  59. package/dist/mention-search.js +8 -9
  60. package/dist/workbench/contribution.d.ts +6 -107
  61. package/dist/workbench/contribution.js +7 -3
  62. package/dist/workbench/index.d.ts +6 -4
  63. package/dist/workbench/index.js +27 -21
  64. package/dist/workbench/launch.d.ts +13 -5
  65. package/dist/workbench/launch.js +1 -1
  66. package/dist/workbench/sessionTitle.d.ts +5 -7
  67. package/dist/workbench/sessionTitle.js +3 -4
  68. package/dist/workbench/state.js +3 -1
  69. package/dist/workspace-agent-generated-files.d.ts +8 -13
  70. package/dist/workspace-agent-generated-files.js +6 -21
  71. package/dist/{workspaceAgentActivityListTypes-C7gPWYiA.d.ts → workspaceAgentActivityListTypes-DZfS_HgG.d.ts} +3 -26
  72. package/package.json +14 -14
  73. package/dist/chunk-3NOJFKDV.js.map +0 -1
  74. package/dist/chunk-4ROALW3K.js.map +0 -1
  75. package/dist/chunk-63BE6RGM.js.map +0 -1
  76. package/dist/chunk-7M77BK6K.js.map +0 -1
  77. package/dist/chunk-CPUEPDF7.js.map +0 -1
  78. package/dist/chunk-FSKGEGGX.js.map +0 -1
  79. package/dist/chunk-GAD6Y3BF.js +0 -88
  80. package/dist/chunk-GAD6Y3BF.js.map +0 -1
  81. package/dist/chunk-GCBDIQDX.js +0 -22
  82. package/dist/chunk-GCBDIQDX.js.map +0 -1
  83. package/dist/chunk-IYEXLOUE.js.map +0 -1
  84. package/dist/chunk-J7ZYAUPC.js.map +0 -1
  85. package/dist/chunk-MASXZENX.js.map +0 -1
  86. package/dist/chunk-MRRICFWA.js.map +0 -1
  87. package/dist/chunk-PLCHNOXL.js.map +0 -1
  88. package/dist/chunk-QWGJ5TEG.js.map +0 -1
  89. package/dist/chunk-SPZJCTBV.js.map +0 -1
  90. package/dist/chunk-T6PEJFRP.js.map +0 -1
  91. package/dist/chunk-Y35GDLP2.js.map +0 -1
  92. package/dist/chunk-Y5M6Q6WX.js +0 -25
  93. package/dist/chunk-Y5M6Q6WX.js.map +0 -1
  94. /package/dist/{chunk-OTRZBTFQ.js.map → chunk-DWUVRWXD.js.map} +0 -0
  95. /package/dist/{chunk-RHTZAODZ.js.map → chunk-E5AD46HP.js.map} +0 -0
@@ -1,6 +1,11 @@
1
1
  import {
2
+ changedFilesForSession,
3
+ workspaceAgentSessionMessageAliases
4
+ } from "./chunk-4YCCATI4.js";
5
+ import {
6
+ isWorkspaceAgentSyntheticControlMessage,
2
7
  normalizeAgentSessionMentionTitle
3
- } from "./chunk-CPUEPDF7.js";
8
+ } from "./chunk-GCW57WYQ.js";
4
9
  import {
5
10
  resolveAgentMentionFileThumbnailUrl
6
11
  } from "./chunk-LUGELG5V.js";
@@ -8,11 +13,19 @@ import {
8
13
  AGENT_CONTEXT_MENTION_PROVIDER_IDS
9
14
  } from "./chunk-JM24HADP.js";
10
15
  import {
11
- getOptionalAgentHostApi
12
- } from "./chunk-MASXZENX.js";
16
+ resolveWorkspaceAgentSessionSortTimeUnixMs
17
+ } from "./chunk-YMXYBG7U.js";
18
+ import {
19
+ getOptionalAgentHostApi,
20
+ workspaceAgentProviderLabel
21
+ } from "./chunk-UESYITH6.js";
22
+ import {
23
+ normalizeAgentTitleText
24
+ } from "./chunk-MIJXEELH.js";
13
25
  import {
14
- translate
15
- } from "./chunk-RHTZAODZ.js";
26
+ translate,
27
+ translateInUiLanguage
28
+ } from "./chunk-E5AD46HP.js";
16
29
 
17
30
  // agent-gui/agentGuiNode/AgentMentionLabels.ts
18
31
  function agentMentionGroupLabel(groupId) {
@@ -71,6 +84,296 @@ function agentMentionEmptyGroupLabel(groupId, query) {
71
84
  return translate("agentHost.agentGui.mentionEmptyIssues");
72
85
  }
73
86
 
87
+ // shared/workspaceAgentActivityListProjection.ts
88
+ import { selectCanonicalAgentActivitySessions } from "@tutti-os/agent-activity-core";
89
+
90
+ // shared/workspaceAgentActivityStatus.ts
91
+ function resolveWorkspaceAgentActivityStatus(session) {
92
+ const normalized = canonicalSessionStatus(session);
93
+ switch (normalized) {
94
+ case "failed":
95
+ return "failed";
96
+ case "canceled":
97
+ return "canceled";
98
+ case "completed":
99
+ return "completed";
100
+ case "waiting":
101
+ return "waiting";
102
+ case "working":
103
+ return "working";
104
+ default:
105
+ return "idle";
106
+ }
107
+ }
108
+ function canonicalSessionStatus(session) {
109
+ if ((session.pendingInteractions?.length ?? 0) > 0) return "waiting";
110
+ if (session.activeTurn && session.activeTurn.phase !== "settled") {
111
+ return session.activeTurn.phase === "waiting" ? "waiting" : "working";
112
+ }
113
+ switch (session.latestTurn?.outcome) {
114
+ case "completed":
115
+ return "completed";
116
+ case "failed":
117
+ return "failed";
118
+ case "canceled":
119
+ case "interrupted":
120
+ return "canceled";
121
+ default:
122
+ return "idle";
123
+ }
124
+ }
125
+
126
+ // shared/workspaceAgentLatestActivitySummary.ts
127
+ function fallbackSummary(status) {
128
+ switch (status) {
129
+ case "working":
130
+ return translate("agentHost.workspaceAgentActivityStatusWorking");
131
+ case "waiting":
132
+ return translate("agentHost.workspaceAgentActivityStatusWaiting");
133
+ case "idle":
134
+ return translate("agentHost.workspaceAgentActivityStatusIdle");
135
+ case "canceled":
136
+ case "completed":
137
+ return translate("agentHost.workspaceAgentActivityStatusEnd");
138
+ case "failed":
139
+ return translate("agentHost.workspaceAgentActivityStatusFailed");
140
+ }
141
+ }
142
+ function isWorkspaceAgentUntitledConversation(title) {
143
+ return localizedWorkspaceAgentLabelSet(
144
+ "agentHost.workspaceAgentsUntitledConversation"
145
+ ).has(compactText(title));
146
+ }
147
+ function compactText(value) {
148
+ return value.trim().replace(/\s+/g, " ");
149
+ }
150
+ function localizedWorkspaceAgentLabelSet(key) {
151
+ return new Set(
152
+ ["en", "zh-CN"].map((language) => compactText(translateInUiLanguage(language, key))).filter(Boolean)
153
+ );
154
+ }
155
+
156
+ // shared/workspaceAgentActivitySummary.ts
157
+ function resolveWorkspaceAgentActivityTitle(session) {
158
+ return session.title.trim() || workspaceAgentUntitledConversationLabel();
159
+ }
160
+ function resolveLatestActivity(messages, status, actors) {
161
+ const latestMessage = latestDisplayableMessage(messages);
162
+ if (latestMessage) {
163
+ return {
164
+ actorName: messageRole(latestMessage.message) === "user" ? actors.userName : actors.agentName,
165
+ summary: latestMessage.text
166
+ };
167
+ }
168
+ return {
169
+ actorName: actors.agentName,
170
+ summary: fallbackSummary(status)
171
+ };
172
+ }
173
+ function latestDisplayableMessage(messages) {
174
+ return messages.map((message) => ({
175
+ message,
176
+ text: messageDisplayText(message),
177
+ time: messageTime(message)
178
+ })).filter(
179
+ (item) => item.text.length > 0 && normalizeToken(item.message.kind) !== "tool_call"
180
+ ).sort((left, right) => {
181
+ const timeDiff = (right.time ?? 0) - (left.time ?? 0);
182
+ if (timeDiff !== 0) {
183
+ return timeDiff;
184
+ }
185
+ return right.message.messageId.localeCompare(left.message.messageId);
186
+ })[0] ?? null;
187
+ }
188
+ function messageDisplayText(message) {
189
+ const payload = message.payload ?? {};
190
+ const text = normalizeAgentTitleText(
191
+ compactText2(
192
+ stringValue(payload.displayPrompt) || stringValue(payload.text) || stringValue(payload.content) || stringValue(payload.message) || stringValue(payload.body) || stringValue(payload.title) || ""
193
+ )
194
+ );
195
+ return isWorkspaceAgentSyntheticControlMessage(text) ? "" : text;
196
+ }
197
+ function messageRole(message) {
198
+ return normalizeToken(message.role);
199
+ }
200
+ function messageTime(message) {
201
+ return message.occurredAtUnixMs ?? message.completedAtUnixMs ?? message.startedAtUnixMs;
202
+ }
203
+ function normalizeToken(value) {
204
+ return value?.trim().toLowerCase() ?? "";
205
+ }
206
+ function compactText2(value) {
207
+ return value.replace(/\s+/g, " ").trim();
208
+ }
209
+ function workspaceAgentUntitledConversationLabel() {
210
+ return normalizeAgentTitleText(
211
+ translate("agentHost.workspaceAgentsUntitledConversation")
212
+ );
213
+ }
214
+ function stringValue(value) {
215
+ return typeof value === "string" && value.trim() ? value.trim() : null;
216
+ }
217
+
218
+ // shared/workspaceAgentSessionTitle.ts
219
+ function resolveDisplayableWorkspaceAgentSessionTitle(session) {
220
+ const title = session.title.trim();
221
+ if (!title || isWorkspaceAgentUntitledConversation(title) || isWorkspaceAgentSyntheticControlMessage(title)) {
222
+ return "";
223
+ }
224
+ const provider = session.provider?.trim();
225
+ if (provider && workspaceAgentProviderLabel(provider).toLowerCase() === title.toLowerCase()) {
226
+ return "";
227
+ }
228
+ return title;
229
+ }
230
+
231
+ // shared/workspaceAgentActivityListOrdering.ts
232
+ function shouldHideEmptyRuntimePlaceholderSession(session, messages, status, options) {
233
+ if (messages.length > 0) {
234
+ return false;
235
+ }
236
+ if (!hasLoadedSessionMessageRecord(session, options.sessionMessagesById)) {
237
+ return false;
238
+ }
239
+ if (!isRuntimePlaceholderTerminalStatus(status)) {
240
+ return false;
241
+ }
242
+ return resolveDisplayableWorkspaceAgentSessionTitle(session) === "";
243
+ }
244
+ function hasLoadedSessionMessageRecord(session, sessionMessagesById) {
245
+ if (!sessionMessagesById) {
246
+ return false;
247
+ }
248
+ return workspaceAgentSessionMessageAliases(session).some(
249
+ (alias) => alias in sessionMessagesById
250
+ );
251
+ }
252
+ function isRuntimePlaceholderTerminalStatus(status) {
253
+ return status === "idle" || status === "completed" || status === "canceled";
254
+ }
255
+ function compareActivities(left, right) {
256
+ const timeDiff = right.sortTimeUnixMs - left.sortTimeUnixMs;
257
+ if (timeDiff !== 0) {
258
+ return timeDiff;
259
+ }
260
+ return left.sessionId.localeCompare(right.sessionId);
261
+ }
262
+
263
+ // shared/workspaceAgentActivityListProjection.ts
264
+ function buildWorkspaceAgentActivityListViewModel(snapshot, options = {}) {
265
+ const activities = selectCanonicalAgentActivitySessions(snapshot).map((session) => {
266
+ const presence = snapshot.presences.find(
267
+ (candidate) => candidate.provider === session.provider && Boolean(candidate.userId) && candidate.userId === session.userId
268
+ ) ?? null;
269
+ const messages = resolveWorkspaceAgentSessionMessages(
270
+ options.sessionMessagesById,
271
+ session
272
+ );
273
+ const status = resolveWorkspaceAgentActivityStatus(session);
274
+ if (shouldHideEmptyRuntimePlaceholderSession(
275
+ session,
276
+ messages,
277
+ status,
278
+ options
279
+ )) {
280
+ return null;
281
+ }
282
+ const user = resolveActivityUser(session, presence, options);
283
+ const agentProvider = resolveProvider(session, presence);
284
+ const agentName = workspaceAgentProviderLabel(agentProvider);
285
+ const resolvedSortTimeUnixMs = resolveWorkspaceAgentSessionSortTimeUnixMs(session);
286
+ const latestActivity = resolveLatestActivity(messages, status, {
287
+ agentName,
288
+ userName: user.userName
289
+ });
290
+ const activity = {
291
+ id: `activity-${session.agentSessionId}`,
292
+ sessionId: session.agentSessionId,
293
+ userId: user.userId,
294
+ userName: user.userName,
295
+ ...user.userAvatarUrl ? { userAvatarUrl: user.userAvatarUrl } : {},
296
+ agentProvider,
297
+ agentName,
298
+ title: resolveWorkspaceAgentActivityTitle(session),
299
+ status,
300
+ latestActivitySummary: latestActivity.summary,
301
+ latestActivityActorName: latestActivity.actorName,
302
+ changedFiles: changedFilesForSession(messages),
303
+ sortTimeUnixMs: resolvedSortTimeUnixMs,
304
+ readTimeUnixMs: readTimeUnixMs(session, status, resolvedSortTimeUnixMs)
305
+ };
306
+ return activity;
307
+ }).filter(
308
+ (activity) => activity !== null
309
+ ).sort(compareActivities);
310
+ return { activities };
311
+ }
312
+ function resolveWorkspaceAgentSessionMessages(sessionMessagesById, session) {
313
+ if (!sessionMessagesById) {
314
+ return [];
315
+ }
316
+ for (const alias of workspaceAgentSessionMessageAliases(session)) {
317
+ const messages = sessionMessagesById[alias];
318
+ if (messages) {
319
+ return messages;
320
+ }
321
+ }
322
+ return [];
323
+ }
324
+ function resolveActivityUser(session, presence, options) {
325
+ if (presence) {
326
+ return resolveUserFromId(presence.userId ?? "", options);
327
+ }
328
+ const sessionUserId = session.userId?.trim() ?? "";
329
+ if (sessionUserId) {
330
+ return resolveUserFromId(sessionUserId, options);
331
+ }
332
+ return {
333
+ userId: null,
334
+ userName: "Unknown member"
335
+ };
336
+ }
337
+ function resolveUserFromId(rawUserId, options) {
338
+ const userId = rawUserId.trim();
339
+ const profile = options.userProfilesById?.[userId];
340
+ const profileName = compactText3(profile?.name ?? "");
341
+ const profileAvatar = profile?.avatar?.trim();
342
+ const rawName = profileName || userId || "Unknown member";
343
+ return {
344
+ userId,
345
+ userName: stripTrailingParentheticalEmailFromLabel(rawName) || rawName,
346
+ ...profileAvatar ? { userAvatarUrl: profileAvatar } : {}
347
+ };
348
+ }
349
+ function resolveProvider(session, presence) {
350
+ const sessionProvider = normalizeProvider(session.provider);
351
+ if (sessionProvider) {
352
+ return sessionProvider;
353
+ }
354
+ const presenceProvider = normalizeProvider(presence?.provider);
355
+ if (presenceProvider) {
356
+ return presenceProvider;
357
+ }
358
+ return "unknown";
359
+ }
360
+ function normalizeProvider(provider) {
361
+ const trimmed = provider?.trim();
362
+ return trimmed ? trimmed.toLowerCase() : null;
363
+ }
364
+ function readTimeUnixMs(session, status, fallbackUnixMs) {
365
+ if (status === "completed" || status === "failed") {
366
+ return session.endedAtUnixMs ?? session.updatedAtUnixMs ?? fallbackUnixMs;
367
+ }
368
+ return fallbackUnixMs;
369
+ }
370
+ function stripTrailingParentheticalEmailFromLabel(label) {
371
+ return label.trim().replace(/\s*\([^)]*@[^)]+\)\s*$/u, "").trim();
372
+ }
373
+ function compactText3(value) {
374
+ return value.replace(/\s+/g, " ").trim();
375
+ }
376
+
74
377
  // shared/richText/richTextDocument.ts
75
378
  import { isRichTextMentionHref } from "@tutti-os/ui-rich-text/core";
76
379
 
@@ -163,7 +466,7 @@ function resolveMentionGroupTotalCount(groupId, totalCounts, itemCount) {
163
466
  function normalizeQuery(value) {
164
467
  return value.replace(/\s+/g, " ").trim();
165
468
  }
166
- function compactText(value) {
469
+ function compactText4(value) {
167
470
  return value?.replace(/\s+/g, " ").trim() ?? "";
168
471
  }
169
472
 
@@ -423,7 +726,7 @@ function normalizeSessionMentionItemsForMySessions(input) {
423
726
  );
424
727
  }
425
728
  function providerItemToAgentMentionItem(input) {
426
- const label = compactText(input.label);
729
+ const label = compactText4(input.label);
427
730
  if (!label) {
428
731
  return null;
429
732
  }
@@ -483,7 +786,7 @@ function providerItemToAgentMentionItem(input) {
483
786
  name: label,
484
787
  title: label,
485
788
  status: presentation.status?.trim() || void 0,
486
- contentPreview: compactText(presentation.description) || compactText(input.subtitle) || void 0
789
+ contentPreview: compactText4(presentation.description) || compactText4(input.subtitle) || void 0
487
790
  };
488
791
  }
489
792
  if (input.providerId === WORKSPACE_APP_PROVIDER_ID) {
@@ -500,7 +803,7 @@ function providerItemToAgentMentionItem(input) {
500
803
  targetId: appId,
501
804
  appId,
502
805
  name: label,
503
- description: compactText(presentation.description) || compactText(presentation.subtitle) || compactText(input.subtitle) || void 0,
806
+ description: compactText4(presentation.description) || compactText4(presentation.subtitle) || compactText4(input.subtitle) || void 0,
504
807
  iconUrl: presentation.iconUrl?.trim() || void 0,
505
808
  referencesListSupported: presentation.referencesListSupported === "true"
506
809
  };
@@ -518,7 +821,7 @@ function providerItemToAgentMentionItem(input) {
518
821
  workspaceId,
519
822
  targetId,
520
823
  name: label,
521
- description: compactText(presentation.description) || compactText(presentation.subtitle) || compactText(input.subtitle) || void 0,
824
+ description: compactText4(presentation.description) || compactText4(presentation.subtitle) || compactText4(input.subtitle) || void 0,
522
825
  agentProviderId,
523
826
  iconUrl: presentation.iconUrl?.trim() || void 0
524
827
  };
@@ -526,8 +829,8 @@ function providerItemToAgentMentionItem(input) {
526
829
  if (input.providerId === AGENT_SESSION_PROVIDER_ID) {
527
830
  const agentName = presentation.subtitle?.trim() || "";
528
831
  const title = normalizeAgentSessionMentionTitle(label) || label;
529
- const description = compactText(presentation.description);
530
- const summaryPreview = description || compactText(input.subtitle) || void 0;
832
+ const description = compactText4(presentation.description);
833
+ const summaryPreview = description || compactText4(input.subtitle) || void 0;
531
834
  return {
532
835
  kind: "session",
533
836
  href: createRichTextMentionHref2({
@@ -670,7 +973,8 @@ function buildAgentMentionBrowseCacheKey(input) {
670
973
  filter: input.filter,
671
974
  fileLimit: input.fileLimit,
672
975
  issueLimit: input.issueLimit,
673
- providerIds: input.providerIds
976
+ providerIds: input.providerIds,
977
+ provenanceFilterKey: input.provenanceFilterKey ?? "disabled"
674
978
  });
675
979
  }
676
980
 
@@ -836,25 +1140,28 @@ async function runAgentMentionProviderQuery(input) {
836
1140
  // agent-gui/agentGuiNode/AgentMentionSearchIndex.ts
837
1141
  async function fetchAgentMentionFilterResult(input) {
838
1142
  const providerDiagnostics = [];
1143
+ const agentFilterActive = input.provenanceFilter !== null && input.provenanceFilter.agentTargetIds !== null;
839
1144
  switch (input.filter) {
840
1145
  case "file": {
841
- const fileQuery = input.queryProviderMentionItemsById({
1146
+ const fileQuery = agentFilterActive ? Promise.resolve([]) : input.queryProviderMentionItemsById({
842
1147
  providerId: FILE_PROVIDER_ID,
843
1148
  workspaceId: input.workspaceId,
844
1149
  currentUserId: input.currentUserId,
845
1150
  query: input.query,
846
1151
  limit: input.query ? input.currentFileSearchLimit : input.fileLimit,
847
1152
  sessionCwd: input.sessionCwd,
848
- diagnostics: providerDiagnostics
1153
+ diagnostics: providerDiagnostics,
1154
+ provenanceFilter: input.provenanceFilter
849
1155
  });
850
- const agentGeneratedFileQuery = input.includeAgentGeneratedFiles ? input.queryProviderMentionItemsById({
1156
+ const agentGeneratedFileQuery = input.includeAgentGeneratedFiles || agentFilterActive ? input.queryProviderMentionItemsById({
851
1157
  providerId: AGENT_GENERATED_FILE_PROVIDER_ID,
852
1158
  workspaceId: input.workspaceId,
853
1159
  currentUserId: input.currentUserId,
854
1160
  query: input.query,
855
1161
  limit: input.fileLimit,
856
1162
  sessionCwd: input.sessionCwd,
857
- diagnostics: providerDiagnostics
1163
+ diagnostics: providerDiagnostics,
1164
+ provenanceFilter: input.provenanceFilter
858
1165
  }) : Promise.resolve([]);
859
1166
  const [fileItems, agentGeneratedFileItems] = await Promise.all([
860
1167
  fileQuery,
@@ -879,7 +1186,8 @@ async function fetchAgentMentionFilterResult(input) {
879
1186
  query: input.query,
880
1187
  limit: DEFAULT_SESSION_LIMIT,
881
1188
  sessionCwd: input.sessionCwd,
882
- diagnostics: providerDiagnostics
1189
+ diagnostics: providerDiagnostics,
1190
+ provenanceFilter: input.provenanceFilter
883
1191
  });
884
1192
  const rawGroups = emptyAgentMentionRawGroups();
885
1193
  rawGroups.my_sessions = normalizeSessionMentionItemsForMySessions({
@@ -893,14 +1201,15 @@ async function fetchAgentMentionFilterResult(input) {
893
1201
  };
894
1202
  }
895
1203
  case "issue": {
896
- const issueItems = await input.queryProviderMentionItemsById({
1204
+ const issueItems = agentFilterActive ? [] : await input.queryProviderMentionItemsById({
897
1205
  providerId: WORKSPACE_ISSUE_PROVIDER_ID,
898
1206
  workspaceId: input.workspaceId,
899
1207
  currentUserId: input.currentUserId,
900
1208
  query: input.query,
901
1209
  limit: input.currentIssueSearchLimit,
902
1210
  sessionCwd: input.sessionCwd,
903
- diagnostics: providerDiagnostics
1211
+ diagnostics: providerDiagnostics,
1212
+ provenanceFilter: input.provenanceFilter
904
1213
  });
905
1214
  const rawGroups = emptyAgentMentionRawGroups();
906
1215
  rawGroups.issues = issueItems.filter(
@@ -919,7 +1228,8 @@ async function fetchAgentMentionFilterResult(input) {
919
1228
  currentUserId: input.currentUserId,
920
1229
  query: input.query,
921
1230
  sessionCwd: input.sessionCwd,
922
- diagnostics: providerDiagnostics
1231
+ diagnostics: providerDiagnostics,
1232
+ provenanceFilter: input.provenanceFilter
923
1233
  });
924
1234
  const rawGroups = emptyAgentMentionRawGroups();
925
1235
  rawGroups.agents = agentItems.filter(
@@ -938,7 +1248,8 @@ async function fetchAgentMentionFilterResult(input) {
938
1248
  currentUserId: input.currentUserId,
939
1249
  query: input.query,
940
1250
  sessionCwd: input.sessionCwd,
941
- diagnostics: providerDiagnostics
1251
+ diagnostics: providerDiagnostics,
1252
+ provenanceFilter: input.provenanceFilter
942
1253
  });
943
1254
  const rawGroups = emptyAgentMentionRawGroups();
944
1255
  rawGroups.apps = appItems.filter((item) => item.kind === "workspace-app");
@@ -961,7 +1272,8 @@ async function queryAgentMentionProviderItems(input) {
961
1272
  currentUserId: input.currentUserId,
962
1273
  sessionCwd: input.sessionCwd || void 0,
963
1274
  target: "agent-gui",
964
- workspaceId: input.workspaceId
1275
+ workspaceId: input.workspaceId,
1276
+ referenceProvenanceFilter: input.provenanceFilter ?? void 0
965
1277
  }
966
1278
  }
967
1279
  });
@@ -1002,6 +1314,21 @@ async function queryAgentMentionProviderItems(input) {
1002
1314
  );
1003
1315
  }
1004
1316
 
1317
+ // agent-gui/agentGuiNode/AgentMentionSearchControllerBase.ts
1318
+ import { referenceProvenanceFilterCacheKey } from "@tutti-os/workspace-file-reference/core";
1319
+
1320
+ // agent-gui/agentGuiNode/agentGuiScheduler.ts
1321
+ var agentGuiScheduler = {
1322
+ schedule(delayMs, task) {
1323
+ const timer = setTimeout(task, delayMs);
1324
+ return {
1325
+ cancel() {
1326
+ clearTimeout(timer);
1327
+ }
1328
+ };
1329
+ }
1330
+ };
1331
+
1005
1332
  // agent-gui/agentGuiNode/AgentMentionSearchControllerBase.ts
1006
1333
  var AgentMentionSearchControllerBase = class {
1007
1334
  contextMentionProviders;
@@ -1016,6 +1343,7 @@ var AgentMentionSearchControllerBase = class {
1016
1343
  listeners = /* @__PURE__ */ new Set();
1017
1344
  expandedCounts = {};
1018
1345
  totalCounts = {};
1346
+ scheduler = agentGuiScheduler;
1019
1347
  timer = null;
1020
1348
  preloadCancel = null;
1021
1349
  pendingPreloadKey = null;
@@ -1026,6 +1354,7 @@ var AgentMentionSearchControllerBase = class {
1026
1354
  currentFilter = DEFAULT_AGENT_MENTION_FILTER;
1027
1355
  currentQuery = "";
1028
1356
  currentSessionCwd = "";
1357
+ currentProvenanceFilter = null;
1029
1358
  currentFileSearchLimit;
1030
1359
  currentIssueSearchLimit;
1031
1360
  agentGeneratedBrowsePath = null;
@@ -1191,9 +1520,15 @@ var AgentMentionSearchControllerBase = class {
1191
1520
  async runBrowseSearch(input) {
1192
1521
  const startedAt = this.diagnosticNow();
1193
1522
  let providerDiagnostics = [];
1194
- const cacheKey = this.browseCacheKey(input);
1523
+ const provenanceFilter = this.currentProvenanceFilter;
1524
+ const cacheKey = this.browseCacheKey(input, provenanceFilter);
1195
1525
  try {
1196
- const result = await this.loadBrowseFetchResult(input, cacheKey, "open");
1526
+ const result = await this.loadBrowseFetchResult(
1527
+ input,
1528
+ cacheKey,
1529
+ "open",
1530
+ provenanceFilter
1531
+ );
1197
1532
  providerDiagnostics = result.providerDiagnostics;
1198
1533
  if (!this.canApply(input.requestId, input.workspaceId, "", input.filter)) {
1199
1534
  this.logLifecycle("browse.apply.skipped", {
@@ -1253,12 +1588,15 @@ var AgentMentionSearchControllerBase = class {
1253
1588
  });
1254
1589
  }
1255
1590
  }
1256
- async fetchBrowseResult(input) {
1257
- return this.fetchFilterResult({
1258
- ...input,
1259
- query: "",
1260
- includeAgentGeneratedFiles: input.filter === "file"
1261
- });
1591
+ async fetchBrowseResult(input, provenanceFilter = this.currentProvenanceFilter) {
1592
+ return this.fetchFilterResult(
1593
+ {
1594
+ ...input,
1595
+ query: "",
1596
+ includeAgentGeneratedFiles: input.filter === "file"
1597
+ },
1598
+ provenanceFilter
1599
+ );
1262
1600
  }
1263
1601
  applyBrowseFetchResult(result) {
1264
1602
  this.rawGroups = cloneAgentMentionRawGroups(result.rawGroups);
@@ -1299,7 +1637,8 @@ var AgentMentionSearchControllerBase = class {
1299
1637
  query: input.query,
1300
1638
  limit: input.limit,
1301
1639
  sessionCwd: input.sessionCwd ?? this.currentSessionCwd,
1302
- abortSignal
1640
+ abortSignal,
1641
+ provenanceFilter: input.provenanceFilter
1303
1642
  }) : null,
1304
1643
  resultCount: (result) => result.length
1305
1644
  });
@@ -1339,7 +1678,7 @@ var AgentMentionSearchControllerBase = class {
1339
1678
  }
1340
1679
  clearTimer() {
1341
1680
  if (this.timer !== null) {
1342
- clearTimeout(this.timer);
1681
+ this.timer.cancel();
1343
1682
  this.timer = null;
1344
1683
  }
1345
1684
  }
@@ -1402,12 +1741,13 @@ var AgentMentionSearchControllerBase = class {
1402
1741
  totalCounts: this.totalCounts
1403
1742
  });
1404
1743
  }
1405
- browseCacheKey(input) {
1744
+ browseCacheKey(input, provenanceFilter = this.currentProvenanceFilter) {
1406
1745
  return buildAgentMentionBrowseCacheKey({
1407
1746
  ...input,
1408
1747
  fileLimit: this.fileLimit,
1409
1748
  issueLimit: this.currentIssueSearchLimit,
1410
- providerIds: [...this.contextMentionProviders.keys()].sort()
1749
+ providerIds: [...this.contextMentionProviders.keys()].sort(),
1750
+ provenanceFilterKey: provenanceFilter ? referenceProvenanceFilterCacheKey(provenanceFilter) : "disabled"
1411
1751
  });
1412
1752
  }
1413
1753
  readBrowseCache(cacheKey) {
@@ -1417,30 +1757,45 @@ var AgentMentionSearchControllerBase = class {
1417
1757
  diagnosticNow: this.diagnosticNow
1418
1758
  });
1419
1759
  }
1420
- loadBrowseFetchResult(input, cacheKey, reason) {
1760
+ loadBrowseFetchResult(input, cacheKey, reason, provenanceFilter = this.currentProvenanceFilter) {
1421
1761
  return loadAgentMentionBrowseFetchResult({
1422
1762
  input,
1423
1763
  cacheKey,
1424
1764
  reason,
1425
1765
  diagnosticNow: this.diagnosticNow,
1426
1766
  providerIds: this.providerIdsForDiagnostics(),
1427
- fetchBrowseResult: () => this.fetchBrowseResult(input),
1767
+ fetchBrowseResult: () => this.fetchBrowseResult(input, provenanceFilter),
1428
1768
  logLifecycle: (event, details) => this.logLifecycle(event, details)
1429
1769
  });
1430
1770
  }
1431
- fetchFilterResult(input) {
1771
+ fetchFilterResult(input, provenanceFilter = this.currentProvenanceFilter) {
1432
1772
  return fetchAgentMentionFilterResult({
1433
1773
  ...input,
1434
1774
  fileLimit: this.fileLimit,
1435
1775
  currentFileSearchLimit: this.currentFileSearchLimit,
1436
1776
  currentIssueSearchLimit: this.currentIssueSearchLimit,
1777
+ provenanceFilter,
1437
1778
  queryProviderMentionItemsById: (queryInput) => this.queryProviderMentionItemsById(queryInput)
1438
1779
  });
1439
1780
  }
1440
1781
  };
1441
1782
 
1442
1783
  // agent-gui/agentGuiNode/AgentMentionSearchController.ts
1784
+ import { referenceProvenanceFilterCacheKey as referenceProvenanceFilterCacheKey2 } from "@tutti-os/workspace-file-reference/core";
1443
1785
  var AgentMentionSearchController = class extends AgentMentionSearchControllerBase {
1786
+ setProvenanceFilter(filter) {
1787
+ const previousKey = this.currentProvenanceFilter ? referenceProvenanceFilterCacheKey2(this.currentProvenanceFilter) : "disabled";
1788
+ const nextKey = filter ? referenceProvenanceFilterCacheKey2(filter) : "disabled";
1789
+ if (previousKey === nextKey) return;
1790
+ this.cancelPendingPreload();
1791
+ this.currentProvenanceFilter = filter;
1792
+ this.updateQuery({
1793
+ workspaceId: this.activeWorkspaceId,
1794
+ currentUserId: this.currentUserId,
1795
+ query: this.currentQuery,
1796
+ sessionCwd: this.currentSessionCwd
1797
+ });
1798
+ }
1444
1799
  subscribe(listener) {
1445
1800
  this.listeners.add(listener);
1446
1801
  listener(this.state);
@@ -1487,7 +1842,7 @@ var AgentMentionSearchController = class extends AgentMentionSearchControllerBas
1487
1842
  groups: this.groupsFromRawGroups(),
1488
1843
  error: null
1489
1844
  });
1490
- this.timer = setTimeout(() => {
1845
+ this.timer = this.scheduler.schedule(this.debounceMs, () => {
1491
1846
  void this.runSearch({
1492
1847
  workspaceId: this.activeWorkspaceId,
1493
1848
  currentUserId: this.currentUserId,
@@ -1495,7 +1850,7 @@ var AgentMentionSearchController = class extends AgentMentionSearchControllerBas
1495
1850
  requestId,
1496
1851
  filter: this.currentFilter
1497
1852
  });
1498
- }, this.debounceMs);
1853
+ });
1499
1854
  }
1500
1855
  setFilter(filter) {
1501
1856
  if (this.disposed) {
@@ -1552,12 +1907,11 @@ var AgentMentionSearchController = class extends AgentMentionSearchControllerBas
1552
1907
  const filter = input.filter ?? DEFAULT_AGENT_MENTION_FILTER;
1553
1908
  const currentUserId = input.currentUserId?.trim() ?? "";
1554
1909
  const sessionCwd = input.sessionCwd?.trim() ?? "";
1555
- const cacheKey = this.browseCacheKey({
1556
- currentUserId,
1557
- filter,
1558
- sessionCwd,
1559
- workspaceId
1560
- });
1910
+ const provenanceFilter = this.currentProvenanceFilter;
1911
+ const cacheKey = this.browseCacheKey(
1912
+ { currentUserId, filter, sessionCwd, workspaceId },
1913
+ provenanceFilter
1914
+ );
1561
1915
  if (this.readBrowseCache(cacheKey).isFresh) {
1562
1916
  return;
1563
1917
  }
@@ -1576,13 +1930,21 @@ var AgentMentionSearchController = class extends AgentMentionSearchControllerBas
1576
1930
  cacheKey,
1577
1931
  currentUserId,
1578
1932
  filter,
1933
+ provenanceFilter,
1579
1934
  sessionCwd,
1580
1935
  workspaceId
1581
1936
  });
1582
1937
  });
1583
1938
  }
1584
1939
  runBrowsePreload(input) {
1585
- const { cacheKey, currentUserId, filter, sessionCwd, workspaceId } = input;
1940
+ const {
1941
+ cacheKey,
1942
+ currentUserId,
1943
+ filter,
1944
+ provenanceFilter,
1945
+ sessionCwd,
1946
+ workspaceId
1947
+ } = input;
1586
1948
  this.logLifecycle("browse.preload", {
1587
1949
  filter,
1588
1950
  providerIds: this.providerIdsForDiagnostics(),
@@ -1608,7 +1970,8 @@ var AgentMentionSearchController = class extends AgentMentionSearchControllerBas
1608
1970
  sessionCwd
1609
1971
  },
1610
1972
  cacheKey,
1611
- "preload"
1973
+ "preload",
1974
+ provenanceFilter
1612
1975
  ).catch((error) => {
1613
1976
  this.logLifecycle("browse.fetch.error", {
1614
1977
  errorKind: diagnosticErrorKind(error),
@@ -1775,6 +2138,7 @@ function preloadAgentMentionBrowse(input) {
1775
2138
  }
1776
2139
 
1777
2140
  export {
2141
+ buildWorkspaceAgentActivityListViewModel,
1778
2142
  agentMentionGroupLabel,
1779
2143
  agentMentionFilterLabel,
1780
2144
  agentMentionEmptyGroupLabel,
@@ -1784,7 +2148,8 @@ export {
1784
2148
  agentGeneratedMentionItemKey,
1785
2149
  MAX_BROWSE_CACHE_ENTRIES,
1786
2150
  resetAgentMentionSearchBrowseCacheForTests,
2151
+ agentGuiScheduler,
1787
2152
  AgentMentionSearchController,
1788
2153
  preloadAgentMentionBrowse
1789
2154
  };
1790
- //# sourceMappingURL=chunk-3NOJFKDV.js.map
2155
+ //# sourceMappingURL=chunk-EUW6VPIK.js.map