@kortix/ui 0.15.7 → 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.
Files changed (262) hide show
  1. package/README.md +7 -7
  2. package/dist/_vendor/kortix-shared.js +39 -1
  3. package/dist/_vendor/shared/my-kortix-agent.d.ts +7 -0
  4. package/dist/_vendor/shared/pixel-mark.d.ts +18 -0
  5. package/dist/access/access/access-dialog-share.js +12 -6
  6. package/dist/access/access/share-selection.d.ts +9 -0
  7. package/dist/access/access/share-selection.js +64 -0
  8. package/dist/customize/connectors/catalog/connector-categories.d.ts +2 -2
  9. package/dist/customize/connectors/catalog/connector-categories.js +2 -2
  10. package/dist/customize/connectors/connector-identity.js +3 -3
  11. package/dist/customize/connectors/detail/app-page.js +2 -2
  12. package/dist/customize/connectors/detail/connector-accounts.d.ts +3 -1
  13. package/dist/customize/connectors/detail/connector-accounts.js +2 -2
  14. package/dist/customize/connectors/detail/connector-modal.js +1 -1
  15. package/dist/customize/connectors/detail/connector-notice-view.d.ts +4 -0
  16. package/dist/customize/connectors/detail/connector-notice-view.js +4 -0
  17. package/dist/customize/connectors/detail/connector-notice.d.ts +31 -4
  18. package/dist/customize/connectors/detail/connector-notice.js +23 -4
  19. package/dist/customize/connectors/detail/connector-page.js +27 -7
  20. package/dist/customize/connectors/detail/connector-status.d.ts +12 -1
  21. package/dist/customize/connectors/detail/connector-status.js +11 -0
  22. package/dist/customize/connectors/detail/status-badge.d.ts +3 -3
  23. package/dist/customize/connectors/detail/status-badge.js +2 -1
  24. package/dist/customize/connectors/detail/use-connector-detail.js +10 -2
  25. package/dist/customize/connectors/detail/use-mcp-oauth-sign-in.d.ts +13 -0
  26. package/dist/customize/connectors/detail/use-mcp-oauth-sign-in.js +29 -0
  27. package/dist/customize/providers/provider-accordion.js +5 -4
  28. package/dist/customize/providers/provider-connect.js +3 -1
  29. package/dist/customize/providers/provider-sheet.js +9 -4
  30. package/dist/customize/sections/component/email-connect-form.js +4 -2
  31. package/dist/customize/sections/connectors-view.d.ts +4 -1
  32. package/dist/customize/sections/connectors-view.js +42 -7
  33. package/dist/customize/sections/gateway-view.d.ts +1 -1
  34. package/dist/customize/sections/gateway-view.js +1 -1
  35. package/dist/customize/sections/view/account-secret-resources-panel.d.ts +15 -0
  36. package/dist/customize/sections/view/account-secret-resources-panel.js +48 -7
  37. package/dist/customize/sections/view/agent-editor-basics-fields.js +1 -1
  38. package/dist/customize/sections/view/gateway/gateway-logs.d.ts +1 -1
  39. package/dist/customize/sections/view/git-view.js +1 -1
  40. package/dist/customize/sections/view/permission-editor.js +1 -1
  41. package/dist/customize/sections/view/secret-delivery.d.ts +9 -2
  42. package/dist/customize/sections/view/secret-delivery.js +14 -4
  43. package/dist/customize/sections/view/secrets-view.js +21 -5
  44. package/dist/customize/sections/view/subscription-usage.d.ts +3 -32
  45. package/dist/customize/sections/view/subscription-usage.js +2 -86
  46. package/dist/customize/shared/entity/entity-modal.js +8 -10
  47. package/dist/customize/triggers/schedule/schedule-builder.js +1 -1
  48. package/dist/customize/triggers/schedule/schedule-copy.js +4 -0
  49. package/dist/customize/triggers/schedule/schedule-detail-sheet.js +14 -3
  50. package/dist/customize/triggers/schedule/then-fields.d.ts +3 -1
  51. package/dist/customize/triggers/schedule/then-fields.js +8 -4
  52. package/dist/customize/triggers/schedule/trigger-composer.js +1 -1
  53. package/dist/customize/triggers/schedule/trigger-list.d.ts +3 -1
  54. package/dist/customize/triggers/schedule/trigger-list.js +18 -2
  55. package/dist/customize/triggers/schedule/trigger-runs-logic.js +4 -2
  56. package/dist/customize/triggers/schedule/trigger-runs-panel.js +4 -1
  57. package/dist/files/project/components/drive-toolbar.d.ts +1 -1
  58. package/dist/files/project/components/drive-toolbar.js +1 -1
  59. package/dist/files/project/store/version-store.d.ts +1 -1
  60. package/dist/files/renderers/pptx-renderer.js +5 -20
  61. package/dist/files/renderers/presentation/FullScreenPresentationViewer.d.ts +3 -2
  62. package/dist/files/renderers/presentation/FullScreenPresentationViewer.js +23 -304
  63. package/dist/files/renderers/presentation/presentation-export-menu.d.ts +14 -0
  64. package/dist/files/renderers/presentation/presentation-export-menu.js +44 -0
  65. package/dist/files/renderers/presentation/presentation-utils.d.ts +1 -0
  66. package/dist/files/renderers/presentation/presentation-utils.js +4 -0
  67. package/dist/files/renderers/presentation/slide-iframe.d.ts +23 -0
  68. package/dist/files/renderers/presentation/slide-iframe.js +61 -0
  69. package/dist/files/renderers/presentation/use-presentation-metadata.d.ts +39 -0
  70. package/dist/files/renderers/presentation/use-presentation-metadata.js +137 -0
  71. package/dist/files/renderers/presentation/use-slide-navigation.d.ts +17 -0
  72. package/dist/files/renderers/presentation/use-slide-navigation.js +82 -0
  73. package/dist/files/renderers/shared/scroll-area-compat.d.ts +6 -6
  74. package/dist/files/renderers/shared/scroll-area-compat.js +7 -9
  75. package/dist/files/renderers/shared/select-compat.js +3 -7
  76. package/dist/files/renderers/shared/use-stage-fit-scale.d.ts +19 -0
  77. package/dist/files/renderers/shared/use-stage-fit-scale.js +41 -0
  78. package/dist/files/renderers/show-content-renderer.js +16 -11
  79. package/dist/files/renderers/xlsx/xlsx-renderer.d.ts +4 -13
  80. package/dist/files/renderers/xlsx/xlsx-renderer.js +6 -63
  81. package/dist/files/renderers/xlsx/xlsx-viewer.d.ts +4 -2
  82. package/dist/files/renderers/xlsx/xlsx-viewer.js +28 -34
  83. package/dist/files/viewer/file-content-renderer.js +1 -4
  84. package/dist/files/viewer/file-preview-modal.d.ts +10 -11
  85. package/dist/files/viewer/file-preview-modal.js +17 -18
  86. package/dist/files/viewer/use-file-content-state.js +10 -9
  87. package/dist/i18n/en.d.ts +51 -0
  88. package/dist/i18n/en.js +58 -7
  89. package/dist/index.js +1 -1
  90. package/dist/internal/account-hub/account-hub-location.js +2 -2
  91. package/dist/internal/account-hub/use-account-members.d.ts +28 -1
  92. package/dist/internal/account-hub/use-account-members.js +27 -10
  93. package/dist/internal/chrome/use-chrome-offered.d.ts +2 -1
  94. package/dist/internal/chrome/use-chrome-offered.js +4 -2
  95. package/dist/internal/components/agent-mark.d.ts +1 -8
  96. package/dist/internal/components/agent-mark.js +2 -19
  97. package/dist/internal/hooks/connectors/use-finish-sign-in.d.ts +13 -0
  98. package/dist/internal/hooks/connectors/use-finish-sign-in.js +33 -0
  99. package/dist/internal/hooks/connectors/use-pipedream-connect-member.js +6 -1
  100. package/dist/internal/hooks/connectors/use-pipedream-connect-project.js +6 -1
  101. package/dist/internal/lib/error-handler.js +33 -0
  102. package/dist/internal/lib/navigation/modified-click.js +2 -2
  103. package/dist/internal/lib/pixel-mark.d.ts +3 -20
  104. package/dist/internal/lib/pixel-mark.js +3 -34
  105. package/dist/internal/lib/trigger-clock.d.ts +7 -2
  106. package/dist/internal/lib/trigger-clock.js +17 -3
  107. package/dist/internal/stores/active-space-store.d.ts +1 -1
  108. package/dist/internal/stores/browser-recents-store.d.ts +1 -1
  109. package/dist/internal/stores/current-account-store.d.ts +1 -1
  110. package/dist/internal/stores/first-chat-store.d.ts +1 -1
  111. package/dist/internal/stores/mobile-app-promo-store.d.ts +1 -1
  112. package/dist/internal/stores/session-browser-store.d.ts +1 -1
  113. package/dist/internal/stores/session-expanded-store.d.ts +1 -1
  114. package/dist/internal/stores/session-filter-store.d.ts +1 -1
  115. package/dist/internal/stores/session-history-view-store.d.ts +1 -1
  116. package/dist/internal/stores/session-hover-store.d.ts +1 -1
  117. package/dist/internal/stores/session-hover-store.js +1 -1
  118. package/dist/internal/stores/session-panel-memory-store.d.ts +1 -1
  119. package/dist/internal/stores/sound-store.d.ts +1 -1
  120. package/dist/internal/stores/tab-store.d.ts +1 -1
  121. package/dist/internal/stores/user-preferences-store.d.ts +1 -1
  122. package/dist/internal/stores/web-notification-store.d.ts +1 -1
  123. package/dist/lib/base-ui-compat.d.ts +149 -0
  124. package/dist/lib/base-ui-compat.js +339 -0
  125. package/dist/lib/portal-container.d.ts +3 -7
  126. package/dist/lib/portal-container.js +5 -3
  127. package/dist/lib/z-stack.d.ts +9 -5
  128. package/dist/lib/z-stack.js +17 -7
  129. package/dist/primitives/accordion.d.ts +36 -5
  130. package/dist/primitives/accordion.js +41 -8
  131. package/dist/primitives/alert-dialog.d.ts +33 -11
  132. package/dist/primitives/alert-dialog.js +41 -19
  133. package/dist/primitives/avatar.d.ts +5 -2
  134. package/dist/primitives/avatar.js +3 -3
  135. package/dist/primitives/badge.js +1 -1
  136. package/dist/primitives/breadcrumb.js +1 -1
  137. package/dist/primitives/button-group.js +3 -3
  138. package/dist/primitives/button.js +1 -1
  139. package/dist/primitives/checkbox.d.ts +14 -5
  140. package/dist/primitives/checkbox.js +24 -9
  141. package/dist/primitives/collapsible.d.ts +16 -4
  142. package/dist/primitives/collapsible.js +18 -7
  143. package/dist/primitives/command-core.d.ts +121 -0
  144. package/dist/primitives/command-core.js +642 -0
  145. package/dist/primitives/command.d.ts +38 -4
  146. package/dist/primitives/command.js +22 -13
  147. package/dist/primitives/context-menu.d.ts +61 -31
  148. package/dist/primitives/context-menu.js +40 -53
  149. package/dist/primitives/dialog.d.ts +48 -10
  150. package/dist/primitives/dialog.js +48 -19
  151. package/dist/primitives/disclosure.d.ts +1 -1
  152. package/dist/primitives/disclosure.js +2 -2
  153. package/dist/primitives/drawer.d.ts +28 -9
  154. package/dist/primitives/drawer.js +42 -18
  155. package/dist/primitives/dropdown-menu.d.ts +55 -33
  156. package/dist/primitives/dropdown-menu.js +46 -82
  157. package/dist/primitives/faded-scroll-area.js +2 -1
  158. package/dist/primitives/hint.js +3 -3
  159. package/dist/primitives/hover-card.d.ts +17 -5
  160. package/dist/primitives/hover-card.js +45 -8
  161. package/dist/primitives/item.js +2 -2
  162. package/dist/primitives/label.d.ts +5 -2
  163. package/dist/primitives/label.js +10 -3
  164. package/dist/primitives/menu-base.d.ts +150 -0
  165. package/dist/primitives/menu-base.js +171 -0
  166. package/dist/primitives/menu-recipe.d.ts +1 -1
  167. package/dist/primitives/menu-recipe.js +2 -7
  168. package/dist/primitives/modal.d.ts +19 -52
  169. package/dist/primitives/modal.js +24 -28
  170. package/dist/primitives/navigation-menu.d.ts +36 -11
  171. package/dist/primitives/navigation-menu.js +31 -12
  172. package/dist/primitives/popover.d.ts +31 -6
  173. package/dist/primitives/popover.js +79 -12
  174. package/dist/primitives/preview-image.d.ts +18 -7
  175. package/dist/primitives/preview-image.js +14 -11
  176. package/dist/primitives/progress.d.ts +4 -2
  177. package/dist/primitives/progress.js +4 -3
  178. package/dist/primitives/project-icon-picker.js +2 -2
  179. package/dist/primitives/radio-group.d.ts +28 -5
  180. package/dist/primitives/radio-group.js +18 -10
  181. package/dist/primitives/scroll-area.d.ts +2 -2
  182. package/dist/primitives/scroll-area.js +8 -3
  183. package/dist/primitives/select.d.ts +55 -12
  184. package/dist/primitives/select.js +93 -36
  185. package/dist/primitives/separator.d.ts +6 -2
  186. package/dist/primitives/separator.js +10 -2
  187. package/dist/primitives/sheet.d.ts +17 -10
  188. package/dist/primitives/sheet.js +19 -22
  189. package/dist/primitives/sidebar-menu-primitives.js +8 -8
  190. package/dist/primitives/slider-native.d.ts +2 -2
  191. package/dist/primitives/slider-native.js +11 -9
  192. package/dist/primitives/slider.d.ts +24 -6
  193. package/dist/primitives/slider.js +26 -24
  194. package/dist/primitives/slot.d.ts +6 -0
  195. package/dist/primitives/slot.js +7 -0
  196. package/dist/primitives/split-sheet.js +1 -1
  197. package/dist/primitives/stepper.js +1 -1
  198. package/dist/primitives/switch.d.ts +16 -3
  199. package/dist/primitives/switch.js +7 -6
  200. package/dist/primitives/tabs.d.ts +36 -20
  201. package/dist/primitives/tabs.js +131 -102
  202. package/dist/primitives/toggle.d.ts +16 -3
  203. package/dist/primitives/toggle.js +8 -3
  204. package/dist/primitives/tooltip.d.ts +24 -5
  205. package/dist/primitives/tooltip.js +32 -10
  206. package/dist/primitives/type-to-confirm-dialog.d.ts +1 -1
  207. package/dist/primitives/type-to-confirm-dialog.js +1 -1
  208. package/dist/session/composer/animated-placeholder.js +1 -1
  209. package/dist/session/composer/chat-input/chat-input-control.js +3 -3
  210. package/dist/session/composer/editor/composer-editor.js +1 -1
  211. package/dist/session/composer/menus/menu-shell.d.ts +1 -1
  212. package/dist/session/composer/menus/menu-shell.js +1 -1
  213. package/dist/session/composer/menus/mount.js +1 -1
  214. package/dist/session/composer/reasoning-effort-selector.js +1 -1
  215. package/dist/session/header/session-site-header.js +2 -2
  216. package/dist/session/header/subagent-hover-card.js +2 -2
  217. package/dist/session/media/image-preview.js +1 -1
  218. package/dist/session/models/model-connection-gate.js +16 -3
  219. package/dist/session/models/model-picker-panel.js +6 -2
  220. package/dist/session/models/model-selector.d.ts +1 -1
  221. package/dist/session/models/model-selector.js +18 -12
  222. package/dist/session/models/provider-key-action.d.ts +10 -0
  223. package/dist/session/models/provider-key-action.js +35 -0
  224. package/dist/session/models/provider-key-slot.d.ts +9 -0
  225. package/dist/session/models/provider-key-slot.js +19 -0
  226. package/dist/session/models/subscription-switcher.d.ts +37 -0
  227. package/dist/session/models/subscription-switcher.js +97 -0
  228. package/dist/session/models/subscription-windows.d.ts +40 -0
  229. package/dist/session/models/subscription-windows.js +86 -0
  230. package/dist/session/overrides/session-overrides-control.js +3 -3
  231. package/dist/session/panel/diff-dialog.js +1 -1
  232. package/dist/session/panel/easy/detail-view.js +3 -3
  233. package/dist/session/panel/mobile-tool-drawer.js +2 -2
  234. package/dist/session/panel/panel-fallback.js +1 -1
  235. package/dist/session/panel/session-files-explorer.d.ts +1 -1
  236. package/dist/session/panel/session-files-explorer.js +1 -1
  237. package/dist/session/prompts/session-connect-prompt.d.ts +40 -0
  238. package/dist/session/prompts/session-connect-prompt.js +126 -0
  239. package/dist/session/status/session-error-banner.d.ts +1 -1
  240. package/dist/session/status/session-error-banner.js +12 -4
  241. package/dist/session/thread/session-chat.js +9 -4
  242. package/dist/session/thread/session-context-message-explorer.js +1 -1
  243. package/dist/session/thread/transcript.js +31 -7
  244. package/dist/session/thread/turn-share.js +3 -4
  245. package/dist/session/tool/shared/show-helpers.js +1 -1
  246. package/dist/session/turn/message-time-label.js +1 -1
  247. package/dist/styles.css +1 -1
  248. package/dist/test-utils/intl.d.ts +51 -0
  249. package/dist/workspace/projects/modal/project-icon-field.js +9 -23
  250. package/dist/workspace/review/review-center.js +1 -1
  251. package/dist/workspace/sessions/session-row.js +1 -1
  252. package/dist/workspace/sidebar/project-session-list.js +2 -2
  253. package/dist/workspace/sidebar/session-brief-hover-card.d.ts +1 -1
  254. package/dist/workspace/sidebar/session-brief-hover-card.js +3 -3
  255. package/dist/workspace/sidebar/session-title.d.ts +2 -2
  256. package/dist/workspace/sidebar/session-title.js +2 -2
  257. package/dist/workspace/sidebar/workspace-menu-section.js +1 -1
  258. package/dist/workspace/spaces/space-links.js +1 -1
  259. package/dist/workspace/spaces/space-threads-tab.js +1 -1
  260. package/package.json +16 -35
  261. package/skills/kortix-ui/SKILL.md +1 -1
  262. package/skills/kortix-ui/references/custom-dashboard.md +1 -1
