@townco/ui 0.1.111 → 0.1.112

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.
@@ -158,6 +158,12 @@ export declare function useChatMessages(client: AcpClient | null, startSession:
158
158
  };
159
159
  })[] | undefined;
160
160
  isStreaming?: boolean | undefined;
161
+ _meta?: {
162
+ semanticName?: string | undefined;
163
+ agentDefinitionName?: string | undefined;
164
+ currentActivity?: string | undefined;
165
+ statusGenerating?: boolean | undefined;
166
+ } | undefined;
161
167
  }[] | undefined;
162
168
  subagentStreaming?: boolean | undefined;
163
169
  subagentCompleted?: boolean | undefined;
@@ -155,6 +155,12 @@ export declare function useToolCalls(client: AcpClient | null): {
155
155
  };
156
156
  })[] | undefined;
157
157
  isStreaming?: boolean | undefined;
158
+ _meta?: {
159
+ semanticName?: string | undefined;
160
+ agentDefinitionName?: string | undefined;
161
+ currentActivity?: string | undefined;
162
+ statusGenerating?: boolean | undefined;
163
+ } | undefined;
158
164
  }[] | undefined;
159
165
  subagentStreaming?: boolean | undefined;
160
166
  subagentCompleted?: boolean | undefined;
@@ -306,6 +312,12 @@ export declare function useToolCalls(client: AcpClient | null): {
306
312
  };
307
313
  })[] | undefined;
308
314
  isStreaming?: boolean | undefined;
315
+ _meta?: {
316
+ semanticName?: string | undefined;
317
+ agentDefinitionName?: string | undefined;
318
+ currentActivity?: string | undefined;
319
+ statusGenerating?: boolean | undefined;
320
+ } | undefined;
309
321
  }[] | undefined;
310
322
  subagentStreaming?: boolean | undefined;
311
323
  subagentCompleted?: boolean | undefined;
@@ -237,6 +237,12 @@ export declare const DisplayMessage: z.ZodObject<{
237
237
  }, z.core.$strip>;
238
238
  }, z.core.$strip>], "type">>>;
239
239
  isStreaming: z.ZodOptional<z.ZodBoolean>;
240
+ _meta: z.ZodOptional<z.ZodObject<{
241
+ semanticName: z.ZodOptional<z.ZodString>;
242
+ agentDefinitionName: z.ZodOptional<z.ZodString>;
243
+ currentActivity: z.ZodOptional<z.ZodString>;
244
+ statusGenerating: z.ZodOptional<z.ZodBoolean>;
245
+ }, z.core.$strip>>;
240
246
  }, z.core.$strip>>>;
241
247
  subagentStreaming: z.ZodOptional<z.ZodBoolean>;
242
248
  subagentCompleted: z.ZodOptional<z.ZodBoolean>;
@@ -502,6 +508,12 @@ export declare const ChatSessionState: z.ZodObject<{
502
508
  }, z.core.$strip>;
503
509
  }, z.core.$strip>], "type">>>;
504
510
  isStreaming: z.ZodOptional<z.ZodBoolean>;
511
+ _meta: z.ZodOptional<z.ZodObject<{
512
+ semanticName: z.ZodOptional<z.ZodString>;
513
+ agentDefinitionName: z.ZodOptional<z.ZodString>;
514
+ currentActivity: z.ZodOptional<z.ZodString>;
515
+ statusGenerating: z.ZodOptional<z.ZodBoolean>;
516
+ }, z.core.$strip>>;
505
517
  }, z.core.$strip>>>;
506
518
  subagentStreaming: z.ZodOptional<z.ZodBoolean>;
507
519
  subagentCompleted: z.ZodOptional<z.ZodBoolean>;
@@ -262,6 +262,12 @@ export declare const SubagentMessageSchema: z.ZodObject<{
262
262
  }, z.core.$strip>;
263
263
  }, z.core.$strip>], "type">>>;
