@kortix/ui 0.15.6 → 0.15.7
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/customize/providers/provider-accordion.js +3 -2
- package/dist/customize/providers/provider-connect.d.ts +7 -0
- package/dist/customize/providers/provider-connect.js +21 -2
- package/dist/customize/providers/provider-sheet.js +3 -2
- package/dist/customize/sections/gateway-view.d.ts +1 -1
- package/dist/customize/sections/gateway-view.js +29 -14
- package/dist/customize/sections/llm-provider/chatgpt-subscription-connect.d.ts +3 -1
- package/dist/customize/sections/llm-provider/chatgpt-subscription-connect.js +2 -2
- package/dist/customize/sections/view/account-secret-resources-panel.js +4 -3
- package/dist/customize/sections/view/review-center-connected.js +15 -3
- package/dist/customize/sections/view/subscription-usage.d.ts +288 -7
- package/dist/customize/sections/view/subscription-usage.js +257 -30
- package/dist/i18n/en.d.ts +37 -47
- package/dist/i18n/en.js +40 -50
- package/dist/i18n/ui-catalog/app-registry-translation-keys.generated.js +5 -0
- package/dist/internal/auth/auth-primitives.d.ts +27 -0
- package/dist/internal/auth/auth-primitives.js +21 -0
- package/dist/internal/billing/index.d.ts +1 -0
- package/dist/internal/billing/index.js +2 -0
- package/dist/internal/billing/use-free-grant-unspent.d.ts +10 -0
- package/dist/internal/billing/use-free-grant-unspent.js +20 -0
- package/dist/internal/lib/billing/billing-gate-state.d.ts +20 -0
- package/dist/internal/lib/billing/billing-gate-state.js +22 -0
- package/dist/internal/lib/error-handler.js +0 -2
- package/dist/internal/notifications/notification-inbox.js +1 -1
- package/dist/internal/stores/upgrade-dialog-store.d.ts +0 -2
- package/dist/internal/stores/upgrade-dialog-store.js +0 -2
- package/dist/markdown/setup-links/approval-decision.d.ts +1 -1
- package/dist/markdown/setup-links/approval-decision.js +1 -1
- package/dist/session/prompts/ask-deck.d.ts +14 -2
- package/dist/session/prompts/ask-deck.js +6 -2
- package/dist/styles.css +1 -1
- package/dist/test-utils/intl.d.ts +37 -47
- package/dist/workspace/admin/settings-search.js +4 -12
- package/dist/workspace/inbox/workspace-inbox.js +11 -2
- package/dist/workspace/layout/new-session-create.d.ts +4 -2
- package/dist/workspace/layout/new-session-create.js +11 -0
- package/dist/workspace/review/approval-modal.d.ts +6 -6
- package/dist/workspace/review/approval-modal.js +10 -14
- package/dist/workspace/review/review-center.d.ts +9 -2
- package/dist/workspace/review/review-center.js +257 -125
- package/dist/workspace/review/review-detail.d.ts +20 -10
- package/dist/workspace/review/review-detail.js +39 -44
- package/dist/workspace/review/review-meta.d.ts +27 -6
- package/dist/workspace/review/review-meta.js +46 -34
- package/dist/workspace/sidebar/footer/project-download-app-nav.d.ts +10 -0
- package/dist/workspace/sidebar/footer/project-download-app-nav.js +53 -0
- package/dist/workspace/sidebar/footer/promo-nav-row.d.ts +2 -1
- package/dist/workspace/sidebar/footer/promo-nav-row.js +1 -1
- package/dist/workspace/sidebar/project-sidebar.d.ts +6 -1
- package/dist/workspace/sidebar/project-sidebar.js +3 -2
- package/dist/workspace/sidebar/workspace-menu-model.d.ts +19 -13
- package/dist/workspace/sidebar/workspace-menu-model.js +7 -8
- package/package.json +3 -3
- package/dist/customize/sections/view/subscription-usage-tab.d.ts +0 -25
- package/dist/customize/sections/view/subscription-usage-tab.js +0 -121
|
@@ -43,6 +43,7 @@ import { useConnectedProviders } from '../sections/llm-provider/use-connected-pr
|
|
|
43
43
|
import { useLiveLlmProviderCatalog, useLlmProviderCatalogRevision, } from '../sections/llm-provider/use-live-catalog.js';
|
|
44
44
|
import { orderProviderRows } from '../sections/llm-provider/utils.js';
|
|
45
45
|
import { AccountSecretResourcesPanel } from '../sections/view/account-secret-resources-panel.js';
|
|
46
|
+
import { LegacyChatGptUsage, SubscriptionUsageSection } from '../sections/view/subscription-usage.js';
|
|
46
47
|
import { useTranslations } from '../../i18n/index.js';
|
|
47
48
|
import { LLM_PROVIDERS, LLM_PROVIDER_BY_ID } from '../../internal/lib/llm-providers.js';
|
|
48
49
|
import { cn } from '../../internal/lib/utils.js';
|
|
@@ -179,11 +180,11 @@ function ExpandedBody({ projectId, entry, status, keyConnected, canWrite, enable
|
|
|
179
180
|
content = (_jsx(AccordionSubRow, { children: entry.hint }));
|
|
180
181
|
}
|
|
181
182
|
else if (pooled.pooledSecretsEnabled && pooled.accountId && entry.id === 'openai') {
|
|
182
|
-
content = (_jsxs("div", { className: "border-border space-y-3 border-t py-3", children: [_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 })] }));
|
|
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
184
|
}
|
|
184
185
|
else if (pooled.pooledSecretsEnabled && pooled.accountId && entry.id === 'anthropic') {
|
|
185
186
|
// Claude accounts, exactly as OpenAI lists ChatGPT accounts; Anthropic API keys below them.
|
|
186
|
-
content = (_jsxs(_Fragment, { children: [_jsxs("div", { className: "border-border space-y-3 border-t py-3", children: [_jsx("p", { className: "text-foreground text-xs font-medium", children: tPooled('claudeAccounts') }), _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' } })] }), _jsx("div", { className: "border-border border-t py-3", children: _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true }) })] }));
|
|
187
|
+
content = (_jsxs(_Fragment, { children: [_jsxs("div", { className: "border-border space-y-3 border-t py-3", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "claude-agent", compact: true }), _jsx("p", { className: "text-foreground text-xs font-medium", children: tPooled('claudeAccounts') }), _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' } })] }), _jsx("div", { className: "border-border border-t py-3", children: _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true }) })] }));
|
|
187
188
|
}
|
|
188
189
|
else if (pooled.pooledSecretsEnabled && pooled.accountId && supportsPooledProviderKey(entry)) {
|
|
189
190
|
content = (_jsxs(_Fragment, { children: [SUBSCRIPTION_BY_PROVIDER[entry.id] ? _jsx(SignInSubRows, { projectId: projectId, entry: entry, canWrite: canWrite }) : null, _jsx("div", { className: "border-border border-t py-3", children: _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true }) })] }));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type LlmProviderEntry } from '../../internal/lib/llm-providers.js';
|
|
2
2
|
import { type ProviderConnectMethod, type ProviderConnectedVia, providerConnectMethod, providerConnectedVia } from '@kortix/sdk';
|
|
3
|
+
import { type UsageTone } from '../sections/view/subscription-usage.js';
|
|
3
4
|
export { FIRST_CLASS_PROVIDER_IDS, supportsPooledProviderKey, } from '@kortix/sdk';
|
|
4
5
|
/** Providers whose sheet offers a subscription sign-in beside the API key. */
|
|
5
6
|
export declare const SUBSCRIPTION_PROVIDER_IDS: ReadonlySet<string>;
|
|
@@ -25,6 +26,12 @@ export interface ProviderListRow {
|
|
|
25
26
|
via?: ConnectedVia;
|
|
26
27
|
/** Inference turned off for this project; credentials are kept. */
|
|
27
28
|
disabled?: boolean;
|
|
29
|
+
/** ChatGPT and Claude subscription usage across every login: the row's trailing line. */
|
|
30
|
+
usage?: {
|
|
31
|
+
text: string;
|
|
32
|
+
percent: number;
|
|
33
|
+
tone: UsageTone;
|
|
34
|
+
} | null;
|
|
28
35
|
}
|
|
29
36
|
/**
|
|
30
37
|
* The provider logo with its status on the tile's corner: a solid green check
|
|
@@ -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 { SUBSCRIPTION_ROW, SubscriptionRowMeter, summarizeSubscriptions, useLiveSubscriptionUsages, useSubscriptionLogins, useSubscriptionRowSummary, } from '../sections/view/subscription-usage.js';
|
|
40
41
|
export { FIRST_CLASS_PROVIDER_IDS, supportsPooledProviderKey, } from '@kortix/sdk';
|
|
41
42
|
/** Providers whose sheet offers a subscription sign-in beside the API key. */
|
|
42
43
|
export const SUBSCRIPTION_PROVIDER_IDS = new Set(Object.keys(PROVIDER_SUBSCRIPTIONS));
|
|
@@ -92,7 +93,7 @@ function ProviderRow({ row, selected, onSelect, }) {
|
|
|
92
93
|
const tAccess = useTranslations('modelAccess');
|
|
93
94
|
return (_jsxs("button", { type: "button", "data-provider-row": row.id, "aria-current": selected || undefined, onClick: () => onSelect(row.id), className: cn('group flex min-h-12 w-full items-center gap-3 rounded-md px-3 py-2 text-left', 'hover:bg-muted/60 transition-[background-color] duration-(--duration-normal) ease-out', 'focus-visible:ring-ring/50 outline-none focus-visible:ring-2', selected && 'bg-muted hover:bg-muted'), children: [_jsx(ProviderLogoStatus, { providerId: row.id, label: row.label, status: row.status, size: "medium" }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "text-foreground block truncate text-sm font-medium", children: row.label }), _jsx("span", { className: "text-muted-foreground block truncate text-xs", children: row.method === 'included' && row.modelCount === 0
|
|
94
95
|
? row.hint ?? tAccess('managedUpgradeHint')
|
|
95
|
-
: meta(row.method, row.modelCount, row.id, row.via) })] }), row.disabled ? (_jsx("span", { className: "text-muted-foreground shrink-0 text-xs", children: t('turnedOff') })) : null, _jsx(CaretRightIcon, { className: cn('text-muted-foreground size-3.5 shrink-0 transition-[color] duration-(--duration-normal)', 'group-hover:text-foreground', selected && 'text-foreground') })] }));
|
|
96
|
+
: meta(row.method, row.modelCount, row.id, row.via) })] }), row.disabled ? (_jsx("span", { className: "text-muted-foreground shrink-0 text-xs", children: t('turnedOff') })) : row.usage ? (_jsx(SubscriptionRowMeter, { ...row.usage })) : null, _jsx(CaretRightIcon, { className: cn('text-muted-foreground size-3.5 shrink-0 transition-[color] duration-(--duration-normal)', 'group-hover:text-foreground', selected && 'text-foreground') })] }));
|
|
96
97
|
}
|
|
97
98
|
function ProviderGroup({ label, rows, selectedId, onSelect, }) {
|
|
98
99
|
if (rows.length === 0)
|
|
@@ -186,6 +187,23 @@ export function ProviderConnect({ projectId, canWrite = false, enabled = true, s
|
|
|
186
187
|
useLiveLlmProviderCatalog(projectId, enabled);
|
|
187
188
|
const catalogRevision = useLlmProviderCatalogRevision();
|
|
188
189
|
const { connectedProviders, providerStateLoading } = useConnectedProviders(projectId, enabled);
|
|
190
|
+
const subscriptionAccountId = enabled && pooled.pooledSecretsEnabled ? pooled.accountId : null;
|
|
191
|
+
const subscriptions = useSubscriptionLogins(subscriptionAccountId, projectId);
|
|
192
|
+
const liveUsage = useLiveSubscriptionUsages(subscriptionAccountId, projectId, subscriptions.logins);
|
|
193
|
+
const rowSummary = useSubscriptionRowSummary();
|
|
194
|
+
// Each subscription login's live usage, summed per provider row (ChatGPT → OpenAI, Claude → Anthropic).
|
|
195
|
+
const now = Math.max(subscriptions.dataUpdatedAt, liveUsage.updatedAt);
|
|
196
|
+
const usageByRow = useMemo(() => {
|
|
197
|
+
const byRow = new Map();
|
|
198
|
+
for (const login of liveUsage.usages) {
|
|
199
|
+
const row = SUBSCRIPTION_ROW[login.secret.provider_id ?? ''];
|
|
200
|
+
if (row)
|
|
201
|
+
byRow.set(row, [...(byRow.get(row) ?? []), login]);
|
|
202
|
+
}
|
|
203
|
+
return new Map([...byRow].map(([row, logins]) => [row, rowSummary(summarizeSubscriptions(logins, now), now)]));
|
|
204
|
+
// `liveUsage.usages` is a fresh array each render; `now` moves with every read it holds.
|
|
205
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
206
|
+
}, [now, subscriptions.logins, rowSummary]);
|
|
189
207
|
const [search, setSearch] = useState('');
|
|
190
208
|
const [visibleCount, setVisibleCount] = useState(PROVIDER_PAGE_SIZE);
|
|
191
209
|
const connectedIds = useMemo(() => new Set(connectedProviders.map((provider) => provider.id)), [connectedProviders]);
|
|
@@ -223,13 +241,14 @@ export function ProviderConnect({ projectId, canWrite = false, enabled = true, s
|
|
|
223
241
|
: 'none',
|
|
224
242
|
via: connectedVia(entry.id, connectedIds),
|
|
225
243
|
disabled: disabledProviders.has(entry.id),
|
|
244
|
+
usage: usageByRow.get(entry.id) ?? null,
|
|
226
245
|
};
|
|
227
246
|
});
|
|
228
247
|
return {
|
|
229
248
|
inUse: rows.filter((row) => row.status !== 'none'),
|
|
230
249
|
available: rows.filter((row) => row.status === 'none'),
|
|
231
250
|
};
|
|
232
|
-
}, [searchable, connectedIds, pooled.pooledProviderIds, search, access.data]);
|
|
251
|
+
}, [searchable, connectedIds, pooled.pooledProviderIds, search, access.data, usageByRow]);
|
|
233
252
|
const searching = search.trim().length > 0;
|
|
234
253
|
const limit = searching ? available.length : visibleCount;
|
|
235
254
|
const visibleAvailable = available.slice(0, limit);
|
|
@@ -43,6 +43,7 @@ import { ChatGptSubscriptionConnect, useSubscriptionSignIn, } from '../sections/
|
|
|
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
45
|
import { AccountSecretResourcesPanel } from '../sections/view/account-secret-resources-panel.js';
|
|
46
|
+
import { LegacyChatGptUsage, SubscriptionUsageSection } from '../sections/view/subscription-usage.js';
|
|
46
47
|
import { useTranslations } from '../../i18n/index.js';
|
|
47
48
|
import { LLM_PROVIDER_BY_ID } from '../../internal/lib/llm-providers.js';
|
|
48
49
|
import { cn } from '../../internal/lib/utils.js';
|
|
@@ -289,11 +290,11 @@ export function ProviderSheet({ projectId, providerId, canWrite, enabled = true,
|
|
|
289
290
|
content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_jsx("p", { className: "text-muted-foreground text-sm text-pretty", children: entry.hint }), models] }));
|
|
290
291
|
}
|
|
291
292
|
else if (pooled.pooledSecretsEnabled && pooled.accountId && entry.id === 'openai') {
|
|
292
|
-
content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_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 })] }), models] }));
|
|
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] }));
|
|
293
294
|
}
|
|
294
295
|
else if (pooled.pooledSecretsEnabled && pooled.accountId && entry.id === 'anthropic') {
|
|
295
296
|
// Claude accounts, exactly as OpenAI lists ChatGPT accounts; Anthropic API keys below them.
|
|
296
|
-
content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_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] }));
|
|
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] }));
|
|
297
298
|
}
|
|
298
299
|
else if (pooled.pooledSecretsEnabled && pooled.accountId && supportsPooledProviderKey(entry)) {
|
|
299
300
|
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] }));
|
|
@@ -72,7 +72,7 @@ import { type ReactNode } from 'react';
|
|
|
72
72
|
import type { ResourceScope } from '../shared/agent-resource-scope.js';
|
|
73
73
|
export declare const MODELS_PAGE_TITLE = "Models";
|
|
74
74
|
export declare const MODELS_PAGE_DESCRIPTION = "Choose the providers and models this workspace can use.";
|
|
75
|
-
type LlmTab = 'providers' | 'models' | 'custom' | 'gateway' | 'routing' | 'overview' | 'logs'
|
|
75
|
+
type LlmTab = 'providers' | 'models' | 'custom' | 'gateway' | 'routing' | 'overview' | 'logs';
|
|
76
76
|
interface LlmTabEntry {
|
|
77
77
|
/** `agent` exists only on the agent variant (`AGENT_LLM_TABS`). */
|
|
78
78
|
id: LlmTab | 'agent';
|
|
@@ -88,7 +88,6 @@ import { CapabilityPageShell } from '../shared/capability-page-shell.js';
|
|
|
88
88
|
import { GatewayAccessTab } from './gateway-access-tab.js';
|
|
89
89
|
import { CustomProviderPanel } from './llm-provider/custom-provider-panel.js';
|
|
90
90
|
import { ModelsTab } from './llm-provider/models-tab.js';
|
|
91
|
-
import { SubscriptionUsageTab, useHasSubscriptions } from './view/subscription-usage-tab.js';
|
|
92
91
|
import { GatewayLogs } from './view/gateway/gateway-logs.js';
|
|
93
92
|
import { GatewayOverview } from './view/gateway/gateway-overview.js';
|
|
94
93
|
import { GatewayRouting } from './view/gateway/gateway-routing.js';
|
|
@@ -119,7 +118,8 @@ export const LLM_TABS = [
|
|
|
119
118
|
// file's own render switch keep working unchanged.
|
|
120
119
|
{ id: 'overview', label: 'Costs' },
|
|
121
120
|
{ id: 'logs', label: 'Logs' },
|
|
122
|
-
|
|
121
|
+
// ChatGPT and Claude subscription usage lives in the provider's sheet
|
|
122
|
+
// (OpenAI, Anthropic), beside the accounts it describes: not a tab.
|
|
123
123
|
];
|
|
124
124
|
export const QUICK_LLM_TABS = LLM_TABS.filter((t) => ['providers', 'models', 'custom'].includes(t.id));
|
|
125
125
|
/** True when `tab` is one of the quick version's three. */
|
|
@@ -208,7 +208,7 @@ export function LlmSections({ projectId, tab, onTabChange, canWrite, enabled, se
|
|
|
208
208
|
dialog, so connecting Anthropic here opens nothing on top of what
|
|
209
209
|
you are already looking at. `p-0` because the host column already
|
|
210
210
|
carries the padding. */
|
|
211
|
-
_jsx(ProviderConnect, { projectId: projectId, canWrite: canWrite, enabled: enabled, selectedId: selectedProviderId, onSelect: onSelectProvider })), tab === 'models' && _jsx(ModelsTab, { projectId: projectId, canWrite: canWrite }), tab === 'custom' && _jsx(CustomProviderPanel, { projectId: projectId, canWrite: canWrite }), tab === 'gateway' && (_jsx(GatewayAccessTab, { projectId: projectId, canWrite: canWrite, onViewModels: () => onTabChange('models') })), tab === 'routing' && (_jsx(GatewayRouting, { projectId: projectId, canWrite: canWrite, projectDefaultPending: modelDefaults.isUpdating })), tab === 'overview' && _jsx(GatewayOverview, { projectId: projectId, canWrite: canWrite }), tab === 'logs' && _jsx(GatewayLogs, { projectId: projectId })
|
|
211
|
+
_jsx(ProviderConnect, { projectId: projectId, canWrite: canWrite, enabled: enabled, selectedId: selectedProviderId, onSelect: onSelectProvider })), tab === 'models' && _jsx(ModelsTab, { projectId: projectId, canWrite: canWrite }), tab === 'custom' && _jsx(CustomProviderPanel, { projectId: projectId, canWrite: canWrite }), tab === 'gateway' && (_jsx(GatewayAccessTab, { projectId: projectId, canWrite: canWrite, onViewModels: () => onTabChange('models') })), tab === 'routing' && (_jsx(GatewayRouting, { projectId: projectId, canWrite: canWrite, projectDefaultPending: modelDefaults.isUpdating })), tab === 'overview' && _jsx(GatewayOverview, { projectId: projectId, canWrite: canWrite }), tab === 'logs' && _jsx(GatewayLogs, { projectId: projectId })] }));
|
|
212
212
|
}
|
|
213
213
|
/** The agent variant's own tab, ahead of the seven project tabs. */
|
|
214
214
|
const AGENT_TAB = 'agent';
|
|
@@ -221,9 +221,7 @@ export function LlmManagementView({ projectId, surface = { kind: 'global' }, age
|
|
|
221
221
|
const agentScoped = surface.kind === 'agent' && agentSettings !== undefined;
|
|
222
222
|
const urlTab = !agentScoped ? LLM_TABS.find(entry => entry.id === requestedTab)?.id : undefined;
|
|
223
223
|
const tAgentScope = useTranslations('agentScope');
|
|
224
|
-
|
|
225
|
-
const subscriptions = useHasSubscriptions(projectId);
|
|
226
|
-
const pageTabs = useMemo(() => (subscriptions.has ? LLM_TABS : LLM_TABS.filter((entry) => entry.id !== 'usage')), [subscriptions.has]);
|
|
224
|
+
const pageTabs = LLM_TABS;
|
|
227
225
|
const agentTabs = useMemo(() => [{ id: AGENT_TAB, label: tAgentScope('thisAgent') }, ...pageTabs], [tAgentScope, pageTabs]);
|
|
228
226
|
const [tab, setTab] = useState(() => urlTab ?? TAB_BY_SECTION[section] ?? (agentScoped ? AGENT_TAB : 'providers'));
|
|
229
227
|
// A role with the LLM section's READ leaf (project.read) but not
|
|
@@ -246,13 +244,30 @@ export function LlmManagementView({ projectId, surface = { kind: 'global' }, age
|
|
|
246
244
|
params.delete('provider');
|
|
247
245
|
navigate(`${pathname}?${params}`, { replace: true });
|
|
248
246
|
}, [searchParams, pathname, navigate, agentScoped]);
|
|
249
|
-
//
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
const
|
|
255
|
-
|
|
247
|
+
// `?provider=openai` opens that provider's sheet: search and the command
|
|
248
|
+
// palette link ChatGPT and Claude subscription usage there. The retired
|
|
249
|
+
// `?tab=usage` has no tab and lands on Providers.
|
|
250
|
+
// The open sheet and the URL move together, so the same link opens it again
|
|
251
|
+
// after it was closed.
|
|
252
|
+
const requestedProvider = searchParams.get('provider');
|
|
253
|
+
const [providerId, setProviderId] = useState(requestedProvider);
|
|
254
|
+
const [linkedProvider, setLinkedProvider] = useState(requestedProvider);
|
|
255
|
+
if (linkedProvider !== requestedProvider) {
|
|
256
|
+
setLinkedProvider(requestedProvider);
|
|
257
|
+
setProviderId(requestedProvider);
|
|
258
|
+
}
|
|
259
|
+
const changeProvider = useCallback((next) => {
|
|
260
|
+
setProviderId(next);
|
|
261
|
+
if (agentScoped)
|
|
262
|
+
return;
|
|
263
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
264
|
+
if (next)
|
|
265
|
+
params.set('provider', next);
|
|
266
|
+
else
|
|
267
|
+
params.delete('provider');
|
|
268
|
+
navigate(`${pathname}?${params}`, { replace: true });
|
|
269
|
+
}, [searchParams, pathname, navigate, agentScoped]);
|
|
270
|
+
return (_jsx(ProviderSheetSplit, { projectId: projectId, providerId: tab === 'providers' ? providerId : null, onProviderChange: changeProvider, canWrite: canWrite, children: _jsx(CapabilityPageShell, { title: MODELS_PAGE_TITLE, description:
|
|
256
271
|
// Only "This agent" is the agent's own; every other tab edits state
|
|
257
272
|
// that all of the project's agents share, and the line says so.
|
|
258
273
|
agentScoped ? tAgentScope('modelsDescription') : MODELS_PAGE_DESCRIPTION,
|
|
@@ -261,7 +276,7 @@ export function LlmManagementView({ projectId, surface = { kind: 'global' }, age
|
|
|
261
276
|
action: canWrite && !agentScoped ? _jsx(ProjectDefaultPicker, { projectId: projectId }) : undefined, filters: _jsx(_Fragment, { children: agentScoped ? (
|
|
262
277
|
// Eight tabs in the editor's pane, beside the rail: the strip
|
|
263
278
|
// scrolls rather than push the row wider than the column.
|
|
264
|
-
_jsx(FadedScrollArea, { orientation: "horizontal", fadeColor: "from-background", className: "min-w-0 max-w-full", children: _jsx(LlmTabStrip, { value: tab, onValueChange: (v) => selectTab(v), tabs: agentTabs }) })) : (_jsx(FadedScrollArea, { orientation: "horizontal", fadeColor: "from-background", className: "min-w-0 max-w-full", children: _jsx(LlmTabStrip, { value: tab, onValueChange: (v) => selectTab(v), tabs: pageTabs }) })) }), children: tab === AGENT_TAB ? (agentSettings) : (_jsx(LlmSections, { projectId: projectId, tab: tab, onTabChange: selectTab, canWrite: canWrite, enabled: open, selectedProviderId: providerId, onSelectProvider:
|
|
279
|
+
_jsx(FadedScrollArea, { orientation: "horizontal", fadeColor: "from-background", className: "min-w-0 max-w-full", children: _jsx(LlmTabStrip, { value: tab, onValueChange: (v) => selectTab(v), tabs: agentTabs }) })) : (_jsx(FadedScrollArea, { orientation: "horizontal", fadeColor: "from-background", className: "min-w-0 max-w-full", children: _jsx(LlmTabStrip, { value: tab, onValueChange: (v) => selectTab(v), tabs: pageTabs }) })) }), children: tab === AGENT_TAB ? (agentSettings) : (_jsx(LlmSections, { projectId: projectId, tab: tab, onTabChange: selectTab, canWrite: canWrite, enabled: open, selectedProviderId: providerId, onSelectProvider: changeProvider })) }) }));
|
|
265
280
|
}
|
|
266
281
|
/**
|
|
267
282
|
* The provider list beside the provider it opened — the page and the quick
|
|
@@ -64,10 +64,12 @@ export declare function useSubscriptionSignIn({ projectId, onConnected, kind, }:
|
|
|
64
64
|
submitCode: (code: string) => Promise<void>;
|
|
65
65
|
checking: boolean;
|
|
66
66
|
};
|
|
67
|
-
export declare function ChatGptSubscriptionConnect({ projectId, onConnected, accessSlot, legacyOnly, kind, }: {
|
|
67
|
+
export declare function ChatGptSubscriptionConnect({ projectId, onConnected, accessSlot, usageSlot, legacyOnly, kind, }: {
|
|
68
68
|
projectId: string;
|
|
69
69
|
onConnected: (providerId: string) => void;
|
|
70
70
|
accessSlot?: ReactNode;
|
|
71
|
+
/** The login's plan windows, under its name (the legacy project login). */
|
|
72
|
+
usageSlot?: ReactNode;
|
|
71
73
|
legacyOnly?: boolean;
|
|
72
74
|
kind?: SubscriptionKind;
|
|
73
75
|
}): import("react").JSX.Element | null;
|
|
@@ -273,7 +273,7 @@ export function useSubscriptionSignIn({ projectId, onConnected, kind = 'chatgpt'
|
|
|
273
273
|
}
|
|
274
274
|
// Legacy ChatGPT subscription login. With pooled connections enabled this
|
|
275
275
|
// component shows only an existing project login; new accounts use resources.
|
|
276
|
-
export function ChatGptSubscriptionConnect({ projectId, onConnected, accessSlot, legacyOnly = false, kind = 'chatgpt', }) {
|
|
276
|
+
export function ChatGptSubscriptionConnect({ projectId, onConnected, accessSlot, usageSlot, legacyOnly = false, kind = 'chatgpt', }) {
|
|
277
277
|
const tHardcodedUi = useTranslations('hardcodedUi');
|
|
278
278
|
const tPooled = useTranslations('pooledSecrets');
|
|
279
279
|
const { subscription, copy, phase, challenge, error, connected, start: handleConnect, cancel: reset, disconnect, } = useSubscriptionSignIn({ projectId, onConnected, kind });
|
|
@@ -281,7 +281,7 @@ export function ChatGptSubscriptionConnect({ projectId, onConnected, accessSlot,
|
|
|
281
281
|
const action = subscriptionPrimaryAction({ connected, failed: !!error });
|
|
282
282
|
if (legacyOnly && !connected)
|
|
283
283
|
return null;
|
|
284
|
-
return (_jsxs("div", { className: "bg-popover rounded-md border px-4 py-4", children: [_jsxs("div", { className: "flex items-start gap-3", children: [_jsx(ProviderLogo, { providerID: subscription.logo, name: subscription.logoName, size: "default" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "text-foreground text-sm font-medium", children: legacyOnly ? tPooled('legacyChatGptLogin') : copy.title }), _jsx("p", { className: "text-muted-foreground mt-0.5 text-xs leading-5", children: legacyOnly ? tPooled('legacyChatGptDescription') : copy.description })] }), accessSlot] }), waiting && (_jsxs("div", { className: "border-border bg-muted/30 mt-3 rounded-md border p-3", children: [challenge ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-foreground text-xs font-medium", children: tHardcodedUi.raw('autoComponentsProjectsProjectProviderModalJsxTextAuthorizeInThed882ae47') }), _jsx("div", { className: "mt-3", children: _jsx(ChatGptDeviceChallenge, { url: challenge.url, code: challenge.code, description: copy.deviceDescription }) })] })) : (_jsx("div", { className: "text-foreground text-xs font-medium", children: tHardcodedUi.raw('autoComponentsProjectsProjectProviderModalJsxTextStartingAuthorization35b1fe13') })), _jsxs("div", { className: "text-muted-foreground mt-3 flex items-center gap-2 text-xs", children: [_jsx(Loading, { className: "size-3.5 shrink-0" }), challenge
|
|
284
|
+
return (_jsxs("div", { className: "bg-popover rounded-md border px-4 py-4", children: [_jsxs("div", { className: "flex items-start gap-3", children: [_jsx(ProviderLogo, { providerID: subscription.logo, name: subscription.logoName, size: "default" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "text-foreground text-sm font-medium", children: legacyOnly ? tPooled('legacyChatGptLogin') : copy.title }), _jsx("p", { className: "text-muted-foreground mt-0.5 text-xs leading-5", children: legacyOnly ? tPooled('legacyChatGptDescription') : copy.description })] }), accessSlot] }), usageSlot ? _jsx("div", { className: "mt-3", children: usageSlot }) : null, waiting && (_jsxs("div", { className: "border-border bg-muted/30 mt-3 rounded-md border p-3", children: [challenge ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "text-foreground text-xs font-medium", children: tHardcodedUi.raw('autoComponentsProjectsProjectProviderModalJsxTextAuthorizeInThed882ae47') }), _jsx("div", { className: "mt-3", children: _jsx(ChatGptDeviceChallenge, { url: challenge.url, code: challenge.code, description: copy.deviceDescription }) })] })) : (_jsx("div", { className: "text-foreground text-xs font-medium", children: tHardcodedUi.raw('autoComponentsProjectsProjectProviderModalJsxTextStartingAuthorization35b1fe13') })), _jsxs("div", { className: "text-muted-foreground mt-3 flex items-center gap-2 text-xs", children: [_jsx(Loading, { className: "size-3.5 shrink-0" }), challenge
|
|
285
285
|
? tHardcodedUi.raw('i18nComplete.text2f938f9b118b')
|
|
286
286
|
: copy.connecting] })] })), (phase === 'done' || (connected && !waiting)) && (_jsxs(BannerAlert, { variant: "success", className: "mt-3 text-xs", children: [_jsx(BannerAlertMedia, { children: _jsx(CheckCircle2, {}) }), _jsx(BannerAlertDescription, { children: copy.connectedBanner })] })), error && (_jsxs(BannerAlert, { variant: "destructive", className: "mt-3 text-xs", children: [_jsx(BannerAlertMedia, { children: _jsx(TriangleAlert, {}) }), _jsx(BannerAlertDescription, { children: error })] })), _jsx("div", { className: "mt-3 flex flex-wrap gap-2", children: waiting ? (_jsx(Button, { type: "button", size: "sm", variant: "outline", className: "px-4", onClick: reset, children: tHardcodedUi.raw('i18nComplete.text19766ed6ccb2') })) : action === 'disconnect' ? (_jsx(Button, { type: "button", size: "sm", variant: "outline", className: "px-4", disabled: disconnect.isPending, onClick: () => disconnect.mutate(), children: disconnect.isPending
|
|
287
287
|
? tHardcodedUi.raw('i18nComplete.textcb2b6a572a85')
|
|
@@ -24,7 +24,7 @@ import { PROJECT_ACTIONS } from '../../../internal/lib/project-actions.js';
|
|
|
24
24
|
import { useProjectCan } from '../../../internal/lib/use-project-can.js';
|
|
25
25
|
import { accessSummary, chatGptSharing, keyAccessFields, labelOwnerName, needsReconnection } from '../../../internal/lib/account-secret-access.js';
|
|
26
26
|
import { UndecryptableValue } from './undecryptable-value.js';
|
|
27
|
-
import { isSubscriptionLogin, SubscriptionAccountLine,
|
|
27
|
+
import { isSubscriptionLogin, SubscriptionAccountLine, SubscriptionAccountUsage } from './subscription-usage.js';
|
|
28
28
|
const NO_MEMBERS = { memberIds: [], groupIds: [], inviteEmails: [] };
|
|
29
29
|
/** Between ChatGPT confirming the sign-in and the account appearing in the list. */
|
|
30
30
|
function ChatGptSignInFinishing({ label }) {
|
|
@@ -382,9 +382,10 @@ export function AccountSecretResourcesPanel({ accountId, projectId, providerId,
|
|
|
382
382
|
// A value Kortix cannot decrypt is lost (KRTX-1719): the gateway skips
|
|
383
383
|
// it. A login is reconnected; a key is entered again.
|
|
384
384
|
const undecryptable = secret.status === 'undecryptable';
|
|
385
|
-
// A subscription login
|
|
385
|
+
// A subscription login names its email and plan, and shows every plan
|
|
386
|
+
// window under it; the sheet's summary sits above this list.
|
|
386
387
|
const usageShown = Boolean(oauth) && isSubscriptionLogin(secret) && !undecryptable;
|
|
387
|
-
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 && _jsx(SubscriptionAccountLine, { accountId: accountId, 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 && _jsx(
|
|
388
|
+
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));
|
|
388
389
|
}) })) : null, _jsx(Modal, { open: creating || rotating !== null, onOpenChange: (open) => { if (!open && !save.isPending && !authorization.finishing)
|
|
389
390
|
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') })
|
|
390
391
|
: (authorization.challenge || (claude && authorization.waiting)) && signInStep(authorization.challenge) :
|
|
@@ -20,14 +20,14 @@ import { useCloseChangeRequest, useMergeChangeRequest, useRequestChangesOnChange
|
|
|
20
20
|
import { useProjectCans } from '../../../internal/lib/use-project-can.js';
|
|
21
21
|
import { useSettingsPanelStore } from '../../../internal/stores/settings-panel-store.js';
|
|
22
22
|
import { listProjectSessions, PROJECT_SESSION_NAME_LOOKUP_LIMIT, REVIEW_CONTROL_ACTIONS, reviewVerdictAllowed, } from '@kortix/sdk';
|
|
23
|
-
import { clearStartStash, contract, qk, reviewItemsOf } from '@kortix/sdk/react';
|
|
23
|
+
import { clearStartStash, contract, qk, reviewItemsOf, useSessionAsks } from '@kortix/sdk/react';
|
|
24
24
|
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
25
25
|
import { useUiRouter, useUiSearchParams } from '../../../providers/ui-provider.js';
|
|
26
26
|
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 } from '../../../session/prompts/ask-deck.js';
|
|
30
|
+
import { AskDeck, DECK_KINDS } 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
|
/**
|
|
@@ -49,6 +49,12 @@ export function ReviewCenterConnected({ projectName }) {
|
|
|
49
49
|
// role still sees the inbox, with no verdict control. The inbox stays live
|
|
50
50
|
// for every viewer: an unresolved probe offers no verdict.
|
|
51
51
|
const cans = useProjectCans(projectId, REVIEW_CONTROL_ACTIONS);
|
|
52
|
+
// The deck claims the inbox's empty pane only while an agent asks something
|
|
53
|
+
// (or the asks still load). With none, its own "Nothing waits on you" would
|
|
54
|
+
// sit beside rows that do wait, so the pane shows "Select an item" instead.
|
|
55
|
+
// Same query as the deck's own: a cache hit, not a second request.
|
|
56
|
+
const asks = useSessionAsks(projectId, { enabled: Boolean(projectId) });
|
|
57
|
+
const deckShows = asks.isLoading || asks.isError || (asks.data?.asks ?? []).some((ask) => DECK_KINDS.has(ask.kind));
|
|
52
58
|
const qc = useQueryClient();
|
|
53
59
|
const router = useUiRouter();
|
|
54
60
|
const closeCustomize = useSettingsPanelStore((s) => s.close);
|
|
@@ -271,7 +277,13 @@ export function ReviewCenterConnected({ projectName }) {
|
|
|
271
277
|
// The effect above has already warmed this href.
|
|
272
278
|
router.push(href);
|
|
273
279
|
}
|
|
274
|
-
return (_jsx(ReviewCenter, { needsYouDeck: projectId
|
|
280
|
+
return (_jsx(ReviewCenter, { needsYouDeck: projectId && deckShows
|
|
281
|
+
? ({ paused }) => (
|
|
282
|
+
// `empty={null}`: in the 5 s Undo window after the last card,
|
|
283
|
+
// the deck draws nothing (the inbox shows its own empty state)
|
|
284
|
+
// rather than "Nothing waits on you" beside rows that do.
|
|
285
|
+
_jsx(AskDeck, { projectId: projectId, onOpenSession: openSession, empty: null, paused: paused }))
|
|
286
|
+
: undefined, initialItems: items, segment: segment, onSegmentChange: setSegment, loadMore: hasNextPage
|
|
275
287
|
? {
|
|
276
288
|
onLoadMore: () => void fetchNextPage(),
|
|
277
289
|
isLoading: isFetchingNextPage,
|