@@ -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, connectorStatusTone } from './connector-status.js';
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, noticeTarget(accounts), isManagedProvider);
289
+ const fix = move?.to ? null : noticeButton(notice, target, isManagedProvider);
277
290
  const runFix = () => {
278
- if (fix?.run === 'add')
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 = connectorStatusTone(connector, connectionsQuery.isSuccess ? accounts.length : undefined);
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 === 'sign_in' ? (_jsxs(Button, { size: "sm", className: "gap-1.5", onClick: runFix, disabled: signIn.isPending, children: [signIn.isPending ? _jsx(SessionDotMatrix, { size: 14, className: "shrink-0" }) : null, t('noticeSignInAction')] })) : fix ? (
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
- export declare const STATUS_DOT: Record<'connected' | 'account' | 'error', string>;
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 ConnectorStatusTone } from './connector-status.js';
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: ConnectorStatusTone;
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,
@@ -0,0 +1,13 @@
1
+ import { type AdminConnector } from '@kortix/sdk';
2
+ /**
3
+ * True when this MCP connector's accounts sign in through the server's
4
+ * one-click OAuth, not a typed credential. The banner and the account rows then
5
+ * say "Sign in", never "credential".
6
+ *
7
+ * Whether a server signs in with OAuth is a property of the server, so one
8
+ * account answers for the connector: the probe is the same discovery Install
9
+ * and the row's sign-in run. Only an account the caller may change can be
10
+ * probed; any other answer (no account, a refusal, no OAuth) is `false`, and
11
+ * the page keeps the credential wording.
12
+ */
13
+ export declare function useMcpOAuthSignIn(projectId: string, connector: Pick<AdminConnector, 'provider' | 'authSecret'>, connectionId: string | null): boolean;
@@ -0,0 +1,29 @@
1
+ 'use client';
2
+ import { discoverConnectionOAuth2Resource } from '@kortix/sdk';
3
+ import { useQuery } from '@tanstack/react-query';
4
+ import { autoConnectPlan } from '../../sections/connector-oauth2-auto.js';
5
+ /**
6
+ * True when this MCP connector's accounts sign in through the server's
7
+ * one-click OAuth, not a typed credential. The banner and the account rows then
8
+ * say "Sign in", never "credential".
9
+ *
10
+ * Whether a server signs in with OAuth is a property of the server, so one
11
+ * account answers for the connector: the probe is the same discovery Install
12
+ * and the row's sign-in run. Only an account the caller may change can be
13
+ * probed; any other answer (no account, a refusal, no OAuth) is `false`, and
14
+ * the page keeps the credential wording.
15
+ */
16
+ export function useMcpOAuthSignIn(projectId, connector, connectionId) {
17
+ const enabled = connector.provider === 'mcp' && Boolean(connector.authSecret) && Boolean(connectionId);
18
+ const query = useQuery({
19
+ queryKey: ['connector-oauth-sign-in', projectId, connectionId],
20
+ queryFn: async () => {
21
+ const { discovery } = await discoverConnectionOAuth2Resource(projectId, connectionId);
22
+ return autoConnectPlan(discovery).kind === 'register';
23
+ },
24
+ enabled,
25
+ staleTime: 10 * 60_000,
26
+ retry: false,
27
+ });
28
+ return enabled && query.data === true;
29
+ }
@@ -42,7 +42,7 @@ import { ChatGptSubscriptionConnect, useSubscriptionSignIn, } from '../sections/
42
42
  import { useConnectedProviders } from '../sections/llm-provider/use-connected-providers.js';
43
43
  import { useLiveLlmProviderCatalog, useLlmProviderCatalogRevision, } from '../sections/llm-provider/use-live-catalog.js';
44
44
  import { orderProviderRows } from '../sections/llm-provider/utils.js';
45
- import { AccountSecretResourcesPanel } from '../sections/view/account-secret-resources-panel.js';
45
+ import { AccountSecretResourcesPanel, PooledProvidersNote } from '../sections/view/account-secret-resources-panel.js';
46
46
  import { LegacyChatGptUsage, SubscriptionUsageSection } from '../sections/view/subscription-usage.js';
47
47
  import { useTranslations } from '../../i18n/index.js';
48
48
  import { LLM_PROVIDERS, LLM_PROVIDER_BY_ID } from '../../internal/lib/llm-providers.js';
@@ -180,7 +180,7 @@ function ExpandedBody({ projectId, entry, status, keyConnected, canWrite, enable
180
180
  content = (_jsx(AccordionSubRow, { children: entry.hint }));
181
181
  }
182
182
  else if (pooled.pooledSecretsEnabled && pooled.accountId && entry.id === 'openai') {
183
- content = (_jsxs("div", { className: "border-border space-y-3 border-t py-3", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "codex", compact: true }), _jsx("p", { className: "text-foreground text-xs font-medium", children: tPooled('chatGptAccounts') }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: "codex", providerName: "ChatGPT Plus/Pro", envVar: "CODEX_AUTH_JSON", canWrite: true, oauth: { projectId, onConnected: () => undefined } }), _jsx(ChatGptSubscriptionConnect, { projectId: projectId, onConnected: () => undefined, legacyOnly: true, usageSlot: _jsx(LegacyChatGptUsage, { accountId: pooled.accountId, projectId: projectId }) })] }));
183
+ content = (_jsxs("div", { className: "border-border space-y-3 border-t py-3", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "codex", compact: true }), _jsx("p", { className: "text-foreground text-xs font-medium", children: tPooled('chatGptAccounts') }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: "codex", providerName: "ChatGPT Plus/Pro", envVar: "CODEX_AUTH_JSON", canWrite: true, oauth: { projectId, onConnected: () => undefined } }), _jsx(ChatGptSubscriptionConnect, { projectId: projectId, onConnected: () => undefined, legacyOnly: true, usageSlot: _jsx(LegacyChatGptUsage, { accountId: pooled.accountId, projectId: projectId }) }), _jsx("p", { className: "text-foreground pt-3 text-xs font-medium", children: tPooled('providerKeysFor', { provider: entry.label }) }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true })] }));
184
184
  }
