@kortix/ui 0.16.3 → 0.16.5

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 (156) hide show
  1. package/dist/_vendor/kortix-shared.js +1 -4
  2. package/dist/customize/sections/view/review-center-connected.js +64 -71
  3. package/dist/customize/sections/view/secret-delivery.d.ts +11 -20
  4. package/dist/customize/sections/view/secret-delivery.js +20 -29
  5. package/dist/customize/sections/view/secrets-view.js +9 -24
  6. package/dist/customize/settings/rail-copy-context.d.ts +2 -0
  7. package/dist/customize/settings/rail-copy-context.js +2 -0
  8. package/dist/customize/settings/tabs/chrome-connections-tab.js +1 -1
  9. package/dist/files/renderers/show-content-renderer.js +3 -1
  10. package/dist/i18n/en.d.ts +130 -22
  11. package/dist/i18n/en.js +142 -34
  12. package/dist/i18n/ui-catalog/product-catalog-translation-keys.generated.js +2 -0
  13. package/dist/internal/auth/auth-card-shell.d.ts +24 -3
  14. package/dist/internal/auth/auth-card-shell.js +15 -8
  15. package/dist/internal/auth/auth-primitives.d.ts +15 -2
  16. package/dist/internal/auth/auth-primitives.js +22 -5
  17. package/dist/internal/chrome/chrome-connect.d.ts +3 -5
  18. package/dist/internal/chrome/chrome-connect.js +7 -10
  19. package/dist/internal/chrome/extension.d.ts +1 -8
  20. package/dist/internal/chrome/extension.js +1 -8
  21. package/dist/internal/chrome/use-chrome-offered.d.ts +6 -12
  22. package/dist/internal/chrome/use-chrome-offered.js +13 -15
  23. package/dist/internal/components/agent-mark.d.ts +2 -1
  24. package/dist/internal/components/agent-mark.js +14 -3
  25. package/dist/internal/hooks/use-review-session-summary.d.ts +1 -1
  26. package/dist/internal/hooks/use-review-session-summary.js +1 -1
  27. package/dist/internal/layout/project-nav-row.d.ts +3 -1
  28. package/dist/internal/layout/project-nav-row.js +2 -2
  29. package/dist/internal/layout/project-page-header.js +5 -4
  30. package/dist/internal/stores/user-preferences-store.d.ts +17 -0
  31. package/dist/internal/stores/user-preferences-store.js +5 -0
  32. package/dist/markdown/setup-links/secret-intake-form.d.ts +4 -1
  33. package/dist/markdown/setup-links/secret-intake-form.js +60 -16
  34. package/dist/markdown/setup-links/setup-link-button.js +6 -1
  35. package/dist/primitives/color-picker.d.ts +19 -0
  36. package/dist/primitives/color-picker.js +27 -0
  37. package/dist/primitives/faded-scroll-area.js +4 -0
  38. package/dist/primitives/glyph-picker.d.ts +11 -0
  39. package/dist/primitives/glyph-picker.js +10 -6
  40. package/dist/primitives/gradient-wallpaper-gl.d.ts +61 -0
  41. package/dist/primitives/gradient-wallpaper-gl.js +446 -0
  42. package/dist/primitives/gradient-wallpaper.d.ts +20 -0
  43. package/dist/primitives/gradient-wallpaper.js +242 -0
  44. package/dist/primitives/resizable.d.ts +1 -1
  45. package/dist/session/agents/agent-hover-card.d.ts +26 -0
  46. package/dist/session/agents/agent-hover-card.js +70 -0
  47. package/dist/session/agents/agent-strip.js +33 -7
  48. package/dist/session/agents/agent-surface.d.ts +26 -1
  49. package/dist/session/agents/agent-surface.js +57 -6
  50. package/dist/session/agents/held-messages.js +2 -2
  51. package/dist/session/agents/subagent-dialog-content.js +2 -2
  52. package/dist/session/composer/ComposerCard.js +4 -4
  53. package/dist/session/composer/composer-toolbar.d.ts +8 -1
  54. package/dist/session/composer/composer-toolbar.js +2 -2
  55. package/dist/session/composer/dictation/dictation-control.d.ts +10 -0
  56. package/dist/session/composer/dictation/dictation-control.js +28 -0
  57. package/dist/session/composer/dictation/dictation-state.d.ts +26 -0
  58. package/dist/session/composer/dictation/dictation-state.js +71 -0
  59. package/dist/session/composer/dictation/recorder.d.ts +30 -0
  60. package/dist/session/composer/dictation/recorder.js +129 -0
  61. package/dist/session/composer/dictation/use-composer-dictation.d.ts +25 -0
  62. package/dist/session/composer/dictation/use-composer-dictation.js +218 -0
  63. package/dist/session/composer/queued-prompt-list.js +5 -1
  64. package/dist/session/panel/easy/apps-card.js +3 -10
  65. package/dist/session/panel/easy/background-tasks-card.d.ts +23 -0
  66. package/dist/session/panel/easy/background-tasks-card.js +119 -0
  67. package/dist/session/panel/easy/change-requests-card.js +1 -1
  68. package/dist/session/panel/easy/changes-card.js +4 -6
  69. package/dist/session/panel/easy/context-card.js +8 -9
  70. package/dist/session/panel/easy/context-meter.d.ts +2 -0
  71. package/dist/session/panel/easy/context-meter.js +18 -4
  72. package/dist/session/panel/easy/detail-view.js +7 -4
  73. package/dist/session/panel/easy/easy-panel-logic.d.ts +4 -15
  74. package/dist/session/panel/easy/easy-panel-logic.js +4 -17
  75. package/dist/session/panel/easy/easy-panel.js +5 -4
  76. package/dist/session/panel/easy/outputs-card.d.ts +1 -13
  77. package/dist/session/panel/easy/outputs-card.js +14 -40
  78. package/dist/session/panel/easy/panel-card.d.ts +13 -40
  79. package/dist/session/panel/easy/panel-card.js +17 -55
  80. package/dist/session/panel/easy/plan-card.js +4 -7
  81. package/dist/session/panel/model-switch-event.d.ts +2 -2
  82. package/dist/session/panel/model-switch-event.js +13 -9
  83. package/dist/session/panel/session-panel-provider.d.ts +2 -1
  84. package/dist/session/panel/session-panel-provider.js +3 -3
  85. package/dist/session/panel/shared/collect-tool-parts.js +2 -2
  86. package/dist/session/panel/shared/derive-panels.js +14 -1
  87. package/dist/session/panel/shared/use-panel-handoffs.d.ts +0 -1
  88. package/dist/session/panel/shared/use-panel-handoffs.js +26 -17
  89. package/dist/session/thread/chat-minimap.js +7 -1
  90. package/dist/session/thread/session-body.js +1 -1
  91. package/dist/session/thread/session-chat.js +59 -15
  92. package/dist/session/tool/shared/infrastructure-contexts.d.ts +7 -0
  93. package/dist/session/tool/shared/infrastructure-contexts.js +9 -0
  94. package/dist/session/tool/shared/infrastructure-row-header.js +4 -1
  95. package/dist/session/tool/shared/infrastructure-rows.js +19 -19
  96. package/dist/session/tool/show-group-renderer.d.ts +5 -5
  97. package/dist/session/tool/show-group-renderer.js +7 -4
  98. package/dist/session/tool/tool-part-renderer.js +25 -9
  99. package/dist/session/tool/tool-renderers.d.ts +1 -1
  100. package/dist/session/tool/tool-renderers.js +1 -1
  101. package/dist/session/tool/tools/bash-tool.js +3 -2
  102. package/dist/session/tool/tools/codemode-tool.d.ts +15 -0
  103. package/dist/session/tool/tools/codemode-tool.js +54 -2
  104. package/dist/session/tool/tools/kortix-action-tool.d.ts +1 -0
  105. package/dist/session/tool/tools/kortix-action-tool.js +19 -8
  106. package/dist/session/tool/tools/multi-agent-tool-bodies.d.ts +8 -1
  107. package/dist/session/tool/tools/multi-agent-tool-bodies.js +76 -10
  108. package/dist/session/tool/tools/task-tool.js +17 -5
  109. package/dist/session/turn/peer-message-row.d.ts +3 -0
  110. package/dist/session/turn/peer-message-row.js +8 -2
  111. package/dist/session/turn/subagent-notice-row.js +5 -3
  112. package/dist/styles.css +1 -1
  113. package/dist/test-utils/intl.d.ts +130 -22
  114. package/dist/theme/index.d.ts +2 -1
  115. package/dist/theme/index.js +2 -1
  116. package/dist/theme/wallpaper-gradients.d.ts +106 -0
  117. package/dist/theme/wallpaper-gradients.js +347 -0
  118. package/dist/theme/wallpapers.d.ts +23 -3
  119. package/dist/theme/wallpapers.js +53 -29
  120. package/dist/workspace/admin/project-admin-dashboard.js +1 -1
  121. package/dist/workspace/layout/project-home.js +1 -1
  122. package/dist/workspace/new/use-create-workspace.d.ts +5 -3
  123. package/dist/workspace/new/use-create-workspace.js +1 -1
  124. package/dist/workspace/projects/modal/project-icon-field.d.ts +3 -1
  125. package/dist/workspace/projects/modal/project-icon-field.js +3 -3
  126. package/dist/workspace/review/review-center.d.ts +9 -1
  127. package/dist/workspace/review/review-center.js +107 -14
  128. package/dist/workspace/review/review-detail.d.ts +19 -0
  129. package/dist/workspace/review/review-detail.js +18 -3
  130. package/dist/workspace/review/review-swipe-deck.d.ts +27 -0
  131. package/dist/workspace/review/review-swipe-deck.js +304 -0
  132. package/dist/workspace/review/review-swipe.d.ts +17 -0
  133. package/dist/workspace/review/review-swipe.js +10 -0
  134. package/dist/workspace/session-spaces/space-picker.js +3 -3
  135. package/dist/workspace/setup/setup-banner-snooze.d.ts +10 -0
  136. package/dist/workspace/setup/setup-banner-snooze.js +44 -0
  137. package/dist/workspace/setup/setup-banner.js +19 -36
  138. package/dist/workspace/setup/setup-steps.d.ts +0 -5
  139. package/dist/workspace/setup/setup-steps.js +0 -7
  140. package/dist/workspace/setup/workspace-setup-modal.d.ts +39 -0
  141. package/dist/workspace/setup/workspace-setup-modal.js +202 -0
  142. package/dist/workspace/sidebar/footer/project-review-nav.d.ts +13 -0
  143. package/dist/workspace/sidebar/footer/project-review-nav.js +29 -0
  144. package/dist/workspace/sidebar/project-nav-items.d.ts +3 -1
  145. package/dist/workspace/sidebar/project-nav-items.js +24 -5
  146. package/dist/workspace/sidebar/project-session-list.js +2 -1
  147. package/dist/workspace/sidebar/project-sidebar.js +6 -5
  148. package/dist/workspace/sidebar/project-spaces-nav.js +3 -10
  149. package/dist/workspace/sidebar/sidebar-more-group.js +1 -1
  150. package/package.json +14 -10
  151. package/skills/kortix-ui/SKILL.md +1 -1
  152. package/skills/kortix-ui/references/modules.md +3 -1
  153. package/dist/primitives/toast-clearance.d.ts +0 -36
  154. package/dist/primitives/toast-clearance.js +0 -94
  155. package/dist/workspace/setup/workspace-setup-page.d.ts +0 -10
  156. package/dist/workspace/setup/workspace-setup-page.js +0 -91
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { HighlightedCode } from '../../../markdown/code/index.js';
4
4
  import { TextShimmer } from '../../../primitives/text-shimmer.js';
