@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
|
@@ -3611,6 +3611,9 @@ var ARTIFACT_DOC_CSS = `
|
|
|
3611
3611
|
.kx-doc .kx-code>figcaption button{display:none}}
|
|
3612
3612
|
`;
|
|
3613
3613
|
|
|
3614
|
+
// ../shared/src/chrome-launch.ts
|
|
3615
|
+
var CHROME_LAUNCHED = false;
|
|
3616
|
+
|
|
3614
3617
|
// ../shared/src/code-language.ts
|
|
3615
3618
|
var LANGUAGE_ALIASES = {
|
|
3616
3619
|
// web
|
|
@@ -5802,4 +5805,4 @@ function parseWorkspaceSettingsSection(raw) {
|
|
|
5802
5805
|
return Object.prototype.hasOwnProperty.call(WORKSPACE_SETTINGS_SECTION_ALIASES, value) ? WORKSPACE_SETTINGS_SECTION_ALIASES[value] : null;
|
|
5803
5806
|
}
|
|
5804
5807
|
|
|
5805
|
-
export { ARTIFACT_DOC_CSS, AVATAR_INK, CARD_TEXT_RATIO, CHANNELS, CHANNEL_PLATFORM_IDS, COMMIT_CONFIRM_ATTEMPTS, COMMIT_CONFIRM_DELAY_MS, CREDITS_PER_DOLLAR, CURATED_SECTIONS, HUMAN_ONLY, KATEX_FENCE_LANGUAGES, LANGUAGE_ALIASES, MAX_PROMPT_ATTACHMENTS_BYTES, MAX_PROMPT_ATTACHMENT_BYTES, MAX_PROMPT_ATTACHMENT_FILES, MAX_PROMPT_UPLOAD_FILENAME_BYTES, MERMAID_DIAGRAM_STARTERS, MY_KORTIX_AGENT_NAME, MY_KORTIX_DISPLAY_NAME, MY_KORTIX_SANDBOX_SLUG, OTHER, PASTED_INLINE_MAX_BYTES, PIXEL_KORTIX_ROWS, PIXEL_MARK_TONES, POLICY_SETS_UNSUPPORTED_PROVIDERS, POPULAR_SECTION, PREVIEW_BUILDING_STATES, PREVIEW_STATE_MESSAGE, PROJECT_GLYPH_COLORS, PROJECT_GLYPH_GROUPS, SPACE_POST_SUMMARY, UNKNOWN_RATIO, UPLOAD_LIMITS, WORKSPACE_SETTINGS_GROUPS, agentDisplayName, appAdminsOnly, autoLinkUrls, avatarFill, buildWebhookSampleRequest, capitalizeWords, cardImageShape, cardListLayout, chalkColors, channelPromptTail, confirmCommitted, countInSection, dollarsToCredits, editConfigPrompt, errorCode, escapeCurrencyDollars, expandPastedContent, extractReadableHtml, fileTagBlocks, fixManifestText, formatFileSize, formatRelative, formatUsdAsCredits, gridApps, groupIntoSections, hasReferenceDefinitionOutsideFences, humanizeCategory, indexOfIgnoreCase, isAllowedWebPushHost, isAmbiguousCreateFailure, isChannelFileLabel, isChannelPlatform, isMermaidCode, isMyKortixAgentName, isProjectGlyphColor, isProjectGlyphName, isProjectGlyphPaletteColor, languageLabel, looksLikeMarkdown, masonryColumns, neutralizePastedTags, newConfigPrompt, newPastedContentId, normalizeLanguage, normalizeLatexDelimiters, normalizeProjectGlyphColor, openMarkdownLinkAtEnd, parseBackgroundWorkers, parseBalanceUsd, parseChannelMessage, parseGrepOutput, parseManifestText, parseMemoryEntryOutput, parseMemorySearchOutput, parsePeerMessagePrompt, parseReminderPrompt, parseSessionGetOutput, parseSessionMessagesOutput, parseSessionMetadataOutput, parseSessionSearchHits, parseTriggerEvent, parseTriggerLines, parseWorkspaceSettingsSection, passesPixelMarkGate, peerHandleLabel, pixelMark, policySetNameError, prefersPreviewLink, prepareMarkdownForKatex, prepareMarkdownForMath, promptFileReferenceXml, ptyOutputBlock, ptySpawnedBody, pushTypeOf, referenceHeaders, removeSpans, replaceSpans, resolveRegisteredKey, safeHttpUrl, sandboxMediaPath, sanitizePromptUploadFilename, sectionKeyForCategory, sectionKeysForEntry, sectionTitle, selfClosingTags, serializePromptWithPastes, shouldTilePaste, skillDocumentBody, slackPlainText, slugifySlug, spaceDriveFolders, spaceSlug, splitPastedContent, stripBashMetadata, stripChatMentionMarkup, stripMarkupForToolOutput, tagBlocks, toolRegistryCandidates, trimPastedText, truncateString, utf8Bytes, withoutEdgeQuotes, xmlBlocks };
|
|
5808
|
+
export { ARTIFACT_DOC_CSS, AVATAR_INK, CARD_TEXT_RATIO, CHANNELS, CHANNEL_PLATFORM_IDS, CHROME_LAUNCHED, COMMIT_CONFIRM_ATTEMPTS, COMMIT_CONFIRM_DELAY_MS, CREDITS_PER_DOLLAR, CURATED_SECTIONS, HUMAN_ONLY, KATEX_FENCE_LANGUAGES, LANGUAGE_ALIASES, MAX_PROMPT_ATTACHMENTS_BYTES, MAX_PROMPT_ATTACHMENT_BYTES, MAX_PROMPT_ATTACHMENT_FILES, MAX_PROMPT_UPLOAD_FILENAME_BYTES, MERMAID_DIAGRAM_STARTERS, MY_KORTIX_AGENT_NAME, MY_KORTIX_DISPLAY_NAME, MY_KORTIX_SANDBOX_SLUG, OTHER, PASTED_INLINE_MAX_BYTES, PIXEL_KORTIX_ROWS, PIXEL_MARK_TONES, POLICY_SETS_UNSUPPORTED_PROVIDERS, POPULAR_SECTION, PREVIEW_BUILDING_STATES, PREVIEW_STATE_MESSAGE, PROJECT_GLYPH_COLORS, PROJECT_GLYPH_GROUPS, SPACE_POST_SUMMARY, UNKNOWN_RATIO, UPLOAD_LIMITS, WORKSPACE_SETTINGS_GROUPS, agentDisplayName, appAdminsOnly, autoLinkUrls, avatarFill, buildWebhookSampleRequest, capitalizeWords, cardImageShape, cardListLayout, chalkColors, channelPromptTail, confirmCommitted, countInSection, dollarsToCredits, editConfigPrompt, errorCode, escapeCurrencyDollars, expandPastedContent, extractReadableHtml, fileTagBlocks, fixManifestText, formatFileSize, formatRelative, formatUsdAsCredits, gridApps, groupIntoSections, hasReferenceDefinitionOutsideFences, humanizeCategory, indexOfIgnoreCase, isAllowedWebPushHost, isAmbiguousCreateFailure, isChannelFileLabel, isChannelPlatform, isMermaidCode, isMyKortixAgentName, isProjectGlyphColor, isProjectGlyphName, isProjectGlyphPaletteColor, languageLabel, looksLikeMarkdown, masonryColumns, neutralizePastedTags, newConfigPrompt, newPastedContentId, normalizeLanguage, normalizeLatexDelimiters, normalizeProjectGlyphColor, openMarkdownLinkAtEnd, parseBackgroundWorkers, parseBalanceUsd, parseChannelMessage, parseGrepOutput, parseManifestText, parseMemoryEntryOutput, parseMemorySearchOutput, parsePeerMessagePrompt, parseReminderPrompt, parseSessionGetOutput, parseSessionMessagesOutput, parseSessionMetadataOutput, parseSessionSearchHits, parseTriggerEvent, parseTriggerLines, parseWorkspaceSettingsSection, passesPixelMarkGate, peerHandleLabel, pixelMark, policySetNameError, prefersPreviewLink, prepareMarkdownForKatex, prepareMarkdownForMath, promptFileReferenceXml, ptyOutputBlock, ptySpawnedBody, pushTypeOf, referenceHeaders, removeSpans, replaceSpans, resolveRegisteredKey, safeHttpUrl, sandboxMediaPath, sanitizePromptUploadFilename, sectionKeyForCategory, sectionKeysForEntry, sectionTitle, selfClosingTags, serializePromptWithPastes, shouldTilePaste, skillDocumentBody, slackPlainText, slugifySlug, spaceDriveFolders, spaceSlug, splitPastedContent, stripBashMetadata, stripChatMentionMarkup, stripMarkupForToolOutput, tagBlocks, toolRegistryCandidates, trimPastedText, truncateString, utf8Bytes, withoutEdgeQuotes, xmlBlocks };
|
|
@@ -30,6 +30,7 @@ import { LockIcon, UsersIcon, UsersThreeIcon, XIcon } from '@phosphor-icons/reac
|
|
|
30
30
|
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
31
31
|
import { useState } from 'react';
|
|
32
32
|
import { EMPTY_PRINCIPAL_SELECTION, PrincipalPicker, } from './principal-picker.js';
|
|
33
|
+
import { applyShareSelection, shareSelectionView } from './share-selection.js';
|
|
33
34
|
/** What Save writes. The rules live in `@kortix/sdk`. */
|
|
34
35
|
export { grantConnectionAccess, planPrivateShare, planShare, sharedWithEveryoneAfter };
|
|
35
36
|
export function ShareAccessBody({ open, onOpenChange, accountId, projectId, projectName, object, current, onDone, }) {
|
|
@@ -96,11 +97,16 @@ export function ShareAccessBody({ open, onOpenChange, accountId, projectId, proj
|
|
|
96
97
|
next.add(grantId);
|
|
97
98
|
return next;
|
|
98
99
|
});
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
// A shared account: the picker shows who has access as checked, and
|
|
101
|
+
// unchecking one is the same as its Remove button (`share-selection.ts`).
|
|
102
|
+
const pickerValue = privateOwner ? picked : shareSelectionView(current, removed, picked);
|
|
103
|
+
const onPickerChange = (next) => {
|
|
104
|
+
if (privateOwner)
|
|
105
|
+
return setPicked(next);
|
|
106
|
+
const split = applyShareSelection(current, removed, next);
|
|
107
|
+
setPicked(split.picked);
|
|
108
|
+
setRemoved(split.removed);
|
|
109
|
+
};
|
|
104
110
|
return (_jsx(Modal, { open: open, onOpenChange: (next) => {
|
|
105
111
|
if (save.isPending)
|
|
106
112
|
return;
|
|
@@ -120,7 +126,7 @@ export function ShareAccessBody({ open, onOpenChange, accountId, projectId, proj
|
|
|
120
126
|
})) })] }), _jsxs(Field, { className: "gap-1.5", children: [_jsx(FieldLabel, { children: t('add') }), _jsx(PrincipalPicker, { scope: { kind: 'project', projectId }, selection: "multi",
|
|
121
127
|
// A private account becomes shared through `shareConnection`,
|
|
122
128
|
// which takes people and groups; an agent joins once it is shared.
|
|
123
|
-
kinds: privateOwner ? ['member', 'group'] : ['member', 'group', 'agent'], everyone: { label: everyoneLabel }, excludeUserIds:
|
|
129
|
+
kinds: privateOwner ? ['member', 'group'] : ['member', 'group', 'agent'], everyone: { label: everyoneLabel }, excludeUserIds: privateOwner ? [privateOwner.userId] : undefined, value: pickerValue, onChange: onPickerChange, disabled: save.isPending, autoFocus: false, emptyLabel: tI18nComplete.raw('textd2600c68a9ff'), allExcludedLabel: tI18nComplete.raw('textf68d7561db3d') }), (picked.agentIds?.length ?? 0) > 0 ? (_jsx("p", { className: "text-muted-foreground text-xs", children: t('agentShareHint') })) : null] }), _jsxs(BannerAlert, { variant: "default", children: [_jsx(BannerAlertMedia, { children: everyoneAfter ? _jsx(UsersThreeIcon, {}) : _jsx(LockIcon, {}) }), _jsx(BannerAlertDescription, { children: _jsx("span", { "data-testid": "share-result", children: everyoneAfter
|
|
124
130
|
? t('resultEveryone', { project: projectName })
|
|
125
131
|
: privateOwner && !privatePlan
|
|
126
132
|
? t('onlyYouDescription')
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ConnectionShare } from '@kortix/sdk';
|
|
2
|
+
import type { PrincipalSelection } from './principal-picker.js';
|
|
3
|
+
/** What the picker shows: the new picks plus every grant not marked removed. */
|
|
4
|
+
export declare function shareSelectionView(current: readonly ConnectionShare[], removed: ReadonlySet<string>, picked: PrincipalSelection): PrincipalSelection;
|
|
5
|
+
/** Split the picker's next value into new picks and grants marked removed. */
|
|
6
|
+
export declare function applyShareSelection(current: readonly ConnectionShare[], removed: ReadonlySet<string>, next: PrincipalSelection): {
|
|
7
|
+
picked: PrincipalSelection;
|
|
8
|
+
removed: Set<string>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// The Share dialog's one selection rule. The picker shows every principal that
|
|
2
|
+
// has access to the account as checked: unchecking it marks its grant for
|
|
3
|
+
// removal, checking it again keeps the grant, and anything else checked is an
|
|
4
|
+
// addition. The audience rows' Remove/Keep buttons edit the same `removed`
|
|
5
|
+
// set, so the two controls never disagree.
|
|
6
|
+
//
|
|
7
|
+
// Before: a principal with access was an ordinary unchecked picker row.
|
|
8
|
+
// Clicking it picked it again, and the save plan cancels a removal whose
|
|
9
|
+
// principal is picked (`planConnectionShare`), so "Remove" then did nothing
|
|
10
|
+
// and Save stayed disabled until the picker was cleared.
|
|
11
|
+
const KEY_OF = {
|
|
12
|
+
member: 'memberIds',
|
|
13
|
+
group: 'groupIds',
|
|
14
|
+
agent: 'agentIds',
|
|
15
|
+
};
|
|
16
|
+
function selected(selection, grant) {
|
|
17
|
+
if (grant.principal_type === 'project')
|
|
18
|
+
return selection.everyone === true;
|
|
19
|
+
return (selection[KEY_OF[grant.principal_type]] ?? []).includes(grant.principal_id);
|
|
20
|
+
}
|
|
21
|
+
/** What the picker shows: the new picks plus every grant not marked removed. */
|
|
22
|
+
export function shareSelectionView(current, removed, picked) {
|
|
23
|
+
const view = {
|
|
24
|
+
...picked,
|
|
25
|
+
memberIds: [...picked.memberIds],
|
|
26
|
+
groupIds: [...picked.groupIds],
|
|
27
|
+
agentIds: [...(picked.agentIds ?? [])],
|
|
28
|
+
};
|
|
29
|
+
for (const grant of current) {
|
|
30
|
+
if (removed.has(grant.grant_id) || selected(view, grant))
|
|
31
|
+
continue;
|
|
32
|
+
if (grant.principal_type === 'project')
|
|
33
|
+
view.everyone = true;
|
|
34
|
+
else
|
|
35
|
+
view[KEY_OF[grant.principal_type]].push(grant.principal_id);
|
|
36
|
+
}
|
|
37
|
+
return view;
|
|
38
|
+
}
|
|
39
|
+
/** Split the picker's next value into new picks and grants marked removed. */
|
|
40
|
+
export function applyShareSelection(current, removed, next) {
|
|
41
|
+
const nextRemoved = new Set(removed);
|
|
42
|
+
const picked = {
|
|
43
|
+
...next,
|
|
44
|
+
memberIds: [...next.memberIds],
|
|
45
|
+
groupIds: [...next.groupIds],
|
|
46
|
+
agentIds: [...(next.agentIds ?? [])],
|
|
47
|
+
};
|
|
48
|
+
for (const grant of current) {
|
|
49
|
+
if (selected(next, grant)) {
|
|
50
|
+
// Checked: the grant stays. It is not an addition.
|
|
51
|
+
nextRemoved.delete(grant.grant_id);
|
|
52
|
+
if (grant.principal_type === 'project')
|
|
53
|
+
picked.everyone = false;
|
|
54
|
+
else {
|
|
55
|
+
const key = KEY_OF[grant.principal_type];
|
|
56
|
+
picked[key] = (picked[key] ?? []).filter((id) => id !== grant.principal_id);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
nextRemoved.add(grant.grant_id);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return { picked, removed: nextRemoved };
|
|
64
|
+
}
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { CheckIcon, } from '@phosphor-icons/react';
|
|
4
4
|
import { useTranslations } from '../../i18n/index.js';
|
|
5
5
|
import { ConnectorLogo } from '../../internal/connector-logo/connector-logo.js';
|
|
6
|
-
import { STATUS_DOT, STATUS_WORD,
|
|
6
|
+
import { STATUS_DOT, STATUS_WORD, connectorTone } from './detail/connector-status.js';
|
|
7
7
|
import { ConnectorStatusBadge as ToneBadge } from './detail/status-badge.js';
|
|
8
8
|
import { cn } from '../../internal/lib/utils.js';
|
|
9
9
|
/**
|
|
@@ -35,7 +35,7 @@ export function ConnectorConnectedMark({ className } = {}) {
|
|
|
35
35
|
* slot instead, the catalogue's `✓`.
|
|
36
36
|
*/
|
|
37
37
|
export function ConnectorStatusBadge({ connector, accountCount, }) {
|
|
38
|
-
const tone =
|
|
38
|
+
const tone = connectorTone(connector, accountCount);
|
|
39
39
|
return tone === 'connected' ? null : _jsx(ToneBadge, { tone: tone });
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
@@ -46,6 +46,6 @@ export function ConnectorStatusBadge({ connector, accountCount, }) {
|
|
|
46
46
|
*/
|
|
47
47
|
export function ConnectorStatusLogo({ connector, source, accountCount, }) {
|
|
48
48
|
const t = useTranslations('connectorPages');
|
|
49
|
-
const tone =
|
|
49
|
+
const tone = connectorTone(connector, accountCount);
|
|
50
50
|
return (_jsxs("span", { className: "relative flex shrink-0", children: [_jsx(ConnectorLogo, { source: source, size: "lg" }), _jsx("span", { "aria-hidden": true, className: "bg-background absolute -right-1 -bottom-1 flex size-3 items-center justify-center rounded-full", children: _jsx("span", { className: cn('size-2 rounded-full', STATUS_DOT[tone]) }) }), _jsx("span", { className: "sr-only", children: t(STATUS_WORD[tone]) })] }));
|
|
51
51
|
}
|
|
@@ -35,7 +35,7 @@ import { providerLabel } from '../provider-label.js';
|
|
|
35
35
|
import { useTranslations } from '../../../i18n/index.js';
|
|
36
36
|
import { PROJECT_ACTIONS } from '../../../internal/lib/project-actions.js';
|
|
37
37
|
import { useProjectCan } from '../../../internal/lib/use-project-can.js';
|
|
38
|
-
import { connectorRunsOver,
|
|
38
|
+
import { connectorRunsOver, connectorTone } from './connector-status.js';
|
|
39
39
|
import { ProviderInfo, providerName } from './provider-info.js';
|
|
40
40
|
import { ConnectorStatusBadge } from './status-badge.js';
|
|
41
41
|
/** The same column as the connector page beside this one (`connector-page.tsx`). */
|
|
@@ -242,7 +242,7 @@ function CatalogAppPage({ projectId, appSegment }) {
|
|
|
242
242
|
_jsx("span", { className: "text-muted-foreground text-xs", children: t('askAdminToInstall') }))] })) : null] }), channelPlatform ? (
|
|
243
243
|
// The header above shows the app's logo: the hero below does not repeat it.
|
|
244
244
|
_jsx(ChannelHeroLogoInHeader, { children: _jsx(ChannelsSection, { projectId: projectId, platform: channelPlatform }) })) : null, !channelPlatform && (infoCells.length > 0 || resolved.description) ? (_jsxs("div", { className: "bg-popover divide-border divide-y overflow-hidden rounded-md border", children: [infoCells.length > 0 ? (_jsx("dl", { className: "flex flex-wrap gap-x-8 gap-y-3 px-4 py-3", children: infoCells.map((cell) => (_jsxs("div", { className: "min-w-0 space-y-0.5", children: [_jsxs("dt", { className: "text-muted-foreground flex h-4 items-center justify-between gap-2 text-xs", children: [_jsx("span", { children: cell.label }), cell.labelAddon] }), _jsx("dd", { className: "text-foreground truncate text-sm font-medium", children: cell.value })] }, cell.key))) })) : null, resolved.description ? (_jsxs("div", { className: "space-y-1.5 px-4 py-4", children: [_jsx("h2", { className: "text-muted-foreground text-xs", children: t('overview') }), _jsx("p", { className: "text-foreground text-sm text-pretty", children: resolved.description })] })) : null] })) : null, inProject.length > 0 ? (_jsxs("section", { className: "space-y-3", children: [_jsx("h2", { className: "text-foreground text-sm font-medium", children: projectName ? t('installedIn', { project: projectName }) : t('installedHere') }), _jsx("ul", { className: ROW_GROUP, children: inProject.map((connector) => {
|
|
245
|
-
const tone =
|
|
245
|
+
const tone = connectorTone(connector, connectionsQuery.data ? connectorAccounts(connectionsQuery.data.connections, connector).length : undefined);
|
|
246
246
|
return (_jsx("li", { children: _jsxs(Link, { href: connectorHref(projectId, connector.slug, { app }), className: "hover:bg-muted/50 flex items-center gap-3 px-4 py-3 transition-colors", children: [_jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "text-foreground block truncate text-sm font-medium", children: connectorDisplayName(connector) }), _jsx("span", { className: "text-muted-foreground block truncate text-xs", children: connectorSummary(connector, providerLabel(connector.provider)) })] }), _jsx("span", { className: "flex w-28 shrink-0 items-center", children: _jsx(ConnectorStatusBadge, { tone: tone }) }), _jsxs("span", { className: "text-muted-foreground flex w-16 shrink-0 items-center justify-end gap-1 text-xs", children: [t('open'), _jsx(CaretRightIcon, { "aria-hidden": true, className: "size-4" })] })] }) }, connector.slug));
|
|
247
247
|
}) })] })) : null, resolved.surfaces.length === 0 && resolved.references.length === 0 ? (_jsx(EmptyState, { icon: GlobeIcon, size: "sm", title: tI18nComplete.raw('text363579e1d66b'), description: tI18nComplete.raw('text4d286e47d580') })) : null, waySurfaces.length > (channelPlatform ? 0 : 1) || resolved.references.length > 0 ? (_jsxs("section", { className: "space-y-3", children: [_jsx("h2", { className: "text-foreground text-sm font-medium", children: channelPlatform ? t('otherWaysToConnect') : t('waysToConnect') }), waySurfaces.length > 0 ? (_jsx("ul", { className: ROW_GROUP, children: waySurfaces.map((surface) => (_jsxs("li", { className: SURFACE_ROW, children: [_jsxs("span", { className: "min-w-0 flex-1 space-y-0.5", children: [_jsxs("span", { className: "flex min-w-0 flex-wrap items-center gap-1.5", children: [_jsx("span", { className: "text-foreground truncate text-sm font-medium", children: surface.label }), _jsx(Badge, { variant: "muted", size: "xs", children: wayKindLabel(surface.kind) }), surface.oneClick ? (_jsx(Badge, { variant: "secondary", size: "xs", children: t('wayOneClick') })) : null, surface.recommended ? (_jsx(Badge, { variant: "success", size: "xs", children: t('wayRecommended') })) : null] }), _jsx("span", { className: "text-muted-foreground block text-xs text-pretty", children: wayDescription(t, { kind: surface.kind, oneClick: surface.oneClick }, resolved.name) })] }), surface.variantId && detail ? (_jsx(Button, { type: "button", variant: shownWay?.variantId === surface.variantId ? 'secondary' : 'outline-ghost', size: "sm", "aria-pressed": shownWay?.variantId === surface.variantId, onClick: () => {
|
|
248
248
|
setToolsWay(surface.variantId);
|
|
@@ -18,6 +18,8 @@ interface ConnectorAccountsProps {
|
|
|
18
18
|
showAccountInfo?: boolean;
|
|
19
19
|
/** Sign an unsigned account in (the row's Connect). */
|
|
20
20
|
onConnect?: (connection: Connection) => void;
|
|
21
|
+
/** Accounts sign in through a provider window: rows say "Sign in". */
|
|
22
|
+
signsIn?: boolean;
|
|
21
23
|
/** Bumped to open "Add account" (a header button, or right after Install). */
|
|
22
24
|
addRequest?: number;
|
|
23
25
|
onAddRequestHandled?: () => void;
|
|
@@ -47,5 +49,5 @@ interface ConnectorAccountsProps {
|
|
|
47
49
|
* (`connector-settings.tsx`) — see that file's docstring. Mounting it here
|
|
48
50
|
* too would print the same form twice.
|
|
49
51
|
*/
|
|
50
|
-
export declare function ConnectorAccounts({ projectId, connector, displayName, canWrite, canManageConnections, onChanged, onRemoved, onStartSession, onSetCredential, showAccountInfo, onConnect, addRequest, onAddRequestHandled, }: ConnectorAccountsProps): import("react").JSX.Element;
|
|
52
|
+
export declare function ConnectorAccounts({ projectId, connector, displayName, canWrite, canManageConnections, onChanged, onRemoved, onStartSession, onSetCredential, showAccountInfo, onConnect, signsIn, addRequest, onAddRequestHandled, }: ConnectorAccountsProps): import("react").JSX.Element;
|
|
51
53
|
export {};
|
|
@@ -30,7 +30,7 @@ import { AccountInfo } from './account-info.js';
|
|
|
30
30
|
* (`connector-settings.tsx`) — see that file's docstring. Mounting it here
|
|
31
31
|
* too would print the same form twice.
|
|
32
32
|
*/
|
|
33
|
-
export function ConnectorAccounts({ projectId, connector, displayName, canWrite, canManageConnections, onChanged, onRemoved, onStartSession, onSetCredential, showAccountInfo = false, onConnect, addRequest, onAddRequestHandled, }) {
|
|
33
|
+
export function ConnectorAccounts({ projectId, connector, displayName, canWrite, canManageConnections, onChanged, onRemoved, onStartSession, onSetCredential, showAccountInfo = false, onConnect, signsIn, addRequest, onAddRequestHandled, }) {
|
|
34
34
|
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
35
35
|
const isManagedProvider = isManagedConnectorProvider(connector.provider);
|
|
36
36
|
// Email's accounts are inboxes (ConnectionsList's `isEmail` branch); Slack and
|
|
@@ -40,5 +40,5 @@ export function ConnectorAccounts({ projectId, connector, displayName, canWrite,
|
|
|
40
40
|
if (isChannel) {
|
|
41
41
|
return (_jsx(ChannelConnectionSection, { projectId: projectId, connector: connector, onChanged: onChanged, onRemoved: onRemoved, canWrite: canWrite }));
|
|
42
42
|
}
|
|
43
|
-
return (_jsxs("div", { className: "space-y-5", children: [_jsx(ConnectionsList, { projectId: projectId, connector: connector, displayName: displayName, canManageConnections: canManageConnections, onChanged: onChanged, onStartSession: onStartSession, onSetCredential: onSetCredential, onConnect: onConnect, addRequest: addRequest, onAddRequestHandled: onAddRequestHandled, addVariant: "default", titleAddon: showAccountInfo ? (_jsx(AccountInfo, { projectId: projectId, displayName: displayName })) : undefined }), showRoster ? (_jsxs("section", { className: "space-y-2", children: [_jsx(Label, { children: tI18nComplete.raw('text74156382383b') }), _jsx(ConnectionRoster, { projectId: projectId, connectorSlug: connector.slug, displayName: displayName })] })) : null] }));
|
|
43
|
+
return (_jsxs("div", { className: "space-y-5", children: [_jsx(ConnectionsList, { projectId: projectId, connector: connector, displayName: displayName, canManageConnections: canManageConnections, onChanged: onChanged, onStartSession: onStartSession, onSetCredential: onSetCredential, onConnect: onConnect, signsIn: signsIn, addRequest: addRequest, onAddRequestHandled: onAddRequestHandled, addVariant: "default", titleAddon: showAccountInfo ? (_jsx(AccountInfo, { projectId: projectId, displayName: displayName })) : undefined }), showRoster ? (_jsxs("section", { className: "space-y-2", children: [_jsx(Label, { children: tI18nComplete.raw('text74156382383b') }), _jsx(ConnectionRoster, { projectId: projectId, connectorSlug: connector.slug, displayName: displayName })] })) : null] }));
|
|
44
44
|
}
|
|
@@ -11,12 +11,16 @@ export declare function NoticeLogLine({ reason }: {
|
|
|
11
11
|
export declare const NOTICE_TITLE: {
|
|
12
12
|
error: string;
|
|
13
13
|
sign_in: string;
|
|
14
|
+
sign_in_again: string;
|
|
15
|
+
no_tools: string;
|
|
14
16
|
no_account: string;
|
|
15
17
|
needs_credential: string;
|
|
16
18
|
};
|
|
17
19
|
export declare const NOTICE_BODY: {
|
|
18
20
|
error: string;
|
|
19
21
|
sign_in: string;
|
|
22
|
+
sign_in_again: string;
|
|
23
|
+
no_tools: string;
|
|
20
24
|
no_account: string;
|
|
21
25
|
needs_credential: string;
|
|
22
26
|
};
|
|
@@ -11,12 +11,16 @@ export function NoticeLogLine({ reason }) {
|
|
|
11
11
|
export const NOTICE_TITLE = {
|
|
12
12
|
error: 'noticeErrorTitle',
|
|
13
13
|
sign_in: 'noticeSignInTitle',
|
|
14
|
+
sign_in_again: 'noticeSignInAgainTitle',
|
|
15
|
+
no_tools: 'noticeNoToolsTitle',
|
|
14
16
|
no_account: 'noticeNoAccountTitle',
|
|
15
17
|
needs_credential: 'noticeCredentialTitle',
|
|
16
18
|
};
|
|
17
19
|
export const NOTICE_BODY = {
|
|
18
20
|
error: 'noticeErrorBody',
|
|
19
21
|
sign_in: 'noticeSignInBody',
|
|
22
|
+
sign_in_again: 'noticeSignInAgainBody',
|
|
23
|
+
no_tools: 'noticeNoToolsBody',
|
|
20
24
|
no_account: 'noticeNoAccountBody',
|
|
21
25
|
needs_credential: 'noticeCredentialBody',
|
|
22
26
|
};
|
|
@@ -8,8 +8,14 @@ import type { AdminConnector } from '@kortix/sdk';
|
|
|
8
8
|
*
|
|
9
9
|
* no_account — nothing is connected; add an account.
|
|
10
10
|
* needs_credential — an account exists and cannot authenticate.
|
|
11
|
-
* sign_in —
|
|
12
|
-
*
|
|
11
|
+
* sign_in — the account still has to finish its sign-in: an MCP
|
|
12
|
+
* server asked for one (401/403), or an account on a
|
|
13
|
+
* connector that signs in (managed, one-click OAuth MCP)
|
|
14
|
+
* never finished one.
|
|
15
|
+
* sign_in_again — an account on a connector that signs in was signed in
|
|
16
|
+
* before and no longer is (expired, revoked, rejected).
|
|
17
|
+
* no_tools — an HTTP connector that works but has no routes, so it
|
|
18
|
+
* gives agents nothing to call.
|
|
13
19
|
* error — the last attempt to load the connector's tools failed;
|
|
14
20
|
* `reason` is the server's own words, when it sent any.
|
|
15
21
|
*/
|
|
@@ -23,6 +29,10 @@ export type ConnectorNotice = {
|
|
|
23
29
|
action: 'set_credential' | 'open_accounts';
|
|
24
30
|
} | {
|
|
25
31
|
kind: 'sign_in';
|
|
32
|
+
} | {
|
|
33
|
+
kind: 'sign_in_again';
|
|
34
|
+
} | {
|
|
35
|
+
kind: 'no_tools';
|
|
26
36
|
} | {
|
|
27
37
|
kind: 'error';
|
|
28
38
|
reason: string | null;
|
|
@@ -43,7 +53,23 @@ export declare function connectorNotice(input: {
|
|
|
43
53
|
accountCount: number;
|
|
44
54
|
/** The accounts list has answered; before that nothing is claimed. */
|
|
45
55
|
accountsLoaded: boolean;
|
|
56
|
+
/** Accounts authorize through a sign-in window, not a typed credential:
|
|
57
|
+
* a managed provider, or an MCP server with one-click OAuth. */
|
|
58
|
+
signsIn?: boolean;
|
|
59
|
+
/** The account the banner fixes never finished a sign-in (`accountNeverSignedIn`). */
|
|
60
|
+
neverSignedIn?: boolean;
|
|
61
|
+
/** How many tools the connector gives agents. Omitted = not known. */
|
|
62
|
+
toolCount?: number;
|
|
46
63
|
}): ConnectorNotice;
|
|
64
|
+
/**
|
|
65
|
+
* An account that never finished a sign-in: not authorized, and nothing on it
|
|
66
|
+
* says it was signed in before (no rejected credential, no known identity).
|
|
67
|
+
*/
|
|
68
|
+
export declare function accountNeverSignedIn(account: {
|
|
69
|
+
authorized?: boolean;
|
|
70
|
+
connected_as?: string | null;
|
|
71
|
+
metadata?: Record<string, unknown> | null;
|
|
72
|
+
}): boolean;
|
|
47
73
|
/**
|
|
48
74
|
* The account the banner's Sign in / Set credential button fixes: one of the
|
|
49
75
|
* caller's OWN accounts (any owner but the project), the first one not signed
|
|
@@ -65,8 +91,9 @@ export declare function noticeTarget<T extends {
|
|
|
65
91
|
*/
|
|
66
92
|
export declare function noticeButton<T>(notice: ConnectorNotice, target: T | 'add' | null, managed: boolean): {
|
|
67
93
|
/** Which button: its words. `add_account` is the page's Add account control. */
|
|
68
|
-
kind: 'add_account' | 'sign_in' | 'set_credential' | 'connect' | 'reconnect';
|
|
69
|
-
|
|
94
|
+
kind: 'add_account' | 'sign_in' | 'set_credential' | 'connect' | 'reconnect' | 'add_routes';
|
|
95
|
+
/** `settings` opens the Settings tab, where an HTTP connector's routes spec is. */
|
|
96
|
+
run: 'add' | 'sign_in' | 'reconnect' | 'settings';
|
|
70
97
|
account: T | null;
|
|
71
98
|
} | null;
|
|
72
99
|
/** A failure line split for the log row: `MCP tools/list failed: HTTP 401` → `401` + `MCP tools/list failed`. */
|
|
@@ -26,12 +26,28 @@ export function connectorNotice(input) {
|
|
|
26
26
|
action: input.accountCount === 0 ? 'add_account' : fixAccount,
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
if (input.connected)
|
|
30
|
-
|
|
29
|
+
if (input.connected) {
|
|
30
|
+
// An HTTP connector's tools are its routes: none means agents can call nothing.
|
|
31
|
+
return input.provider === 'http' && input.toolCount === 0 ? { kind: 'no_tools' } : { kind: 'none' };
|
|
32
|
+
}
|
|
31
33
|
if (input.accountCount === 0)
|
|
32
34
|
return { kind: 'no_account', action: 'add_account' };
|
|
35
|
+
// A connector that signs in has no credential to type: say "sign in".
|
|
36
|
+
if (input.signsIn)
|
|
37
|
+
return input.neverSignedIn ? { kind: 'sign_in' } : { kind: 'sign_in_again' };
|
|
33
38
|
return { kind: 'needs_credential', action: fixAccount };
|
|
34
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* An account that never finished a sign-in: not authorized, and nothing on it
|
|
42
|
+
* says it was signed in before (no rejected credential, no known identity).
|
|
43
|
+
*/
|
|
44
|
+
export function accountNeverSignedIn(account) {
|
|
45
|
+
if (account.authorized !== false)
|
|
46
|
+
return false;
|
|
47
|
+
if (account.connected_as)
|
|
48
|
+
return false;
|
|
49
|
+
return !account.metadata?.credential_rejected_at;
|
|
50
|
+
}
|
|
35
51
|
/**
|
|
36
52
|
* The account the banner's Sign in / Set credential button fixes: one of the
|
|
37
53
|
* caller's OWN accounts (any owner but the project), the first one not signed
|
|
@@ -56,10 +72,13 @@ export function noticeTarget(accounts) {
|
|
|
56
72
|
export function noticeButton(notice, target, managed) {
|
|
57
73
|
if (notice.kind === 'none')
|
|
58
74
|
return null;
|
|
59
|
-
if (notice.kind === '
|
|
75
|
+
if (notice.kind === 'no_tools')
|
|
76
|
+
return { kind: 'add_routes', run: 'settings', account: null };
|
|
77
|
+
if (notice.kind === 'sign_in' || notice.kind === 'sign_in_again') {
|
|
60
78
|
if (target === 'add')
|
|
61
79
|
return { kind: 'sign_in', run: 'add', account: null };
|
|
62
|
-
|
|
80
|
+
// A managed account signs in through its provider window (`reconnect`).
|
|
81
|
+
return target ? { kind: 'sign_in', run: managed ? 'reconnect' : 'sign_in', account: target } : null;
|
|
63
82
|
}
|
|
64
83
|
if (notice.action === 'add_account')
|
|
65
84
|
return { kind: 'add_account', run: 'add', account: null };
|
|
@@ -4,7 +4,7 @@ import { connectorConnectionQueryKeys } from '../../sections/connector-connectio
|
|
|
4
4
|
import { invalidateConnections } from '../invalidate-connections.js';
|
|
5
5
|
import { ConnectorNoticeRow, NOTICE_BODY, NOTICE_TITLE, NoticeLogLine, } from './connector-notice-view.js';
|
|
6
6
|
import { DetailPageShell, DETAIL_PAGE_COLUMN as PAGE_COLUMN } from './detail-page-shell.js';
|
|
7
|
-
import { getProjectDetail, listConnectors, syncConnectors } from '@kortix/sdk';
|
|
7
|
+
import { connectorAccountSignInStarted, getProjectDetail, listConnectors, syncConnectors, } from '@kortix/sdk';
|
|
8
8
|
import { contract, FRESHNESS, qk, useProjectAccountId } from '@kortix/sdk/react';
|
|
9
9
|
import { CaretLeftIcon, PlugIcon, PlusIcon } from '@phosphor-icons/react';
|
|
10
10
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
@@ -33,14 +33,15 @@ import { useProjectCan } from '../../../internal/lib/use-project-can.js';
|
|
|
33
33
|
import { isManagedConnectorProvider } from '../provider-label.js';
|
|
34
34
|
import { ConnectorDetailTabs } from './connector-detail-tabs.js';
|
|
35
35
|
import { ConnectorMoveRow, useConnectorMove } from './connector-move-row.js';
|
|
36
|
-
import { connectorNotice, noticeButton, noticeTarget } from './connector-notice.js';
|
|
36
|
+
import { accountNeverSignedIn, connectorNotice, noticeButton, noticeTarget } from './connector-notice.js';
|
|
37
37
|
import { connectHandoff, connectorPageState } from './connector-page-state.js';
|
|
38
|
-
import { connectorRunsOver,
|
|
38
|
+
import { connectorRunsOver, connectorTone } from './connector-status.js';
|
|
39
39
|
import { CONNECTOR_TAB_LABEL_KEY, connectorTabs } from './connector-tabs.js';
|
|
40
40
|
import { useConnectorEventTriggers } from './connector-triggers.js';
|
|
41
41
|
import { ProviderInfo, providerName } from './provider-info.js';
|
|
42
42
|
import { ConnectorStatusBadge } from './status-badge.js';
|
|
43
43
|
import { useConnectorDetail } from './use-connector-detail.js';
|
|
44
|
+
import { useMcpOAuthSignIn } from './use-mcp-oauth-sign-in.js';
|
|
44
45
|
/** The column `CapabilityPageShell` gives the list page beside this one. */
|
|
45
46
|
/**
|
|
46
47
|
* `/workspaces/<id>/admin/connectors/<app>/<connector>` — one connector, as
|
|
@@ -118,6 +119,7 @@ export function ConnectorDetailView({ projectId, connector, canWrite, onChanged,
|
|
|
118
119
|
const t = useTranslations('connectorPages');
|
|
119
120
|
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
120
121
|
const tSharing = useTranslations('accessSharing');
|
|
122
|
+
const tSignIn = useTranslations('connectSignIn');
|
|
121
123
|
const search = useUiSearchParams();
|
|
122
124
|
const router = useUiRouter();
|
|
123
125
|
const pathname = useUiPathname();
|
|
@@ -233,6 +235,14 @@ export function ConnectorDetailView({ projectId, connector, canWrite, onChanged,
|
|
|
233
235
|
const everyoneLabel = projectName
|
|
234
236
|
? tSharing('everyone', { project: projectName })
|
|
235
237
|
: tSharing('visibilityEveryone');
|
|
238
|
+
// The account the banner's button fixes (see `noticeTarget`).
|
|
239
|
+
const target = noticeTarget(accounts);
|
|
240
|
+
const targetAccount = target && target !== 'add' ? target : null;
|
|
241
|
+
// An MCP server with one-click OAuth signs in like a managed app: its
|
|
242
|
+
// accounts say "Sign in", never "credential". Any account answers for it.
|
|
243
|
+
const oauthMcp = useMcpOAuthSignIn(projectId, connector, (targetAccount ?? accounts.find((account) => account.authorized === false) ?? null)
|
|
244
|
+
?.connection_id ?? null);
|
|
245
|
+
const signsIn = isManagedProvider || oauthMcp;
|
|
236
246
|
// One banner says what is wrong and carries the button that fixes it.
|
|
237
247
|
const notice = connectorNotice({
|
|
238
248
|
provider: connector.provider,
|
|
@@ -244,6 +254,9 @@ export function ConnectorDetailView({ projectId, connector, canWrite, onChanged,
|
|
|
244
254
|
managed: isManagedProvider,
|
|
245
255
|
accountCount: accounts.length,
|
|
246
256
|
accountsLoaded: connectionsQuery.isSuccess,
|
|
257
|
+
signsIn,
|
|
258
|
+
neverSignedIn: targetAccount ? accountNeverSignedIn(targetAccount) : true,
|
|
259
|
+
toolCount: connector.actions.length,
|
|
247
260
|
});
|
|
248
261
|
// Re-read the connector's tools. The list refetch that follows shows the
|
|
249
262
|
// new status, or the same error with its reason.
|
|
@@ -273,9 +286,11 @@ export function ConnectorDetailView({ projectId, connector, canWrite, onChanged,
|
|
|
273
286
|
// A Pipedream connector that can move: the move is the fix. A new Pipedream
|
|
274
287
|
// account would only have to sign in again after the move.
|
|
275
288
|
const move = useConnectorMove(projectId, connector);
|
|
276
|
-
const fix = move?.to ? null : noticeButton(notice,
|
|
289
|
+
const fix = move?.to ? null : noticeButton(notice, target, isManagedProvider);
|
|
277
290
|
const runFix = () => {
|
|
278
|
-
if (fix?.run === '
|
|
291
|
+
if (fix?.run === 'settings')
|
|
292
|
+
setTab('settings');
|
|
293
|
+
else if (fix?.run === 'add')
|
|
279
294
|
requestAdd();
|
|
280
295
|
else if (fix?.run === 'sign_in' && fix.account)
|
|
281
296
|
signIn.mutate(fix.account);
|
|
@@ -286,7 +301,7 @@ export function ConnectorDetailView({ projectId, connector, canWrite, onChanged,
|
|
|
286
301
|
// account reconnects through its provider window.
|
|
287
302
|
const needsSignIn = isManagedProvider || Boolean(connector.authSecret);
|
|
288
303
|
const connectAccount = (account) => isManagedProvider ? reconnectAccount(account) : signIn.mutate(account);
|
|
289
|
-
const tone =
|
|
304
|
+
const tone = connectorTone(connector, connectionsQuery.isSuccess ? accounts.length : undefined);
|
|
290
305
|
const providerManagedBy = isManagedConnectorProvider(connector.provider)
|
|
291
306
|
? connectorRunsOver(connector.provider)
|
|
292
307
|
: null;
|
|
@@ -322,7 +337,11 @@ export function ConnectorDetailView({ projectId, connector, canWrite, onChanged,
|
|
|
322
337
|
const addAccountControl = isComputer ? (_jsxs(Button, { size: "sm", className: "gap-1.5", onClick: () => setComputerOpen(true), children: [_jsx(PlusIcon, { className: "size-4 shrink-0" }), tI18nComplete.raw('text1a2303ede074')] })) : (_jsxs(Button, { size: "sm", className: "gap-1.5", onClick: requestAdd, disabled: connectPending, children: [_jsx(PlusIcon, { className: "size-4 shrink-0" }), tSharing('addAccount')] }));
|
|
323
338
|
return (_jsxs(SplitSheet, { open: sheetOpen, onOpenChange: closeCredential, size: "lg", className: "flex-1", children: [_jsx(SplitSheetMain, { children: _jsxs("div", { className: columnClassName, children: [back, _jsxs("header", { className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [_jsx(ConnectorLogo, { source: installedConnectorLogoSource(connector), size: "lg" }), wrapTitle(_jsx("h1", { ref: headingRef, tabIndex: -1, className: "text-foreground min-w-0 text-xl font-medium text-balance wrap-break-word", children: displayName }))] }), _jsxs("div", { className: "flex shrink-0 flex-wrap items-center gap-2", children: [isComputer && headerCta === 'connect' ? addAccountControl : null, connected ? (_jsx(Button, { size: "sm", variant: "outline", onClick: () => startPrivateSession(), children: t('newSession') })) : null, headerEnd] })] }), _jsxs("div", { className: "bg-popover divide-border divide-y overflow-hidden rounded-md border", children: [_jsx("dl", { className: "divide-border flex divide-x", children: stripCells.map((cell) => (_jsxs("div", { className: "min-w-0 flex-1 space-y-0.5 px-4 py-2.5", children: [_jsxs("dt", { className: "text-muted-foreground flex h-4 items-center justify-between gap-2 text-xs", children: [_jsx("span", { className: "truncate", children: cell.label }), cell.labelAddon] }), _jsx("dd", { className: "text-foreground flex min-w-0 items-center gap-1.5 truncate text-sm font-medium", children: cell.value })] }, cell.key))) }), notice.kind !== 'none' && !(notice.kind === 'no_account' && tab === 'accounts') ? (_jsxs(ConnectorNoticeRow, { title: t(NOTICE_TITLE[notice.kind], { name: displayName }), detail: notice.kind === 'error' && notice.reason ? (_jsx(NoticeLogLine, { reason: notice.reason })) : (_jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: t(notice.kind === 'needs_credential' && isManagedProvider
|
|
324
339
|
? 'noticeReconnectBody'
|
|
325
|
-
: NOTICE_BODY[notice.kind], { name: displayName }) })), children: [notice.kind === 'error' && canWrite ? (_jsxs(Button, { size: "sm", variant: "ghost", className: "gap-1.5", onClick: () => retry.mutate(), disabled: retry.isPending, children: [retry.isPending ? _jsx(Loading, { className: "size-4 shrink-0" }) : null, tI18nComplete.raw('text942087cc2d41')] })) : null, fix?.kind === 'add_account' ? (addAccountControl) : fix?.kind === '
|
|
340
|
+
: NOTICE_BODY[notice.kind], { name: displayName }) })), children: [notice.kind === 'error' && canWrite ? (_jsxs(Button, { size: "sm", variant: "ghost", className: "gap-1.5", onClick: () => retry.mutate(), disabled: retry.isPending, children: [retry.isPending ? _jsx(Loading, { className: "size-4 shrink-0" }) : null, tI18nComplete.raw('text942087cc2d41')] })) : null, fix?.kind === 'add_account' ? (addAccountControl) : fix?.kind === 'add_routes' ? (
|
|
341
|
+
// The routes spec is on the Settings tab, which only writers see.
|
|
342
|
+
canWrite ? (_jsx(Button, { size: "sm", variant: "secondary", onClick: runFix, children: t('noticeAddRoutesAction') })) : null) : fix?.kind === 'sign_in' ? (_jsxs(Button, { size: "sm", className: "gap-1.5", onClick: runFix, disabled: signIn.isPending || connectPending, children: [signIn.isPending || connectPending ? (_jsx(SessionDotMatrix, { size: 14, className: "shrink-0" })) : null, fix.account && connectorAccountSignInStarted(fix.account)
|
|
343
|
+
? tSignIn('finishSignIn')
|
|
344
|
+
: t('noticeSignInAction')] })) : fix ? (
|
|
326
345
|
// Fix it here: credential entry for a direct account, the
|
|
327
346
|
// provider window for a managed one, or "Add account" for
|
|
328
347
|
// a caller with no account of their own.
|
|
@@ -343,6 +362,7 @@ export function ConnectorDetailView({ projectId, connector, canWrite, onChanged,
|
|
|
343
362
|
onRemoved: onLeave,
|
|
344
363
|
onSetCredential: setCredentialTarget,
|
|
345
364
|
onConnect: needsSignIn ? connectAccount : undefined,
|
|
365
|
+
signsIn,
|
|
346
366
|
showAccountInfo: true,
|
|
347
367
|
}, settings: {
|
|
348
368
|
projectId: projectId,
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import type { AdminConnector } from '@kortix/sdk';
|
|
2
2
|
/** The connector states and their rules live in `@kortix/sdk`. */
|
|
3
3
|
export { connectorDerivedState, connectorStatusTone, connectorUsable, type ConnectorDerivedState, type ConnectorStatusTone, } from '@kortix/sdk';
|
|
4
|
-
|
|
4
|
+
import { connectorStatusTone, type ConnectorStatusTone } from '@kortix/sdk';
|
|
5
|
+
/**
|
|
6
|
+
* The tone a connector shows. `no_tools`: an HTTP connector that works but has
|
|
7
|
+
* no routes, so agents have nothing to call. It reads "No tools", not
|
|
8
|
+
* "Connected" with a 0 beside it.
|
|
9
|
+
*/
|
|
10
|
+
export type ConnectorTone = ConnectorStatusTone | 'no_tools';
|
|
11
|
+
/** An HTTP connector with no routes: it gives agents no tools. */
|
|
12
|
+
export declare function connectorHasNoTools(connector: Pick<AdminConnector, 'provider' | 'actions'>): boolean;
|
|
13
|
+
export declare function connectorTone(connector: Parameters<typeof connectorStatusTone>[0] & Pick<AdminConnector, 'provider' | 'actions'>, accountCount?: number): ConnectorTone;
|
|
14
|
+
export declare const STATUS_DOT: Record<ConnectorTone, string>;
|
|
5
15
|
/** The `connectorPages` key of each state's word. */
|
|
6
16
|
export declare const STATUS_WORD: {
|
|
7
17
|
readonly connected: "statusConnected";
|
|
8
18
|
readonly account: "statusNeedsAccount";
|
|
9
19
|
readonly error: "statusError";
|
|
20
|
+
readonly no_tools: "statusNoTools";
|
|
10
21
|
};
|
|
11
22
|
/** What the connector runs over: its provider, named the way a person says it. */
|
|
12
23
|
export declare function connectorRunsOver(provider: AdminConnector['provider']): string;
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
/** The connector states and their rules live in `@kortix/sdk`. */
|
|
2
2
|
export { connectorDerivedState, connectorStatusTone, connectorUsable, } from '@kortix/sdk';
|
|
3
|
+
import { connectorStatusTone } from '@kortix/sdk';
|
|
3
4
|
import { providerLabel } from '../provider-label.js';
|
|
5
|
+
/** An HTTP connector with no routes: it gives agents no tools. */
|
|
6
|
+
export function connectorHasNoTools(connector) {
|
|
7
|
+
return connector.provider === 'http' && (connector.actions?.length ?? 0) === 0;
|
|
8
|
+
}
|
|
9
|
+
export function connectorTone(connector, accountCount) {
|
|
10
|
+
const tone = connectorStatusTone(connector, accountCount);
|
|
11
|
+
return tone === 'connected' && connectorHasNoTools(connector) ? 'no_tools' : tone;
|
|
12
|
+
}
|
|
4
13
|
export const STATUS_DOT = {
|
|
5
14
|
connected: 'bg-kortix-green',
|
|
6
15
|
account: 'bg-kortix-orange',
|
|
7
16
|
error: 'bg-kortix-red',
|
|
17
|
+
no_tools: 'bg-kortix-orange',
|
|
8
18
|
};
|
|
9
19
|
/** The `connectorPages` key of each state's word. */
|
|
10
20
|
export const STATUS_WORD = {
|
|
11
21
|
connected: 'statusConnected',
|
|
12
22
|
account: 'statusNeedsAccount',
|
|
13
23
|
error: 'statusError',
|
|
24
|
+
no_tools: 'statusNoTools',
|
|
14
25
|
};
|
|
15
26
|
/** What the connector runs over: its provider, named the way a person says it. */
|
|
16
27
|
export function connectorRunsOver(provider) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
/** A connector's state as a Badge with its dot: Connected, Needs account or Error. */
|
|
1
|
+
import { type ConnectorTone } from './connector-status.js';
|
|
2
|
+
/** A connector's state as a Badge with its dot: Connected, Needs account, No tools or Error. */
|
|
3
3
|
export declare function ConnectorStatusBadge({ tone }: {
|
|
4
|
-
tone:
|
|
4
|
+
tone: ConnectorTone;
|
|
5
5
|
}): import("react").JSX.Element;
|
|
@@ -7,8 +7,9 @@ const STATUS_BADGE = {
|
|
|
7
7
|
connected: 'success',
|
|
8
8
|
account: 'warning',
|
|
9
9
|
error: 'destructive',
|
|
10
|
+
no_tools: 'warning',
|
|
10
11
|
};
|
|
11
|
-
/** A connector's state as a Badge with its dot: Connected, Needs account or Error. */
|
|
12
|
+
/** A connector's state as a Badge with its dot: Connected, Needs account, No tools or Error. */
|
|
12
13
|
export function ConnectorStatusBadge({ tone }) {
|
|
13
14
|
const t = useTranslations('connectorPages');
|
|
14
15
|
return (_jsxs(Badge, { variant: STATUS_BADGE[tone], size: "sm", children: [_jsx("span", { "data-slot": "status-dot", "aria-hidden": true, className: cn('rounded-full', STATUS_DOT[tone]) }), t(STATUS_WORD[tone])] }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { listConnections, listedConnectorAccounts as connectorAccounts, } from '@kortix/sdk';
|
|
2
|
+
import { connectorAccountSignInStarted, listConnections, listedConnectorAccounts as connectorAccounts, } from '@kortix/sdk';
|
|
3
3
|
import { useProjectAccountId } from '@kortix/sdk/react';
|
|
4
4
|
import { useQuery } from '@tanstack/react-query';
|
|
5
5
|
import { useState } from 'react';
|
|
@@ -8,6 +8,7 @@ import { isManagedConnectorProvider } from '../provider-label.js';
|
|
|
8
8
|
import { connectorSetupStatus } from '../../sections/connector-connection-form.js';
|
|
9
9
|
import { usePipedreamConnectMember } from '../../../internal/hooks/connectors/use-pipedream-connect-member.js';
|
|
10
10
|
import { usePipedreamConnectProject } from '../../../internal/hooks/connectors/use-pipedream-connect-project.js';
|
|
11
|
+
import { useFinishSignIn } from '../../../internal/hooks/connectors/use-finish-sign-in.js';
|
|
11
12
|
import { useNewProjectSession } from '../../../internal/hooks/projects/use-new-project-session.js';
|
|
12
13
|
import { PROJECT_ACTIONS } from '../../../internal/lib/project-actions.js';
|
|
13
14
|
import { useProjectCan } from '../../../internal/lib/use-project-can.js';
|
|
@@ -53,6 +54,7 @@ export function useConnectorDetail({ projectId, connector, canWrite, onChanged,
|
|
|
53
54
|
};
|
|
54
55
|
const connectShared = usePipedreamConnectProject(projectId, connector.slug, refreshAccounts);
|
|
55
56
|
const connectMine = usePipedreamConnectMember(projectId, connector.slug, refreshAccounts);
|
|
57
|
+
const finishSignIn = useFinishSignIn(projectId, connector.slug, refreshAccounts);
|
|
56
58
|
// `accountId` rides the qk.project.detail(id) cache the connectors page
|
|
57
59
|
// already filled, so the connections probe resolves on the first render
|
|
58
60
|
// instead of after its own getProject round-trip.
|
|
@@ -95,6 +97,12 @@ export function useConnectorDetail({ projectId, connector, canWrite, onChanged,
|
|
|
95
97
|
* credential entry for a direct one. */
|
|
96
98
|
const reconnectAccount = (account) => {
|
|
97
99
|
const owner = account.owner_type === 'project' ? 'project' : 'me';
|
|
100
|
+
// A sign-in that started and never finished: ask the provider first, and
|
|
101
|
+
// record it when it finished there (an agent's link used outside Kortix).
|
|
102
|
+
if (isManagedProvider && account.authorized === false && connectorAccountSignInStarted(account)) {
|
|
103
|
+
finishSignIn.mutate(account);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
98
106
|
if (isManagedProvider) {
|
|
99
107
|
// Reconciling the SAME label re-points this row, never a second account.
|
|
100
108
|
if (owner === 'project')
|
|
@@ -119,7 +127,7 @@ export function useConnectorDetail({ projectId, connector, canWrite, onChanged,
|
|
|
119
127
|
connected,
|
|
120
128
|
canManageConnections,
|
|
121
129
|
headerCta,
|
|
122
|
-
connectPending: connectShared.isPending || connectMine.isPending,
|
|
130
|
+
connectPending: connectShared.isPending || connectMine.isPending || finishSignIn.isPending,
|
|
123
131
|
refreshAccounts,
|
|
124
132
|
replaceSoleAccount,
|
|
125
133
|
startPrivateSession,
|