185
185
  else if (pooled.pooledSecretsEnabled && pooled.accountId && entry.id === 'anthropic') {
186
186
  // Claude accounts, exactly as OpenAI lists ChatGPT accounts; Anthropic API keys below them.
@@ -282,7 +282,8 @@ export function ProviderAccordion({ projectId, canWrite = false, enabled = true,
282
282
  const singleKey = entry.envVars.length === 1 &&
283
283
  !SUBSCRIPTION_BY_PROVIDER[entry.id] &&
284
284
  !(pooled.pooledSecretsEnabled && supportsPooledProviderKey(entry));
285
- const keyConnected = connectedIds.has(entry.id);
285
+ // A key saved through the form lands in the named store ("Workspace key").
286
+ const keyConnected = connectedIds.has(entry.id) || pooled.pooledProviderIds.has(entry.id);
286
287
  if (addingId === row.id && singleKey && canWrite) {
287
288
  return (_jsx(InlineAddKeyRow, { projectId: projectId, entry: entry, row: row, onDone: () => setAddingId(null) }, row.id));
288
289
  }
@@ -318,7 +319,7 @@ export function ProviderAccordion({ projectId, canWrite = false, enabled = true,
318
319
  event.stopPropagation();
319
320
  setSearchOpen(false);
320
321
  }
321
- } }), _jsx(InputGroupSearchClear, { onClick: () => setSearch('') })] }) })) : null, pooled.pooledSecretsEnabled || !canWrite ? (_jsx("p", { className: "text-muted-foreground px-1 pb-2 text-xs text-pretty", children: pooled.pooledSecretsEnabled ? tPooled('sharedDescription') : t('readOnly') })) : null, empty ? (_jsx(EmptyState, { size: "sm", title: t('noMatch', { query: search.trim() }) })) : (_jsxs(_Fragment, { children: [inUse.length > 0 ? (_jsx(AccordionGroupLabel, { label: `${t('inUse')} · ${inUse.length}`, action: searchOpen ? null : searchButton })) : null, inUse.map(renderRow), visibleAvailable.length > 0 ? (_jsx(AccordionGroupLabel, { label: t('available'), className: inUse.length > 0 ? 'pt-3.5' : undefined, action: inUse.length === 0 && !searchOpen ? searchButton : null })) : null, visibleAvailable.map(renderRow)] })), hiddenCount > 0 ? (_jsxs("div", { className: "flex items-center gap-2 px-1 pt-1", "data-provider-load-more": "", children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: () => setVisibleCount((shown) => shown + PROVIDER_PAGE_SIZE), children: t('showMore') }), _jsx("span", { className: "text-muted-foreground text-xs tabular-nums", children: t('shownOf', {
322
+ } }), _jsx(InputGroupSearchClear, { onClick: () => setSearch('') })] }) })) : null, pooled.pooledSecretsEnabled || !canWrite ? (pooled.pooledSecretsEnabled ? (_jsx(PooledProvidersNote, { projectId: projectId, className: "text-muted-foreground px-1 pb-2 text-xs text-pretty" })) : (_jsx("p", { className: "text-muted-foreground px-1 pb-2 text-xs text-pretty", children: t('readOnly') }))) : null, empty ? (_jsx(EmptyState, { size: "sm", title: t('noMatch', { query: search.trim() }) })) : (_jsxs(_Fragment, { children: [inUse.length > 0 ? (_jsx(AccordionGroupLabel, { label: `${t('inUse')} · ${inUse.length}`, action: searchOpen ? null : searchButton })) : null, inUse.map(renderRow), visibleAvailable.length > 0 ? (_jsx(AccordionGroupLabel, { label: t('available'), className: inUse.length > 0 ? 'pt-3.5' : undefined, action: inUse.length === 0 && !searchOpen ? searchButton : null })) : null, visibleAvailable.map(renderRow)] })), hiddenCount > 0 ? (_jsxs("div", { className: "flex items-center gap-2 px-1 pt-1", "data-provider-load-more": "", children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: () => setVisibleCount((shown) => shown + PROVIDER_PAGE_SIZE), children: t('showMore') }), _jsx("span", { className: "text-muted-foreground text-xs tabular-nums", children: t('shownOf', {
322
323
  shown: inUse.length + visibleAvailable.length,
323
324
  total: inUse.length + available.length,
324
325
  }) })] })) : null] }));
