@kortix/ui 0.15.8 → 0.15.9
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 +4 -1
- 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/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 +27 -7
- 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/providers/provider-accordion.js +5 -4
- package/dist/customize/providers/provider-connect.js +3 -1
- package/dist/customize/providers/provider-sheet.js +9 -4
- package/dist/customize/sections/component/email-connect-form.js +4 -2
- 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/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/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/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 +48 -0
- package/dist/i18n/en.js +51 -3
- 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/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/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/lib/z-stack.d.ts +5 -1
- package/dist/lib/z-stack.js +12 -2
- package/dist/session/models/model-connection-gate.js +16 -3
- package/dist/session/models/model-picker-panel.js +6 -2
- 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/prompts/session-connect-prompt.d.ts +40 -0
- package/dist/session/prompts/session-connect-prompt.js +126 -0
- package/dist/session/status/session-error-banner.d.ts +1 -1
- package/dist/session/status/session-error-banner.js +12 -4
- package/dist/session/thread/session-chat.js +7 -2
- package/dist/session/thread/transcript.js +31 -7
- package/dist/test-utils/intl.d.ts +48 -0
- package/package.json +3 -3
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type AdminConnector } from '@kortix/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* True when this MCP connector's accounts sign in through the server's
|
|
4
|
+
* one-click OAuth, not a typed credential. The banner and the account rows then
|
|
5
|
+
* say "Sign in", never "credential".
|
|
6
|
+
*
|
|
7
|
+
* Whether a server signs in with OAuth is a property of the server, so one
|
|
8
|
+
* account answers for the connector: the probe is the same discovery Install
|
|
9
|
+
* and the row's sign-in run. Only an account the caller may change can be
|
|
10
|
+
* probed; any other answer (no account, a refusal, no OAuth) is `false`, and
|
|
11
|
+
* the page keeps the credential wording.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useMcpOAuthSignIn(projectId: string, connector: Pick<AdminConnector, 'provider' | 'authSecret'>, connectionId: string | null): boolean;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { discoverConnectionOAuth2Resource } from '@kortix/sdk';
|
|
3
|
+
import { useQuery } from '@tanstack/react-query';
|
|
4
|
+
import { autoConnectPlan } from '../../sections/connector-oauth2-auto.js';
|
|
5
|
+
/**
|
|
6
|
+
* True when this MCP connector's accounts sign in through the server's
|
|
7
|
+
* one-click OAuth, not a typed credential. The banner and the account rows then
|
|
8
|
+
* say "Sign in", never "credential".
|
|
9
|
+
*
|
|
10
|
+
* Whether a server signs in with OAuth is a property of the server, so one
|
|
11
|
+
* account answers for the connector: the probe is the same discovery Install
|
|
12
|
+
* and the row's sign-in run. Only an account the caller may change can be
|
|
13
|
+
* probed; any other answer (no account, a refusal, no OAuth) is `false`, and
|
|
14
|
+
* the page keeps the credential wording.
|
|
15
|
+
*/
|
|
16
|
+
export function useMcpOAuthSignIn(projectId, connector, connectionId) {
|
|
17
|
+
const enabled = connector.provider === 'mcp' && Boolean(connector.authSecret) && Boolean(connectionId);
|
|
18
|
+
const query = useQuery({
|
|
19
|
+
queryKey: ['connector-oauth-sign-in', projectId, connectionId],
|
|
20
|
+
queryFn: async () => {
|
|
21
|
+
const { discovery } = await discoverConnectionOAuth2Resource(projectId, connectionId);
|
|
22
|
+
return autoConnectPlan(discovery).kind === 'register';
|
|
23
|
+
},
|
|
24
|
+
enabled,
|
|
25
|
+
staleTime: 10 * 60_000,
|
|
26
|
+
retry: false,
|
|
27
|
+
});
|
|
28
|
+
return enabled && query.data === true;
|
|
29
|
+
}
|
|
@@ -42,7 +42,7 @@ import { ChatGptSubscriptionConnect, useSubscriptionSignIn, } from '../sections/
|
|
|
42
42
|
import { useConnectedProviders } from '../sections/llm-provider/use-connected-providers.js';
|
|
43
43
|
import { useLiveLlmProviderCatalog, useLlmProviderCatalogRevision, } from '../sections/llm-provider/use-live-catalog.js';
|
|
44
44
|
import { orderProviderRows } from '../sections/llm-provider/utils.js';
|
|
45
|
-
import { AccountSecretResourcesPanel } from '../sections/view/account-secret-resources-panel.js';
|
|
45
|
+
import { AccountSecretResourcesPanel, PooledProvidersNote } from '../sections/view/account-secret-resources-panel.js';
|
|
46
46
|
import { LegacyChatGptUsage, SubscriptionUsageSection } from '../sections/view/subscription-usage.js';
|
|
47
47
|
import { useTranslations } from '../../i18n/index.js';
|
|
48
48
|
import { LLM_PROVIDERS, LLM_PROVIDER_BY_ID } from '../../internal/lib/llm-providers.js';
|
|
@@ -180,7 +180,7 @@ function ExpandedBody({ projectId, entry, status, keyConnected, canWrite, enable
|
|
|
180
180
|
content = (_jsx(AccordionSubRow, { children: entry.hint }));
|
|
181
181
|
}
|
|
182
182
|
else if (pooled.pooledSecretsEnabled && pooled.accountId && entry.id === 'openai') {
|
|
183
|
-
content = (_jsxs("div", { className: "border-border space-y-3 border-t py-3", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "codex", compact: true }), _jsx("p", { className: "text-foreground text-xs font-medium", children: tPooled('chatGptAccounts') }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: "codex", providerName: "ChatGPT Plus/Pro", envVar: "CODEX_AUTH_JSON", canWrite: true, oauth: { projectId, onConnected: () => undefined } }), _jsx(ChatGptSubscriptionConnect, { projectId: projectId, onConnected: () => undefined, legacyOnly: true, usageSlot: _jsx(LegacyChatGptUsage, { accountId: pooled.accountId, projectId: projectId }) })] }));
|
|
183
|
+
content = (_jsxs("div", { className: "border-border space-y-3 border-t py-3", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "codex", compact: true }), _jsx("p", { className: "text-foreground text-xs font-medium", children: tPooled('chatGptAccounts') }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: "codex", providerName: "ChatGPT Plus/Pro", envVar: "CODEX_AUTH_JSON", canWrite: true, oauth: { projectId, onConnected: () => undefined } }), _jsx(ChatGptSubscriptionConnect, { projectId: projectId, onConnected: () => undefined, legacyOnly: true, usageSlot: _jsx(LegacyChatGptUsage, { accountId: pooled.accountId, projectId: projectId }) }), _jsx("p", { className: "text-foreground pt-3 text-xs font-medium", children: tPooled('providerKeysFor', { provider: entry.label }) }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true })] }));
|
|
184
184
|
}
|
|
185
185
|
else if (pooled.pooledSecretsEnabled && pooled.accountId && entry.id === 'anthropic') {
|
|
186
186
|
// Claude accounts, exactly as OpenAI lists ChatGPT accounts; Anthropic API keys below them.
|
|
@@ -282,7 +282,8 @@ export function ProviderAccordion({ projectId, canWrite = false, enabled = true,
|
|
|
282
282
|
const singleKey = entry.envVars.length === 1 &&
|
|
283
283
|
!SUBSCRIPTION_BY_PROVIDER[entry.id] &&
|
|
284
284
|
!(pooled.pooledSecretsEnabled && supportsPooledProviderKey(entry));
|
|
285
|
-
|
|
285
|
+
// A key saved through the form lands in the named store ("Workspace key").
|
|
286
|
+
const keyConnected = connectedIds.has(entry.id) || pooled.pooledProviderIds.has(entry.id);
|
|
286
287
|
if (addingId === row.id && singleKey && canWrite) {
|
|
287
288
|
return (_jsx(InlineAddKeyRow, { projectId: projectId, entry: entry, row: row, onDone: () => setAddingId(null) }, row.id));
|
|
288
289
|
}
|
|
@@ -318,7 +319,7 @@ export function ProviderAccordion({ projectId, canWrite = false, enabled = true,
|
|
|
318
319
|
event.stopPropagation();
|
|
319
320
|
setSearchOpen(false);
|
|
320
321
|
}
|
|
321
|
-
} }), _jsx(InputGroupSearchClear, { onClick: () => setSearch('') })] }) })) : null, pooled.pooledSecretsEnabled || !canWrite ? (_jsx(
|
|
322
|
+
} }), _jsx(InputGroupSearchClear, { onClick: () => setSearch('') })] }) })) : null, pooled.pooledSecretsEnabled || !canWrite ? (pooled.pooledSecretsEnabled ? (_jsx(PooledProvidersNote, { projectId: projectId, className: "text-muted-foreground px-1 pb-2 text-xs text-pretty" })) : (_jsx("p", { className: "text-muted-foreground px-1 pb-2 text-xs text-pretty", children: t('readOnly') }))) : null, empty ? (_jsx(EmptyState, { size: "sm", title: t('noMatch', { query: search.trim() }) })) : (_jsxs(_Fragment, { children: [inUse.length > 0 ? (_jsx(AccordionGroupLabel, { label: `${t('inUse')} · ${inUse.length}`, action: searchOpen ? null : searchButton })) : null, inUse.map(renderRow), visibleAvailable.length > 0 ? (_jsx(AccordionGroupLabel, { label: t('available'), className: inUse.length > 0 ? 'pt-3.5' : undefined, action: inUse.length === 0 && !searchOpen ? searchButton : null })) : null, visibleAvailable.map(renderRow)] })), hiddenCount > 0 ? (_jsxs("div", { className: "flex items-center gap-2 px-1 pt-1", "data-provider-load-more": "", children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: () => setVisibleCount((shown) => shown + PROVIDER_PAGE_SIZE), children: t('showMore') }), _jsx("span", { className: "text-muted-foreground text-xs tabular-nums", children: t('shownOf', {
|
|
322
323
|
shown: inUse.length + visibleAvailable.length,
|
|
323
324
|
total: inUse.length + available.length,
|
|
324
325
|
}) })] })) : null] }));
|
|
@@ -37,6 +37,7 @@ import { PLATFORM_FEE_PERCENT } from '../../internal/billing/compute-pricing.js'
|
|
|
37
37
|
import { FIRST_CLASS_PROVIDER_IDS, PROVIDER_SUBSCRIPTIONS, getProjectDetail, providerConnectMethod, providerConnectedVia, } from '@kortix/sdk';
|
|
38
38
|
import { qk, useAccountSecretResources, useFeatureFlag, useModelAccess, useProjectModelPickerCatalog, } from '@kortix/sdk/react';
|
|
39
39
|
import { useQuery } from '@tanstack/react-query';
|
|
40
|
+
import { useCanShareProviderAccounts } from '../sections/view/account-secret-resources-panel.js';
|
|
40
41
|
import { SUBSCRIPTION_ROW, SubscriptionRowMeter, summarizeSubscriptions, useLiveSubscriptionUsages, useSubscriptionLogins, useSubscriptionRowSummary, } from '../sections/view/subscription-usage.js';
|
|
41
42
|
export { FIRST_CLASS_PROVIDER_IDS, supportsPooledProviderKey, } from '@kortix/sdk';
|
|
42
43
|
/** Providers whose sheet offers a subscription sign-in beside the API key. */
|
|
@@ -184,6 +185,7 @@ export function ProviderConnect({ projectId, canWrite = false, enabled = true, s
|
|
|
184
185
|
const access = useModelAccess(enabled ? projectId : null);
|
|
185
186
|
const managedProvider = useManagedProvider(enabled ? projectId : null);
|
|
186
187
|
const pooled = usePooledProviderIds(projectId, enabled);
|
|
188
|
+
const canShare = useCanShareProviderAccounts(projectId);
|
|
187
189
|
useLiveLlmProviderCatalog(projectId, enabled);
|
|
188
190
|
const catalogRevision = useLlmProviderCatalogRevision();
|
|
189
191
|
const { connectedProviders, providerStateLoading } = useConnectedProviders(projectId, enabled);
|
|
@@ -259,7 +261,7 @@ export function ProviderConnect({ projectId, canWrite = false, enabled = true, s
|
|
|
259
261
|
return (_jsx(ErrorState, { size: "sm", title: tPooled('loadError'), action: _jsx(Button, { size: "sm", variant: "secondary", disabled: pooled.isFetching, onClick: pooled.refetch, children: common('retry') }) }));
|
|
260
262
|
}
|
|
261
263
|
return (_jsx(ProviderConnectView, { inUse: inUse, available: visibleAvailable, totalCount: searchable.length, hiddenCount: available.length - visibleAvailable.length, onLoadMore: () => setVisibleCount((shown) => shown + PROVIDER_PAGE_SIZE), search: search, onSearchChange: setSearch, selectedId: selectedId, onSelect: onSelect, note: pooled.pooledSecretsEnabled
|
|
262
|
-
? tPooled('sharedDescription')
|
|
264
|
+
? tPooled(canShare ? 'sharedDescription' : 'sharedOnlyYouDescription')
|
|
263
265
|
: canWrite
|
|
264
266
|
? undefined
|
|
265
267
|
: t('readOnly'), className: className }));
|
|
@@ -42,7 +42,7 @@ import { ProviderLogoStatus, connectedVia, providerMethod, supportsPooledProvide
|
|
|
42
42
|
import { ChatGptSubscriptionConnect, useSubscriptionSignIn, } from '../sections/llm-provider/chatgpt-subscription-connect.js';
|
|
43
43
|
import { useConnectedProviders } from '../sections/llm-provider/use-connected-providers.js';
|
|
44
44
|
import { envVarPlaceholder, formatTokenCount, prettyFieldLabel, providerDisconnectPlan, } from '../sections/llm-provider/utils.js';
|
|
45
|
-
import { AccountSecretResourcesPanel } from '../sections/view/account-secret-resources-panel.js';
|
|
45
|
+
import { AccountSecretResourcesPanel, useCanShareProviderAccounts } from '../sections/view/account-secret-resources-panel.js';
|
|
46
46
|
import { LegacyChatGptUsage, SubscriptionUsageSection } from '../sections/view/subscription-usage.js';
|
|
47
47
|
import { useTranslations } from '../../i18n/index.js';
|
|
48
48
|
import { LLM_PROVIDER_BY_ID } from '../../internal/lib/llm-providers.js';
|
|
@@ -266,6 +266,7 @@ export function ProviderSheet({ projectId, providerId, canWrite, enabled = true,
|
|
|
266
266
|
const access = useModelAccess(enabled ? projectId : null);
|
|
267
267
|
const managed = useManagedProvider(enabled ? projectId : null);
|
|
268
268
|
const pooled = usePooledProviderIds(projectId, enabled);
|
|
269
|
+
const canShare = useCanShareProviderAccounts(projectId);
|
|
269
270
|
const { connectedProviders } = useConnectedProviders(projectId, enabled);
|
|
270
271
|
const entry = providerId === 'kortix' ? managed : LLM_PROVIDER_BY_ID.get(providerId);
|
|
271
272
|
if (!entry)
|
|
@@ -284,17 +285,21 @@ export function ProviderSheet({ projectId, providerId, canWrite, enabled = true,
|
|
|
284
285
|
.setEnabled({ target: 'provider', id: entry.id, enabled: next })
|
|
285
286
|
.catch((error) => errorToast(error instanceof Error ? error.message : tAccess('providerError'))) })) : null;
|
|
286
287
|
const models = (_jsxs(_Fragment, { children: [status !== 'none' ? accessRow : null, _jsx(ProviderModelsList, { models: entry.models, connected: status !== 'none' })] }));
|
|
287
|
-
|
|
288
|
+
// A key form writes the named store now (the API files it as a "Workspace
|
|
289
|
+
// key"), so a key saved there counts as this provider's saved key too.
|
|
290
|
+
const bodyProps = {
|
|
291
|
+
projectId, entry, connected: keyConnected || pooled.pooledProviderIds.has(entry.id), canWrite, models,
|
|
292
|
+
};
|
|
288
293
|
let content;
|
|
289
294
|
if (method === 'included') {
|
|
290
295
|
content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_jsx("p", { className: "text-muted-foreground text-sm text-pretty", children: entry.hint }), models] }));
|
|
291
296
|
}
|
|
292
297
|
else if (pooled.pooledSecretsEnabled && pooled.accountId && entry.id === 'openai') {
|
|
293
|
-
content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "codex" }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('chatGptAccounts') }), _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: tPooled('oauthPrivateDescription') }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: "codex", providerName: "ChatGPT Plus/Pro", envVar: "CODEX_AUTH_JSON", canWrite: true, oauth: { projectId, onConnected: () => undefined } }), _jsx(ChatGptSubscriptionConnect, { projectId: projectId, onConnected: () => undefined, legacyOnly: true, usageSlot: _jsx(LegacyChatGptUsage, { accountId: pooled.accountId, projectId: projectId }) })] }), models] }));
|
|
298
|
+
content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "codex" }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('chatGptAccounts') }), _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: tPooled(canShare ? 'oauthPrivateDescription' : 'oauthOnlyYouDescription') }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: "codex", providerName: "ChatGPT Plus/Pro", envVar: "CODEX_AUTH_JSON", canWrite: true, oauth: { projectId, onConnected: () => undefined } }), _jsx(ChatGptSubscriptionConnect, { projectId: projectId, onConnected: () => undefined, legacyOnly: true, usageSlot: _jsx(LegacyChatGptUsage, { accountId: pooled.accountId, projectId: projectId }) })] }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('providerKeysFor', { provider: entry.label }) }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true })] }), models] }));
|
|
294
299
|
}
|
|
295
300
|
else if (pooled.pooledSecretsEnabled && pooled.accountId && entry.id === 'anthropic') {
|
|
296
301
|
// Claude accounts, exactly as OpenAI lists ChatGPT accounts; Anthropic API keys below them.
|
|
297
|
-
content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "claude-agent" }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('claudeAccounts') }), _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: tPooled('claudeOauthPrivateDescription') }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: "claude-agent", providerName: "Claude Pro/Max", envVar: "CLAUDE_CODE_OAUTH_TOKEN", canWrite: true, oauth: { projectId, onConnected: () => undefined, kind: 'claude' } })] }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('providerKeysFor', { provider: entry.label }) }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true })] }), models] }));
|
|
302
|
+
content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "claude-agent" }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('claudeAccounts') }), _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: tPooled(canShare ? 'claudeOauthPrivateDescription' : 'claudeOauthOnlyYouDescription') }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: "claude-agent", providerName: "Claude Pro/Max", envVar: "CLAUDE_CODE_OAUTH_TOKEN", canWrite: true, oauth: { projectId, onConnected: () => undefined, kind: 'claude' } })] }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('providerKeysFor', { provider: entry.label }) }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true })] }), models] }));
|
|
298
303
|
}
|
|
299
304
|
else if (pooled.pooledSecretsEnabled && pooled.accountId && supportsPooledProviderKey(entry)) {
|
|
300
305
|
content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true }), models] }));
|
|
@@ -92,6 +92,8 @@ export function EmailConnectForm({ projectId, account, onConnected, }) {
|
|
|
92
92
|
const managedAvailable = mode.data?.managed_available === true;
|
|
93
93
|
// An older server omits it; the address preview then shows "…".
|
|
94
94
|
const managedDomain = mode.data?.managed_domain || '…';
|
|
95
|
+
// Outside prod the server ends a managed address in `.<env>` (`agent.dev@`).
|
|
96
|
+
const managedSuffix = mode.data?.managed_suffix ?? '';
|
|
95
97
|
const [homeChoice, setHome] = useState(null);
|
|
96
98
|
// Until the user picks, the home follows what the deployment offers.
|
|
97
99
|
const home = managedAvailable ? (homeChoice ?? 'own') : 'own';
|
|
@@ -128,7 +130,7 @@ export function EmailConnectForm({ projectId, account, onConnected, }) {
|
|
|
128
130
|
const domain = domainChoice || ownDomains.find((d) => d.verified)?.domain || ownDomains[0]?.domain || (key ? ADD_DOMAIN : '');
|
|
129
131
|
const selected = home === 'own' ? ownDomains.find((d) => d.domain === domain) : undefined;
|
|
130
132
|
const addressDomain = home === 'managed' ? managedDomain : !domain || domain === ADD_DOMAIN ? '…' : domain;
|
|
131
|
-
const address = `${username || 'agent'}@${addressDomain}`;
|
|
133
|
+
const address = `${username || 'agent'}${home === 'managed' ? managedSuffix : ''}@${addressDomain}`;
|
|
132
134
|
const domainReady = home === 'managed' || (Boolean(domain) && domain !== ADD_DOMAIN && selected?.verified !== false);
|
|
133
135
|
const submit = () => {
|
|
134
136
|
setError(null);
|
|
@@ -155,7 +157,7 @@ export function EmailConnectForm({ projectId, account, onConnected, }) {
|
|
|
155
157
|
sender_policy: policy,
|
|
156
158
|
}, { onSuccess: onConnected, onError: (e) => setError(e.message) });
|
|
157
159
|
};
|
|
158
|
-
return (_jsxs("div", { className: "space-y-6", children: [_jsxs("section", { className: "space-y-3", children: [_jsx("h3", { className: "text-foreground text-sm font-medium", children: managedAvailable ? t('homeTitle') : t('homeOwn') }), managedAvailable ? (_jsxs(RadioGroup, { value: home, onValueChange: (v) => setHome(v), className: "grid gap-2 sm:grid-cols-2", children: [_jsx(RadioGroupItem, { value: "own", variant: "outline", label: t('homeOwn'), description: t('homeOwnHint') }), _jsx(RadioGroupItem, { value: "managed", variant: "outline", label: t('homeManaged'), description: t('homeManagedHint', { domain: managedDomain }) })] })) : null, home === 'own' ? (_jsxs("p", { className: "text-muted-foreground text-sm text-pretty", children: [t('ownNeeds'), ' ', _jsx(Link, { href: RESEND_LINKS.apiKeys, target: "_blank", rel: "noopener noreferrer", className: "text-foreground underline underline-offset-2", children: t('linkApiKeys') }), ' · ', _jsx(Link, { href: RESEND_LINKS.receiving, target: "_blank", rel: "noopener noreferrer", className: "text-foreground underline underline-offset-2", children: t('linkReceiving') }), ' · ', _jsx(Link, { href: RESEND_LINKS.inboxes, target: "_blank", rel: "noopener noreferrer", className: "text-foreground underline underline-offset-2", children: t('linkInboxes') })] })) : null, home === 'own' ? (_jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: "email-connect-key", children: t('keyLabel') }), _jsx(Input, { id: "email-connect-key", type: "password", value: apiKey, onChange: (e) => setApiKey(e.target.value), placeholder: "re_\u2026", autoComplete: "off", spellCheck: false }), _jsx(FieldDescription, { children: listDomains.isPending ? t('keyChecking') : listDomains.isError ? (_jsx("span", { className: "text-destructive", children: listDomains.error.message })) : listDomains.data && key ? (t('keyOk', { count: listDomains.data.domains.length })) : (t('keyHint')) })] })) : null] }), !attachOpen ? (_jsxs("section", { className: "space-y-3", children: [_jsx("h3", { className: "text-foreground text-sm font-medium", children: t('addressTitle') }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { "aria-label": t('usernameLabel'), value: username, onChange: (e) => setUsername(e.target.value.toLowerCase().replace(/[^a-z0-9._-]/g, '')), placeholder: "
|
|
160
|
+
return (_jsxs("div", { className: "space-y-6", children: [_jsxs("section", { className: "space-y-3", children: [_jsx("h3", { className: "text-foreground text-sm font-medium", children: managedAvailable ? t('homeTitle') : t('homeOwn') }), managedAvailable ? (_jsxs(RadioGroup, { value: home, onValueChange: (v) => setHome(v), className: "grid gap-2 sm:grid-cols-2", children: [_jsx(RadioGroupItem, { value: "own", variant: "outline", label: t('homeOwn'), description: t('homeOwnHint') }), _jsx(RadioGroupItem, { value: "managed", variant: "outline", label: t('homeManaged'), description: t('homeManagedHint', { domain: managedDomain }) })] })) : null, home === 'own' ? (_jsxs("p", { className: "text-muted-foreground text-sm text-pretty", children: [t('ownNeeds'), ' ', _jsx(Link, { href: RESEND_LINKS.apiKeys, target: "_blank", rel: "noopener noreferrer", className: "text-foreground underline underline-offset-2", children: t('linkApiKeys') }), ' · ', _jsx(Link, { href: RESEND_LINKS.receiving, target: "_blank", rel: "noopener noreferrer", className: "text-foreground underline underline-offset-2", children: t('linkReceiving') }), ' · ', _jsx(Link, { href: RESEND_LINKS.inboxes, target: "_blank", rel: "noopener noreferrer", className: "text-foreground underline underline-offset-2", children: t('linkInboxes') })] })) : null, home === 'own' ? (_jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: "email-connect-key", children: t('keyLabel') }), _jsx(Input, { id: "email-connect-key", type: "password", value: apiKey, onChange: (e) => setApiKey(e.target.value), placeholder: "re_\u2026", autoComplete: "off", spellCheck: false }), _jsx(FieldDescription, { children: listDomains.isPending ? t('keyChecking') : listDomains.isError ? (_jsx("span", { className: "text-destructive", children: listDomains.error.message })) : listDomains.data && key ? (t('keyOk', { count: listDomains.data.domains.length })) : (t('keyHint')) })] })) : null] }), !attachOpen ? (_jsxs("section", { className: "space-y-3", children: [_jsx("h3", { className: "text-foreground text-sm font-medium", children: t('addressTitle') }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { "aria-label": t('usernameLabel'), value: username, onChange: (e) => setUsername(e.target.value.toLowerCase().replace(/[^a-z0-9._-]/g, '')), placeholder: "orders", autoComplete: "off", spellCheck: false, className: "min-w-0 flex-1" }), home === 'managed' && managedSuffix ? (_jsx("span", { className: "text-muted-foreground text-sm", children: managedSuffix })) : null, _jsx("span", { className: "text-muted-foreground text-sm", children: "@" }), home === 'managed' ? (_jsx("span", { className: "bg-muted text-foreground flex h-9 min-w-0 flex-1 items-center rounded-md px-3 text-sm", children: _jsx("span", { className: "truncate", children: managedDomain }) })) : (_jsxs(Select, { value: domain, onValueChange: setDomain, children: [_jsx(SelectTrigger, { "aria-label": t('domainLabel'), className: "min-w-0 flex-1", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [ownDomains.map((d) => (_jsx(SelectItem, { value: d.domain, children: _jsxs("span", { className: "flex items-center gap-2", children: [d.domain, d.verified ? null : _jsx(Badge, { variant: "secondary", children: t('domainPending') })] }) }, d.domain))), _jsx(SelectSeparator, {}), _jsx(SelectItem, { value: ADD_DOMAIN, disabled: !key, children: t('domainAdd') })] })] }))] }), _jsxs("p", { className: "text-muted-foreground flex items-center gap-1.5 text-xs", children: [_jsx(EnvelopeSimpleIcon, { className: "size-3.5 shrink-0" }), _jsxs("span", { className: "truncate", children: [displayName.trim() || 'Kortix Agent', " <", address, ">"] })] }), home === 'own' && domain === ADD_DOMAIN ? (_jsx(AddDomain, { projectId: projectId, apiKey: key, onAdded: (result) => {
|
|
159
161
|
setAdded((list) => [...list.filter((d) => d.domain !== result.domain.domain), result.domain]);
|
|
160
162
|
setDomain(result.domain.domain);
|
|
161
163
|
} })) : null, home === 'own' && selected && !selected.verified ? (_jsx(DomainRecords, { projectId: projectId, apiKey: key, domain: selected, onChecked: (result) => setAdded((list) => [...list.filter((d) => d.domain !== result.domain.domain), result.domain]) })) : null, _jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: "email-connect-name", children: t('displayNameLabel') }), _jsx(Input, { id: "email-connect-name", value: displayName, onChange: (e) => setDisplayName(e.target.value), placeholder: "Kortix Agent" })] })] })) : null, _jsxs("section", { className: "space-y-3", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-foreground text-sm font-medium", children: t('sendersTitle') }), _jsx("p", { className: "text-muted-foreground mt-1 text-xs", children: t('sendersHint') })] }), _jsxs(RadioGroup, { value: senders, onValueChange: (v) => setSenders(v), children: [viewerEmail ? _jsx(RadioGroupItem, { value: "me", label: t('sendersMe', { email: viewerEmail }) }) : null, teamDomain ? _jsx(RadioGroupItem, { value: "team", label: t('sendersTeam', { domain: teamDomain }) }) : null, _jsx(RadioGroupItem, { value: "custom", label: t('sendersCustom') }), _jsx(RadioGroupItem, { value: "anyone", label: t('sendersAnyone'), description: t('sendersAnyoneHint') })] }), senders === 'custom' ? (_jsx(Textarea, { "aria-label": t('sendersCustom'), value: customList, onChange: (e) => setCustomList(e.target.value), placeholder: t('sendersCustomPlaceholder'), rows: 3, spellCheck: false })) : null] }), _jsxs("section", { className: "space-y-3", children: [_jsx(Button, { type: "button", variant: "text", size: "sm", className: "px-0", onClick: () => setAttachOpen((open) => !open), children: attachOpen ? t('attachClose') : t('attachOpen') }), attachOpen ? (_jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [_jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: "email-connect-inbox-email", children: t('attachEmail') }), _jsx(Input, { id: "email-connect-inbox-email", value: inboxEmail, onChange: (e) => setInboxEmail(e.target.value.trim().toLowerCase()), placeholder: "support@example.com", autoComplete: "off", spellCheck: false })] }), _jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: "email-connect-inbox-id", children: t('attachId') }), _jsx(Input, { id: "email-connect-inbox-id", value: inboxId, onChange: (e) => setInboxId(e.target.value.trim()), autoComplete: "off", spellCheck: false })] }), _jsx("p", { className: "text-muted-foreground text-xs sm:col-span-2", children: t('attachHint') })] })) : null] }), error ? _jsx(BannerAlert, { variant: "destructive", children: _jsx(BannerAlertDescription, { children: error }) }) : null, _jsx("div", { className: "flex justify-end", children: _jsxs(Button, { onClick: submit, disabled: connect.isPending || mode.isLoading || (!attachOpen && !domainReady), children: [connect.isPending ? _jsx(Loading, { className: "size-3.5 shrink-0" }) : null, attachOpen ? t('submitAttach') : t('submitCreate', { address })] }) })] }));
|
|
@@ -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) :
|
|
@@ -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') {
|