@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.
Files changed (100) hide show
  1. package/dist/customize/sections/view/review-center-connected.js +64 -71
  2. package/dist/customize/sections/view/secret-delivery.d.ts +11 -20
  3. package/dist/customize/sections/view/secret-delivery.js +20 -29
  4. package/dist/customize/sections/view/secrets-view.js +9 -24
  5. package/dist/i18n/en.d.ts +116 -13
  6. package/dist/i18n/en.js +127 -24
  7. package/dist/i18n/ui-catalog/product-catalog-translation-keys.generated.js +2 -0
  8. package/dist/internal/auth/auth-card-shell.d.ts +24 -3
  9. package/dist/internal/auth/auth-card-shell.js +15 -8
  10. package/dist/internal/auth/auth-primitives.d.ts +15 -2
  11. package/dist/internal/auth/auth-primitives.js +22 -5
  12. package/dist/internal/components/agent-mark.d.ts +2 -1
  13. package/dist/internal/components/agent-mark.js +14 -3
  14. package/dist/internal/hooks/use-review-session-summary.d.ts +1 -1
  15. package/dist/internal/hooks/use-review-session-summary.js +1 -1
  16. package/dist/internal/layout/project-nav-row.d.ts +3 -1
  17. package/dist/internal/layout/project-nav-row.js +2 -2
  18. package/dist/markdown/setup-links/secret-intake-form.d.ts +4 -1
  19. package/dist/markdown/setup-links/secret-intake-form.js +60 -16
  20. package/dist/markdown/setup-links/setup-link-button.js +6 -1
  21. package/dist/session/agents/agent-hover-card.d.ts +26 -0
  22. package/dist/session/agents/agent-hover-card.js +70 -0
  23. package/dist/session/agents/agent-strip.js +33 -7
  24. package/dist/session/agents/agent-surface.d.ts +26 -1
  25. package/dist/session/agents/agent-surface.js +57 -6
  26. package/dist/session/agents/held-messages.js +2 -2
  27. package/dist/session/agents/subagent-dialog-content.js +2 -2
  28. package/dist/session/composer/ComposerCard.js +4 -1
  29. package/dist/session/composer/composer-toolbar.d.ts +8 -1
  30. package/dist/session/composer/composer-toolbar.js +2 -2
  31. package/dist/session/composer/dictation/dictation-control.d.ts +10 -0
  32. package/dist/session/composer/dictation/dictation-control.js +28 -0
  33. package/dist/session/composer/dictation/dictation-state.d.ts +26 -0
  34. package/dist/session/composer/dictation/dictation-state.js +71 -0
  35. package/dist/session/composer/dictation/recorder.d.ts +30 -0
  36. package/dist/session/composer/dictation/recorder.js +129 -0
  37. package/dist/session/composer/dictation/use-composer-dictation.d.ts +25 -0
  38. package/dist/session/composer/dictation/use-composer-dictation.js +218 -0
  39. package/dist/session/composer/queued-prompt-list.js +5 -1
  40. package/dist/session/panel/easy/apps-card.js +3 -10
  41. package/dist/session/panel/easy/background-tasks-card.d.ts +23 -0
  42. package/dist/session/panel/easy/background-tasks-card.js +119 -0
  43. package/dist/session/panel/easy/change-requests-card.js +1 -1
  44. package/dist/session/panel/easy/changes-card.js +4 -6
  45. package/dist/session/panel/easy/context-card.js +8 -9
  46. package/dist/session/panel/easy/context-meter.d.ts +2 -0
  47. package/dist/session/panel/easy/context-meter.js +18 -4
  48. package/dist/session/panel/easy/detail-view.js +4 -2
  49. package/dist/session/panel/easy/easy-panel-logic.d.ts +4 -15
  50. package/dist/session/panel/easy/easy-panel-logic.js +4 -17
  51. package/dist/session/panel/easy/easy-panel.js +5 -4
  52. package/dist/session/panel/easy/outputs-card.d.ts +1 -13
  53. package/dist/session/panel/easy/outputs-card.js +14 -40
  54. package/dist/session/panel/easy/panel-card.d.ts +13 -40
  55. package/dist/session/panel/easy/panel-card.js +17 -55
  56. package/dist/session/panel/easy/plan-card.js +4 -7
  57. package/dist/session/panel/model-switch-event.d.ts +2 -2
  58. package/dist/session/panel/model-switch-event.js +13 -9
  59. package/dist/session/panel/session-panel-provider.d.ts +2 -1
  60. package/dist/session/panel/session-panel-provider.js +3 -3
  61. package/dist/session/panel/shared/derive-panels.js +14 -1
  62. package/dist/session/panel/shared/use-panel-handoffs.d.ts +0 -1
  63. package/dist/session/panel/shared/use-panel-handoffs.js +3 -15
  64. package/dist/session/thread/chat-minimap.js +7 -1
  65. package/dist/session/thread/session-chat.js +59 -15
  66. package/dist/session/tool/shared/infrastructure-contexts.d.ts +2 -0
  67. package/dist/session/tool/shared/infrastructure-contexts.js +2 -0
  68. package/dist/session/tool/shared/infrastructure-row-header.js +4 -1
  69. package/dist/session/tool/shared/infrastructure-rows.js +19 -19
  70. package/dist/session/tool/tool-part-renderer.js +23 -9
  71. package/dist/session/tool/tools/bash-tool.js +3 -2
  72. package/dist/session/tool/tools/codemode-tool.d.ts +15 -0
  73. package/dist/session/tool/tools/codemode-tool.js +54 -2
  74. package/dist/session/tool/tools/kortix-action-tool.d.ts +1 -0
  75. package/dist/session/tool/tools/kortix-action-tool.js +19 -8
  76. package/dist/session/tool/tools/multi-agent-tool-bodies.d.ts +8 -1
  77. package/dist/session/tool/tools/multi-agent-tool-bodies.js +76 -10
  78. package/dist/session/tool/tools/task-tool.js +17 -5
  79. package/dist/session/turn/peer-message-row.d.ts +3 -0
  80. package/dist/session/turn/peer-message-row.js +8 -2
  81. package/dist/session/turn/subagent-notice-row.js +5 -3
  82. package/dist/styles.css +1 -1
  83. package/dist/test-utils/intl.d.ts +116 -13
  84. package/dist/workspace/projects/modal/project-icon-field.d.ts +3 -1
  85. package/dist/workspace/projects/modal/project-icon-field.js +3 -3
  86. package/dist/workspace/review/review-center.d.ts +9 -1
  87. package/dist/workspace/review/review-center.js +107 -14
  88. package/dist/workspace/review/review-detail.d.ts +19 -0
  89. package/dist/workspace/review/review-detail.js +18 -3
  90. package/dist/workspace/review/review-swipe-deck.d.ts +27 -0
  91. package/dist/workspace/review/review-swipe-deck.js +304 -0
  92. package/dist/workspace/review/review-swipe.d.ts +17 -0
  93. package/dist/workspace/review/review-swipe.js +10 -0
  94. package/dist/workspace/sidebar/footer/project-review-nav.d.ts +13 -0
  95. package/dist/workspace/sidebar/footer/project-review-nav.js +29 -0
  96. package/dist/workspace/sidebar/project-nav-items.d.ts +3 -1
  97. package/dist/workspace/sidebar/project-nav-items.js +24 -5
  98. package/dist/workspace/sidebar/project-spaces-nav.js +3 -10
  99. package/dist/workspace/sidebar/sidebar-more-group.js +1 -1
  100. package/package.json +3 -3
@@ -1,5 +1,14 @@
1
1
  /** @internal Kortix apps only. No semver: it may change in any release. */
2
2
  export declare const AUTH_EASE: readonly [0.23, 1, 0.32, 1];