@@ -37,6 +37,7 @@ import { PLATFORM_FEE_PERCENT } from '../../internal/billing/compute-pricing.js'
37
37
  import { FIRST_CLASS_PROVIDER_IDS, PROVIDER_SUBSCRIPTIONS, getProjectDetail, providerConnectMethod, providerConnectedVia, } from '@kortix/sdk';
38
38
  import { qk, useAccountSecretResources, useFeatureFlag, useModelAccess, useProjectModelPickerCatalog, } from '@kortix/sdk/react';
39
39
  import { useQuery } from '@tanstack/react-query';
40
+ import { useCanShareProviderAccounts } from '../sections/view/account-secret-resources-panel.js';
40
41
  import { SUBSCRIPTION_ROW, SubscriptionRowMeter, summarizeSubscriptions, useLiveSubscriptionUsages, useSubscriptionLogins, useSubscriptionRowSummary, } from '../sections/view/subscription-usage.js';
41
42
  export { FIRST_CLASS_PROVIDER_IDS, supportsPooledProviderKey, } from '@kortix/sdk';
42
43
  /** Providers whose sheet offers a subscription sign-in beside the API key. */
@@ -184,6 +185,7 @@ export function ProviderConnect({ projectId, canWrite = false, enabled = true, s
184
185
  const access = useModelAccess(enabled ? projectId : null);
185
186
  const managedProvider = useManagedProvider(enabled ? projectId : null);
186
187
  const pooled = usePooledProviderIds(projectId, enabled);
188
+ const canShare = useCanShareProviderAccounts(projectId);
187
189
  useLiveLlmProviderCatalog(projectId, enabled);
188
190
  const catalogRevision = useLlmProviderCatalogRevision();
189
191
  const { connectedProviders, providerStateLoading } = useConnectedProviders(projectId, enabled);
@@ -259,7 +261,7 @@ export function ProviderConnect({ projectId, canWrite = false, enabled = true, s
259
261
  return (_jsx(ErrorState, { size: "sm", title: tPooled('loadError'), action: _jsx(Button, { size: "sm", variant: "secondary", disabled: pooled.isFetching, onClick: pooled.refetch, children: common('retry') }) }));
260
262
  }
261
263
  return (_jsx(ProviderConnectView, { inUse: inUse, available: visibleAvailable, totalCount: searchable.length, hiddenCount: available.length - visibleAvailable.length, onLoadMore: () => setVisibleCount((shown) => shown + PROVIDER_PAGE_SIZE), search: search, onSearchChange: setSearch, selectedId: selectedId, onSelect: onSelect, note: pooled.pooledSecretsEnabled
262
- ? tPooled('sharedDescription')
264
+ ? tPooled(canShare ? 'sharedDescription' : 'sharedOnlyYouDescription')
263
265
  : canWrite
264
266
  ? undefined
265
267
  : t('readOnly'), className: className }));
@@ -42,7 +42,7 @@ import { ProviderLogoStatus, connectedVia, providerMethod, supportsPooledProvide
42
42
  import { ChatGptSubscriptionConnect, useSubscriptionSignIn, } from '../sections/llm-provider/chatgpt-subscription-connect.js';
43
43
  import { useConnectedProviders } from '../sections/llm-provider/use-connected-providers.js';
44
44
  import { envVarPlaceholder, formatTokenCount, prettyFieldLabel, providerDisconnectPlan, } from '../sections/llm-provider/utils.js';
45
- import { AccountSecretResourcesPanel } from '../sections/view/account-secret-resources-panel.js';
45
+ import { AccountSecretResourcesPanel, useCanShareProviderAccounts } from '../sections/view/account-secret-resources-panel.js';
46
46
  import { LegacyChatGptUsage, SubscriptionUsageSection } from '../sections/view/subscription-usage.js';
47
47
  import { useTranslations } from '../../i18n/index.js';
48
48
  import { LLM_PROVIDER_BY_ID } from '../../internal/lib/llm-providers.js';
@@ -266,6 +266,7 @@ export function ProviderSheet({ projectId, providerId, canWrite, enabled = true,
266
266
  const access = useModelAccess(enabled ? projectId : null);
267
267
  const managed = useManagedProvider(enabled ? projectId : null);
268
268
  const pooled = usePooledProviderIds(projectId, enabled);
269
+ const canShare = useCanShareProviderAccounts(projectId);
269
270
  const { connectedProviders } = useConnectedProviders(projectId, enabled);
270
271
  const entry = providerId === 'kortix' ? managed : LLM_PROVIDER_BY_ID.get(providerId);
271
272
  if (!entry)
@@ -284,17 +285,21 @@ export function ProviderSheet({ projectId, providerId, canWrite, enabled = true,
284
285
  .setEnabled({ target: 'provider', id: entry.id, enabled: next })
285
286
  .catch((error) => errorToast(error instanceof Error ? error.message : tAccess('providerError'))) })) : null;
286
287
  const models = (_jsxs(_Fragment, { children: [status !== 'none' ? accessRow : null, _jsx(ProviderModelsList, { models: entry.models, connected: status !== 'none' })] }));
287
- const bodyProps = { projectId, entry, connected: keyConnected, canWrite, models };
288
+ // A key form writes the named store now (the API files it as a "Workspace
289
+ // key"), so a key saved there counts as this provider's saved key too.
290
+ const bodyProps = {
291
+ projectId, entry, connected: keyConnected || pooled.pooledProviderIds.has(entry.id), canWrite, models,
292
+ };
288
293
  let content;
289
294
  if (method === 'included') {
290
295
  content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_jsx("p", { className: "text-muted-foreground text-sm text-pretty", children: entry.hint }), models] }));
291
296
  }
292
297
  else if (pooled.pooledSecretsEnabled && pooled.accountId && entry.id === 'openai') {
293
- content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "codex" }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('chatGptAccounts') }), _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: tPooled('oauthPrivateDescription') }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: "codex", providerName: "ChatGPT Plus/Pro", envVar: "CODEX_AUTH_JSON", canWrite: true, oauth: { projectId, onConnected: () => undefined } }), _jsx(ChatGptSubscriptionConnect, { projectId: projectId, onConnected: () => undefined, legacyOnly: true, usageSlot: _jsx(LegacyChatGptUsage, { accountId: pooled.accountId, projectId: projectId }) })] }), models] }));
298
+ content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "codex" }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('chatGptAccounts') }), _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: tPooled(canShare ? 'oauthPrivateDescription' : 'oauthOnlyYouDescription') }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: "codex", providerName: "ChatGPT Plus/Pro", envVar: "CODEX_AUTH_JSON", canWrite: true, oauth: { projectId, onConnected: () => undefined } }), _jsx(ChatGptSubscriptionConnect, { projectId: projectId, onConnected: () => undefined, legacyOnly: true, usageSlot: _jsx(LegacyChatGptUsage, { accountId: pooled.accountId, projectId: projectId }) })] }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('providerKeysFor', { provider: entry.label }) }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true })] }), models] }));
294
299
  }
