@kortix/ui 0.15.9 → 0.15.11

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 (202) hide show
  1. package/dist/_vendor/kortix-shared.js +467 -2
  2. package/dist/_vendor/shared/app-config.d.ts +6 -30
  3. package/dist/_vendor/shared/channel-descriptors.d.ts +0 -34
  4. package/dist/_vendor/shared/channel-header.d.ts +2 -1
  5. package/dist/_vendor/shared/connector-sections.d.ts +0 -25
  6. package/dist/_vendor/shared/file-tags.d.ts +2 -1
  7. package/dist/_vendor/shared/index.d.ts +1 -0
  8. package/dist/_vendor/shared/pasted-content.d.ts +0 -4
  9. package/dist/_vendor/shared/pixel-mark.d.ts +0 -17
  10. package/dist/_vendor/shared/project-glyphs.d.ts +0 -1
  11. package/dist/_vendor/shared/session/attachment-tile.d.ts +32 -0
  12. package/dist/_vendor/shared/session/stop-refusal.d.ts +15 -0
  13. package/dist/_vendor/shared/session/tool-row-text.d.ts +58 -0
  14. package/dist/_vendor/shared/session-delivery.d.ts +2 -0
  15. package/dist/customize/agents/agent-model-view.d.ts +11 -1
  16. package/dist/customize/agents/agent-model-view.js +12 -1
  17. package/dist/customize/agents/agent-page.js +19 -6
  18. package/dist/customize/agents/agent-tabs.d.ts +2 -0
  19. package/dist/customize/agents/agent-tabs.js +2 -0
  20. package/dist/customize/connectors/connectors-page.js +1 -1
  21. package/dist/customize/connectors/detail/connector-page.js +9 -4
  22. package/dist/customize/connectors/detail/connector-triggers.js +1 -1
  23. package/dist/customize/connectors/install/use-install.js +1 -1
  24. package/dist/customize/connectors/use-agent-access.d.ts +1 -0
  25. package/dist/customize/providers/provider-accordion.js +5 -5
  26. package/dist/customize/providers/provider-connect.d.ts +3 -3
  27. package/dist/customize/providers/provider-connect.js +8 -16
  28. package/dist/customize/providers/provider-sheet.js +4 -4
  29. package/dist/customize/sections/component/teams-byo-wizard.js +4 -1
  30. package/dist/customize/sections/connector-connection-form.d.ts +0 -1
  31. package/dist/customize/sections/connector-connection-form.js +0 -9
  32. package/dist/customize/sections/view/review-center-connected.js +7 -3
  33. package/dist/customize/settings/tabs/workspace-keys.js +53 -11
  34. package/dist/customize/shared/feature-gate-screen.js +1 -1
  35. package/dist/customize/triggers/runtime-triggers.js +13 -2
  36. package/dist/customize/triggers/schedule/event-account-picker.js +1 -1
  37. package/dist/customize/triggers/schedule/event-trigger-copy.js +1 -1
  38. package/dist/customize/triggers/schedule/schedule-detail-sheet.js +5 -4
  39. package/dist/customize/triggers/schedule/then-fields.d.ts +5 -1
  40. package/dist/customize/triggers/schedule/then-fields.js +23 -3
  41. package/dist/customize/triggers/schedule/trigger-callouts.js +1 -1
  42. package/dist/customize/triggers/schedule/trigger-composer-logic.d.ts +27 -0
  43. package/dist/customize/triggers/schedule/trigger-composer-logic.js +51 -5
  44. package/dist/customize/triggers/schedule/trigger-composer.js +19 -13
  45. package/dist/customize/triggers/schedule/trigger-edit-logic.js +25 -5
  46. package/dist/customize/triggers/schedule/trigger-filter.d.ts +10 -3
  47. package/dist/customize/triggers/schedule/trigger-filter.js +7 -6
  48. package/dist/customize/triggers/schedule/trigger-readonly.js +1 -1
  49. package/dist/customize/triggers/schedule/trigger-runs-panel.js +1 -1
  50. package/dist/customize/triggers/schedule/use-event-app-connect.js +2 -1
  51. package/dist/customize/triggers/schedule/when-event.js +1 -1
  52. package/dist/customize/triggers/schedule/when-schedule.d.ts +5 -1
  53. package/dist/customize/triggers/schedule/when-schedule.js +16 -1
  54. package/dist/customize/triggers/schedule-view.js +4 -2
  55. package/dist/i18n/en.d.ts +56 -7
  56. package/dist/i18n/en.js +65 -16
  57. package/dist/internal/billing/compute-pricing.d.ts +7 -1
  58. package/dist/internal/billing/compute-pricing.js +7 -1
  59. package/dist/internal/hooks/connectors/invalidate-connections.d.ts +10 -0
  60. package/dist/internal/hooks/connectors/invalidate-connections.js +18 -0
  61. package/dist/internal/hooks/connectors/use-finish-sign-in.js +1 -1
  62. package/dist/internal/hooks/connectors/use-pipedream-connect-member.js +1 -1
  63. package/dist/internal/hooks/connectors/use-pipedream-connect-project.js +1 -1
  64. package/dist/internal/hooks/projects/use-new-project-session.d.ts +2 -0
  65. package/dist/internal/hooks/projects/use-new-project-session.js +4 -1
  66. package/dist/internal/hooks/use-review-session-summary.d.ts +1 -1
  67. package/dist/internal/hooks/use-review-session-summary.js +1 -1
  68. package/dist/internal/layout/project-settings-nav.d.ts +17 -0
  69. package/dist/internal/layout/project-settings-nav.js +24 -0
  70. package/dist/internal/lib/browser-noise/rules/injected-scripts.js +2 -2
  71. package/dist/internal/lib/capability-tab-routes.d.ts +8 -0
  72. package/dist/internal/lib/capability-tab-routes.js +11 -0
  73. package/dist/internal/notifications/notification-inbox.d.ts +4 -10
  74. package/dist/internal/notifications/notification-inbox.js +8 -9
  75. package/dist/internal/stores/composer-prefill-store.d.ts +7 -0
  76. package/dist/internal/stores/composer-prefill-store.js +1 -0
  77. package/dist/internal/stores/connector-gate-store.d.ts +3 -1
  78. package/dist/internal/stores/connector-gate-store.js +13 -3
  79. package/dist/internal/stores/upgrade-dialog-store.d.ts +4 -0
  80. package/dist/internal/stores/upgrade-dialog-store.js +2 -0
  81. package/dist/lib/routes.d.ts +4 -11
  82. package/dist/lib/routes.js +3 -5
  83. package/dist/markdown/unified-markdown-utils.d.ts +7 -0
  84. package/dist/markdown/unified-markdown-utils.js +19 -0
  85. package/dist/markdown/unified-markdown.js +16 -3
  86. package/dist/primitives/alert-dialog.js +1 -1
  87. package/dist/primitives/dialog.js +3 -1
  88. package/dist/primitives/drawer.js +1 -1
  89. package/dist/primitives/modal.js +1 -1
  90. package/dist/primitives/preview-image.js +1 -1
  91. package/dist/primitives/sheet.js +1 -1
  92. package/dist/session/actions/session-label.js +2 -2
  93. package/dist/session/agents/agent-strip.d.ts +10 -5
  94. package/dist/session/agents/agent-strip.js +40 -12
  95. package/dist/session/agents/held-messages.d.ts +6 -2
  96. package/dist/session/agents/held-messages.js +6 -3
  97. package/dist/session/composer/ComposerCard.js +8 -3
  98. package/dist/session/composer/agent-selector.d.ts +2 -0
  99. package/dist/session/composer/agent-selector.js +5 -0
  100. package/dist/session/composer/attachment-tile.d.ts +2 -26
  101. package/dist/session/composer/attachment-tile.js +3 -47
  102. package/dist/session/composer/composer-chat-input.d.ts +3 -1
  103. package/dist/session/composer/composer-chat-input.js +2 -2
  104. package/dist/session/composer/composer-logic.d.ts +7 -0
  105. package/dist/session/composer/composer-logic.js +18 -0
  106. package/dist/session/composer/composer-reset.d.ts +8 -14
  107. package/dist/session/composer/composer-toolbar.d.ts +3 -1
  108. package/dist/session/composer/composer-toolbar.js +3 -3
  109. package/dist/session/composer/composer.d.ts +9 -0
  110. package/dist/session/composer/composer.js +22 -11
  111. package/dist/session/composer/draft/home-composer-focus-handoff.d.ts +7 -0
  112. package/dist/session/composer/draft/home-composer-focus-handoff.js +94 -0
  113. package/dist/session/composer/draft/use-composer-draft.d.ts +3 -1
  114. package/dist/session/composer/draft/use-composer-draft.js +22 -2
  115. package/dist/session/composer/editor/composer-editor.d.ts +4 -2
  116. package/dist/session/composer/editor/composer-editor.js +13 -7
  117. package/dist/session/composer/hooks/use-composer-focus.js +4 -2
  118. package/dist/session/header/session-site-header.d.ts +3 -1
  119. package/dist/session/header/session-site-header.js +3 -2
  120. package/dist/session/index.d.ts +1 -0
  121. package/dist/session/index.js +1 -0
  122. package/dist/session/models/chatgpt-connection-button.js +5 -9
  123. package/dist/session/models/connect-model-step.d.ts +29 -0
  124. package/dist/session/models/connect-model-step.js +50 -0
  125. package/dist/session/models/model-connection-gate.d.ts +2 -1
  126. package/dist/session/models/model-connection-gate.js +6 -3
  127. package/dist/session/models/model-connection-layout.d.ts +2 -0
  128. package/dist/session/models/model-connection-layout.js +4 -0
  129. package/dist/session/models/model-selector.d.ts +1 -1
  130. package/dist/session/models/model-selector.js +9 -6
  131. package/dist/session/models/subscription-offer.d.ts +4 -0
  132. package/dist/session/models/subscription-offer.js +11 -3
  133. package/dist/session/models/use-workspace-model-gate.d.ts +11 -0
  134. package/dist/session/models/use-workspace-model-gate.js +62 -0
  135. package/dist/session/models/workspace-model-gate.d.ts +46 -0
  136. package/dist/session/models/workspace-model-gate.js +66 -0
  137. package/dist/session/overrides/session-overrides-toolbar.js +2 -4
  138. package/dist/session/prompts/ask-deck.d.ts +5 -1
  139. package/dist/session/prompts/ask-deck.js +15 -3
  140. package/dist/session/prompts/question-labels.d.ts +16 -0
  141. package/dist/session/prompts/question-labels.js +34 -0
  142. package/dist/session/prompts/question-prompt.js +6 -6
  143. package/dist/session/prompts/session-connect-card.d.ts +63 -0
  144. package/dist/session/prompts/{session-connect-prompt.js → session-connect-card.js} +53 -42
  145. package/dist/session/status/provisioning-failure.d.ts +23 -2
  146. package/dist/session/status/provisioning-failure.js +53 -3
  147. package/dist/session/status/stop-refusal.d.ts +6 -12
  148. package/dist/session/status/stop-refusal.js +6 -19
  149. package/dist/session/thread/agent-run-props.d.ts +19 -0
  150. package/dist/session/thread/agent-run-props.js +54 -0
  151. package/dist/session/thread/session-chat.js +317 -298
  152. package/dist/session/thread/transcript.d.ts +19 -2
  153. package/dist/session/thread/transcript.js +93 -25
  154. package/dist/session/tool/tool-part-renderer.js +7 -2
  155. package/dist/session/tool/tools/bash-tool.d.ts +3 -52
  156. package/dist/session/tool/tools/bash-tool.js +3 -86
  157. package/dist/session/tool/tools/kortix-action-tool.js +10 -2
  158. package/dist/session/turn/answer-streaming.d.ts +21 -0
  159. package/dist/session/turn/answer-streaming.js +34 -0
  160. package/dist/session/turn/queued-prompt-bubbles.d.ts +5 -0
  161. package/dist/session/turn/queued-prompt-bubbles.js +12 -0
  162. package/dist/session/turn/turn-viewport.d.ts +66 -10
  163. package/dist/session/turn/turn-viewport.js +92 -12
  164. package/dist/session/turn/turn-work-accordion.d.ts +3 -1
  165. package/dist/session/turn/turn-work-accordion.js +2 -2
  166. package/dist/session/turn/user-message.js +7 -5
  167. package/dist/styles.css +1 -1
  168. package/dist/test-utils/intl.d.ts +56 -7
  169. package/dist/workspace/admin/project-admin-dashboard.js +2 -4
  170. package/dist/workspace/home/existing-repo-setup-prompt.d.ts +5 -8
  171. package/dist/workspace/home/existing-repo-setup-prompt.js +16 -42
  172. package/dist/workspace/home/first-chat.d.ts +7 -1
  173. package/dist/workspace/home/first-chat.js +12 -5
  174. package/dist/workspace/home/no-agent-home.d.ts +3 -1
  175. package/dist/workspace/home/no-agent-home.js +2 -2
  176. package/dist/workspace/inbox/workspace-inbox.d.ts +6 -16
  177. package/dist/workspace/inbox/workspace-inbox.js +9 -51
  178. package/dist/workspace/layout/project-home.js +17 -16
  179. package/dist/workspace/layout/use-project-home-send.d.ts +2 -0
  180. package/dist/workspace/layout/use-project-home-send.js +29 -15
  181. package/dist/workspace/new/advanced-fields.d.ts +4 -1
  182. package/dist/workspace/new/advanced-fields.js +2 -2
  183. package/dist/workspace/new/workspace-name.d.ts +9 -0
  184. package/dist/workspace/new/workspace-name.js +20 -0
  185. package/dist/workspace/projects/session-starter.d.ts +6 -4
  186. package/dist/workspace/projects/session-starter.js +8 -14
  187. package/dist/workspace/review/review-center.d.ts +6 -2
  188. package/dist/workspace/review/review-center.js +45 -25
  189. package/dist/workspace/sidebar/session-grouping.d.ts +1 -1
  190. package/dist/workspace/sidebar/session-grouping.js +1 -1
  191. package/dist/workspace/sidebar/workspace-menu-model.d.ts +3 -5
  192. package/dist/workspace/sidebar/workspace-menu-model.js +1 -1
  193. package/dist/workspace/spaces/space-details-panel.js +2 -2
  194. package/dist/workspace/spaces/space-triggers.js +2 -2
  195. package/dist/workspace/spaces/space-view.js +11 -5
  196. package/package.json +15 -7
  197. package/skills/kortix-ui/references/modules.md +1 -1
  198. package/dist/customize/connectors/invalidate-connections.d.ts +0 -2
  199. package/dist/customize/connectors/invalidate-connections.js +0 -4
  200. package/dist/internal/notifications/use-inbox-summary.d.ts +0 -17
  201. package/dist/internal/notifications/use-inbox-summary.js +0 -28
  202. package/dist/session/prompts/session-connect-prompt.d.ts +0 -40