264
264
  isStreaming: z.ZodOptional<z.ZodBoolean>;
265
+ _meta: z.ZodOptional<z.ZodObject<{
266
+ semanticName: z.ZodOptional<z.ZodString>;
267
+ agentDefinitionName: z.ZodOptional<z.ZodString>;
268
+ currentActivity: z.ZodOptional<z.ZodString>;
269
+ statusGenerating: z.ZodOptional<z.ZodBoolean>;
270
+ }, z.core.$strip>>;
265
271
  }, z.core.$strip>;
266
272
  export type SubagentMessage = z.infer<typeof SubagentMessageSchema>;
267
273
  /**
@@ -443,6 +449,12 @@ export declare const ToolCallSchema: z.ZodObject<{
443
449
  }, z.core.$strip>;
444
450
  }, z.core.$strip>], "type">>>;
445
451
  isStreaming: z.ZodOptional<z.ZodBoolean>;
452
+ _meta: z.ZodOptional<z.ZodObject<{
453
+ semanticName: z.ZodOptional<z.ZodString>;
454
+ agentDefinitionName: z.ZodOptional<z.ZodString>;
455
+ currentActivity: z.ZodOptional<z.ZodString>;
456
+ statusGenerating: z.ZodOptional<z.ZodBoolean>;
457
+ }, z.core.$strip>>;
446
458
  }, z.core.$strip>>>;
447
459
  subagentStreaming: z.ZodOptional<z.ZodBoolean>;
448
460
  subagentCompleted: z.ZodOptional<z.ZodBoolean>;
@@ -596,6 +608,12 @@ export declare const ToolCallUpdateSchema: z.ZodObject<{
596
608
  }, z.core.$strip>;
597
609
  }, z.core.$strip>], "type">>>;
598
610
  isStreaming: z.ZodOptional<z.ZodBoolean>;
611
+ _meta: z.ZodOptional<z.ZodObject<{
612
+ semanticName: z.ZodOptional<z.ZodString>;
613
+ agentDefinitionName: z.ZodOptional<z.ZodString>;
614
+ currentActivity: z.ZodOptional<z.ZodString>;
615
+ statusGenerating: z.ZodOptional<z.ZodBoolean>;
616
+ }, z.core.$strip>>;
599
617
  }, z.core.$strip>>>;
600
618
  subagentCompleted: z.ZodOptional<z.ZodBoolean>;
601
619
  _meta: z.ZodOptional<z.ZodObject<{
@@ -117,6 +117,14 @@ export const SubagentMessageSchema = z.object({
117
117
  /** Interleaved content blocks in arrival order */
118
118
  contentBlocks: z.array(SubagentContentBlockSchema).optional(),
119
119
  isStreaming: z.boolean().optional(),
120
+ _meta: z
121
+ .object({
122
+ semanticName: z.string().optional(),
123
+ agentDefinitionName: z.string().optional(),
124
+ currentActivity: z.string().optional(),
125
+ statusGenerating: z.boolean().optional(),
126
+ })
127
+ .optional(),
120
128
  });