295
300
  else if (pooled.pooledSecretsEnabled && pooled.accountId && entry.id === 'anthropic') {
296
301
  // Claude accounts, exactly as OpenAI lists ChatGPT accounts; Anthropic API keys below them.
297
- content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "claude-agent" }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('claudeAccounts') }), _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: tPooled('claudeOauthPrivateDescription') }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: "claude-agent", providerName: "Claude Pro/Max", envVar: "CLAUDE_CODE_OAUTH_TOKEN", canWrite: true, oauth: { projectId, onConnected: () => undefined, kind: 'claude' } })] }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('providerKeysFor', { provider: entry.label }) }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true })] }), models] }));
302
+ content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_jsx(SubscriptionUsageSection, { accountId: pooled.accountId, projectId: projectId, providerId: "claude-agent" }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('claudeAccounts') }), _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: tPooled(canShare ? 'claudeOauthPrivateDescription' : 'claudeOauthOnlyYouDescription') }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: "claude-agent", providerName: "Claude Pro/Max", envVar: "CLAUDE_CODE_OAUTH_TOKEN", canWrite: true, oauth: { projectId, onConnected: () => undefined, kind: 'claude' } })] }), _jsxs("div", { className: "space-y-3", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: tPooled('providerKeysFor', { provider: entry.label }) }), _jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true })] }), models] }));
298
303
  }