@@ -6,6 +6,8 @@ export const useUpgradeDialogStore = create((set) => ({
6
6
  accountId: undefined,
7
7
  hasSubscription: undefined,
8
8
  billingState: undefined,
9
+ pickedMonthlyUsd: undefined,
10
+ setPickedMonthlyUsd: (monthlyUsd) => set({ pickedMonthlyUsd: monthlyUsd }),
9
11
  openUpgradeDialog: (opts) => set({
10
12
  isOpen: true,
11
13
  reason: opts.reason ?? 'subscription_required',
@@ -52,19 +52,12 @@ export interface UiRoutes {
52
52
  /** The project's Company memory (`chat` flag); a page is `?page=<page_id>`. */
53
53
  memory: (projectId: string) => string | null;
54
54
  /**
55
- * Review: everything that waits on a person (asks, approvals, changes), as
56
- * its own page beside the app sidebar. Absent: the host serves Review only
57
- * inside its `customize` route.
55
+ * Review: the workspace's Review queue, beside the app sidebar. Since
56
+ * KRTX-4799 it lives at the workspace Inbox address; the person's
57
+ * notifications are not a view of it (they span every workspace). Absent:
58
+ * the host serves Review only inside its `customize` route.
58
59
  */
59
60
  review?: (projectId: string) => string | null;
60
- /**
61
- * The Inbox: the signed-in person's notifications from every project, as a
62
- * page beside the project sidebar (KRTX-1742). Absent or null: the host
63
- * serves no Inbox page and the sidebar has no Inbox row. It is new
64
- * (2026-11-06), so a host that maps any route (its own router) gets no
65
- * Inbox row until it routes `inbox` too: no host gets a link it does not serve.
66
- */
67
- inbox?: (projectId: string) => string | null;
68
61
  }
69
62
  export declare const defaultUiRoutes: UiRoutes;
70
63
  /**
@@ -15,9 +15,9 @@ const DEFAULT_ROUTES = {
15
15
  channel: (p, slug) => `/workspaces/${p}/c/${slug}`,
16
16
  dm: (p, agentName) => `/workspaces/${p}/dm/${encodeURIComponent(agentName)}`,
17
17
  memory: (p) => `/workspaces/${p}/memory`,
18
- // Review is a tab of the Inbox (2026-11-08); `/workspaces/<id>/review` redirects here.
18
+ // The workspace Inbox page IS the Review queue (KRTX-4799); the old
19
+ // `/workspaces/<id>/review` route redirects here.
19
20
  review: (p) => `/workspaces/${p}/inbox?view=review`,
20
- inbox: (p) => `/workspaces/${p}/inbox`,
21
21
  };
22
22
  export const defaultUiRoutes = DEFAULT_ROUTES;
23
23
  let routes = DEFAULT_ROUTES;
@@ -31,9 +31,7 @@ export function setUiRoutes(overrides) {
31
31
  const admin = overrides.admin ?? overrides.customize;
32
32
  // A host that routes its own customize pages serves Review there unless it also routes `review`.
33
33
  const review = overrides.review ?? (overrides.customize ? undefined : DEFAULT_ROUTES.review);
34
- // The Inbox page is new: only the default router (no override) serves it unasked.
35
- const inbox = overrides.inbox ?? (Object.keys(overrides).length === 0 ? DEFAULT_ROUTES.inbox : undefined);
36
- routes = { ...DEFAULT_ROUTES, ...overrides, ...(admin ? { admin } : {}), review, inbox };
34
+ routes = { ...DEFAULT_ROUTES, ...overrides, ...(admin ? { admin } : {}), review };
37
35
  }
38
36
  export function uiRoutes() {
39
37
  return routes;
@@ -59,6 +59,13 @@ export declare function remoteImageHost(src: string, proxiedSrc?: string): strin
59
59
  * back to a plain `<a>` and never feed garbage to `next/link`.
60
60
  */
61
61
  export declare function isLinkSafeHref(href: string | undefined): boolean;
62
+ /**
63
+ * The app path of an absolute URL on this page's own origin
64
+ * (`https://kortix.com/workspaces/…` on kortix.com → `/workspaces/…`), or
65
+ * `null` for any other href. Agents write full URLs; a click on one is an
66
+ * in-app navigation, not a page load.
67
+ */
68
+ export declare function sameOriginAppPath(href: string | undefined): string | null;
62
69
  /** Route only trusted app paths through Next.js Link and its prefetcher. */
63
70
  export declare function shouldUseNextLink(href: string | undefined): boolean;
64
71
  export { LANGUAGE_ALIASES, normalizeLanguage, languageLabel } from '../_vendor/shared/code-language.js';
@@ -122,6 +122,25 @@ export function isLinkSafeHref(href) {
122
122
  // `new URL(..., window.location.href)` always succeeds for them.
123
123
  return true;
124
124
  }
125
+ /**
126
+ * The app path of an absolute URL on this page's own origin
127
+ * (`https://kortix.com/workspaces/…` on kortix.com → `/workspaces/…`), or
128
+ * `null` for any other href. Agents write full URLs; a click on one is an
129
+ * in-app navigation, not a page load.
130
+ */
131
+ export function sameOriginAppPath(href) {
132
+ if (!href || typeof window === 'undefined' || !/^https?:\/\//i.test(href))
133
+ return null;
134
+ try {
135
+ const url = new URL(href);
136
+ if (url.origin !== window.location.origin)
137
+ return null;
138
+ return url.pathname + url.search + url.hash;
139
+ }
140
+ catch {
141
+ return null;
142
+ }
143
+ }
125
144
  /** Route only trusted app paths through Next.js Link and its prefetcher. */
126
145
  export function shouldUseNextLink(href) {
127
146
  return isInternalUrl(href) && isLinkSafeHref(href);
@@ -14,7 +14,7 @@ import { InsideLinkContext } from './code/inside-link-context.js';
14
14
  import { isKatexClassName, katexRehypePlugins, katexRehypePluginsNoRaw, katexRemarkPlugins, normalizeClassName, } from './katex-markdown.js';
15
15
  import { markdownPolicy, } from './markdown-policy.js';
16
16
  import { MarkdownOrderedList } from './ordered-list.js';
17
- import { hasLinkReferenceDefinition, isInternalUrl, isStreamingLinkPlaceholder, prepareMarkdownSource, remoteImageHost, shouldUseNextLink, } from './unified-markdown-utils.js';
17
+ import { hasLinkReferenceDefinition, isInternalUrl, isStreamingLinkPlaceholder, prepareMarkdownSource, remoteImageHost, sameOriginAppPath, shouldUseNextLink, } from './unified-markdown-utils.js';
18
18
  import { remarkSetupLinkBlocks } from './setup-link-blocks.js';
19
19
  import { rehypeStreamWords, STREAM_WORD_CLASS, StreamFadeGateContext, StreamWord, createStreamFadeGate, } from './stream-words.js';
20
20
  import { SetupLinkButton, SetupLinkInlineContext } from './setup-links/setup-link-button.js';
@@ -25,7 +25,7 @@ import { useSandboxProxy } from '../internal/hooks/use-sandbox-proxy.js';
25
25
  import { useOpenPreviewLink } from '../internal/hooks/use-open-preview-link.js';
26
26
  import { cn } from '../lib/utils.js';
27
27
  import { ImageIcon } from '@phosphor-icons/react';
28
- import { useUiLink } from '../providers/ui-provider.js';
28
+ import { useUiLink, useUiRouter } from '../providers/ui-provider.js';
29
29
  import React, { useCallback, useContext, useMemo, useState } from 'react';
30
30
  import { parseMarkdownIntoBlocks, Streamdown } from 'streamdown';
31
31
  function SlackMark({ className }) {
@@ -119,6 +119,7 @@ function bareLinkText(children) {
119
119
  export function MarkdownLink({ href, children, }) {
120
120
  const tAppLink = useTranslations('markdownAppLinks');
121
121
  const Link = useUiLink();
122
+ const router = useUiRouter();
122
123
  const { proxy, policy, variant } = useContext(MarkdownRenderContext);
123
124
  const openPreview = useOpenPreviewLink();
124
125
  // Only agent content may turn a setup link into the in-app card. From any
@@ -201,8 +202,20 @@ export function MarkdownLink({ href, children, }) {
201
202
  // treats those as app routes and prefetches them, including typos such
202
203
  // as `/legal/terms.`. Only trusted root-relative/hash paths belong in
203
204
  // the app router; every other href stays a plain anchor.
205
+ // An absolute URL on this app's own origin (an agent writes
206
+ // `https://kortix.com/workspaces/…`) navigates in place through the app
207
+ // router on a plain click. Decided at click time, so the server markup and
208
+ // the prefetcher never see it; a modified click keeps the native new tab.
204
209
  if (!shouldUseNextLink(resolvedHref)) {
205
- return (_jsx("a", { href: resolvedHref, className: anchorClass, title: presentation ? resolvedHref : undefined, ...(isExternal && !isHash ? { target: '_blank', rel: 'noopener noreferrer' } : {}), children: _jsx(InsideLinkContext.Provider, { value: true, children: linkContent }) }));
210
+ return (_jsx("a", { href: resolvedHref, className: anchorClass, title: presentation ? resolvedHref : undefined, ...(isExternal && !isHash ? { target: '_blank', rel: 'noopener noreferrer' } : {}), onClick: (e) => {
211
+ if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey)
212
+ return;
213
+ const appPath = sameOriginAppPath(resolvedHref);
214
+ if (!appPath)
215
+ return;
216
+ e.preventDefault();
217
+ router.push(appPath);
218
+ }, children: _jsx(InsideLinkContext.Provider, { value: true, children: linkContent }) }));
206
219
  }
207
220
  return (_jsx(Link, { href: resolvedHref, onClick: isHash ? (e) => handleHashClick(e, resolvedHref) : undefined, className: anchorClass, title: presentation ? resolvedHref : undefined, ...(isExternal && !isHash ? { target: '_blank', rel: 'noopener noreferrer' } : {}), children: _jsx(InsideLinkContext.Provider, { value: true, children: linkContent }) }));
208
221
  }
@@ -28,7 +28,7 @@ function AlertDialogPortal({ container, forceMount, children, }) {
28
28
  }
29
29
  function AlertDialogOverlay({ className, style, ...props }) {
30
30
  const depth = useDialogDepth();
31
- return (_jsx(AlertDialogPrimitive.Backdrop, { "data-slot": "alert-dialog-overlay", className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 bg-black/65 backdrop-blur-xs', className), style: { zIndex: dialogOverlayZ(depth), ...style }, render: stateRender('div', openState), ...props }));
31
+ return (_jsx(AlertDialogPrimitive.Backdrop, { forceRender: true, "data-slot": "alert-dialog-overlay", className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 bg-black/65 backdrop-blur-xs', className), style: { zIndex: dialogOverlayZ(depth), ...style }, render: stateRender('div', openState), ...props }));
32
32
  }
33
33
  function AlertDialogContent({ className, style, overlayClassName, asChild, forceMount, children, onEscapeKeyDown, onOpenAutoFocus, onCloseAutoFocus, ...props }) {
34
34
  const depth = useDialogDepth();
@@ -34,7 +34,9 @@ const DialogClose = React.forwardRef(({ asChild, children, ...props }, ref) => {
34
34
  DialogClose.displayName = 'DialogClose';
35
35
  const DialogOverlay = React.forwardRef(({ className, style, ...props }, ref) => {
36
36
  const depth = useDialogDepth();
37
- return (_jsx(DialogPrimitive.Backdrop, { ref: ref, className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-moderate fixed inset-0 bg-black/65 backdrop-blur-xs', className), style: { zIndex: dialogOverlayZ(depth), ...style }, render: stateRender('div', openState), ...props }));
37
+ return (_jsx(DialogPrimitive.Backdrop, { ref: ref,
38
+ // Base UI skips a nested backdrop by default; Radix dimmed the parent dialog.
39
+ forceRender: true, className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-moderate fixed inset-0 bg-black/65 backdrop-blur-xs', className), style: { zIndex: dialogOverlayZ(depth), ...style }, render: stateRender('div', openState), ...props }));
38
40
  });
39
41
  DialogOverlay.displayName = 'DialogOverlay';
40
42
  const DialogVariants = cva(cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 border p-5 shadow-lg duration-moderate sm:max-w-lg sm:rounded-lg'), {
@@ -30,7 +30,7 @@ function DrawerClose({ asChild, children, ...props }) {
30
30
  return (_jsx(DrawerPrimitive.Close, { "data-slot": "drawer-close", ...props, ref: composeRefs(props.ref, native.ref), render: slot.render, nativeButton: native.nativeButton, children: slot.children }));
31
31
  }
32
32
  function DrawerOverlay({ className, ...props }) {
33
- return (_jsx(DrawerPrimitive.Backdrop, { "data-slot": "drawer-overlay", className: cn('duration-moderate fixed inset-0 z-50 bg-black/50 opacity-[calc(1-var(--drawer-swipe-progress,0))] transition-opacity ease-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-swiping:duration-0', className), render: stateRender('div', openState), ...props }));
33
+ return (_jsx(DrawerPrimitive.Backdrop, { forceRender: true, "data-slot": "drawer-overlay", className: cn('duration-moderate fixed inset-0 z-50 bg-black/50 opacity-[calc(1-var(--drawer-swipe-progress,0))] transition-opacity ease-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-swiping:duration-0', className), render: stateRender('div', openState), ...props }));
34
34
  }
35
35
  /**
36
36
  * Slide-in per edge. The swipe offset Base UI writes while the drawer is
@@ -62,7 +62,7 @@ const overlayAnimationClasses = {
62
62
  };
63
63
  const ModalOverlay = React.forwardRef(({ className, style, animation = 'default', ...props }, ref) => {
64
64
  const depth = useDialogDepth();
65
- return (_jsx(DialogPrimitive.Backdrop, { render: stateRender('div', openState), className: cn('fixed inset-0 bg-black/65 backdrop-blur-xs', overlayAnimationClasses[animation], className), style: { zIndex: dialogOverlayZ(depth), ...style }, ...props, ref: ref }));
65
+ return (_jsx(DialogPrimitive.Backdrop, { forceRender: true, render: stateRender('div', openState), className: cn('fixed inset-0 bg-black/65 backdrop-blur-xs', overlayAnimationClasses[animation], className), style: { zIndex: dialogOverlayZ(depth), ...style }, ...props, ref: ref }));
66
66
  });
67
67
  ModalOverlay.displayName = 'ModalOverlay';
68
68
  const ModalVariants = cva(cn('fixed gap-0 border p-0 shadow-lg overflow-y-auto', 'lg:top-[50%] lg:left-[50%] lg:grid lg:w-full lg:max-w-lg lg:-translate-x-1/2 lg:-translate-y-1/2 lg:rounded-xl', 'lg:flex lg:h-full lg:flex-col space-y-4'), {
@@ -14,7 +14,7 @@ function PreviewImage({ open, defaultOpen, onOpenChange, modal, children, }) {
14
14
  const PreviewImageTrigger = DialogTrigger;
15
15
  const PreviewImagePortal = DialogPortal;
16
16
  const PreviewImageClose = DialogClose;
17
- const PreviewImageOverlay = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Backdrop, { ref: ref, className: cn('fixed inset-0 z-50 bg-black/40', className), ...props })));
17
+ const PreviewImageOverlay = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Backdrop, { ref: ref, forceRender: true, className: cn('fixed inset-0 z-50 bg-black/40', className), ...props })));
18
18
  PreviewImageOverlay.displayName = 'PreviewImageOverlay';
19
19
  const MIN_ZOOM = 0.7;
20
20
  const DEFAULT_ZOOM = 1;
@@ -18,7 +18,7 @@ const SheetClose = DialogClose;
18
18
  const SheetPortal = DialogPortal;
19
19
  const SheetOverlay = React.forwardRef(({ className, style, ...props }, ref) => {
20
20
  const depth = useDialogDepth();
21
- return (_jsx(SheetPrimitive.Backdrop, { className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 bg-black/80', className), style: { zIndex: dialogOverlayZ(depth), ...style }, render: stateRender('div', openState), ...props, ref: ref }));
21
+ return (_jsx(SheetPrimitive.Backdrop, { forceRender: true, className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 bg-black/80', className), style: { zIndex: dialogOverlayZ(depth), ...style }, render: stateRender('div', openState), ...props, ref: ref }));
22
22
  });
23
23
  SheetOverlay.displayName = 'SheetOverlay';
24
24
  const sheetVariants = cva('fixed flex min-h-0 flex-col gap-4 overflow-hidden bg-sidebar p-4 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out h-[calc(100vh-1.4rem)]', {
@@ -40,7 +40,7 @@ export function sessionSource(session, tI18nComplete) {
40
40
  if (type === 'cron')
41
41
  return { kind: 'schedule', label: tI18nComplete.raw('text4724f344c1c0'), triggerSlug };
42
42
  if (type === 'event')
43
- return { kind: 'event', label: tI18nComplete.raw('text5441e7146193'), triggerSlug };
43
+ return { kind: 'event', label: tI18nComplete.raw('textca395c4d19b2'), triggerSlug };
44
44
  return { kind: 'webhook', label: tI18nComplete.raw('text4814f62c108d'), triggerSlug };
45
45
  }
46
46
  return { kind: 'chat', label: tI18nComplete.raw('text460b3a7da007'), triggerSlug: null };
@@ -112,7 +112,7 @@ export const SESSION_SOURCE_FILTERS = [
112
112
  { value: 'email', label: 'Email' },
113
113
  { value: 'schedule', label: 'Scheduled' },
114
114
  { value: 'webhook', label: 'Webhook' },
115
- { value: 'event', label: 'App event' },
115
+ { value: 'event', label: 'Connector event' },
116
116
  { value: 'manual', label: 'Manual' },
117
117
  ];
118
118
  export const SESSION_STATUS_FILTERS = [
@@ -33,11 +33,14 @@ export interface AgentsPanelProps extends Omit<AgentsLineViewProps, 'compact' |
33
33
  /** The popover body: Agents, Team, Workflows, and a Tasks tab when this session leads a team. */
34
34
  export declare function AgentsPanel({ projectId, sessionId, agents, team, runs, tasks, onOpen, onStop, stopping, live }: AgentsPanelProps): import("react").JSX.Element;
35
35
  /**
36
- * The agents of one session, read live: its children (polled every 5 s), its
37
- * teammates and team tasks (flag `agent_teams`) and its workflow runs; and the
38
- * stop of one agent.
36
+ * The agents of one session, read live: its children, its teammates and team
37
+ * tasks (flag `agent_teams`) and its workflow runs; and the stop of one agent.
38
+ * The lists poll every 5 s while the session works (`live`) and every 30 s
39
+ * while it is idle.
39
40
  */
40
- export declare function useAgentsLine(projectId: string | undefined, sessionId: string | undefined): {
41
+ export declare function useAgentsLine(projectId: string | undefined, sessionId: string | undefined, { live }?: {
42
+ live?: boolean;
43
+ }): {
41
44
  ready: boolean;
42
45
  agents: AgentRow[];
43
46
  team: AgentRow[];
@@ -51,8 +54,10 @@ export declare function useAgentsLine(projectId: string | undefined, sessionId:
51
54
  * (`SessionChatInputProps.underbarSlot`). Nothing renders while the session
52
55
  * started no agent and no workflow run.
53
56
  */
54
- export declare function AgentsLine({ projectId, sessionId, compact, }: {
57
+ export declare function AgentsLine({ projectId, sessionId, compact, live, }: {
55
58
  projectId: string | undefined;
56
59
  sessionId: string | undefined;
57
60
  compact?: boolean;
61
+ /** The session works now: its agent lists poll every 5 s instead of every 30 s. */
62
+ live?: boolean;
58
63
  }): import("react").JSX.Element | null;
@@ -14,7 +14,7 @@ import { cn } from '../../lib/utils.js';
14
14
  import { AgentStateMark } from './agent-state-mark.js';
15
15
  import { SubagentDialog } from './subagent-view.js';
16
16
  import { ArrowUpRightIcon, CaretUpIcon, SquareIcon } from '@phosphor-icons/react';
17
- import { useMemo, useState } from 'react';
17
+ import { useEffect, useMemo, useRef, useState } from 'react';
18
18
  import { useMutation, useQueryClient } from '@tanstack/react-query';
19
19
  import { stopProjectSession } from '@kortix/sdk';
20
20
  import { qk, useFeatureFlag, useNow, useSessionChildren, useSessionWorkflows, useTeamTasks, useTeammates, } from '@kortix/sdk/react';
@@ -37,8 +37,10 @@ import { isLargeRun, LargeRunBadge, useLiveWorkflowRun, useRestartAgent, Workflo
37
37
  * started nothing, and it never holds the composer: the agents run in their own
38
38
  * sessions, and the person keeps talking to this one.
39
39
  */
40
- /** How often the child list polls while the line is mounted. */
40
+ /** How often the child list polls while the session works. */
41
41
  const CHILDREN_POLL_MS = 5_000;
42
+ /** An idle session starts no agent: its children poll every 30 s. */
43
+ const IDLE_CHILDREN_POLL_MS = 30_000;
42
44
  /** A finished workflow run stays listed this long after it ended. */
43
45
  const RECENT_RUN_MS = 60 * 60_000;
44
46
  /** The popover lists at most this many runs. */
@@ -195,23 +197,45 @@ function WorkflowLineRow({ projectId, sessionId, run: listed, onOpen, }) {
195
197
  return (_jsxs("li", { "data-testid": "agents-line-row", "data-workflow-run": run.runId, children: [_jsxs("div", { className: "group/row hover:bg-hover focus-within:bg-hover flex min-w-0 items-center gap-1 rounded-sm", children: [_jsxs("button", { type: "button", "aria-expanded": open, onClick: () => setOpen((value) => !value), className: "flex min-w-0 flex-1 cursor-pointer items-center gap-2 py-1.5 pl-2 text-left text-xs outline-none", children: [_jsx(RunProgressRing, { done: counts.done, failed: counts.failed, total: Math.max(counts.total, 1), ended: run.status === 'done' ? 'done' : run.status === 'stopped' ? 'stopped' : undefined }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex min-w-0 items-baseline gap-2", children: [_jsx("span", { className: "text-foreground min-w-0 truncate font-medium", title: title, children: title }), _jsx("span", { className: "text-muted-foreground shrink-0", children: t(`state.${RUN_STATE[run.status]}`) })] }), line && _jsx("p", { className: "text-muted-foreground truncate tabular-nums", children: line })] })] }), isLargeRun(run) && _jsx(LargeRunBadge, {}), _jsxs("div", { className: cn(ROW_ACTIONS, 'pr-1'), children: [run.background && (_jsx(Hint, { label: t('openRun'), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", "aria-label": t('openRun'), onClick: () => onOpen({ sessionId: run.background.sessionId, title }), className: "text-muted-foreground hover:text-foreground", children: _jsx(ArrowUpRightIcon, { className: "size-3.5 shrink-0" }) }) })), _jsx(WorkflowRunControls, { projectId: projectId, controlSessionId: live ? controlSessionId : undefined, ownerSessionId: sessionId, run: run })] })] }), open && run.agents.length > 0 && (_jsx("div", { className: "pl-5", children: _jsx(WorkflowRunRows, { run: run, live: live, now: now, onOpen: (agent) => agent.sessionId && onOpen({ sessionId: agent.sessionId, title: agent.label }), stop: stop }) })), open && run.agents.length === 0 && (_jsx(Badge, { variant: "muted", size: "sm", className: "ml-7", children: t('runNoAgents') }))] }));
196
198
  }
197
199
  /**
198
- * The agents of one session, read live: its children (polled every 5 s), its
199
- * teammates and team tasks (flag `agent_teams`) and its workflow runs; and the
200
- * stop of one agent.
200
+ * The agents of one session, read live: its children, its teammates and team
201
+ * tasks (flag `agent_teams`) and its workflow runs; and the stop of one agent.
202
+ * The lists poll every 5 s while the session works (`live`) and every 30 s
203
+ * while it is idle.
201
204
  */
202
- export function useAgentsLine(projectId, sessionId) {
205
+ export function useAgentsLine(projectId, sessionId, { live = false } = {}) {
203
206
  const t = useTranslations('multiAgent.strip');
204
207
  const pid = projectId ?? '';
205
208
  const sid = sessionId ?? '';
206
209
  const ready = !!projectId && !!sessionId;
207
210
  const teams = useFeatureFlag(projectId, 'agent_teams').enabled;
208
- const childList = useSessionChildren(pid, sid, { enabled: ready, refetchInterval: CHILDREN_POLL_MS, limit: 50 });
211
+ // A child or teammate can keep working after the lead's turn ends: the lists
212
+ // stay at 5 s while any of them works.
213
+ const [agentsActive, setAgentsActive] = useState(false);
214
+ const fast = live || agentsActive;
215
+ const childList = useSessionChildren(pid, sid, {
216
+ enabled: ready,
217
+ refetchInterval: fast ? CHILDREN_POLL_MS : IDLE_CHILDREN_POLL_MS,
218
+ limit: 50,
219
+ });
209
220
  const children = childList.sessions;
210
- const { data: teammates, dataUpdatedAt: teammatesAt } = useTeammates(projectId, sessionId, { enabled: ready && teams });
211
- const { data: tasks } = useTeamTasks(projectId, sessionId, { enabled: ready && teams });
212
- const { data: runData, dataUpdatedAt: runsAt } = useSessionWorkflows(projectId, sessionId, { enabled: ready });
221
+ const { data: teammates, dataUpdatedAt: teammatesAt } = useTeammates(projectId, sessionId, {
222
+ enabled: ready && teams,
223
+ live: fast,
224
+ });
225
+ const { data: tasks } = useTeamTasks(projectId, sessionId, { enabled: ready && teams, live: fast });
226
+ const { data: runData, dataUpdatedAt: runsAt } = useSessionWorkflows(projectId, sessionId, { enabled: ready, live: fast });
213
227
  const [stopping, setStopping] = useState(() => new Set());
214
228
  const queryClient = useQueryClient();
229
+ // A turn that ends may have started an agent or a run in its last seconds:
230
+ // read the lists once now instead of waiting for the next idle poll.
231
+ const wasLive = useRef(live);
232
+ useEffect(() => {
233
+ if (wasLive.current && !live && ready) {
234
+ void queryClient.invalidateQueries({ queryKey: qk.project.sessionChildren(pid, sid) });
235
+ void queryClient.invalidateQueries({ queryKey: qk.project.sessionAgents(pid, sid) });
236
+ }
237
+ wasLive.current = live;
238
+ }, [live, ready, pid, sid, queryClient]);
215
239
  const stopMutation = useMutation({
216
240
  mutationFn: (row) => stopProjectSession(pid, row.sessionId),
217
241
  onSettled: (_data, _error, row) => {
@@ -234,6 +258,10 @@ export function useAgentsLine(projectId, sessionId) {
234
258
  exclude: runSessionIds(runs),
235
259
  now,
236
260
  }), [sid, children, teammates, runs, now]);
261
+ const anyActive = [...groups.agents, ...groups.team].some((row) => row.state === 'working');
262
+ // Adjusted during render (React's derived-state pattern): the lists read it next render.
263
+ if (anyActive !== agentsActive)
264
+ setAgentsActive(anyActive);
237
265
  const leadsTeam = teams && ((teammates?.length ?? 0) > 0 || (tasks?.length ?? 0) > 0);
238
266
  return {
239
267
  ready,
@@ -253,8 +281,8 @@ export function useAgentsLine(projectId, sessionId) {
253
281
  * (`SessionChatInputProps.underbarSlot`). Nothing renders while the session
254
282
  * started no agent and no workflow run.
255
283
  */
256
- export function AgentsLine({ projectId, sessionId, compact = false, }) {
257
- const line = useAgentsLine(projectId, sessionId);
284
+ export function AgentsLine({ projectId, sessionId, compact = false, live = false, }) {
285
+ const line = useAgentsLine(projectId, sessionId, { live });
258
286
  const [open, setOpen] = useState(null);
259
287
  if (!line.ready)
260
288
  return null;
@@ -21,9 +21,13 @@ export declare function HeldMessageList({ messages, approve, deny, }: {
21
21
  approve: PeerMessagesQuery['approve'];
22
22
  deny: PeerMessagesQuery['deny'];
23
23
  }): import("react").JSX.Element | null;
24
- /** A session's held messages, read on their own (for a host without the agent strip). */
25
- export declare function HeldMessages({ projectId, sessionId }: {
24
+ /**
25
+ * A session's held messages, read on their own (for a host without the agent
26
+ * strip). They poll every 5 s while the session works (`live`), every 30 s idle.
27
+ */
28
+ export declare function HeldMessages({ projectId, sessionId, live, }: {
26
29
  projectId: string | undefined;
27
30
  sessionId: string | undefined;
31
+ live?: boolean;
28
32
  }): import("react").JSX.Element;
29
33
  export {};
@@ -26,8 +26,11 @@ export function HeldMessageList({ messages, approve, deny, }) {
26
26
  const fail = (key) => (error) => errorToast(t(key), { description: error instanceof Error ? error.message : undefined });
27
27
  return (_jsx("div", { "aria-label": t('label'), role: "group", className: "space-y-1.5", children: held.map((message) => (_jsx(HeldMessageCard, { message: message, pending: pendingFor(message.id), onApprove: () => approve.mutate(message.id, { onError: fail('approveFailed') }), onDeny: () => deny.mutate(message.id, { onError: fail('denyFailed') }) }, message.id))) }));
28
28
  }
29
- /** A session's held messages, read on their own (for a host without the agent strip). */
30
- export function HeldMessages({ projectId, sessionId }) {
31
- const { data, approve, deny } = usePeerMessages(projectId, sessionId, 'in');
29
+ /**
30
+ * A session's held messages, read on their own (for a host without the agent
31
+ * strip). They poll every 5 s while the session works (`live`), every 30 s idle.
32
+ */
33
+ export function HeldMessages({ projectId, sessionId, live = false, }) {
34
+ const { data, approve, deny } = usePeerMessages(projectId, sessionId, 'in', { live });
32
35
  return _jsx(HeldMessageList, { messages: data, approve: approve, deny: deny });
33
36
  }
@@ -5,6 +5,7 @@ import { WarningIcon } from '@phosphor-icons/react';
5
5
  import { lazy, Suspense, useContext, useMemo, useRef } from 'react';
6
6
  import { SpaceMentionContext } from './menus/space-mentions.js';
7
7
  import { useFeatureFlag } from '@kortix/sdk/react';
8
+ import { ModelConnectionLayoutContext } from '../models/model-connection-layout.js';
8
9
  import { ImagesUnsupportedBar, ModelConnectionBar } from '../models/model-connection-gate.js';
9
10
  import { AnimatedComposerPlaceholder } from './animated-placeholder.js';
10
11
  import { AttachmentTiles } from './attachment-tiles.js';
@@ -13,6 +14,7 @@ import { shouldFocusEditorFromPadding } from './composer-logic.js';
13
14
  import { ComposerToolbar } from './composer-toolbar.js';
14
15
  import { ComposerUnderbar } from './composer-underbar.js';
15
16
  import { ChatInputOverridesProvider } from './chat-input/chat-input-overrides.js';
17
+ import { resolveProgramAgent } from './agent-selector.js';
16
18
  import { useUiHostConfig } from '../../providers/ui-provider.js';
17
19
  /** What the attach picker offers when the host names no list. */
18
20
  const DEFAULT_ATTACH_ACCEPT = 'image/*,.pdf,.txt,.md,.json,.csv,.xml,.yaml,.yml,.toml,.js,.ts,.jsx,.tsx,.py,.rb,.go,.rs,.java,.c,.cpp,.h,.css,.html,.vue,.svelte,.log,.sql,.zip,.tar,.gz,.rar';
@@ -25,6 +27,7 @@ export function ComposerCard({ tHardcodedUi, isDragOver, handleDragEnter, handle
25
27
  // defaults mirror `ComposerImpl`'s, because the spread passes the raw
26
28
  // values, not the component's defaulted locals.
27
29
  agents = EMPTY_AGENTS, commands = EMPTY_COMMANDS, slashFiles = EMPTY_SLASH_FILES, models = EMPTY_MODELS, notice = null, disabled = false, lockForQuestion = false, lockForApproval = false, questionButtonLabel = null, questionActive = false, submitLabel = null, questionCanAct = true, escCount = 0, isBusy = false, isSending = false, onStop, stopDisabled = false, canStop = true, modelsLoading = false, modelRequired = false, onModelChange, modelDefaultControls, inheritedModel, providers, variants = EMPTY_VARIANTS, selectedVariant = null, onVariantChange, projectId, toolbarSlot, underbarSlot, rewind, selectedAgent = null, onAgentChange, noAccessibleAgents = false, agentLocked = false, onContextClick, messages, underbarPlacement = 'below', agentPickerCompact = false, slashMenuPlacement = 'above', cardClassName, call, }) {
30
+ const connectionsAbove = useContext(ModelConnectionLayoutContext) === 'above';
28
31
  const cardRef = useRef(null);
29
32
  const { attachAccept, modelPickerEnabled } = useUiHostConfig();
30
33
  const inlineUnderbar = underbarPlacement === 'inline';
@@ -39,6 +42,8 @@ agents = EMPTY_AGENTS, commands = EMPTY_COMMANDS, slashFiles = EMPTY_SLASH_FILES
39
42
  // Inside a space the `@` menu is its people and agents (`menus/space-mentions.ts`).
40
43
  const spaceMentions = useContext(SpaceMentionContext);
41
44
  const chatInputOpen = agentMenuOpen || modelMenuOpen || reasoningMenuOpen;
45
+ // A program agent (`run` in kortix.yaml) has no model: its listing names provider `program`.
46
+ const programAgent = resolveProgramAgent(primaryAgents, selectedAgent);
42
47
  const chatInput = useMemo(() => {
43
48
  if (!chatInputEnabled)
44
49
  return undefined;
@@ -90,7 +95,7 @@ agents = EMPTY_AGENTS, commands = EMPTY_COMMANDS, slashFiles = EMPTY_SLASH_FILES
90
95
  selectedVariant,
91
96
  onVariantChange,
92
97
  ]);
93
- return (_jsxs(ChatInputOverridesProvider, { enabled: chatInputEnabled, children: [_jsxs("div", { ref: cardRef, onDragEnter: handleDragEnter, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDropFiles, className: cn(
98
+ return (_jsxs(ChatInputOverridesProvider, { enabled: chatInputEnabled, children: [connectionsAbove ? _jsx(ModelConnectionBar, { show: noModelsConnected }) : null, _jsxs("div", { ref: cardRef, onDragEnter: handleDragEnter, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDropFiles, className: cn(
94
99
  // One shadow, from the ladder. `shadow-card` is defined nowhere in
95
100
  // `globals.css` and `shadow-xl` was dead — twMerge dropped it for the
96
101
  // arbitrary `shadow-[…oklch…]` that followed, which was the only
@@ -116,7 +121,7 @@ agents = EMPTY_AGENTS, commands = EMPTY_COMMANDS, slashFiles = EMPTY_SLASH_FILES
116
121
  // the div and immediately fights the caret we are placing.
117
122
  e.preventDefault();
118
123
  editorRef.current?.focus();
119
- }, children: [_jsx(AnimatedComposerPlaceholder, { placeholder: editorPlaceholder, active: animatePlaceholder }), _jsx(Suspense, { fallback: _jsx(ComposerEditorFallback, {}), children: _jsx(ComposerEditorLazy, { ref: setEditorRef, placeholder: animatePlaceholder ? '' : editorPlaceholder, disabled: editorDisabled, onSubmit: handleSubmit, onArrowUpAtStart: handleArrowUpAtStart, onArrowDownAtEnd: handleArrowDownAtEnd, onEmptyChange: setIsEmpty, onDocChange: handleDocChange, agents: agents, sessions: allSessions ?? [], currentSessionId: sessionId, spaceMentions: spaceMentions, commands: commands, actions: slashActions, files: slashFiles, onSelectAction: handleSelectAction, slashDockSelector: `#${dockId}`, onMenuOpenChange: setMenuOpen }) })] }), _jsx("input", { ref: fileInputRef, type: "file", accept: attachAccept ?? DEFAULT_ATTACH_ACCEPT, multiple: true, className: "hidden", onChange: handleFileSelect }), _jsx(ComposerToolbar, { leading: inlineUnderbar ? (_jsx(ComposerUnderbar, { variant: "inline", agentPickerCompact: agentPickerCompact, onAttachClick: handleAttachClick, agents: primaryAgents, selectedAgent: selectedAgent, onAgentChange: onAgentChange, agentMenuOpen: agentMenuOpen, onAgentMenuOpenChange: setAgentMenuOpen, noAccessibleAgents: noAccessibleAgents, agentLocked: agentLocked, messages: messages, models: models, selectedModel: availableSelectedModel, onContextClick: onContextClick, agentsSlot: underbarSlot, chatInput: chatInput })) : null, pickersInChatInput: chatInputEnabled, modelsLoading: modelsLoading, models: models, selectedModel: availableSelectedModel, onModelChange: onModelChange, modelDefaultControls: modelDefaultControls, providers: providers, modelRequired: modelRequired, modelMenuOpen: modelMenuOpen, onModelMenuOpenChange: setModelMenuOpen, reasoningMenuOpen: reasoningMenuOpen, onReasoningMenuOpenChange: setReasoningMenuOpen, variants: variants, selectedVariant: selectedVariant, onVariantChange: onVariantChange, projectId: projectId,
124
+ }, children: [_jsx(AnimatedComposerPlaceholder, { placeholder: editorPlaceholder, active: animatePlaceholder }), _jsx(Suspense, { fallback: _jsx(ComposerEditorFallback, {}), children: _jsx(ComposerEditorLazy, { ref: setEditorRef, placeholder: animatePlaceholder ? '' : editorPlaceholder, disabled: editorDisabled, onSubmit: handleSubmit, onArrowUpAtStart: handleArrowUpAtStart, onArrowDownAtEnd: handleArrowDownAtEnd, onEmptyChange: setIsEmpty, onDocChange: handleDocChange, agents: agents, sessions: allSessions ?? [], currentSessionId: sessionId, spaceMentions: spaceMentions, commands: commands, actions: slashActions, files: slashFiles, onSelectAction: handleSelectAction, slashDockSelector: `#${dockId}`, onMenuOpenChange: setMenuOpen }) })] }), _jsx("input", { ref: fileInputRef, type: "file", accept: attachAccept ?? DEFAULT_ATTACH_ACCEPT, multiple: true, className: "hidden", onChange: handleFileSelect }), _jsx(ComposerToolbar, { noModel: programAgent, leading: inlineUnderbar ? (_jsx(ComposerUnderbar, { variant: "inline", agentPickerCompact: agentPickerCompact, onAttachClick: handleAttachClick, agents: primaryAgents, selectedAgent: selectedAgent, onAgentChange: onAgentChange, agentMenuOpen: agentMenuOpen, onAgentMenuOpenChange: setAgentMenuOpen, noAccessibleAgents: noAccessibleAgents, agentLocked: agentLocked, messages: messages, models: models, selectedModel: availableSelectedModel, onContextClick: onContextClick, agentsSlot: underbarSlot, chatInput: chatInput })) : null, pickersInChatInput: chatInputEnabled, modelsLoading: modelsLoading, models: models, selectedModel: availableSelectedModel, onModelChange: onModelChange, modelDefaultControls: modelDefaultControls, providers: providers, modelRequired: modelRequired, modelMenuOpen: modelMenuOpen, onModelMenuOpenChange: setModelMenuOpen, reasoningMenuOpen: reasoningMenuOpen, onReasoningMenuOpenChange: setReasoningMenuOpen, variants: variants, selectedVariant: selectedVariant, onVariantChange: onVariantChange, projectId: projectId,
120
125
  // Inline placement has no under-row, so the slot (the session
121
126
  // overrides gear, meta indicator) rides the toolbar itself. With
122
127
  // the 'below' placement the ComposerUnderbar further down renders
@@ -124,5 +129,5 @@ agents = EMPTY_AGENTS, commands = EMPTY_COMMANDS, slashFiles = EMPTY_SLASH_FILES
124
129
  toolbarSlot: inlineUnderbar ? toolbarSlot : undefined, rewind: rewind, isSending: isSending, isBusy: isBusy, onStop: onStop, stopDisabled: stopDisabled, canStop: canStop, escCount: escCount, lockForQuestion: lockForQuestion, questionButtonLabel: questionButtonLabel, submitLabel: submitLabel, questionCanAct: questionCanAct, hasText: !isEmpty, canSubmit: canSubmit, submitDisabled: submitDisabled ||
125
130
  attachmentFailed ||
126
131
  modelRejectingImages !== null ||
127
- commandAttachmentPlan.kind === 'refuse', attachmentFailed: attachmentFailed, attachmentUnsupported: imagesUnsupportedReason, disabled: disabled, modelUnavailable: modelUnavailable, agentUnavailable: agentUnavailable, call: call, onSubmit: () => handleSubmit() })] })] })] }), _jsx(ImagesUnsupportedBar, { modelName: noModelsConnected ? null : modelRejectingImages }), inlineUnderbar ? null : (_jsx(ComposerUnderbar, { onAttachClick: handleAttachClick, agents: primaryAgents, selectedAgent: selectedAgent, onAgentChange: onAgentChange, agentMenuOpen: agentMenuOpen, onAgentMenuOpenChange: setAgentMenuOpen, noAccessibleAgents: noAccessibleAgents, agentLocked: agentLocked, messages: messages, models: models, selectedModel: availableSelectedModel, onContextClick: onContextClick, toolbarSlot: toolbarSlot, agentsSlot: underbarSlot, chatInput: chatInput })), _jsx(ModelConnectionBar, { show: noModelsConnected }), slashMenuPlacement === 'below' && (_jsx("div", { id: dockId, className: "absolute top-full right-4 left-4 z-99 mt-3.5" }))] }));
132
+ commandAttachmentPlan.kind === 'refuse', attachmentFailed: attachmentFailed, attachmentUnsupported: imagesUnsupportedReason, disabled: disabled, modelUnavailable: modelUnavailable, agentUnavailable: agentUnavailable, call: call, onSubmit: () => handleSubmit() })] })] })] }), _jsx(ImagesUnsupportedBar, { modelName: noModelsConnected ? null : modelRejectingImages }), inlineUnderbar ? null : (_jsx(ComposerUnderbar, { onAttachClick: handleAttachClick, agents: primaryAgents, selectedAgent: selectedAgent, onAgentChange: onAgentChange, agentMenuOpen: agentMenuOpen, onAgentMenuOpenChange: setAgentMenuOpen, noAccessibleAgents: noAccessibleAgents, agentLocked: agentLocked, messages: messages, models: models, selectedModel: availableSelectedModel, onContextClick: onContextClick, toolbarSlot: toolbarSlot, agentsSlot: underbarSlot, chatInput: chatInput })), connectionsAbove ? null : _jsx(ModelConnectionBar, { show: noModelsConnected }), slashMenuPlacement === 'below' && (_jsx("div", { id: dockId, className: "absolute top-full right-4 left-4 z-99 mt-3.5" }))] }));
128
133
  }
@@ -14,6 +14,8 @@ export declare const FeaturedAgentsContext: import("react").Context<{
14
14
  * else the first selectable agent. One rule for the trigger and the chat composer.
15
15
  */
16
16
  export declare function resolveDisplayedAgentName(primaryAgents: Agent[], selectedAgent: string | null): string;
17
+ /** Is the displayed agent a program agent (`run`)? Its runtime listing names provider `program`: it has no model to pick. */
18
+ export declare function resolveProgramAgent(primaryAgents: Agent[], selectedAgent: string | null): boolean;
17
19
  /** The label `AgentSelector` shows for a selection (null = nothing picked). Other surfaces that name the agent reuse it. */
18
20
  export declare function agentDisplayLabel(agents: Agent[], selectedAgent: string | null): string;
19
21
  /**
@@ -36,6 +36,11 @@ export function resolveDisplayedAgentName(primaryAgents, selectedAgent) {
36
36
  const current = primaryAgents.find((a) => a.name === selectedAgent);
37
37
  return current?.name ?? selectedAgent ?? primaryAgents[0]?.name;
38
38
  }
39
+ /** Is the displayed agent a program agent (`run`)? Its runtime listing names provider `program`: it has no model to pick. */
40
+ export function resolveProgramAgent(primaryAgents, selectedAgent) {
41
+ const name = resolveDisplayedAgentName(primaryAgents, selectedAgent);
42
+ return primaryAgents.find((a) => a.name === name)?.model?.providerID === 'program';
43
+ }
39
44
  /** The label `AgentSelector` shows for a selection (null = nothing picked). Other surfaces that name the agent reuse it. */
40
45
  export function agentDisplayLabel(agents, selectedAgent) {
41
46
  const name = resolveDisplayedAgentName(composerSelectableAgents(agents), selectedAgent);
@@ -25,32 +25,8 @@ export declare const TILE_SURFACE = "border-border bg-popover relative block siz
25
25
  * the file, opens the lightbox). A tile with no handler carries no promise.
26
26
  */
27
27
  export declare const TILE_INTERACTIVE = "hover:bg-accent cursor-pointer transition-colors duration-fast active:scale-[0.96]";
28
- /**
29
- * Which files the tile shows AS A PICTURE. Raster images only. An SVG is text
30
- * that happens to draw — a logo file on a tile is a black blob at 100px, and
31
- * its name is what tells it from the next logo file (Jay, 2026-09-06). It
32
- * gets the named treatment, badge and all.
33
- */
34
- export declare function isPreviewableImage(filename: string, mime?: string): boolean;
35
- /** What the tile prints in the file's corner. Lowercase, from the name first
36
- * and the MIME subtype second; empty when neither says anything. */
37
- export declare function attachmentExtension(filename: string, mime?: string): string;
38
- /**
39
- * How a name is laid out on the tile.
40
- *
41
- * A short name wraps over two lines as the browser sees fit. A long one is
42
- * split: the first line is the head, ellipsized by CSS at the tile's edge, and
43
- * the second line is the last ten characters verbatim — the part that carries
44
- * the extension and tells `…-chatux.md` from `…-ux.md`. A single middle
45
- * ellipsis in one string wrapped wherever the browser chose, and left a
46
- * dangling hyphen at the end of line one (2026-09-06).
47
- */
48
- export declare const LONG_NAME_THRESHOLD = 24;
49
- export declare const NAME_TAIL_CHARS = 10;
50
- export declare function splitFilenameForTile(name: string): {
51
- head: string;
52
- tail: string;
53
- } | null;
28
+ /** The five tile rules live once in `@kortix/shared/session/attachment-tile`. */
29
+ export { LONG_NAME_THRESHOLD, NAME_TAIL_CHARS, attachmentExtension, isPreviewableImage, splitFilenameForTile, } from '../../_vendor/shared/session/attachment-tile.js';
54
30
  /** A tile previews the head of the paste only: the clamp shows four lines, and the DOM need not hold 100 kB. */
55
31
  export declare const PASTE_PREVIEW_CHARS = 400;
56
32
  export interface AttachmentTileProps {
@@ -3,6 +3,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
3
3
  import { Badge } from '../../primitives/badge.js';
4
4
  import { Close } from '../../icons/close.js';
5
5
  import { cn } from '../../lib/utils.js';
6
+ import { attachmentExtension, isPreviewableImage, splitFilenameForTile, } from '../../_vendor/kortix-shared.js';
6
7
  /** The square every attachment is. `size-28` (~103px on the 0.23rem scale) —
7
8
  * Jay's call, 2026-09-06: the 88px square read as cramped beside the name. */
8
9
  export const TILE_SURFACE = 'border-border bg-popover relative block size-28 shrink-0 overflow-hidden rounded-md border text-left';
@@ -11,53 +12,8 @@ export const TILE_SURFACE = 'border-border bg-popover relative block size-28 shr
11
12
  * the file, opens the lightbox). A tile with no handler carries no promise.
12
13
  */
13
14
  export const TILE_INTERACTIVE = 'hover:bg-accent cursor-pointer transition-colors duration-fast active:scale-[0.96]';
14
- /**
15
- * Which files the tile shows AS A PICTURE. Raster images only. An SVG is text
16
- * that happens to draw — a logo file on a tile is a black blob at 100px, and
17
- * its name is what tells it from the next logo file (Jay, 2026-09-06). It
18
- * gets the named treatment, badge and all.
19
- */
20
- export function isPreviewableImage(filename, mime) {
21
- const ext = attachmentExtension(filename, mime);
22
- if (ext === 'svg')
23
- return false;
24
- return (mime ?? '').toLowerCase().startsWith('image/');
25
- }
26
- /** What the tile prints in the file's corner. Lowercase, from the name first
27
- * and the MIME subtype second; empty when neither says anything. */
28
- export function attachmentExtension(filename, mime) {
29
- const dot = filename.lastIndexOf('.');
30
- if (dot > 0 && dot < filename.length - 1) {
31
- const ext = filename
32
- .slice(dot + 1)
33
- .trim()
34
- .toLowerCase();
35
- if (ext.length > 0 && ext.length <= 8 && !/\s/.test(ext))
36
- return ext;
37
- }
38
- const subtype = (mime ?? '').split('/')[1]?.split(';')[0]?.trim().toLowerCase() ?? '';
39
- if (!subtype)
40
- return '';
41
- // `svg+xml` → `svg`, `x-icon` → `icon`, `vnd.ms-excel` → `excel`.
42
- return subtype.split('+')[0].replace(/^x-/, '').split('.').pop() ?? '';
43
- }
44
- /**
45
- * How a name is laid out on the tile.
46
- *
47
- * A short name wraps over two lines as the browser sees fit. A long one is
48
- * split: the first line is the head, ellipsized by CSS at the tile's edge, and
49
- * the second line is the last ten characters verbatim — the part that carries
50
- * the extension and tells `…-chatux.md` from `…-ux.md`. A single middle
51
- * ellipsis in one string wrapped wherever the browser chose, and left a
52
- * dangling hyphen at the end of line one (2026-09-06).
53
- */
54
- export const LONG_NAME_THRESHOLD = 24;
55
- export const NAME_TAIL_CHARS = 10;
56
- export function splitFilenameForTile(name) {
57
- if (name.length <= LONG_NAME_THRESHOLD)
58
- return null;
59
- return { head: name.slice(0, -NAME_TAIL_CHARS), tail: name.slice(-NAME_TAIL_CHARS) };
60
- }
15
+ /** The five tile rules live once in `@kortix/shared/session/attachment-tile`. */
16
+ export { LONG_NAME_THRESHOLD, NAME_TAIL_CHARS, attachmentExtension, isPreviewableImage, splitFilenameForTile, } from '../../_vendor/kortix-shared.js';
61
17
  /** A tile previews the head of the paste only: the clamp shows four lines, and the DOM need not hold 100 kB. */
62
18
  export const PASTE_PREVIEW_CHARS = 400;
63
19
  /**