@kortix/ui 0.15.8 → 0.15.10
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/kortix-shared.js +75 -1
- package/dist/_vendor/shared/index.d.ts +1 -0
- package/dist/_vendor/shared/session/attachment-tile.d.ts +32 -0
- package/dist/_vendor/shared/session/stop-refusal.d.ts +15 -0
- package/dist/_vendor/shared/session/tool-row-text.d.ts +58 -0
- package/dist/_vendor/shared/session-delivery.d.ts +2 -0
- package/dist/access/access/access-dialog-share.js +12 -6
- package/dist/access/access/share-selection.d.ts +9 -0
- package/dist/access/access/share-selection.js +64 -0
- package/dist/customize/connectors/connector-identity.js +3 -3
- package/dist/customize/connectors/connectors-page.js +1 -1
- package/dist/customize/connectors/detail/app-page.js +2 -2
- package/dist/customize/connectors/detail/connector-accounts.d.ts +3 -1
- package/dist/customize/connectors/detail/connector-accounts.js +2 -2
- package/dist/customize/connectors/detail/connector-notice-view.d.ts +4 -0
- package/dist/customize/connectors/detail/connector-notice-view.js +4 -0
- package/dist/customize/connectors/detail/connector-notice.d.ts +31 -4
- package/dist/customize/connectors/detail/connector-notice.js +23 -4
- package/dist/customize/connectors/detail/connector-page.js +35 -10
- package/dist/customize/connectors/detail/connector-status.d.ts +12 -1
- package/dist/customize/connectors/detail/connector-status.js +11 -0
- package/dist/customize/connectors/detail/status-badge.d.ts +3 -3
- package/dist/customize/connectors/detail/status-badge.js +2 -1
- package/dist/customize/connectors/detail/use-connector-detail.js +10 -2
- package/dist/customize/connectors/detail/use-mcp-oauth-sign-in.d.ts +13 -0
- package/dist/customize/connectors/detail/use-mcp-oauth-sign-in.js +29 -0
- package/dist/customize/connectors/install/use-install.js +1 -1
- package/dist/customize/providers/provider-accordion.js +9 -8
- package/dist/customize/providers/provider-connect.d.ts +3 -3
- package/dist/customize/providers/provider-connect.js +10 -16
- package/dist/customize/providers/provider-sheet.js +13 -8
- package/dist/customize/sections/component/email-connect-form.js +4 -2
- package/dist/customize/sections/connector-connection-form.d.ts +0 -1
- package/dist/customize/sections/connector-connection-form.js +0 -9
- package/dist/customize/sections/connectors-view.d.ts +4 -1
- package/dist/customize/sections/connectors-view.js +42 -7
- package/dist/customize/sections/view/account-secret-resources-panel.d.ts +15 -0
- package/dist/customize/sections/view/account-secret-resources-panel.js +44 -5
- package/dist/customize/sections/view/review-center-connected.js +7 -3
- package/dist/customize/sections/view/secret-delivery.d.ts +9 -2
- package/dist/customize/sections/view/secret-delivery.js +14 -4
- package/dist/customize/sections/view/secrets-view.js +21 -5
- package/dist/customize/settings/tabs/workspace-keys.js +53 -11
- package/dist/customize/shared/feature-gate-screen.js +1 -1
- package/dist/customize/triggers/schedule/event-account-picker.js +1 -1
- package/dist/customize/triggers/schedule/schedule-builder.js +1 -1
- package/dist/customize/triggers/schedule/schedule-copy.js +4 -0
- package/dist/customize/triggers/schedule/schedule-detail-sheet.js +14 -3
- package/dist/customize/triggers/schedule/then-fields.d.ts +3 -1
- package/dist/customize/triggers/schedule/then-fields.js +8 -4
- package/dist/customize/triggers/schedule/trigger-composer.js +1 -1
- package/dist/customize/triggers/schedule/trigger-list.d.ts +3 -1
- package/dist/customize/triggers/schedule/trigger-list.js +18 -2
- package/dist/customize/triggers/schedule/trigger-runs-logic.js +4 -2
- package/dist/customize/triggers/schedule/trigger-runs-panel.js +4 -1
- package/dist/customize/triggers/schedule/use-event-app-connect.js +2 -1
- package/dist/files/renderers/pptx-renderer.js +5 -20
- package/dist/files/renderers/presentation/FullScreenPresentationViewer.d.ts +3 -2
- package/dist/files/renderers/presentation/FullScreenPresentationViewer.js +23 -304
- package/dist/files/renderers/presentation/presentation-export-menu.d.ts +14 -0
- package/dist/files/renderers/presentation/presentation-export-menu.js +44 -0
- package/dist/files/renderers/presentation/presentation-utils.d.ts +1 -0
- package/dist/files/renderers/presentation/presentation-utils.js +4 -0
- package/dist/files/renderers/presentation/slide-iframe.d.ts +23 -0
- package/dist/files/renderers/presentation/slide-iframe.js +61 -0
- package/dist/files/renderers/presentation/use-presentation-metadata.d.ts +39 -0
- package/dist/files/renderers/presentation/use-presentation-metadata.js +137 -0
- package/dist/files/renderers/presentation/use-slide-navigation.d.ts +17 -0
- package/dist/files/renderers/presentation/use-slide-navigation.js +82 -0
- package/dist/files/renderers/shared/use-stage-fit-scale.d.ts +19 -0
- package/dist/files/renderers/shared/use-stage-fit-scale.js +41 -0
- package/dist/files/renderers/show-content-renderer.js +16 -11
- package/dist/files/renderers/xlsx/xlsx-renderer.d.ts +4 -13
- package/dist/files/renderers/xlsx/xlsx-renderer.js +6 -63
- package/dist/files/renderers/xlsx/xlsx-viewer.d.ts +4 -2
- package/dist/files/renderers/xlsx/xlsx-viewer.js +28 -34
- package/dist/files/viewer/file-content-renderer.js +1 -4
- package/dist/files/viewer/use-file-content-state.js +10 -9
- package/dist/i18n/en.d.ts +55 -7
- package/dist/i18n/en.js +59 -11
- package/dist/internal/billing/compute-pricing.d.ts +7 -1
- package/dist/internal/billing/compute-pricing.js +7 -1
- package/dist/internal/chrome/use-chrome-offered.d.ts +2 -1
- package/dist/internal/chrome/use-chrome-offered.js +4 -2
- package/dist/internal/hooks/connectors/invalidate-connections.d.ts +10 -0
- package/dist/internal/hooks/connectors/invalidate-connections.js +18 -0
- package/dist/internal/hooks/connectors/use-finish-sign-in.d.ts +13 -0
- package/dist/internal/hooks/connectors/use-finish-sign-in.js +33 -0
- package/dist/internal/hooks/connectors/use-pipedream-connect-member.js +6 -1
- package/dist/internal/hooks/connectors/use-pipedream-connect-project.js +6 -1
- package/dist/internal/hooks/projects/use-new-project-session.d.ts +2 -0
- package/dist/internal/hooks/projects/use-new-project-session.js +4 -1
- package/dist/internal/hooks/use-review-session-summary.d.ts +1 -1
- package/dist/internal/hooks/use-review-session-summary.js +1 -1
- package/dist/internal/lib/browser-noise/rules/injected-scripts.js +2 -2
- package/dist/internal/lib/error-handler.js +33 -0
- package/dist/internal/lib/trigger-clock.d.ts +7 -2
- package/dist/internal/lib/trigger-clock.js +17 -3
- package/dist/internal/notifications/notification-inbox.d.ts +4 -10
- package/dist/internal/notifications/notification-inbox.js +8 -9
- package/dist/internal/stores/connector-gate-store.d.ts +3 -1
- package/dist/internal/stores/connector-gate-store.js +13 -3
- package/dist/internal/stores/upgrade-dialog-store.d.ts +4 -0
- package/dist/internal/stores/upgrade-dialog-store.js +2 -0
- package/dist/lib/routes.d.ts +4 -11
- package/dist/lib/routes.js +3 -5
- package/dist/lib/z-stack.d.ts +5 -1
- package/dist/lib/z-stack.js +12 -2
- package/dist/markdown/unified-markdown-utils.d.ts +7 -0
- package/dist/markdown/unified-markdown-utils.js +19 -0
- package/dist/markdown/unified-markdown.js +16 -3
- package/dist/primitives/alert-dialog.js +1 -1
- package/dist/primitives/dialog.js +3 -1
- package/dist/primitives/drawer.js +1 -1
- package/dist/primitives/modal.js +1 -1
- package/dist/primitives/preview-image.js +1 -1
- package/dist/primitives/sheet.js +1 -1
- package/dist/session/composer/ComposerCard.js +4 -2
- package/dist/session/composer/attachment-tile.d.ts +2 -26
- package/dist/session/composer/attachment-tile.js +3 -47
- package/dist/session/composer/composer-chat-input.d.ts +2 -1
- package/dist/session/composer/composer-chat-input.js +2 -2
- package/dist/session/composer/composer.d.ts +2 -0
- package/dist/session/composer/composer.js +5 -8
- package/dist/session/composer/draft/home-composer-focus-handoff.d.ts +7 -0
- package/dist/session/composer/draft/home-composer-focus-handoff.js +94 -0
- package/dist/session/composer/draft/use-composer-draft.d.ts +3 -1
- package/dist/session/composer/draft/use-composer-draft.js +22 -2
- package/dist/session/composer/editor/composer-editor.d.ts +4 -2
- package/dist/session/composer/editor/composer-editor.js +7 -3
- package/dist/session/composer/hooks/use-composer-focus.js +4 -2
- package/dist/session/index.d.ts +1 -0
- package/dist/session/index.js +1 -0
- package/dist/session/models/chatgpt-connection-button.js +5 -9
- package/dist/session/models/model-connection-gate.d.ts +2 -1
- package/dist/session/models/model-connection-gate.js +21 -5
- package/dist/session/models/model-connection-layout.d.ts +2 -0
- package/dist/session/models/model-connection-layout.js +4 -0
- package/dist/session/models/model-picker-panel.js +6 -2
- package/dist/session/models/model-selector.d.ts +1 -1
- package/dist/session/models/model-selector.js +9 -6
- package/dist/session/models/provider-key-action.d.ts +10 -0
- package/dist/session/models/provider-key-action.js +35 -0
- package/dist/session/models/provider-key-slot.d.ts +9 -0
- package/dist/session/models/provider-key-slot.js +19 -0
- package/dist/session/models/subscription-offer.d.ts +4 -0
- package/dist/session/models/subscription-offer.js +11 -3
- package/dist/session/overrides/session-overrides-toolbar.js +2 -4
- package/dist/session/prompts/ask-deck.d.ts +5 -1
- package/dist/session/prompts/ask-deck.js +15 -3
- package/dist/session/prompts/question-labels.d.ts +16 -0
- package/dist/session/prompts/question-labels.js +34 -0
- package/dist/session/prompts/question-prompt.js +6 -6
- package/dist/session/prompts/session-connect-prompt.d.ts +40 -0
- package/dist/session/prompts/session-connect-prompt.js +126 -0
- package/dist/session/status/provisioning-failure.d.ts +23 -2
- package/dist/session/status/provisioning-failure.js +53 -3
- package/dist/session/status/session-error-banner.d.ts +1 -1
- package/dist/session/status/session-error-banner.js +12 -4
- package/dist/session/status/stop-refusal.d.ts +6 -12
- package/dist/session/status/stop-refusal.js +6 -19
- package/dist/session/thread/agent-run-props.d.ts +19 -0
- package/dist/session/thread/agent-run-props.js +54 -0
- package/dist/session/thread/session-chat.js +34 -6
- package/dist/session/thread/transcript.d.ts +17 -1
- package/dist/session/thread/transcript.js +104 -16
- package/dist/session/tool/tools/bash-tool.d.ts +3 -52
- package/dist/session/tool/tools/bash-tool.js +3 -86
- package/dist/session/turn/answer-streaming.d.ts +21 -0
- package/dist/session/turn/answer-streaming.js +34 -0
- package/dist/session/turn/queued-prompt-bubbles.d.ts +5 -0
- package/dist/session/turn/queued-prompt-bubbles.js +12 -0
- package/dist/session/turn/turn-work-accordion.d.ts +3 -1
- package/dist/session/turn/turn-work-accordion.js +2 -2
- package/dist/styles.css +1 -1
- package/dist/test-utils/intl.d.ts +55 -7
- package/dist/workspace/home/first-chat.d.ts +7 -1
- package/dist/workspace/home/first-chat.js +12 -5
- package/dist/workspace/inbox/workspace-inbox.d.ts +6 -16
- package/dist/workspace/inbox/workspace-inbox.js +9 -51
- package/dist/workspace/layout/project-home.js +5 -11
- package/dist/workspace/layout/use-project-home-send.d.ts +2 -0
- package/dist/workspace/layout/use-project-home-send.js +29 -15
- package/dist/workspace/new/advanced-fields.d.ts +4 -1
- package/dist/workspace/new/advanced-fields.js +2 -2
- package/dist/workspace/new/workspace-name.d.ts +9 -0
- package/dist/workspace/new/workspace-name.js +20 -0
- package/dist/workspace/projects/session-starter.d.ts +6 -4
- package/dist/workspace/projects/session-starter.js +8 -14
- package/dist/workspace/review/review-center.d.ts +6 -2
- package/dist/workspace/review/review-center.js +45 -25
- package/dist/workspace/sidebar/workspace-menu-model.d.ts +3 -5
- package/dist/workspace/sidebar/workspace-menu-model.js +1 -1
- package/package.json +3 -7
- package/skills/kortix-ui/references/modules.md +1 -1
- package/dist/customize/connectors/invalidate-connections.d.ts +0 -2
- package/dist/customize/connectors/invalidate-connections.js +0 -4
- package/dist/internal/notifications/use-inbox-summary.d.ts +0 -17
- package/dist/internal/notifications/use-inbox-summary.js +0 -28
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
import { Badge } from '../../primitives/badge.js';
|
|
4
4
|
import { Close } from '../../icons/close.js';
|
|
5
5
|
import { cn } from '../../lib/utils.js';
|
|
6
|
+
import { attachmentExtension, isPreviewableImage, splitFilenameForTile, } from '../../_vendor/kortix-shared.js';
|
|
6
7
|
/** The square every attachment is. `size-28` (~103px on the 0.23rem scale) —
|
|
7
8
|
* Jay's call, 2026-09-06: the 88px square read as cramped beside the name. */
|
|
8
9
|
export const TILE_SURFACE = 'border-border bg-popover relative block size-28 shrink-0 overflow-hidden rounded-md border text-left';
|
|
@@ -11,53 +12,8 @@ export const TILE_SURFACE = 'border-border bg-popover relative block size-28 shr
|
|
|
11
12
|
* the file, opens the lightbox). A tile with no handler carries no promise.
|
|
12
13
|
*/
|
|
13
14
|
export const TILE_INTERACTIVE = 'hover:bg-accent cursor-pointer transition-colors duration-fast active:scale-[0.96]';
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
* that happens to draw — a logo file on a tile is a black blob at 100px, and
|
|
17
|
-
* its name is what tells it from the next logo file (Jay, 2026-09-06). It
|
|
18
|
-
* gets the named treatment, badge and all.
|
|
19
|
-
*/
|
|
20
|
-
export function isPreviewableImage(filename, mime) {
|
|
21
|
-
const ext = attachmentExtension(filename, mime);
|
|
22
|
-
if (ext === 'svg')
|
|
23
|
-
return false;
|
|
24
|
-
return (mime ?? '').toLowerCase().startsWith('image/');
|
|
25
|
-
}
|
|
26
|
-
/** What the tile prints in the file's corner. Lowercase, from the name first
|
|
27
|
-
* and the MIME subtype second; empty when neither says anything. */
|
|
28
|
-
export function attachmentExtension(filename, mime) {
|
|
29
|
-
const dot = filename.lastIndexOf('.');
|
|
30
|
-
if (dot > 0 && dot < filename.length - 1) {
|
|
31
|
-
const ext = filename
|
|
32
|
-
.slice(dot + 1)
|
|
33
|
-
.trim()
|
|
34
|
-
.toLowerCase();
|
|
35
|
-
if (ext.length > 0 && ext.length <= 8 && !/\s/.test(ext))
|
|
36
|
-
return ext;
|
|
37
|
-
}
|
|
38
|
-
const subtype = (mime ?? '').split('/')[1]?.split(';')[0]?.trim().toLowerCase() ?? '';
|
|
39
|
-
if (!subtype)
|
|
40
|
-
return '';
|
|
41
|
-
// `svg+xml` → `svg`, `x-icon` → `icon`, `vnd.ms-excel` → `excel`.
|
|
42
|
-
return subtype.split('+')[0].replace(/^x-/, '').split('.').pop() ?? '';
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* How a name is laid out on the tile.
|
|
46
|
-
*
|
|
47
|
-
* A short name wraps over two lines as the browser sees fit. A long one is
|
|
48
|
-
* split: the first line is the head, ellipsized by CSS at the tile's edge, and
|
|
49
|
-
* the second line is the last ten characters verbatim — the part that carries
|
|
50
|
-
* the extension and tells `…-chatux.md` from `…-ux.md`. A single middle
|
|
51
|
-
* ellipsis in one string wrapped wherever the browser chose, and left a
|
|
52
|
-
* dangling hyphen at the end of line one (2026-09-06).
|
|
53
|
-
*/
|
|
54
|
-
export const LONG_NAME_THRESHOLD = 24;
|
|
55
|
-
export const NAME_TAIL_CHARS = 10;
|
|
56
|
-
export function splitFilenameForTile(name) {
|
|
57
|
-
if (name.length <= LONG_NAME_THRESHOLD)
|
|
58
|
-
return null;
|
|
59
|
-
return { head: name.slice(0, -NAME_TAIL_CHARS), tail: name.slice(-NAME_TAIL_CHARS) };
|
|
60
|
-
}
|
|
15
|
+
/** The five tile rules live once in `@kortix/shared/session/attachment-tile`. */
|
|
16
|
+
export { LONG_NAME_THRESHOLD, NAME_TAIL_CHARS, attachmentExtension, isPreviewableImage, splitFilenameForTile, } from '../../_vendor/kortix-shared.js';
|
|
61
17
|
/** A tile previews the head of the paste only: the clamp shows four lines, and the DOM need not hold 100 kB. */
|
|
62
18
|
export const PASTE_PREVIEW_CHARS = 400;
|
|
63
19
|
/**
|
|
@@ -35,7 +35,7 @@ export interface ComposerChatCall {
|
|
|
35
35
|
* The current selections are handed to `onSend` / `onCommand` as `options`, so
|
|
36
36
|
* callers never need their own `useRuntimeLocal`.
|
|
37
37
|
*/
|
|
38
|
-
export declare function ComposerChatInput({ onSend, onCommand, sessionId, projectId, isBusy, sessionWorking, runtimeReady, stopDisabled, isSending, disabled, autoFocus, placeholder, hint, prefill, onPrefillApplied, aboveSlot, inputSlot, toolbarSlot, underbarPlacement, slashMenuPlacement, cardClassName, parentClassName, boundAgentName, lockAgent, defaultAgentName, channelAgentNames, projectSession, clearOnSend, onAgentSelectionChange, sandboxSlot, draftScope, draftActive, promptAttachments, submitLabel, onArrowUpAtStart, call, }: {
|
|
38
|
+
export declare function ComposerChatInput({ onSend, onCommand, sessionId, projectId, isBusy, sessionWorking, runtimeReady, stopDisabled, isSending, disabled, autoFocus, placeholder, hint, prefill, onPrefillApplied, aboveSlot, inputSlot, toolbarSlot, underbarPlacement, slashMenuPlacement, cardClassName, parentClassName, boundAgentName, lockAgent, defaultAgentName, channelAgentNames, projectSession, clearOnSend, onAgentSelectionChange, sandboxSlot, draftScope, draftHandoffScope, draftActive, promptAttachments, submitLabel, onArrowUpAtStart, call, }: {
|
|
39
39
|
onSend: (text: string, files: AttachedFile[] | undefined, options: ComposerOptions, attachments?: AttachmentSubmission) => void | Promise<void>;
|
|
40
40
|
onCommand?: (command: Command, args: string | undefined, options: ComposerOptions) => void;
|
|
41
41
|
sessionId?: string;
|
|
@@ -103,6 +103,7 @@ export declare function ComposerChatInput({ onSend, onCommand, sessionId, projec
|
|
|
103
103
|
sandboxSlot?: SessionOverrideSlot;
|
|
104
104
|
/** Persist the unsent draft under this scope — see `composer/draft/`. */
|
|
105
105
|
draftScope?: DraftScope | null;
|
|
106
|
+
draftHandoffScope?: import('react').RefObject<DraftScope | null>;
|
|
106
107
|
draftActive?: boolean;
|
|
107
108
|
/** Host-owned upload controller. See `SessionChatInputProps.promptAttachments`. */
|
|
108
109
|
promptAttachments?: SessionChatInputProps['promptAttachments'];
|
|
@@ -17,7 +17,7 @@ import { inheritedModelFor } from './chat-input/chat-input-summary.js';
|
|
|
17
17
|
* The current selections are handed to `onSend` / `onCommand` as `options`, so
|
|
18
18
|
* callers never need their own `useRuntimeLocal`.
|
|
19
19
|
*/
|
|
20
|
-
export function ComposerChatInput({ onSend, onCommand, sessionId, projectId, isBusy, sessionWorking, runtimeReady, stopDisabled, isSending, disabled, autoFocus, placeholder, hint, prefill, onPrefillApplied, aboveSlot, inputSlot, toolbarSlot, underbarPlacement, slashMenuPlacement, cardClassName, parentClassName, boundAgentName, lockAgent = false, defaultAgentName, channelAgentNames, projectSession, clearOnSend, onAgentSelectionChange, sandboxSlot, draftScope, draftActive, promptAttachments, submitLabel, onArrowUpAtStart, call, }) {
|
|
20
|
+
export function ComposerChatInput({ onSend, onCommand, sessionId, projectId, isBusy, sessionWorking, runtimeReady, stopDisabled, isSending, disabled, autoFocus, placeholder, hint, prefill, onPrefillApplied, aboveSlot, inputSlot, toolbarSlot, underbarPlacement, slashMenuPlacement, cardClassName, parentClassName, boundAgentName, lockAgent = false, defaultAgentName, channelAgentNames, projectSession, clearOnSend, onAgentSelectionChange, sandboxSlot, draftScope, draftHandoffScope, draftActive, promptAttachments, submitLabel, onArrowUpAtStart, call, }) {
|
|
21
21
|
const contextAutoFocus = useContext(ComposerAutoFocusContext);
|
|
22
22
|
const { data: rosterAgents } = useRuntimeAgents({ projectId });
|
|
23
23
|
const agents = useMemo(() => withChannelAgents(rosterAgents, channelAgentNames), [rosterAgents, channelAgentNames]);
|
|
@@ -151,7 +151,7 @@ export function ComposerChatInput({ onSend, onCommand, sessionId, projectId, isB
|
|
|
151
151
|
// A thread a space's chat opened by itself does not take the focus (`ComposerAutoFocusContext`).
|
|
152
152
|
autoFocus: autoFocus ?? (contextAutoFocus ? undefined : false), placeholder: placeholder, hint: hint, prefill: deliveredPrefill, onPrefillApplied: onPrefillApplied, aboveSlot: aboveSlot, inputSlot: inputSlot, toolbarSlot: combinedToolbarSlot, underbarPlacement: underbarPlacement, slashMenuPlacement: slashMenuPlacement, cardClassName: cardClassName, parentClassName: parentClassName, sessionId: sessionId, projectId: projectId, providers: providers, agents: local.agent.list, selectedAgent: selectedAgentName, noAccessibleAgents: noAccessibleAgents, agentLocked: agentLocked,
|
|
153
153
|
// A locked agent has nothing to switch to: no handler is the composer's "fixed agent" signal.
|
|
154
|
-
onAgentChange: agentLocked ? undefined : (name) => local.agent.set(name ?? undefined), models: local.model.list, selectedModel: local.model.currentKey ?? null, onModelChange: (m) => local.model.set(m ?? undefined, { recent: true }), inheritedModel: inheritedModelFor(local.model, selectedAgentName), modelRequired: true, modelsLoading: providersLoading, variants: local.model.variant.list, selectedVariant: local.model.variant.current ?? null, onVariantChange: (v) => local.model.variant.set(v ?? undefined), commands: commands || [], commandsResolved: commands !== undefined, draftScope: draftScope, draftActive: draftActive, submitLabel: submitLabel, onArrowUpAtStart: onArrowUpAtStart, call: call && selectedAgentName
|
|
154
|
+
onAgentChange: agentLocked ? undefined : (name) => local.agent.set(name ?? undefined), models: local.model.list, selectedModel: local.model.currentKey ?? null, onModelChange: (m) => local.model.set(m ?? undefined, { recent: true }), inheritedModel: inheritedModelFor(local.model, selectedAgentName), modelRequired: true, modelsLoading: providersLoading, variants: local.model.variant.list, selectedVariant: local.model.variant.current ?? null, onVariantChange: (v) => local.model.variant.set(v ?? undefined), commands: commands || [], commandsResolved: commands !== undefined, draftScope: draftScope, draftHandoffScope: draftHandoffScope, draftActive: draftActive, submitLabel: submitLabel, onArrowUpAtStart: onArrowUpAtStart, call: call && selectedAgentName
|
|
155
155
|
? { inCall: call.inCall, onCall: () => call.onCall({ ...options(), agent: selectedAgentName }) }
|
|
156
156
|
: undefined }));
|
|
157
157
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Agent, Command, FlatModel, ProviderListResponse, UsePromptAttachmentsResult } from '@kortix/sdk/react';
|
|
2
2
|
import { type SessionLogMessage } from '@kortix/sdk';
|
|
3
|
+
import type { RefObject } from 'react';
|
|
3
4
|
import { type ComposerSendReset } from './composer-reset.js';
|
|
4
5
|
import { type ModelDefaultControls } from '../models/model-selector.js';
|
|
5
6
|
import type { DraftScope } from './draft/composer-draft.js';
|
|
@@ -158,6 +159,7 @@ export interface SessionChatInputProps {
|
|
|
158
159
|
* marketing-demo composers rely on.
|
|
159
160
|
*/
|
|
160
161
|
draftScope?: DraftScope | null;
|
|
162
|
+
draftHandoffScope?: RefObject<DraftScope | null>;
|
|
161
163
|
draftActive?: boolean;
|
|
162
164
|
disabled?: boolean;
|
|
163
165
|
/**
|
|
@@ -103,18 +103,14 @@ const useNoSlashActions = () => NO_SLASH_ACTIONS;
|
|
|
103
103
|
function setDocumentWithoutStealingFocus(handle, doc) {
|
|
104
104
|
if (!handle)
|
|
105
105
|
return;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
handle.setDocument(doc);
|
|
110
|
-
if (!wasFocused) {
|
|
111
|
-
previouslyFocused?.focus?.();
|
|
112
|
-
}
|
|
106
|
+
// A focus command schedules a later animation frame. Restoring DOM focus
|
|
107
|
+
// immediately after it cannot cancel that scheduled focus.
|
|
108
|
+
handle.setDocument(doc, false);
|
|
113
109
|
}
|
|
114
110
|
function ComposerImpl(props) {
|
|
115
111
|
const { onSend, promptAttachments: hostPromptAttachments, isBusy = false, sessionWorking, runtimeReady = true, onStop, stopDisabled = false, isSending = false, rewind, agents = EMPTY_AGENTS, selectedAgent = null, onAgentChange, noAccessibleAgents = false, commands: runtimeCommands = EMPTY_COMMANDS,
|
|
116
112
|
/** Whether the live command list has EVER resolved — see `planUnresolvedCommandChip`. */
|
|
117
|
-
commandsResolved = false, slashFiles = EMPTY_SLASH_FILES, onCommand, onHoldCommand, models = EMPTY_MODELS, selectedModel = null, onModelChange, modelDefaultControls, variants = EMPTY_VARIANTS, selectedVariant = null, onVariantChange, messages, sessionId, projectId, draftScope = null, draftActive = true, disabled = false, notice = null, onNoticeRetry, clearOnSend = true, modelRequired = false, modelsLoading = false, autoFocus, placeholder = 'Ask anything…', hint, onArrowUpAtStart, prefill = null, onPrefillApplied, attachRequestId = null, providers, onContextClick, onCompactClick, inputSlot, toolbarSlot, underbarPlacement = 'below', slashMenuPlacement = 'above', cardClassName, quoteRequests = NO_QUOTE_REQUESTS, onQuoteRequestsApplied, lockForQuestion = false, lockForApproval = false, onCustomAnswer, questionButtonLabel = null, questionCanAct = true, onQuestionAction, escCount = 0, parentClassName, } = props;
|
|
113
|
+
commandsResolved = false, slashFiles = EMPTY_SLASH_FILES, onCommand, onHoldCommand, models = EMPTY_MODELS, selectedModel = null, onModelChange, modelDefaultControls, variants = EMPTY_VARIANTS, selectedVariant = null, onVariantChange, messages, sessionId, projectId, draftScope = null, draftHandoffScope, draftActive = true, disabled = false, notice = null, onNoticeRetry, clearOnSend = true, modelRequired = false, modelsLoading = false, autoFocus, placeholder = 'Ask anything…', hint, onArrowUpAtStart, prefill = null, onPrefillApplied, attachRequestId = null, providers, onContextClick, onCompactClick, inputSlot, toolbarSlot, underbarPlacement = 'below', slashMenuPlacement = 'above', cardClassName, quoteRequests = NO_QUOTE_REQUESTS, onQuoteRequestsApplied, lockForQuestion = false, lockForApproval = false, onCustomAnswer, questionButtonLabel = null, questionCanAct = true, onQuestionAction, escCount = 0, parentClassName, } = props;
|
|
118
114
|
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
119
115
|
const tModelGate = useTranslations('sessionUi.modelGate');
|
|
120
116
|
const tComposerAttachments = useTranslations('hardcodedUi.composerAttachments');
|
|
@@ -307,6 +303,7 @@ function ComposerImpl(props) {
|
|
|
307
303
|
const { handleDocChange, clearSavedDraft } = useComposerDraft({
|
|
308
304
|
active: draftActive,
|
|
309
305
|
scope: draftScope,
|
|
306
|
+
handoffScope: draftHandoffScope,
|
|
310
307
|
editorRef,
|
|
311
308
|
editorReady: editorElement != null,
|
|
312
309
|
attachedFiles,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DraftScope } from './composer-draft.js';
|
|
2
|
+
import type { ComposerEditorHandle } from '../editor/composer-editor.js';
|
|
3
|
+
/** Called by the destination's draft lifecycle after restoration, including an empty draft. */
|
|
4
|
+
export declare function completeHomeComposerFocus(scope: DraftScope, editor: ComposerEditorHandle): void;
|
|
5
|
+
export declare function registerHomeComposerEditor(editor: ComposerEditorHandle | null): void;
|
|
6
|
+
/** Own only BODY keyboard input between the home editor and its destination restore. */
|
|
7
|
+
export declare function handoffHomeComposerFocus(sessionId: string, userId: string): void;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { EditorState, TextSelection } from '@tiptap/pm/state';
|
|
2
|
+
import { deleteSelection, joinBackward, selectNodeBackward, splitBlock } from '@tiptap/pm/commands';
|
|
3
|
+
import { readDraft, writeDraft } from './composer-draft-store.js';
|
|
4
|
+
import { serializeDraft } from './composer-draft.js';
|
|
5
|
+
let pending = null;
|
|
6
|
+
/** Called by the destination's draft lifecycle after restoration, including an empty draft. */
|
|
7
|
+
export function completeHomeComposerFocus(scope, editor) {
|
|
8
|
+
if (scope.kind === 'session' && pending?.sessionId === scope.sessionId)
|
|
9
|
+
pending.finish(editor);
|
|
10
|
+
}
|
|
11
|
+
/** The source registers its handle; no global textbox search chooses the destination. */
|
|
12
|
+
let sourceEditor = null;
|
|
13
|
+
export function registerHomeComposerEditor(editor) {
|
|
14
|
+
sourceEditor = editor;
|
|
15
|
+
}
|
|
16
|
+
/** Own only BODY keyboard input between the home editor and its destination restore. */
|
|
17
|
+
export function handoffHomeComposerFocus(sessionId, userId) {
|
|
18
|
+
const original = document.activeElement;
|
|
19
|
+
if (!(original instanceof HTMLElement) || !original.matches('[contenteditable="true"][role="textbox"]'))
|
|
20
|
+
return;
|
|
21
|
+
const schema = sourceEditor?.getEditingState()?.schema;
|
|
22
|
+
if (!schema)
|
|
23
|
+
return;
|
|
24
|
+
let state = null;
|
|
25
|
+
const scope = { kind: 'session', sessionId };
|
|
26
|
+
let timer;
|
|
27
|
+
const stop = () => {
|
|
28
|
+
if (pending?.finish === finish)
|
|
29
|
+
pending = null;
|
|
30
|
+
clearTimeout(timer);
|
|
31
|
+
document.removeEventListener('keydown', onKey, true);
|
|
32
|
+
document.removeEventListener('pointerdown', stop, true);
|
|
33
|
+
document.removeEventListener('focusin', onFocus, true);
|
|
34
|
+
};
|
|
35
|
+
const finish = (editor) => {
|
|
36
|
+
const ownsFocus = document.activeElement === document.body || document.activeElement === editor.getElement();
|
|
37
|
+
stop();
|
|
38
|
+
const element = editor.getElement();
|
|
39
|
+
if (ownsFocus && element) {
|
|
40
|
+
element.focus();
|
|
41
|
+
const range = document.createRange();
|
|
42
|
+
range.selectNodeContents(element);
|
|
43
|
+
range.collapse(false);
|
|
44
|
+
const selection = window.getSelection();
|
|
45
|
+
selection?.removeAllRanges();
|
|
46
|
+
selection?.addRange(range);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const onFocus = (event) => {
|
|
50
|
+
if (event.target !== original && event.target !== document.body && event.target instanceof HTMLElement &&
|
|
51
|
+
!event.target.matches('[contenteditable="true"][role="textbox"]'))
|
|
52
|
+
stop();
|
|
53
|
+
};
|
|
54
|
+
const onKey = (event) => {
|
|
55
|
+
if (document.activeElement !== document.body || event.ctrlKey || event.metaKey || event.altKey)
|
|
56
|
+
return;
|
|
57
|
+
if (event.key.length !== 1 && event.key !== 'Backspace' && event.key !== 'Enter')
|
|
58
|
+
return;
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
const draft = readDraft(scope, userId) ?? serializeDraft({
|
|
61
|
+
doc: { type: 'doc', content: [] }, documentIsEmpty: false, files: [], userId,
|
|
62
|
+
});
|
|
63
|
+
if (!draft)
|
|
64
|
+
return;
|
|
65
|
+
if (!state) {
|
|
66
|
+
const doc = schema.nodeFromJSON(draft.doc);
|
|
67
|
+
state = EditorState.create({ schema, doc, selection: TextSelection.atEnd(doc) });
|
|
68
|
+
}
|
|
69
|
+
const dispatch = (transaction) => {
|
|
70
|
+
state = state.apply(transaction);
|
|
71
|
+
};
|
|
72
|
+
if (event.key === 'Backspace') {
|
|
73
|
+
if (!deleteSelection(state, dispatch)) {
|
|
74
|
+
const before = state.selection.$from.nodeBefore;
|
|
75
|
+
if (before?.isInline) {
|
|
76
|
+
const size = before.isText ? (Array.from(before.text ?? '').at(-1)?.length ?? 1) : before.nodeSize;
|
|
77
|
+
dispatch(state.tr.delete(state.selection.from - size, state.selection.from));
|
|
78
|
+
}
|
|
79
|
+
else if (!joinBackward(state, dispatch))
|
|
80
|
+
selectNodeBackward(state, dispatch);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else if (event.key === 'Enter')
|
|
84
|
+
splitBlock(state, dispatch);
|
|
85
|
+
else
|
|
86
|
+
dispatch(state.tr.insertText(event.key));
|
|
87
|
+
writeDraft(scope, { ...draft, doc: state.doc.toJSON() });
|
|
88
|
+
};
|
|
89
|
+
pending = { sessionId, finish };
|
|
90
|
+
document.addEventListener('keydown', onKey, true);
|
|
91
|
+
document.addEventListener('pointerdown', stop, true);
|
|
92
|
+
document.addEventListener('focusin', onFocus, true);
|
|
93
|
+
timer = window.setTimeout(stop, 30_000);
|
|
94
|
+
}
|
|
@@ -6,6 +6,8 @@ import type { AttachedFile } from '../types.js';
|
|
|
6
6
|
import { type DraftScope, type StoredDraft, type StoredUpload } from './composer-draft.js';
|
|
7
7
|
export interface UseComposerDraftInput {
|
|
8
8
|
active?: boolean;
|
|
9
|
+
/** Move the remaining home draft into the created session on unmount. */
|
|
10
|
+
handoffScope?: RefObject<DraftScope | null>;
|
|
9
11
|
/** Omitted or null → the composer persists nothing (marketing demo, tests). */
|
|
10
12
|
scope: DraftScope | null | undefined;
|
|
11
13
|
editorRef: RefObject<ComposerEditorHandle | null>;
|
|
@@ -46,4 +48,4 @@ export interface UseComposerDraftResult {
|
|
|
46
48
|
* render-silent while typing (`editor/composer-editor.tsx`'s `onEmptyChange`
|
|
47
49
|
* contract) and lifting the document into state would defeat it.
|
|
48
50
|
*/
|
|
49
|
-
export declare function useComposerDraft({ active, scope, editorRef, editorReady, attachedFiles, quotes, pastes, uploads, hasPrefill, onRestore, }: UseComposerDraftInput): UseComposerDraftResult;
|
|
51
|
+
export declare function useComposerDraft({ active, handoffScope, scope, editorRef, editorReady, attachedFiles, quotes, pastes, uploads, hasPrefill, onRestore, }: UseComposerDraftInput): UseComposerDraftResult;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { completeHomeComposerFocus, registerHomeComposerEditor } from './home-composer-focus-handoff.js';
|
|
2
3
|
import { useCallback, useEffect, useLayoutEffect, useRef } from 'react';
|
|
3
4
|
import { useUiViewerId } from '../../../providers/ui-provider.js';
|
|
4
5
|
import { useLatestRef } from '../hooks/use-latest-ref.js';
|
|
@@ -22,7 +23,13 @@ const NO_UPLOADS = [];
|
|
|
22
23
|
* render-silent while typing (`editor/composer-editor.tsx`'s `onEmptyChange`
|
|
23
24
|
* contract) and lifting the document into state would defeat it.
|
|
24
25
|
*/
|
|
25
|
-
export function useComposerDraft({ active = true, scope, editorRef, editorReady, attachedFiles, quotes = NO_QUOTES, pastes = NO_PASTES, uploads = NO_UPLOADS, hasPrefill, onRestore, }) {
|
|
26
|
+
export function useComposerDraft({ active = true, handoffScope, scope, editorRef, editorReady, attachedFiles, quotes = NO_QUOTES, pastes = NO_PASTES, uploads = NO_UPLOADS, hasPrefill, onRestore, }) {
|
|
27
|
+
useLayoutEffect(() => {
|
|
28
|
+
if (scope?.kind !== 'project' || !editorReady)
|
|
29
|
+
return;
|
|
30
|
+
registerHomeComposerEditor(editorRef.current);
|
|
31
|
+
return () => registerHomeComposerEditor(null);
|
|
32
|
+
}, [scope, editorReady, editorRef]);
|
|
26
33
|
const viewerId = useUiViewerId();
|
|
27
34
|
const userId = viewerId ?? '';
|
|
28
35
|
const enabled = !!scope && !!userId;
|
|
@@ -75,11 +82,20 @@ export function useComposerDraft({ active = true, scope, editorRef, editorReady,
|
|
|
75
82
|
activeRef.current = active;
|
|
76
83
|
if (!active)
|
|
77
84
|
flush();
|
|
85
|
+
const source = scopeRef.current;
|
|
86
|
+
const ownerId = userIdRef.current;
|
|
78
87
|
return () => {
|
|
79
88
|
flush();
|
|
89
|
+
const target = handoffScope?.current;
|
|
90
|
+
if (target && source && ownerId) {
|
|
91
|
+
const draft = readDraft(source, ownerId);
|
|
92
|
+
if (draft)
|
|
93
|
+
writeDraft(target, draft);
|
|
94
|
+
clearDraft(source);
|
|
95
|
+
}
|
|
80
96
|
activeRef.current = false;
|
|
81
97
|
};
|
|
82
|
-
}, [active, flush]);
|
|
98
|
+
}, [active, flush, handoffScope, scopeRef, userIdRef]);
|
|
83
99
|
const handleDocChange = useCallback((doc, isEmpty) => {
|
|
84
100
|
if (!activeRef.current || !scopeRef.current || !userIdRef.current)
|
|
85
101
|
return;
|
|
@@ -158,12 +174,16 @@ export function useComposerDraft({ active = true, scope, editorRef, editorReady,
|
|
|
158
174
|
hasPrefill,
|
|
159
175
|
alreadyRestored: restoredKeyRef.current === key,
|
|
160
176
|
})) {
|
|
177
|
+
if (active && editorReady && editorRef.current)
|
|
178
|
+
completeHomeComposerFocus(scope, editorRef.current);
|
|
161
179
|
return;
|
|
162
180
|
}
|
|
163
181
|
restoredKeyRef.current = key;
|
|
164
182
|
const stored = readDraft(scope, userId);
|
|
165
183
|
if (stored)
|
|
166
184
|
onRestore(stored);
|
|
185
|
+
if (editorRef.current)
|
|
186
|
+
completeHomeComposerFocus(scope, editorRef.current);
|
|
167
187
|
}, [active, scope, userId, editorReady, hasPrefill, editorRef, onRestore]);
|
|
168
188
|
return { handleDocChange, clearSavedDraft };
|
|
169
189
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EditorState } from '@tiptap/pm/state';
|
|
1
2
|
import type { Agent, Command, Session } from '@kortix/sdk/react';
|
|
2
3
|
import type { Editor, JSONContent } from '@tiptap/core';
|
|
3
4
|
import type { EditorView } from '@tiptap/pm/view';
|
|
@@ -54,6 +55,7 @@ export interface ComposerEditorHandle {
|
|
|
54
55
|
* blocks (built from the STRUCTURED `mentions` array, not the text) would
|
|
55
56
|
* then be missing entirely.
|
|
56
57
|
*/
|
|
58
|
+
getEditingState(): EditorState | null;
|
|
57
59
|
getDocument(): JSONContent;
|
|
58
60
|
/**
|
|
59
61
|
* Always replaces the whole document, same as `setContent`. A `mode`
|
|
@@ -65,7 +67,7 @@ export interface ComposerEditorHandle {
|
|
|
65
67
|
* merge, unlike `setContent`'s `textToParagraphs`, which only ever knows
|
|
66
68
|
* how to build plain text) and written back through this method.
|
|
67
69
|
*/
|
|
68
|
-
setDocument(doc: JSONContent): void;
|
|
70
|
+
setDocument(doc: JSONContent, focus?: boolean): void;
|
|
69
71
|
/**
|
|
70
72
|
* Insert literal text at the CURRENT cursor/selection — Task 13. The old
|
|
71
73
|
* plain `<textarea>` gave this for free via `setRangeText`; nothing here
|
|
@@ -259,7 +261,7 @@ onArrowDownAtEnd?: () => boolean): (view: EditorView, event: KeyboardEvent) => b
|
|
|
259
261
|
* are exercised directly in `composer-editor.test.ts`.
|
|
260
262
|
*/
|
|
261
263
|
export declare function getEditorDocument(editor: Editor | null): JSONContent;
|
|
262
|
-
export declare function setEditorDocument(editor: Editor | null, doc: JSONContent): void;
|
|
264
|
+
export declare function setEditorDocument(editor: Editor | null, doc: JSONContent, focus?: boolean): void;
|
|
263
265
|
/**
|
|
264
266
|
* Task 13, fix round 1, Important 2's specific regression guard: this must
|
|
265
267
|
* insert INLINE at the current selection (`editor.commands.insertContent`
|
|
@@ -140,7 +140,7 @@ const EMPTY_DOC = { type: 'doc', content: textToParagraphs('') };
|
|
|
140
140
|
export function getEditorDocument(editor) {
|
|
141
141
|
return editor ? editor.getJSON() : EMPTY_DOC;
|
|
142
142
|
}
|
|
143
|
-
export function setEditorDocument(editor, doc) {
|
|
143
|
+
export function setEditorDocument(editor, doc, focus = true) {
|
|
144
144
|
if (!editor)
|
|
145
145
|
return;
|
|
146
146
|
const content = doc.content ?? [];
|
|
@@ -148,7 +148,10 @@ export function setEditorDocument(editor, doc) {
|
|
|
148
148
|
// `scrollIntoView: false` — see the note on the `setContent` handle below.
|
|
149
149
|
// This is the same programmatic whole-document replace, so it wants the same
|
|
150
150
|
// treatment: put the caret at the end, move nothing.
|
|
151
|
-
|
|
151
|
+
if (focus)
|
|
152
|
+
editor.commands.focus('end', { scrollIntoView: false });
|
|
153
|
+
else
|
|
154
|
+
editor.commands.setTextSelection(editor.state.doc.content.size);
|
|
152
155
|
}
|
|
153
156
|
/**
|
|
154
157
|
* Task 13, fix round 1, Important 2's specific regression guard: this must
|
|
@@ -447,7 +450,8 @@ export const ComposerEditor = forwardRef(function ComposerEditor({ placeholder,
|
|
|
447
450
|
editor.commands.focus(caret, { scrollIntoView: false });
|
|
448
451
|
},
|
|
449
452
|
getDocument: () => getEditorDocument(editor),
|
|
450
|
-
|
|
453
|
+
getEditingState: () => editor?.state ?? null,
|
|
454
|
+
setDocument: (doc, focus) => setEditorDocument(editor, doc, focus),
|
|
451
455
|
insertAtCursor: (text) => insertTextAtCursor(editor, text),
|
|
452
456
|
clear: () => editor?.commands.setContent(EMPTY_DOC),
|
|
453
457
|
focus: () => editor?.commands.focus('end'),
|
|
@@ -80,14 +80,16 @@ export function useComposerFocus({ ref, autoFocus, disabled = false, onTypeAhead
|
|
|
80
80
|
const el = ref.current;
|
|
81
81
|
if (!el)
|
|
82
82
|
return;
|
|
83
|
+
const canTakeFocus = () => !hasOpenFocusOverlay() &&
|
|
84
|
+
(document.activeElement === el || !isEditableField(document.activeElement));
|
|
83
85
|
if (isVisible(el)) {
|
|
84
|
-
if (
|
|
86
|
+
if (canTakeFocus())
|
|
85
87
|
el.focus();
|
|
86
88
|
return;
|
|
87
89
|
}
|
|
88
90
|
const observer = new IntersectionObserver((entries) => {
|
|
89
91
|
if (entries[0]?.isIntersecting) {
|
|
90
|
-
if (
|
|
92
|
+
if (canTakeFocus())
|
|
91
93
|
ref.current?.focus();
|
|
92
94
|
observer.disconnect();
|
|
93
95
|
}
|
package/dist/session/index.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export { SessionConnectingBanner } from './status/session-starting-loader.js';
|
|
|
53
53
|
export { ChatMinimap } from './thread/chat-minimap.js';
|
|
54
54
|
export { SessionChat } from './thread/session-chat.js';
|
|
55
55
|
export { SessionTurn, TranscriptTurnRow, TurnAssistantBlock } from './thread/transcript.js';
|
|
56
|
+
export { useAgentRunLayout, type AgentRunLayout, type AgentRunRowProps } from './thread/agent-run-props.js';
|
|
56
57
|
export { ToolSurfaceContext, partOutcome } from './tool/shared/infrastructure.js';
|
|
57
58
|
export { ToolOutcomeContext } from './tool/shared/infrastructure-contexts.js';
|
|
58
59
|
export { ToolOutputFallback } from './tool/shared/infrastructure-output.js';
|
package/dist/session/index.js
CHANGED
|
@@ -51,6 +51,7 @@ export { SessionConnectingBanner } from './status/session-starting-loader.js';
|
|
|
51
51
|
export { ChatMinimap } from './thread/chat-minimap.js';
|
|
52
52
|
export { SessionChat } from './thread/session-chat.js';
|
|
53
53
|
export { SessionTurn, TranscriptTurnRow, TurnAssistantBlock } from './thread/transcript.js';
|
|
54
|
+
export { useAgentRunLayout } from './thread/agent-run-props.js';
|
|
54
55
|
export { ToolSurfaceContext, partOutcome } from './tool/shared/infrastructure.js';
|
|
55
56
|
export { ToolOutcomeContext } from './tool/shared/infrastructure-contexts.js';
|
|
56
57
|
export { ToolOutputFallback } from './tool/shared/infrastructure-output.js';
|
|
@@ -5,7 +5,7 @@ import { Button } from '../../primitives/button.js';
|
|
|
5
5
|
import { cn } from '../../lib/utils.js';
|
|
6
6
|
import { useSessionIds } from '../../providers/session-ids.js';
|
|
7
7
|
import { useUiComponents, useUiViewerId } from '../../providers/ui-provider.js';
|
|
8
|
-
import {
|
|
8
|
+
import { useModelAccess, useProjectSession, useSessionProviderSecretPools, } from '@kortix/sdk/react';
|
|
9
9
|
import { useState } from 'react';
|
|
10
10
|
import { chatGptActionApplies } from './chatgpt-connection-action.js';
|
|
11
11
|
import { sessionPersonalUser } from '../overrides/provider-pool-draft.js';
|
|
@@ -23,22 +23,18 @@ export function ChatGptConnectionSlot({ action, className = 'mt-2 pl-7', }) {
|
|
|
23
23
|
return _jsx(ChatGptConnectionButton, { action: action, projectId: projectId, sessionId: sessionId, className: className });
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* Opens the ChatGPT accounts dialog
|
|
27
|
-
* secrets and the LLM gateway on. Shown only where connecting or
|
|
26
|
+
* Opens the ChatGPT accounts dialog. Shown only where connecting or
|
|
28
27
|
* reconnecting an account can fix this session (`chatGptActionApplies`).
|
|
29
28
|
*/
|
|
30
29
|
function ChatGptConnectionButton({ action, projectId, sessionId, className, }) {
|
|
31
30
|
const t = useTranslations('pooledSecrets');
|
|
32
31
|
const viewerId = useUiViewerId();
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const session = useProjectSession(projectId, sessionId, { enabled });
|
|
37
|
-
const pools = useSessionProviderSecretPools(enabled ? projectId : null, sessionId);
|
|
32
|
+
const access = useModelAccess(projectId);
|
|
33
|
+
const session = useProjectSession(projectId, sessionId);
|
|
34
|
+
const pools = useSessionProviderSecretPools(projectId, sessionId);
|
|
38
35
|
const [open, setOpen] = useState(false);
|
|
39
36
|
const { ProviderAccountsModal } = useUiComponents();
|
|
40
37
|
const applies = !!ProviderAccountsModal &&
|
|
41
|
-
enabled &&
|
|
42
38
|
!(access.data?.disabledProviders ?? []).includes('codex') &&
|
|
43
39
|
chatGptActionApplies({
|
|
44
40
|
action,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* No model can run: the composer shows the same "Connect ChatGPT" and "Connect
|
|
3
3
|
* Claude" rows the project home offers (`ConnectPlanRows`), a gap below the
|
|
4
|
-
* composer,
|
|
4
|
+
* composer by default, and above it on first-chat home. The rows are not
|
|
5
|
+
* dismissible. Sending is already disabled by `modelUnavailable`.
|
|
5
6
|
*
|
|
6
7
|
* It used to be a heading ("Connect a model to start"), two bordered tiles,
|
|
7
8
|
* "Use an API key" and "Upgrade". On the project home it stacked on top of the
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { ImageBrokenIcon } from '@phosphor-icons/react';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { CreditCardIcon, ImageBrokenIcon, KeyIcon } from '@phosphor-icons/react';
|
|
4
4
|
import { AnimatePresence, m, useReducedMotion } from 'motion/react';
|
|
5
|
-
import { useState } from 'react';
|
|
5
|
+
import { useContext, useState } from 'react';
|
|
6
6
|
import { useTranslations } from '../../i18n/index.js';
|
|
7
|
+
import { Button } from '../../primitives/button.js';
|
|
8
|
+
import { ModelConnectionLayoutContext } from './model-connection-layout.js';
|
|
7
9
|
import { ConnectPlanRows } from './subscription-offer.js';
|
|
10
|
+
import { useModelConnectionGate } from './use-model-connection-gate.js';
|
|
8
11
|
// Enter waits a beat (delay) so the composer paints first, then the bar slides
|
|
9
12
|
// out from under it — height opens the space while the strip translates down,
|
|
10
13
|
// same spring on both so they move as one surface. Exit runs faster than enter
|
|
@@ -14,7 +17,8 @@ const BAR_EXIT = { type: 'spring', duration: 0.35, bounce: 0 };
|
|
|
14
17
|
/**
|
|
15
18
|
* No model can run: the composer shows the same "Connect ChatGPT" and "Connect
|
|
16
19
|
* Claude" rows the project home offers (`ConnectPlanRows`), a gap below the
|
|
17
|
-
* composer,
|
|
20
|
+
* composer by default, and above it on first-chat home. The rows are not
|
|
21
|
+
* dismissible. Sending is already disabled by `modelUnavailable`.
|
|
18
22
|
*
|
|
19
23
|
* It used to be a heading ("Connect a model to start"), two bordered tiles,
|
|
20
24
|
* "Use an API key" and "Upgrade". On the project home it stacked on top of the
|
|
@@ -24,7 +28,19 @@ const BAR_EXIT = { type: 'spring', duration: 0.35, bounce: 0 };
|
|
|
24
28
|
* `show` must only flip on settled data (see `entitlementsPending`).
|
|
25
29
|
*/
|
|
26
30
|
export function ModelConnectionBar({ show }) {
|
|
27
|
-
|
|
31
|
+
const above = useContext(ModelConnectionLayoutContext) === 'above';
|
|
32
|
+
return show ? (_jsxs("div", { className: above ? 'mb-4 flex flex-col gap-2' : 'mt-4 flex flex-col gap-1', children: [_jsx(NoModelReason, {}), _jsx(ConnectPlanRows, { dismissible: false })] })) : null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Why Send is disabled, and the two ways out. A Free account sees no Kortix
|
|
36
|
+
* model (managed models are Credits-plan only) even with credits bought, so
|
|
37
|
+
* the composer said "No model" and gave no reason. The same sentence answers a
|
|
38
|
+
* session create refused with `no_model_available` (error-handler.tsx).
|
|
39
|
+
*/
|
|
40
|
+
function NoModelReason() {
|
|
41
|
+
const t = useTranslations('sessionUi.modelGate');
|
|
42
|
+
const { canConnectProvider, openConnectProvider, openUpgrade, showUpgradeOption, modal } = useModelConnectionGate();
|
|
43
|
+
return (_jsxs(_Fragment, { children: [modal, _jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2 py-1 pr-3.5 pl-2.5", "data-testid": "no-model-reason", children: [_jsx("span", { className: "text-muted-foreground min-w-0 flex-1 text-xs", children: showUpgradeOption ? t('noModelUpgradeReason') : t('noModelKeyReason') }), showUpgradeOption ? (_jsxs(Button, { type: "button", size: "xs", onClick: openUpgrade, children: [_jsx(CreditCardIcon, { className: "size-3.5" }), t('noModelUpgradePlan')] })) : null, canConnectProvider ? (_jsxs(Button, { type: "button", size: "xs", variant: showUpgradeOption ? 'outline' : 'default', onClick: () => openConnectProvider('providers'), children: [_jsx(KeyIcon, { className: "size-3.5" }), t('noModelAddProviderKey')] })) : null] })] }));
|
|
28
44
|
}
|
|
29
45
|
/**
|
|
30
46
|
* One line under the card when the selected model cannot read an attached image
|
|
@@ -6,7 +6,7 @@ import { useTranslations } from '../../i18n/index.js';
|
|
|
6
6
|
import { MODEL_SELECTOR_PROVIDER_IDS, ProviderLogo } from '../../internal/lib/provider-branding.js';
|
|
7
7
|
import { cn } from '../../lib/utils.js';
|
|
8
8
|
import { SolidCheckIcon } from '../../internal/icons/solid-check-icon.js';
|
|
9
|
-
import { foreignDialogOpen } from '../../lib/z-stack.js';
|
|
9
|
+
import { foreignDialogOpen, openDialogs } from '../../lib/z-stack.js';
|
|
10
10
|
import { Button } from '../../primitives/button.js';
|
|
11
11
|
import { CommandGroup, CommandInput, CommandItem, CommandList } from '../../primitives/command.js';
|
|
12
12
|
import Hint from '../../primitives/hint.js';
|
|
@@ -64,8 +64,12 @@ export function ModelPickerPanel({ browseModels, pickableModels, searchModels, s
|
|
|
64
64
|
useEffect(() => {
|
|
65
65
|
if (!onForeignDialog)
|
|
66
66
|
return;
|
|
67
|
+
// A dialog already open when the picker opens is its host (the trigger
|
|
68
|
+
// composer, a settings modal), not one that opened over it. Counting it
|
|
69
|
+
// closed the picker ~60 ms after every open inside a modal.
|
|
70
|
+
const host = new Set(openDialogs());
|
|
67
71
|
const check = () => {
|
|
68
|
-
if (foreignDialogOpen(rootRef.current))
|
|
72
|
+
if (foreignDialogOpen(rootRef.current, host))
|
|
69
73
|
onForeignDialog();
|
|
70
74
|
};
|
|
71
75
|
const observer = new MutationObserver(check);
|
|
@@ -82,7 +82,7 @@ export interface ModelSelectorProps {
|
|
|
82
82
|
appearance?: 'chip' | 'field' | 'inline';
|
|
83
83
|
projectId?: string;
|
|
84
84
|
/**
|
|
85
|
-
* Offer the member's own ChatGPT subscription
|
|
85
|
+
* Offer the member's own ChatGPT subscription at
|
|
86
86
|
* the end of the list. Only an interactive session can use a personal
|
|
87
87
|
* account; a scheduled or background run cannot, so its pickers leave this off.
|
|
88
88
|
*/
|