299
304
  else if (pooled.pooledSecretsEnabled && pooled.accountId && supportsPooledProviderKey(entry)) {
300
305
  content = (_jsxs(SplitSheetBody, { className: "space-y-7", children: [_jsx(AccountSecretResourcesPanel, { accountId: pooled.accountId, projectId: projectId, providerId: entry.id, providerName: entry.label, envVar: entry.envVars[0], canWrite: true }), models] }));
@@ -92,6 +92,8 @@ export function EmailConnectForm({ projectId, account, onConnected, }) {
92
92
  const managedAvailable = mode.data?.managed_available === true;
93
93
  // An older server omits it; the address preview then shows "…".
94
94
  const managedDomain = mode.data?.managed_domain || '…';
95
+ // Outside prod the server ends a managed address in `.<env>` (`agent.dev@`).
96
+ const managedSuffix = mode.data?.managed_suffix ?? '';
95
97
  const [homeChoice, setHome] = useState(null);
96
98
  // Until the user picks, the home follows what the deployment offers.
97
99
  const home = managedAvailable ? (homeChoice ?? 'own') : 'own';
@@ -128,7 +130,7 @@ export function EmailConnectForm({ projectId, account, onConnected, }) {
128
130
  const domain = domainChoice || ownDomains.find((d) => d.verified)?.domain || ownDomains[0]?.domain || (key ? ADD_DOMAIN : '');
129
131
  const selected = home === 'own' ? ownDomains.find((d) => d.domain === domain) : undefined;
130
132
  const addressDomain = home === 'managed' ? managedDomain : !domain || domain === ADD_DOMAIN ? '…' : domain;
131
- const address = `${username || 'agent'}@${addressDomain}`;
133
+ const address = `${username || 'agent'}${home === 'managed' ? managedSuffix : ''}@${addressDomain}`;
132
134
  const domainReady = home === 'managed' || (Boolean(domain) && domain !== ADD_DOMAIN && selected?.verified !== false);
133
135
  const submit = () => {
134
136
  setError(null);
@@ -155,7 +157,7 @@ export function EmailConnectForm({ projectId, account, onConnected, }) {
155
157
  sender_policy: policy,
156
158
  }, { onSuccess: onConnected, onError: (e) => setError(e.message) });
157
159
  };
158
- return (_jsxs("div", { className: "space-y-6", children: [_jsxs("section", { className: "space-y-3", children: [_jsx("h3", { className: "text-foreground text-sm font-medium", children: managedAvailable ? t('homeTitle') : t('homeOwn') }), managedAvailable ? (_jsxs(RadioGroup, { value: home, onValueChange: (v) => setHome(v), className: "grid gap-2 sm:grid-cols-2", children: [_jsx(RadioGroupItem, { value: "own", variant: "outline", label: t('homeOwn'), description: t('homeOwnHint') }), _jsx(RadioGroupItem, { value: "managed", variant: "outline", label: t('homeManaged'), description: t('homeManagedHint', { domain: managedDomain }) })] })) : null, home === 'own' ? (_jsxs("p", { className: "text-muted-foreground text-sm text-pretty", children: [t('ownNeeds'), ' ', _jsx(Link, { href: RESEND_LINKS.apiKeys, target: "_blank", rel: "noopener noreferrer", className: "text-foreground underline underline-offset-2", children: t('linkApiKeys') }), ' · ', _jsx(Link, { href: RESEND_LINKS.receiving, target: "_blank", rel: "noopener noreferrer", className: "text-foreground underline underline-offset-2", children: t('linkReceiving') }), ' · ', _jsx(Link, { href: RESEND_LINKS.inboxes, target: "_blank", rel: "noopener noreferrer", className: "text-foreground underline underline-offset-2", children: t('linkInboxes') })] })) : null, home === 'own' ? (_jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: "email-connect-key", children: t('keyLabel') }), _jsx(Input, { id: "email-connect-key", type: "password", value: apiKey, onChange: (e) => setApiKey(e.target.value), placeholder: "re_\u2026", autoComplete: "off", spellCheck: false }), _jsx(FieldDescription, { children: listDomains.isPending ? t('keyChecking') : listDomains.isError ? (_jsx("span", { className: "text-destructive", children: listDomains.error.message })) : listDomains.data && key ? (t('keyOk', { count: listDomains.data.domains.length })) : (t('keyHint')) })] })) : null] }), !attachOpen ? (_jsxs("section", { className: "space-y-3", children: [_jsx("h3", { className: "text-foreground text-sm font-medium", children: t('addressTitle') }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { "aria-label": t('usernameLabel'), value: username, onChange: (e) => setUsername(e.target.value.toLowerCase().replace(/[^a-z0-9._-]/g, '')), placeholder: "support", autoComplete: "off", spellCheck: false, className: "min-w-0 flex-1" }), _jsx("span", { className: "text-muted-foreground text-sm", children: "@" }), home === 'managed' ? (_jsx("span", { className: "bg-muted text-foreground flex h-9 min-w-0 flex-1 items-center rounded-md px-3 text-sm", children: _jsx("span", { className: "truncate", children: managedDomain }) })) : (_jsxs(Select, { value: domain, onValueChange: setDomain, children: [_jsx(SelectTrigger, { "aria-label": t('domainLabel'), className: "min-w-0 flex-1", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [ownDomains.map((d) => (_jsx(SelectItem, { value: d.domain, children: _jsxs("span", { className: "flex items-center gap-2", children: [d.domain, d.verified ? null : _jsx(Badge, { variant: "secondary", children: t('domainPending') })] }) }, d.domain))), _jsx(SelectSeparator, {}), _jsx(SelectItem, { value: ADD_DOMAIN, disabled: !key, children: t('domainAdd') })] })] }))] }), _jsxs("p", { className: "text-muted-foreground flex items-center gap-1.5 text-xs", children: [_jsx(EnvelopeSimpleIcon, { className: "size-3.5 shrink-0" }), _jsxs("span", { className: "truncate", children: [displayName.trim() || 'Kortix Agent', " <", address, ">"] })] }), home === 'own' && domain === ADD_DOMAIN ? (_jsx(AddDomain, { projectId: projectId, apiKey: key, onAdded: (result) => {
160
+ return (_jsxs("div", { className: "space-y-6", children: [_jsxs("section", { className: "space-y-3", children: [_jsx("h3", { className: "text-foreground text-sm font-medium", children: managedAvailable ? t('homeTitle') : t('homeOwn') }), managedAvailable ? (_jsxs(RadioGroup, { value: home, onValueChange: (v) => setHome(v), className: "grid gap-2 sm:grid-cols-2", children: [_jsx(RadioGroupItem, { value: "own", variant: "outline", label: t('homeOwn'), description: t('homeOwnHint') }), _jsx(RadioGroupItem, { value: "managed", variant: "outline", label: t('homeManaged'), description: t('homeManagedHint', { domain: managedDomain }) })] })) : null, home === 'own' ? (_jsxs("p", { className: "text-muted-foreground text-sm text-pretty", children: [t('ownNeeds'), ' ', _jsx(Link, { href: RESEND_LINKS.apiKeys, target: "_blank", rel: "noopener noreferrer", className: "text-foreground underline underline-offset-2", children: t('linkApiKeys') }), ' · ', _jsx(Link, { href: RESEND_LINKS.receiving, target: "_blank", rel: "noopener noreferrer", className: "text-foreground underline underline-offset-2", children: t('linkReceiving') }), ' · ', _jsx(Link, { href: RESEND_LINKS.inboxes, target: "_blank", rel: "noopener noreferrer", className: "text-foreground underline underline-offset-2", children: t('linkInboxes') })] })) : null, home === 'own' ? (_jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: "email-connect-key", children: t('keyLabel') }), _jsx(Input, { id: "email-connect-key", type: "password", value: apiKey, onChange: (e) => setApiKey(e.target.value), placeholder: "re_\u2026", autoComplete: "off", spellCheck: false }), _jsx(FieldDescription, { children: listDomains.isPending ? t('keyChecking') : listDomains.isError ? (_jsx("span", { className: "text-destructive", children: listDomains.error.message })) : listDomains.data && key ? (t('keyOk', { count: listDomains.data.domains.length })) : (t('keyHint')) })] })) : null] }), !attachOpen ? (_jsxs("section", { className: "space-y-3", children: [_jsx("h3", { className: "text-foreground text-sm font-medium", children: t('addressTitle') }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { "aria-label": t('usernameLabel'), value: username, onChange: (e) => setUsername(e.target.value.toLowerCase().replace(/[^a-z0-9._-]/g, '')), placeholder: "orders", autoComplete: "off", spellCheck: false, className: "min-w-0 flex-1" }), home === 'managed' && managedSuffix ? (_jsx("span", { className: "text-muted-foreground text-sm", children: managedSuffix })) : null, _jsx("span", { className: "text-muted-foreground text-sm", children: "@" }), home === 'managed' ? (_jsx("span", { className: "bg-muted text-foreground flex h-9 min-w-0 flex-1 items-center rounded-md px-3 text-sm", children: _jsx("span", { className: "truncate", children: managedDomain }) })) : (_jsxs(Select, { value: domain, onValueChange: setDomain, children: [_jsx(SelectTrigger, { "aria-label": t('domainLabel'), className: "min-w-0 flex-1", children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [ownDomains.map((d) => (_jsx(SelectItem, { value: d.domain, children: _jsxs("span", { className: "flex items-center gap-2", children: [d.domain, d.verified ? null : _jsx(Badge, { variant: "secondary", children: t('domainPending') })] }) }, d.domain))), _jsx(SelectSeparator, {}), _jsx(SelectItem, { value: ADD_DOMAIN, disabled: !key, children: t('domainAdd') })] })] }))] }), _jsxs("p", { className: "text-muted-foreground flex items-center gap-1.5 text-xs", children: [_jsx(EnvelopeSimpleIcon, { className: "size-3.5 shrink-0" }), _jsxs("span", { className: "truncate", children: [displayName.trim() || 'Kortix Agent', " <", address, ">"] })] }), home === 'own' && domain === ADD_DOMAIN ? (_jsx(AddDomain, { projectId: projectId, apiKey: key, onAdded: (result) => {
159
161
  setAdded((list) => [...list.filter((d) => d.domain !== result.domain.domain), result.domain]);
160
162
  setDomain(result.domain.domain);
161
163
  } })) : null, home === 'own' && selected && !selected.verified ? (_jsx(DomainRecords, { projectId: projectId, apiKey: key, domain: selected, onChecked: (result) => setAdded((list) => [...list.filter((d) => d.domain !== result.domain.domain), result.domain]) })) : null, _jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: "email-connect-name", children: t('displayNameLabel') }), _jsx(Input, { id: "email-connect-name", value: displayName, onChange: (e) => setDisplayName(e.target.value), placeholder: "Kortix Agent" })] })] })) : null, _jsxs("section", { className: "space-y-3", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-foreground text-sm font-medium", children: t('sendersTitle') }), _jsx("p", { className: "text-muted-foreground mt-1 text-xs", children: t('sendersHint') })] }), _jsxs(RadioGroup, { value: senders, onValueChange: (v) => setSenders(v), children: [viewerEmail ? _jsx(RadioGroupItem, { value: "me", label: t('sendersMe', { email: viewerEmail }) }) : null, teamDomain ? _jsx(RadioGroupItem, { value: "team", label: t('sendersTeam', { domain: teamDomain }) }) : null, _jsx(RadioGroupItem, { value: "custom", label: t('sendersCustom') }), _jsx(RadioGroupItem, { value: "anyone", label: t('sendersAnyone'), description: t('sendersAnyoneHint') })] }), senders === 'custom' ? (_jsx(Textarea, { "aria-label": t('sendersCustom'), value: customList, onChange: (e) => setCustomList(e.target.value), placeholder: t('sendersCustomPlaceholder'), rows: 3, spellCheck: false })) : null] }), _jsxs("section", { className: "space-y-3", children: [_jsx(Button, { type: "button", variant: "text", size: "sm", className: "px-0", onClick: () => setAttachOpen((open) => !open), children: attachOpen ? t('attachClose') : t('attachOpen') }), attachOpen ? (_jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [_jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: "email-connect-inbox-email", children: t('attachEmail') }), _jsx(Input, { id: "email-connect-inbox-email", value: inboxEmail, onChange: (e) => setInboxEmail(e.target.value.trim().toLowerCase()), placeholder: "support@example.com", autoComplete: "off", spellCheck: false })] }), _jsxs(Field, { children: [_jsx(FieldLabel, { htmlFor: "email-connect-inbox-id", children: t('attachId') }), _jsx(Input, { id: "email-connect-inbox-id", value: inboxId, onChange: (e) => setInboxId(e.target.value.trim()), autoComplete: "off", spellCheck: false })] }), _jsx("p", { className: "text-muted-foreground text-xs sm:col-span-2", children: t('attachHint') })] })) : null] }), error ? _jsx(BannerAlert, { variant: "destructive", children: _jsx(BannerAlertDescription, { children: error }) }) : null, _jsx("div", { className: "flex justify-end", children: _jsxs(Button, { onClick: submit, disabled: connect.isPending || mode.isLoading || (!attachOpen && !domainReady), children: [connect.isPending ? _jsx(Loading, { className: "size-3.5 shrink-0" }) : null, attachOpen ? t('submitAttach') : t('submitCreate', { address })] }) })] }));
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import { type AdminConnector, type Connection } from '@kortix/sdk';
3
- export declare function ConnectionsList({ projectId, connector, displayName, canManageConnections, onChanged, onStartSession, onSetCredential, onConnect, titleAddon, addVariant, addRequest, onAddRequestHandled, disabled, }: {
3
+ export declare function ConnectionsList({ projectId, connector, displayName, canManageConnections, onChanged, onStartSession, onSetCredential, onConnect, signsIn, titleAddon, addVariant, addRequest, onAddRequestHandled, disabled, }: {
4
4
  projectId: string;
5
5
  connector: AdminConnector;
6
6
  displayName: string;
@@ -19,6 +19,9 @@ export declare function ConnectionsList({ projectId, connector, displayName, can
19
19
  }) => void;
20
20
  /** Sign an unsigned account in. Omitted = no Connect on the rows. */
21
21
  onConnect?: (connection: Connection) => void;
22
+ /** An MCP server with one-click OAuth: rows say "Sign in". A managed
23
+ * provider always does. */
24
+ signsIn?: boolean;
22
25
  /** Bumped to open "Add account" from outside the list (a header button,
23
26
  * or the connector page right after Install). */
24
27
  addRequest?: number;
@@ -37,7 +37,7 @@ import { emptyProjectSlot, useAddAccount } from '../../internal/hooks/connectors
37
37
  import { useDeleteTunnelConnection } from '@kortix/sdk/react';
38
38
  import { useCopy } from '../../internal/hooks/use-copy.js';
39
39
  import { cn } from '../../internal/lib/utils.js';
40
- import { createConnector, discoverConnectionOAuth2, discoverConnectionOAuth2Resource, discoverConnectorAuth, ensureProjectConnectorConnection, getConnectorConfig, getProjectDetail, listAllConnections, listConnections, listProjectAccess, putConnectionOAuth2Application, reconcileMemberConnection, renameConnection, revokeConnection, setConnectorCredential, setDefaultConnection, startConnectionOAuth2Authorization, startConnectionOAuth2DeviceAuthorization, updateConnectionCredential, waitForConnectionOAuth2, } from '@kortix/sdk';
40
+ import { connectionSignInSteps, connectorAccountSignInStarted, createConnector, discoverConnectionOAuth2, discoverConnectionOAuth2Resource, discoverConnectorAuth, ensureProjectConnectorConnection, getConnectorConfig, getProjectDetail, listAllConnections, listConnections, listProjectAccess, putConnectionOAuth2Application, reconcileMemberConnection, renameConnection, revokeConnection, setConnectorCredential, setDefaultConnection, startConnectionOAuth2Authorization, startConnectionOAuth2DeviceAuthorization, updateConnectionCredential, waitForConnectionOAuth2, } from '@kortix/sdk';
41
41
  import { contract, qk, useFeatureFlag, useProjectAccountId } from '@kortix/sdk/react';
42
42
  import { AddAccountFields } from './add-account-fields.js';
43
43
  import { useEmailInboxes, useRemoveEmailInbox, } from '../../internal/hooks/channels/use-email-inboxes.js';
@@ -62,11 +62,14 @@ function CodeSnippet({ code, language, className, }) {
62
62
  return (_jsx("div", { className: cn('border-border/60 bg-card flex w-full overflow-x-auto rounded-md border', className), children: _jsx("div", { className: "p-3 [&_code]:text-xs", children: _jsx(HighlightedCode, { code: code, language: language }) }) }));
63
63
  }
64
64
  /** One row in the connections list — a single connected account. */
65
- function ConnectionRow({ connection, viewerId, isMine, canManage, onSetDefault, onDisconnect, onRename, onStartSession, onSetCredential, onShare, onConnect, needsSignIn, pending, disabled = false, meta, menuItems, }) {
65
+ function ConnectionRow({ connection, viewerId, isMine, canManage, onSetDefault, onDisconnect, onRename, onStartSession, onSetCredential, onShare, onConnect, needsSignIn, signsIn = false, pending, disabled = false, meta, menuItems, }) {
66
66
  const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
67
67
  const tSharing = useTranslations('accessSharing');
68
68
  const tComputers = useTranslations('computers');
69
69
  const tConnectorPages = useTranslations('connectorPages');
70
+ const tSignIn = useTranslations('connectSignIn');
71
+ // A sign-in someone started (an agent's link) and nobody finished.
72
+ const signInStarted = needsSignIn && connectorAccountSignInStarted(connection);
70
73
  const isProjectAuthorization = connection.owner_type === 'project';
71
74
  const active = connection.status === 'active';
72
75
  // Only the owner of a connection may change it: your own personal connection,
@@ -75,9 +78,13 @@ function ConnectionRow({ connection, viewerId, isMine, canManage, onSetDefault,
75
78
  const visibility = accountVisibility(connection, viewerId);
76
79
  const everyoneWithAccess = (connection.shared_with ?? []).map((share) => share.label);
77
80
  const { copy } = useCopy({ successMessage: tI18nComplete.raw('text56ee71f3ece0') });
78
- return (_jsxs("li", { className: "flex items-center gap-3 px-4 py-3", children: [_jsx("span", { "aria-hidden": true, className: "bg-muted text-muted-foreground flex size-8 shrink-0 items-center justify-center rounded-md", children: visibility.kind === 'you' ? (_jsx(Lock, { className: "size-4" })) : visibility.kind === 'everyone' ? (_jsx(UsersThree, { className: "size-4" })) : (_jsx(Users, { className: "size-4" })) }), _jsxs("div", { className: "min-w-0 flex-1 space-y-0.5", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx("span", { className: "truncate text-sm font-medium", children: connection.label }), connection.is_default && (_jsx(Badge, { variant: "secondary", size: "xs", children: tI18nComplete.raw('text21b111cbfe6e') }))] }), _jsxs(InlineMeta, { children: [_jsx(AudienceText, { visibility: visibility, labels: everyoneWithAccess }), meta, connection.usable === false ? tSharing('notSharedWithYou') : null, active && needsSignIn ? (_jsx("span", { children: tConnectorPages('notSignedIn') })) : null, active && connection.metadata?.credential_rejected_at ? (_jsx("span", { className: "text-destructive", children: tConnectorPages('credentialRejected') })) : null, active ? null : (_jsx("span", { className: "text-destructive", children: connection.status === 'revoked' ? 'Disconnected' : 'Error' })), active && connection.machine ? (_jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx(ComputerStateDot, { state: connection.machine.online ? 'online' : 'offline' }), tComputers(connection.machine.online ? 'online' : 'offline')] })) : null, connection.connected_as && connection.connected_as !== connection.label
81
+ return (_jsxs("li", { className: "flex items-center gap-3 px-4 py-3", children: [_jsx("span", { "aria-hidden": true, className: "bg-muted text-muted-foreground flex size-8 shrink-0 items-center justify-center rounded-md", children: visibility.kind === 'you' ? (_jsx(Lock, { className: "size-4" })) : visibility.kind === 'everyone' ? (_jsx(UsersThree, { className: "size-4" })) : (_jsx(Users, { className: "size-4" })) }), _jsxs("div", { className: "min-w-0 flex-1 space-y-0.5", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx("span", { className: "truncate text-sm font-medium", children: connection.label }), connection.is_default && (_jsx(Badge, { variant: "secondary", size: "xs", children: tI18nComplete.raw('text21b111cbfe6e') }))] }), _jsxs(InlineMeta, { children: [_jsx(AudienceText, { visibility: visibility, labels: everyoneWithAccess }), meta, connection.usable === false ? tSharing('notSharedWithYou') : null, active && needsSignIn ? (_jsx("span", { children: signInStarted ? tSignIn('signInUnfinished') : tConnectorPages('notSignedIn') })) : null, active && connection.metadata?.credential_rejected_at ? (_jsx("span", { className: "text-destructive", children: tConnectorPages('credentialRejected') })) : null, active ? null : (_jsx("span", { className: "text-destructive", children: connection.status === 'revoked' ? 'Disconnected' : 'Error' })), active && connection.machine ? (_jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx(ComputerStateDot, { state: connection.machine.online ? 'online' : 'offline' }), tComputers(connection.machine.online ? 'online' : 'offline')] })) : null, connection.connected_as && connection.connected_as !== connection.label
79
82
  ? tI18nComplete('texte9e0b20cf289', { value0: connection.connected_as })
80
- : null] })] }), onConnect && mayMutate && needsSignIn ? (_jsx(Button, { size: "sm", className: "shrink-0", onClick: onConnect, disabled: pending || disabled, children: tConnectorPages('connectAccount') })) : null, _jsxs(ButtonGroup, { className: "shrink-0", children: [onShare && mayMutate ? (
83
+ : null] })] }), onConnect && mayMutate && needsSignIn ? (_jsx(Button, { size: "sm", className: "shrink-0", onClick: onConnect, disabled: pending || disabled, children: signInStarted
84
+ ? tSignIn('finishSignIn')
85
+ : signsIn
86
+ ? tConnectorPages('noticeSignInAction')
87
+ : tConnectorPages('connectAccount') })) : null, _jsxs(ButtonGroup, { className: "shrink-0", children: [onShare && mayMutate ? (
81
88
  // Your own private account is shared by turning it into a shared one,
82
89
  // which needs the same right as creating a shared account.
83
90
  isProjectAuthorization || canManage ? (_jsxs(Button, { variant: "secondary", size: "sm", className: "shrink-0 gap-1.5", onClick: onShare, disabled: pending || disabled, "aria-label": tSharing('shareTitle', { label: connection.label }), children: [_jsx(ShareNetworkIcon, { className: "size-3.5 shrink-0" }), tI18nComplete.raw('text29887a5ff984')] })) : (_jsx(Hint, { label: tSharing('shareRequiresManage'), children: _jsx("span", { className: "inline-flex shrink-0", children: _jsxs(Button, { variant: "secondary", size: "sm", className: "gap-1.5", disabled: true, "aria-label": tSharing('shareTitle', { label: connection.label }), children: [_jsx(ShareNetworkIcon, { className: "size-3.5 shrink-0" }), tI18nComplete.raw('text29887a5ff984')] }) }) }))) : null, _jsx(ButtonGroupSeparator, { className: "bg-border" }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "secondary", size: "icon", className: "size-8 shrink-0", "aria-label": tI18nComplete('text33da220b1a34', { value0: connection.label }), disabled: pending || disabled, children: pending ? (_jsx(Loading, { className: "size-4 shrink-0" })) : (_jsx(DotsThreeIcon, { className: "size-4" })) }) }), _jsxs(DropdownMenuContent, { align: "end", className: "min-w-48", children: [_jsx(DropdownMenuItem, { onClick: () => copy(connection.connection_id), children: tI18nComplete.raw('text99775327d988') }), mayMutate && (_jsx(DropdownMenuItem, { onClick: onRename, children: tI18nComplete.raw('text3064d79a295c') })), mayMutate && isMine && active && onStartSession && (_jsx(DropdownMenuItem, { onClick: onStartSession, children: tI18nComplete.raw('textfae237eed0c5') })), mayMutate && onSetCredential && (_jsx(DropdownMenuItem, { onClick: onSetCredential, children: tI18nComplete.raw('text3d6627454174') })), mayMutate && !connection.is_default && active && (_jsxs(DropdownMenuItem, { onClick: onSetDefault, children: [tI18nComplete.raw('texta92f66fd3d83'), isProjectAuthorization ? ` ${tI18nComplete.raw('text801a345cd406')}` : ''] })), mayMutate ? menuItems : null, mayMutate && (_jsx(DropdownMenuItem, { onClick: onDisconnect, children: tI18nComplete.raw('textacfc5be785a9') }))] })] })] })] }));
