@kortix/ui 0.14.16 → 0.14.17
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/artifact-annotations.d.ts +126 -1
- package/dist/_vendor/shared/artifact-comments.d.ts +30 -1
- package/dist/customize/settings/tabs/experimental-tab.js +1 -4
- package/dist/customize/shared/channels-switch-dialog.d.ts +4 -8
- package/dist/customize/shared/channels-switch-dialog.js +5 -16
- package/dist/customize/shared/feature-gate-screen.js +5 -7
- package/dist/files/drives/drive-path-param.d.ts +4 -0
- package/dist/files/drives/drive-path-param.js +50 -0
- package/dist/files/index.d.ts +1 -0
- package/dist/files/index.js +1 -0
- package/dist/i18n/en.d.ts +48 -14
- package/dist/i18n/en.js +60 -26
- package/dist/markdown/doc-editor/doc-menus.d.ts +6 -0
- package/dist/markdown/doc-editor/doc-menus.js +74 -9
- package/dist/session/status/provisioning-failure.d.ts +22 -1
- package/dist/session/status/provisioning-failure.js +35 -7
- package/dist/styles.css +1 -1
- package/dist/workspace/sidebar/project-session-list.js +13 -26
- package/dist/workspace/sidebar/session-brief-hover-card.d.ts +0 -3
- package/dist/workspace/sidebar/session-brief-hover-card.js +0 -3
- package/package.json +3 -3
- package/skills/kortix-ui/references/modules.md +1 -1
package/dist/i18n/en.js
CHANGED
|
@@ -801,14 +801,6 @@ const catalog = {
|
|
|
801
801
|
"name": "Composio event triggers",
|
|
802
802
|
"description": "Start an agent when something happens in a connected app: a new email, a pull request, a calendar event. Events come from Composio. Kortix also checks your connected apps itself."
|
|
803
803
|
},
|
|
804
|
-
"volumes": {
|
|
805
|
-
"name": "Volumes",
|
|
806
|
-
"description": "Shared Files for this project."
|
|
807
|
-
},
|
|
808
|
-
"drives": {
|
|
809
|
-
"name": "Drive",
|
|
810
|
-
"description": "Shared folders that stay in sync with sessions: your own drive, one per agent, and company drives an admin attaches to the project. New sessions see them under /drives."
|
|
811
|
-
},
|
|
812
804
|
"session_log_restore": {
|
|
813
805
|
"name": "Session log restore",
|
|
814
806
|
"description": "Rebuilds a session from its saved session log when its computer lost the conversation. Kortix enables it per project."
|
|
@@ -1390,6 +1382,17 @@ const catalog = {
|
|
|
1390
1382
|
"label": "Restart session",
|
|
1391
1383
|
"pending": "Restarting…",
|
|
1392
1384
|
"ownerOnly": "Only the session owner or a project manager can restart this session."
|
|
1385
|
+
},
|
|
1386
|
+
"image": {
|
|
1387
|
+
"title": "Preparing the sandbox image",
|
|
1388
|
+
"states": {
|
|
1389
|
+
"resolving": "Choosing the image for this session.",
|
|
1390
|
+
"serving_last_ready": "Starting from the last ready image. The new one builds in the background.",
|
|
1391
|
+
"waiting_for_build": "The first image for this project is building. The session starts when it is ready.",
|
|
1392
|
+
"building": "Building the first image for this project. This happens once and takes a few minutes.",
|
|
1393
|
+
"copying_to_region": "Copying the image to this session's region.",
|
|
1394
|
+
"waiting_for_provider": "The image is finishing. The session starts when it is ready."
|
|
1395
|
+
}
|
|
1393
1396
|
}
|
|
1394
1397
|
},
|
|
1395
1398
|
"sessionDelete": {
|
|
@@ -7453,23 +7456,23 @@ const catalog = {
|
|
|
7453
7456
|
"addAccess": "Add a person, team or agent",
|
|
7454
7457
|
"notGrantable": "This folder holds the tree together and can't be shared. Share a folder inside it.",
|
|
7455
7458
|
"viewOnlyAccess": "Only people who can share this folder can change who has access.",
|
|
7456
|
-
"noGrants": "Nobody has been given access here yet. Project
|
|
7459
|
+
"noGrants": "Nobody has been given access here yet. Project admins can open every folder.",
|
|
7457
7460
|
"myFolder": "My folder",
|
|
7458
|
-
"myFolderHint": "Your own folder:
|
|
7461
|
+
"myFolderHint": "Your own folder: only you and the project's admins can open it, and it is your desktop in your sessions",
|
|
7459
7462
|
"sharedWithMeHint": "Folders other people shared with you",
|
|
7460
7463
|
"sessionNoFolders": "No folders are mounted in this session.",
|
|
7461
7464
|
"folderAccessDescription": "Choose who can open this folder and everything in it. A session gets the folder when its agent, its project or the person who started it has access.",
|
|
7462
7465
|
"whoCanAccess": "Who can access",
|
|
7463
7466
|
"whoCanAccessFolder": "Who can access {name}",
|
|
7464
7467
|
"accessPanelDescription": "People, teams and agents with access get this folder and everything in it.",
|
|
7465
|
-
"accessPanelRoot": "Open a folder to choose who can access it. Company is shared with everyone in the project
|
|
7468
|
+
"accessPanelRoot": "Open a folder to choose who can access it. Company is shared with everyone in the project. Each person's own folder opens for them and the project's admins.",
|
|
7466
7469
|
"audienceEveryoneDescription": "Everyone who works in this project, and every session in it.",
|
|
7467
7470
|
"audienceAdmins": "Admins only",
|
|
7468
7471
|
"audienceAdminsShort": "Project managers can open and share it",
|
|
7469
7472
|
"audienceAdminsDescription": "Project managers can open and share it. No session gets it until you share it.",
|
|
7470
7473
|
"audienceOnlyYou": "Only you",
|
|
7471
7474
|
"audienceOnlyOwner": "Only {name}",
|
|
7472
|
-
"audienceOwnerDescription": "A person's own folder
|
|
7475
|
+
"audienceOwnerDescription": "A person's own folder opens for them and the project's admins. Each time an admin opens it, its owner can see that.",
|
|
7473
7476
|
"audienceSpecific": "Specific people, teams or agents",
|
|
7474
7477
|
"audienceSpecificDescription": "Only the people, teams and agents you pick, plus project managers. An agent gets the folder in every one of its sessions.",
|
|
7475
7478
|
"inheritedEveryoneNote": "Everyone in this project already has access through {path}. Change it there to narrow it.",
|
|
@@ -7495,7 +7498,6 @@ const catalog = {
|
|
|
7495
7498
|
"audienceQuestion": "Who can open it?",
|
|
7496
7499
|
"badgeEveryone": "Everyone",
|
|
7497
7500
|
"badgePeople": "{count, plural, one {# person} other {# people}}",
|
|
7498
|
-
"privateNote": "Only you can open My files, not even admins. Share a folder to give someone access.",
|
|
7499
7501
|
"noTeamFolders": "No team folders yet.",
|
|
7500
7502
|
"sessionFilesName": "Files",
|
|
7501
7503
|
"sessionFilesHint": "Folders it can open",
|
|
@@ -7520,7 +7522,21 @@ const catalog = {
|
|
|
7520
7522
|
"accountStorageTitle": "Files storage",
|
|
7521
7523
|
"accountStorageDescription": "What each project's Files hold. Your plan allows {project} per project and {account} across all projects.",
|
|
7522
7524
|
"accountStorageEmpty": "No project holds files yet.",
|
|
7523
|
-
"accountStorageIncomplete": "Some projects could not be measured right now."
|
|
7525
|
+
"accountStorageIncomplete": "Some projects could not be measured right now.",
|
|
7526
|
+
"folderInfo": {
|
|
7527
|
+
"audienceYouAndAdmins": "You and project admins",
|
|
7528
|
+
"audienceOwnerAndAdmins": "Owner and admins",
|
|
7529
|
+
"boxPathHint": "Where sessions see this folder. Click to copy.",
|
|
7530
|
+
"pathCopied": "Copied",
|
|
7531
|
+
"projectAdmins": "Project admins",
|
|
7532
|
+
"adminsOpenRecorded": "Can open it. You see each time they do.",
|
|
7533
|
+
"openedByAdmins": "Opened by admins",
|
|
7534
|
+
"noAdminOpens": "No admin has opened this folder."
|
|
7535
|
+
},
|
|
7536
|
+
"folderTree": "Folders",
|
|
7537
|
+
"treeYou": "{name} (You)",
|
|
7538
|
+
"treeExpand": "Open {name}",
|
|
7539
|
+
"treeCollapse": "Close {name}"
|
|
7524
7540
|
},
|
|
7525
7541
|
"genui": {
|
|
7526
7542
|
"showData": "Show data",
|
|
@@ -8339,7 +8355,7 @@ const catalog = {
|
|
|
8339
8355
|
"edit": "Edit",
|
|
8340
8356
|
"delete": "Delete",
|
|
8341
8357
|
"deleteTitle": "Delete comment?",
|
|
8342
|
-
"deleteDescription": "
|
|
8358
|
+
"deleteDescription": "Its text is removed for everyone, and “Comment deleted” stays in its place. This cannot be undone.",
|
|
8343
8359
|
"commentDeleted": "Comment deleted",
|
|
8344
8360
|
"threadDeleted": "This thread was deleted.",
|
|
8345
8361
|
"resolve": "Resolve",
|
|
@@ -8350,9 +8366,6 @@ const catalog = {
|
|
|
8350
8366
|
"quoteLabel": "Selected passage",
|
|
8351
8367
|
"waitingForPerson": "Waiting for a person",
|
|
8352
8368
|
"deliveryFailed": "Could not send feedback to the agent.",
|
|
8353
|
-
"sendToAgent": "Send to agent ({count})",
|
|
8354
|
-
"sendExisting": "This Artifact’s session",
|
|
8355
|
-
"sendNew": "A new {agent} session",
|
|
8356
8369
|
"sendFailed": "Could not send these comments. Try again.",
|
|
8357
8370
|
"retrySend": "Retry send ({count})",
|
|
8358
8371
|
"discardSend": "Discard and use latest comments",
|
|
@@ -8365,8 +8378,9 @@ const catalog = {
|
|
|
8365
8378
|
"contextLoadError": "Could not load comment permissions.",
|
|
8366
8379
|
"activityLoadError": "Could not load activity.",
|
|
8367
8380
|
"retry": "Try again",
|
|
8381
|
+
"sendAgainTo": "Send again to {agent}",
|
|
8368
8382
|
"noComments": "No open comments",
|
|
8369
|
-
"noCommentsHint": "Select a passage or
|
|
8383
|
+
"noCommentsHint": "Select a passage to comment on it, or start a new comment.",
|
|
8370
8384
|
"noResolved": "No resolved comments",
|
|
8371
8385
|
"noResolvedHint": "Resolved threads appear here.",
|
|
8372
8386
|
"noAllComments": "No comments yet",
|
|
@@ -8383,7 +8397,7 @@ const catalog = {
|
|
|
8383
8397
|
"preparingSelection": "Preparing selected passage…",
|
|
8384
8398
|
"selectionCaptureFailed": "Could not prepare the selected passage. Discard it to leave a whole-Artifact comment.",
|
|
8385
8399
|
"commentSelection": "Comment",
|
|
8386
|
-
"selectionTooLong": "
|
|
8400
|
+
"selectionTooLong": "This passage is too long to comment on. Select {max} characters or fewer.",
|
|
8387
8401
|
"selectionUnavailable": "This passage cannot be anchored. Select another passage.",
|
|
8388
8402
|
"snapshotChanged": "The document changed. Reload it before commenting.",
|
|
8389
8403
|
"commentSaveFailed": "Could not save the document. Try again before commenting.",
|
|
@@ -8402,7 +8416,7 @@ const catalog = {
|
|
|
8402
8416
|
"sent_to_agent": "sent feedback to an agent"
|
|
8403
8417
|
},
|
|
8404
8418
|
"person": "Person",
|
|
8405
|
-
"deleteRootDescription": "
|
|
8419
|
+
"deleteRootDescription": "Its text is removed for everyone, and the thread becomes read-only. This cannot be undone.",
|
|
8406
8420
|
"showPanel": "Show comments",
|
|
8407
8421
|
"hidePanel": "Hide comments",
|
|
8408
8422
|
"panelTitle": "Comments and activity",
|
|
@@ -8424,7 +8438,29 @@ const catalog = {
|
|
|
8424
8438
|
"screenshotReadFailed": "Could not load the screenshot.",
|
|
8425
8439
|
"screenshotMissing": "Screenshot unavailable. The drawing is saved.",
|
|
8426
8440
|
"screenshotCaptureFailed": "Could not capture a screenshot. Your comment will include the drawing without an image.",
|
|
8427
|
-
"sendScreenshotLimit": "
|
|
8441
|
+
"sendScreenshotLimit": "Could not send these comments. Their screenshots exceed the limit for one request. Send fewer threads with drawings.",
|
|
8442
|
+
"agentsUnavailable": "Could not load agents.",
|
|
8443
|
+
"showMore": "Show more",
|
|
8444
|
+
"showLess": "Show less",
|
|
8445
|
+
"moreReplies": "{count, plural, one {# more reply} other {# more replies}}",
|
|
8446
|
+
"resolvedBy": "Resolved by {name}",
|
|
8447
|
+
"agent": "Agent",
|
|
8448
|
+
"threadResolved": "Thread resolved",
|
|
8449
|
+
"undo": "Undo",
|
|
8450
|
+
"agentPending": "Sending to agent…",
|
|
8451
|
+
"agentSent": "Sent to agent",
|
|
8452
|
+
"openSession": "Open session",
|
|
8453
|
+
"notDelivered": "Not delivered",
|
|
8454
|
+
"sendThreads": "{count, plural, one {Send # open thread to {agent}} other {Send # open threads to {agent}}}",
|
|
8455
|
+
"chooseAgent": "Choose agent",
|
|
8456
|
+
"sentToAgent": "Comments sent to {agent}",
|
|
8457
|
+
"newCommentFrom": "New comment from {name}",
|
|
8458
|
+
"newComments": "{count, plural, one {# new comment} other {# new comments}}",
|
|
8459
|
+
"filterLabel": "Thread status",
|
|
8460
|
+
"pagePinLabel": "Comment {number}",
|
|
8461
|
+
"showPanelCount": "Show comments, {count} open",
|
|
8462
|
+
"hidePanelCount": "Hide comments, {count} open",
|
|
8463
|
+
"commentSelectionHint": "Comment on the selection"
|
|
8428
8464
|
},
|
|
8429
8465
|
"insertMedia": "Image or video…",
|
|
8430
8466
|
"diagram": "Diagram",
|
|
@@ -9066,10 +9102,8 @@ const catalog = {
|
|
|
9066
9102
|
"memoryNoteChannel": "What agents in {place} remember. Agents read this at the start of every thread.",
|
|
9067
9103
|
"memoryNoteDm": "What {agent} remembers from this DM. It reads this at the start of every thread.",
|
|
9068
9104
|
"off": {
|
|
9069
|
-
"title": "
|
|
9070
|
-
"description": "Files and memory for {place} live in Drive.
|
|
9071
|
-
"descriptionMember": "Files and memory for {place} live in Drive. Ask a project admin to turn it on.",
|
|
9072
|
-
"action": "Open feature flags"
|
|
9105
|
+
"title": "No Drive here",
|
|
9106
|
+
"description": "Files and memory for {place} live in the Drive. This Kortix stores no Drive: it needs Platinum."
|
|
9073
9107
|
}
|
|
9074
9108
|
},
|
|
9075
9109
|
"onboarding": {
|
|
@@ -1,4 +1,10 @@
|
|
|
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;
|
|
2
8
|
export declare function DocMenus({ editor, blockMenu, editable, canComment, commenting, onComment, }: {
|
|
3
9
|
editor: Editor;
|
|
4
10
|
blockMenu?: boolean;
|
|
@@ -1,23 +1,62 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx,
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } 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`
|
|
9
|
-
* it is the only button
|
|
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.
|
|
10
11
|
*/
|
|
11
12
|
import { ChatCircleIcon, CheckSquareIcon, CodeBlockIcon, CodeIcon, LinkSimpleIcon, ListBulletsIcon, ListNumbersIcon, MinusIcon, PlusIcon, QuotesIcon, TableIcon, TextBIcon, TextHOneIcon, TextHThreeIcon, TextHTwoIcon, TextItalicIcon, TextStrikethroughIcon, TrashIcon, } from '@phosphor-icons/react';
|
|
12
13
|
import { TextSelection } from '@tiptap/pm/state';
|
|
13
14
|
import { useEditorState } from '@tiptap/react';
|
|
14
15
|
import { BubbleMenu, FloatingMenu } from '@tiptap/react/menus';
|
|
16
|
+
import { useEffect, useRef, useState } from 'react';
|
|
15
17
|
import { useTranslations } from '../../i18n/index.js';
|
|
16
18
|
import { Button } from '../../primitives/button.js';
|
|
17
19
|
import Hint from '../../primitives/hint.js';
|
|
20
|
+
import { Kbd, KbdGroup } from '../../primitives/kbd.js';
|
|
21
|
+
import Loading from '../../primitives/loading.js';
|
|
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) {
|
|
37
|
+
const { selection } = state;
|
|
38
|
+
return (selection instanceof TextSelection &&
|
|
39
|
+
selection.from !== selection.to &&
|
|
40
|
+
!!state.doc.textBetween(selection.from, selection.to).trim() &&
|
|
41
|
+
!editor.isActive('image') &&
|
|
42
|
+
!editor.isActive('video'));
|
|
43
|
+
}
|
|
18
44
|
function MenuButton({ icon: IconCmp, label, active, onClick, disabled, }) {
|
|
19
45
|
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" }) }) }));
|
|
20
46
|
}
|
|
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
|
+
}
|
|
21
60
|
const MENU = 'bg-popover text-popover-foreground flex items-center gap-0.5 rounded-lg border p-1 shadow-md';
|
|
22
61
|
export function DocMenus({ editor, blockMenu = true, editable = true, canComment = false, commenting = false, onComment, }) {
|
|
23
62
|
const t = useTranslations('artifacts');
|
|
@@ -36,6 +75,37 @@ export function DocMenus({ editor, blockMenu = true, editable = true, canComment
|
|
|
36
75
|
table: e.isActive('table'),
|
|
37
76
|
}),
|
|
38
77
|
});
|
|
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]);
|
|
39
109
|
const chain = () => editor.chain().focus();
|
|
40
110
|
const setLink = () => {
|
|
41
111
|
const previous = editor.getAttributes('link').href;
|
|
@@ -47,10 +117,5 @@ export function DocMenus({ editor, blockMenu = true, editable = true, canComment
|
|
|
47
117
|
else
|
|
48
118
|
chain().extendMarkRange('link').setLink({ href: url.trim() }).run();
|
|
49
119
|
};
|
|
50
|
-
return (_jsxs(_Fragment, { children: [_jsx(BubbleMenu, { editor: editor, options: {
|
|
51
|
-
s.selection instanceof TextSelection &&
|
|
52
|
-
from !== to &&
|
|
53
|
-
!!s.doc.textBetween(from, to).trim() &&
|
|
54
|
-
!e.isActive('image') &&
|
|
55
|
-
!e.isActive('video'), children: _jsxs("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, canComment && onComment ? (_jsxs(_Fragment, { children: [editable ? _jsx("span", { className: "bg-border mx-0.5 h-5 w-px" }) : null, _jsx(MenuButton, { icon: ChatCircleIcon, label: t('discussion.commentSelection'), onClick: onComment, disabled: commenting })] })) : 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] }));
|
|
120
|
+
return (_jsxs(_Fragment, { children: [_jsx(BubbleMenu, { editor: editor, options: bubbleOptions, shouldShow: ({ editor: e, state: s }) => (editable || canComment) && commentableSelection(e, s), children: _jsxs("div", { className: MENU, children: [canComment && onComment ? (_jsxs(_Fragment, { children: [_jsx(CommentButton, { label: t('discussion.commentSelection'), busy: commenting, shown: bubbleShown, onClick: onComment }), editable ? _jsx("span", { className: "bg-border mx-0.5 h-5 w-px" }) : null] })) : null, 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] }));
|
|
56
121
|
}
|
|
@@ -9,6 +9,17 @@ interface ProvisioningFailurePresentation {
|
|
|
9
9
|
export declare function provisioningFailurePresentation(metadata: Record<string, unknown>, sandboxLabel: string | undefined, tI18nComplete: UiTranslator): ProvisioningFailurePresentation;
|
|
10
10
|
/** Read the server-owned recovery copy. This function never consumes it. */
|
|
11
11
|
export declare function pendingSessionPromptFromMetadata(metadata: Record<string, unknown> | null | undefined): PendingSessionPrompt | null;
|
|
12
|
+
/**
|
|
13
|
+
* The prompt the failure card shows, and who delivers it on Retry.
|
|
14
|
+
*
|
|
15
|
+
* `redeliveredOnRestart` is true for `metadata.initial_prompt`: the restart
|
|
16
|
+
* route (`provisionReplacementRuntime`) hands that prompt to the new runtime
|
|
17
|
+
* itself, so Retry must only restart. A legacy `pending_prompt.text` and a
|
|
18
|
+
* start stash exist only in the client, so Retry must POST them.
|
|
19
|
+
*/
|
|
20
|
+
export interface RecoveryPrompt extends PendingSessionPrompt {
|
|
21
|
+
redeliveredOnRestart: boolean;
|
|
22
|
+
}
|
|
12
23
|
/**
|
|
13
24
|
* The recovery copy, from the server when it has one and from this tab's start
|
|
14
25
|
* stash otherwise. Never consumes either.
|
|
@@ -18,6 +29,16 @@ export declare function pendingSessionPromptFromMetadata(metadata: Record<string
|
|
|
18
29
|
* nothing, so its prompt lives only in the start stash the composer wrote before
|
|
19
30
|
* navigating. Reading both is what keeps the failure card's "copy your prompt"
|
|
20
31
|
* and Retry working identically on either path.
|
|
32
|
+
*
|
|
33
|
+
* A session that an agent, a trigger, a channel, MCP or a marketplace install
|
|
34
|
+
* created has neither: its first prompt is `metadata.initial_prompt`. That
|
|
35
|
+
* prompt is shown only while `runtimeSessionId` is empty, which is the same
|
|
36
|
+
* condition under which the restart re-delivers it.
|
|
37
|
+
*/
|
|
38
|
+
export declare function pendingSessionPromptForRecovery(sessionId: string, metadata: Record<string, unknown> | null | undefined, runtimeSessionId?: string | null): RecoveryPrompt | null;
|
|
39
|
+
/**
|
|
40
|
+
* The prompt Retry must POST itself, or null when the restart alone delivers
|
|
41
|
+
* it. Sending a `redeliveredOnRestart` prompt here would run it twice.
|
|
21
42
|
*/
|
|
22
|
-
export declare function
|
|
43
|
+
export declare function recoveryPromptToSendOnRetry(prompt: RecoveryPrompt | null): PendingSessionPrompt | null;
|
|
23
44
|
export {};
|
|
@@ -79,19 +79,47 @@ export function pendingSessionPromptFromMetadata(metadata) {
|
|
|
79
79
|
* nothing, so its prompt lives only in the start stash the composer wrote before
|
|
80
80
|
* navigating. Reading both is what keeps the failure card's "copy your prompt"
|
|
81
81
|
* and Retry working identically on either path.
|
|
82
|
+
*
|
|
83
|
+
* A session that an agent, a trigger, a channel, MCP or a marketplace install
|
|
84
|
+
* created has neither: its first prompt is `metadata.initial_prompt`. That
|
|
85
|
+
* prompt is shown only while `runtimeSessionId` is empty, which is the same
|
|
86
|
+
* condition under which the restart re-delivers it.
|
|
82
87
|
*/
|
|
83
|
-
export function pendingSessionPromptForRecovery(sessionId, metadata) {
|
|
88
|
+
export function pendingSessionPromptForRecovery(sessionId, metadata, runtimeSessionId) {
|
|
84
89
|
const fromMetadata = pendingSessionPromptFromMetadata(metadata);
|
|
85
90
|
if (fromMetadata)
|
|
86
|
-
return fromMetadata;
|
|
91
|
+
return { ...fromMetadata, redeliveredOnRestart: false };
|
|
87
92
|
const stash = readStartStash(sessionId);
|
|
88
|
-
if (
|
|
93
|
+
if (stash && stash.prompt.trim().length > 0) {
|
|
94
|
+
return {
|
|
95
|
+
text: stash.prompt,
|
|
96
|
+
agent: stash.agent ?? null,
|
|
97
|
+
model: stash.model ?? null,
|
|
98
|
+
variant: stash.variant ?? null,
|
|
99
|
+
attachment_names: [],
|
|
100
|
+
redeliveredOnRestart: false,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
const initialPrompt = metadata?.initial_prompt;
|
|
104
|
+
if (runtimeSessionId || typeof initialPrompt !== 'string' || initialPrompt.trim().length === 0) {
|
|
89
105
|
return null;
|
|
106
|
+
}
|
|
90
107
|
return {
|
|
91
|
-
text:
|
|
92
|
-
agent:
|
|
93
|
-
model:
|
|
94
|
-
variant:
|
|
108
|
+
text: initialPrompt,
|
|
109
|
+
agent: null,
|
|
110
|
+
model: null,
|
|
111
|
+
variant: null,
|
|
95
112
|
attachment_names: [],
|
|
113
|
+
redeliveredOnRestart: true,
|
|
96
114
|
};
|
|
97
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* The prompt Retry must POST itself, or null when the restart alone delivers
|
|
118
|
+
* it. Sending a `redeliveredOnRestart` prompt here would run it twice.
|
|
119
|
+
*/
|
|
120
|
+
export function recoveryPromptToSendOnRetry(prompt) {
|
|
121
|
+
if (!prompt || prompt.redeliveredOnRestart)
|
|
122
|
+
return null;
|
|
123
|
+
const { redeliveredOnRestart: _redeliveredOnRestart, ...toSend } = prompt;
|
|
124
|
+
return toSend;
|
|
125
|
+
}
|