121
129
  /**
122
130
  * Complete tool call state as displayed in the UI
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ChevronDown, Loader2 } from "lucide-react";
3
3
  import { useCallback, useEffect, useRef, useState } from "react";
4
4
  import { MarkdownRenderer } from "./MarkdownRenderer.js";
@@ -93,10 +93,13 @@ export function SubAgentDetails({ parentStatus, agentName, query, isExpanded: co
93
93
  ? (query.split("\n")[0] ?? "").slice(0, 100) +
94
94
  (query.length > 100 ? "..." : "")
95
95
  : "";
96
- return (_jsxs("div", { children: [!isExpanded && (_jsx("div", { className: "w-full max-w-md", children: previewText ? (_jsx("p", { className: "text-paragraph-sm text-muted-foreground/70 truncate", children: previewText })) : queryFirstLine ? (_jsx("p", { className: "text-paragraph-sm text-muted-foreground/50 truncate", children: queryFirstLine })) : null })), isExpanded && (_jsxs("div", { className: "space-y-3", children: [(agentName || query) && (_jsxs("div", { children: [
96
+ return (_jsxs("div", { children: [!isExpanded && (_jsx("div", { className: "w-full max-w-md", children: currentMessage?._meta?.currentActivity ? (_jsx("p", { className: "text-paragraph-sm text-muted-foreground/70 truncate", children: currentMessage._meta.currentActivity })) : currentMessage?._meta?.statusGenerating ? (_jsx("p", { className: "text-paragraph-sm text-muted-foreground/50 truncate animate-pulse", children: "Determining status..." })) : previewText ? (_jsx("p", { className: "text-paragraph-sm text-muted-foreground/70 truncate", children: previewText })) : queryFirstLine ? (_jsx("p", { className: "text-paragraph-sm text-muted-foreground/50 truncate", children: queryFirstLine })) : null })), isExpanded && (_jsxs("div", { className: "space-y-3", children: [(agentName || query) && (_jsxs("div", { children: [
97
97
  _jsx("div", { className: "text-[10px] font-bold text-muted-foreground uppercase tracking-wider mb-1.5 font-sans", children: "Input" }), _jsxs("div", { className: "text-[11px] font-mono space-y-1", children: [agentName && (_jsxs("div", { children: [
98
- _jsx("span", { className: "text-muted-foreground", children: "agentName: " }), _jsx("span", { className: "text-foreground", children: agentName })
99
- ] })), query && (_jsxs("div", { children: [
98
+ _jsx("span", { className: "text-muted-foreground", children: storedMessages?.[0]?._meta?.semanticName
99
+ ? "Task: "
100
+ : "agentName: " }), storedMessages?.[0]?._meta?.semanticName ? (_jsxs(_Fragment, { children: [
101
+ _jsx("span", { className: "text-foreground font-medium", children: storedMessages[0]._meta.semanticName }), _jsxs("span", { className: "text-muted-foreground text-[10px] ml-1", children: ["(", agentName, ")"] })
102
+ ] })) : (_jsx("span", { className: "text-foreground", children: agentName }))] })), query && (_jsxs("div", { children: [
100
103
  _jsx("span", { className: "text-muted-foreground", children: "query: " }), _jsx("span", { className: "text-foreground", children: query })
101
104
  ] }))] })
102
105
  ] })), _jsxs("div", { children: [
@@ -349,7 +349,9 @@ function GroupedToolCallItem({ toolCall, hookNotification, }) {
349
349
  // Render subagent with clickable header and SubAgentDetails component
350
350
  return (_jsxs("div", { className: "flex flex-col ml-5", children: [
351
351
  _jsxs("button", { type: "button", className: "flex items-center gap-1.5 cursor-pointer bg-transparent border-none p-0 text-left group w-fit", onClick: () => setIsExpanded(!isExpanded), "aria-expanded": isExpanded, children: [
352
- _jsx("div", { className: "text-text-secondary/70 group-hover:text-text-secondary transition-colors", children: _jsx(CircleDot, { className: "h-3 w-3" }) }), _jsx("span", { className: "text-paragraph-sm text-text-secondary/70 group-hover:text-text-secondary transition-colors", children: toolCall.rawInput?.agentName || "Subagent" }), isRunning && toolCall.startedAt && (_jsx(RunningDuration, { startTime: toolCall.startedAt })), isFailed && (_jsx("span", { title: toolCall.error || "Operation failed", children: _jsx(AlertCircle, { className: "h-3 w-3 text-destructive" }) })), hasCompaction && (_jsx(TooltipProvider, { delayDuration: 0, children: _jsxs(Tooltip, { children: [
352
+ _jsx("div", { className: "text-text-secondary/70 group-hover:text-text-secondary transition-colors", children: _jsx(CircleDot, { className: "h-3 w-3" }) }), _jsx("span", { className: "text-paragraph-sm text-text-secondary/70 group-hover:text-text-secondary transition-colors", children: toolCall.subagentMessages?.[0]?._meta?.semanticName ||
353
+ toolCall.rawInput?.agentName ||
354
+ "Subagent" }), toolCall.subagentMessages?.[0]?._meta?.semanticName && (_jsxs("span", { className: "text-muted-foreground text-[10px] ml-1", children: ["(", toolCall.rawInput?.agentName || "subagent", ")"] })), isRunning && toolCall.startedAt && (_jsx(RunningDuration, { startTime: toolCall.startedAt })), isFailed && (_jsx("span", { title: toolCall.error || "Operation failed", children: _jsx(AlertCircle, { className: "h-3 w-3 text-destructive" }) })), hasCompaction && (_jsx(TooltipProvider, { delayDuration: 0, children: _jsxs(Tooltip, { children: [
353
355
  _jsx(TooltipTrigger, { asChild: true, children: _jsx("span", { children: isTruncation ? (_jsx(ScissorsLineDashed, { className: "h-3 w-3 text-destructive" })) : (_jsx(FoldVertical, { className: "h-3 w-3 text-text-secondary/70" })) }) }), _jsx(TooltipContent, { children: (() => {
354
356
  const meta = toolCall._meta;
355
357
  const percentage = meta?.originalTokens && meta?.finalTokens
@@ -348,6 +348,12 @@ export declare const SessionUpdate: z.ZodUnion<readonly [z.ZodObject<{
348
348
  }, z.core.$strip>;
349
349
  }, z.core.$strip>], "type">>>;
350
350
  isStreaming: z.ZodOptional<z.ZodBoolean>;
351
+ _meta: z.ZodOptional<z.ZodObject<{
352
+ semanticName: z.ZodOptional<z.ZodString>;
353
+ agentDefinitionName: z.ZodOptional<z.ZodString>;
354
+ currentActivity: z.ZodOptional<z.ZodString>;
355
+ statusGenerating: z.ZodOptional<z.ZodBoolean>;
356
+ }, z.core.$strip>>;
351
357
  }, z.core.$strip>>>;
352
358
  subagentStreaming: z.ZodOptional<z.ZodBoolean>;
353
359
  subagentCompleted: z.ZodOptional<z.ZodBoolean>;
@@ -557,6 +563,12 @@ export declare const SessionUpdate: z.ZodUnion<readonly [z.ZodObject<{
557
563
  }, z.core.$strip>;
558
564
  }, z.core.$strip>], "type">>>;
559
565
  isStreaming: z.ZodOptional<z.ZodBoolean>;
566
+ _meta: z.ZodOptional<z.ZodObject<{
567
+ semanticName: z.ZodOptional<z.ZodString>;
568
+ agentDefinitionName: z.ZodOptional<z.ZodString>;
569
+ currentActivity: z.ZodOptional<z.ZodString>;
570
+ statusGenerating: z.ZodOptional<z.ZodBoolean>;
571
+ }, z.core.$strip>>;
560
572
  }, z.core.$strip>>>;
561
573
  subagentCompleted: z.ZodOptional<z.ZodBoolean>;
562
574
  _meta: z.ZodOptional<z.ZodObject<{
@@ -872,19 +872,14 @@ export class HttpTransport {
872
872
  message.method === "session/update" &&
873
873
  message.params?.update?.sessionUpdate === "sources";
874
874
  if (isSourcesMessage) {
875
- // Use console.warn directly for gui-console capture
876
- console.warn("🟢 RECEIVED SOURCES SSE MESSAGE", {
877
- sourcesCount: message.params?.update?.sources?.length,
878
- isInReplayMode: this.isInReplayMode,
879
- callbackCount: this.sessionUpdateCallbacks.size,
880
- });
881
875
  // Handle sources directly without ACP schema validation
882
876
  try {
883
877
  this.handleSessionNotification(message.params);
884
- console.warn("🟢 AFTER handleSessionNotification for sources");
885
878
  }
886
879
  catch (error) {
887
- console.error("🔴 ERROR in handleSessionNotification for sources", error);
880
+ logger.error("Error in handleSessionNotification for sources", {
881
+ error,
882
+ });
888
883
  }
889
884
  return;
890
885
  }
@@ -931,9 +926,6 @@ export class HttpTransport {
931
926
  logger.debug("Skipping session notification - stream complete/cancelled");
932
927
  return;
933
928
  }
934
- if (this.streamComplete && isSourcesNotification) {
935
- console.warn("🟢 Processing sources notification after stream complete");
936
- }
937
929
  logger.debug("handleSessionNotification called", { params });
938
930
  // Extract content from the update
939
931
  const paramsExtended = params;
@@ -1548,13 +1540,6 @@ export class HttpTransport {
1548
1540
  update.sessionUpdate === "sources") {
1549
1541
  // Sources notification - citation sources from tool calls
1550
1542
  const sourcesUpdate = update;
1551
- console.warn("🔵 SOURCES in handleSessionNotification", {
1552
- sourcesCount: sourcesUpdate.sources.length,
1553
- isInReplayMode: this.isInReplayMode,
1554
- callbackCount: this.sessionUpdateCallbacks.size,
1555
- firstSourceId: sourcesUpdate.sources[0]?.id,
1556
- firstSourceToolCallId: sourcesUpdate.sources[0]?.toolCallId,
1557
- });
1558
1543
  // Create a sources session update
1559
1544
  const sessionUpdate = {
1560
1545
  type: "sources",
@@ -1567,20 +1552,9 @@ export class HttpTransport {
1567
1552
  // If no callbacks are registered yet (React hooks haven't subscribed),
1568
1553
  // queue the sources to be replayed when they do subscribe
1569
1554
  if (this.sessionUpdateCallbacks.size === 0) {
1570
- console.warn("🔵 QUEUEING sources for late-subscribing callbacks", {
1571
- sourcesCount: sourcesUpdate.sources.length,
1572
- queueLengthBefore: this.pendingReplayUpdates.length,
1573
- });
1574
1555
  this.pendingReplayUpdates.push(sessionUpdate);
1575
- console.warn("🔵 Queue length after:", {
1576
- queueLengthAfter: this.pendingReplayUpdates.length,
1577
- });
1578
1556
  }
1579
1557
  else {
1580
- console.warn("🔵 NOTIFYING sources immediately (callbacks registered)", {
1581
- sourcesCount: sourcesUpdate.sources.length,
1582
- callbackCount: this.sessionUpdateCallbacks.size,
1583
- });
1584
1558
  this.notifySessionUpdate(sessionUpdate);
1585
1559
  }
1586
1560
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@townco/ui",
3
- "version": "0.1.111",
3
+ "version": "0.1.112",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -49,7 +49,7 @@
49
49
  "@radix-ui/react-slot": "^1.2.4",
50
50
  "@radix-ui/react-tabs": "^1.1.13",
51
51
  "@radix-ui/react-tooltip": "^1.2.8",
52
- "@townco/core": "0.0.89",
52
+ "@townco/core": "0.0.90",
53
53
  "@types/mdast": "^4.0.4",
54
54
  "@uiw/react-json-view": "^2.0.0-alpha.39",
55
55
  "class-variance-authority": "^0.7.1",
@@ -67,7 +67,7 @@
67
67
  "zustand": "^5.0.8"
68
68
  },
69
69
  "devDependencies": {
70
- "@townco/tsconfig": "0.1.108",
70
+ "@townco/tsconfig": "0.1.109",
71
71
  "@types/node": "^24.10.0",
72
72
  "@types/react": "^19.2.2",
73
73
  "@types/unist": "^3.0.3",