@@ -102,7 +109,7 @@ const EMPTY_NEW_ACCOUNT = {
102
109
  audience: 'private',
103
110
  picked: { memberIds: [], groupIds: [] },
104
111
  };
105
- export function ConnectionsList({ projectId, connector, displayName, canManageConnections, onChanged, onStartSession, onSetCredential, onConnect, titleAddon, addVariant = 'secondary', addRequest = 0, onAddRequestHandled, disabled = false, }) {
112
+ export function ConnectionsList({ projectId, connector, displayName, canManageConnections, onChanged, onStartSession, onSetCredential, onConnect, signsIn = false, titleAddon, addVariant = 'secondary', addRequest = 0, onAddRequestHandled, disabled = false, }) {
106
113
  const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
107
114
  const tSharing = useTranslations('accessSharing');
108
115
  const tComputers = useTranslations('computers');
@@ -163,6 +170,32 @@ export function ConnectionsList({ projectId, connector, displayName, canManageCo
163
170
  // An inbox account always has an inbox behind it: there is no empty slot.
164
171
  const slot = isEmail ? null : emptyProjectSlot(connector, allRows);
165
172
  const rows = slot ? allRows.filter((row) => row !== slot) : allRows;
173
+ // A managed account whose sign-in started and never finished may be done at
174
+ // the provider (the person used an agent's link outside Kortix). Ask once
175
+ // per account when the list shows it; a finished one is recorded and the
176
+ // row turns signed in without a click.
177
+ const unfinishedIds = isManagedConnectorProvider(connector.provider)
178
+ ? rows
179
+ .filter((row) => row.status === 'active' && row.authorized === false && connectorAccountSignInStarted(row))
180
+ .map((row) => row.connection_id)
181
+ .sort()
182
+ : [];
183
+ useQuery({
184
+ queryKey: ['connection-sign-in-check', projectId, connector.slug, unfinishedIds],
185
+ enabled: unfinishedIds.length > 0,
186
+ staleTime: Infinity,
187
+ retry: false,
188
+ queryFn: async () => {
189
+ const results = await Promise.allSettled(unfinishedIds.map((connectionId) => {
190
+ const row = rows.find((candidate) => candidate.connection_id === connectionId);
191
+ return connectionSignInSteps(projectId, connector.slug, row).finalize();
192
+ }));
193
+ const recorded = results.some((result) => result.status === 'fulfilled' && result.value.connected);
194
+ if (recorded)
195
+ refresh();
196
+ return recorded;
197
+ },
198
+ });
166
199
  const openCredential = onSetCredential ?? setCredentialTarget;
167
200
  // "Add account" asks the account's name and who may use it: only you,
168
201
  // everyone in the project, or picked people and groups. The connector
@@ -194,7 +227,9 @@ export function ConnectionsList({ projectId, connector, displayName, canManageCo
194
227
  setEmailOpen(true);
195
228
  return;
196
229
  }
197
- setDraft({ ...EMPTY_NEW_ACCOUNT, label: addAccount.proposedLabel() });
230
+ // "Everyone in this workspace" for a person who may share, as model keys
231
+ // default: a trigger runs only on a shared account. "Only you" otherwise.
232
+ setDraft({ ...EMPTY_NEW_ACCOUNT, audience: canManageConnections ? 'project' : 'private', label: addAccount.proposedLabel() });
198
233
  setLabelEdited(false);
199
234
  setAddOpen(true);
200
235
  };
@@ -284,7 +319,7 @@ export function ConnectionsList({ projectId, connector, displayName, canManageCo
284
319
  inbox.email !== connection.label ? _jsx("span", { children: inbox.email }, "address") : null,
285
320
  _jsx(EmailInboxHome, { inbox: inbox }, "home"),
286
321
  ]
287
- : undefined, menuItems: inbox ? (_jsx(DropdownMenuItem, { onClick: () => setPolicyInbox(inbox), children: tInboxes('policyMenu') })) : undefined, viewerId: viewerId, isMine: connection.owner_type === 'member', canManage: canManageConnections, pending: pendingConnectionId === connection.connection_id, disabled: disabled, onSetDefault: () => setDefault.mutate(connection.connection_id), onDisconnect: () => setConfirmDisconnect(connection), onRename: () => openRename(connection), onStartSession: onStartSession ? () => onStartSession(connection) : undefined, onSetCredential: setCredential ? () => setCredential(connection) : undefined, onConnect: onConnect ? () => onConnect(connection) : undefined, needsSignIn: !isEmail && accountNeedsSignIn(connection, connector), onShare: accountId
322
+ : undefined, menuItems: inbox ? (_jsx(DropdownMenuItem, { onClick: () => setPolicyInbox(inbox), children: tInboxes('policyMenu') })) : undefined, viewerId: viewerId, isMine: connection.owner_type === 'member', canManage: canManageConnections, pending: pendingConnectionId === connection.connection_id, disabled: disabled, onSetDefault: () => setDefault.mutate(connection.connection_id), onDisconnect: () => setConfirmDisconnect(connection), onRename: () => openRename(connection), onStartSession: onStartSession ? () => onStartSession(connection) : undefined, onSetCredential: setCredential ? () => setCredential(connection) : undefined, onConnect: onConnect ? () => onConnect(connection) : undefined, needsSignIn: !isEmail && accountNeedsSignIn(connection, connector), signsIn: signsIn || isManagedConnectorProvider(connector.provider), onShare: accountId
288
323
  ? () => {
289
324
  setShareTarget(connection);
290
325
  setShareOpen(true);
@@ -135,7 +135,7 @@ export declare function ProjectDefaultPicker({ projectId }: {
135
135
  * character.
136
136
  *
137
137
  * One section at a time, by the caller's state — NOT seven `TabsContent`
138
- * panels. Radix keeps every panel in the tree and each one used to open its
138
+ * panels. `Tabs` keeps every panel element in the tree and each one used to open its
139
139
  * own `overflow-y-auto`, which is how this page ended up with three nested
140
140
  * scroll containers under a shell that already had one.
141
141
  *