@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
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import { qk } from '@kortix/sdk/react';
|
|
2
1
|
const MAX_CONNECTOR_SLUG_LENGTH = 128;
|
|
3
2
|
/** A connector's setup status. The rules live in `@kortix/sdk`. */
|
|
4
3
|
export { connectorSetupStatus, isConnectorAuthChallenge as isAuthChallenge, } from '@kortix/sdk';
|
|
5
|
-
export function connectorConnectionQueryKeys(projectId) {
|
|
6
|
-
return [
|
|
7
|
-
qk.project.connectors(projectId),
|
|
8
|
-
['connections', projectId],
|
|
9
|
-
['connections-all', projectId],
|
|
10
|
-
['session-scope-catalog', projectId],
|
|
11
|
-
];
|
|
12
|
-
}
|
|
13
4
|
export function createOnlyConnectorDraft(draft) {
|
|
14
5
|
return { ...draft, create_only: true };
|
|
15
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type AdminConnector, type Connection } from '@kortix/sdk';
|
|
3
|
-
export declare function ConnectionsList({ projectId, connector, displayName, canManageConnections, onChanged, onStartSession, onSetCredential, onConnect, titleAddon, addVariant, addRequest, onAddRequestHandled, disabled, }: {
|
|
3
|
+
export declare function ConnectionsList({ projectId, connector, displayName, canManageConnections, onChanged, onStartSession, onSetCredential, onConnect, signsIn, titleAddon, addVariant, addRequest, onAddRequestHandled, disabled, }: {
|
|
4
4
|
projectId: string;
|
|
5
5
|
connector: AdminConnector;
|
|
6
6
|
displayName: string;
|
|
@@ -19,6 +19,9 @@ export declare function ConnectionsList({ projectId, connector, displayName, can
|
|
|
19
19
|
}) => void;
|
|
20
20
|
/** Sign an unsigned account in. Omitted = no Connect on the rows. */
|
|
21
21
|
onConnect?: (connection: Connection) => void;
|
|
22
|
+
/** An MCP server with one-click OAuth: rows say "Sign in". A managed
|
|
23
|
+
* provider always does. */
|
|
24
|
+
signsIn?: boolean;
|
|
22
25
|
/** Bumped to open "Add account" from outside the list (a header button,
|
|
23
26
|
* or the connector page right after Install). */
|
|
24
27
|
addRequest?: number;
|
|
@@ -37,7 +37,7 @@ import { emptyProjectSlot, useAddAccount } from '../../internal/hooks/connectors
|
|
|
37
37
|
import { useDeleteTunnelConnection } from '@kortix/sdk/react';
|
|
38
38
|
import { useCopy } from '../../internal/hooks/use-copy.js';
|
|
39
39
|
import { cn } from '../../internal/lib/utils.js';
|
|
40
|
-
import { createConnector, discoverConnectionOAuth2, discoverConnectionOAuth2Resource, discoverConnectorAuth, ensureProjectConnectorConnection, getConnectorConfig, getProjectDetail, listAllConnections, listConnections, listProjectAccess, putConnectionOAuth2Application, reconcileMemberConnection, renameConnection, revokeConnection, setConnectorCredential, setDefaultConnection, startConnectionOAuth2Authorization, startConnectionOAuth2DeviceAuthorization, updateConnectionCredential, waitForConnectionOAuth2, } from '@kortix/sdk';
|
|
40
|
+
import { connectionSignInSteps, connectorAccountSignInStarted, createConnector, discoverConnectionOAuth2, discoverConnectionOAuth2Resource, discoverConnectorAuth, ensureProjectConnectorConnection, getConnectorConfig, getProjectDetail, listAllConnections, listConnections, listProjectAccess, putConnectionOAuth2Application, reconcileMemberConnection, renameConnection, revokeConnection, setConnectorCredential, setDefaultConnection, startConnectionOAuth2Authorization, startConnectionOAuth2DeviceAuthorization, updateConnectionCredential, waitForConnectionOAuth2, } from '@kortix/sdk';
|
|
41
41
|
import { contract, qk, useFeatureFlag, useProjectAccountId } from '@kortix/sdk/react';
|
|
42
42
|
import { AddAccountFields } from './add-account-fields.js';
|
|
43
43
|
import { useEmailInboxes, useRemoveEmailInbox, } from '../../internal/hooks/channels/use-email-inboxes.js';
|
|
@@ -62,11 +62,14 @@ function CodeSnippet({ code, language, className, }) {
|
|
|
62
62
|
return (_jsx("div", { className: cn('border-border/60 bg-card flex w-full overflow-x-auto rounded-md border', className), children: _jsx("div", { className: "p-3 [&_code]:text-xs", children: _jsx(HighlightedCode, { code: code, language: language }) }) }));
|
|
63
63
|
}
|
|
64
64
|
/** One row in the connections list — a single connected account. */
|
|
65
|
-
function ConnectionRow({ connection, viewerId, isMine, canManage, onSetDefault, onDisconnect, onRename, onStartSession, onSetCredential, onShare, onConnect, needsSignIn, pending, disabled = false, meta, menuItems, }) {
|
|
65
|
+
function ConnectionRow({ connection, viewerId, isMine, canManage, onSetDefault, onDisconnect, onRename, onStartSession, onSetCredential, onShare, onConnect, needsSignIn, signsIn = false, pending, disabled = false, meta, menuItems, }) {
|
|
66
66
|
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
67
67
|
const tSharing = useTranslations('accessSharing');
|
|
68
68
|
const tComputers = useTranslations('computers');
|
|
69
69
|
const tConnectorPages = useTranslations('connectorPages');
|
|
70
|
+
const tSignIn = useTranslations('connectSignIn');
|
|
71
|
+
// A sign-in someone started (an agent's link) and nobody finished.
|
|
72
|
+
const signInStarted = needsSignIn && connectorAccountSignInStarted(connection);
|
|
70
73
|
const isProjectAuthorization = connection.owner_type === 'project';
|
|
71
74
|
const active = connection.status === 'active';
|
|
72
75
|
// Only the owner of a connection may change it: your own personal connection,
|
|
@@ -75,9 +78,13 @@ function ConnectionRow({ connection, viewerId, isMine, canManage, onSetDefault,
|
|
|
75
78
|
const visibility = accountVisibility(connection, viewerId);
|
|
76
79
|
const everyoneWithAccess = (connection.shared_with ?? []).map((share) => share.label);
|
|
77
80
|
const { copy } = useCopy({ successMessage: tI18nComplete.raw('text56ee71f3ece0') });
|
|
78
|
-
return (_jsxs("li", { className: "flex items-center gap-3 px-4 py-3", children: [_jsx("span", { "aria-hidden": true, className: "bg-muted text-muted-foreground flex size-8 shrink-0 items-center justify-center rounded-md", children: visibility.kind === 'you' ? (_jsx(Lock, { className: "size-4" })) : visibility.kind === 'everyone' ? (_jsx(UsersThree, { className: "size-4" })) : (_jsx(Users, { className: "size-4" })) }), _jsxs("div", { className: "min-w-0 flex-1 space-y-0.5", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx("span", { className: "truncate text-sm font-medium", children: connection.label }), connection.is_default && (_jsx(Badge, { variant: "secondary", size: "xs", children: tI18nComplete.raw('text21b111cbfe6e') }))] }), _jsxs(InlineMeta, { children: [_jsx(AudienceText, { visibility: visibility, labels: everyoneWithAccess }), meta, connection.usable === false ? tSharing('notSharedWithYou') : null, active && needsSignIn ? (_jsx("span", { children: tConnectorPages('notSignedIn') })) : null, active && connection.metadata?.credential_rejected_at ? (_jsx("span", { className: "text-destructive", children: tConnectorPages('credentialRejected') })) : null, active ? null : (_jsx("span", { className: "text-destructive", children: connection.status === 'revoked' ? 'Disconnected' : 'Error' })), active && connection.machine ? (_jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx(ComputerStateDot, { state: connection.machine.online ? 'online' : 'offline' }), tComputers(connection.machine.online ? 'online' : 'offline')] })) : null, connection.connected_as && connection.connected_as !== connection.label
|
|
81
|
+
return (_jsxs("li", { className: "flex items-center gap-3 px-4 py-3", children: [_jsx("span", { "aria-hidden": true, className: "bg-muted text-muted-foreground flex size-8 shrink-0 items-center justify-center rounded-md", children: visibility.kind === 'you' ? (_jsx(Lock, { className: "size-4" })) : visibility.kind === 'everyone' ? (_jsx(UsersThree, { className: "size-4" })) : (_jsx(Users, { className: "size-4" })) }), _jsxs("div", { className: "min-w-0 flex-1 space-y-0.5", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx("span", { className: "truncate text-sm font-medium", children: connection.label }), connection.is_default && (_jsx(Badge, { variant: "secondary", size: "xs", children: tI18nComplete.raw('text21b111cbfe6e') }))] }), _jsxs(InlineMeta, { children: [_jsx(AudienceText, { visibility: visibility, labels: everyoneWithAccess }), meta, connection.usable === false ? tSharing('notSharedWithYou') : null, active && needsSignIn ? (_jsx("span", { children: signInStarted ? tSignIn('signInUnfinished') : tConnectorPages('notSignedIn') })) : null, active && connection.metadata?.credential_rejected_at ? (_jsx("span", { className: "text-destructive", children: tConnectorPages('credentialRejected') })) : null, active ? null : (_jsx("span", { className: "text-destructive", children: connection.status === 'revoked' ? 'Disconnected' : 'Error' })), active && connection.machine ? (_jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx(ComputerStateDot, { state: connection.machine.online ? 'online' : 'offline' }), tComputers(connection.machine.online ? 'online' : 'offline')] })) : null, connection.connected_as && connection.connected_as !== connection.label
|
|
79
82
|
? tI18nComplete('texte9e0b20cf289', { value0: connection.connected_as })
|
|
80
|
-
: null] })] }), onConnect && mayMutate && needsSignIn ? (_jsx(Button, { size: "sm", className: "shrink-0", onClick: onConnect, disabled: pending || disabled, children:
|
|
83
|
+
: null] })] }), onConnect && mayMutate && needsSignIn ? (_jsx(Button, { size: "sm", className: "shrink-0", onClick: onConnect, disabled: pending || disabled, children: signInStarted
|
|
84
|
+
? tSignIn('finishSignIn')
|
|
85
|
+
: signsIn
|
|
86
|
+
? tConnectorPages('noticeSignInAction')
|
|
87
|
+
: tConnectorPages('connectAccount') })) : null, _jsxs(ButtonGroup, { className: "shrink-0", children: [onShare && mayMutate ? (
|
|
81
88
|
// Your own private account is shared by turning it into a shared one,
|
|
82
89
|
// which needs the same right as creating a shared account.
|
|
83
90
|
isProjectAuthorization || canManage ? (_jsxs(Button, { variant: "secondary", size: "sm", className: "shrink-0 gap-1.5", onClick: onShare, disabled: pending || disabled, "aria-label": tSharing('shareTitle', { label: connection.label }), children: [_jsx(ShareNetworkIcon, { className: "size-3.5 shrink-0" }), tI18nComplete.raw('text29887a5ff984')] })) : (_jsx(Hint, { label: tSharing('shareRequiresManage'), children: _jsx("span", { className: "inline-flex shrink-0", children: _jsxs(Button, { variant: "secondary", size: "sm", className: "gap-1.5", disabled: true, "aria-label": tSharing('shareTitle', { label: connection.label }), children: [_jsx(ShareNetworkIcon, { className: "size-3.5 shrink-0" }), tI18nComplete.raw('text29887a5ff984')] }) }) }))) : null, _jsx(ButtonGroupSeparator, { className: "bg-border" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "secondary", size: "icon", className: "size-8 shrink-0", "aria-label": tI18nComplete('text33da220b1a34', { value0: connection.label }), disabled: pending || disabled, children: pending ? (_jsx(Loading, { className: "size-4 shrink-0" })) : (_jsx(DotsThreeIcon, { className: "size-4" })) }) }), _jsxs(DropdownMenuContent, { align: "end", className: "min-w-48", children: [_jsx(DropdownMenuItem, { onClick: () => copy(connection.connection_id), children: tI18nComplete.raw('text99775327d988') }), mayMutate && (_jsx(DropdownMenuItem, { onClick: onRename, children: tI18nComplete.raw('text3064d79a295c') })), mayMutate && isMine && active && onStartSession && (_jsx(DropdownMenuItem, { onClick: onStartSession, children: tI18nComplete.raw('textfae237eed0c5') })), mayMutate && onSetCredential && (_jsx(DropdownMenuItem, { onClick: onSetCredential, children: tI18nComplete.raw('text3d6627454174') })), mayMutate && !connection.is_default && active && (_jsxs(DropdownMenuItem, { onClick: onSetDefault, children: [tI18nComplete.raw('texta92f66fd3d83'), isProjectAuthorization ? ` ${tI18nComplete.raw('text801a345cd406')}` : ''] })), mayMutate ? menuItems : null, mayMutate && (_jsx(DropdownMenuItem, { onClick: onDisconnect, children: tI18nComplete.raw('textacfc5be785a9') }))] })] })] })] }));
|
|
@@ -102,7 +109,7 @@ const EMPTY_NEW_ACCOUNT = {
|
|
|
102
109
|
audience: 'private',
|
|
103
110
|
picked: { memberIds: [], groupIds: [] },
|
|
104
111
|
};
|
|
105
|
-
export function ConnectionsList({ projectId, connector, displayName, canManageConnections, onChanged, onStartSession, onSetCredential, onConnect, titleAddon, addVariant = 'secondary', addRequest = 0, onAddRequestHandled, disabled = false, }) {
|
|
112
|
+
export function ConnectionsList({ projectId, connector, displayName, canManageConnections, onChanged, onStartSession, onSetCredential, onConnect, signsIn = false, titleAddon, addVariant = 'secondary', addRequest = 0, onAddRequestHandled, disabled = false, }) {
|
|
106
113
|
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
107
114
|
const tSharing = useTranslations('accessSharing');
|
|
108
115
|
const tComputers = useTranslations('computers');
|
|
@@ -163,6 +170,32 @@ export function ConnectionsList({ projectId, connector, displayName, canManageCo
|
|
|
163
170
|
// An inbox account always has an inbox behind it: there is no empty slot.
|
|
164
171
|
const slot = isEmail ? null : emptyProjectSlot(connector, allRows);
|
|
165
172
|
const rows = slot ? allRows.filter((row) => row !== slot) : allRows;
|
|
173
|
+
// A managed account whose sign-in started and never finished may be done at
|
|
174
|
+
// the provider (the person used an agent's link outside Kortix). Ask once
|
|
175
|
+
// per account when the list shows it; a finished one is recorded and the
|
|
176
|
+
// row turns signed in without a click.
|
|
177
|
+
const unfinishedIds = isManagedConnectorProvider(connector.provider)
|
|
178
|
+
? rows
|
|
179
|
+
.filter((row) => row.status === 'active' && row.authorized === false && connectorAccountSignInStarted(row))
|
|
180
|
+
.map((row) => row.connection_id)
|
|
181
|
+
.sort()
|
|
182
|
+
: [];
|
|
183
|
+
useQuery({
|
|
184
|
+
queryKey: ['connection-sign-in-check', projectId, connector.slug, unfinishedIds],
|
|
185
|
+
enabled: unfinishedIds.length > 0,
|
|
186
|
+
staleTime: Infinity,
|
|
187
|
+
retry: false,
|
|
188
|
+
queryFn: async () => {
|
|
189
|
+
const results = await Promise.allSettled(unfinishedIds.map((connectionId) => {
|
|
190
|
+
const row = rows.find((candidate) => candidate.connection_id === connectionId);
|
|
191
|
+
return connectionSignInSteps(projectId, connector.slug, row).finalize();
|
|
192
|
+
}));
|
|
193
|
+
const recorded = results.some((result) => result.status === 'fulfilled' && result.value.connected);
|
|
194
|
+
if (recorded)
|
|
195
|
+
refresh();
|
|
196
|
+
return recorded;
|
|
197
|
+
},
|
|
198
|
+
});
|
|
166
199
|
const openCredential = onSetCredential ?? setCredentialTarget;
|
|
167
200
|
// "Add account" asks the account's name and who may use it: only you,
|
|
168
201
|
// everyone in the project, or picked people and groups. The connector
|
|
@@ -194,7 +227,9 @@ export function ConnectionsList({ projectId, connector, displayName, canManageCo
|
|
|
194
227
|
setEmailOpen(true);
|
|
195
228
|
return;
|
|
196
229
|
}
|
|
197
|
-
|
|
230
|
+
// "Everyone in this workspace" for a person who may share, as model keys
|
|
231
|
+
// default: a trigger runs only on a shared account. "Only you" otherwise.
|
|
232
|
+
setDraft({ ...EMPTY_NEW_ACCOUNT, audience: canManageConnections ? 'project' : 'private', label: addAccount.proposedLabel() });
|
|
198
233
|
setLabelEdited(false);
|
|
199
234
|
setAddOpen(true);
|
|
200
235
|
};
|
|
@@ -284,7 +319,7 @@ export function ConnectionsList({ projectId, connector, displayName, canManageCo
|
|
|
284
319
|
inbox.email !== connection.label ? _jsx("span", { children: inbox.email }, "address") : null,
|
|
285
320
|
_jsx(EmailInboxHome, { inbox: inbox }, "home"),
|
|
286
321
|
]
|
|
287
|
-
: undefined, menuItems: inbox ? (_jsx(DropdownMenuItem, { onClick: () => setPolicyInbox(inbox), children: tInboxes('policyMenu') })) : undefined, viewerId: viewerId, isMine: connection.owner_type === 'member', canManage: canManageConnections, pending: pendingConnectionId === connection.connection_id, disabled: disabled, onSetDefault: () => setDefault.mutate(connection.connection_id), onDisconnect: () => setConfirmDisconnect(connection), onRename: () => openRename(connection), onStartSession: onStartSession ? () => onStartSession(connection) : undefined, onSetCredential: setCredential ? () => setCredential(connection) : undefined, onConnect: onConnect ? () => onConnect(connection) : undefined, needsSignIn: !isEmail && accountNeedsSignIn(connection, connector), onShare: accountId
|
|
322
|
+
: undefined, menuItems: inbox ? (_jsx(DropdownMenuItem, { onClick: () => setPolicyInbox(inbox), children: tInboxes('policyMenu') })) : undefined, viewerId: viewerId, isMine: connection.owner_type === 'member', canManage: canManageConnections, pending: pendingConnectionId === connection.connection_id, disabled: disabled, onSetDefault: () => setDefault.mutate(connection.connection_id), onDisconnect: () => setConfirmDisconnect(connection), onRename: () => openRename(connection), onStartSession: onStartSession ? () => onStartSession(connection) : undefined, onSetCredential: setCredential ? () => setCredential(connection) : undefined, onConnect: onConnect ? () => onConnect(connection) : undefined, needsSignIn: !isEmail && accountNeedsSignIn(connection, connector), signsIn: signsIn || isManagedConnectorProvider(connector.provider), onShare: accountId
|
|
288
323
|
? () => {
|
|
289
324
|
setShareTarget(connection);
|
|
290
325
|
setShareOpen(true);
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The line above the provider list with pooled provider keys on: new keys and
|
|
3
|
+
* accounts are shared with the workspace, or, for a viewer who may not share,
|
|
4
|
+
* only theirs. A component, so the permission read runs only where it shows.
|
|
5
|
+
*/
|
|
6
|
+
export declare function PooledProvidersNote({ projectId, className }: {
|
|
7
|
+
projectId: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
10
|
+
/**
|
|
11
|
+
* Whether a new provider key or account the viewer adds is shared with the
|
|
12
|
+
* workspace by default. A viewer without `project.secret.write` adds only
|
|
13
|
+
* private ones ("Only you"), so the copy above each list must say so.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useCanShareProviderAccounts(projectId: string): boolean;
|
|
1
16
|
/**
|
|
2
17
|
* Provider keys live beside the provider they configure. The secret value stays
|
|
3
18
|
* write-only. With `oauth`, the panel manages ChatGPT or Claude accounts: any
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
4
4
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { useTranslations } from '../../../i18n/index.js';
|
|
6
|
-
import { ApiError, createAccountSecretResource, deleteAccountSecretResource, listAccountMembers, setAccountSecretResourceAccess, rotateAccountSecretResource, pollProjectProviderOAuth, startProjectProviderOAuth, completeClaudeSubscriptionLogin, startClaudeSubscriptionLogin, } from '@kortix/sdk';
|
|
6
|
+
import { ApiError, createAccountSecretResource, deleteAccountSecretResource, listAccountMembers, setAccountSecretResourceAccess, rotateAccountSecretResource, verifyAccountSecretResource, pollProjectProviderOAuth, startProjectProviderOAuth, completeClaudeSubscriptionLogin, startClaudeSubscriptionLogin, } from '@kortix/sdk';
|
|
7
7
|
import { refreshProjectProviderState, useAccountSecretResources } from '@kortix/sdk/react';
|
|
8
8
|
import { ChatGptDeviceChallenge } from '../llm-provider/chatgpt-device-challenge.js';
|
|
9
9
|
import { ClaudeCodeStep } from '../llm-provider/claude-code-step.js';
|
|
@@ -206,6 +206,24 @@ function useClaudeAuthorization(projectId) {
|
|
|
206
206
|
}, [projectId]);
|
|
207
207
|
return { challenge, waiting, finishing, checking, error, authorize, cancel, reset, submitCode };
|
|
208
208
|
}
|
|
209
|
+
/**
|
|
210
|
+
* The line above the provider list with pooled provider keys on: new keys and
|
|
211
|
+
* accounts are shared with the workspace, or, for a viewer who may not share,
|
|
212
|
+
* only theirs. A component, so the permission read runs only where it shows.
|
|
213
|
+
*/
|
|
214
|
+
export function PooledProvidersNote({ projectId, className }) {
|
|
215
|
+
const t = useTranslations('pooledSecrets');
|
|
216
|
+
const canShare = useCanShareProviderAccounts(projectId);
|
|
217
|
+
return _jsx("p", { className: className, children: t(canShare ? 'sharedDescription' : 'sharedOnlyYouDescription') });
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Whether a new provider key or account the viewer adds is shared with the
|
|
221
|
+
* workspace by default. A viewer without `project.secret.write` adds only
|
|
222
|
+
* private ones ("Only you"), so the copy above each list must say so.
|
|
223
|
+
*/
|
|
224
|
+
export function useCanShareProviderAccounts(projectId) {
|
|
225
|
+
return useProjectCan(projectId, PROJECT_ACTIONS.PROJECT_SECRET_WRITE).allowed === true;
|
|
226
|
+
}
|
|
209
227
|
/**
|
|
210
228
|
* Provider keys live beside the provider they configure. The secret value stays
|
|
211
229
|
* write-only. With `oauth`, the panel manages ChatGPT or Claude accounts: any
|
|
@@ -222,7 +240,7 @@ export function AccountSecretResourcesPanel({ accountId, projectId, providerId,
|
|
|
222
240
|
const resources = useAccountSecretResources(accountId, projectId);
|
|
223
241
|
// Hide share controls on anything but an explicit grant: an owner-only
|
|
224
242
|
// connection is always allowed, so a slow probe never blocks the common case.
|
|
225
|
-
const canShare =
|
|
243
|
+
const canShare = useCanShareProviderAccounts(projectId);
|
|
226
244
|
const [creating, setCreating] = useState(false);
|
|
227
245
|
const [label, setLabel] = useState('');
|
|
228
246
|
const [value, setValue] = useState('');
|
|
@@ -323,16 +341,37 @@ export function AccountSecretResourcesPanel({ accountId, projectId, providerId,
|
|
|
323
341
|
value, consumer: 'llm_gateway', strategy: 'broker',
|
|
324
342
|
});
|
|
325
343
|
},
|
|
326
|
-
onSuccess: async () => {
|
|
344
|
+
onSuccess: async (saved) => {
|
|
327
345
|
await refresh();
|
|
328
346
|
setCreating(false);
|
|
329
347
|
setRotating(null);
|
|
330
348
|
setLabel('');
|
|
331
349
|
setValue('');
|
|
332
|
-
|
|
350
|
+
// The server checked the key with one call to the provider. A refusal
|
|
351
|
+
// keeps the key saved; it says so instead of a plain "saved".
|
|
352
|
+
const verification = saved?.verification;
|
|
353
|
+
if (verification?.status === 'invalid')
|
|
354
|
+
errorToast(t('savedInvalid', { provider: providerName, message: verification.message }));
|
|
355
|
+
else
|
|
356
|
+
successToast(verification?.status === 'verified' ? t('savedVerified') : t('saved'));
|
|
333
357
|
},
|
|
334
358
|
onError: (error) => errorToast(error instanceof Error ? error.message : t('saveError')),
|
|
335
359
|
});
|
|
360
|
+
const verify = useMutation({
|
|
361
|
+
mutationFn: (secretId) => verifyAccountSecretResource(accountId, secretId),
|
|
362
|
+
onSettled: async () => { await refresh(); },
|
|
363
|
+
onError: (error) => errorToast(error instanceof Error ? error.message : t('checkError')),
|
|
364
|
+
});
|
|
365
|
+
const verificationLine = (secret) => {
|
|
366
|
+
const verification = secret.verification;
|
|
367
|
+
if (oauth || !verification)
|
|
368
|
+
return null;
|
|
369
|
+
if (verification.status === 'verified')
|
|
370
|
+
return _jsx("span", { className: "text-muted-foreground block text-xs font-normal", children: t('keyVerified', { provider: providerName }) });
|
|
371
|
+
if (verification.status === 'invalid')
|
|
372
|
+
return _jsx("span", { className: "text-destructive block text-xs font-normal break-words", children: t('keyInvalid', { provider: providerName, message: verification.message }) });
|
|
373
|
+
return _jsx("span", { className: "text-muted-foreground block text-xs font-normal break-words", children: t('keyUnchecked', { message: verification.message }) });
|
|
374
|
+
};
|
|
336
375
|
const remove = useMutation({
|
|
337
376
|
mutationFn: (secretId) => deleteAccountSecretResource(accountId, secretId),
|
|
338
377
|
onSuccess: async () => { await refresh(); setDeleting(null); successToast(t('deleted')); },
|
|
@@ -387,7 +426,7 @@ export function AccountSecretResourcesPanel({ accountId, projectId, providerId,
|
|
|
387
426
|
// A subscription login names its email and plan, and shows every plan
|
|
388
427
|
// window under it; the sheet's summary sits above this list.
|
|
389
428
|
const usageShown = Boolean(oauth) && isSubscriptionLogin(secret) && !undecryptable;
|
|
390
|
-
return (_jsxs("li", { className: usageShown ? 'border-border flex min-w-0 items-start gap-3 rounded-md border px-3 py-2' : 'border-border flex min-w-0 items-center gap-3 rounded-md border px-3 py-1.5', children: [_jsxs("span", { className: "text-foreground min-w-0 flex-1 text-sm font-medium", children: [_jsx("span", { className: "block break-words", children: secret.label }), usageShown && oauth && _jsx(SubscriptionAccountLine, { accountId: accountId, projectId: oauth.projectId, secret: secret }), _jsx("span", { className: "text-muted-foreground block text-xs font-normal", children: accessLine(secret) }), stale && (_jsx("span", { className: "text-muted-foreground block text-xs font-normal", children: t('needsReconnection') })), !(usageShown && secret.usage) && secret.cooldown_until && Date.parse(secret.cooldown_until) > resources.dataUpdatedAt && (_jsx("span", { className: "text-muted-foreground block text-xs font-normal", children: t('coolingDown') })), usageShown && oauth && _jsx(SubscriptionAccountUsage, { accountId: accountId, projectId: oauth.projectId, secret: secret })] }), undecryptable && _jsx(UndecryptableValue, { hint: tUndecryptable(oauth ? 'loginHint' : 'keyHint') }), (stale || undecryptable) && canReconnect && (_jsx(Button, { size: "sm", variant: "secondary", "aria-label": t('reconnectTitle', { label: secret.label }), onClick: () => openReconnect(secret), children: t('reconnectAccount') })), undecryptable && canManage && !oauth && (_jsx(Button, { size: "sm", variant: "secondary", onClick: () => { setValue(''); save.reset(); setRotating(secret); }, children: tUndecryptable('reenterKey') })), (canManage || canReconnect) && _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { size: "icon-sm", variant: "ghost", "aria-label": t('actionsFor', { label: secret.label }), children: _jsx(DotsThreeIcon, { className: "size-4" }) }) }), _jsxs(DropdownMenuContent, { align: "end", children: [canReconnect && _jsx(DropdownMenuItem, { onSelect: () => openReconnect(secret), children: t('reconnectAccount') }), canChangeAccess && _jsx(DropdownMenuItem, { onSelect: () => { changeGrant.reset(); setSharingMode(secret.access_mode); setSelectedMembers({ memberIds: secret.granted_user_ids, groupIds: [], inviteEmails: [] }); setSharing(secret); }, children: t('manageAccess') }), canManage && !oauth && _jsx(DropdownMenuItem, { onSelect: () => { setValue(''); save.reset(); setRotating(secret); }, children: t('rotateKey') }), canManage && _jsx(DropdownMenuItem, { onSelect: () => setDeleting(secret), children: oauth ? t('deleteAccount') : t('deleteKey') })] })] })] }, secret.secret_id));
|
|
429
|
+
return (_jsxs("li", { className: usageShown ? 'border-border flex min-w-0 items-start gap-3 rounded-md border px-3 py-2' : 'border-border flex min-w-0 items-center gap-3 rounded-md border px-3 py-1.5', children: [_jsxs("span", { className: "text-foreground min-w-0 flex-1 text-sm font-medium", children: [_jsx("span", { className: "block break-words", children: secret.label }), usageShown && oauth && _jsx(SubscriptionAccountLine, { accountId: accountId, projectId: oauth.projectId, secret: secret }), _jsx("span", { className: "text-muted-foreground block text-xs font-normal", children: accessLine(secret) }), verificationLine(secret), stale && (_jsx("span", { className: "text-muted-foreground block text-xs font-normal", children: t('needsReconnection') })), !(usageShown && secret.usage) && secret.cooldown_until && Date.parse(secret.cooldown_until) > resources.dataUpdatedAt && (_jsx("span", { className: "text-muted-foreground block text-xs font-normal", children: t('coolingDown') })), usageShown && oauth && _jsx(SubscriptionAccountUsage, { accountId: accountId, projectId: oauth.projectId, secret: secret })] }), undecryptable && _jsx(UndecryptableValue, { hint: tUndecryptable(oauth ? 'loginHint' : 'keyHint') }), (stale || undecryptable) && canReconnect && (_jsx(Button, { size: "sm", variant: "secondary", "aria-label": t('reconnectTitle', { label: secret.label }), onClick: () => openReconnect(secret), children: t('reconnectAccount') })), undecryptable && canManage && !oauth && (_jsx(Button, { size: "sm", variant: "secondary", onClick: () => { setValue(''); save.reset(); setRotating(secret); }, children: tUndecryptable('reenterKey') })), (canManage || canReconnect) && _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { size: "icon-sm", variant: "ghost", "aria-label": t('actionsFor', { label: secret.label }), children: _jsx(DotsThreeIcon, { className: "size-4" }) }) }), _jsxs(DropdownMenuContent, { align: "end", children: [canReconnect && _jsx(DropdownMenuItem, { onSelect: () => openReconnect(secret), children: t('reconnectAccount') }), canChangeAccess && _jsx(DropdownMenuItem, { onSelect: () => { changeGrant.reset(); setSharingMode(secret.access_mode); setSelectedMembers({ memberIds: secret.granted_user_ids, groupIds: [], inviteEmails: [] }); setSharing(secret); }, children: t('manageAccess') }), canManage && !oauth && secret.project_id && _jsx(DropdownMenuItem, { disabled: verify.isPending, onSelect: () => verify.mutate(secret.secret_id), children: t('checkKey') }), canManage && !oauth && _jsx(DropdownMenuItem, { onSelect: () => { setValue(''); save.reset(); setRotating(secret); }, children: t('rotateKey') }), canManage && _jsx(DropdownMenuItem, { onSelect: () => setDeleting(secret), children: oauth ? t('deleteAccount') : t('deleteKey') })] })] })] }, secret.secret_id));
|
|
391
430
|
}) })) : null, _jsx(Modal, { open: creating || rotating !== null, onOpenChange: (open) => { if (!open && !save.isPending && !authorization.finishing)
|
|
392
431
|
closeCreate(); }, children: _jsxs(ModalContent, { className: "lg:max-w-md", children: [_jsxs(ModalHeader, { children: [_jsx(ModalTitle, { children: rotating ? t('rotateLabel', { label: rotating.label }) : `${oauth ? t('addAccount') : t('addKey')} · ${providerName}` }), _jsx(ModalDescription, { children: rotating ? t('valueNeverShown') : oauth ? tAccount('oauthCreationDescription', 'claudeOauthCreationDescription') : t('creationDescription') })] }), _jsxs(ModalBody, { className: "max-h-[60vh] space-y-3 overflow-y-auto", children: [save.isError && _jsx("p", { role: "alert", className: "text-destructive text-sm", children: save.error instanceof Error ? save.error.message : t('saveError') }), oauth && authorization.error && _jsx("p", { role: "alert", className: "text-destructive text-sm", children: authorization.error }), !rotating && _jsx(_Fragment, { children: _jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: `provider-key-label-${providerId}`, children: t('label') }), _jsx(Input, { id: `provider-key-label-${providerId}`, value: label, disabled: busy, onChange: (event) => setLabel(event.target.value), placeholder: oauth ? tAccount('accountLabelPlaceholder', 'claudeAccountLabelPlaceholder') : t('primaryKey'), maxLength: 100 })] }) }), oauth ? authorization.finishing ? _jsx(ChatGptSignInFinishing, { label: t('oauthFinishing') })
|
|
393
432
|
: (authorization.challenge || (claude && authorization.waiting)) && signInStep(authorization.challenge) :
|
|
@@ -27,7 +27,7 @@ import { useEffect, useMemo, useState } from 'react';
|
|
|
27
27
|
import { invalidateReviewInbox, useActReviewItem, useBulkActReviewItems, useResolveReviewApproval, useReviewItemById, useReviewItems, withFreshApprovalDetail, } from '../../../workspace/review/hooks/use-review-items.js';
|
|
28
28
|
import { mapApiReviewItem } from '../../../workspace/review/map.js';
|
|
29
29
|
import { connectorCallId, crChangeRequestId, isApprovalExpiredError, itemDeepLink, } from '../../../workspace/review/review-actions.js';
|
|
30
|
-
import { AskDeck, DECK_KINDS } from '../../../session/prompts/ask-deck.js';
|
|
30
|
+
import { AskDeck, DECK_KINDS, deckOrder } from '../../../session/prompts/ask-deck.js';
|
|
31
31
|
import { ReviewCenter } from '../../../workspace/review/review-center.js';
|
|
32
32
|
import { REVIEW_VERDICT_ANNOUNCED } from '../../../workspace/review/review-reducer.js';
|
|
33
33
|
/**
|
|
@@ -54,6 +54,10 @@ export function ReviewCenterConnected({ projectName }) {
|
|
|
54
54
|
// sit beside rows that do wait, so the pane shows "Select an item" instead.
|
|
55
55
|
// Same query as the deck's own: a cache hit, not a second request.
|
|
56
56
|
const asks = useSessionAsks(projectId, { enabled: Boolean(projectId) });
|
|
57
|
+
const [selectedAskId, setSelectedAskId] = useState(null);
|
|
58
|
+
const [currentAskId, setCurrentAskId] = useState(null);
|
|
59
|
+
const [hiddenAskIds, setHiddenAskIds] = useState(() => new Set());
|
|
60
|
+
const deckAsks = deckOrder((asks.data?.asks ?? []).filter((ask) => DECK_KINDS.has(ask.kind)), [], hiddenAskIds);
|
|
57
61
|
const deckShows = asks.isLoading || asks.isError || (asks.data?.asks ?? []).some((ask) => DECK_KINDS.has(ask.kind));
|
|
58
62
|
const qc = useQueryClient();
|
|
59
63
|
const router = useUiRouter();
|
|
@@ -277,12 +281,12 @@ export function ReviewCenterConnected({ projectName }) {
|
|
|
277
281
|
// The effect above has already warmed this href.
|
|
278
282
|
router.push(href);
|
|
279
283
|
}
|
|
280
|
-
return (_jsx(ReviewCenter, { needsYouDeck: projectId && deckShows
|
|
284
|
+
return (_jsx(ReviewCenter, { sessionAsks: deckAsks, selectedAskId: currentAskId, onSelectAsk: setSelectedAskId, needsYouDeck: projectId && deckShows
|
|
281
285
|
? ({ paused }) => (
|
|
282
286
|
// `empty={null}`: in the 5 s Undo window after the last card,
|
|
283
287
|
// the deck draws nothing (the inbox shows its own empty state)
|
|
284
288
|
// rather than "Nothing waits on you" beside rows that do.
|
|
285
|
-
_jsx(AskDeck, { projectId: projectId, onOpenSession: openSession, empty: null, paused: paused }))
|
|
289
|
+
_jsx(AskDeck, { projectId: projectId, onOpenSession: openSession, empty: null, paused: paused, onCurrentAskChange: setCurrentAskId, onHiddenAskIdsChange: setHiddenAskIds, selectedAskId: selectedAskId, onClearSelection: () => setSelectedAskId(null) }))
|
|
286
290
|
: undefined, initialItems: items, segment: segment, onSegmentChange: setSegment, loadMore: hasNextPage
|
|
287
291
|
? {
|
|
288
292
|
onLoadMore: () => void fetchNextPage(),
|
|
@@ -73,7 +73,14 @@ export declare function secretUsage(strategy: SecretDeliveryStrategy, consumer?:
|
|
|
73
73
|
* would silently move the secret off the consumer its owning flow reads —
|
|
74
74
|
* disconnecting a model provider, a connector, or a repository.
|
|
75
75
|
*/
|
|
76
|
-
export declare function secretUsageIsAssigned(consumer?: SecretConsumer | null): boolean;
|
|
76
|
+
export declare function secretUsageIsAssigned(consumer?: SecretConsumer | null, opts?: SecretUsageContext): boolean;
|
|
77
|
+
/** What the row's surroundings say about its usage. */
|
|
78
|
+
export type SecretUsageContext = {
|
|
79
|
+
/** A connector resolves this secret. Unknown (absent) reads as bound. */
|
|
80
|
+
connectorBound?: boolean;
|
|
81
|
+
/** The user picked an exposure in this edit. */
|
|
82
|
+
picked?: boolean;
|
|
83
|
+
};
|
|
77
84
|
/**
|
|
78
85
|
* The `(strategy, consumer)` pair a save writes, given the picked exposure and
|
|
79
86
|
* the row it is editing.
|
|
@@ -93,7 +100,7 @@ export declare function secretUsageIsAssigned(consumer?: SecretConsumer | null):
|
|
|
93
100
|
export declare function secretDeliveryTarget(exposure: SecretExposure, row?: {
|
|
94
101
|
strategy: SecretDeliveryStrategy;
|
|
95
102
|
consumer: SecretConsumer | null;
|
|
96
|
-
} | null): {
|
|
103
|
+
} | null, opts?: SecretUsageContext): {
|
|
97
104
|
strategy: SecretDeliveryStrategy;
|
|
98
105
|
consumer: SecretConsumer | null;
|
|
99
106
|
};
|
|
@@ -53,8 +53,13 @@ export function secretUsage(strategy, consumer) {
|
|
|
53
53
|
* would silently move the secret off the consumer its owning flow reads —
|
|
54
54
|
* disconnecting a model provider, a connector, or a repository.
|
|
55
55
|
*/
|
|
56
|
-
export function secretUsageIsAssigned(consumer) {
|
|
57
|
-
|
|
56
|
+
export function secretUsageIsAssigned(consumer, opts) {
|
|
57
|
+
// A connector-only row that no connector uses (a value typed into a
|
|
58
|
+
// connector-scoped setup link and never bound) has no owning flow to
|
|
59
|
+
// disconnect: its owner picks its delivery.
|
|
60
|
+
if (consumer === 'connector')
|
|
61
|
+
return opts?.connectorBound ?? true;
|
|
62
|
+
return consumer === 'llm_gateway' || consumer === 'git_proxy';
|
|
58
63
|
}
|
|
59
64
|
/**
|
|
60
65
|
* The `(strategy, consumer)` pair a save writes, given the picked exposure and
|
|
@@ -72,8 +77,13 @@ export function secretUsageIsAssigned(consumer) {
|
|
|
72
77
|
*
|
|
73
78
|
* Everything else writes the pair its exposure names (spec §3).
|
|
74
79
|
*/
|
|
75
|
-
export function secretDeliveryTarget(exposure, row) {
|
|
76
|
-
if (row && secretUsageIsAssigned(row.consumer)) {
|
|
80
|
+
export function secretDeliveryTarget(exposure, row, opts) {
|
|
81
|
+
if (row && secretUsageIsAssigned(row.consumer, opts)) {
|
|
82
|
+
return { strategy: row.strategy, consumer: row.consumer };
|
|
83
|
+
}
|
|
84
|
+
// An unbound connector row moves only when its owner picks an exposure: an
|
|
85
|
+
// unrelated save (a new value) keeps it where it is.
|
|
86
|
+
if (row?.consumer === 'connector' && !opts?.picked) {
|
|
77
87
|
return { strategy: row.strategy, consumer: row.consumer };
|
|
78
88
|
}
|
|
79
89
|
if (exposure === 'enforced' && row?.strategy === 'broker' && row.consumer === 'http_broker') {
|
|
@@ -404,14 +404,26 @@ function SecretDialog({ open, onOpenChange, projectId, row, connectors, connecto
|
|
|
404
404
|
*/
|
|
405
405
|
const [pickedExposure, setPickedExposure] = useState(null);
|
|
406
406
|
const exposure = pickedExposure ?? defaultSecretExposure(row, classification);
|
|
407
|
-
|
|
407
|
+
/**
|
|
408
|
+
* A connector-only row that no connector resolves (a value typed into a
|
|
409
|
+
* connector-scoped setup link, never bound) has no owning flow: its owner
|
|
410
|
+
* may move it to environment delivery. Unknown while connectors load.
|
|
411
|
+
*/
|
|
412
|
+
const connectorBound = row?.consumer !== 'connector' ||
|
|
413
|
+
connectorsLoading ||
|
|
414
|
+
connectors.some((connector) => connector.secretIdentifier === row?.identifier);
|
|
415
|
+
const unboundConnectorRow = row?.consumer === 'connector' && !connectorBound;
|
|
416
|
+
const usageContext = { connectorBound, picked: pickedExposure !== null };
|
|
417
|
+
const { strategy, consumer: nextConsumer } = secretDeliveryTarget(exposure, row, usageContext);
|
|
408
418
|
/**
|
|
409
419
|
* The LLM gateway, a connector, or the git connection owns this row's
|
|
410
420
|
* usage, so the picker must not be shown at all. It writes three
|
|
411
421
|
* `(strategy, consumer)` pairs and none of them is the one this row has;
|
|
412
422
|
* rendering it would silently disconnect whatever assigned it.
|
|
413
423
|
*/
|
|
414
|
-
const usageAssigned = secretUsageIsAssigned(row?.consumer);
|
|
424
|
+
const usageAssigned = secretUsageIsAssigned(row?.consumer, usageContext);
|
|
425
|
+
/** The picker's value: an unbound connector row reads as Connector until moved. */
|
|
426
|
+
const pickerValue = unboundConnectorRow && pickedExposure === null ? 'connector' : exposure;
|
|
415
427
|
const [selectedConnectorSlugs, setSelectedConnectorSlugs] = useState(null);
|
|
416
428
|
const effectiveSelectedConnectorSlugs = selectedConnectorSlugs ??
|
|
417
429
|
connectors
|
|
@@ -452,7 +464,8 @@ function SecretDialog({ open, onOpenChange, projectId, row, connectors, connecto
|
|
|
452
464
|
const prepareSavePlan = () => {
|
|
453
465
|
const finalKey = (row?.key ?? key).trim().toUpperCase();
|
|
454
466
|
const finalIdentifier = (row?.identifier ?? identifier).trim() || finalKey;
|
|
455
|
-
const
|
|
467
|
+
const keepsConnector = row?.consumer === 'connector' && nextConsumer === 'connector';
|
|
468
|
+
const nextConnectorSlugs = keepsConnector ? effectiveSelectedConnectorSlugs : [];
|
|
456
469
|
const bindingChanges = connectorBindingChanges(connectors, finalIdentifier, nextConnectorSlugs);
|
|
457
470
|
if (!SECRET_NAME_REGEX.test(finalKey)) {
|
|
458
471
|
throw new Error('Key: use A-Z, 0-9, _ only. Must start with a letter or _. Max 64 chars.');
|
|
@@ -472,7 +485,9 @@ function SecretDialog({ open, onOpenChange, projectId, row, connectors, connecto
|
|
|
472
485
|
if (needsHosts && !enforcedPolicy) {
|
|
473
486
|
throw new Error('Add at least one exact HTTPS host.');
|
|
474
487
|
}
|
|
475
|
-
|
|
488
|
+
// An unbound connector row may be saved unbound (a new value); a bound one
|
|
489
|
+
// keeps at least one connector.
|
|
490
|
+
if (keepsConnector && connectorBound && nextConnectorSlugs.length === 0) {
|
|
476
491
|
throw new Error('Select at least one connector.');
|
|
477
492
|
}
|
|
478
493
|
if (!nextSharedWith) {
|
|
@@ -651,6 +666,7 @@ function SecretDialog({ open, onOpenChange, projectId, row, connectors, connecto
|
|
|
651
666
|
? `Edit ${row.identifier}`
|
|
652
667
|
: `Set ${row.identifier}`;
|
|
653
668
|
const selectedDelivery = secretDeliveryPresentation(strategy, nextConsumer, { tI18nComplete });
|
|
669
|
+
const connectorOnlyDelivery = secretDeliveryPresentation('broker', 'connector', { tI18nComplete });
|
|
654
670
|
const bindingIdentifier = (row?.identifier ?? identifier).trim() || key.trim().toUpperCase();
|
|
655
671
|
const connectorOptions = connectorBindingOptions(connectors, bindingIdentifier, tI18nComplete);
|
|
656
672
|
// Offer "Enforce at the network" only when the experimental flag is on, or
|
|
@@ -703,7 +719,7 @@ function SecretDialog({ open, onOpenChange, projectId, row, connectors, connecto
|
|
|
703
719
|
/* Read-only, because another flow assigned it. Same treatment
|
|
704
720
|
the git-connection secret always had, now covering the LLM
|
|
705
721
|
gateway and connector rows it was always true of. */
|
|
706
|
-
_jsxs("div", { id: "secret-dialog-delivery", className: "border-border bg-sidebar rounded-md border p-3", children: [_jsx(Badge, { variant: selectedDelivery.tone, size: "sm", children: selectedDelivery.label }), _jsxs("p", { className: "text-muted-foreground mt-2 text-xs text-pretty", children: [selectedDelivery.description, " ", tI18nComplete.raw('text5740535823f9')] })] })) : (_jsxs(Select, { value:
|
|
722
|
+
_jsxs("div", { id: "secret-dialog-delivery", className: "border-border bg-sidebar rounded-md border p-3", children: [_jsx(Badge, { variant: selectedDelivery.tone, size: "sm", children: selectedDelivery.label }), _jsxs("p", { className: "text-muted-foreground mt-2 text-xs text-pretty", children: [selectedDelivery.description, " ", tI18nComplete.raw('text5740535823f9')] })] })) : (_jsxs(Select, { value: pickerValue, onValueChange: (next) => setPickedExposure(next === 'connector' ? null : next), disabled: save.isPending, children: [_jsx(SelectTrigger, { id: "secret-dialog-delivery", className: "min-h-10 w-full", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [unboundConnectorRow && (_jsx(SelectItem, { value: "connector", description: connectorOnlyDelivery.description, children: connectorOnlyDelivery.label })), exposureOptions.map((option) => (_jsx(SelectItem, { value: option.exposure, description: option.description, children: option.label }, option.exposure)))] })] })), !usageAssigned && (_jsx(FieldDescription, { children: selectedDelivery.description }))] }), strategy === 'runtime' && (_jsxs(Alert, { variant: "warning", children: [_jsx(AlertTitle, { children: tI18nComplete.raw('text4fb8319405f3') }), _jsx(AlertDescription, { children: tI18nComplete.raw('textdb71b63b5778') })] })), grantNotice && (_jsxs(BannerAlert, { variant: "warning", className: "[&_[data-slot=alert-content]]:min-w-0", children: [_jsx(BannerAlertMedia, { children: _jsx(DangerTriangleSolid, { weight: "fill" }) }), _jsx(BannerAlertTitle, { children: grantNotice.title }), _jsxs(BannerAlertDescription, { children: [_jsx("span", { className: "block text-pretty", children: grantNotice.body }), grantPlan.candidates.length > 0 && (_jsxs("div", { className: "mt-3 flex flex-wrap items-center gap-2", children: [grantPlan.candidates.length > 1 && (_jsxs(Select, { value: selectedGrantAgent ?? '', onValueChange: setGrantAgent, disabled: grant.isPending, children: [_jsx(SelectTrigger, { "aria-label": tI18nComplete.raw('text33e745179bcb'), className: "h-8 w-48", children: _jsx(SelectValue, { placeholder: tI18nComplete.raw('textb6890bc23a9c') }) }), _jsx(SelectContent, { children: grantPlan.candidates.map((candidate) => (_jsx(SelectItem, { value: candidate.name, description: agentGrantCandidateHint(candidate) ?? undefined, children: candidate.name }, candidate.name))) })] })), _jsxs(Button, { type: "button", size: "sm", onClick: startGrant, disabled: !selectedGrantAgent || grant.isPending, children: [grant.isPending ? _jsx(Loading, { className: "size-3.5 shrink-0" }) : null, agentGrantActionLabel(grantPlan, selectedGrantAgent)] })] })), grantPlan.candidates.length === 0 && (_jsx("span", { className: "text-muted-foreground mt-2 block text-xs text-pretty", children: tI18nComplete.raw('textf23c70160b5b') })), selectedGrantHint && (_jsx("span", { className: "text-muted-foreground mt-2 block text-xs text-pretty", children: selectedGrantHint })), grant.error && (_jsx("span", { className: "text-kortix-red mt-2 block text-xs text-pretty", children: agentGrantErrorMessage(grant.error) })), _jsx("pre", { className: "border-border bg-muted mt-2 overflow-x-auto rounded-sm border p-2 font-mono text-xs leading-relaxed", children: grantManifest })] })] })), needsHosts && (_jsxs("div", { className: "border-border bg-sidebar space-y-4 rounded-md border p-3", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-sm font-medium", children: tI18nComplete.raw('textd3297c00f7a2') }), _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: tI18nComplete.raw('text76f48924ee10') })] }), _jsxs(BannerAlert, { variant: "default", className: "[&_[data-slot=alert-content]]:min-w-0", children: [_jsx(BannerAlertTitle, { children: echoNotice.title }), _jsxs(BannerAlertDescription, { children: [_jsx("span", { className: "block text-pretty", children: echoNotice.body }), _jsx("pre", { className: "border-border bg-muted mt-2 overflow-x-auto rounded-sm border p-2 font-mono text-xs leading-relaxed", children: echoNotice.probe }), _jsx(Link, { href: echoNotice.docsHref, target: "_blank", rel: "noreferrer", className: "text-muted-foreground hover:text-foreground mt-2 inline-block text-xs underline underline-offset-2", children: echoNotice.docsLabel })] })] }), _jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: "secret-dialog-hosts", children: tI18nComplete.raw('textbba9af131107') }), _jsx(Textarea, { id: "secret-dialog-hosts", value: hosts, onChange: (event) => setEditedHosts(event.target.value), placeholder: tI18nComplete.raw('text07de8e6e567f'), minHeight: 56, maxHeight: 112, variant: "outline", className: "font-mono text-xs", disabled: save.isPending }), _jsx(FieldDescription, { children: tI18nComplete.raw('text80befc2e0620') })] }), legacyDetail && (_jsxs("div", { className: "border-border bg-popover space-y-2 rounded-md border p-3", children: [_jsx("p", { className: "text-sm font-medium", children: legacyDetail.title }), _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: legacyDetail.body }), _jsx("dl", { className: "text-muted-foreground space-y-0.5 font-mono text-xs", children: legacyDetail.lines.map((line) => (_jsx("dd", { children: line }, line))) }), _jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => setLegacyInject(null), disabled: save.isPending, children: tI18nComplete.raw('text4a72652fb7e7') })] }))] })), row?.consumer === 'connector' && nextConsumer === 'connector' && (_jsx("div", { className: "border-border bg-sidebar space-y-4 rounded-md border p-3", children: _jsxs(Field, { children: [_jsx(FieldLabel, { children: tI18nComplete.raw('textc3d2e79ebdd0') }), connectorsLoading ? (_jsxs("div", { className: "space-y-2", children: [_jsx(Skeleton, { className: "h-12 rounded-md" }), _jsx(Skeleton, { className: "h-12 rounded-md" })] })) : connectorOptions.length === 0 ? (_jsxs(BannerAlert, { variant: "default", children: [_jsx(BannerAlertTitle, { children: tI18nComplete.raw('text10798ef769fd') }), _jsx(BannerAlertDescription, { children: tI18nComplete.raw('text0b834e60371f') })] })) : (_jsx("div", { className: "bg-popover overflow-hidden rounded-md border", children: connectorOptions.map((option, index) => (_jsxs("label", { className: cn('flex min-h-12 items-center gap-3 px-3 py-2', index > 0 && 'border-t', option.disabled ? 'cursor-not-allowed opacity-60' : 'cursor-pointer'), children: [_jsx(Checkbox, { checked: effectiveSelectedConnectorSlugSet.has(option.slug), disabled: option.disabled || save.isPending, onCheckedChange: (checked) => {
|
|
707
723
|
setSelectedConnectorSlugs((current) => checked
|
|
708
724
|
? [
|
|
709
725
|
...new Set([
|