5
- import { BasicTool, partInput, partMetadata, partOutput, partStatus, partStreamingInput, StructuredOutput, RecoveredCallsContext, ToolRunningContext, useToolCardFrame, useToolCardPad, useToolIndent, useToolOpen, partRawOutput, } from '../shared/infrastructure.js';
5
+ import { BasicTool, partInput, partMetadata, partOutput, partStatus, partStreamingInput, StructuredOutput, RecoveredCallsContext, ToolRunningContext, ToolSurfaceContext, useToolCardFrame, useToolCardPad, useToolIndent, useToolOpen, partRawOutput, } from '../shared/infrastructure.js';
6
6
  import { GenericTool } from '../generic-tool.js';
7
7
  import { ToolRegistry } from '../shared/registry.js';
8
8
  import { cn } from '../../../lib/utils.js';
@@ -107,6 +107,7 @@ function CommandBlock({ command, output, richOutput, exitCode, settled, }) {
107
107
  function BashTrigger({ title, failed, command, commandPreview, extraLines, live, }) {
108
108
  const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
109
109
  const open = useToolOpen();
110
+ const valueFirst = useContext(ToolSurfaceContext) === 'panel' && !open;
110
111
  if (live) {
111
112
  return (_jsx("div", { className: "flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden", children: open ? (
112
113
  // The shimmer moves to the label: mid-flight the row still has to
@@ -116,7 +117,7 @@ function BashTrigger({ title, failed, command, commandPreview, extraLines, live,
116
117
  }
117
118
  return (_jsx("div", { className: "flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden", children: _jsxs("span", { className: "flex min-w-0 shrink-0 items-center gap-2 text-xs",
118
119
  // Redundant once the card spells the command out below.
119
- title: open ? undefined : command, children: [_jsx("span", { className: "min-w-0 truncate text-foreground", children: title }), !open && (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-muted-foreground min-w-0 truncate font-mono", children: commandPreview }), extraLines > 0 && (_jsxs("span", { className: "text-muted-foreground shrink-0 tabular-nums", children: ["+", extraLines] }))] }))] }) }));
120
+ title: open ? undefined : command, children: [_jsx("span", { className: cn('min-w-0 truncate', valueFirst ? 'text-muted-foreground' : 'text-foreground'), children: title }), !open && (_jsxs(_Fragment, { children: [_jsx("span", { className: cn('min-w-0 truncate font-mono', valueFirst ? 'text-foreground' : 'text-muted-foreground'), children: commandPreview }), extraLines > 0 && (_jsxs("span", { className: "text-muted-foreground shrink-0 tabular-nums", children: ["+", extraLines] }))] }))] }) }));
120
121
  }
121
122
  export function BashTool({ call, defaultOpen, forceOpen, locked }) {
122
123
  const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
@@ -18,4 +18,19 @@ export interface ScriptCall {
18
18
  export declare function scriptCalls(metadata: Record<string, unknown>): ScriptCall[];
19
19
  /** The script's result without pi's `Script completed|failed`, `Wall time` and `Output:` header lines. */
20
20
  export declare function scriptResult(text: string): string;
21
+ /** One Kortix tool result a script printed: its card's title line and its rows. */
22
+ export interface ScriptCard {
23
+ title: string;
24
+ rows: string[];
25
+ }
26
+ /**
27
+ * A script that returns Kortix tool results (`text(await tools.task_stop(…))`)
28
+ * prints them as escaped JSON. Read each one as its card: the title ("faq-writer
29
+ * had already ended") and every row under it, so a list keeps its entries.
30
+ * Null when the output is anything else, or when a card carries a link or a
31
+ * change the summary would drop.
32
+ */
33
+ export declare function scriptCards(result: string): ScriptCard[] | null;
34
+ /** The cards as plain text, for the copy button. */
35
+ export declare function scriptCardsText(cards: ScriptCard[]): string;
21
36
  export declare function CodemodeTool({ call, defaultOpen, forceOpen, locked }: ToolProps): import("react").JSX.Element;
@@ -8,7 +8,7 @@ import { BasicTool, partError, partInput, partMetadata, partOutput, partStatus,
8
8
  import { ToolRegistry } from '../shared/registry.js';
9
9
  import { useTranslations } from '../../../i18n/index.js';
10
10
  import { cn } from '../../../lib/utils.js';
11
- import { getToolPrimaryArg } from '@kortix/sdk';
11
+ import { getToolPrimaryArg, parseKortixToolResult } from '@kortix/sdk';
12
12
  import { CheckIcon, CodeIcon, MinusIcon, ProhibitIcon, WarningIcon } from '@phosphor-icons/react';
13
13
  import { useContext } from 'react';
14
14
  const STATUS = {
@@ -59,6 +59,57 @@ export function scriptCalls(metadata) {
59
59
  export function scriptResult(text) {
60
60
  return text.replace(/^Script (?:completed|failed)\n(?:Wall time [^\n]*\n)?(?:Output:\n)?/, '').trim();
61
61
  }
62
+ /**
63
+ * A script that returns Kortix tool results (`text(await tools.task_stop(…))`)
64
+ * prints them as escaped JSON. Read each one as its card: the title ("faq-writer
65
+ * had already ended") and every row under it, so a list keeps its entries.
66
+ * Null when the output is anything else, or when a card carries a link or a
67
+ * change the summary would drop.
68
+ */
69
+ export function scriptCards(result) {
70
+ let value;
71
+ try {
72
+ value = JSON.parse(result);
73
+ }
74
+ catch {
75
+ return null;
76
+ }
77
+ const items = Array.isArray(value) ? value : [value];
78
+ const cards = [];
79
+ for (const item of items) {
80
+ const raw = typeof item === 'string' ? item : JSON.stringify(item);
81
+ const parsed = parseKortixToolResult(raw);
82
+ if (!parsed)
83
+ return null;
84
+ const { card } = parsed;
85
+ // The parser caps a card's rows: a longer list keeps the original output, so no row is lost.
86
+ if (rawRowCount(raw) !== card.rows.length)
87
+ return null;
88
+ // A link (a sign-in, a row's session URL) or a setting change is an action or
89
+ // a fact the summary would drop: the original output stays.
90
+ if (card.links.length > 0 || card.changes.length > 0 || card.rows.some((row) => row.href))
91
+ return null;
92
+ cards.push({
93
+ title: card.subtitle ? `${card.title} · ${card.subtitle}` : card.title,
94
+ rows: card.rows.map((row) => [row.title, row.detail, row.badge].filter(Boolean).join(' · ')),
95
+ });
96
+ }
97
+ return cards.length ? cards : null;
98
+ }
99
+ /** How many rows the card had before parsing. */
100
+ function rawRowCount(raw) {
101
+ try {
102
+ const rows = JSON.parse(raw).card?.rows;
103
+ return Array.isArray(rows) ? rows.length : 0;
104
+ }
105
+ catch {
106
+ return -1;
107
+ }
108
+ }
109
+ /** The cards as plain text, for the copy button. */
110
+ export function scriptCardsText(cards) {
111
+ return cards.map((card) => [card.title, ...card.rows.map((row) => ` ${row}`)].join('\n')).join('\n');
112
+ }
62
113
  function formatDuration(ms) {
63
114
  return ms < 1000 ? `${Math.round(ms)} ms` : `${(ms / 1000).toFixed(1)} s`;
64
115
  }
@@ -99,8 +150,9 @@ export function CodemodeTool({ call, defaultOpen, forceOpen, locked }) {
99
150
  const failed = status === 'error';
100
151
  const live = running && !failed && status !== 'completed';
101
152
  const result = scriptResult(failed ? (partError(call) ?? '') : partOutput(call));
153
+ const cards = failed ? null : scriptCards(result);
102
154
  const names = [...new Set(calls.map((c) => c.name))].join(' · ');
103
155
  const summary = calls.length ? `${t('calls', { count: calls.length })}${names ? ` · ${names}` : ''}` : '';
104
- return (_jsx(BasicTool, { icon: _jsx(CodeIcon, { className: "size-4 shrink-0" }), trigger: _jsx(ScriptTrigger, { title: live ? t('runningScript') : failed ? t('scriptFailed') : t('ranScript'), live: live, summary: summary }), defaultOpen: defaultOpen, forceOpen: forceOpen, locked: locked, children: _jsx("div", { className: cn(indent && 'mt-1.5', indent), children: _jsxs("div", { className: cn('relative overflow-hidden', frame), children: [calls.length > 0 && (_jsx("div", { className: cn(paneInset, 'border-border/60 border-b'), children: _jsx(CallList, { calls: calls }) })), code && (_jsxs("div", { className: "relative", children: [_jsx("div", { "data-scrollable": true, className: cn('max-h-64 overflow-auto', frame && 'bg-muted/40'), children: _jsx("pre", { className: cn('text-foreground font-mono text-xs leading-relaxed wrap-break-word whitespace-pre-wrap [&_code]:border-none [&_code]:bg-transparent [&_code]:p-0 [&_code]:text-xs [&_code]:leading-relaxed [&_code]:whitespace-pre-wrap [&_pre]:whitespace-pre-wrap [&_span]:border-none [&_span]:outline-none', paneInset, 'pr-11'), children: _jsx(HighlightedCode, { code: code, language: "javascript", children: code }) }) }), _jsx("div", { className: "absolute top-2 right-2", children: _jsx(CopyButton, { code: code, className: "text-muted-foreground hover:text-foreground" }) })] })), (result || status === 'completed') && (_jsxs("div", { className: "border-border/60 relative border-t", children: [_jsx("div", { "data-scrollable": true, className: "max-h-80 overflow-auto", children: _jsx("div", { className: cn('font-mono text-xs leading-relaxed wrap-break-word whitespace-pre-wrap', failed ? 'text-foreground' : 'text-muted-foreground', paneInset, 'pr-11'), children: result || t('noOutput') }) }), result && (_jsx("div", { className: "absolute top-2 right-2", children: _jsx(CopyButton, { code: result, className: "text-muted-foreground hover:text-foreground" }) }))] }))] }) }) }));
156
+ return (_jsx(BasicTool, { icon: _jsx(CodeIcon, { className: "size-4 shrink-0" }), trigger: _jsx(ScriptTrigger, { title: live ? t('runningScript') : failed ? t('scriptFailed') : t('ranScript'), live: live, summary: summary }), defaultOpen: defaultOpen, forceOpen: forceOpen, locked: locked, children: _jsx("div", { className: cn(indent && 'mt-1.5', indent), children: _jsxs("div", { className: cn('relative overflow-hidden', frame), children: [calls.length > 0 && (_jsx("div", { className: cn(paneInset, 'border-border/60 border-b'), children: _jsx(CallList, { calls: calls }) })), code && (_jsxs("div", { className: "relative", children: [_jsx("div", { "data-scrollable": true, className: cn('max-h-64 overflow-auto', frame && 'bg-muted/40'), children: _jsx("pre", { className: cn('text-foreground font-mono text-xs leading-relaxed wrap-break-word whitespace-pre-wrap [&_code]:border-none [&_code]:bg-transparent [&_code]:p-0 [&_code]:text-xs [&_code]:leading-relaxed [&_code]:whitespace-pre-wrap [&_pre]:whitespace-pre-wrap [&_span]:border-none [&_span]:outline-none', paneInset, 'pr-11'), children: _jsx(HighlightedCode, { code: code, language: "javascript", children: code }) }) }), _jsx("div", { className: "absolute top-2 right-2", children: _jsx(CopyButton, { code: code, className: "text-muted-foreground hover:text-foreground" }) })] })), (result || status === 'completed') && (_jsxs("div", { className: "border-border/60 relative border-t", children: [_jsx("div", { "data-scrollable": true, className: "max-h-80 overflow-auto", children: cards ? (_jsx("ul", { "data-slot": "script-card-lines", className: cn('text-foreground flex flex-col gap-2 text-sm', paneInset, 'pr-11'), children: cards.map((card, index) => (_jsxs("li", { className: "flex min-w-0 flex-col gap-0.5 wrap-break-word", children: [_jsx("span", { children: card.title }), card.rows.map((row, rowIndex) => (_jsx("span", { className: "text-muted-foreground text-xs", children: row }, rowIndex)))] }, index))) })) : (_jsx("div", { className: cn('font-mono text-xs leading-relaxed wrap-break-word whitespace-pre-wrap', failed ? 'text-foreground' : 'text-muted-foreground', paneInset, 'pr-11'), children: result || t('noOutput') })) }), result && (_jsx("div", { className: "absolute top-2 right-2", children: _jsx(CopyButton, { code: cards ? scriptCardsText(cards) : result, className: "text-muted-foreground hover:text-foreground" }) }))] }))] }) }) }));
105
157
  }
106
158
  ToolRegistry.register('codemode', CodemodeTool);
@@ -1,2 +1,3 @@
1
1
  import type { ToolProps } from '../shared/types.js';
2
+ /** Kortix platform calls (agents, sessions, access, connectors). In the side panel they are the same flat rows as every other call. */
2
3
  export declare function KortixActionTool(props: ToolProps): import("react").JSX.Element;
@@ -6,15 +6,18 @@ import { ButtonGroup } from '../../../primitives/button-group.js';
6
6
  import { StatusDot } from '../../../primitives/status.js';
7
7
  import { TextShimmer } from '../../../primitives/text-shimmer.js';
8
8
  import { GenericTool } from '../generic-tool.js';
9
- import { BasicTool, partError, partInput, partRawOutput, partStatus, ToolOutcomeContext, ToolRunningContext, useToolIndent, useToolOpen, } from '../shared/infrastructure.js';
9
+ import { BasicTool, partError, partInput, partRawOutput, partStatus, ToolOutcomeContext, ToolRunningContext, ToolSurfaceContext, useToolIndent, useToolOpen, } from '../shared/infrastructure.js';
10
10
  import { ToolRegistry } from '../shared/registry.js';
11
+ import { SolidCheckIcon } from '../../../internal/icons/solid-check-icon.js';
11
12
  import { ToolResultCard } from '../shared/result-card.js';
12
13
  import { useTranslations } from '../../../i18n/index.js';
13
14
  import { cn } from '../../../lib/utils.js';
14
15
  import { UiLink } from '../../../providers/ui-provider.js';
15
- import { ArrowRightIcon, ArrowSquareOutIcon, CalendarDotsIcon, CaretRightIcon, ChartBarIcon, ChatsCircleIcon, CheckIcon, GitPullRequestIcon, SunDimIcon, HandPointingIcon, LockKeyIcon, PlugIcon, RobotIcon, UsersIcon, WarningIcon, } from '@phosphor-icons/react';
16
+ import { ArrowRightIcon, ArrowSquareOutIcon, CalendarDotsIcon, CaretRightIcon, ChartBarIcon, ChatsCircleIcon, GitPullRequestIcon, SunDimIcon, HandPointingIcon, LockKeyIcon, PlugIcon, RobotIcon, UsersIcon, WarningIcon, } from '@phosphor-icons/react';
16
17
  import { useContext, useMemo } from 'react';
17
- import { MULTI_AGENT_ICON, multiAgentBody, PeerSendRow, runningKey } from './multi-agent-tool-bodies.js';
18
+ import { AgentChip } from '../../agents/agent-surface.js';
19
+ import { peerHandleLabel } from '../../../_vendor/kortix-shared.js';
20
+ import { MULTI_AGENT_ICON, multiAgentBody, PeerSendRow, peerReceiverId, runningKey } from './multi-agent-tool-bodies.js';
18
21
  import { parsePeerSend, toolCallConnectorSignIns } from '@kortix/sdk';
19
22
  import { useSessionConnectRequests } from '../../prompts/session-connect-card.js';
20
23
  import { KORTIX_PLATFORM_TOOLS, isReadAction, kortixCardTool, kortixPlatformTool, multiAgentTool, parseKortixToolResult, } from './kortix-tool-card.js';
@@ -43,7 +46,9 @@ function badgeVariant(badge) {
43
46
  /** The card's state at the row's right edge. The glyph carries the hue; the word is for a screen reader. */
44
47
  function StatusMark({ status }) {
45
48
  const t = useTranslations('tools.kortixAction.status');
46
- const glyph = status === 'done' ? (_jsx(CheckIcon, { "aria-hidden": true, className: "text-kortix-green size-3.5 shrink-0" })) : status === 'running' ? (
49
+ const glyph = status === 'done' ? (
50
+ // Done is a resting state: meta ink, never green (green means running).
51
+ _jsx(SolidCheckIcon, { "aria-hidden": true, className: "text-muted-foreground size-3.5 shrink-0" })) : status === 'running' ? (
47
52
  // The thing the tool started runs on (a session). No spinner: the call itself is over.
48
53
  _jsx(StatusDot, { tone: "success" })) : status === 'needs_you' ? (_jsx(HandPointingIcon, { weight: "fill", "aria-hidden": true, className: "text-kortix-yellow size-3.5 shrink-0" })) : status === 'denied' ? (_jsx(LockKeyIcon, { weight: "fill", "aria-hidden": true, className: "text-kortix-orange size-3.5 shrink-0" })) : (_jsx(WarningIcon, { weight: "fill", "aria-hidden": true, className: "text-kortix-red size-3.5 shrink-0" }));
49
54
  const label = { done: t('done'), running: t('running'), needs_you: t('needsYou'), denied: t('denied'), error: t('error') }[status];
@@ -51,11 +56,14 @@ function StatusMark({ status }) {
51
56
  }
52
57
  /** The row's words stay ink; the status mark at the right edge carries the hue. */
53
58
  function CardTrigger({ title, subtitle, live, status, }) {
54
- return (_jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden text-sm", children: [live ? (_jsx(TextShimmer, { duration: 1, spread: 2, className: "min-w-0 truncate text-sm", children: title })) : (_jsx("span", { className: "text-foreground min-w-0 truncate", title: title, children: title })), subtitle && (_jsx("span", { className: "text-muted-foreground min-w-0 flex-1 truncate", title: subtitle, children: subtitle })), status && _jsx(StatusMark, { status: status })] }));
59
+ return (_jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden text-sm", children: [live ? (_jsx(TextShimmer, { duration: 1, spread: 2, className: "min-w-0 truncate text-sm", children: title })) : (_jsx("span", { className: "text-foreground min-w-0 truncate", children: title })), subtitle && (_jsx("span", { className: "text-muted-foreground min-w-0 flex-1 truncate", title: subtitle, children: subtitle })), status && _jsx(StatusMark, { status: status })] }));
55
60
  }
56
61
  const ROW_CLASS = 'flex min-w-0 items-center gap-2 rounded-sm px-2 py-1.5 text-xs';
57
62
  function CardRowLine({ row }) {
58
- const body = (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-foreground min-w-0 truncate font-medium", title: row.title, children: row.title }), row.detail ? (_jsx("span", { className: "text-muted-foreground min-w-0 flex-1 truncate", title: row.detail, children: row.detail })) : (_jsx("span", { className: "flex-1" })), row.badge && (_jsx(Badge, { variant: badgeVariant(row.badge), size: "sm", className: "shrink-0", children: row.badge })), row.href && _jsx(CaretRightIcon, { "aria-hidden": true, className: "text-muted-foreground size-3 shrink-0" })] }));
63
+ // A row titled with an agent handle (`@pricing-scout`) is an agent: its chip, as everywhere else.
64
+ const handle = row.title.startsWith('@') ? row.title.slice(1) : null;
65
+ const body = (_jsxs(_Fragment, { children: [handle ? (_jsx(AgentChip, { handle: handle, name: peerHandleLabel(handle).replace(/^@/, ''), className: "shrink" })) : (_jsx("span", { className: "text-foreground min-w-0 truncate font-medium", title: row.title, children: row.title })), row.detail ? (_jsx("span", { className: "text-muted-foreground min-w-0 flex-1 truncate", title: row.detail, children: row.detail })) : (_jsx("span", { className: "flex-1" })), row.badge &&
66
+ (badgeVariant(row.badge) === 'muted' ? (_jsx("span", { className: "text-muted-foreground shrink-0", children: row.badge })) : (_jsx(Badge, { variant: badgeVariant(row.badge), size: "sm", className: "shrink-0", children: row.badge }))), row.href && _jsx(CaretRightIcon, { "aria-hidden": true, className: "text-muted-foreground size-3 shrink-0" })] }));
59
67
  return row.href ? (_jsx(UiLink, { href: row.href, className: cn(ROW_CLASS, 'hover:bg-muted/40 transition-colors'), children: body })) : (_jsx("div", { className: ROW_CLASS, children: body }));
60
68
  }
61
69
  function ChangeLine({ change }) {
@@ -75,16 +83,19 @@ function DeniedNotice({ error }) {
75
83
  function CardLinks({ links }) {
76
84
  const t = useTranslations('tools.kortixAction');
77
85
  const indent = useToolIndent();
86
+ // In the side panel the links sit under the rows: start them on the rows' text edge.
87
+ const panel = useContext(ToolSurfaceContext) === 'panel';
78
88
  const external = links.filter((link) => link.external);
79
89
  const internal = links.filter((link) => !link.external);
80
90
  const internalButtons = internal.map((link) => (_jsx(Button, { asChild: true, variant: "outline", size: "xs", children: _jsx(UiLink, { href: link.href, children: link.label }) }, `${link.label}-${link.href}`)));
81
- return (_jsxs("div", { className: cn('flex flex-wrap items-center gap-1.5', indent && 'mt-1.5', indent), children: [external.map((link) => (_jsx(Button, { asChild: true, size: "xs", children: _jsxs("a", { href: link.href, target: "_blank", rel: "noopener noreferrer", title: t('opensInNewTab'), children: [link.label, _jsx(ArrowSquareOutIcon, { "aria-hidden": true, className: "size-3 shrink-0" })] }) }, `${link.label}-${link.href}`))), internalButtons.length > 1 ? _jsx(ButtonGroup, { children: internalButtons }) : internalButtons] }));
91
+ return (_jsxs("div", { className: cn('flex flex-wrap items-center gap-1.5', indent && 'mt-1.5', indent, panel && 'px-2'), children: [external.map((link) => (_jsx(Button, { asChild: true, size: "xs", children: _jsxs("a", { href: link.href, target: "_blank", rel: "noopener noreferrer", title: t('opensInNewTab'), children: [link.label, _jsx(ArrowSquareOutIcon, { "aria-hidden": true, className: "size-3 shrink-0" })] }) }, `${link.label}-${link.href}`))), internalButtons.length > 1 ? _jsx(ButtonGroup, { children: internalButtons }) : internalButtons] }));
82
92
  }
83
93
  /** The trigger subtitle while the row is closed; open, the body says it in full. */
84
94
  function SettledTrigger({ title, subtitle, subtitleInBody, status, }) {
85
95
  const open = useToolOpen();
86
96
  return (_jsx(CardTrigger, { title: title, subtitle: open && subtitleInBody ? undefined : subtitle, live: false, status: status }));
87
97
  }
98
+ /** Kortix platform calls (agents, sessions, access, connectors). In the side panel they are the same flat rows as every other call. */
88
99
  export function KortixActionTool(props) {
89
100
  const { call, defaultOpen, forceOpen, locked } = props;
90
101
  const t = useTranslations('tools.kortixAction');
@@ -120,7 +131,7 @@ export function KortixActionTool(props) {
120
131
  if (multi === 'send_message') {
121
132
  const send = parsePeerSend(result.data);
122
133
  if (send)
123
- return _jsx(PeerSendRow, { send: send, defaultOpen: defaultOpen, forceOpen: forceOpen, locked: locked });
134
+ return _jsx(PeerSendRow, { send: send, receiverId: peerReceiverId(result.data), defaultOpen: defaultOpen, forceOpen: forceOpen, locked: locked });
124
135
  }
125
136
  const denied = card.status === 'denied';
126
137
  // A multi-agent result draws its own body from `data`; the card's rows would say it twice.
@@ -16,13 +16,20 @@ export declare const AgentAvatarIcon: typeof AgentFace;
16
16
  * │ why it did not arrive, when it did not
17
17
  *
18
18
  * The state is a glyph and a muted word: a held message waits on a person, it did not fail.
19
+ * A delivered note to a colleague this session started reads Working while that colleague
20
+ * works on it: the note handed it work, and the row is where the person sees that. Only the
21
+ * note whose turn is still open does: a settled one sits in its turn's fold and keeps its state.
19
22
  */
20
- export declare function PeerSendRow({ send, defaultOpen, forceOpen, locked }: {
23
+ export declare function PeerSendRow({ send, receiverId, defaultOpen, forceOpen, locked, }: {
21
24
  send: PeerSendSummary;
25
+ /** The session the platform delivered the note to (`data.to.session_id`). */
26
+ receiverId?: string | null;
22
27
  defaultOpen?: boolean;
23
28
  forceOpen?: boolean;
24
29
  locked?: boolean;
25
30
  }): import("react").JSX.Element;
31
+ /** The session the platform delivered a note to (`data.to.session_id`), or null. */
32
+ export declare function peerReceiverId(data: unknown): string | null;
26
33
  /**
27
34
  * The body a multi-agent result draws from its `data`, or `null` when the data
28
35
  * does not parse or holds nothing to show (the card's own rows draw instead).
@@ -7,14 +7,19 @@ import { ToolResultCard } from '../shared/result-card.js';
7
7
  import { SubagentDialog } from '../../agents/subagent-view.js';
8
8
  import { useTranslations } from '../../../i18n/index.js';
9
9
  import { cn } from '../../../lib/utils.js';
10
- import { AgentStateMark } from '../../agents/agent-state-mark.js';
11
10
  import { subagentTitle } from '../../agents/agent-model.js';
12
11
  import { agentDisplayName } from '../../../internal/components/agent-mark.js';
13
- import { AgentFace, AgentHandle, AgentRowBody, AgentRowScope, AgentStatus, AgentTrigger, SmallGlyph, taskGlyphStatus } from '../../agents/agent-surface.js';
14
- import { BasicTool } from '../shared/infrastructure.js';
12
+ import { peerHandleLabel } from '../../../_vendor/kortix-shared.js';
13
+ import { AgentChip, AgentFace, AgentHandle, AgentRowBody, AgentRowScope, AgentStatus, AgentTrigger, SmallGlyph, taskGlyphStatus } from '../../agents/agent-surface.js';
14
+ import { BasicTool, ToolSurfaceContext } from '../shared/infrastructure.js';
15
15
  import { ArrowSquareOutIcon, ArrowUpRightIcon, ListChecksIcon, PaperPlaneTiltIcon, StopCircleIcon, UsersThreeIcon, } from '@phosphor-icons/react';
16
- import { useState } from 'react';
17
- import { parsePeerSend, parseReachable, parseStoppedChild, parseTasks, } from '@kortix/sdk';
16
+ import { useContext, useState } from 'react';
17
+ import { SolidCheckIcon } from '../../../internal/icons/solid-check-icon.js';
18
+ import { ToolStartedAtContext } from '../shared/infrastructure-contexts.js';
19
+ import { useSessionChildren } from '@kortix/sdk/react';
20
+ import { useSessionIds } from '../../../providers/session-ids.js';
21
+ import { WorkFoldContext } from '../../turn/turn-work-accordion.js';
22
+ import { sessionWorkState, parsePeerSend, parseReachable, parseStoppedChild, parseTasks, } from '@kortix/sdk';
18
23
  export const MULTI_AGENT_ICON = {
19
24
  send_message: PaperPlaneTiltIcon,
20
25
  list_agents: UsersThreeIcon,
@@ -62,6 +67,12 @@ const TASK_KEY = {
62
67
  const ROW_CLASS = 'flex min-w-0 items-center gap-2 rounded-sm px-2 py-1.5 text-xs';
63
68
  /** An agent's face as a tool row's 16px icon: its pixel mark on its own tile. */
64
69
  export const AgentAvatarIcon = AgentFace;
70
+ /** "To {to}" in any locale, split at the name: the words before it lead the chip, the words after it (Japanese "{to} へ") trail it. */
71
+ const TO_MARK = '\u0000';
72
+ function aroundName(sentence) {
73
+ const [lead = '', trail = ''] = sentence.split(TO_MARK);
74
+ return { lead: lead.trim(), trail: trail.trim() };
75
+ }
65
76
  /** The state a send ended in, as a session-list glyph: delivered is done, held waits on a person. */
66
77
  const PEER_GLYPH = {
67
78
  delivered: 'done',
@@ -79,13 +90,63 @@ const PEER_GLYPH = {
79
90
  * │ why it did not arrive, when it did not
80
91
  *
81
92
  * The state is a glyph and a muted word: a held message waits on a person, it did not fail.
93
+ * A delivered note to a colleague this session started reads Working while that colleague
94
+ * works on it: the note handed it work, and the row is where the person sees that. Only the
95
+ * note whose turn is still open does: a settled one sits in its turn's fold and keeps its state.
82
96
  */
83
- export function PeerSendRow({ send, defaultOpen, forceOpen, locked }) {
97
+ export function PeerSendRow({ send, receiverId, defaultOpen, forceOpen, locked, }) {
84
98
  const t = useTranslations('multiAgent.tools');
85
99
  const delivered = send.status === 'delivered';
100
+ const settled = useContext(WorkFoldContext);
101
+ const working = useColleagueWorking(delivered && !settled ? { handle: send.to, sessionId: receiverId ?? null } : null);
86
102
  const preview = send.summary || firstLineOf(send.message) || undefined;
87
103
  const hasBody = !!send.message || (!delivered && !!send.note);
88
- return (_jsx(AgentRowScope, { children: _jsx(BasicTool, { icon: send.to ? _jsx(AgentFace, { handle: send.to }) : undefined, trigger: _jsx(AgentTrigger, { title: send.to ? t('messageToName', { to: send.to }) : t('messageSent'), subtitle: preview }), triggerAction: _jsx(AgentStatus, { status: PEER_GLYPH[send.status], label: t(`peerStatus.${send.status}`), opens: hasBody }), defaultOpen: defaultOpen, forceOpen: forceOpen, locked: locked, children: hasBody ? (_jsxs(AgentRowBody, { children: [send.message && _jsx("p", { className: "text-foreground whitespace-pre-wrap wrap-break-word", children: send.message }), !delivered && send.note && _jsx("p", { className: "text-muted-foreground", children: send.note })] })) : undefined }) }));
104
+ // The side panel has the room for what happened to the message, in order.
105
+ if (useContext(ToolSurfaceContext) === 'panel') {
106
+ return _jsx(PeerSendTimeline, { send: send, working: working });
107
+ }
108
+ return (_jsx(AgentRowScope, { children: _jsx(BasicTool, { trigger: send.to ? (_jsx(AgentTrigger, { ...aroundName(t('messageToName', { to: TO_MARK })), handle: send.to, title: peerHandleLabel(send.to).replace(/^@/, ''), subtitle: preview, sessionId: receiverId })) : (_jsx(AgentTrigger, { title: t('messageSent'), subtitle: preview })), triggerAction: working ? (_jsx(AgentStatus, { status: "running", label: t('state.working'), opens: hasBody })) : (_jsx(AgentStatus, { status: PEER_GLYPH[send.status], label: t(`peerStatus.${send.status}`), opens: hasBody })), defaultOpen: defaultOpen, forceOpen: forceOpen, locked: locked, children: hasBody ? (_jsxs(AgentRowBody, { children: [send.message && _jsx("p", { className: "text-foreground whitespace-pre-wrap wrap-break-word", children: send.message }), !delivered && send.note && _jsx("p", { className: "text-muted-foreground", children: send.note })] })) : undefined }) }));
109
+ }
110
+ /**
111
+ * A sent message in the side panel, as a timeline (one rail, one node per
112
+ * event, the time on the right): who it went to and what it said, then what
113
+ * became of it — the receiver working on it, or the delivery state and the
114
+ * platform's note when it did not get through.
115
+ */
116
+ function PeerSendTimeline({ send, working }) {
117
+ const t = useTranslations('multiAgent.tools');
118
+ const startedAt = useContext(ToolStartedAtContext);
119
+ const clock = startedAt ? new Date(startedAt).toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' }) : null;
120
+ const delivered = send.status === 'delivered';
121
+ const { lead, trail } = aroundName(t('messageToName', { to: TO_MARK }));
122
+ const name = send.to ? peerHandleLabel(send.to).replace(/^@/, '') : null;
123
+ const title = send.summary || null;
124
+ const text = send.message && send.message !== title ? send.message : null;
125
+ return (_jsxs("ol", { className: "flex flex-col py-1", children: [_jsxs(TimelineNode, { glyph: _jsx(PaperPlaneTiltIcon, { className: "size-3.5" }), rail: true, children: [_jsxs("div", { className: "flex min-h-5 min-w-0 items-center gap-1.5 text-sm", children: [name ? (_jsxs(_Fragment, { children: [lead && _jsx("span", { className: "text-muted-foreground shrink-0", children: lead.trim() }), _jsx(AgentChip, { handle: send.to, name: name, plain: true, className: "max-w-none min-w-0 shrink" }), trail && _jsx("span", { className: "text-muted-foreground shrink-0", children: trail.trim() })] })) : (_jsx("span", { className: "text-muted-foreground", children: t('messageSent') })), clock && _jsx("span", { className: "text-muted-foreground ml-auto shrink-0 pl-2 text-xs tabular-nums", children: clock })] }), (title || text) && (_jsxs("div", { className: "bg-popover border-border mt-2 rounded-md border px-3 py-2.5 text-sm", children: [title && _jsx("p", { className: "text-foreground font-medium", children: title }), text && (_jsx("p", { className: cn('whitespace-pre-wrap wrap-break-word', title ? 'text-muted-foreground mt-1' : 'text-foreground'), children: text }))] }))] }), _jsxs(TimelineNode, { glyph: working ? (_jsx(SmallGlyph, { status: "running" })) : delivered ? (_jsx(SolidCheckIcon, { className: "size-3.5" })) : (_jsx(SmallGlyph, { status: PEER_GLYPH[send.status] })), children: [_jsx("div", { className: "flex min-h-5 items-center text-sm", children: _jsx("span", { className: "text-muted-foreground", children: working ? t('state.working') : t(`peerStatus.${send.status}`) }) }), !delivered && send.note && _jsx("p", { className: "text-muted-foreground mt-0.5 text-sm", children: send.note })] })] }));
126
+ }
127
+ /** One event on the rail: a 20px glyph node, the rail running down to the next node, the content beside it. */
128
+ function TimelineNode({ glyph, rail = false, children }) {
129
+ return (_jsxs("li", { className: cn('relative flex gap-3', rail && 'pb-4'), children: [rail && _jsx("span", { "aria-hidden": true, className: "bg-border absolute top-6 bottom-1 left-2.5 w-px" }), _jsx("span", { "aria-hidden": true, className: "text-muted-foreground flex size-5 shrink-0 items-center justify-center", children: glyph }), _jsx("div", { className: "min-w-0 flex-1", children: children })] }));
130
+ }
131
+ /**
132
+ * Whether the child of this session a note reached works now: by the session the note was
133
+ * delivered to, else by its handle (an unnamed child has none). Reads the child list the agents
134
+ * line under the composer polls (same query key), so the row adds no request of its own.
135
+ */
136
+ function useColleagueWorking(receiver) {
137
+ const ids = useSessionIds();
138
+ const ready = !!receiver && (!!receiver.handle || !!receiver.sessionId) && !!ids.projectId && !!ids.sessionId;
139
+ // The agents line's page size: the query key has no limit, so a smaller page would replace its list.
140
+ const { sessions } = useSessionChildren(ids.projectId ?? '', ids.sessionId ?? '', { enabled: ready, limit: 50 });
141
+ if (!ready)
142
+ return false;
143
+ return sessions.some((child) => (receiver.sessionId ? child.session_id === receiver.sessionId : child.agent_handle === receiver.handle) &&
144
+ sessionWorkState(child) === 'running');
145
+ }
146
+ /** The session the platform delivered a note to (`data.to.session_id`), or null. */
147
+ export function peerReceiverId(data) {
148
+ const id = data?.to?.session_id;
149
+ return typeof id === 'string' && id ? id : null;
89
150
  }
90
151
  function firstLineOf(text) {
91
152
  return text?.split('\n').find((line) => line.trim())?.trim() ?? '';
@@ -111,7 +172,11 @@ function AgentLine({ agent }) {
111
172
  .filter(Boolean)
112
173
  .join(' · ');
113
174
  const name = `@${agent.handle}`;
114
- return (_jsxs("li", { className: "group/row hover:bg-hover focus-within:bg-hover flex min-w-0 items-center gap-1 rounded-sm", "data-agent-row": agent.sessionId, children: [_jsxs("button", { type: "button", onClick: () => setViewing(true), className: "flex min-w-0 flex-1 cursor-pointer items-center gap-2 py-1.5 pl-2 text-left text-xs outline-none", children: [agent.state ? _jsx(AgentStateMark, { state: agent.state }) : _jsx("span", { "aria-hidden": true, className: "size-3 shrink-0" }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsxs("span", { className: "flex min-w-0 items-baseline gap-2", children: [_jsx("span", { className: "text-foreground min-w-0 truncate font-medium", children: name }), agent.state && (_jsx("span", { className: "text-muted-foreground shrink-0", children: t(`state.${STATE_KEY[agent.state]}`) }))] }), meta && (_jsx("span", { className: "text-muted-foreground block truncate", title: meta, children: meta }))] })] }), _jsx("div", { className: ROW_ACTIONS, children: _jsx(Hint, { label: tStrip('openAgent', { name }), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", "aria-label": tStrip('openAgent', { name }), onClick: () => setViewing(true), className: "text-muted-foreground hover:text-foreground", children: _jsx(ArrowUpRightIcon, { className: "size-3.5 shrink-0" }) }) }) }), _jsx(SubagentDialog, { open: viewing, onOpenChange: setViewing, sessionId: agent.sessionId, title: name })] }));
175
+ const label = peerHandleLabel(agent.handle).replace(/^@/, '');
176
+ const failed = agent.state === 'failed';
177
+ // The agent's mark and name, its state on the right edge, and what it works
178
+ // on below, on the name's edge. No tinted pill: the mark is the agent's face.
179
+ return (_jsxs("li", { className: "group/row hover:bg-hover focus-within:bg-hover flex min-w-0 items-start rounded-md", "data-agent-row": agent.sessionId, children: [_jsxs("button", { type: "button", onClick: () => setViewing(true), className: "flex min-w-0 flex-1 cursor-pointer flex-col gap-0.5 py-2 pl-1 text-left outline-none", children: [_jsxs("span", { className: "flex min-w-0 items-center gap-2", children: [_jsx(AgentChip, { handle: agent.handle, name: label, plain: true, className: "max-w-none min-w-0 shrink" }), _jsx("span", { className: "flex-1" }), agent.state && (_jsx("span", { className: cn('shrink-0 text-xs', failed ? 'text-kortix-red' : 'text-muted-foreground'), children: t(`state.${STATE_KEY[agent.state]}`) }))] }), meta && (_jsx("span", { className: "text-muted-foreground block truncate pl-5 text-xs", title: meta, children: meta }))] }), _jsx("div", { className: cn(ROW_ACTIONS, 'pt-1.5 pl-1'), children: _jsx(Hint, { label: tStrip('openAgent', { name: label }), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", "aria-label": tStrip('openAgent', { name }), onClick: () => setViewing(true), className: "text-muted-foreground hover:text-foreground", children: _jsx(ArrowUpRightIcon, { className: "size-3.5 shrink-0" }) }) }) }), _jsx(SubagentDialog, { open: viewing, onOpenChange: setViewing, sessionId: agent.sessionId, title: name })] }));
115
180
  }
116
181
  function TaskLine({ task }) {
117
182
  const t = useTranslations('multiAgent.tools');
@@ -137,13 +202,14 @@ export function multiAgentBody(tool, result) {
137
202
  switch (tool) {
138
203
  case 'send_message': {
139
204
  const send = parsePeerSend(result.data);
140
- return send ? _jsx(PeerSendRow, { send: send }) : null;
205
+ return send ? _jsx(PeerSendRow, { send: send, receiverId: peerReceiverId(result.data) }) : null;
141
206
  }
142
207
  case 'list_agents': {
143
208
  const agents = parseReachable(result.data);
144
209
  if (!agents || agents.length === 0)
145
210
  return null;
146
- return (_jsx(ToolResultCard, { bodyClassName: "p-1", children: _jsx("ul", { children: agents.map((agent) => (_jsx(AgentLine, { agent: agent }, agent.sessionId))) }) }));
211
+ // One list under the row, no card around it: each agent is a row of its own.
212
+ return (_jsx("ul", { className: "-mx-1 flex flex-col", children: agents.map((agent) => (_jsx(AgentLine, { agent: agent }, agent.sessionId))) }));
147
213
  }
148
214
  case 'task_create':
149
215
  case 'task_list':
@@ -11,7 +11,7 @@ import { useProjectSession, useSessionAsks, useSessionStateStore } from '@kortix
11
11
  import { agentDisplayName } from '../../../internal/components/agent-mark.js';
12
12
  import { useSessionIds } from '../../../providers/session-ids.js';
13
13
  import { agentRowOf } from '../../agents/agent-model.js';
14
- import { AgentFace, AgentFailure, AgentRowBody, AgentRowScope, AgentStatus, AgentTrigger, OpenAgentButton } from '../../agents/agent-surface.js';
14
+ import { AgentFailure, AgentRowBody, AgentRowScope, AgentStatus, AgentTrigger, OpenAgentButton } from '../../agents/agent-surface.js';
15
15
  /**
16
16
  * Whether a background hand-off's child still works. The child's status is
17
17
  * known while this tab streams it; without it, a child whose last reply has
@@ -52,7 +52,13 @@ export function TaskTool({ call, defaultOpen, forceOpen, locked }) {
52
52
  (typeof input.agent === 'string' && input.agent) ||
53
53
  (typeof input.agent === 'object' && input.agent !== null ? INLINE_AGENT : '') ||
54
54
  'general';
55
- const name = typeof input.name === 'string' ? input.name : '';
55
+ const name = typeof input.name === 'string' ? input.name.trim().replace(/^@/, '') : '';
56
+ // An inline spec names the role it plays (`agent.description`, "Neighborhood
57
+ // demand researcher"). It reads better than the word "Inline", which says
58
+ // how the child runs, not who it is.
59
+ const inlineRole = typeof input.agent === 'object' && input.agent !== null && typeof input.agent.description === 'string'
60
+ ? input.agent.description.trim()
61
+ : '';
56
62
  const description = useMemo(() => (typeof input.description === 'string' && input.description) ||
57
63
  firstMeaningfulLine(input.prompt) ||
58
64
  // Codex `spawn_agent`.
@@ -83,8 +89,14 @@ export function TaskTool({ call, defaultOpen, forceOpen, locked }) {
83
89
  ? 'needs_input'
84
90
  : (child?.state ?? (isRunning || (background && backgroundWorking) ? 'working' : status === 'completed' ? 'completed' : 'idle'));
85
91
  // The name its parent gave it (`agent({ name })`) reads best; else the kind of agent.
86
- const handle = name || (child?.named ? child.handle : '') || subagentType;
87
- const title = name || (child?.named ? child.handle : '') || agentDisplayName(subagentType);
92
+ const handle = name || (child?.named ? child.handle : '') || inlineRole || subagentType;
93
+ const title = name || (child?.named ? child.handle : '') || inlineRole || agentDisplayName(subagentType);
94
+ // A call that failed before its agent existed: "Didn't start", never "Didn't finish".
95
+ const failedBeforeStart = !!errorText && !childSessionId;
96
+ const subtitle = description;
97
+ const stateLabel = failedBeforeStart ? t('notStarted') : t(`state.${state}`);
98
+ const metaModel = partMetadata(call).model;
99
+ const callModel = typeof metaModel?.modelID === 'string' ? metaModel.modelID : null;
88
100
  // A row with a session opens it: beside the chat in the side panel, or as the agent
89
101
  // dialog where there is no panel. Its prompt, steps and answer are that session's
90
102
  // conversation, so the row carries no copy of them. A call that never got a
@@ -93,7 +105,7 @@ export function TaskTool({ call, defaultOpen, forceOpen, locked }) {
93
105
  const surface = useContext(ToolSurfaceContext);
94
106
  const opensAgent = !!childSessionId && surface !== 'panel';
95
107
  const hasBody = !opensAgent && (!!prompt || !!errorText || !!childSessionId);
96
- return (_jsxs(AgentRowScope, { children: [_jsx(BasicTool, { icon: _jsx(AgentFace, { handle: handle }), trigger: _jsx(AgentTrigger, { title: title, subtitle: description }), triggerAction: _jsx(AgentStatus, { status: STATE_GLYPH[state], label: t(`state.${state}`), opens: opensAgent || hasBody }), onClick: opensAgent ? () => setModalOpen(true) : undefined, defaultOpen: defaultOpen, forceOpen: forceOpen, locked: locked, children: hasBody ? (_jsxs(AgentRowBody, { children: [prompt && prompt !== description && (_jsx("p", { className: "text-muted-foreground line-clamp-4 whitespace-pre-wrap wrap-break-word", children: prompt })), errorText && _jsx(AgentFailure, { sentence: tNotice('failedSentence'), raw: errorText }), childSessionId && _jsx(OpenAgentButton, { label: t('openAgent', { name: description || title }), onClick: () => setModalOpen(true) })] })) : undefined }), _jsx(SubAgentStatusBanner, { childSessionId: childSessionId, childThread: childThread }), childSessionId && (_jsx(SubagentDialog, { open: modalOpen, onOpenChange: setModalOpen, sessionId: childSessionId, title: title, handle: handle, task: description || undefined, failure: errorText || undefined }))] }));
108
+ return (_jsxs(AgentRowScope, { children: [_jsx(BasicTool, { trigger: _jsx(AgentTrigger, { handle: handle, title: title, subtitle: subtitle, sessionId: childSessionId, detail: { state: stateLabel, task: description, model: callModel, note: failedBeforeStart ? t('notStartedSentence') : t('card.inline') } }), triggerAction: _jsx(AgentStatus, { status: STATE_GLYPH[state], label: stateLabel, opens: opensAgent || hasBody }), onClick: opensAgent ? () => setModalOpen(true) : undefined, defaultOpen: defaultOpen, forceOpen: forceOpen, locked: locked, children: hasBody ? (_jsxs(AgentRowBody, { children: [prompt && prompt !== description && (_jsx("p", { className: "text-muted-foreground line-clamp-4 whitespace-pre-wrap wrap-break-word", children: prompt })), errorText && _jsx(AgentFailure, { sentence: failedBeforeStart ? t('notStartedSentence') : tNotice('failedSentence'), raw: errorText }), childSessionId && _jsx(OpenAgentButton, { label: t('openAgent', { name: description || title }), onClick: () => setModalOpen(true) })] })) : undefined }), _jsx(SubAgentStatusBanner, { childSessionId: childSessionId, childThread: childThread }), childSessionId && (_jsx(SubagentDialog, { open: modalOpen, onOpenChange: setModalOpen, sessionId: childSessionId, title: title, handle: handle, task: description || undefined, failure: errorText || undefined }))] }));
97
109
  }
98
110
  /** The agent name an inline agent spec's child runs under (pi `INLINE_AGENT`). */
99
111
  const INLINE_AGENT = 'inline';
@@ -11,6 +11,9 @@ import type { PeerMessagePromptInfo } from '../../_vendor/shared/index.js';
11
11
  *
12
12
  * An idle notice says only that a teammate finished: one row like an agent's
13
13
  * finish, that opens to the rest. A shutdown request and its answer say so on the right.
14
+ *
15
+ * Under a "Worked for" row every message is one closed line: the answer next to
16
+ * it already says what it means, and the full text would say it twice.
14
17
  */
15
18
  /** An idle notice's text without the line that repeats the state, and its answer without the "Its last answer:" label. */
16
19
  export declare function idleNoticeBody(text: string): string;
@@ -4,8 +4,10 @@ import { peerMessagePreview } from '@kortix/sdk';
4
4
  import { peerHandleLabel } from '../../_vendor/kortix-shared.js';
5
5
  import { useTranslations } from '../../i18n/index.js';
6
6
  import { UnifiedMarkdown } from '../../markdown/unified-markdown.js';
7
- import { AgentFace, AgentRowBody, AgentRowScope, AgentStatus, AgentTrigger } from '../agents/agent-surface.js';
7
+ import { AgentRowBody, AgentRowScope, AgentStatus, AgentTrigger } from '../agents/agent-surface.js';
8
8
  import { BasicTool } from '../tool/shared/infrastructure.js';
9
+ import { WorkFoldContext } from './turn-work-accordion.js';
10
+ import { useContext } from 'react';
9
11
  /**
10
12
  * A message another Kortix session sent this one (`send_message`). Nobody here
11
13
  * typed it, so it is never a bubble: it is an agent row, the sender's face and
@@ -18,6 +20,9 @@ import { BasicTool } from '../tool/shared/infrastructure.js';
18
20
  *
19
21
  * An idle notice says only that a teammate finished: one row like an agent's
20
22
  * finish, that opens to the rest. A shutdown request and its answer say so on the right.
23
+ *
24
+ * Under a "Worked for" row every message is one closed line: the answer next to
25
+ * it already says what it means, and the full text would say it twice.
21
26
  */
22
27
  /** An idle notice's text without the line that repeats the state, and its answer without the "Its last answer:" label. */
23
28
  export function idleNoticeBody(text) {
@@ -31,6 +36,7 @@ export function idleNoticeBody(text) {
31
36
  }
32
37
  export function PeerMessageRow({ info, actions }) {
33
38
  const t = useTranslations('multiAgent.peer');
39
+ const inFold = useContext(WorkFoldContext);
34
40
  const from = info.from;
35
41
  const name = peerHandleLabel(from).replace(/^@/, '');
36
42
  const idle = info.kind === 'idle_notice';
@@ -45,5 +51,5 @@ export function PeerMessageRow({ info, actions }) {
45
51
  : idle
46
52
  ? t('kind.finished')
47
53
  : t('kind.message');
48
- return (_jsxs("div", { "data-testid": "peer-message-turn", "data-peer-kind": info.kind, "data-peer-message-id": info.messageId, className: "flex min-w-0 flex-col gap-1", children: [_jsx(AgentRowScope, { children: _jsx(BasicTool, { icon: _jsx(AgentFace, { handle: from }), trigger: _jsx(AgentTrigger, { title: name, subtitle: idle ? preview : info.summary?.trim() }), triggerAction: _jsx(AgentStatus, { status: idle ? 'done' : undefined, label: kindWord, opens: !!body }), defaultOpen: !idle, children: body ? (_jsx(AgentRowBody, { children: _jsx("div", { "data-slot": "peer-message-body", className: "min-w-0", children: _jsx(UnifiedMarkdown, { content: body, trust: "agent", isStreaming: false, lineBreaks: "chat" }) }) })) : undefined }) }), actions] }));
54
+ return (_jsxs("div", { "data-testid": "peer-message-turn", "data-peer-kind": info.kind, "data-peer-message-id": info.messageId, className: "flex min-w-0 flex-col gap-1", children: [_jsx(AgentRowScope, { children: _jsx(BasicTool, { trigger: _jsx(AgentTrigger, { handle: from, title: name, subtitle: idle ? preview : info.summary?.trim() }), triggerAction: _jsx(AgentStatus, { status: idle ? 'done' : undefined, label: kindWord, opens: !!body }), defaultOpen: !idle && !inFold, children: body ? (_jsx(AgentRowBody, { children: _jsx("div", { "data-slot": "peer-message-body", className: "min-w-0", children: _jsx(UnifiedMarkdown, { content: body, trust: "agent", isStreaming: false, lineBreaks: "chat" }) }) })) : undefined }) }), actions] }));
49
55
  }
@@ -7,7 +7,7 @@ import { useTranslations } from '../../i18n/index.js';
7
7
  import { agentDisplayName } from '../../internal/components/agent-mark.js';
8
8
  import { useSessionIds } from '../../providers/session-ids.js';
9
9
  import { SubagentDialog } from '../agents/subagent-view.js';
10
- import { AgentFace, AgentRowScope, AgentStatus, AgentTrigger } from '../agents/agent-surface.js';
10
+ import { AgentRowScope, AgentStatus, AgentTrigger } from '../agents/agent-surface.js';
11
11
  import { BasicTool } from '../tool/shared/infrastructure.js';
12
12
  import { firstLine } from './subagent-notice.js';
13
13
  /** A workflow's report arrives wrapped in `<workflow_result>`: the person reads what is inside. */
@@ -25,6 +25,8 @@ export const NOTICE_GLYPH = {
25
25
  };
26
26
  /** A first line that only says it is done repeats the state word. */
27
27
  const ONLY_DONE = /^(done|finished|completed?|all done|ok(ay)?)[.!]*$/i;
28
+ /** A sandbox path in a one-line summary reads as its file name: `/workspace/out/review.md` → `review.md`. */
29
+ const SANDBOX_PATH = /\/workspace\/(?:[\w.-]+\/)*([\w.-]+)/g;
28
30
  /** Who the notice is from: the handle its parent gave it, else the kind of agent, else the task. */
29
31
  function useNoticeName(notice) {
30
32
  const t = useTranslations('multiAgent.notice');
@@ -50,7 +52,7 @@ export function SubagentNoticeRow({ notice }) {
50
52
  const [viewing, setViewing] = useState(false);
51
53
  const failed = notice.status === 'failed';
52
54
  const result = readableReport(notice.result);
53
- const first = firstLine(result);
55
+ const first = firstLine(result)?.replace(SANDBOX_PATH, '$1');
54
56
  const subtitle = notice.ownedTasks
55
57
  ? t('ownsTasks', { tasks: notice.ownedTasks })
56
58
  : failed
@@ -58,5 +60,5 @@ export function SubagentNoticeRow({ notice }) {
58
60
  : first && !ONLY_DONE.test(first)
59
61
  ? first
60
62
  : (notice.title ?? undefined);
61
- return (_jsxs("div", { "data-testid": "subagent-notice", "data-notice-status": notice.status, "data-child-session": notice.sessionId, className: "min-w-0", children: [_jsx(AgentRowScope, { children: _jsx(BasicTool, { icon: _jsx(AgentFace, { handle: face }), trigger: _jsx(AgentTrigger, { title: name, subtitle: subtitle }), triggerAction: _jsx(AgentStatus, { status: NOTICE_GLYPH[notice.status], label: t(`state.${notice.status}`), opens: true }), onClick: () => setViewing(true) }) }), _jsx(SubagentDialog, { open: viewing, onOpenChange: setViewing, sessionId: notice.sessionId, title: name, handle: face, task: subtitle, failure: failed ? result || t('failedSentence') : undefined })] }));
63
+ return (_jsxs("div", { "data-testid": "subagent-notice", "data-notice-status": notice.status, "data-child-session": notice.sessionId, className: "min-w-0", children: [_jsx(AgentRowScope, { children: _jsx(BasicTool, { trigger: _jsx(AgentTrigger, { handle: face, title: name, subtitle: subtitle, sessionId: notice.sessionId }), triggerAction: _jsx(AgentStatus, { status: NOTICE_GLYPH[notice.status], label: t(`state.${notice.status}`), opens: true }), onClick: () => setViewing(true) }) }), _jsx(SubagentDialog, { open: viewing, onOpenChange: setViewing, sessionId: notice.sessionId, title: name, handle: face, task: subtitle, failure: failed ? result || t('failedSentence') : undefined })] }));
62
64
  }