3
+ /**
4
+ * What the enclosing AuthFrame tells the steps inside it: whether the column
5
+ * is centered, and the mark a header shows by default. Every step header and
6
+ * quiet-link row in a centered frame lines up without per-step props.
7
+ */
8
+ export declare const AuthFrameContext: import("react").Context<{
9
+ centered: boolean;
10
+ mark?: React.ReactNode;
11
+ }>;
3
12
  /** Gentle entrance: header first, body ~60ms behind. Opacity-only under reduced motion. */
4
13
  export declare function Rise({ delay, className, children, }: {
5
14
  delay?: number;
@@ -23,7 +32,7 @@ export declare function Rise({ delay, className, children, }: {
23
32
  * traffic lights and the frame's Back control.
24
33
  */
25
34
  export declare function AuthMobileLogo(): import("react").JSX.Element;
26
- export declare function StepHeader({ title, description, mark, markOnMobile, }: {
35
+ export declare function StepHeader({ title, description, mark: markProp, markOnMobile, align: alignProp, }: {
27
36
  /** A string, or a string led by a status mark (a decided approval). */
28
37
  title: React.ReactNode;
29
38
  /**
@@ -36,6 +45,8 @@ export declare function StepHeader({ title, description, mark, markOnMobile, }:
36
45
  * where no corner logo stands in for it on mobile. */
37
46
  markOnMobile?: boolean;
38
47
  description?: React.ReactNode;
48
+ /** `center` centers the mark, title and description on one axis. */
49
+ align?: 'start' | 'center';
39
50
  }): import("react").JSX.Element;
40
51
  /** "or" between a provider button and the email form. */
41
52
  export declare function OrDivider({ label }: {
@@ -55,10 +66,12 @@ export type QuietLink = {
55
66
  * middots ("Use a password · Use SSO"). Falsy entries drop out; an empty row
56
67
  * renders nothing.
57
68
  */
58
- export declare function QuietLinks({ links, disabled, className, }: {
69
+ export declare function QuietLinks({ links, disabled, className, align: alignProp, }: {
59
70
  links: Array<QuietLink | null | false | undefined>;
60
71
  disabled?: boolean;
61
72
  className?: string;
73
+ /** `center` centers the row and drops the lead middot instead of clipping it. */
74
+ align?: 'start' | 'center';
62
75
  }): import("react").JSX.Element | null;
63
76
  export declare function FieldLabel({ htmlFor, children }: {
64
77
  htmlFor: string;
@@ -7,7 +7,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
7
7
  */
8
8
  import { WarningIcon as DangerTriangleSolid, InfoIcon as InfoCircleSolid, } from '@phosphor-icons/react';
9
9
  import { m, useReducedMotion } from 'motion/react';
10
- import { useEffect, useRef } from 'react';
10
+ import { createContext, useContext, useEffect, useRef } from 'react';
11
11
  import { inputFocusClasses, inputSurfaceClasses } from '../../primitives/input.js';
12
12
  import { KortixLogo } from '../../primitives/kortix-logo.js';
13
13
  import { Button } from '../../primitives/button.js';
@@ -17,6 +17,14 @@ import { useTranslations } from '../../i18n/index.js';
17
17
  import { cn } from '../lib/utils.js';
18
18
  import { UiLink as Link } from '../../providers/ui-provider.js';
19
19
  export const AUTH_EASE = [0.23, 1, 0.32, 1];
20
+ /**
21
+ * What the enclosing AuthFrame tells the steps inside it: whether the column
22
+ * is centered, and the mark a header shows by default. Every step header and
23
+ * quiet-link row in a centered frame lines up without per-step props.
24
+ */
25
+ export const AuthFrameContext = createContext({
26
+ centered: false,
27
+ });
20
28
  /** Gentle entrance: header first, body ~60ms behind. Opacity-only under reduced motion. */
21
29
  export function Rise({ delay = 0, className, children, }) {
22
30
  const prefersReducedMotion = useReducedMotion();
@@ -43,8 +51,13 @@ export function AuthMobileLogo() {
43
51
  const tHardcodedUi = useTranslations('hardcodedUi');
44
52
  return (_jsx("div", { className: "kx-auth-mobile-logo absolute top-6 left-6 z-10 md:hidden", children: _jsx(Link, { href: "/", "aria-label": tHardcodedUi.raw('i18nComplete.text7ecec93ed268'), className: "hit-area-3 inline-flex", children: _jsx(KortixLogo, { variant: "icon", size: 22, className: "text-foreground" }) }) }));
45
53
  }
46
- export function StepHeader({ title, description, mark, markOnMobile = false, }) {
47
- return (_jsxs("div", { className: "mb-8", children: [mark ? (_jsx("div", { className: markOnMobile ? undefined : 'hidden md:block', children: mark })) : (_jsx(KortixLogo, { variant: "icon", size: 22, className: "text-foreground hidden md:block" })), _jsx("h1", { className: cn('text-foreground text-2xl font-semibold tracking-tight text-balance md:mt-6', mark && markOnMobile && 'mt-6'), children: title }), description ? (_jsx("p", { className: "text-muted-foreground mt-2 text-sm text-pretty", children: description })) : null] }));
54
+ export function StepHeader({ title, description, mark: markProp, markOnMobile = false, align: alignProp, }) {
55
+ const frame = useContext(AuthFrameContext);
56
+ const align = alignProp ?? (frame.centered ? 'center' : 'start');
57
+ const mark = markProp ?? frame.mark;
58
+ return (_jsxs("div", { className: cn('mb-8', align === 'center' && 'text-center'), children: [mark ? (_jsx("div", { className: cn(markOnMobile ? 'block' : 'hidden md:block', align === 'center' && (markOnMobile ? 'flex justify-center' : 'md:flex md:justify-center')), children: mark })) : (_jsx(KortixLogo, { variant: "icon", size: 22, className: cn('text-foreground hidden md:block', align === 'center' && 'md:mx-auto') })), _jsx("h1", { className: cn('text-foreground text-2xl tracking-tight text-balance md:mt-6',
59
+ // The sign-in frame sets its headings in medium; other screens keep semibold.
60
+ frame.centered ? 'font-medium' : 'font-semibold', mark && markOnMobile && 'mt-6'), children: title }), description ? (_jsx("p", { className: "text-muted-foreground mt-2 text-sm text-pretty", children: description })) : null] }));
48
61
  }
49
62
  /** "or" between a provider button and the email form. */
50
63
  export function OrDivider({ label }) {
@@ -55,14 +68,18 @@ export function OrDivider({ label }) {
55
68
  * middots ("Use a password · Use SSO"). Falsy entries drop out; an empty row
56
69
  * renders nothing.
57
70
  */
58
- export function QuietLinks({ links, disabled = false, className, }) {
71
+ export function QuietLinks({ links, disabled = false, className, align: alignProp, }) {
72
+ const frame = useContext(AuthFrameContext);
73
+ const align = alignProp ?? (frame.centered ? 'center' : 'start');
59
74
  const shown = links.filter(Boolean);
60
75
  if (shown.length === 0)
61
76
  return null;
62
77
  // Every entry leads with its middot, and the row is pulled left by one
63
78
  // middot's width and clipped: an entry that wraps to a new line starts
64
79
  // clean, with no dot in front of it.
65
- return (_jsx("div", { className: cn('text-muted-foreground mt-5 overflow-x-clip text-sm', className), children: _jsx("p", { className: "-ml-4 flex flex-wrap items-center gap-x-2", children: shown.map((link) => (_jsxs("span", { className: "flex items-center gap-x-2 whitespace-nowrap", children: [_jsx("span", { "aria-hidden": true, className: "w-2 text-center select-none", children: "\u00B7" }), link.onClick ? (_jsx("button", { type: "button", onClick: link.onClick, disabled: disabled || link.disabled, className: "hover:text-foreground -my-2 py-2 transition-colors disabled:opacity-50", children: link.label })) : (_jsx("span", { className: "tabular-nums", children: link.label })), link.hint ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": true, className: "select-none", children: "\u00B7" }), _jsx("span", { className: "tabular-nums", children: link.hint })] })) : null] }, link.key))) }) }));
80
+ return (_jsx("div", { className: cn('text-muted-foreground mt-5 overflow-x-clip text-sm', className), children: _jsx("p", { className: cn('flex flex-wrap items-center gap-x-2', align === 'center'
81
+ ? 'justify-center [&>span:first-child>span:first-child]:hidden'
82
+ : '-ml-4'), children: shown.map((link) => (_jsxs("span", { className: "flex items-center gap-x-2 whitespace-nowrap", children: [_jsx("span", { "aria-hidden": true, className: "w-2 text-center select-none", children: "\u00B7" }), link.onClick ? (_jsx("button", { type: "button", onClick: link.onClick, disabled: disabled || link.disabled, className: "hover:text-foreground -my-2 py-2 transition-colors disabled:opacity-50", children: link.label })) : (_jsx("span", { className: "tabular-nums", children: link.label })), link.hint ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": true, className: "select-none", children: "\u00B7" }), _jsx("span", { className: "tabular-nums", children: link.hint })] })) : null] }, link.key))) }) }));
66
83
  }
67
84
  export function FieldLabel({ htmlFor, children }) {
68
85
  return (_jsx("label", { htmlFor: htmlFor, className: "text-foreground text-sm font-medium", children: children }));
@@ -22,9 +22,10 @@ export declare function agentMarkTileClass(slug: string): string | undefined;
22
22
  /** The bare pixel figure, painted with `--mark-ink` from an ancestor. A 7 × 7
23
23
  * mark fills `size`; a wider reserved grid (My Kortix's 12 × 10 symbol) keeps
24
24
  * whole-pixel cells, `floor(size / 12)` px each. */
25
- export declare function AgentMarkGlyph({ slug, size }: {
25
+ export declare function AgentMarkGlyph({ slug, size, trim }: {
26
26
  slug: string;
27
27
  size: AgentMarkSize;
28
+ trim?: boolean;
28
29
  }): import("react").JSX.Element;
29
30
  /**
30
31
  * An agent's pixel mark on its tile — the agent's face wherever it appears:
@@ -30,16 +30,27 @@ export function agentMarkVars(slug) {
30
30
  export function agentMarkTileClass(slug) {
31
31
  return pixelMark(slug).tone.name === 'brand' ? 'ring-1 ring-inset ring-border' : undefined;
32
32
  }
33
+ /** The first row that holds a pixel and how many rows down to the last one. Paths are `Mx yhNv1h-Nz` runs. */
34
+ function inkedRows(path, dither, height) {
35
+ const ys = [...`${path}${dither ?? ''}`.matchAll(/M\d+ (\d+)/g)].map((match) => Number(match[1]));
36
+ if (ys.length === 0)
37
+ return [0, height];
38
+ const top = Math.min(...ys);
39
+ return [top, Math.max(...ys) + 1 - top];
40
+ }
33
41
  /** The bare pixel figure, painted with `--mark-ink` from an ancestor. A 7 × 7
34
42
  * mark fills `size`; a wider reserved grid (My Kortix's 12 × 10 symbol) keeps
35
43
  * whole-pixel cells, `floor(size / 12)` px each. */
36
- export function AgentMarkGlyph({ slug, size }) {
44
+ export function AgentMarkGlyph({ slug, size, trim = false }) {
37
45
  const mark = pixelMark(slug);
38
46
  const cell = mark.width === 7 ? size / 7 : Math.max(1, Math.floor(size / 12));
39
- return (_jsxs("svg", { "aria-hidden": true, width: mark.width * cell, height: mark.height * cell, viewBox: `0 0 ${mark.width} ${mark.height}`,
47
+ // `trim`: only the rows that hold pixels, so a mark with an empty bottom row
48
+ // centres on what is drawn, not on its reserved grid.
49
+ const [top, rows] = trim ? inkedRows(mark.path, mark.ditherPath, mark.height) : [0, mark.height];
50
+ return (_jsxs("svg", { "aria-hidden": true, width: mark.width * cell, height: rows * cell, viewBox: `0 ${top} ${mark.width} ${rows}`,
40
51
  // Inline, so a host's `[&_svg]:size-4` default (menu rows) cannot rescale
41
52
  // the pixel grid off whole device pixels.
42
- style: { width: mark.width * cell, height: mark.height * cell }, shapeRendering: "crispEdges", className: "shrink-0", children: [_jsx("path", { d: mark.path, className: "fill-(--mark-ink)" }), mark.ditherPath ? (_jsx("path", { d: mark.ditherPath, className: "fill-(--mark-ink)", opacity: 0.5 })) : null] }));
53
+ style: { width: mark.width * cell, height: rows * cell }, shapeRendering: "crispEdges", className: "shrink-0", children: [_jsx("path", { d: mark.path, className: "fill-(--mark-ink)" }), mark.ditherPath ? (_jsx("path", { d: mark.ditherPath, className: "fill-(--mark-ink)", opacity: 0.5 })) : null] }));
43
54
  }
44
55
  /**
45
56
  * An agent's pixel mark on its tile — the agent's face wherever it appears:
@@ -61,6 +61,6 @@ export declare function useSessionsAwaitingAnswer(projectId: string): ReadonlySe
61
61
  * What waits on the person in this workspace's Review: the review summary's
62
62
  * "needs you", plus the agents' questions and permission asks
63
63
  * (`useSessionAsks`). Connector approvals are already in the summary. The
64
- * sidebar's Review row (`project-spaces-nav`) shows this number.
64
+ * sidebar's Review row (`project-review-nav`) shows this number.
65
65
  */
66
66
  export declare function useReviewNeedsYouCount(projectId: string): number;
@@ -97,7 +97,7 @@ export function useSessionsAwaitingAnswer(projectId) {
97
97
  * What waits on the person in this workspace's Review: the review summary's
98
98
  * "needs you", plus the agents' questions and permission asks
99
99
  * (`useSessionAsks`). Connector approvals are already in the summary. The
100
- * sidebar's Review row (`project-spaces-nav`) shows this number.
100
+ * sidebar's Review row (`project-review-nav`) shows this number.
101
101
  */
102
102
  export function useReviewNeedsYouCount(projectId) {
103
103
  const reviewNeedsYou = useReviewSessionSummary(projectId, { enabled: !!projectId }).totalNeedsYou;
@@ -2,10 +2,12 @@
2
2
  import { HoverPrefetchLink } from '../components/hover-prefetch-link.js';
3
3
  import type { ComponentProps, ReactNode } from 'react';
4
4
  /** Keep the anchor's intent handlers and the caller's active-route semantics. */
5
- export declare function ProjectNavRow({ active, label, className, children, ...link }: ComponentProps<typeof HoverPrefetchLink> & {
5
+ export declare function ProjectNavRow({ active, label, className, itemClassName, children, ...link }: ComponentProps<typeof HoverPrefetchLink> & {
6
6
  active: boolean;
7
7
  label: string;
8
8
  /** Added to the row button's classes. */
9
9
  className?: string;
10
+ /** Added to the list item's classes (spacing around the row). */
11
+ itemClassName?: string;
10
12
  children: ReactNode;
11
13
  }): import("react").JSX.Element;
@@ -5,10 +5,10 @@ import { SidebarMenuButton, SidebarMenuItem, useSidebar } from '../../primitives
5
5
  import { useIsMobile } from '../hooks/index.js';
6
6
  import { cn } from '../lib/utils.js';
7
7
  /** Keep the anchor's intent handlers and the caller's active-route semantics. */
8
- export function ProjectNavRow({ active, label, className, children, ...link }) {
8
+ export function ProjectNavRow({ active, label, className, itemClassName, children, ...link }) {
9
9
  const isMobile = useIsMobile();
10
10
  const { setOpenMobile } = useSidebar();
11
- return (_jsx(SidebarMenuItem, { children: _jsx(SidebarMenuButton, { asChild: true, isActive: active, tooltip: label, className: cn('group/menu-button text-sidebar-foreground relative', className), children: _jsx(HoverPrefetchLink, { ...link, onClick: (event) => {
11
+ return (_jsx(SidebarMenuItem, { className: itemClassName, children: _jsx(SidebarMenuButton, { asChild: true, isActive: active, tooltip: label, className: cn('group/menu-button text-sidebar-foreground relative', className), children: _jsx(HoverPrefetchLink, { ...link, onClick: (event) => {
12
12
  link.onClick?.(event);
13
13
  if (isMobile)
14
14
  setOpenMobile(false);
@@ -1,11 +1,14 @@
1
+ import { type SecretSetupLinkInfo } from '@kortix/sdk';
1
2
  /**
2
3
  * Renders the fields an agent-minted secret link asks for, and submits the
3
4
  * values the human types. Shared by the public /secret-intake/[token] page and
4
5
  * the in-chat modal. The value is write-only — it's never read back here.
5
6
  */
6
- export declare function SecretIntakeForm({ token, onDone, compact, }: {
7
+ export declare function SecretIntakeForm({ token, onDone, compact, onLinkInfo, }: {
7
8
  token: string;
8
9
  onDone?: () => void;
10
+ /** Called once with what the link asks for, so a host can title its dialog. */
11
+ onLinkInfo?: (info: SecretSetupLinkInfo) => void;
9
12
  /**
10
13
  * The host already states the encryption promise (the in-chat modal header),
11
14
  * so the footnote keeps only the expiry.
@@ -8,9 +8,9 @@ import Loading from '../../primitives/loading.js';
8
8
  import { outcomeTint } from '../../internal/outcomes/outcome-vocabulary.js';
9
9
  import { useTranslations } from '../../i18n/index.js';
10
10
  import { cn } from '../../lib/utils.js';
11
- import { getSecretSetupLink, submitSecretSetupLink, } from '@kortix/sdk';
11
+ import { getSecretSetupLink, submitBrowserLoginSetupLink, submitSecretSetupLink, } from '@kortix/sdk';
12
12
  import { ArrowUpRightIcon, CheckIcon, ClockCountdownIcon, LinkBreakIcon, WarningCircleIcon, } from '@phosphor-icons/react';
13
- import { Fragment, useEffect, useState } from 'react';
13
+ import { Fragment, useEffect, useRef, useState } from 'react';
14
14
  import { classifySetupLinkError, describeLinkExpiry, describeWithheldSecrets, splitTextLinks, } from './util.js';
15
15
  import { setupLinkApiBase } from './api-base.js';
16
16
  /** Every phase that is not the form: tinted tile, title, one muted line. */
@@ -31,14 +31,19 @@ function LinkedText({ text }) {
31
31
  * values the human types. Shared by the public /secret-intake/[token] page and
32
32
  * the in-chat modal. The value is write-only — it's never read back here.
33
33
  */
34
- export function SecretIntakeForm({ token, onDone, compact, }) {
34
+ export function SecretIntakeForm({ token, onDone, compact, onLinkInfo, }) {
35
35
  const tI18nHardcoded = useTranslations('hardcodedUi');
36
36
  const base = setupLinkApiBase();
37
+ const onLinkInfoRef = useRef(onLinkInfo);
38
+ onLinkInfoRef.current = onLinkInfo;
37
39
  const [phase, setPhase] = useState('loading');
38
40
  const [info, setInfo] = useState(null);
39
41
  const [expiresIn, setExpiresIn] = useState(null);
40
42
  const [values, setValues] = useState({});
43
+ // A `browser` link asks for website logins: a username and a password each.
44
+ const [logins, setLogins] = useState({});
41
45
  // Who can use the values: everyone (the default) or only the person who asked.
46
+ // A website login acts as one person, so it starts as theirs alone.
42
47
  const [onlyRequester, setOnlyRequester] = useState(false);
43
48
  const tSharing = useTranslations('accessSharing');
44
49
  const [error, setError] = useState(null);
@@ -51,6 +56,8 @@ export function SecretIntakeForm({ token, onDone, compact, }) {
51
56
  if (cancelled)
52
57
  return;
53
58
  setInfo(body);
59
+ onLinkInfoRef.current?.(body);
60
+ setOnlyRequester(body.scope === 'browser' && Boolean(body.requester));
54
61
  setExpiresIn(describeLinkExpiry(body.expires_at, Date.now()));
55
62
  setPhase('ready');
56
63
  }
@@ -76,23 +83,41 @@ export function SecretIntakeForm({ token, onDone, compact, }) {
76
83
  cancelled = true;
77
84
  };
78
85
  }, [base, token, tI18nHardcoded]);
86
+ /** A `browser` link's logins with both parts filled; the password is kept verbatim. */
87
+ function filledLogins(fields) {
88
+ const filled = {};
89
+ for (const f of fields) {
90
+ const username = (logins[f.name]?.username ?? '').trim();
91
+ const password = logins[f.name]?.password ?? '';
92
+ if (username && password)
93
+ filled[f.name] = { username, password };
94
+ }
95
+ return filled;
96
+ }
79
97
  async function submit() {
80
98
  if (!info)
81
99
  return;
100
+ const isLoginLink = info.scope === 'browser';
82
101
  const filled = {};
83
102
  for (const f of info.fields) {
84
103
  const v = (values[f.name] ?? '').trim();
85
104
  if (v.length > 0)
86
105
  filled[f.name] = v;
87
106
  }
88
- if (Object.keys(filled).length === 0) {
89
- setError('Enter a value before saving.');
107
+ const filledLoginValues = isLoginLink ? filledLogins(info.fields) : {};
108
+ if (Object.keys(isLoginLink ? filledLoginValues : filled).length === 0) {
109
+ setError(isLoginLink
110
+ ? tI18nHardcoded.raw('secretIntakeLogin.missing')
111
+ : 'Enter a value before saving.');
90
112
  return;
91
113
  }
92
114
  setPhase('submitting');
93
115
  setError(null);
94
116
  try {
95
- const result = await submitSecretSetupLink(token, filled, { backendUrl: base }, onlyRequester ? { only_requester: true } : undefined);
117
+ const audience = onlyRequester ? { only_requester: true } : undefined;
118
+ const result = isLoginLink
119
+ ? await submitBrowserLoginSetupLink(token, filledLoginValues, { backendUrl: base }, audience)
120
+ : await submitSecretSetupLink(token, filled, { backendUrl: base }, audience);
96
121
  setWithheldNotice(describeWithheldSecrets(result));
97
122
  setPhase('done');
98
123
  onDone?.();
@@ -139,10 +164,19 @@ export function SecretIntakeForm({ token, onDone, compact, }) {
139
164
  .join(' ');
140
165
  return (_jsx(StatusNotice, { icon: WarningCircleIcon, tone: "warning", title: tI18nHardcoded('secretIntakeWithheld.title', { agent }), description: description }));
141
166
  }
167
+ if (info?.scope === 'browser') {
168
+ return (_jsx(StatusNotice, { icon: CheckIcon, tone: "success", title: tI18nHardcoded.raw('secretIntakeLogin.savedTitle'), description: tI18nHardcoded.raw('secretIntakeLogin.savedDescription') }));
169
+ }
142
170
  return (_jsx(StatusNotice, { icon: CheckIcon, tone: "success", title: tI18nHardcoded.raw('autoComponentsSetupLinksSecretIntakeFormJsxTextSavedSecurelyd63e94b1'), description: tI18nHardcoded.raw('autoComponentsSetupLinksSecretIntakeFormJsxTextYouCand69604da') }));
143
171
  }
144
172
  const submitting = phase === 'submitting';
145
173
  const fields = info?.fields ?? [];
174
+ const isLogin = info?.scope === 'browser';
175
+ const loginSites = [...new Set(fields.flatMap((f) => f.sites ?? []))];
176
+ const setLogin = (name, patch) => setLogins((current) => {
177
+ const previous = current[name] ?? { username: '', password: '' };
178
+ return { ...current, [name]: { ...previous, ...patch } };
179
+ });
146
180
  const footnote = [
147
181
  compact
148
182
  ? null
@@ -151,16 +185,26 @@ export function SecretIntakeForm({ token, onDone, compact, }) {
151
185
  ]
152
186
  .filter(Boolean)
153
187
  .join(' ');
154
- return (_jsxs("div", { className: "space-y-5", children: [_jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: info?.scope === 'runtime'
155
- ? tI18nHardcoded.raw('autoComponentsSetupLinksSecretIntakeFormJsxTextDeliveryRuntime1760e931')
156
- : info?.scope === 'connector'
157
- ? tI18nHardcoded.raw('autoComponentsSetupLinksSecretIntakeFormJsxTextDeliveryConnectorb21e2055')
158
- : tI18nHardcoded.raw('autoComponentsSetupLinksSecretIntakeFormJsxTextDeliveryScopec3e2a686') }), _jsx(FieldGroup, { className: "gap-5", children: fields.map((f) => (_jsxs(Field, { className: "space-y-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(FieldLabel, { htmlFor: `secret-${f.name}`, className: "text-foreground", children: f.label || _jsx("code", { className: "font-mono", children: f.name }) }), f.description ? (_jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: _jsx(LinkedText, { text: f.description }) })) : null] }), _jsx(Input, { id: `secret-${f.name}`, name: f.name, type: "password", autoComplete: "off", spellCheck: false,
159
- // 16px below `sm` so iOS Safari does not zoom the page on focus.
160
- className: "font-mono max-sm:text-base", placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022", value: values[f.name] ?? '', disabled: submitting, onChange: (e) => setValues((v) => ({ ...v, [f.name]: e.target.value })), onKeyDown: (e) => {
161
- if (e.key === 'Enter' && fields.length === 1)
162
- void submit();
163
- } })] }, f.name))) }), info?.requester ? (_jsxs("div", { className: "space-y-2", children: [_jsx(FieldLabel, { children: tSharing('whoCanUse') }), _jsxs(RadioGroup, { value: onlyRequester ? 'requester' : 'project', onValueChange: (next) => setOnlyRequester(next === 'requester'), className: "space-y-2", children: [_jsx(RadioGroupItem, { value: "project", id: "secret-intake-everyone", label: tSharing('everyone', { project: info.project_name }), description: tSharing('everyoneMeta'), size: "lg", variant: "outline", disabled: submitting }), _jsx(RadioGroupItem, { value: "requester", id: "secret-intake-requester", label: info.requester.label
188
+ return (_jsxs("div", { className: "space-y-5", children: [_jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: isLogin
189
+ ? tI18nHardcoded('secretIntakeLogin.delivery', { sites: loginSites.join(', ') })
190
+ : info?.scope === 'runtime'
191
+ ? tI18nHardcoded.raw('autoComponentsSetupLinksSecretIntakeFormJsxTextDeliveryRuntime1760e931')
192
+ : info?.scope === 'connector'
193
+ ? tI18nHardcoded.raw('autoComponentsSetupLinksSecretIntakeFormJsxTextDeliveryConnectorb21e2055')
194
+ : tI18nHardcoded.raw('autoComponentsSetupLinksSecretIntakeFormJsxTextDeliveryScopec3e2a686') }), _jsxs(FieldGroup, { className: "gap-5", children: [isLogin &&
195
+ fields.map((f) => (_jsxs(Field, { className: "space-y-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: f.label || _jsx("code", { className: "font-mono", children: f.name }) }), f.description ? (_jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: _jsx(LinkedText, { text: f.description }) })) : null] }), _jsxs("div", { className: "space-y-2", children: [_jsx(FieldLabel, { htmlFor: `login-${f.name}-username`, className: "text-muted-foreground", children: tI18nHardcoded.raw('secretIntakeLogin.username') }), _jsx(Input, { id: `login-${f.name}-username`, name: `${f.name}-username`, type: "text", autoComplete: "off", spellCheck: false,
196
+ // 16px below `sm` so iOS Safari does not zoom the page on focus.
197
+ className: "max-sm:text-base", value: logins[f.name]?.username ?? '', disabled: submitting, onChange: (e) => setLogin(f.name, { username: e.target.value }) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(FieldLabel, { htmlFor: `login-${f.name}-password`, className: "text-muted-foreground", children: tI18nHardcoded.raw('secretIntakeLogin.password') }), _jsx(Input, { id: `login-${f.name}-password`, name: `${f.name}-password`, type: "password",
198
+ // Not the Kortix account: keep the browser from filling it in.
199
+ autoComplete: "new-password", spellCheck: false, className: "font-mono max-sm:text-base", placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022", value: logins[f.name]?.password ?? '', disabled: submitting, onChange: (e) => setLogin(f.name, { password: e.target.value }), onKeyDown: (e) => {
200
+ if (e.key === 'Enter' && fields.length === 1)
201
+ void submit();
202
+ } })] })] }, f.name))), !isLogin && fields.map((f) => (_jsxs(Field, { className: "space-y-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(FieldLabel, { htmlFor: `secret-${f.name}`, className: "text-foreground", children: f.label || _jsx("code", { className: "font-mono", children: f.name }) }), f.description ? (_jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: _jsx(LinkedText, { text: f.description }) })) : null] }), _jsx(Input, { id: `secret-${f.name}`, name: f.name, type: "password", autoComplete: "off", spellCheck: false,
203
+ // 16px below `sm` so iOS Safari does not zoom the page on focus.
204
+ className: "font-mono max-sm:text-base", placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022", value: values[f.name] ?? '', disabled: submitting, onChange: (e) => setValues((v) => ({ ...v, [f.name]: e.target.value })), onKeyDown: (e) => {
205
+ if (e.key === 'Enter' && fields.length === 1)
206
+ void submit();
207
+ } })] }, f.name)))] }), info?.requester ? (_jsxs("div", { className: "space-y-2", children: [_jsx(FieldLabel, { children: tSharing('whoCanUse') }), _jsxs(RadioGroup, { value: onlyRequester ? 'requester' : 'project', onValueChange: (next) => setOnlyRequester(next === 'requester'), className: "space-y-2", children: [_jsx(RadioGroupItem, { value: "project", id: "secret-intake-everyone", label: tSharing('everyone', { project: info.project_name }), description: tSharing('everyoneMeta'), size: "lg", variant: "outline", disabled: submitting }), _jsx(RadioGroupItem, { value: "requester", id: "secret-intake-requester", label: info.requester.label
164
208
  ? tSharing('onlyRequester', { name: info.requester.label })
165
209
  : tSharing('onlyRequesterUnnamed'), description: tSharing('onlyRequesterDescription'), size: "lg", variant: "outline", disabled: submitting })] })] })) : null, _jsxs("div", { className: "space-y-3", children: [error ? (_jsx("p", { role: "alert", className: "text-destructive text-xs", children: error })) : null, _jsxs(Button, { type: "button", className: "w-full", onClick: submit, disabled: submitting, children: [submitting ? _jsx(Loading, { className: "size-4 shrink-0" }) : null, submitting
166
210
  ? tI18nHardcoded.raw('i18nComplete.text23e39291d613')
@@ -82,6 +82,9 @@ export function SetupLinkButton({ kind, token, children, }) {
82
82
  * omits the field, and that card reads "Waiting for you" again after a reload.
83
83
  */
84
84
  const [settledHere, setSettled] = useState(false);
85
+ // A secret link that asks for a website login titles its dialog as one.
86
+ const [secretScope, setSecretScope] = useState(null);
87
+ const tLogin = useTranslations('hardcodedUi');
85
88
  const inline = useContext(SetupLinkInlineContext);
86
89
  const localizedCopy = useLocalizedUiCatalog(COPY);
87
90
  const titles = useLocalizedUiCatalog(CONNECTOR_TITLES);
@@ -146,5 +149,7 @@ export function SetupLinkButton({ kind, token, children, }) {
146
149
  // The query container for `ConnectorHandshake`'s narrow layout. Below
147
150
  // 28rem the title wraps to two lines instead of cutting off the app name.
148
151
  titleClassName: "@max-md/connect:line-clamp-2 @max-md/connect:whitespace-normal", className: "@container/connect my-2" }));
149
- return (_jsxs(_Fragment, { children: [card, token !== null && kind === 'connector' && ConnectorConnectModal ? (_jsx(ConnectorConnectModal, { token: token, open: open, onOpenChange: handleOpenChange, onConnected: handleSettled, fallbackName: appName })) : null, token !== null && kind === 'secret' ? (_jsx(Modal, { open: open, onOpenChange: handleOpenChange, children: _jsxs(ModalContent, { className: "lg:max-w-lg", children: [_jsxs(ModalHeader, { className: "pr-12", children: [_jsx(ModalTitle, { children: copy.title }), _jsx(ModalDescription, { className: "text-pretty", children: copy.blurb })] }), _jsx(ModalBody, { className: "max-h-[60vh] overflow-y-auto", children: _jsx(SecretIntakeForm, { token: token, compact: true, onDone: handleSettled }) })] }) })) : null] }));
152
+ return (_jsxs(_Fragment, { children: [card, token !== null && kind === 'connector' && ConnectorConnectModal ? (_jsx(ConnectorConnectModal, { token: token, open: open, onOpenChange: handleOpenChange, onConnected: handleSettled, fallbackName: appName })) : null, token !== null && kind === 'secret' ? (_jsx(Modal, { open: open, onOpenChange: handleOpenChange, children: _jsxs(ModalContent, { className: "lg:max-w-lg", children: [_jsxs(ModalHeader, { className: "pr-12", children: [_jsx(ModalTitle, { children: secretScope === 'browser' ? tLogin.raw('secretIntakeLogin.modalTitle') : copy.title }), _jsx(ModalDescription, { className: "text-pretty", children: secretScope === 'browser'
153
+ ? tLogin.raw('secretIntakeLogin.modalDescription')
154
+ : copy.blurb })] }), _jsx(ModalBody, { className: "max-h-[60vh] overflow-y-auto", children: _jsx(SecretIntakeForm, { token: token, compact: true, onDone: handleSettled, onLinkInfo: (linkInfo) => setSecretScope(linkInfo.scope ?? null) }) })] }) })) : null] }));
150
155
  }
@@ -0,0 +1,26 @@
1
+ import { type ReactElement } from 'react';
2
+ export declare function AgentHoverCard({ sessionId, name, className, children, }: {
3
+ sessionId: string;
4
+ name: string;
5
+ /** The trigger box: it takes the chip's place in the row, so it takes its flex. */
6
+ className?: string;
7
+ children: ReactElement;
8
+ }): import("react").JSX.Element;
9
+ /** What an inline agent's card shows: it has no session, so the row's own facts. */
10
+ export interface AgentInlineDetail {
11
+ state?: string;
12
+ task?: string;
13
+ model?: string | null;
14
+ /** One line on where it ran, or why it never did. */
15
+ note?: string;
16
+ }
17
+ /**
18
+ * The hover card of an agent that ran inside this session (pi `session: "same"`):
19
+ * the same card without the session line, and a note saying where it ran.
20
+ */
21
+ export declare function AgentInlineHoverCard({ name, detail, className, children, }: {
22
+ name: string;
23
+ detail: AgentInlineDetail;
24
+ className?: string;
25
+ children: ReactElement;
26
+ }): import("react").JSX.Element;
@@ -0,0 +1,70 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { ArrowUpRightIcon } from '@phosphor-icons/react';
4
+ import { useProjectSession } from '@kortix/sdk/react';
5
+ import { useEffect, useRef, useState } from 'react';
6
+ import { useTranslations } from '../../i18n/index.js';
7
+ import { CopyButton } from '../../markdown/copy-button.js';
8
+ import { useProjectSessionHref } from '../../internal/lib/navigation/session-href.js';
9
+ import { HoverCard, HoverCardContent, HoverCardTrigger } from '../../primitives/hover-card.js';
10
+ import { useSessionIds } from '../../providers/session-ids.js';
11
+ import { agentRowOf } from './agent-model.js';
12
+ import { agentDisplayName } from '../../internal/components/agent-mark.js';
13
+ import { cn } from '../../lib/utils.js';
14
+ /**
15
+ * What an agent chip says on hover: who the agent is, how it is doing, the
16
+ * model it runs on, and its session — the id to copy and a link that opens it
17
+ * in a new tab. Only an agent with a session of its own gets the card; an
18
+ * inline run (pi `session: "same"`) has nothing to open.
19
+ */
20
+ /**
21
+ * A hover card that mounts on first hover. A transcript holds dozens of agent
22
+ * rows; each idle row stays a plain span, and only the one a pointer reaches
23
+ * pays for the floating layer.
24
+ */
25
+ function LazyAgentCard({ className, card, children }) {
26
+ const [armed, setArmed] = useState(false);
27
+ const [open, setOpen] = useState(false);
28
+ const timer = useRef(undefined);
29
+ useEffect(() => () => clearTimeout(timer.current), []);
30
+ const trigger = (_jsx("span", { "data-slot": "agent-hover-trigger", className: cn('flex min-w-0', className), onPointerEnter: () => {
31
+ if (armed)
32
+ return;
33
+ setArmed(true);
34
+ // The first hover opens after the same delay a mounted card waits.
35
+ timer.current = setTimeout(() => setOpen(true), OPEN_DELAY);
36
+ }, onPointerLeave: () => clearTimeout(timer.current), children: children }));
37
+ if (!armed)
38
+ return trigger;
39
+ return (_jsxs(HoverCard, { open: open, onOpenChange: setOpen, openDelay: OPEN_DELAY, closeDelay: 120, children: [_jsx(HoverCardTrigger, { asChild: true, children: trigger }), _jsx(HoverCardContent, { side: "top", align: "start", sideOffset: 6, animated: false, className: "w-72 p-0",
40
+ // The card is portaled, but React still bubbles its events to the row: a click
41
+ // on Copy or the link must not also open the row.
42
+ onClick: (event) => event.stopPropagation(), onPointerDown: (event) => event.stopPropagation(), children: card(open) })] }));
43
+ }
44
+ const OPEN_DELAY = 350;
45
+ export function AgentHoverCard({ sessionId, name, className, children, }) {
46
+ return (_jsx(LazyAgentCard, { className: className, card: (open) => (open ? _jsx(AgentCardBody, { sessionId: sessionId, name: name }) : null), children: children }));
47
+ }
48
+ function AgentCardBody({ sessionId, name }) {
49
+ const t = useTranslations('tools.agent');
50
+ const ids = useSessionIds();
51
+ const href = useProjectSessionHref()(sessionId);
52
+ const row = useProjectSession(ids.projectId, sessionId, { enabled: !!ids.projectId });
53
+ const session = row.data ?? null;
54
+ const agent = session ? agentRowOf(session) : null;
55
+ const model = session?.model?.split('/').pop() ?? null;
56
+ const line = agent?.line ?? null;
57
+ return (_jsxs("div", { className: "flex flex-col gap-2 px-3 py-2.5 text-sm", "data-slot": "agent-hover-card", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx("p", { className: "text-foreground min-w-0 flex-1 truncate font-medium", children: name }), agent && _jsx("span", { className: "text-muted-foreground shrink-0 text-xs", children: t(`state.${agent.state}`) })] }), line && _jsx("p", { className: "text-muted-foreground line-clamp-2 text-xs", children: line }), _jsxs("dl", { className: "text-muted-foreground grid grid-cols-[auto_1fr] items-center gap-x-3 gap-y-1 text-xs", children: [agent?.agent && agent.named && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t('card.runsAs') }), _jsx("dd", { className: "text-foreground min-w-0 truncate", children: agentDisplayName(agent.agent) })] })), model && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t('card.model') }), _jsx("dd", { className: "text-foreground min-w-0 truncate", children: model })] })), _jsx("dt", { children: t('card.session') }), _jsxs("dd", { className: "flex min-w-0 items-center gap-1", children: [_jsx("span", { className: "text-foreground min-w-0 truncate font-mono tabular-nums", title: sessionId, children: sessionId.slice(0, 8) }), _jsx(CopyButton, { code: sessionId, label: t('card.copyId'), size: "sm", hintSide: "top" })] })] }), href && (_jsxs("a", { href: href, target: "_blank", rel: "noreferrer", className: "text-muted-foreground hover:text-foreground focus-visible:text-foreground flex w-fit items-center gap-1 text-xs", children: [t('card.openNewTab'), _jsx(ArrowUpRightIcon, { "aria-hidden": true, className: "size-3" })] }))] }));
58
+ }
59
+ /**
60
+ * The hover card of an agent that ran inside this session (pi `session: "same"`):
61
+ * the same card without the session line, and a note saying where it ran.
62
+ */
63
+ export function AgentInlineHoverCard({ name, detail, className, children, }) {
64
+ return (_jsx(LazyAgentCard, { className: className, card: () => _jsx(InlineCardBody, { name: name, detail: detail }), children: children }));
65
+ }
66
+ function InlineCardBody({ name, detail }) {
67
+ const t = useTranslations('tools.agent');
68
+ const model = detail.model?.split('/').pop() ?? null;
69
+ return (_jsxs("div", { className: "flex flex-col gap-2 px-3 py-2.5 text-sm", "data-slot": "agent-hover-card", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx("p", { className: "text-foreground min-w-0 flex-1 truncate font-medium", children: name }), detail.state && _jsx("span", { className: "text-muted-foreground shrink-0 text-xs", children: detail.state })] }), detail.task && _jsx("p", { className: "text-muted-foreground line-clamp-2 text-xs", children: detail.task }), model && (_jsxs("dl", { className: "text-muted-foreground grid grid-cols-[auto_1fr] items-center gap-x-3 gap-y-1 text-xs", children: [_jsx("dt", { children: t('card.model') }), _jsx("dd", { className: "text-foreground min-w-0 truncate", children: model })] })), detail.note && _jsx("p", { className: "text-muted-foreground text-xs", children: detail.note })] }));
70
+ }
@@ -8,6 +8,7 @@ import Loading from '../../primitives/loading.js';
8
8
  import { Popover, PopoverContent, PopoverTrigger } from '../../primitives/popover.js';
9
9
  import { Tabs, TabsContent, TabsList, TabsTrigger } from '../../primitives/tabs.js';
10
10
  import { errorToast } from '../../primitives/toast.js';
11
+ import { FadedScrollArea } from '../../primitives/faded-scroll-area.js';
11
12
  import { useTranslations } from '../../i18n/index.js';
12
13
  import { agentDisplayName } from '../../internal/components/agent-mark.js';
13
14
  import { cn } from '../../lib/utils.js';
@@ -23,6 +24,7 @@ import { RunProgressRing } from '../tool/tools/workflow-progress.js';
23
24
  import { WorkflowRunRows } from '../tool/tools/workflow-run-card.js';
24
25
  import { isActive, lineSummary, shortElapsed, stripGroups, } from './agent-model.js';
25
26
  import { TasksPanel } from './tasks-panel.js';
27
+ import { AgentChip } from './agent-surface.js';
26
28
  import { isLargeRun, LargeRunBadge, useLiveWorkflowRun, useRestartAgent, useStopAgent, WorkflowRunControls, } from './workflow-run-controls.js';
27
29
  /**
28
30
  * The agents line: one muted control in the composer's under-row, right of the
@@ -128,13 +130,34 @@ export function AgentsPanel({ projectId, sessionId, agents, team, runs, tasks, o
128
130
  const t = useTranslations('multiAgent.strip');
129
131
  const anyWorking = live && [...agents, ...team].some((row) => row.state === 'working');
130
132
  const now = useNow(1_000, anyWorking);
131
- const sections = [agents.length > 0, team.length > 0, runs.length > 0].filter(Boolean).length;
132
133
  const renderRows = (list, teammate) => (_jsx("ul", { children: list.map((row) => (_jsx(AgentLineRow, { row: row, teammate: teammate, now: now, stopping: stopping.has(row.sessionId), onOpen: () => onOpen({ sessionId: row.sessionId, title: row.handle }), onStop: () => onStop(row) }, row.sessionId))) }));
133
- const list = (_jsxs("div", { className: "max-h-96 overflow-y-auto p-1", children: [agents.length > 0 && (_jsxs("section", { "aria-label": t('label'), children: [sections > 1 && _jsx(GroupLabel, { children: t('label') }), renderRows(agents, false)] })), team.length > 0 && (_jsxs("section", { "aria-label": t('team'), children: [_jsx(GroupLabel, { children: t('team') }), renderRows(team, true)] })), runs.length > 0 && (_jsxs("section", { "aria-label": t('workflowsGroup'), children: [_jsx(GroupLabel, { children: t('workflowsGroup') }), _jsx("ul", { children: runs.map((run) => (_jsx(WorkflowLineRow, { projectId: projectId, sessionId: sessionId, run: run, onOpen: onOpen }, run.runId || run.title))) })] }))] }));
134
+ const people = [...agents, ...team];
135
+ // The summary stays put; the rows scroll under it, faded at the edges.
136
+ const list = (_jsxs("div", { className: "flex max-h-96 min-h-0 flex-col p-1", children: [people.length > 0 && _jsx(AgentsSummary, { rows: people }), _jsxs(FadedScrollArea, { fadeColor: "from-popover", fadeSize: "6", rootClassName: "h-auto", className: "overscroll-contain", children: [agents.length > 0 && (_jsxs("section", { "aria-label": t('label'), children: [team.length > 0 && _jsx(GroupLabel, { children: t('label') }), renderRows(agents, false)] })), team.length > 0 && (_jsxs("section", { "aria-label": t('team'), children: [_jsx(GroupLabel, { children: t('team') }), renderRows(team, true)] })), runs.length > 0 && (_jsxs("section", { "aria-label": t('workflowsGroup'), children: [_jsx(GroupLabel, { children: t('workflowsGroup') }), _jsx("ul", { children: runs.map((run) => (_jsx(WorkflowLineRow, { projectId: projectId, sessionId: sessionId, run: run, onOpen: onOpen }, run.runId || run.title))) })] }))] })] }));
134
137
  if (tasks === null)
135
138
  return list;
136
139
  const openTasks = tasks.filter((task) => task.status !== 'completed').length;
137
- return (_jsxs(Tabs, { defaultValue: "agents", className: "gap-0", children: [_jsx(TabsContent, { value: "agents", children: list }), _jsx(TabsContent, { value: "tasks", className: "max-h-96 overflow-y-auto p-1", children: _jsx(TasksPanel, { tasks: tasks }) }), _jsx("div", { className: "border-t p-1", children: _jsxs(TabsList, { size: "xs", animate: "none", className: "w-full", children: [_jsx(TabsTrigger, { value: "agents", children: t('label') }), _jsxs(TabsTrigger, { value: "tasks", className: "gap-1.5", children: [t('tasks'), openTasks > 0 && _jsx(CountBadge, { count: openTasks })] })] }) })] }));
140
+ return (_jsxs(Tabs, { defaultValue: "agents", className: "gap-0", children: [_jsx(TabsContent, { value: "agents", children: list }), _jsx(TabsContent, { value: "tasks", className: "flex max-h-96 min-h-0 flex-col p-1", children: _jsx(FadedScrollArea, { fadeColor: "from-popover", fadeSize: "6", rootClassName: "h-auto", className: "overscroll-contain", children: _jsx(TasksPanel, { tasks: tasks }) }) }), _jsx("div", { className: "border-t p-1", children: _jsxs(TabsList, { size: "xs", animate: "none", className: "w-full", children: [_jsx(TabsTrigger, { value: "agents", children: t('label') }), _jsxs(TabsTrigger, { value: "tasks", className: "gap-1.5", children: [t('tasks'), openTasks > 0 && _jsx(CountBadge, { count: openTasks })] })] }) })] }));
141
+ }
142
+ /** The order and colour of each state in the summary: what needs the person first. */
143
+ const SUMMARY = [
144
+ { state: 'needs_input', color: 'var(--kortix-blue)' },
145
+ { state: 'failed', color: 'var(--kortix-red)' },
146
+ { state: 'working', color: 'var(--kortix-green)' },
147
+ { state: 'completed', color: 'var(--kortix-green)' },
148
+ { state: 'stopped', color: 'var(--muted-foreground)' },
149
+ ];
150
+ /** `idle` reads as done: it counts with `completed`. */
151
+ const summaryState = (state) => (state === 'idle' ? 'completed' : state);
152
+ /**
153
+ * How the session's colleagues are doing, in one glance: the count, each state's
154
+ * count, and a bar split by state. Done is the green ring's colour at a lighter
155
+ * weight, so working and done read apart.
156
+ */
157
+ function AgentsSummary({ rows }) {
158
+ const t = useTranslations('multiAgent.strip');
159
+ const counts = SUMMARY.map((item) => ({ ...item, count: rows.filter((row) => summaryState(row.state) === item.state).length })).filter((item) => item.count > 0);
160
+ return (_jsxs("div", { "data-slot": "agents-summary", className: "flex flex-col gap-2 px-2 pt-1.5 pb-2.5", children: [_jsxs("div", { className: "flex min-w-0 items-baseline justify-between gap-3", children: [_jsx("span", { className: "text-foreground text-sm", children: t('agents', { count: rows.length }) }), _jsx("span", { className: "text-muted-foreground truncate text-xs", children: counts.map((item) => t('stateCount', { count: item.count, state: t(`state.${item.state}`) })).join(' · ') })] }), _jsx("div", { "aria-hidden": true, className: "flex h-1 gap-0.5 overflow-hidden rounded-full", children: counts.map((item) => (_jsx("span", { className: cn('h-full', item.state === 'completed' && 'opacity-50'), style: { flexGrow: item.count, backgroundColor: item.color } }, item.state))) })] }));
138
161
  }
139
162
  function GroupLabel({ children }) {
140
163
  return _jsx("div", { className: "text-muted-foreground px-2 pt-1.5 pb-0.5 text-xs font-medium", children: children });
@@ -150,11 +173,14 @@ function rowState(row, now, t) {
150
173
  }
151
174
  function AgentLineRow({ row, teammate, now, stopping, onOpen, onStop, }) {
152
175
  const t = useTranslations('multiAgent.strip');
153
- // The result, or what it waits for: one line on hover, never inline.
176
+ // The result, or what it waits for: the row's second line, before "runs as".
154
177
  const detail = row.state === 'needs_input' ? (row.line ?? t(`attention.${row.attention ?? 'question'}`)) : row.line;
155
- const handle = (_jsx("span", { className: "text-foreground min-w-0 truncate font-medium", title: teammate ? undefined : row.handle, children: row.handle }));
156
- const state = (_jsx("span", { className: "text-muted-foreground shrink-0 tabular-nums", children: rowState(row, now, t) }));
157
- return (_jsxs("li", { "data-testid": "agents-line-row", "data-agent-row": row.sessionId, className: "group/row hover:bg-hover focus-within:bg-hover flex min-w-0 items-center gap-1 rounded-sm", children: [_jsxs("div", { onClick: onOpen, className: "flex min-w-0 flex-1 cursor-pointer items-center gap-2 py-1.5 pl-2 text-xs", children: [_jsx(AgentStateMark, { state: row.state }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex min-w-0 items-baseline gap-2", children: [teammate ? (_jsx(Hint, { label: t('teamRole'), side: "top", children: handle })) : (handle), detail ? (_jsx(Hint, { label: _jsx("span", { className: "block max-w-72 truncate", children: detail }), side: "top", children: state })) : (state)] }), row.named && row.agent && (_jsx("p", { className: "text-muted-foreground truncate", children: t('runsAs', { agent: agentDisplayName(row.agent) }) }))] })] }), _jsxs("div", { className: cn(ROW_ACTIONS, 'pr-1', stopping && 'opacity-100'), children: [_jsx(Hint, { label: t('openAgent', { name: row.handle }), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", "aria-label": t('openAgent', { name: row.handle }), onClick: onOpen, className: "text-muted-foreground hover:text-foreground", children: _jsx(ArrowUpRightIcon, { className: "size-3.5 shrink-0" }) }) }), stopping ? (_jsx("span", { className: "flex size-6 items-center justify-center", children: _jsx(Loading, { className: "text-muted-foreground size-3" }) })) : isActive(row.state) ? (_jsx(Hint, { label: t('stopHint'), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", "aria-label": t('stopAgent', { name: row.handle }), onClick: onStop, className: "text-muted-foreground hover:text-foreground", children: _jsx(SquareIcon, { weight: "fill", className: "size-2.5" }) }) })) : null] })] }));
178
+ const chip = _jsx(AgentChip, { handle: row.handle, name: row.handle, className: "max-w-none min-w-0 shrink" });
179
+ const stateWord = rowState(row, now, t);
180
+ const sub = [detail, row.named && row.agent ? t('runsAs', { agent: agentDisplayName(row.agent) }) : null].filter(Boolean).join(' · ');
181
+ return (_jsxs("li", { "data-testid": "agents-line-row", "data-agent-row": row.sessionId, className: "group/row hover:bg-hover focus-within:bg-hover flex min-w-0 items-start rounded-md", children: [_jsxs("div", { onClick: onOpen, className: "flex min-w-0 flex-1 cursor-pointer flex-col gap-1 py-2 pl-2", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [teammate ? (_jsx(Hint, { label: t('teamRole'), side: "top", children: chip })) : (chip), _jsx("span", { className: "flex-1" }), _jsx("span", { "data-slot": "agent-row-state", className: cn('shrink-0 text-xs tabular-nums',
182
+ // Red text reads at 6:1; the blue token is under 4.5:1 at 12px, so "needs you" stays in ink.
183
+ row.state === 'failed' ? 'text-kortix-red' : row.state === 'needs_input' ? 'text-foreground' : 'text-muted-foreground'), children: stateWord })] }), sub && _jsx("p", { className: "text-muted-foreground truncate pl-0.5 text-xs", children: sub })] }), _jsxs("div", { className: cn(ROW_ACTIONS, 'pt-1.5 pr-1 pl-1', stopping && 'opacity-100'), children: [_jsx(Hint, { label: t('openAgent', { name: row.handle }), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", "aria-label": t('openAgent', { name: row.handle }), onClick: onOpen, className: "text-muted-foreground hover:text-foreground", children: _jsx(ArrowUpRightIcon, { className: "size-3.5 shrink-0" }) }) }), stopping ? (_jsx("span", { className: "flex size-6 items-center justify-center", children: _jsx(Loading, { className: "text-muted-foreground size-3" }) })) : isActive(row.state) ? (_jsx(Hint, { label: t('stopHint'), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", "aria-label": t('stopAgent', { name: row.handle }), onClick: onStop, className: "text-muted-foreground hover:text-foreground", children: _jsx(SquareIcon, { weight: "fill", className: "size-2.5" }) }) })) : null] })] }));
158
184
  }
159
185
  const RUN_STATE = {
160
186
  running: 'working',