@kortix/ui 0.14.16 → 0.14.19
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/README.md +2 -2
- package/dist/_vendor/kortix-shared.js +38 -2
- package/dist/_vendor/shared/artifact-annotations.d.ts +126 -1
- package/dist/_vendor/shared/artifact-comments.d.ts +30 -1
- package/dist/_vendor/shared/channel-descriptors.d.ts +20 -1
- package/dist/_vendor/shared/channel-message.d.ts +1 -1
- package/dist/_vendor/shared/my-kortix-agent.d.ts +1 -1
- package/dist/_vendor/shared/space-slug.d.ts +3 -4
- package/dist/_vendor/shared/utils/ambiguous-write.d.ts +3 -3
- package/dist/customize/agents/agent-instructions.d.ts +8 -0
- package/dist/customize/agents/agent-instructions.js +38 -12
- package/dist/customize/agents/agent-overview.d.ts +6 -3
- package/dist/customize/agents/agent-overview.js +8 -2
- package/dist/customize/agents/agent-page-chrome.d.ts +45 -27
- package/dist/customize/agents/agent-page-chrome.js +60 -37
- package/dist/customize/agents/agent-page.js +88 -99
- package/dist/customize/agents/agent-tabs.d.ts +15 -14
- package/dist/customize/agents/agent-tabs.js +19 -16
- package/dist/customize/agents/agents-page.js +8 -6
- package/dist/customize/connectors/detail/account-info.js +1 -1
- package/dist/customize/project-settings/project-admin-sections.d.ts +6 -2
- package/dist/customize/project-settings/project-admin-sections.js +5 -3
- package/dist/customize/project-settings/project-settings-sections.js +1 -1
- package/dist/customize/sections/component/channel-access-panel.js +16 -0
- package/dist/customize/sections/component/channel-mocks.d.ts +5 -0
- package/dist/customize/sections/component/channel-mocks.js +14 -2
- package/dist/customize/sections/component/discord-channel-row.d.ts +6 -0
- package/dist/customize/sections/component/discord-channel-row.js +48 -0
- package/dist/customize/sections/gateway-access-tab.js +1 -1
- package/dist/customize/sections/view/channels-view.js +18 -1
- package/dist/customize/sections/view/git-view.js +2 -2
- package/dist/customize/sections/view/secret-delivery.js +1 -1
- package/dist/customize/sections/view/secrets-view.js +1 -1
- package/dist/customize/settings/rail.js +2 -2
- package/dist/customize/settings/tabs/experimental-tab.d.ts +2 -2
- package/dist/customize/settings/tabs/experimental-tab.js +3 -6
- package/dist/customize/settings/tabs/general-tab.js +5 -4
- package/dist/customize/shared/capability-library.js +19 -22
- 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/customize-tab-bar.d.ts +1 -2
- package/dist/customize/shared/customize-tab-bar.js +10 -11
- 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/files/project/components/drive-create-dialog.js +3 -3
- package/dist/i18n/en.d.ts +99 -18
- package/dist/i18n/en.js +125 -44
- package/dist/i18n/ui-catalog/remaining-ui-translation-keys.generated.js +1 -1
- package/dist/internal/branding/branding-provider.d.ts +15 -4
- package/dist/internal/branding/branding-provider.js +12 -7
- package/dist/internal/connector-logo/connector-logo.js +2 -0
- package/dist/internal/connector-logo/connector-mark-files.js +1 -0
- package/dist/internal/hooks/channels/use-channels-installations.d.ts +7 -2
- package/dist/internal/hooks/channels/use-channels-installations.js +31 -1
- package/dist/internal/hooks/projects/use-new-project-session.d.ts +6 -14
- package/dist/internal/hooks/projects/use-new-project-session.js +12 -97
- package/dist/internal/hooks/use-notification-center.d.ts +11 -8
- package/dist/internal/hooks/use-notification-center.js +22 -10
- package/dist/internal/icons/discord.d.ts +9 -0
- package/dist/internal/icons/discord.js +9 -0
- package/dist/internal/layout/connect-mcp-modal.js +1 -1
- package/dist/internal/lib/browser-noise/rules/expected-states.js +1 -1
- package/dist/internal/lib/error-handler.js +1 -1
- package/dist/internal/lib/use-project-feature-flags.js +5 -3
- package/dist/markdown/doc-editor/doc-menus.d.ts +6 -0
- package/dist/markdown/doc-editor/doc-menus.js +74 -9
- package/dist/markdown/markdown-frontmatter.d.ts +0 -3
- package/dist/markdown/markdown-frontmatter.js +45 -5
- package/dist/session/actions/project-session-list-helpers.d.ts +4 -14
- package/dist/session/actions/project-session-list-helpers.js +5 -16
- package/dist/session/actions/session-label.d.ts +5 -9
- package/dist/session/actions/session-label.js +6 -10
- package/dist/session/participants/session-participants.d.ts +7 -5
- package/dist/session/participants/session-participants.js +11 -7
- package/dist/session/status/provisioning-failure.d.ts +26 -6
- package/dist/session/status/provisioning-failure.js +39 -12
- package/dist/session/thread/optimistic-turn.js +11 -2
- package/dist/session/thread/session-chat.js +73 -25
- package/dist/session/thread/transcript.d.ts +9 -0
- package/dist/session/thread/transcript.js +44 -5
- package/dist/session/tool/tools/channel-send-card.js +1 -0
- package/dist/session/turn/channel-brand.js +4 -0
- package/dist/session/turn/message-author.d.ts +13 -8
- package/dist/session/turn/message-author.js +34 -16
- package/dist/session/turn/peer-message-row.js +24 -6
- package/dist/session/turn/user-message.js +1 -1
- package/dist/session/voice/call-audio.d.ts +32 -0
- package/dist/session/voice/call-audio.js +146 -0
- package/dist/session/voice/screen-share.d.ts +24 -0
- package/dist/session/voice/screen-share.js +75 -0
- package/dist/session/voice/use-voice-call.d.ts +15 -0
- package/dist/session/voice/use-voice-call.js +220 -0
- package/dist/session/voice/voice-call-bar.d.ts +4 -0
- package/dist/session/voice/voice-call-bar.js +39 -0
- package/dist/session/voice/voice-call-state.d.ts +96 -0
- package/dist/session/voice/voice-call-state.js +103 -0
- package/dist/session/voice/voice-call-store.d.ts +12 -0
- package/dist/session/voice/voice-call-store.js +10 -0
- package/dist/session/voice/voice-call-url.d.ts +24 -0
- package/dist/session/voice/voice-call-url.js +33 -0
- package/dist/session/voice/voice-call.d.ts +15 -0
- package/dist/session/voice/voice-call.js +54 -0
- package/dist/styles.css +1 -1
- package/dist/workspace/admin/project-admin-dashboard.js +9 -4
- package/dist/workspace/layout/project-home.js +13 -14
- package/dist/workspace/sidebar/footer/project-manifest-issues-alert.d.ts +1 -1
- package/dist/workspace/sidebar/footer/project-manifest-issues-alert.js +4 -3
- package/dist/workspace/sidebar/project-session-list.js +14 -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/dist/workspace/sidebar/session-filter-menu.js +1 -0
- package/dist/workspace/sidebar/session-grouping.d.ts +4 -0
- package/dist/workspace/sidebar/session-grouping.js +2 -0
- package/dist/workspace/sidebar/session-source-icons.js +2 -0
- package/dist/workspace/space/space-page.js +2 -2
- package/package.json +9 -9
- package/skills/kortix-ui/SKILL.md +2 -2
- package/skills/kortix-ui/references/custom-dashboard.md +1 -1
- package/skills/kortix-ui/references/modules.md +1 -1
- package/dist/customize/agents/agent-section-rail.d.ts +0 -21
- package/dist/customize/agents/agent-section-rail.js +0 -23
- package/dist/internal/hooks/projects/use-warm-project-session.d.ts +0 -270
- package/dist/internal/hooks/projects/use-warm-project-session.js +0 -362
- package/dist/internal/hooks/projects/warm-session-seed.d.ts +0 -66
- package/dist/internal/hooks/projects/warm-session-seed.js +0 -80
- package/dist/internal/hooks/projects/warm-session-taken-registry.d.ts +0 -61
- package/dist/internal/hooks/projects/warm-session-taken-registry.js +0 -141
|
@@ -27,13 +27,7 @@ export declare const LIVE_SESSION_STATUSES: ProjectSessionStatus[];
|
|
|
27
27
|
*/
|
|
28
28
|
export declare function groupChangeRequestsBySession(changeRequests: readonly ChangeRequest[], sessions: readonly ProjectSession[]): Map<string, ChangeRequest[]>;
|
|
29
29
|
/** Whether the session list should keep polling — true while any session is
|
|
30
|
-
* still mid-provisioning (queued/branching/provisioning).
|
|
31
|
-
*
|
|
32
|
-
* A warm row (pre-created, never prompted) is skipped: the API reports its
|
|
33
|
-
* idle, billed shell as `provisioning` for as long as the box lives
|
|
34
|
-
* (KRTX-1466), and polling that static status 5s-fast for up to the warm
|
|
35
|
-
* grant would buy nothing — the next real change is the marker drop at the
|
|
36
|
-
* first accepted turn, which the open-session interval covers. */
|
|
30
|
+
* still mid-provisioning (queued/branching/provisioning). */
|
|
37
31
|
export declare function shouldPollProjectSessions(sessions: ProjectSession[] | undefined): boolean;
|
|
38
32
|
/**
|
|
39
33
|
* How often the sidebar refetches the session list, or false for not at all.
|
|
@@ -99,13 +93,9 @@ export declare function sessionTitleHasLanded(session: ProjectSession): boolean;
|
|
|
99
93
|
* be proven young, and guessing wrong in that direction is the unbounded poll
|
|
100
94
|
* this window exists to prevent.
|
|
101
95
|
*
|
|
102
|
-
* The window opens from the LATER of creation and last activity
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* first prompt, i.e. at adoption, which stamps `metadata.last_activity_at`
|
|
106
|
-
* (apps/api/src/projects/routes/warm-sessions.ts). Windowing on `created_at`
|
|
107
|
-
* alone skipped the fast poll for exactly the sessions the home send
|
|
108
|
-
* produces.
|
|
96
|
+
* The window opens from the LATER of creation and last activity: a session
|
|
97
|
+
* created empty gets its title from its first prompt, which stamps
|
|
98
|
+
* `metadata.last_activity_at` and can come long after the create.
|
|
109
99
|
*/
|
|
110
100
|
export declare function isAwaitingTitle(session: ProjectSession, now: number): boolean;
|
|
111
101
|
/** Is any session in the list still waiting for its title? */
|
|
@@ -66,16 +66,9 @@ export function groupChangeRequestsBySession(changeRequests, sessions) {
|
|
|
66
66
|
return grouped;
|
|
67
67
|
}
|
|
68
68
|
/** Whether the session list should keep polling — true while any session is
|
|
69
|
-
* still mid-provisioning (queued/branching/provisioning).
|
|
70
|
-
*
|
|
71
|
-
* A warm row (pre-created, never prompted) is skipped: the API reports its
|
|
72
|
-
* idle, billed shell as `provisioning` for as long as the box lives
|
|
73
|
-
* (KRTX-1466), and polling that static status 5s-fast for up to the warm
|
|
74
|
-
* grant would buy nothing — the next real change is the marker drop at the
|
|
75
|
-
* first accepted turn, which the open-session interval covers. */
|
|
69
|
+
* still mid-provisioning (queued/branching/provisioning). */
|
|
76
70
|
export function shouldPollProjectSessions(sessions) {
|
|
77
|
-
return (sessions ?? []).some((session) => LIVE_SESSION_STATUSES.includes(session.status)
|
|
78
|
-
session.metadata?.warm !== true);
|
|
71
|
+
return (sessions ?? []).some((session) => LIVE_SESSION_STATUSES.includes(session.status));
|
|
79
72
|
}
|
|
80
73
|
/** Fast poll: a provisioning session changes status within seconds. */
|
|
81
74
|
const PROVISIONING_POLL_MS = 5_000;
|
|
@@ -250,13 +243,9 @@ const TITLE_WAIT_WINDOW_MS = 2 * 60_000;
|
|
|
250
243
|
* be proven young, and guessing wrong in that direction is the unbounded poll
|
|
251
244
|
* this window exists to prevent.
|
|
252
245
|
*
|
|
253
|
-
* The window opens from the LATER of creation and last activity
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
* first prompt, i.e. at adoption, which stamps `metadata.last_activity_at`
|
|
257
|
-
* (apps/api/src/projects/routes/warm-sessions.ts). Windowing on `created_at`
|
|
258
|
-
* alone skipped the fast poll for exactly the sessions the home send
|
|
259
|
-
* produces.
|
|
246
|
+
* The window opens from the LATER of creation and last activity: a session
|
|
247
|
+
* created empty gets its title from its first prompt, which stamps
|
|
248
|
+
* `metadata.last_activity_at` and can come long after the create.
|
|
260
249
|
*/
|
|
261
250
|
export function isAwaitingTitle(session, now) {
|
|
262
251
|
if (sessionTitleHasLanded(session))
|
|
@@ -14,12 +14,12 @@ import { isLegacyMigratedSession, type ProjectSession, type SessionListStatus }
|
|
|
14
14
|
/**
|
|
15
15
|
* Where a session came from, derived from the creation metadata stamped by
|
|
16
16
|
* the API: channel sessions carry `metadata.source` ('slack' | 'telegram' |
|
|
17
|
-
* 'teams' | 'email'),
|
|
17
|
+
* 'teams' | 'email' | 'discord'),
|
|
18
18
|
* trigger fires carry `metadata.trigger_source` ('cron' | 'webhook' | 'event' |
|
|
19
19
|
* 'manual') + `trigger_type`/`trigger_slug`. Everything else is a regular
|
|
20
20
|
* chat the user started.
|
|
21
21
|
*/
|
|
22
|
-
export type SessionSourceKind = 'chat' | 'slack' | 'telegram' | 'teams' | 'email' | 'schedule' | 'webhook' | 'event' | 'manual';
|
|
22
|
+
export type SessionSourceKind = 'chat' | 'slack' | 'telegram' | 'discord' | 'teams' | 'email' | 'schedule' | 'webhook' | 'event' | 'manual';
|
|
23
23
|
export interface SessionSource {
|
|
24
24
|
kind: SessionSourceKind;
|
|
25
25
|
/** Human label, e.g. "Slack", "Scheduled". */
|
|
@@ -74,12 +74,8 @@ export { isLegacyMigratedSession };
|
|
|
74
74
|
/**
|
|
75
75
|
* Whether the row's lifecycle menu and the session header may offer Stop.
|
|
76
76
|
*
|
|
77
|
-
* `running`
|
|
78
|
-
*
|
|
79
|
-
* lives (KRTX-1466), but it still bills compute the owner can stop — the stop
|
|
80
|
-
* route reads the sandbox row, not this word — so it keeps its Stop control.
|
|
81
|
-
* A genuinely booting session (no warm marker) does not: its box is not up
|
|
82
|
-
* yet, and stopping one answers 409 "Session is not running".
|
|
77
|
+
* Only a `running` session. A booting session's box is not up yet, and
|
|
78
|
+
* stopping one answers 409 "Session is not running".
|
|
83
79
|
*/
|
|
84
80
|
export declare function sessionCanBeStopped(session: ProjectSession): boolean;
|
|
85
81
|
/**
|
|
@@ -92,7 +88,7 @@ export declare function sessionDisplayStatus(session: ProjectSession, reviewCoun
|
|
|
92
88
|
* how "All" is expressed, so there is no `'all'` sentinel member. A sentinel
|
|
93
89
|
* alongside arrays would allow `['all', 'running']`, which has no meaning.
|
|
94
90
|
*/
|
|
95
|
-
export type SessionSourceFilter = 'shared' | 'slack' | 'telegram' | 'teams' | 'email' | 'schedule' | 'webhook' | 'event' | 'manual';
|
|
91
|
+
export type SessionSourceFilter = 'shared' | 'slack' | 'telegram' | 'discord' | 'teams' | 'email' | 'schedule' | 'webhook' | 'event' | 'manual';
|
|
96
92
|
export type SessionStatusFilter = 'running' | 'done' | 'stopped' | 'failed' | 'legacy';
|
|
97
93
|
export declare const SESSION_SOURCE_FILTERS: Array<{
|
|
98
94
|
value: SessionSourceFilter;
|
|
@@ -21,6 +21,8 @@ export function sessionSource(session, tI18nComplete) {
|
|
|
21
21
|
return { kind: 'slack', label: tI18nComplete.raw('textb27fb38ba323'), triggerSlug: null };
|
|
22
22
|
if (source === 'telegram')
|
|
23
23
|
return { kind: 'telegram', label: tI18nComplete.raw('textacdd1e734125'), triggerSlug: null };
|
|
24
|
+
if (source === 'discord')
|
|
25
|
+
return { kind: 'discord', label: tI18nComplete.raw('text053bc65874ad'), triggerSlug: null };
|
|
24
26
|
if (source === 'teams')
|
|
25
27
|
return { kind: 'teams', label: tI18nComplete.raw('texta7b52b269a23'), triggerSlug: null };
|
|
26
28
|
if (source === 'email')
|
|
@@ -88,18 +90,11 @@ export { isLegacyMigratedSession };
|
|
|
88
90
|
/**
|
|
89
91
|
* Whether the row's lifecycle menu and the session header may offer Stop.
|
|
90
92
|
*
|
|
91
|
-
* `running`
|
|
92
|
-
*
|
|
93
|
-
* lives (KRTX-1466), but it still bills compute the owner can stop — the stop
|
|
94
|
-
* route reads the sandbox row, not this word — so it keeps its Stop control.
|
|
95
|
-
* A genuinely booting session (no warm marker) does not: its box is not up
|
|
96
|
-
* yet, and stopping one answers 409 "Session is not running".
|
|
93
|
+
* Only a `running` session. A booting session's box is not up yet, and
|
|
94
|
+
* stopping one answers 409 "Session is not running".
|
|
97
95
|
*/
|
|
98
96
|
export function sessionCanBeStopped(session) {
|
|
99
|
-
|
|
100
|
-
return true;
|
|
101
|
-
return (session.status === 'provisioning' &&
|
|
102
|
-
(session.metadata ?? {}).warm === true);
|
|
97
|
+
return session.status === 'running';
|
|
103
98
|
}
|
|
104
99
|
/**
|
|
105
100
|
* Resolve a session to its display status. A pending review wins outright; a
|
|
@@ -112,6 +107,7 @@ export const SESSION_SOURCE_FILTERS = [
|
|
|
112
107
|
{ value: 'shared', label: 'Shared' },
|
|
113
108
|
{ value: 'slack', label: 'Slack' },
|
|
114
109
|
{ value: 'telegram', label: 'Telegram' },
|
|
110
|
+
{ value: 'discord', label: 'Discord' },
|
|
115
111
|
{ value: 'teams', label: 'Teams' },
|
|
116
112
|
{ value: 'email', label: 'Email' },
|
|
117
113
|
{ value: 'schedule', label: 'Scheduled' },
|
|
@@ -11,13 +11,15 @@ type AvatarPerson = Pick<SessionParticipant, 'name' | 'email'> & {
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function participantLabel(person: AvatarPerson): string;
|
|
13
13
|
/**
|
|
14
|
-
* A message
|
|
15
|
-
*
|
|
16
|
-
* author
|
|
17
|
-
*
|
|
14
|
+
* A member's message: its author's avatar above the bubble, on the right
|
|
15
|
+
* edge, your own included, in every session. A message with no recorded
|
|
16
|
+
* author renders alone. `reserve` keeps the avatar's space empty while the
|
|
17
|
+
* author loads, so the bubble does not move when it arrives. The author comes
|
|
18
|
+
* from `.../message-authors`.
|
|
18
19
|
*/
|
|
19
|
-
export declare function MessageSenderAbove({ sender, children, }: {
|
|
20
|
+
export declare function MessageSenderAbove({ sender, reserve, children, }: {
|
|
20
21
|
sender: AvatarPerson | null | undefined;
|
|
22
|
+
reserve?: boolean;
|
|
21
23
|
children: ReactNode;
|
|
22
24
|
}): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
|
|
23
25
|
/** Who can open the session beyond the listed rows: the route lists 20, `total` counts everyone. */
|
|
@@ -24,15 +24,19 @@ function ParticipantAvatar({ person, size }) {
|
|
|
24
24
|
return (_jsx(UserAvatar, { size: size, name: person.name, email: person.email ?? '', avatarUrl: person.avatar_url ?? null }));
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
* A message
|
|
28
|
-
*
|
|
29
|
-
* author
|
|
30
|
-
*
|
|
27
|
+
* A member's message: its author's avatar above the bubble, on the right
|
|
28
|
+
* edge, your own included, in every session. A message with no recorded
|
|
29
|
+
* author renders alone. `reserve` keeps the avatar's space empty while the
|
|
30
|
+
* author loads, so the bubble does not move when it arrives. The author comes
|
|
31
|
+
* from `.../message-authors`.
|
|
31
32
|
*/
|
|
32
|
-
export function MessageSenderAbove({ sender, children, }) {
|
|
33
|
+
export function MessageSenderAbove({ sender, reserve = false, children, }) {
|
|
33
34
|
const t = useTranslations('sessionParticipants');
|
|
34
|
-
if (!sender)
|
|
35
|
-
|
|
35
|
+
if (!sender) {
|
|
36
|
+
if (!reserve)
|
|
37
|
+
return children;
|
|
38
|
+
return (_jsxs("div", { className: "flex max-w-full flex-col items-end gap-1.5", children: [_jsx("span", { "aria-hidden": true, className: "size-6 shrink-0" }), _jsx("div", { className: "flex max-w-full min-w-0", children: children })] }));
|
|
39
|
+
}
|
|
36
40
|
const name = participantLabel(sender);
|
|
37
41
|
return (_jsxs("div", { className: "flex max-w-full flex-col items-end gap-1.5", children: [_jsx("span", { className: "sr-only", children: t('sentBy', { name }) }), _jsx(Hint, { label: sender.email ?? name, side: "top", delayDuration: 300, children: _jsx("span", { "aria-hidden": true, className: "flex shrink-0", children: _jsx(ParticipantAvatar, { person: sender, size: "sm" }) }) }), _jsx("div", { className: "flex max-w-full min-w-0", children: children })] }));
|
|
38
42
|
}
|
|
@@ -9,15 +9,35 @@ 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.
|
|
15
26
|
*
|
|
16
|
-
* `metadata.pending_prompt` is written by the session CREATE
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
27
|
+
* `metadata.pending_prompt` is written by the session CREATE. The start stash
|
|
28
|
+
* the composer wrote before navigating is the fallback while that row is not
|
|
29
|
+
* read yet. Reading both keeps the failure card's "copy your prompt" and Retry
|
|
30
|
+
* working before and after the session row loads.
|
|
31
|
+
*
|
|
32
|
+
* A session that an agent, a trigger, a channel, MCP or a marketplace install
|
|
33
|
+
* created has neither: its first prompt is `metadata.initial_prompt`. That
|
|
34
|
+
* prompt is shown only while `runtimeSessionId` is empty, which is the same
|
|
35
|
+
* condition under which the restart re-delivers it.
|
|
36
|
+
*/
|
|
37
|
+
export declare function pendingSessionPromptForRecovery(sessionId: string, metadata: Record<string, unknown> | null | undefined, runtimeSessionId?: string | null): RecoveryPrompt | null;
|
|
38
|
+
/**
|
|
39
|
+
* The prompt Retry must POST itself, or null when the restart alone delivers
|
|
40
|
+
* it. Sending a `redeliveredOnRestart` prompt here would run it twice.
|
|
21
41
|
*/
|
|
22
|
-
export declare function
|
|
42
|
+
export declare function recoveryPromptToSendOnRetry(prompt: RecoveryPrompt | null): PendingSessionPrompt | null;
|
|
23
43
|
export {};
|
|
@@ -74,24 +74,51 @@ export function pendingSessionPromptFromMetadata(metadata) {
|
|
|
74
74
|
* The recovery copy, from the server when it has one and from this tab's start
|
|
75
75
|
* stash otherwise. Never consumes either.
|
|
76
76
|
*
|
|
77
|
-
* `metadata.pending_prompt` is written by the session CREATE
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
77
|
+
* `metadata.pending_prompt` is written by the session CREATE. The start stash
|
|
78
|
+
* the composer wrote before navigating is the fallback while that row is not
|
|
79
|
+
* read yet. Reading both keeps the failure card's "copy your prompt" and Retry
|
|
80
|
+
* working before and after the session row loads.
|
|
81
|
+
*
|
|
82
|
+
* A session that an agent, a trigger, a channel, MCP or a marketplace install
|
|
83
|
+
* created has neither: its first prompt is `metadata.initial_prompt`. That
|
|
84
|
+
* prompt is shown only while `runtimeSessionId` is empty, which is the same
|
|
85
|
+
* condition under which the restart re-delivers it.
|
|
82
86
|
*/
|
|
83
|
-
export function pendingSessionPromptForRecovery(sessionId, metadata) {
|
|
87
|
+
export function pendingSessionPromptForRecovery(sessionId, metadata, runtimeSessionId) {
|
|
84
88
|
const fromMetadata = pendingSessionPromptFromMetadata(metadata);
|
|
85
89
|
if (fromMetadata)
|
|
86
|
-
return fromMetadata;
|
|
90
|
+
return { ...fromMetadata, redeliveredOnRestart: false };
|
|
87
91
|
const stash = readStartStash(sessionId);
|
|
88
|
-
if (
|
|
92
|
+
if (stash && stash.prompt.trim().length > 0) {
|
|
93
|
+
return {
|
|
94
|
+
text: stash.prompt,
|
|
95
|
+
agent: stash.agent ?? null,
|
|
96
|
+
model: stash.model ?? null,
|
|
97
|
+
variant: stash.variant ?? null,
|
|
98
|
+
attachment_names: [],
|
|
99
|
+
redeliveredOnRestart: false,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const initialPrompt = metadata?.initial_prompt;
|
|
103
|
+
if (runtimeSessionId || typeof initialPrompt !== 'string' || initialPrompt.trim().length === 0) {
|
|
89
104
|
return null;
|
|
105
|
+
}
|
|
90
106
|
return {
|
|
91
|
-
text:
|
|
92
|
-
agent:
|
|
93
|
-
model:
|
|
94
|
-
variant:
|
|
107
|
+
text: initialPrompt,
|
|
108
|
+
agent: null,
|
|
109
|
+
model: null,
|
|
110
|
+
variant: null,
|
|
95
111
|
attachment_names: [],
|
|
112
|
+
redeliveredOnRestart: true,
|
|
96
113
|
};
|
|
97
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* The prompt Retry must POST itself, or null when the restart alone delivers
|
|
117
|
+
* it. Sending a `redeliveredOnRestart` prompt here would run it twice.
|
|
118
|
+
*/
|
|
119
|
+
export function recoveryPromptToSendOnRetry(prompt) {
|
|
120
|
+
if (!prompt || prompt.redeliveredOnRestart)
|
|
121
|
+
return null;
|
|
122
|
+
const { redeliveredOnRestart: _redeliveredOnRestart, ...toSend } = prompt;
|
|
123
|
+
return toSend;
|
|
124
|
+
}
|
|
@@ -12,7 +12,9 @@ import { useProjectSessionHref } from '../../internal/lib/navigation/session-hre
|
|
|
12
12
|
import { cn } from '../../lib/utils.js';
|
|
13
13
|
import { getFilename } from '../../internal/lib/utils/file-utils.js';
|
|
14
14
|
import { openTabAndNavigate } from '../../internal/stores/tab-store.js';
|
|
15
|
-
import { useUiShallowNavigate } from '../../providers/ui-provider.js';
|
|
15
|
+
import { useUiShallowNavigate, useUiViewer } from '../../providers/ui-provider.js';
|
|
16
|
+
import { MessageSenderAbove } from '../participants/session-participants.js';
|
|
17
|
+
import { viewerAuthor } from '../turn/message-author.js';
|
|
16
18
|
// `BUBBLE_SURFACE` / `BUBBLE_TEXT` are imported from `turn/user-message.tsx`,
|
|
17
19
|
// not redeclared here. A local copy drifted twice already — first the dark
|
|
18
20
|
// fill (`dark:bg-sidebar-accent-foreground/9` vs `dark:bg-muted`, fixed), then
|
|
@@ -129,7 +131,14 @@ function OptimisticUserBubble({ text, agentNames, onFileClick, deferPreview, sta
|
|
|
129
131
|
}));
|
|
130
132
|
return [...pastes.map(pastedAttachment), ...fromText, ...fromStaged];
|
|
131
133
|
}, [pastes, files, deferPreview, staged]);
|
|
132
|
-
|
|
134
|
+
// This tab sent the prompt: the viewer's avatar sits above it, as on the
|
|
135
|
+
// server turn that replaces it (`MessageSenderAbove`).
|
|
136
|
+
const viewer = useUiViewer();
|
|
137
|
+
const sender = useMemo(() => {
|
|
138
|
+
const author = viewerAuthor(viewer);
|
|
139
|
+
return author?.kind === 'member' ? author : null;
|
|
140
|
+
}, [viewer]);
|
|
141
|
+
return (_jsxs("div", { className: "ml-auto flex w-full max-w-[80%] flex-col items-end gap-2 self-end", children: [attachments.length > 0 && (_jsx(MessageAttachments, { attachments: attachments, status: uploadStatus })), (cleanText || quotedPieces) && (_jsx(MessageSenderAbove, { sender: sender, reserve: true, children: _jsx("div", { className: cn(BUBBLE_SURFACE, 'w-fit overflow-hidden rounded-tr-[calc(var(--radius)-6px)]'), children: quotedPieces ? (_jsx(QuotedMessageBody, { pieces: quotedPieces, renderText: (runText) => (_jsx(HighlightMentions, { text: runText, sessions: sessions, agentNames: agentNames, onFileClick: onFileClick })) })) : (_jsx("p", { className: BUBBLE_TEXT, children: _jsx(HighlightMentions, { text: cleanText, sessions: sessions, agentNames: agentNames, onFileClick: onFileClick }) })) }) })), _jsx(UserMessageActions, { timestamp: null, copyText: expandPastedContent(text), deliveryStatus: deliveryStatus })] }));
|
|
133
142
|
}
|
|
134
143
|
/**
|
|
135
144
|
* Highlight @mentions in plain text (for optimistic & user messages).
|
|
@@ -10,16 +10,16 @@ import { useTranslations } from '../../i18n/index.js';
|
|
|
10
10
|
import { errorMessageOf, isDeliveredButDisconnected } from '../../internal/lib/delivered-but-disconnected.js';
|
|
11
11
|
import { useQueuedDraftStore, useQueuedDrafts } from '../composer/stores/queued-draft-store.js';
|
|
12
12
|
import { SESSION_LOG_MINOR, SESSION_LOG_SCHEMA, listSessionPrompts, sessionLogOfV1Rows, sessionLogPromptMessage, sessionLogRetrying, sessionLogTurns, fetchSessionAttachment, sessionLogFullTextPlan, sessionLogHarnessSwitches, sessionLogRestoreNotice, sessionLogWithFullTexts, } from '@kortix/sdk';
|
|
13
|
-
import { useProjectSession, useSessionLogOlder, useSessionLogRecord, useSessionLogThread, useSessionMessageAuthors,
|
|
13
|
+
import { useProjectSession, useSessionLogOlder, useSessionLogRecord, useSessionLogThread, useSessionMessageAuthors, useSessionParticipants, useSessionModelUsage, } from '@kortix/sdk/react';
|
|
14
14
|
import { ArrowBendUpLeftIcon, CaretDownIcon, StackIcon as Layers, } from '@phosphor-icons/react';
|
|
15
15
|
import { jumpToOutcome } from '../outcomes/jump-to-outcome.js';
|
|
16
16
|
import { useIsMobile, useIsPhone } from '../../hooks/use-mobile.js';
|
|
17
|
-
import { useUiLink, useUiPathname, useUiRouter, useUiShallowNavigate, useUiSearchParams, useUiViewerId, } from '../../providers/ui-provider.js';
|
|
17
|
+
import { useUiLink, useUiPathname, useUiRouter, useUiShallowNavigate, useUiSearchParams, useUiViewer, useUiViewerId, } from '../../providers/ui-provider.js';
|
|
18
18
|
import { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
19
19
|
import { TranscriptRowsContext } from './transcript-rows.js';
|
|
20
20
|
import { AgentBusyRow, PendingPromptRows } from './thread-boot-rows.js';
|
|
21
21
|
import { createPortal } from 'react-dom';
|
|
22
|
-
import { AUTHOR_RETRY_DELAYS_MS, authorForTurn, awaitsAgent, missingAuthorKey, resolveTranscriptAuthors, rewindableMessageIds,
|
|
22
|
+
import { AUTHOR_RETRY_DELAYS_MS, authorForTurn, awaitsAgent, missingAuthorKey, participantAuthor, resolveTranscriptAuthors, rewindableMessageIds, stoppedByName, viewerAuthor, } from '../turn/message-author.js';
|
|
23
23
|
import { stopRefusalMessage } from '../status/stop-refusal.js';
|
|
24
24
|
import { QueuedPromptList } from '../composer/queued-prompt-list.js';
|
|
25
25
|
import { runtimePermissionLocksComposer } from '../composer/send-blockers.js';
|
|
@@ -48,6 +48,7 @@ import { sessionSlashFiles } from '../composer/menus/slash-files.js';
|
|
|
48
48
|
import { resolveFirstPromptHandover, transcriptCarriesFirstPrompt, } from './first-prompt-handover.js';
|
|
49
49
|
import { CompactModal } from '../header/compact-modal.js';
|
|
50
50
|
import { SessionSiteHeader } from '../header/session-site-header.js';
|
|
51
|
+
import { VoiceCallSlot } from '../voice/voice-call.js';
|
|
51
52
|
import { claimFirstTurnRow } from '../composer/inbox-row-claims.js';
|
|
52
53
|
import { OptimisticTurn } from './optimistic-turn.js';
|
|
53
54
|
import { inboxHoldsLivePrompt } from '../composer/inbox-live-prompt.js';
|
|
@@ -106,7 +107,7 @@ import { HELD_COMMAND_ROW_PREFIX, canReleaseHeldCommand, heldCommandRows, } from
|
|
|
106
107
|
import { useSessionHistoryViewStore } from '../../internal/stores/session-history-view-store.js';
|
|
107
108
|
import { downloadBlob } from '../../internal/lib/utils/download.js';
|
|
108
109
|
import { RestoreNotice, hasOutOfContext } from './session-history.js';
|
|
109
|
-
import { TranscriptTurnRow, strandedPromptIds, optimisticAnswersCache, promptTexts, resolveTurnError, } from './transcript.js';
|
|
110
|
+
import { TranscriptTurnRow, isAgentNoticeTurn, strandedPromptIds, optimisticAnswersCache, promptTexts, resolveTurnError, } from './transcript.js';
|
|
110
111
|
export { SessionReportCard, deriveTurnErrorAbortState, deriveTurnErrorPresentation } from './transcript.js';
|
|
111
112
|
// ============================================================================
|
|
112
113
|
// Sub-Session Breadcrumb
|
|
@@ -412,8 +413,15 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
412
413
|
threadRef.current = thread;
|
|
413
414
|
}, [thread]);
|
|
414
415
|
const messagesLoading = syncMessagesLoading;
|
|
415
|
-
// Who wrote each user message
|
|
416
|
+
// Who wrote each user message: every member message shows its sender's
|
|
417
|
+
// avatar from the first frame, one-person session included, so nothing
|
|
418
|
+
// moves when a second person joins.
|
|
416
419
|
const viewerId = useUiViewerId();
|
|
420
|
+
const viewer = useUiViewer();
|
|
421
|
+
const viewerAsAuthor = useMemo(() => viewerAuthor(viewer), [viewer]);
|
|
422
|
+
// Wire ids this tab sent. Their recorded author arrives a moment after the
|
|
423
|
+
// bubble paints, so the viewer's avatar stands in until then.
|
|
424
|
+
const sentHereIds = useRef(new Set());
|
|
417
425
|
const Link = useUiLink();
|
|
418
426
|
// Only a user message adds an author, so only user messages key the refetch.
|
|
419
427
|
const userMessageIds = useMemo(() => (messages ?? []).filter((m) => m.role === 'user').map((m) => m.message_id), [messages]);
|
|
@@ -422,12 +430,18 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
422
430
|
const turnOutcome = useSessionTurnOutcome(projectId ?? '', projectSessionId ?? '');
|
|
423
431
|
// A stop adds no message but does add a name ("Stopped by"): the turn that
|
|
424
432
|
// ended keys the read too, so the stopper shows when that turn ends.
|
|
425
|
-
const { data: messageAuthors, refetch: refetchMessageAuthors } = useSessionMessageAuthors(projectId, projectSessionId, `${newestUserMessageId}|${turnOutcome.last_ended?.turn_token ?? ''}`);
|
|
433
|
+
const { data: messageAuthors, isLoading: messageAuthorsLoading, refetch: refetchMessageAuthors, } = useSessionMessageAuthors(projectId, projectSessionId, `${newestUserMessageId}|${turnOutcome.last_ended?.turn_token ?? ''}`);
|
|
426
434
|
const transcriptAuthors = useMemo(() => resolveTranscriptAuthors(userMessageIds, messageAuthors), [userMessageIds, messageAuthors]);
|
|
427
|
-
//
|
|
428
|
-
//
|
|
435
|
+
// The user messages on screen when this session's first authors read
|
|
436
|
+
// landed. A message after them arrived live: the drain may re-mint its id
|
|
437
|
+
// and the ledger records it a moment later, so its avatar slot is held.
|
|
438
|
+
const [loadedUserIds, setLoadedUserIds] = useState(null);
|
|
439
|
+
if (messageAuthors && loadedUserIds?.sessionId !== sessionId) {
|
|
440
|
+
setLoadedUserIds({ sessionId, ids: new Set(userMessageIds) });
|
|
441
|
+
}
|
|
442
|
+
// Names a queued prompt's sender before the authors read lists it. Same
|
|
443
|
+
// cache as the header.
|
|
429
444
|
const { data: sessionParticipants } = useSessionParticipants(projectId, projectSessionId);
|
|
430
|
-
const groupChat = transcriptAuthors.multiAuthor || !!sessionParticipants?.multi_user;
|
|
431
445
|
// Project sessions use the server-side project agent roster. A sub-agent's
|
|
432
446
|
// chat has no projectId, but runs inside the parent scope's project: its
|
|
433
447
|
// roster is that project's. Only a chat with neither falls back to the
|
|
@@ -460,14 +474,19 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
460
474
|
...promptInbox.prompts.flatMap((prompt) => [prompt.message_id, prompt.wire_message_id ?? '']),
|
|
461
475
|
]);
|
|
462
476
|
const authorRetry = useRef({ key: '', count: 0 });
|
|
477
|
+
// The missing set the retries gave up on: a live message still unattributed
|
|
478
|
+
// then stops holding its avatar slot.
|
|
479
|
+
const [authorsGaveUp, setAuthorsGaveUp] = useState('');
|
|
463
480
|
useEffect(() => {
|
|
464
481
|
if (!missingAuthors)
|
|
465
482
|
return;
|
|
466
483
|
if (authorRetry.current.key !== missingAuthors)
|
|
467
484
|
authorRetry.current = { key: missingAuthors, count: 0 };
|
|
468
485
|
const delay = AUTHOR_RETRY_DELAYS_MS[authorRetry.current.count];
|
|
469
|
-
if (delay === undefined)
|
|
486
|
+
if (delay === undefined) {
|
|
487
|
+
setAuthorsGaveUp(missingAuthors);
|
|
470
488
|
return;
|
|
489
|
+
}
|
|
471
490
|
const timer = setTimeout(() => {
|
|
472
491
|
authorRetry.current.count += 1;
|
|
473
492
|
void refetchMessageAuthors();
|
|
@@ -1867,6 +1886,9 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1867
1886
|
* 1.5k "two children with the same key" errors in one churn). The origin
|
|
1868
1887
|
* key goes to the FIRST claimant; any other turn falls back to its own id.
|
|
1869
1888
|
*/
|
|
1889
|
+
// Turns whose prompt is another agent's notice: the work continues across
|
|
1890
|
+
// them, so they sit a continuation's distance below the turn above.
|
|
1891
|
+
const agentNoticeTurnIds = useMemo(() => new Set(turns.filter((turn) => isAgentNoticeTurn(turn)).map((turn) => turn.id)), [turns]);
|
|
1870
1892
|
const turnRenderKeys = useMemo(() => {
|
|
1871
1893
|
const keys = new Map();
|
|
1872
1894
|
const used = new Set();
|
|
@@ -2182,6 +2204,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2182
2204
|
const clientMessageId = overrides?.clientMessageId ?? ascendingId('msg');
|
|
2183
2205
|
const sentAtMs = Date.now();
|
|
2184
2206
|
const messageID = mintSessionWireMessageId(sessionId, clientMessageId);
|
|
2207
|
+
sentHereIds.current.add(messageID);
|
|
2185
2208
|
// Generate part IDs upfront so the optimistic message and the server
|
|
2186
2209
|
// request use the SAME IDs. When the server echoes parts via
|
|
2187
2210
|
// message.part.updated, the sync store's upsertPart will UPDATE
|
|
@@ -3297,17 +3320,19 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3297
3320
|
const agentsLineCompact = !!transcriptRows && !isPhone;
|
|
3298
3321
|
const chatUnderbarSlot = useMemo(() => _jsx(AgentsLine, { projectId: projectId, sessionId: projectSessionId, compact: agentsLineCompact }), [projectId, projectSessionId, agentsLineCompact]);
|
|
3299
3322
|
// The queued messages and the one Resume while a Stop holds the queue: their
|
|
3300
|
-
// own full-width card above the composer stack, not inside the strip.
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3323
|
+
// own full-width card above the composer stack, not inside the strip. A live
|
|
3324
|
+
// voice call is the card above them (nothing unless a call is open).
|
|
3325
|
+
const chatAboveSlot = useMemo(() => (_jsxs(_Fragment, { children: [_jsx(VoiceCallSlot, { sessionId: projectSessionId }), _jsx(QueuedPromptList, { rows: heldCommands.length > 0 ? [...queueRows.rows, ...heldCommandRows(heldCommands)] : queueRows.rows, heldCount: queueRows.heldCount, resumePending: resumePending, onResume: () => void handleResumeQueue(), onEdit: (id) => {
|
|
3326
|
+
queueEdit.takeBack(id);
|
|
3327
|
+
}, onRemove: (id) => {
|
|
3328
|
+
if (id.startsWith(HELD_COMMAND_ROW_PREFIX)) {
|
|
3329
|
+
const heldId = id.slice(HELD_COMMAND_ROW_PREFIX.length);
|
|
3330
|
+
setHeldCommands((held) => held.filter((entry) => entry.id !== heldId));
|
|
3331
|
+
return;
|
|
3332
|
+
}
|
|
3333
|
+
void handleRemoveQueuedMessage(id);
|
|
3334
|
+
}, onRetry: handleRetryQueuedMessage, onStopAndSend: effectiveBusy && canStop ? handleStopAndSendQueuedMessage : undefined, editing: queueEdit.editing, onCancelEdit: queueEdit.cancel })] })), [
|
|
3335
|
+
projectSessionId,
|
|
3311
3336
|
heldCommands,
|
|
3312
3337
|
queueEdit.editing,
|
|
3313
3338
|
queueEdit.cancel,
|
|
@@ -3629,7 +3654,21 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3629
3654
|
: undefined;
|
|
3630
3655
|
// A queued prompt is not in the runtime transcript yet;
|
|
3631
3656
|
// its author still shows (`authorForTurn`).
|
|
3632
|
-
const
|
|
3657
|
+
const promptAuthorId = pendingPromptsByMessageId.get(turn.id)?.author_user_id;
|
|
3658
|
+
const turnAuthor = authorForTurn(transcriptAuthors, messageAuthors, turn.id, pendingPrompt?.wire_message_id) ??
|
|
3659
|
+
participantAuthor(sessionParticipants, promptAuthorId) ??
|
|
3660
|
+
(sentHereIds.current.has(turn.id) ||
|
|
3661
|
+
sentHereIds.current.has(turnRenderKeys.get(turn.id) ?? '') ||
|
|
3662
|
+
(viewerId !== undefined && promptAuthorId === viewerId) ||
|
|
3663
|
+
// The first prompt of a session the viewer started,
|
|
3664
|
+
// sent from another surface (project home), before
|
|
3665
|
+
// the first authors read lands.
|
|
3666
|
+
(messageAuthorsLoading &&
|
|
3667
|
+
viewerId !== undefined &&
|
|
3668
|
+
projectSessionRow?.created_by === viewerId &&
|
|
3669
|
+
turn.id === userMessageIds[0])
|
|
3670
|
+
? viewerAsAuthor
|
|
3671
|
+
: undefined);
|
|
3633
3672
|
return (_jsx(TranscriptTurnRow
|
|
3634
3673
|
// ONE element per prompt: keyed by the id the
|
|
3635
3674
|
// bubble was FIRST painted under, so the swap to a
|
|
@@ -3646,14 +3685,23 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3646
3685
|
// more — at most one is visible at a time.)
|
|
3647
3686
|
viewportClassName: turnIndex === 0 || transcriptRows
|
|
3648
3687
|
? ''
|
|
3649
|
-
: // A compaction
|
|
3650
|
-
turn.compaction || turn.continues
|
|
3688
|
+
: // A compaction, the work after it and another agent's notice continue the turn above.
|
|
3689
|
+
turn.compaction || turn.continues || agentNoticeTurnIds.has(turn.id)
|
|
3651
3690
|
? 'mt-6'
|
|
3652
3691
|
: lastTurnWorking &&
|
|
3653
3692
|
pendingTurnIds.has(turn.id) &&
|
|
3654
3693
|
pendingTurnIds.has(turns[turnIndex - 1].id)
|
|
3655
3694
|
? 'mt-3'
|
|
3656
|
-
: 'mt-12', turn: turn, author: turnAuthor,
|
|
3695
|
+
: 'mt-12', turn: turn, author: turnAuthor,
|
|
3696
|
+
// Reserve the sender row while the authors load,
|
|
3697
|
+
// for a queued prompt whose sender is known, and
|
|
3698
|
+
// for a live message until its author resolves.
|
|
3699
|
+
showAuthor: !!turnAuthor ||
|
|
3700
|
+
messageAuthorsLoading ||
|
|
3701
|
+
!!promptAuthorId ||
|
|
3702
|
+
(loadedUserIds?.sessionId === sessionId &&
|
|
3703
|
+
!loadedUserIds.ids.has(turn.id) &&
|
|
3704
|
+
authorsGaveUp !== missingAuthors), stoppedBy: stoppedByName(messageAuthors, turn.id, viewerId), servedModel: servedModelOfTurn(modelUsage, turn.id, turns[turnIndex - 1]?.id), turnOutcome: turnOutcome, isLast: turn.id === lastUserMessageId, ownsPlan: turn.id === planAnchorId, sessionId: sessionId, projectId: projectId, projectSessionId: projectSessionId, sessionStatus: sessionStatus, permissions: pendingPermissions, questions: pendingQuestions, agentNames: agentNames, isFirstTurn: turnIndex === 0,
|
|
3657
3705
|
// Handed over only once the stand-in has stepped
|
|
3658
3706
|
// aside — while it is up it draws these itself.
|
|
3659
3707
|
pendingText: turnIndex === 0 ? firstTurnHandover?.text : undefined, pendingAttachments: sentAttachmentsForTurn({
|
|
@@ -3,6 +3,7 @@ import { type SessionLogBlock, type SessionLogMessage, type SessionLogTurn, type
|
|
|
3
3
|
import type { AttachmentUploadStatus, NormalizedAttachment } from '../turn/user-message.js';
|
|
4
4
|
import type { TurnServedModel } from '../turn/served-model.js';
|
|
5
5
|
import { type NoticeBatchItem, type SubagentNotice } from '../turn/subagent-notice.js';
|
|
6
|
+
import { type PeerMessagePromptInfo } from '../../_vendor/shared/index.js';
|
|
6
7
|
import { type SentAttachment } from '../composer/sent-attachment-previews.js';
|
|
7
8
|
import { type KortixSystemMessage, type SessionReport } from '../../internal/lib/utils/kortix-system-tags.js';
|
|
8
9
|
import { type Command, type PermissionRequest, type QuestionRequest } from '../../internal/session-types/index.js';
|
|
@@ -285,6 +286,13 @@ type PromptText = {
|
|
|
285
286
|
* A user message's text as its v1 text parts held it: a text block, or an
|
|
286
287
|
* `ignored` text (a model-invisible `harness` block whose data is the part).
|
|
287
288
|
*/
|
|
289
|
+
/**
|
|
290
|
+
* Whether a turn's prompt is a notice from another agent, not something a
|
|
291
|
+
* person wrote: a peer message (`send_message`), a subagent or teammate that
|
|
292
|
+
* finished, or a batch of those. The agent's work continues across it, so the
|
|
293
|
+
* thread spaces it like a continuation, not like a new prompt.
|
|
294
|
+
*/
|
|
295
|
+
export declare function isAgentNoticeTurn(turn: Pick<SessionLogTurn, 'user'>): boolean;
|
|
288
296
|
export declare function promptTexts(message: SessionLogMessage): PromptText[];
|
|
289
297
|
/** The user side of the turn: the worker-run report, the system pills, the
|
|
290
298
|
* bubble's visibility, and the command pill. */
|
|
@@ -292,6 +300,7 @@ declare function useTurnUserContent({ turn, commandMessages, commands, }: Pick<S
|
|
|
292
300
|
sessionReport: SessionReport | null;
|
|
293
301
|
noticeBatch: NoticeBatchItem[] | null;
|
|
294
302
|
subagentNotice: SubagentNotice | null;
|
|
303
|
+
peerMessage: PeerMessagePromptInfo | null;
|
|
295
304
|
systemMessages: KortixSystemMessage[];
|
|
296
305
|
hasVisibleUserContent: boolean;
|
|
297
306
|
userMessageText: string;
|