@kortix/ui 0.15.1 → 0.15.2
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/_vendor/shared/index.d.ts +0 -2
- package/dist/artifacts/artifact-frame.d.ts +0 -1
- package/dist/artifacts/artifact-frame.js +4 -10
- package/dist/artifacts/artifact-session.js +2 -6
- package/dist/artifacts/frame-policy.d.ts +1 -1
- package/dist/artifacts/frame-policy.js +2 -2
- package/dist/customize/sections/view/agent-editor-catalog.js +0 -5
- package/dist/customize/triggers/schedule/trigger-list.d.ts +2 -2
- package/dist/customize/triggers/schedule/trigger-list.js +12 -18
- package/dist/i18n/en.d.ts +8 -185
- package/dist/i18n/en.js +13 -190
- package/dist/internal/components/agent-mark.js +6 -0
- package/dist/internal/components/clickable-path.d.ts +3 -0
- package/dist/internal/components/clickable-path.js +4 -1
- package/dist/internal/lib/browser-noise/rules/injected-scripts.js +11 -0
- package/dist/internal/lib/trigger-clock.d.ts +5 -0
- package/dist/internal/lib/trigger-clock.js +15 -0
- package/dist/internal/lib/turn-broadcast.d.ts +0 -3
- package/dist/internal/lib/use-project-feature-flags.d.ts +2 -0
- package/dist/internal/lib/use-project-feature-flags.js +2 -4
- package/dist/internal/lib/web-notifications.d.ts +1 -8
- package/dist/internal/lib/web-notifications.js +12 -53
- package/dist/internal/notifications/notification-bell.d.ts +13 -33
- package/dist/internal/notifications/notification-bell.js +14 -117
- package/dist/internal/notifications/notification-inbox.d.ts +45 -0
- package/dist/internal/notifications/notification-inbox.js +119 -0
- package/dist/internal/notifications/notification-rows.d.ts +3 -4
- package/dist/internal/notifications/notification-rows.js +1 -4
- package/dist/internal/notifications/use-inbox-summary.d.ts +13 -0
- package/dist/internal/notifications/use-inbox-summary.js +22 -0
- package/dist/internal/notifications/web-push.d.ts +9 -10
- package/dist/internal/notifications/web-push.js +9 -10
- package/dist/internal/stores/web-notification-store.d.ts +6 -9
- package/dist/internal/stores/web-notification-store.js +0 -4
- package/dist/lib/routes.d.ts +8 -0
- package/dist/lib/routes.js +4 -1
- package/dist/markdown/doc-editor/doc-menus.d.ts +1 -10
- package/dist/markdown/doc-editor/doc-menus.js +6 -69
- package/dist/markdown/file-links.js +21 -0
- package/dist/primitives/button.d.ts +1 -1
- package/dist/session/header/reminder-parts.d.ts +1 -1
- package/dist/session/header/session-site-header.js +2 -6
- package/dist/session/panel/session-reminders-panel.js +4 -15
- package/dist/session/tool/tools/session-spawn-tool.js +7 -4
- package/dist/session/tool/tools/task-tool.js +18 -4
- package/dist/styles.css +1 -1
- package/dist/workspace/home/access-requests-bell.d.ts +6 -9
- package/dist/workspace/home/access-requests-bell.js +8 -10
- package/dist/workspace/layout/project-home.js +1 -2
- package/dist/workspace/sidebar/project-sidebar.js +2 -6
- package/package.json +11 -7
- package/skills/kortix-ui/references/custom-dashboard.md +1 -1
- package/dist/_vendor/shared/artifact-annotations.d.ts +0 -311
- package/dist/_vendor/shared/artifact-comments.d.ts +0 -155
- package/dist/internal/hooks/use-notification-center.d.ts +0 -50
- package/dist/internal/hooks/use-notification-center.js +0 -151
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import { type Editor } from '@tiptap/react';
|
|
2
|
-
|
|
3
|
-
* ⌘⌥M on a Mac, Ctrl+Alt+M elsewhere: comment on the selected text (the
|
|
4
|
-
* Google Docs key). Matched by the physical key too: ⌥M types `µ` on a Mac,
|
|
5
|
-
* and Windows treats Ctrl+Alt as AltGr, so `key` is often not `m`.
|
|
6
|
-
*/
|
|
7
|
-
export declare function isCommentShortcut(event: Pick<KeyboardEvent, 'key' | 'code' | 'metaKey' | 'ctrlKey' | 'altKey' | 'shiftKey' | 'repeat'>, mac: boolean): boolean;
|
|
8
|
-
export declare function DocMenus({ editor, blockMenu, editable, canComment, commenting, onComment, }: {
|
|
2
|
+
export declare function DocMenus({ editor, blockMenu, editable, }: {
|
|
9
3
|
editor: Editor;
|
|
10
4
|
blockMenu?: boolean;
|
|
11
5
|
editable?: boolean;
|
|
12
|
-
canComment?: boolean;
|
|
13
|
-
commenting?: boolean;
|
|
14
|
-
onComment?: () => void;
|
|
15
6
|
}): import("react").JSX.Element;
|
|
@@ -1,39 +1,20 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx,
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
/**
|
|
4
4
|
* The document editor's two menus: one over selected text (marks, headings,
|
|
5
5
|
* quote, table rows) and a `+` menu on an empty line (blocks). Markdown
|
|
6
6
|
* shortcuts (`# `, `- `, `1. `, `[ ] `, `> `, ``` ```) work without them.
|
|
7
7
|
* `blockMenu={false}` drops the `+` menu, for an editor with a `/` block menu.
|
|
8
|
-
* `canComment` puts a labeled Comment button first over selected text (with
|
|
9
|
-
* `editable={false}` it is the only button) and turns on its shortcut, ⌘⌥M on
|
|
10
|
-
* a Mac and Ctrl+Alt+M elsewhere.
|
|
11
8
|
*/
|
|
12
|
-
import {
|
|
9
|
+
import { CheckSquareIcon, CodeBlockIcon, CodeIcon, LinkSimpleIcon, ListBulletsIcon, ListNumbersIcon, MinusIcon, PlusIcon, QuotesIcon, TableIcon, TextBIcon, TextHOneIcon, TextHThreeIcon, TextHTwoIcon, TextItalicIcon, TextStrikethroughIcon, TrashIcon, } from '@phosphor-icons/react';
|
|
13
10
|
import { TextSelection } from '@tiptap/pm/state';
|
|
14
11
|
import { useEditorState } from '@tiptap/react';
|
|
15
12
|
import { BubbleMenu, FloatingMenu } from '@tiptap/react/menus';
|
|
16
|
-
import { useEffect, useRef, useState } from 'react';
|
|
17
13
|
import { useTranslations } from '../../i18n/index.js';
|
|
18
14
|
import { Button } from '../../primitives/button.js';
|
|
19
15
|
import Hint from '../../primitives/hint.js';
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const isMac = () => typeof navigator !== 'undefined' && /Mac|iPhone|iPad/.test(navigator.platform);
|
|
23
|
-
/**
|
|
24
|
-
* ⌘⌥M on a Mac, Ctrl+Alt+M elsewhere: comment on the selected text (the
|
|
25
|
-
* Google Docs key). Matched by the physical key too: ⌥M types `µ` on a Mac,
|
|
26
|
-
* and Windows treats Ctrl+Alt as AltGr, so `key` is often not `m`.
|
|
27
|
-
*/
|
|
28
|
-
export function isCommentShortcut(event, mac) {
|
|
29
|
-
if (!event.altKey || event.shiftKey || event.repeat)
|
|
30
|
-
return false;
|
|
31
|
-
if (mac ? !event.metaKey || event.ctrlKey : !event.ctrlKey || event.metaKey)
|
|
32
|
-
return false;
|
|
33
|
-
return event.code === 'KeyM' || event.key.toLowerCase() === 'm';
|
|
34
|
-
}
|
|
35
|
-
/** Selected text a comment can quote: a non-blank text range, not an image or a video. */
|
|
36
|
-
function commentableSelection(editor, state) {
|
|
16
|
+
/** Selected text to format: a non-blank text range, not an image or a video. */
|
|
17
|
+
function textSelected(editor, state) {
|
|
37
18
|
const { selection } = state;
|
|
38
19
|
return (selection instanceof TextSelection &&
|
|
39
20
|
selection.from !== selection.to &&
|
|
@@ -44,21 +25,8 @@ function commentableSelection(editor, state) {
|
|
|
44
25
|
function MenuButton({ icon: IconCmp, label, active, onClick, disabled, }) {
|
|
45
26
|
return (_jsx(Hint, { label: label, side: "top", sideOffset: 6, children: _jsx(Button, { type: "button", size: "icon-sm", variant: "ghost", "aria-label": label, "aria-pressed": active, "aria-busy": disabled || undefined, disabled: disabled, onMouseDown: (e) => e.preventDefault(), onClick: onClick, className: "data-[active=true]:bg-active data-[active=true]:text-foreground text-muted-foreground", "data-active": active || undefined, children: _jsx(IconCmp, { className: "size-4" }) }) }));
|
|
46
27
|
}
|
|
47
|
-
/**
|
|
48
|
-
* The first item over selected text: a labeled button, so a first-time reader
|
|
49
|
-
* finds comments. Its hint closes with the menu: the shortcut hides the menu
|
|
50
|
-
* under a still pointer, and an open hint would lose its anchor.
|
|
51
|
-
*/
|
|
52
|
-
function CommentButton({ label, busy, shown, onClick, }) {
|
|
53
|
-
const [mac] = useState(isMac);
|
|
54
|
-
const [hint, setHint] = useState(false);
|
|
55
|
-
if (hint && !shown)
|
|
56
|
-
setHint(false);
|
|
57
|
-
const keys = mac ? ['⌘', '⌥', 'M'] : ['Ctrl', 'Alt', 'M'];
|
|
58
|
-
return (_jsx(Hint, { open: hint && shown && !busy, onOpenChange: setHint, side: "top", sideOffset: 6, label: _jsxs("span", { className: "flex items-center gap-1.5", children: [label, _jsx(KbdGroup, { children: keys.map((key) => (_jsx(Kbd, { className: "h-4 w-auto min-w-4", children: key }, key))) })] }), children: _jsxs(Button, { type: "button", size: "xs", variant: "ghost", "aria-keyshortcuts": mac ? 'Meta+Alt+M' : 'Control+Alt+M', "aria-busy": busy || undefined, disabled: busy, onMouseDown: (e) => e.preventDefault(), onClick: onClick, children: [busy ? _jsx(Loading, { className: "size-4" }) : _jsx(ChatCircleIcon, { className: "size-4" }), label] }) }));
|
|
59
|
-
}
|
|
60
28
|
const MENU = 'bg-popover text-popover-foreground flex items-center gap-0.5 rounded-lg border p-1 shadow-md';
|
|
61
|
-
export function DocMenus({ editor, blockMenu = true, editable = true,
|
|
29
|
+
export function DocMenus({ editor, blockMenu = true, editable = true, }) {
|
|
62
30
|
const t = useTranslations('artifacts');
|
|
63
31
|
const state = useEditorState({
|
|
64
32
|
editor,
|
|
@@ -75,37 +43,6 @@ export function DocMenus({ editor, blockMenu = true, editable = true, canComment
|
|
|
75
43
|
table: e.isActive('table'),
|
|
76
44
|
}),
|
|
77
45
|
});
|
|
78
|
-
// ⌘⌥M / Ctrl+Alt+M comments on the selection in this editor, while comments are on.
|
|
79
|
-
const comment = useRef({ onComment, commenting });
|
|
80
|
-
useEffect(() => {
|
|
81
|
-
comment.current = { onComment, commenting };
|
|
82
|
-
});
|
|
83
|
-
const commentsOn = canComment && !!onComment;
|
|
84
|
-
// One options object for the menu's life: it reports when the menu shows and hides.
|
|
85
|
-
const [bubbleShown, setBubbleShown] = useState(false);
|
|
86
|
-
const [bubbleOptions] = useState(() => ({
|
|
87
|
-
placement: 'top',
|
|
88
|
-
onShow: () => setBubbleShown(true),
|
|
89
|
-
onHide: () => setBubbleShown(false),
|
|
90
|
-
}));
|
|
91
|
-
useEffect(() => {
|
|
92
|
-
if (!commentsOn)
|
|
93
|
-
return;
|
|
94
|
-
const mac = isMac();
|
|
95
|
-
const onKey = (event) => {
|
|
96
|
-
const { onComment: run, commenting: busy } = comment.current;
|
|
97
|
-
if (event.defaultPrevented || !run || !isCommentShortcut(event, mac))
|
|
98
|
-
return;
|
|
99
|
-
const selected = editor.view.dom.ownerDocument.getSelection()?.anchorNode;
|
|
100
|
-
if (!selected || !editor.view.dom.contains(selected) || !commentableSelection(editor, editor.state))
|
|
101
|
-
return;
|
|
102
|
-
event.preventDefault();
|
|
103
|
-
if (!busy)
|
|
104
|
-
run();
|
|
105
|
-
};
|
|
106
|
-
window.addEventListener('keydown', onKey);
|
|
107
|
-
return () => window.removeEventListener('keydown', onKey);
|
|
108
|
-
}, [editor, commentsOn]);
|
|
109
46
|
const chain = () => editor.chain().focus();
|
|
110
47
|
const setLink = () => {
|
|
111
48
|
const previous = editor.getAttributes('link').href;
|
|
@@ -117,5 +54,5 @@ export function DocMenus({ editor, blockMenu = true, editable = true, canComment
|
|
|
117
54
|
else
|
|
118
55
|
chain().extendMarkRange('link').setLink({ href: url.trim() }).run();
|
|
119
56
|
};
|
|
120
|
-
return (_jsxs(_Fragment, { children: [_jsx(BubbleMenu, { editor: editor, options:
|
|
57
|
+
return (_jsxs(_Fragment, { children: [_jsx(BubbleMenu, { editor: editor, options: { placement: 'top' }, shouldShow: ({ editor: e, state: s }) => editable && textSelected(e, s), children: _jsx("div", { className: MENU, children: editable ? (_jsxs(_Fragment, { children: [_jsx(MenuButton, { icon: TextBIcon, label: t('bold'), active: state.bold, onClick: () => chain().toggleBold().run() }), _jsx(MenuButton, { icon: TextItalicIcon, label: t('italic'), active: state.italic, onClick: () => chain().toggleItalic().run() }), _jsx(MenuButton, { icon: TextStrikethroughIcon, label: t('strike'), active: state.strike, onClick: () => chain().toggleStrike().run() }), _jsx(MenuButton, { icon: CodeIcon, label: t('inlineCode'), active: state.code, onClick: () => chain().toggleCode().run() }), _jsx(MenuButton, { icon: LinkSimpleIcon, label: t('link'), active: state.link, onClick: setLink }), _jsx("span", { className: "bg-border mx-0.5 h-5 w-px" }), _jsx(MenuButton, { icon: TextHOneIcon, label: t('heading1'), active: state.h1, onClick: () => chain().toggleHeading({ level: 1 }).run() }), _jsx(MenuButton, { icon: TextHTwoIcon, label: t('heading2'), active: state.h2, onClick: () => chain().toggleHeading({ level: 2 }).run() }), _jsx(MenuButton, { icon: TextHThreeIcon, label: t('heading3'), active: state.h3, onClick: () => chain().toggleHeading({ level: 3 }).run() }), _jsx(MenuButton, { icon: QuotesIcon, label: t('quote'), active: state.quote, onClick: () => chain().toggleBlockquote().run() }), state.table ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "bg-border mx-0.5 h-5 w-px" }), _jsx(MenuButton, { icon: PlusIcon, label: t('addRow'), onClick: () => chain().addRowAfter().run() }), _jsx(MenuButton, { icon: ListBulletsIcon, label: t('addColumn'), onClick: () => chain().addColumnAfter().run() }), _jsx(MenuButton, { icon: MinusIcon, label: t('deleteRow'), onClick: () => chain().deleteRow().run() }), _jsx(MenuButton, { icon: TrashIcon, label: t('deleteTable'), onClick: () => chain().deleteTable().run() })] })) : null] })) : null }) }), editable && blockMenu ? (_jsx(FloatingMenu, { editor: editor, options: { placement: 'bottom-start', offset: 6 }, children: _jsxs("div", { className: MENU, children: [_jsx(MenuButton, { icon: TextHOneIcon, label: t('heading1'), onClick: () => chain().setHeading({ level: 1 }).run() }), _jsx(MenuButton, { icon: TextHTwoIcon, label: t('heading2'), onClick: () => chain().setHeading({ level: 2 }).run() }), _jsx(MenuButton, { icon: TextHThreeIcon, label: t('heading3'), onClick: () => chain().setHeading({ level: 3 }).run() }), _jsx(MenuButton, { icon: ListBulletsIcon, label: t('bulletList'), onClick: () => chain().toggleBulletList().run() }), _jsx(MenuButton, { icon: ListNumbersIcon, label: t('numberedList'), onClick: () => chain().toggleOrderedList().run() }), _jsx(MenuButton, { icon: CheckSquareIcon, label: t('taskList'), onClick: () => chain().toggleTaskList().run() }), _jsx(MenuButton, { icon: QuotesIcon, label: t('quote'), onClick: () => chain().toggleBlockquote().run() }), _jsx(MenuButton, { icon: CodeBlockIcon, label: t('codeBlock'), onClick: () => chain().toggleCodeBlock().run() }), _jsx(MenuButton, { icon: TableIcon, label: t('table'), onClick: () => chain().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run() }), _jsx(MenuButton, { icon: MinusIcon, label: t('divider'), onClick: () => chain().setHorizontalRule().run() })] }) })) : null] }));
|
|
121
58
|
}
|
|
@@ -20,6 +20,23 @@ const ANY_SCHEME = /^[a-z][a-z0-9+.-]*:/i;
|
|
|
20
20
|
function isFilePreviewPath(path) {
|
|
21
21
|
return isUnderSandboxRoot(path) || (path.startsWith('/drives/') && !path.split('/').some((part) => part === '..' || part === '.'));
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* The path of a link to this app's own `/drives/…` URL, still encoded, or null.
|
|
25
|
+
* The web app has no `/drives` route: `https://<app>/drives/me/a.jpg` is the
|
|
26
|
+
* same file as `/drives/me/a.jpg`, not a page. Without a window (server
|
|
27
|
+
* render) no origin is this app's.
|
|
28
|
+
*/
|
|
29
|
+
function ownDriveUrlPath(href) {
|
|
30
|
+
if (typeof window === 'undefined')
|
|
31
|
+
return null;
|
|
32
|
+
try {
|
|
33
|
+
const url = new URL(href);
|
|
34
|
+
return url.origin === window.location.origin && url.pathname.startsWith('/drives/') ? url.pathname : null;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
23
40
|
/**
|
|
24
41
|
* Resolves a document-relative href against the directory of the document
|
|
25
42
|
* that contains the link, lexically (`.` and `..` only — no filesystem
|
|
@@ -48,6 +65,7 @@ function resolveDocumentRelative(baseDir, href) {
|
|
|
48
65
|
*/
|
|
49
66
|
export function workspaceFileLinkPath(url, baseDir) {
|
|
50
67
|
let path = url?.trim() ?? '';
|
|
68
|
+
path = ownDriveUrlPath(path) ?? path;
|
|
51
69
|
if (FILE_SCHEME.test(path)) {
|
|
52
70
|
path = path.replace(FILE_SCHEME, '');
|
|
53
71
|
}
|
|
@@ -71,6 +89,9 @@ export function workspaceFileLinkPath(url, baseDir) {
|
|
|
71
89
|
: resolveDocumentRelative(baseDir, path);
|
|
72
90
|
return resolved && isFilePreviewPath(resolved) ? resolved : null;
|
|
73
91
|
}
|
|
92
|
+
// An encoded `..` (`%2F..%2F`) only shows after decoding.
|
|
93
|
+
if (path.startsWith('/drives/') && !isFilePreviewPath(path))
|
|
94
|
+
return null;
|
|
74
95
|
return path || null;
|
|
75
96
|
}
|
|
76
97
|
export function parseFileLinkHref(href, document = false) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "link" | "input" | "text" | "popover" | "background" | "outline" | "accent" | "error" | "secondary" | "success" | "warning" | "info" | "default" | "destructive" | "
|
|
4
|
+
variant?: "link" | "input" | "text" | "popover" | "background" | "outline" | "accent" | "error" | "secondary" | "success" | "warning" | "info" | "default" | "destructive" | "muted" | "danger" | "blue" | "transparent" | "brand" | "blue-ghost" | "blue-secondary" | "outline-ghost" | "secondary-outline" | "sidebar" | "ghost" | "foreground" | "outline-foreground" | "inverse" | "invert-outline-foreground" | "ghost-input" | "ghost-sidebar" | "outline-sidebar" | null | undefined;
|
|
5
5
|
size?: "base" | "default" | "icon" | "toolbar" | "xs" | "sm" | "lg" | "xl" | "icon-xs" | "icon-sm" | "icon-base" | "icon-md" | "icon-lg" | "magic-sm" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
@@ -22,7 +22,7 @@ export declare function useReminderView(now: number): (reminder: SessionReminder
|
|
|
22
22
|
nextAt: number;
|
|
23
23
|
countdown: [string, string | null];
|
|
24
24
|
share: number | null;
|
|
25
|
-
tone: "
|
|
25
|
+
tone: "purple" | "red";
|
|
26
26
|
pauseLabel: string;
|
|
27
27
|
schedule: string;
|
|
28
28
|
meta: string;
|
|
@@ -34,7 +34,6 @@ import { useDesktopShell } from '../../internal/layout/sidebar-opener.js';
|
|
|
34
34
|
import { SidebarToggle } from '../../internal/layout/sidebar-toggle.js';
|
|
35
35
|
import { useRenameSession } from '../actions/use-rename-session.js';
|
|
36
36
|
import { SessionDeleteModal } from '../actions/session-delete-modal.js';
|
|
37
|
-
import { useNotificationCenter } from '../../internal/hooks/use-notification-center.js';
|
|
38
37
|
import { useUiComponents, useUiHostConfig, useUiPathname, useUiRouter, useUiViewerId, } from '../../providers/ui-provider.js';
|
|
39
38
|
import { getSessionDisplayTitle } from '../actions/project-session-list-helpers.js';
|
|
40
39
|
import { useReloadSessionConfig } from '../../internal/hooks/projects/use-session-config-freshness.js';
|
|
@@ -128,17 +127,14 @@ export function SessionSiteHeader({ sessionId, sessionTitle, isMobileView, leadi
|
|
|
128
127
|
});
|
|
129
128
|
// Mute: the caller's watch on this session (KRTX-1742). Anyone who can open
|
|
130
129
|
// it may mute it; unmuting a session you never watched makes you a watcher.
|
|
131
|
-
// Only with the project's `notification_center` flag on: off, the watch
|
|
132
|
-
// routes answer 403 and the item does not exist.
|
|
133
130
|
const viewerId = useUiViewerId();
|
|
134
|
-
const notificationCenter = useNotificationCenter(projectId);
|
|
135
131
|
const sessionWatch = useSessionWatch({
|
|
136
132
|
userId: viewerId,
|
|
137
133
|
projectId,
|
|
138
134
|
sessionId: projectSessionId,
|
|
139
|
-
enabled: isProjectSession && !parent
|
|
135
|
+
enabled: isProjectSession && !parent,
|
|
140
136
|
});
|
|
141
|
-
const watching =
|
|
137
|
+
const watching = sessionWatch.data?.watching;
|
|
142
138
|
const toggleWatch = () => {
|
|
143
139
|
if (watching === undefined)
|
|
144
140
|
return;
|
|
@@ -27,7 +27,7 @@ import { cn } from '../../internal/lib/utils.js';
|
|
|
27
27
|
import { useLocale, useTranslations } from '../../i18n/index.js';
|
|
28
28
|
import { AlarmIcon, MagnifyingGlassIcon as SearchIcon } from '@phosphor-icons/react';
|
|
29
29
|
import { useState } from 'react';
|
|
30
|
-
import { CLOCK_TONE, lastRunLabel } from '../../internal/lib/trigger-clock.js';
|
|
30
|
+
import { CLOCK_TONE, lastRunLabel, nextRunIn } from '../../internal/lib/trigger-clock.js';
|
|
31
31
|
import { ReminderActions, ReminderFacts, isFailedReminder, sortReminders, useReminderControls, } from '../header/reminder-parts.js';
|
|
32
32
|
const STATUS_LABEL_KEY = {
|
|
33
33
|
all: 'statusAll',
|
|
@@ -51,19 +51,6 @@ function ReminderTile({ reminder }) {
|
|
|
51
51
|
: CLOCK_TONE.ok;
|
|
52
52
|
return (_jsxs("span", { "aria-hidden": true, className: "relative size-5 shrink-0", children: [_jsx("span", { className: "text-muted-foreground absolute inset-0 flex items-center justify-center [&_svg]:size-5", children: _jsx(AlarmIcon, {}) }), _jsx("span", { className: cn('absolute inset-0 flex items-center justify-center [&_svg]:size-5', tone.reflection), style: { maskImage: REFLECTION_MASK, WebkitMaskImage: REFLECTION_MASK }, children: _jsx(AlarmIcon, {}) }), _jsx("span", { className: "absolute -right-0.75 -bottom-0.75 flex size-3 items-center justify-center rounded-full bg-(--row-surface)", children: _jsx("span", { className: cn('size-1.5 rounded-full', tone.dot) }) })] }));
|
|
53
53
|
}
|
|
54
|
-
/** "in 25m", "in 8h", "in 3d": the next run in the last-run label's narrow style. */
|
|
55
|
-
function nextRunIn(iso, locale, now) {
|
|
56
|
-
const at = iso ? Date.parse(iso) : Number.NaN;
|
|
57
|
-
if (!Number.isFinite(at))
|
|
58
|
-
return '—';
|
|
59
|
-
const rtf = new Intl.RelativeTimeFormat(locale, { style: 'narrow', numeric: 'auto' });
|
|
60
|
-
const min = Math.max(0, Math.round((at - now) / 60_000));
|
|
61
|
-
if (min < 60)
|
|
62
|
-
return rtf.format(min, 'minute');
|
|
63
|
-
if (min < 24 * 60)
|
|
64
|
-
return rtf.format(Math.round(min / 60), 'hour');
|
|
65
|
-
return rtf.format(Math.round(min / (24 * 60)), 'day');
|
|
66
|
-
}
|
|
67
54
|
function ReminderListRow({ reminder, schedule, now, open, onToggle, controls, manageHref, }) {
|
|
68
55
|
const t = useTranslations('reminders');
|
|
69
56
|
const tTriggers = useTranslations('hardcodedUi.i18nComplete');
|
|
@@ -76,7 +63,9 @@ function ReminderListRow({ reminder, schedule, now, open, onToggle, controls, ma
|
|
|
76
63
|
// always matches: rest = card, hover = muted at 60% over card, open = muted.
|
|
77
64
|
'bg-(--row-surface) [--row-surface:var(--card)] transition-[background-color] duration-(--duration-fast)', open
|
|
78
65
|
? '[--row-surface:var(--muted)]'
|
|
79
|
-
: 'hover:[--row-surface:color-mix(in_oklab,var(--muted)_60%,var(--card))] has-[button:focus-visible]:[--row-surface:color-mix(in_oklab,var(--muted)_60%,var(--card))]'), children: [_jsxs("button", { type: "button", onClick: onToggle, "aria-expanded": open, "data-testid": "session-reminder-panel-row", className: "flex h-14 w-full items-center gap-3 rounded-md px-3 text-left outline-none", children: [_jsx("span", { className: "flex size-5 shrink-0 items-center justify-center", children: _jsx(ReminderTile, { reminder: reminder }) }), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [_jsx("span", { className: "text-foreground truncate text-sm leading-tight font-medium", children: reminderTitle(reminder) }), _jsx("span", { className: "text-muted-foreground truncate text-xs leading-tight", children: schedule })] }), _jsxs("span", { className: "flex shrink-0 flex-col items-end text-xs tabular-nums", children: [_jsx("span", { className: cn('whitespace-nowrap', active ? 'text-foreground' : 'text-muted-foreground'), children: active
|
|
66
|
+
: 'hover:[--row-surface:color-mix(in_oklab,var(--muted)_60%,var(--card))] has-[button:focus-visible]:[--row-surface:color-mix(in_oklab,var(--muted)_60%,var(--card))]'), children: [_jsxs("button", { type: "button", onClick: onToggle, "aria-expanded": open, "data-testid": "session-reminder-panel-row", className: "flex h-14 w-full items-center gap-3 rounded-md px-3 text-left outline-none", children: [_jsx("span", { className: "flex size-5 shrink-0 items-center justify-center", children: _jsx(ReminderTile, { reminder: reminder }) }), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [_jsx("span", { className: "text-foreground truncate text-sm leading-tight font-medium", children: reminderTitle(reminder) }), _jsx("span", { className: "text-muted-foreground truncate text-xs leading-tight", children: schedule })] }), _jsxs("span", { className: "flex shrink-0 flex-col items-end text-xs tabular-nums", children: [_jsx("span", { className: cn('whitespace-nowrap', active ? 'text-foreground' : 'text-muted-foreground'), children: active
|
|
67
|
+
? nextRunIn(reminder.next_fire_at, new Intl.RelativeTimeFormat(locale, { style: 'narrow', numeric: 'auto' }), now)
|
|
68
|
+
: t('pausedLabel') }), _jsx("span", { className: "text-muted-foreground whitespace-nowrap", children: lastRunLabel(asTrigger, tTriggers, locale, now) })] })] }), open ? (
|
|
80
69
|
// Starts under the name: the row's px-3, the 20px clock slot, gap-3.
|
|
81
70
|
_jsxs("div", { className: "space-y-3 pr-3 pb-3 pl-11", children: [reminder.name ? (_jsx("p", { className: "text-muted-foreground text-xs text-pretty whitespace-pre-line", children: reminder.prompt })) : null, _jsx(ReminderFacts, { reminder: reminder, now: now }), _jsx(ReminderActions, { reminder: reminder, controls: controls, manageHref: manageHref, className: "-ml-1.5" })] })) : null] }));
|
|
82
71
|
}
|
|
@@ -21,10 +21,13 @@ export function SessionSpawnTool({ call, forceOpen }) {
|
|
|
21
21
|
const status = partStatus(call);
|
|
22
22
|
const { projectId, sessionId } = useSessionIds();
|
|
23
23
|
const Link = useUiLink();
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
24
|
+
// Tool input is the model's JSON (`unknown` at runtime): read each field by
|
|
25
|
+
// type, so a non-string takes the absent-field fallback instead of throwing
|
|
26
|
+
// in `capitalizeWords` or `split` (KRTX-4511).
|
|
27
|
+
const agentName = capitalizeWords((typeof input.agent === 'string' && input.agent) || 'kortix');
|
|
28
|
+
const description = typeof input.description === 'string' ? input.description : '';
|
|
29
|
+
const projectName = typeof input.project === 'string' ? input.project : '';
|
|
30
|
+
const fullPrompt = typeof input.prompt === 'string' ? input.prompt : '';
|
|
28
31
|
const childSessionId = useMemo(() => getChildSessionId(call), [call]);
|
|
29
32
|
const childThread = useSubAgentThread(childSessionId);
|
|
30
33
|
const childCalls = useMemo(() => subAgentCalls(childThread), [childThread]);
|
|
@@ -40,8 +40,20 @@ export function TaskTool({ call, defaultOpen, forceOpen, locked }) {
|
|
|
40
40
|
const tNotice = useTranslations('multiAgent.notice');
|
|
41
41
|
const input = partInput(call);
|
|
42
42
|
const status = partStatus(call);
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
// Tool input is the model's JSON: every field is `unknown` at runtime, and a
|
|
44
|
+
// truthy non-string used to crash the render tree (`e.replace is not a
|
|
45
|
+
// function`, KRTX-4511). Read each field by type, never by cast — an empty
|
|
46
|
+
// or junk value falls through to the same fallback as an absent one.
|
|
47
|
+
// pi's `agent` field is an object by schema: an inline agent spec
|
|
48
|
+
// (`{ instructions, model?, tools?, description? }`). Its child runs as the
|
|
49
|
+
// `inline` agent (`INLINE_AGENT` in the pi subagents extension), so the row
|
|
50
|
+
// names it that way, never as `general`.
|
|
51
|
+
const subagentType = (typeof input.subagent_type === 'string' && input.subagent_type) ||
|
|
52
|
+
(typeof input.agent === 'string' && input.agent) ||
|
|
53
|
+
(typeof input.agent === 'object' && input.agent !== null ? INLINE_AGENT : '') ||
|
|
54
|
+
'general';
|
|
55
|
+
const name = typeof input.name === 'string' ? input.name : '';
|
|
56
|
+
const description = useMemo(() => (typeof input.description === 'string' && input.description) ||
|
|
45
57
|
firstMeaningfulLine(input.prompt) ||
|
|
46
58
|
// Codex `spawn_agent`.
|
|
47
59
|
firstMeaningfulLine(input.message) ||
|
|
@@ -64,8 +76,8 @@ export function TaskTool({ call, defaultOpen, forceOpen, locked }) {
|
|
|
64
76
|
? 'failed'
|
|
65
77
|
: (child?.state ?? (isRunning || (background && backgroundWorking) ? 'working' : status === 'completed' ? 'completed' : 'idle'));
|
|
66
78
|
// The name its parent gave it (`agent({ name })`) reads best; else the kind of agent.
|
|
67
|
-
const handle =
|
|
68
|
-
const title =
|
|
79
|
+
const handle = name || (child?.named ? child.handle : '') || subagentType;
|
|
80
|
+
const title = name || (child?.named ? child.handle : '') || agentDisplayName(subagentType);
|
|
69
81
|
// A row with a session opens it: beside the chat in the side panel, or as the agent
|
|
70
82
|
// dialog where there is no panel. Its prompt, steps and answer are that session's
|
|
71
83
|
// conversation, so the row carries no copy of them. A call that never got a
|
|
@@ -76,6 +88,8 @@ export function TaskTool({ call, defaultOpen, forceOpen, locked }) {
|
|
|
76
88
|
const hasBody = !opensAgent && (!!prompt || !!errorText || !!childSessionId);
|
|
77
89
|
return (_jsxs(AgentRowScope, { children: [_jsx(BasicTool, { icon: _jsx(AgentFace, { handle: handle }), trigger: _jsx(AgentTrigger, { title: title, subtitle: description }), triggerAction: _jsx(AgentStatus, { status: STATE_GLYPH[state], label: t(`state.${state}`), opens: opensAgent || hasBody }), onClick: opensAgent ? () => setModalOpen(true) : undefined, defaultOpen: defaultOpen, forceOpen: forceOpen, locked: locked, children: hasBody ? (_jsxs(AgentRowBody, { children: [prompt && prompt !== description && (_jsx("p", { className: "text-muted-foreground line-clamp-4 whitespace-pre-wrap wrap-break-word", children: prompt })), errorText && _jsx(AgentFailure, { sentence: tNotice('failedSentence'), raw: errorText }), childSessionId && _jsx(OpenAgentButton, { label: t('openAgent', { name: description || title }), onClick: () => setModalOpen(true) })] })) : undefined }), _jsx(SubAgentStatusBanner, { childSessionId: childSessionId, childThread: childThread }), childSessionId && (_jsx(SubagentDialog, { open: modalOpen, onOpenChange: setModalOpen, sessionId: childSessionId, title: title, handle: handle, task: description || undefined, failure: errorText || undefined }))] }));
|
|
78
90
|
}
|
|
91
|
+
/** The agent name an inline agent spec's child runs under (pi `INLINE_AGENT`). */
|
|
92
|
+
const INLINE_AGENT = 'inline';
|
|
79
93
|
/** The session-list glyph an agent's state draws. */
|
|
80
94
|
const STATE_GLYPH = {
|
|
81
95
|
working: 'running',
|