@kortix/ui 0.16.4 → 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.
- package/dist/customize/sections/view/review-center-connected.js +64 -71
- package/dist/customize/sections/view/secret-delivery.d.ts +11 -20
- package/dist/customize/sections/view/secret-delivery.js +20 -29
- package/dist/customize/sections/view/secrets-view.js +9 -24
- package/dist/i18n/en.d.ts +116 -13
- package/dist/i18n/en.js +127 -24
- package/dist/i18n/ui-catalog/product-catalog-translation-keys.generated.js +2 -0
- package/dist/internal/auth/auth-card-shell.d.ts +24 -3
- package/dist/internal/auth/auth-card-shell.js +15 -8
- package/dist/internal/auth/auth-primitives.d.ts +15 -2
- package/dist/internal/auth/auth-primitives.js +22 -5
- package/dist/internal/components/agent-mark.d.ts +2 -1
- package/dist/internal/components/agent-mark.js +14 -3
- package/dist/internal/hooks/use-review-session-summary.d.ts +1 -1
- package/dist/internal/hooks/use-review-session-summary.js +1 -1
- package/dist/internal/layout/project-nav-row.d.ts +3 -1
- package/dist/internal/layout/project-nav-row.js +2 -2
- package/dist/markdown/setup-links/secret-intake-form.d.ts +4 -1
- package/dist/markdown/setup-links/secret-intake-form.js +60 -16
- package/dist/markdown/setup-links/setup-link-button.js +6 -1
- package/dist/session/agents/agent-hover-card.d.ts +26 -0
- package/dist/session/agents/agent-hover-card.js +70 -0
- package/dist/session/agents/agent-strip.js +33 -7
- package/dist/session/agents/agent-surface.d.ts +26 -1
- package/dist/session/agents/agent-surface.js +57 -6
- package/dist/session/agents/held-messages.js +2 -2
- package/dist/session/agents/subagent-dialog-content.js +2 -2
- package/dist/session/composer/ComposerCard.js +4 -1
- package/dist/session/composer/composer-toolbar.d.ts +8 -1
- package/dist/session/composer/composer-toolbar.js +2 -2
- package/dist/session/composer/dictation/dictation-control.d.ts +10 -0
- package/dist/session/composer/dictation/dictation-control.js +28 -0
- package/dist/session/composer/dictation/dictation-state.d.ts +26 -0
- package/dist/session/composer/dictation/dictation-state.js +71 -0
- package/dist/session/composer/dictation/recorder.d.ts +30 -0
- package/dist/session/composer/dictation/recorder.js +129 -0
- package/dist/session/composer/dictation/use-composer-dictation.d.ts +25 -0
- package/dist/session/composer/dictation/use-composer-dictation.js +218 -0
- package/dist/session/composer/queued-prompt-list.js +5 -1
- package/dist/session/panel/easy/apps-card.js +3 -10
- package/dist/session/panel/easy/background-tasks-card.d.ts +23 -0
- package/dist/session/panel/easy/background-tasks-card.js +119 -0
- package/dist/session/panel/easy/change-requests-card.js +1 -1
- package/dist/session/panel/easy/changes-card.js +4 -6
- package/dist/session/panel/easy/context-card.js +8 -9
- package/dist/session/panel/easy/context-meter.d.ts +2 -0
- package/dist/session/panel/easy/context-meter.js +18 -4
- package/dist/session/panel/easy/detail-view.js +4 -2
- package/dist/session/panel/easy/easy-panel-logic.d.ts +4 -15
- package/dist/session/panel/easy/easy-panel-logic.js +4 -17
- package/dist/session/panel/easy/easy-panel.js +5 -4
- package/dist/session/panel/easy/outputs-card.d.ts +1 -13
- package/dist/session/panel/easy/outputs-card.js +14 -40
- package/dist/session/panel/easy/panel-card.d.ts +13 -40
- package/dist/session/panel/easy/panel-card.js +17 -55
- package/dist/session/panel/easy/plan-card.js +4 -7
- package/dist/session/panel/model-switch-event.d.ts +2 -2
- package/dist/session/panel/model-switch-event.js +13 -9
- package/dist/session/panel/session-panel-provider.d.ts +2 -1
- package/dist/session/panel/session-panel-provider.js +3 -3
- package/dist/session/panel/shared/derive-panels.js +14 -1
- package/dist/session/panel/shared/use-panel-handoffs.d.ts +0 -1
- package/dist/session/panel/shared/use-panel-handoffs.js +3 -15
- package/dist/session/thread/chat-minimap.js +7 -1
- package/dist/session/thread/session-chat.js +59 -15
- package/dist/session/tool/shared/infrastructure-contexts.d.ts +2 -0
- package/dist/session/tool/shared/infrastructure-contexts.js +2 -0
- package/dist/session/tool/shared/infrastructure-row-header.js +4 -1
- package/dist/session/tool/shared/infrastructure-rows.js +19 -19
- package/dist/session/tool/tool-part-renderer.js +23 -9
- package/dist/session/tool/tools/bash-tool.js +3 -2
- package/dist/session/tool/tools/codemode-tool.d.ts +15 -0
- package/dist/session/tool/tools/codemode-tool.js +54 -2
- package/dist/session/tool/tools/kortix-action-tool.d.ts +1 -0
- package/dist/session/tool/tools/kortix-action-tool.js +19 -8
- package/dist/session/tool/tools/multi-agent-tool-bodies.d.ts +8 -1
- package/dist/session/tool/tools/multi-agent-tool-bodies.js +76 -10
- package/dist/session/tool/tools/task-tool.js +17 -5
- package/dist/session/turn/peer-message-row.d.ts +3 -0
- package/dist/session/turn/peer-message-row.js +8 -2
- package/dist/session/turn/subagent-notice-row.js +5 -3
- package/dist/styles.css +1 -1
- package/dist/test-utils/intl.d.ts +116 -13
- package/dist/workspace/projects/modal/project-icon-field.d.ts +3 -1
- package/dist/workspace/projects/modal/project-icon-field.js +3 -3
- package/dist/workspace/review/review-center.d.ts +9 -1
- package/dist/workspace/review/review-center.js +107 -14
- package/dist/workspace/review/review-detail.d.ts +19 -0
- package/dist/workspace/review/review-detail.js +18 -3
- package/dist/workspace/review/review-swipe-deck.d.ts +27 -0
- package/dist/workspace/review/review-swipe-deck.js +304 -0
- package/dist/workspace/review/review-swipe.d.ts +17 -0
- package/dist/workspace/review/review-swipe.js +10 -0
- package/dist/workspace/sidebar/footer/project-review-nav.d.ts +13 -0
- package/dist/workspace/sidebar/footer/project-review-nav.js +29 -0
- package/dist/workspace/sidebar/project-nav-items.d.ts +3 -1
- package/dist/workspace/sidebar/project-nav-items.js +24 -5
- package/dist/workspace/sidebar/project-spaces-nav.js +3 -10
- package/dist/workspace/sidebar/sidebar-more-group.js +1 -1
- package/package.json +3 -3
|
@@ -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,
|
|
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 {
|
|
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' ? (
|
|
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",
|
|
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
|
-
|
|
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 {
|
|
14
|
-
import {
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
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, {
|
|
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 {
|
|
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, {
|
|
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 {
|
|
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, {
|
|
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
|
}
|