@truefoundry/trueforge-ui 0.2.4 → 0.3.0-rc.0

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 (58) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +41 -17
  3. package/dist/{ConnectorSettings-ODC3LVHN.js → ConnectorSettings-FXQ5B7TN.js} +5 -5
  4. package/dist/{DockLayout-TEOWEMSV.js → DockLayout-LBNQJZNF.js} +9 -9
  5. package/dist/{DrawerLayout-2JOQ4EDZ.js → DrawerLayout-Q6UK4VMI.js} +9 -9
  6. package/dist/{ModelSettings-CKQ5CVAC.js → ModelSettings-4L4LOQJA.js} +5 -5
  7. package/dist/OpenUiFenceBlock-6UIIAVBX.js +9 -0
  8. package/dist/{SandboxSettings-HSCPYUOC.js → SandboxSettings-Z4ZG6ZX4.js} +5 -5
  9. package/dist/{SettingsBuilder-MYWRFXRI.js → SettingsBuilder-WF7ZWKQW.js} +7 -7
  10. package/dist/{SidebarLayout-6MHQYW45.js → SidebarLayout-3WZ3CVON.js} +31 -14
  11. package/dist/SidebarLayout-3WZ3CVON.js.map +1 -0
  12. package/dist/{SkillSettings-ECH6SHZ7.js → SkillSettings-3EPPC3IT.js} +5 -5
  13. package/dist/{TrueForgeUIWithRouter-KMHPOKLN.js → TrueForgeUIWithRouter-NZ4FGPE4.js} +7 -7
  14. package/dist/{WidgetLayout-4ZIG3RXV.js → WidgetLayout-3QZ357FL.js} +10 -10
  15. package/dist/{WidgetLayout-4ZIG3RXV.js.map → WidgetLayout-3QZ357FL.js.map} +1 -1
  16. package/dist/chunk-36KOSC2J.js +567 -0
  17. package/dist/chunk-36KOSC2J.js.map +1 -0
  18. package/dist/{chunk-IWPDSPVA.js → chunk-3S6KHO7H.js} +292 -239
  19. package/dist/chunk-3S6KHO7H.js.map +1 -0
  20. package/dist/{chunk-PUFYHFND.js → chunk-7L63OK3O.js} +7 -7
  21. package/dist/{chunk-JRRCAKEP.js → chunk-B52K63AW.js} +2 -2
  22. package/dist/{chunk-FXCYLEFB.js → chunk-BSIPI3KV.js} +18 -2
  23. package/dist/chunk-BSIPI3KV.js.map +1 -0
  24. package/dist/{chunk-IFLE7OMM.js → chunk-FJ5RSSMA.js} +4 -4
  25. package/dist/{chunk-IFLE7OMM.js.map → chunk-FJ5RSSMA.js.map} +1 -1
  26. package/dist/{chunk-XRTTKGKN.js → chunk-OSV3HI5M.js} +746 -680
  27. package/dist/chunk-OSV3HI5M.js.map +1 -0
  28. package/dist/{chunk-255AE5NI.js → chunk-WREC7D54.js} +13 -11
  29. package/dist/chunk-WREC7D54.js.map +1 -0
  30. package/dist/{chunk-OZTNBS6V.js → chunk-ZXOADNF3.js} +4 -4
  31. package/dist/index.d.ts +179 -121
  32. package/dist/index.js +17 -9
  33. package/dist/index.js.map +1 -1
  34. package/dist/plugins/trueforge-agent-server-adapter/index.d.ts +1 -5
  35. package/dist/plugins/trueforge-agent-server-adapter/index.js +3 -0
  36. package/dist/plugins/trueforge-agent-server-adapter/index.js.map +1 -1
  37. package/dist/styles.css +1 -1
  38. package/package.json +5 -5
  39. package/dist/OpenUiFenceBlock-3EFPY4JW.js +0 -9
  40. package/dist/SidebarLayout-6MHQYW45.js.map +0 -1
  41. package/dist/chunk-255AE5NI.js.map +0 -1
  42. package/dist/chunk-72LC2M3R.js +0 -567
  43. package/dist/chunk-72LC2M3R.js.map +0 -1
  44. package/dist/chunk-FXCYLEFB.js.map +0 -1
  45. package/dist/chunk-IWPDSPVA.js.map +0 -1
  46. package/dist/chunk-XRTTKGKN.js.map +0 -1
  47. /package/dist/{ConnectorSettings-ODC3LVHN.js.map → ConnectorSettings-FXQ5B7TN.js.map} +0 -0
  48. /package/dist/{DockLayout-TEOWEMSV.js.map → DockLayout-LBNQJZNF.js.map} +0 -0
  49. /package/dist/{DrawerLayout-2JOQ4EDZ.js.map → DrawerLayout-Q6UK4VMI.js.map} +0 -0
  50. /package/dist/{ModelSettings-CKQ5CVAC.js.map → ModelSettings-4L4LOQJA.js.map} +0 -0
  51. /package/dist/{OpenUiFenceBlock-3EFPY4JW.js.map → OpenUiFenceBlock-6UIIAVBX.js.map} +0 -0
  52. /package/dist/{SandboxSettings-HSCPYUOC.js.map → SandboxSettings-Z4ZG6ZX4.js.map} +0 -0
  53. /package/dist/{SettingsBuilder-MYWRFXRI.js.map → SettingsBuilder-WF7ZWKQW.js.map} +0 -0
  54. /package/dist/{SkillSettings-ECH6SHZ7.js.map → SkillSettings-3EPPC3IT.js.map} +0 -0
  55. /package/dist/{TrueForgeUIWithRouter-KMHPOKLN.js.map → TrueForgeUIWithRouter-NZ4FGPE4.js.map} +0 -0
  56. /package/dist/{chunk-PUFYHFND.js.map → chunk-7L63OK3O.js.map} +0 -0
  57. /package/dist/{chunk-JRRCAKEP.js.map → chunk-B52K63AW.js.map} +0 -0
  58. /package/dist/{chunk-OZTNBS6V.js.map → chunk-ZXOADNF3.js.map} +0 -0
@@ -1,6 +1,7 @@
1
1
  import {
2
+ CustomActionRenderersProvider,
2
3
  notifyComposerBusyFailure
3
- } from "./chunk-FXCYLEFB.js";
4
+ } from "./chunk-BSIPI3KV.js";
4
5
  import {
5
6
  useAuiState
6
7
  } from "./chunk-M6MHLVSO.js";
@@ -9,13 +10,13 @@ import {
9
10
  ToasterProvider,
10
11
  modelPatchWithReasoningEffort,
11
12
  useToaster
12
- } from "./chunk-XRTTKGKN.js";
13
+ } from "./chunk-OSV3HI5M.js";
13
14
  import {
14
15
  DraftCatalogProvider,
15
16
  Spinner,
16
17
  getErrorMessage,
17
18
  useDraftCatalog
18
- } from "./chunk-IFLE7OMM.js";
19
+ } from "./chunk-FJ5RSSMA.js";
19
20
  import {
20
21
  DEFAULT_AGENT_CONFIG,
21
22
  ServerProvider,
@@ -26,7 +27,7 @@ import {
26
27
  } from "./chunk-WQULF5AT.js";
27
28
  import {
28
29
  cn
29
- } from "./chunk-72LC2M3R.js";
30
+ } from "./chunk-36KOSC2J.js";
30
31
 
31
32
  // src/containers/TrueFoundryChatProvider.tsx
32
33
  import { AssistantRuntimeProvider } from "@assistant-ui/react";
@@ -312,10 +313,10 @@ function useResolvedServer(config, onError) {
312
313
 
313
314
  // src/containers/TrueForgeUIShell.tsx
314
315
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
315
- var SidebarLayout = lazy(() => import("./SidebarLayout-6MHQYW45.js").then((m) => ({ default: m.SidebarLayout })));
316
- var DrawerLayout = lazy(() => import("./DrawerLayout-2JOQ4EDZ.js").then((m) => ({ default: m.DrawerLayout })));
317
- var DockLayout = lazy(() => import("./DockLayout-TEOWEMSV.js").then((m) => ({ default: m.DockLayout })));
318
- var WidgetLayout = lazy(() => import("./WidgetLayout-4ZIG3RXV.js").then((m) => ({ default: m.WidgetLayout })));
316
+ var SidebarLayout = lazy(() => import("./SidebarLayout-3WZ3CVON.js").then((m) => ({ default: m.SidebarLayout })));
317
+ var DrawerLayout = lazy(() => import("./DrawerLayout-Q6UK4VMI.js").then((m) => ({ default: m.DrawerLayout })));
318
+ var DockLayout = lazy(() => import("./DockLayout-LBNQJZNF.js").then((m) => ({ default: m.DockLayout })));
319
+ var WidgetLayout = lazy(() => import("./WidgetLayout-3QZ357FL.js").then((m) => ({ default: m.WidgetLayout })));
319
320
  var ShellRouteSync = lazy(() => import("./ShellRouteSync-T4WLY57Q.js").then((m) => ({ default: m.ShellRouteSync })));
320
321
  function LayoutFallback({ className }) {
321
322
  return /* @__PURE__ */ jsx2(
@@ -448,6 +449,7 @@ function TrueForgeUIShell(props) {
448
449
  initialSettingsOpen = false,
449
450
  server: serverConfig,
450
451
  onError,
452
+ customActionRenderers,
451
453
  resolvedRoutes,
452
454
  routes: _routes,
453
455
  ...providerRest
@@ -463,7 +465,7 @@ function TrueForgeUIShell(props) {
463
465
  }
464
466
  const server = resolved.server;
465
467
  const layoutTree = /* @__PURE__ */ jsx2(LayoutChildren, { layout, className });
466
- return /* @__PURE__ */ jsx2(SlotsProvider, { overrides, theme, children: /* @__PURE__ */ jsx2(ServerProvider, { server, children: /* @__PURE__ */ jsxs(ShellModeProvider, { agentConfig, initialSettingsOpen, children: [
468
+ return /* @__PURE__ */ jsx2(SlotsProvider, { overrides, theme, children: /* @__PURE__ */ jsx2(CustomActionRenderersProvider, { renderers: customActionRenderers, children: /* @__PURE__ */ jsx2(ServerProvider, { server, children: /* @__PURE__ */ jsxs(ShellModeProvider, { agentConfig, initialSettingsOpen, children: [
467
469
  resolvedRoutes != null ? /* @__PURE__ */ jsx2(Suspense, { fallback: null, children: /* @__PURE__ */ jsx2(
468
470
  ShellRouteSync,
469
471
  {
@@ -482,7 +484,7 @@ function TrueForgeUIShell(props) {
482
484
  children: layoutTree
483
485
  }
484
486
  )
485
- ] }) }) });
487
+ ] }) }) }) });
486
488
  }
487
489
 
488
490
  export {
@@ -490,4 +492,4 @@ export {
490
492
  ServerInitLoader,
491
493
  TrueForgeUIShell
492
494
  };
493
- //# sourceMappingURL=chunk-255AE5NI.js.map
495
+ //# sourceMappingURL=chunk-WREC7D54.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/containers/TrueFoundryChatProvider.tsx","../src/containers/TrueForgeUIShell.tsx","../src/atoms/draft/DraftSpecPreferenceBridge.tsx","../src/routing/RemoteIdRouteBridge.tsx","../src/containers/useResolvedServer.ts"],"sourcesContent":["'use client';\n\nimport { AssistantRuntimeProvider } from '@assistant-ui/react';\nimport {\n trueFoundryAttachmentAdapter,\n useTrueFoundryAgentRuntime,\n type TrueFoundryAgentConfig,\n type UseTrueFoundryAgentRuntimeOptions,\n} from '@truefoundry/assistant-ui-runtime';\nimport { useCallback, useMemo, type ReactNode } from 'react';\n\nimport { notifyComposerBusyFailure } from '../hooks/useComposerBusyState.js';\nimport type { AgentUIServer } from '../server/types.js';\nimport { ToasterProvider, useToaster } from './ToasterContainer.js';\n\ntype RuntimeAdapters = NonNullable<UseTrueFoundryAgentRuntimeOptions['adapters']>;\n\nexport type TrueFoundryChatProviderProps = {\n server: AgentUIServer;\n initialSessionId?: string;\n adapters?: RuntimeAdapters;\n onError?: (error: unknown) => void;\n children: ReactNode;\n /** Discriminated agent source. Prefer over legacy `agentName`. */\n agent?: TrueFoundryAgentConfig;\n /** Legacy named-agent shorthand. Prefer `agent: { mode: \"named\", agentName }`. */\n agentName?: string;\n /** Forwarded to `listSessions({ agentId })` for history filtering. */\n listSessionsAgentId?: string;\n};\n\nfunction ChatRuntimeScope({\n server,\n agent,\n agentName,\n listSessionsAgentId,\n initialSessionId,\n adapters,\n onError,\n children,\n}: {\n server: AgentUIServer;\n agent?: TrueFoundryAgentConfig;\n agentName?: string;\n listSessionsAgentId?: string;\n initialSessionId?: string;\n adapters?: RuntimeAdapters;\n onError?: (error: unknown) => void;\n children: ReactNode;\n}) {\n const { showError } = useToaster();\n const reportError = onError ?? showError;\n // composer().send() is void and swallows onNew rejections; clear optimistic\n // busy when the runtime reports a pre-stream failure (e.g. createSession).\n const resolvedOnError = useCallback(\n (error: unknown) => {\n notifyComposerBusyFailure();\n reportError(error);\n },\n [reportError],\n );\n\n const runtime = useTrueFoundryAgentRuntime({\n server: server as never,\n agent,\n agentName,\n listSessionsAgentId,\n initialSessionId,\n onError: resolvedOnError,\n adapters: {\n ...adapters,\n attachments: adapters?.attachments ?? trueFoundryAttachmentAdapter,\n },\n });\n\n return <AssistantRuntimeProvider runtime={runtime as never}>{children}</AssistantRuntimeProvider>;\n}\n\n/**\n * Chat shell: wires `useTrueFoundryAgentRuntime` from `server` and provides\n * assistant-ui + error toasts.\n */\nexport function TrueFoundryChatProvider(props: TrueFoundryChatProviderProps) {\n const { server, initialSessionId, adapters, onError, children, agent, agentName, listSessionsAgentId } = props;\n\n const stableServer = useMemo(() => server, [server]);\n\n return (\n <ToasterProvider>\n <ChatRuntimeScope\n server={stableServer}\n agent={agent}\n agentName={agentName}\n listSessionsAgentId={listSessionsAgentId}\n initialSessionId={initialSessionId}\n adapters={adapters}\n onError={onError}\n >\n {children}\n </ChatRuntimeScope>\n </ToasterProvider>\n );\n}\n","'use client';\n\nimport type { TrueFoundryAgentConfig, UseTrueFoundryAgentRuntimeOptions } from '@truefoundry/assistant-ui-runtime';\nimport { lazy, Suspense, useCallback, useMemo, useState, type ReactNode } from 'react';\n\nimport { DraftCatalogProvider } from '../atoms/draft/DraftCatalogProvider.js';\nimport { DraftSpecPreferenceBridge } from '../atoms/draft/DraftSpecPreferenceBridge.js';\nimport { cn } from '../atoms/lib/cn.js';\nimport { Spinner } from '../atoms/primitives/Spinner.js';\nimport { RemoteIdRouteBridge } from '../routing/RemoteIdRouteBridge.js';\nimport type { ResolvedRoutes, RoutesConfig } from '../routing/types.js';\nimport { CustomActionRenderersProvider, type CustomActionRenderers } from '../server/CustomActionRenderersContext.js';\nimport { ServerProvider } from '../server/ServerContext.js';\nimport { DEFAULT_AGENT_CONFIG, ShellModeProvider, useShellMode, type AgentConfig } from '../server/ShellModeContext.js';\nimport type { TrueForgeServerConfig } from '../server/TrueForgeServerConfig.js';\nimport { SlotsProvider, type SlotOverrides } from '../theme/SlotsProvider.js';\nimport type { LayoutProp, ThemeConfig } from '../theme/types.js';\nimport { getErrorMessage } from '../utils/getErrorMessage.js';\nimport { TrueFoundryChatProvider, type TrueFoundryChatProviderProps } from './TrueFoundryChatProvider.js';\nimport { useResolvedServer } from './useResolvedServer.js';\n\nconst SidebarLayout = lazy(() => import('../layouts/SidebarLayout.js').then(m => ({ default: m.SidebarLayout })));\nconst DrawerLayout = lazy(() => import('../layouts/DrawerLayout.js').then(m => ({ default: m.DrawerLayout })));\nconst DockLayout = lazy(() => import('../layouts/DockLayout.js').then(m => ({ default: m.DockLayout })));\nconst WidgetLayout = lazy(() => import('../layouts/WidgetLayout.js').then(m => ({ default: m.WidgetLayout })));\nconst ShellRouteSync = lazy(() => import('../routing/ShellRouteSync.js').then(m => ({ default: m.ShellRouteSync })));\n\nexport type ChatLayout = 'sidebar' | 'drawer' | 'dock' | 'widget';\n\ntype RuntimeAdapters = NonNullable<UseTrueFoundryAgentRuntimeOptions['adapters']>;\n\nexport type TrueForgeUIProps = {\n server: TrueForgeServerConfig;\n /** Built-in layout string or a custom layout component. Defaults to `\"sidebar\"`. */\n layout?: LayoutProp;\n overrides?: SlotOverrides;\n theme?: ThemeConfig;\n className?: string;\n initialSessionId?: string;\n adapters?: RuntimeAdapters;\n onError?: (error: unknown) => void;\n /**\n * Agent / library / composer shell mode.\n * Defaults to `{ mode: \"AgentLibraryWithComposer\" }`.\n */\n agentConfig?: AgentConfig;\n /** Open settings on first paint only (host boot with no models configured). */\n initialSettingsOpen?: boolean;\n /**\n * Host UI for pending client-side tools, keyed by tool name.\n * When a pending tool matches, the composer mounts that component instead of Ask User.\n */\n customActionRenderers?: CustomActionRenderers;\n /**\n * Sync shell navigation to the browser URL via react-router (opt-in).\n * Requires `react-router-dom` in the host. Leave off for dock/widget embeds\n * and hosts that own their own router. Defaults to `false`.\n */\n withRouter?: boolean;\n /** URL path customization; only honored when `withRouter`. */\n routes?: RoutesConfig;\n};\n\nexport type TrueForgeUIShellProps = Omit<TrueForgeUIProps, 'withRouter'> & { resolvedRoutes?: ResolvedRoutes };\n\nfunction LayoutFallback({ className }: { className?: string }) {\n return (\n <div\n className={className}\n style={{\n height: '100%',\n minHeight: '12rem',\n background:\n 'linear-gradient(90deg, color-mix(in oklab, var(--secondary-bg) 55%, transparent) 25%, color-mix(in oklab, var(--secondary-bg) 25%, transparent) 50%, color-mix(in oklab, var(--secondary-bg) 55%, transparent) 75%)',\n backgroundSize: '200% 100%',\n animation: 'tfy-aui-pulse 1.2s ease-in-out infinite',\n }}\n aria-hidden\n />\n );\n}\n\n/** Shown while `type: \"truefoundry\"` resolves the agent UI server. */\nexport function ServerInitLoader({ className }: { className?: string }) {\n return (\n <div\n role=\"status\"\n aria-live=\"polite\"\n aria-busy=\"true\"\n className={cn(\n 'flex h-full min-h-48 w-full flex-1 items-center justify-center bg-primary-bg text-text-secondary',\n className,\n )}\n >\n <Spinner size={28} className=\"text-text-primary\" />\n <span className=\"sr-only\">Loading</span>\n </div>\n );\n}\n\nfunction ServerInitError({ error, className }: { error: unknown; className?: string }) {\n const message = getErrorMessage(error, 'Failed to initialize server');\n return (\n <div\n role=\"alert\"\n className={cn(\n 'flex h-full min-h-48 items-center justify-center bg-primary-bg px-6 text-center text-sm text-failure-bg',\n className,\n )}\n >\n {message}\n </div>\n );\n}\n\nfunction isBuiltInLayout(layout: LayoutProp): layout is ChatLayout {\n return layout === 'sidebar' || layout === 'drawer' || layout === 'dock' || layout === 'widget';\n}\n\nfunction BuiltInLayoutView({ layout, className }: { layout: ChatLayout; className?: string }) {\n switch (layout) {\n case 'sidebar':\n return <SidebarLayout className={className} />;\n case 'drawer':\n return <DrawerLayout className={className} />;\n case 'dock':\n return <DockLayout className={className} />;\n case 'widget':\n return <WidgetLayout className={className} />;\n }\n}\n\nfunction LayoutChildren({ layout, className }: { layout: LayoutProp; className?: string }) {\n if (isBuiltInLayout(layout)) {\n return (\n <Suspense fallback={<LayoutFallback className={className} />}>\n <BuiltInLayoutView layout={layout} className={className} />\n </Suspense>\n );\n }\n const HostLayout = layout;\n return <HostLayout className={className} />;\n}\n\nfunction ChatProviderFromShell({\n children,\n initialSessionId: hostInitialSessionId,\n onRemoteIdChange,\n ...providerRest\n}: {\n children: ReactNode;\n /** When routing, reports the active thread's remote id up to `ShellRouteSync`. */\n onRemoteIdChange?: (id: string | undefined) => void;\n} & Omit<TrueFoundryChatProviderProps, 'agent' | 'agentName' | 'listSessionsAgentId' | 'children'>) {\n const { mode, runtimeKey, listSessionsAgentId, pendingSessionId } = useShellMode();\n\n // Freeze draft seed for the life of this runtimeKey so bindMutableAgent (identity /\n // instructions on shell) does not push a new defaultAgentSpec into the runtime.\n const draftDefaultAgentSpec = useMemo(() => {\n if (mode.status === 'active' && mode.isMutable) {\n return mode.agentSpec ?? { model: { name: 'openai-main/gpt-4.1' } };\n }\n return { model: { name: 'openai-main/gpt-4.1' } };\n // runtimeKey is the remount boundary for mutable chats.\n // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally keyed on runtimeKey only\n }, [runtimeKey]);\n\n const agent: TrueFoundryAgentConfig = useMemo(() => {\n // idle uses a placeholder draft so layout chrome (useAui) still mounts;\n // layouts render an empty CTA instead of the thread.\n if (mode.status === 'idle') {\n return {\n mode: 'draft',\n defaultAgentSpec: { model: { name: 'openai-main/gpt-4.1' } },\n };\n }\n // Runtime still uses named|draft; shell mutability maps onto that adapter.\n if (!mode.isMutable) {\n const agentName = mode.agentName ?? mode.agentId ?? pendingSessionId;\n if (agentName == null) {\n // Active immutable without identity should not happen; keep chrome mounted.\n return {\n mode: 'draft',\n defaultAgentSpec: { model: { name: 'openai-main/gpt-4.1' } },\n };\n }\n return { mode: 'named', agentName };\n }\n return {\n mode: 'draft',\n defaultAgentSpec: draftDefaultAgentSpec,\n };\n }, [mode, draftDefaultAgentSpec, pendingSessionId]);\n\n return (\n <TrueFoundryChatProvider\n key={runtimeKey}\n {...providerRest}\n agent={agent}\n listSessionsAgentId={listSessionsAgentId}\n initialSessionId={pendingSessionId ?? hostInitialSessionId}\n >\n <DraftCatalogProvider>\n <DraftSpecPreferenceBridge />\n {onRemoteIdChange != null ? <RemoteIdRouteBridge onRemoteIdChange={onRemoteIdChange} /> : null}\n {children}\n </DraftCatalogProvider>\n </TrueFoundryChatProvider>\n );\n}\n\n/** Internal shell. `resolvedRoutes` present iff mounted under `TrueForgeUIWithRouter`. */\nexport function TrueForgeUIShell(props: TrueForgeUIShellProps) {\n const {\n layout = 'sidebar',\n overrides,\n theme,\n className,\n agentConfig = DEFAULT_AGENT_CONFIG,\n initialSettingsOpen = false,\n server: serverConfig,\n onError,\n customActionRenderers,\n resolvedRoutes,\n routes: _routes,\n ...providerRest\n } = props;\n\n const resolved = useResolvedServer(serverConfig, onError);\n const [activeRemoteId, setActiveRemoteId] = useState<string | undefined>(undefined);\n const handleRemoteIdChange = useCallback((id: string | undefined) => setActiveRemoteId(id), []);\n\n if (resolved.status === 'loading') {\n return (\n <SlotsProvider overrides={overrides} theme={theme}>\n <ServerInitLoader className={className} />\n </SlotsProvider>\n );\n }\n\n if (resolved.status === 'error') {\n return (\n <SlotsProvider overrides={overrides} theme={theme}>\n <ServerInitError error={resolved.error} className={className} />\n </SlotsProvider>\n );\n }\n\n const server = resolved.server;\n const layoutTree = <LayoutChildren layout={layout} className={className} />;\n\n return (\n <SlotsProvider overrides={overrides} theme={theme}>\n <CustomActionRenderersProvider renderers={customActionRenderers}>\n <ServerProvider server={server}>\n <ShellModeProvider agentConfig={agentConfig} initialSettingsOpen={initialSettingsOpen}>\n {resolvedRoutes != null ? (\n <Suspense fallback={null}>\n <ShellRouteSync\n routes={resolvedRoutes}\n activeRemoteId={activeRemoteId}\n initialSettingsOpen={initialSettingsOpen}\n />\n </Suspense>\n ) : null}\n <ChatProviderFromShell\n server={server}\n onError={onError}\n onRemoteIdChange={resolvedRoutes != null ? handleRemoteIdChange : undefined}\n {...providerRest}\n >\n {layoutTree}\n </ChatProviderFromShell>\n </ShellModeProvider>\n </ServerProvider>\n </CustomActionRenderersProvider>\n </SlotsProvider>\n );\n}\n","'use client';\n\nimport { useTrueFoundryAgentSpec, useTrueFoundryUpdateAgentSpec } from '@truefoundry/assistant-ui-runtime';\nimport { useEffect } from 'react';\n\nimport { withCapabilitiesSandbox } from '../../server/draftSpecPreferences.js';\nimport { useServerCapabilities } from '../../server/ServerContext.js';\nimport { useShellMode } from '../../server/ShellModeContext.js';\nimport type { AgentSkill, AgentSpec, ConnectorState, ModelSelection } from '../../server/types.js';\nimport { useDraftCatalog } from './DraftCatalogProvider.js';\nimport { modelPatchWithReasoningEffort } from './reasoningEffort.js';\n\nfunction mountName(mount: object): string | null {\n const name = Reflect.get(mount, 'name');\n return typeof name === 'string' ? name : null;\n}\n\nfunction filterMounts<T extends object>(mounts: T[] | undefined, availableNames: Set<string>): T[] | undefined {\n if (mounts === undefined) return undefined;\n const filtered = mounts.filter(mount => {\n const name = mountName(mount);\n return name !== null && availableNames.has(name);\n });\n return filtered.length === mounts.length ? mounts : filtered;\n}\n\nexport function reconcileDraftSpecPreferences({\n agentSpec,\n models,\n skills,\n connectors,\n skillsEnabled,\n}: {\n agentSpec: AgentSpec;\n models: ModelSelection[];\n skills: AgentSkill[];\n connectors: ConnectorState[];\n skillsEnabled: boolean | undefined;\n}): Partial<AgentSpec> {\n const update: Partial<AgentSpec> = {};\n const selectedModel = agentSpec.model.name.trim();\n if (!models.some(model => model.name === selectedModel)) {\n const fallback = models[0];\n if (fallback !== undefined) {\n update.model = modelPatchWithReasoningEffort(\n fallback.name,\n agentSpec.model.params,\n fallback.properties.reasoningEfforts,\n );\n }\n }\n\n const nextMcpServers = filterMounts(agentSpec.mcpServers, new Set(connectors.map(connector => connector.name)));\n if (nextMcpServers !== agentSpec.mcpServers) {\n update.mcpServers = nextMcpServers;\n }\n\n if (skillsEnabled === false) {\n // Only clear when there is something to clear — a fresh `[]` each call would\n // fail reference equality and loop `updateAgentSpec` forever.\n if (agentSpec.skills !== undefined && agentSpec.skills.length > 0) {\n update.skills = [];\n }\n } else {\n const nextSkills = filterMounts(agentSpec.skills, new Set(skills.map(skill => skill.name)));\n if (nextSkills !== agentSpec.skills) {\n update.skills = nextSkills;\n }\n }\n\n return update;\n}\n\nexport function reconcileDraftSandbox({\n agentSpec,\n sandboxEnabled,\n}: {\n agentSpec: AgentSpec;\n sandboxEnabled: boolean | null | undefined;\n}): Partial<AgentSpec> {\n const nextSpec = withCapabilitiesSandbox(agentSpec, sandboxEnabled);\n return nextSpec === agentSpec ? {} : { config: nextSpec.config };\n}\n\n/**\n * Mirrors plain-draft composer choices into the shell seed and removes catalog\n * entries that disappeared since those choices were stored.\n */\nexport function DraftSpecPreferenceBridge() {\n const { mode, pendingSessionId, rememberDraftSpec } = useShellMode();\n const { agentSpec } = useTrueFoundryAgentSpec();\n const updateAgentSpec = useTrueFoundryUpdateAgentSpec();\n const capabilities = useServerCapabilities();\n const sandboxEnabled = capabilities?.sandbox.enabled;\n const { models, skills, connectors, loaded, error, ensureLoaded } = useDraftCatalog();\n const isPlainDraft = mode.status === 'active' && mode.isMutable && mode.agentId == null && pendingSessionId == null;\n\n useEffect(() => {\n if (isPlainDraft) ensureLoaded();\n }, [ensureLoaded, isPlainDraft]);\n\n useEffect(() => {\n if (isPlainDraft && agentSpec != null) {\n rememberDraftSpec(agentSpec);\n }\n }, [agentSpec, isPlainDraft, rememberDraftSpec]);\n\n useEffect(() => {\n if (!isPlainDraft || agentSpec == null || updateAgentSpec == null) return;\n const update = reconcileDraftSandbox({ agentSpec, sandboxEnabled });\n if (Object.keys(update).length > 0) {\n updateAgentSpec(update);\n }\n }, [agentSpec, isPlainDraft, sandboxEnabled, updateAgentSpec]);\n\n useEffect(() => {\n if (!isPlainDraft || agentSpec == null || updateAgentSpec == null || !loaded || error != null) return;\n\n const update = reconcileDraftSpecPreferences({\n agentSpec,\n models,\n skills,\n connectors,\n skillsEnabled: capabilities?.skill.enabled,\n });\n if (Object.keys(update).length > 0) {\n updateAgentSpec(update);\n }\n }, [\n agentSpec,\n capabilities?.skill.enabled,\n connectors,\n error,\n isPlainDraft,\n loaded,\n models,\n skills,\n updateAgentSpec,\n ]);\n\n return null;\n}\n","'use client';\n\nimport { useEffect } from 'react';\n\nimport { useAuiState } from '../assistant-ui.js';\n\n/**\n * Observes the active thread's remote id (assigned once a fresh chat persists)\n * and lifts it to the parent so `ShellRouteSync` can mirror it to `/sessions/:id`.\n * Lives inside the chat runtime, so it remounts with `runtimeKey`; reporting is\n * idempotent, so that is harmless. Carries no react-router dependency.\n */\nexport function RemoteIdRouteBridge({ onRemoteIdChange }: { onRemoteIdChange: (id: string | undefined) => void }) {\n const remoteId = useAuiState(s => s.threadListItem.remoteId);\n useEffect(() => {\n onRemoteIdChange(remoteId ?? undefined);\n }, [remoteId, onRemoteIdChange]);\n return null;\n}\n","'use client';\n\nimport { createTrueFoundryAgentUIServer } from '@truefoundry/assistant-ui-runtime/plugins/truefoundry-agent-server-adapter';\nimport { useEffect, useState } from 'react';\n\nimport type { TrueForgeBuiltInServerConfig, TrueForgeServerConfig } from '../server/TrueForgeServerConfig.js';\nimport type { AgentBuilderCapabilitiesResponse, AgentUIServer, CatalogServer } from '../server/types.js';\n\nexport type ResolvedServerState =\n | { status: 'loading'; server: null; error: null }\n | { status: 'ready'; server: AgentUIServer; error: null }\n | { status: 'error'; server: null; error: unknown };\n\n/** Fallback when an older runtime adapter omits `getCapabilities`. */\nconst DEFAULT_CAPABILITIES = {\n data: {\n sandbox: { enabled: true },\n skill: { enabled: true },\n settings: { enabled: true },\n },\n} satisfies AgentBuilderCapabilitiesResponse;\n\nfunction isBuiltInConfig(config: TrueForgeServerConfig): config is TrueForgeBuiltInServerConfig {\n return (\n typeof config === 'object' &&\n config !== null &&\n 'type' in config &&\n (config.type === 'truefoundry' || config.type === 'trueforge')\n );\n}\n\nfunction hasGetCapabilities(\n server: object,\n): server is { getCapabilities: () => Promise<AgentBuilderCapabilitiesResponse> } {\n return typeof Reflect.get(server, 'getCapabilities') === 'function';\n}\n\n/**\n * Attach optional catalog and ensure `getCapabilities` exists on the composed port.\n */\nfunction toAgentUIServer(server: object, catalog: CatalogServer | undefined): AgentUIServer {\n const getCapabilities = hasGetCapabilities(server)\n ? () => server.getCapabilities()\n : async () => DEFAULT_CAPABILITIES;\n const withCapabilities = { ...server, getCapabilities };\n const withCatalog = catalog != null ? { ...withCapabilities, catalog } : withCapabilities;\n if (!isAgentUIServer(withCatalog)) {\n throw new Error('TrueForgeUI: runtime adapter returned an incomplete AgentUIServer');\n }\n return withCatalog;\n}\n\nfunction isAgentUIServer(value: object): value is AgentUIServer {\n return (\n typeof Reflect.get(value, 'createSession') === 'function' &&\n typeof Reflect.get(value, 'listSessions') === 'function' &&\n typeof Reflect.get(value, 'getSession') === 'function' &&\n typeof Reflect.get(value, 'updateSession') === 'function' &&\n typeof Reflect.get(value, 'createTurn') === 'function' &&\n typeof Reflect.get(value, 'cancelSession') === 'function' &&\n typeof Reflect.get(value, 'listTurns') === 'function' &&\n typeof Reflect.get(value, 'getTurn') === 'function' &&\n typeof Reflect.get(value, 'listEvents') === 'function' &&\n typeof Reflect.get(value, 'getCapabilities') === 'function' &&\n typeof Reflect.get(value, 'getModels') === 'function' &&\n typeof Reflect.get(value, 'getSkills') === 'function' &&\n typeof Reflect.get(value, 'getMcp') === 'function' &&\n typeof Reflect.get(value, 'searchAgents') === 'function' &&\n typeof Reflect.get(value, 'saveAgent') === 'function'\n );\n}\n\n/**\n * Resolves a {@link TrueForgeServerConfig} to an {@link AgentUIServer}.\n * - `AgentUIServer` — sync passthrough\n * - `truefoundry` — async via `createTrueFoundryAgentUIServer`\n * - `trueforge` — via dynamic import of the Harness plugin adapter\n */\nexport function useResolvedServer(\n config: TrueForgeServerConfig,\n onError?: (error: unknown) => void,\n): ResolvedServerState {\n const builtIn = isBuiltInConfig(config) ? config : null;\n const directServer: AgentUIServer | null = isBuiltInConfig(config) ? null : config;\n const type = builtIn?.type;\n const apiKey = builtIn?.type === 'truefoundry' ? builtIn.apiKey : '';\n const controlPlaneURL = builtIn?.type === 'truefoundry' ? builtIn.controlPlaneURL : '';\n const gatewayPlaneURL = builtIn?.type === 'truefoundry' ? (builtIn.gatewayPlaneURL ?? '') : '';\n const trueforgeBaseUrl = builtIn?.type === 'trueforge' ? (builtIn.baseUrl ?? '') : '';\n const trueforgeToken = builtIn?.type === 'trueforge' ? (builtIn.token ?? '') : '';\n const trueforgeFetch = builtIn?.type === 'trueforge' ? builtIn.fetch : undefined;\n const catalog = builtIn?.catalog;\n\n const [state, setState] = useState<ResolvedServerState>(() => {\n if (directServer) {\n return { status: 'ready', server: directServer, error: null };\n }\n return { status: 'loading', server: null, error: null };\n });\n\n useEffect(() => {\n if (directServer) {\n setState({ status: 'ready', server: directServer, error: null });\n return;\n }\n\n let cancelled = false;\n setState({ status: 'loading', server: null, error: null });\n\n const resolve = async (): Promise<AgentUIServer> => {\n if (type === 'trueforge') {\n const { createTrueForgeAgentUIServer } = await import('../plugins/trueforge-agent-server-adapter/index.js');\n return createTrueForgeAgentUIServer({\n ...(trueforgeBaseUrl ? { baseUrl: trueforgeBaseUrl } : {}),\n ...(trueforgeToken ? { token: trueforgeToken } : {}),\n ...(trueforgeFetch !== undefined ? { fetch: trueforgeFetch } : {}),\n ...(catalog != null ? { catalog } : {}),\n });\n }\n\n const runtimeServer = await createTrueFoundryAgentUIServer({\n apiKey,\n cpURL: controlPlaneURL,\n ...(gatewayPlaneURL ? { gatewayURL: gatewayPlaneURL } : {}),\n });\n // TrueFoundry adapter may omit catalog; attach host-supplied catalog here.\n return toAgentUIServer(runtimeServer, catalog);\n };\n\n void resolve()\n .then(server => {\n if (cancelled) return;\n try {\n // trueforge factory already includes catalog; still normalize capabilities.\n setState({\n status: 'ready',\n server: type === 'trueforge' ? toAgentUIServer(server, undefined) : server,\n error: null,\n });\n } catch (error: unknown) {\n onError?.(error);\n setState({ status: 'error', server: null, error });\n }\n })\n .catch((error: unknown) => {\n if (cancelled) return;\n onError?.(error);\n setState({ status: 'error', server: null, error });\n });\n\n return () => {\n cancelled = true;\n };\n }, [\n type,\n directServer,\n apiKey,\n controlPlaneURL,\n gatewayPlaneURL,\n trueforgeBaseUrl,\n trueforgeToken,\n trueforgeFetch,\n catalog,\n onError,\n ]);\n\n return state;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,gCAAgC;AACzC;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,aAAa,eAA+B;AAkE5C;AA5CT,SAAS,iBAAiB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GASG;AACD,QAAM,EAAE,UAAU,IAAI,WAAW;AACjC,QAAM,cAAc,WAAW;AAG/B,QAAM,kBAAkB;AAAA,IACtB,CAAC,UAAmB;AAClB,gCAA0B;AAC1B,kBAAY,KAAK;AAAA,IACnB;AAAA,IACA,CAAC,WAAW;AA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B,GAChE;AAAA,EAEJ;AAEA,QAAM,SAAS,SAAS;AACxB,QAAM,aAAa,gBAAAA,KAAC,kBAAe,QAAgB,WAAsB;AAEzE,SACE,gBAAAA,KAAC,iBAAc,WAAsB,OACnC,0BAAAA,KAAC,iCAA8B,WAAW,uBACxC,0BAAAA,KAAC,kBAAe,QACd,+BAAC,qBAAkB,aAA0B,qBAC1C;AAAA,sBAAkB,OACjB,gBAAAA,KAAC,YAAS,UAAU,MAClB,0BAAAA;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR;AAAA,QACA;AAAA;AAAA,IACF,GACF,IACE;AAAA,IACJ,gBAAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,kBAAkB,kBAAkB,OAAO,uBAAuB;AAAA,QACjE,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,KACF,GACF,GACF,GACF;AAEJ;","names":["useCallback","useMemo","useState","useEffect","useEffect","useEffect","jsx","useMemo","useState","useCallback"]}
@@ -2,11 +2,11 @@ import {
2
2
  Tooltip,
3
3
  useNamedAgentHeaderState,
4
4
  useSlot
5
- } from "./chunk-XRTTKGKN.js";
5
+ } from "./chunk-OSV3HI5M.js";
6
6
  import {
7
7
  Icon,
8
8
  auiButtonClass
9
- } from "./chunk-IFLE7OMM.js";
9
+ } from "./chunk-FJ5RSSMA.js";
10
10
  import {
11
11
  useOptionalCatalogServer,
12
12
  useOptionalShellMode,
@@ -15,7 +15,7 @@ import {
15
15
  import {
16
16
  cn,
17
17
  useTheme
18
- } from "./chunk-72LC2M3R.js";
18
+ } from "./chunk-36KOSC2J.js";
19
19
 
20
20
  // src/atoms/NamedAgentHeaderLabel.tsx
21
21
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -72,4 +72,4 @@ export {
72
72
  NamedAgentHeaderLabel,
73
73
  ShellActions
74
74
  };
75
- //# sourceMappingURL=chunk-OZTNBS6V.js.map
75
+ //# sourceMappingURL=chunk-ZXOADNF3.js.map
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import react__default, { ComponentPropsWithRef, ComponentProps, ComponentType, ReactNode, HTMLAttributes, CSSProperties, FC, SVGProps, ComponentPropsWithoutRef, PropsWithChildren } from 'react';
2
+ import react__default, { CSSProperties, ReactNode, FC, SVGProps, ComponentType, ComponentPropsWithRef, ComponentProps, HTMLAttributes, ComponentPropsWithoutRef, PropsWithChildren } from 'react';
3
3
  import { LucideIcon } from 'lucide-react';
4
4
  import { MessagePrimitive, ToolCallMessagePartComponent } from '@assistant-ui/react';
5
5
  export { AssistantState, useAui, useAuiState } from '@assistant-ui/react';
@@ -10,18 +10,157 @@ export { AgentBuilderCapabilitiesResponse, AgentBuilderServer, AgentChatServer,
10
10
  export { C as CreateTrueFoundryServerOptions, T as TrueFoundryServer, c as createTrueFoundryServer } from './createTrueFoundryServer-B72bU-J7.js';
11
11
  import { PartState } from '@assistant-ui/core/react';
12
12
 
13
- /** Configured brand name, or the SDK default. Safe outside a `ThemeProvider`. */
14
- declare function useBrandName(): string;
13
+ type ThemeMode = 'light' | 'dark' | 'system';
14
+ type ThemePreset = 'trueforge' | 'claude' | 'chatgpt' | 'gemini';
15
+ type SemanticTokens = {
16
+ sidebarBg: string;
17
+ topbarBg: string;
18
+ primaryBg: string;
19
+ secondaryBg: string;
20
+ border: string;
21
+ fontFamily: string;
22
+ inputBoxBg: string;
23
+ inputBorder: string;
24
+ textPrimary: string;
25
+ textSecondary: string;
26
+ cardBg: string;
27
+ dropdownSelectedItemBg: string;
28
+ dropdownSelectedItemText: string;
29
+ userMessageBg: string;
30
+ userMessageText: string;
31
+ assistantMessageBg: string;
32
+ assistantMessageText: string;
33
+ primaryButtonBg: string;
34
+ primaryButtonHover: string;
35
+ primaryButtonText: string;
36
+ secondaryButtonBg: string;
37
+ secondaryButtonHover: string;
38
+ secondaryButtonText: string;
39
+ ghostButtonBg: string;
40
+ ghostButtonHover: string;
41
+ ghostButtonText: string;
42
+ successBg: string;
43
+ successText: string;
44
+ failureBg: string;
45
+ failureText: string;
46
+ warningBg: string;
47
+ warningText: string;
48
+ focusRing: string;
49
+ radius: string;
50
+ composerRadius: string;
51
+ overlay: string;
52
+ shadowColor: string;
53
+ scrollbarThumb: string;
54
+ };
55
+ type IconProps$1 = {
56
+ className?: string;
57
+ style?: CSSProperties;
58
+ size?: string | number;
59
+ 'aria-hidden'?: boolean | 'true' | 'false';
60
+ 'aria-label'?: string;
61
+ 'data-testid'?: string;
62
+ };
63
+ type IconComponent = LucideIcon | ((props: IconProps$1) => ReactNode) | FC<SVGProps<SVGSVGElement>>;
64
+ type IconEntry = IconComponent | ReactNode;
65
+ type IconMap = Record<string, IconEntry>;
15
66
  /**
16
- * The product mark: `theme.brand.logo` resolved against the active theme mode,
17
- * labelled with the brand name, and linked when the config carries an `href`.
18
- * Falls back to the default mark when no logo is configured.
19
- *
20
- * Callers that also want the name as text render it themselves — the SDK layouts
21
- * pair this with `useBrandName()` so each one controls its own arrangement.
67
+ * Brand image sources. `light` / `dark` pick per resolved theme mode and fall
68
+ * back to each other, then to `src`.
69
+ */
70
+ type BrandLogoConfig = {
71
+ src?: string;
72
+ light?: string;
73
+ dark?: string;
74
+ };
75
+ type BrandImage = string | BrandLogoConfig;
76
+ /** Chrome look for `theme.brand`. Omit `brand` entirely for the default TrueForge marks. */
77
+ type BrandMode = 'icon-title' | 'icon-only' | 'logo';
78
+ /**
79
+ * Product branding. Set `mode`, then pass the fields that mode requires.
80
+ * `name` always labels the mark (`alt` / `aria-label`).
81
+ */
82
+ type BrandConfig = {
83
+ mode: 'icon-title';
84
+ /** Accessible label and visible title beside the square mark in expanded chrome. */
85
+ name: string;
86
+ /** Square image, or per-mode sources. Omit to keep the default mark. */
87
+ icon?: BrandImage;
88
+ logo?: never;
89
+ /** Wraps configured brand images in a same-tab link. */
90
+ href?: string;
91
+ } | {
92
+ mode: 'icon-only';
93
+ /** Accessible label only — no title text in expanded chrome. */
94
+ name: string;
95
+ /** Square image, or per-mode sources. */
96
+ icon: BrandImage;
97
+ logo?: never;
98
+ /** Wraps configured brand images in a same-tab link. */
99
+ href?: string;
100
+ } | {
101
+ mode: 'logo';
102
+ /** Accessible label only — wide logo replaces the text title in expanded chrome. */
103
+ name: string;
104
+ /** Square image, or per-mode sources, used when compact. */
105
+ icon: BrandImage;
106
+ /** Wider image, or per-mode sources, used when expanded. */
107
+ logo: BrandImage;
108
+ /** Wraps configured brand images in a same-tab link. */
109
+ href?: string;
110
+ };
111
+ type ContentClassNames = {
112
+ markdown?: string;
113
+ inlineCode?: string;
114
+ syntaxHighlighter?: {
115
+ root?: string;
116
+ pre?: string;
117
+ code?: string;
118
+ lineNumber?: string;
119
+ };
120
+ openui?: {
121
+ root?: string;
122
+ scope?: string;
123
+ };
124
+ monaco?: {
125
+ root?: string;
126
+ editor?: string;
127
+ monacoTheme?: string;
128
+ };
129
+ };
130
+ type ThemeConfig = {
131
+ preset?: ThemePreset;
132
+ mode?: ThemeMode;
133
+ tokens?: Partial<SemanticTokens>;
134
+ brand?: BrandConfig;
135
+ className?: string;
136
+ icons?: IconMap;
137
+ classNames?: ContentClassNames;
138
+ };
139
+ type BuiltInLayout = 'sidebar' | 'drawer' | 'dock' | 'widget';
140
+ type LayoutProp = BuiltInLayout | ComponentType<{
141
+ className?: string;
142
+ }>;
143
+
144
+ /** Expanded / collapsed chrome choices derived from `theme.brand.mode`. */
145
+ type BrandChrome = {
146
+ expandedVariant: 'icon' | 'logo';
147
+ collapsedVariant: 'icon';
148
+ /** Whether to render `name` as visible text beside the mark in expanded chrome. */
149
+ showTitle: boolean;
150
+ };
151
+ /**
152
+ * Maps `brand.mode` to layout chrome. Layouts should not re-derive field combinations.
153
+ */
154
+ declare function resolveBrandChrome(brand: Partial<BrandConfig> | undefined): BrandChrome;
155
+ /** Configured display name, or the SDK default when no custom brand is set. */
156
+ declare function useBrandName(): string | undefined;
157
+ /**
158
+ * The product mark resolved against the active theme mode. Compact surfaces use
159
+ * `icon`; expanded surfaces use `logo` and fall back to `icon`.
22
160
  */
23
- declare function BrandLogo({ className }: {
161
+ declare function BrandLogo({ className, variant }: {
24
162
  className?: string;
163
+ variant?: 'icon' | 'logo';
25
164
  }): react.JSX.Element;
26
165
  declare module './SlotsProvider.js' {
27
166
  interface AtomSlots {
@@ -941,115 +1080,6 @@ declare const defaultSlots: {
941
1080
  ShellActionsActionSlot: typeof ShellActionsActionSlot;
942
1081
  };
943
1082
 
944
- type ThemeMode = 'light' | 'dark' | 'system';
945
- type ThemePreset = 'trueforge' | 'claude' | 'chatgpt' | 'gemini';
946
- type SemanticTokens = {
947
- sidebarBg: string;
948
- topbarBg: string;
949
- primaryBg: string;
950
- secondaryBg: string;
951
- border: string;
952
- fontFamily: string;
953
- inputBoxBg: string;
954
- inputBorder: string;
955
- textPrimary: string;
956
- textSecondary: string;
957
- cardBg: string;
958
- dropdownSelectedItemBg: string;
959
- dropdownSelectedItemText: string;
960
- userMessageBg: string;
961
- userMessageText: string;
962
- assistantMessageBg: string;
963
- assistantMessageText: string;
964
- primaryButtonBg: string;
965
- primaryButtonHover: string;
966
- primaryButtonText: string;
967
- secondaryButtonBg: string;
968
- secondaryButtonHover: string;
969
- secondaryButtonText: string;
970
- ghostButtonBg: string;
971
- ghostButtonHover: string;
972
- ghostButtonText: string;
973
- successBg: string;
974
- successText: string;
975
- failureBg: string;
976
- failureText: string;
977
- warningBg: string;
978
- warningText: string;
979
- focusRing: string;
980
- radius: string;
981
- composerRadius: string;
982
- overlay: string;
983
- shadowColor: string;
984
- scrollbarThumb: string;
985
- };
986
- type IconProps$1 = {
987
- className?: string;
988
- style?: CSSProperties;
989
- size?: string | number;
990
- 'aria-hidden'?: boolean | 'true' | 'false';
991
- 'aria-label'?: string;
992
- 'data-testid'?: string;
993
- };
994
- type IconComponent = LucideIcon | ((props: IconProps$1) => ReactNode) | FC<SVGProps<SVGSVGElement>>;
995
- type IconEntry = IconComponent | ReactNode;
996
- type IconMap = Record<string, IconEntry>;
997
- /**
998
- * Logo sources. `light` / `dark` pick per resolved theme mode and fall back to
999
- * each other, then to `src`. `href` wraps the logo in a same-tab link. The logo
1000
- * is labelled with `name`; replace the mark itself through the slot table when
1001
- * an image URL is not enough.
1002
- */
1003
- type BrandLogoConfig = {
1004
- src?: string;
1005
- light?: string;
1006
- dark?: string;
1007
- href?: string;
1008
- };
1009
- /**
1010
- * Setting `brand` requires a `name`: it labels the logo, so a logo without one has
1011
- * no accessible name. `logo` is optional — omit it to pair host text with the stock
1012
- * mark.
1013
- */
1014
- type BrandConfig = {
1015
- /** Display name, and the logo's accessible label. */
1016
- name: string;
1017
- /** Image URL, or per-mode sources. Omit to keep the default mark. */
1018
- logo?: string | BrandLogoConfig;
1019
- };
1020
- type ContentClassNames = {
1021
- markdown?: string;
1022
- inlineCode?: string;
1023
- syntaxHighlighter?: {
1024
- root?: string;
1025
- pre?: string;
1026
- code?: string;
1027
- lineNumber?: string;
1028
- };
1029
- openui?: {
1030
- root?: string;
1031
- scope?: string;
1032
- };
1033
- monaco?: {
1034
- root?: string;
1035
- editor?: string;
1036
- monacoTheme?: string;
1037
- };
1038
- };
1039
- type ThemeConfig = {
1040
- preset?: ThemePreset;
1041
- mode?: ThemeMode;
1042
- tokens?: Partial<SemanticTokens>;
1043
- brand?: BrandConfig;
1044
- className?: string;
1045
- icons?: IconMap;
1046
- classNames?: ContentClassNames;
1047
- };
1048
- type BuiltInLayout = 'sidebar' | 'drawer' | 'dock' | 'widget';
1049
- type LayoutProp = BuiltInLayout | ComponentType<{
1050
- className?: string;
1051
- }>;
1052
-
1053
1083
  type PresetTokens = {
1054
1084
  light: SemanticTokens;
1055
1085
  dark: SemanticTokens;
@@ -1190,6 +1220,9 @@ type ComposerContainerProps = {
1190
1220
  };
1191
1221
  declare function ComposerContainer({ placeholder, }: ComposerContainerProps): react.JSX.Element;
1192
1222
 
1223
+ /** Host custom-action UI for a pending client-side tool response. */
1224
+ declare function CustomActionContainer(): react.JSX.Element | null;
1225
+
1193
1226
  /**
1194
1227
  * Renders `HistoryLoader` at the top of the message list and fetches
1195
1228
  * the next older history page when the user scrolls near it. Scroll position
@@ -1264,10 +1297,11 @@ type ToolApprovalOption = {
1264
1297
  };
1265
1298
  type ToolApprovalContainerProps = {
1266
1299
  toolName?: string;
1300
+ argsText?: string;
1267
1301
  options: ToolApprovalOption[];
1268
1302
  onSelectOption: (optionId: string, reason?: string) => void;
1269
1303
  };
1270
- declare function ToolApprovalContainer({ toolName, options, onSelectOption }: ToolApprovalContainerProps): react.JSX.Element;
1304
+ declare function ToolApprovalContainer({ toolName, argsText, options, onSelectOption, }: ToolApprovalContainerProps): react.JSX.Element;
1271
1305
 
1272
1306
  declare const ToolCallContainer: ToolCallMessagePartComponent;
1273
1307
 
@@ -1426,6 +1460,22 @@ type RoutesConfig = {
1426
1460
  };
1427
1461
  };
1428
1462
 
1463
+ /** Props Trueforge passes to a host-registered custom action renderer. */
1464
+ type CustomActionRendererProps = {
1465
+ args: Record<string, unknown>;
1466
+ disabled: boolean;
1467
+ /** Resume the paused client-side tool with a non-empty string result. */
1468
+ onSubmit: (content: string) => void;
1469
+ };
1470
+ /** Map of client-side tool name → host UI for composer pause. */
1471
+ type CustomActionRenderers = Record<string, ComponentType<CustomActionRendererProps>>;
1472
+ declare function CustomActionRenderersProvider({ renderers, children, }: {
1473
+ renderers?: CustomActionRenderers;
1474
+ children: ReactNode;
1475
+ }): react.JSX.Element;
1476
+ /** Host-registered custom action renderers, or `undefined` when none were provided. */
1477
+ declare function useOptionalCustomActionRenderers(): CustomActionRenderers | undefined;
1478
+
1429
1479
  /**
1430
1480
  * Built-in backends init inside `<TrueForgeUI />`.
1431
1481
  * Optional `catalog` is attached onto the resolved `AgentUIServer`.
@@ -1471,6 +1521,11 @@ type TrueForgeUIProps = {
1471
1521
  agentConfig?: AgentConfig;
1472
1522
  /** Open settings on first paint only (host boot with no models configured). */
1473
1523
  initialSettingsOpen?: boolean;
1524
+ /**
1525
+ * Host UI for pending client-side tools, keyed by tool name.
1526
+ * When a pending tool matches, the composer mounts that component instead of Ask User.
1527
+ */
1528
+ customActionRenderers?: CustomActionRenderers;
1474
1529
  /**
1475
1530
  * Sync shell navigation to the browser URL via react-router (opt-in).
1476
1531
  * Requires `react-router-dom` in the host. Leave off for dock/widget embeds
@@ -1549,6 +1604,9 @@ type ThreadPauseState = {
1549
1604
  declare function threadHasPendingMcpAuth(s: ThreadPauseState): boolean;
1550
1605
  type ComposerPauseView = {
1551
1606
  kind: 'mcp';
1607
+ } | {
1608
+ kind: 'custom';
1609
+ toolName: string;
1552
1610
  } | {
1553
1611
  kind: 'ask-user';
1554
1612
  } | {
@@ -1622,4 +1680,4 @@ declare function DraftCatalogProvider({ children }: {
1622
1680
  }): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react.JSX.Element | null | undefined;
1623
1681
  declare function useDraftCatalog(): DraftCatalogValue;
1624
1682
 
1625
- export { type AgentConfig, type AgentStepPart, AgentStepsCard, type AgentStepsCardProps, AgentStepsContainer, type AgentStepsContainerProps, type AgentStepsSplitResult, AgentsLibrary, AgentsLibraryButton, type AgentsLibraryButtonProps, type AgentsLibraryProps, type AskUserAnswerDraft, type AnsweredQuestion as AskUserAnsweredQuestion, AskUserContainer, type AskUserPromptProps, type Question as AskUserQuestion, type AskUserPromptProps as AskUserQuestionCardProps, AssistantMessageBubble, type AssistantMessageBubbleProps, AssistantMessageContainer, AssistantTextContainer, type PublicAtomSlots as AtomSlots, AttachmentCard, type AttachmentCardProps, type AttachmentCardSize, AttachmentPickerButton, type AttachmentPickerButtonProps, AttachmentPreviewDialog, type AttachmentPreviewDialogProps, Avatar, AvatarFallback, type AvatarFallbackProps, AvatarImage, type AvatarImageProps, type AvatarProps, BottomSheet, type BottomSheetProps, type BrandConfig, BrandLogo, type BrandLogoConfig, type ButtonProps, type ButtonSize, type ButtonVariant, CenteredModal, type CenteredModalProps, ChatFileDownload, type ChatFileDownloadFile, type ChatFileDownloadProps, type ChatLayout, ClearChatButton, CodeEditor, type CodeEditorProps, ComposerAttachmentPickerContainer, ComposerAttachmentsContainer, ComposerBusyProvider, type ComposerBusyState, ComposerContainer, type ComposerContainerProps, ComposerLeftSection, type ComposerLeftSectionProps, type ComposerPauseView, ComposerRightSection, type ComposerRightSectionProps, ComposerSendButton, type ComposerSendButtonProps, ComposerShell, type ComposerShellProps, type ContentClassNames, DEFAULT_AGENT_CONFIG, DraftCatalogProvider, DraftComposerLeftSection, DraftComposerRightSection, DraftCompositeSelector, type DraftCompositeSelectorProps, DraftModelSelector, type DraftModelSelectorProps, HistoryLoader, HistoryLoaderContainer, type HistoryLoaderProps, Icon, type IconButtonProps, type IconMap, type IconProps, type LayoutProp, MCP_AUTH_POPUP_CHANNEL, Markdown, type MarkdownProps, type McpAuthCallback, type McpAuthPromptProps as McpAuthCardProps, McpAuthContainer, type McpAuthPopupMessage, type McpAuthPromptProps, type McpServer as McpAuthServer, MessageActionBar, type MessageActionBarProps, MessageAttachmentsContainer, MessageErrorBanner, type MessageErrorBannerProps, MessageGroup, type MessageGroupProps, MessageIndicator, type MessageIndicatorProps, MessageListSkeleton, type MessageListSkeletonProps, MessageTimestamp, type MessageTimestampProps, MonacoEditorCore, type MonacoEditorCoreProps, OpenUiFenceBlock, type OpenUiFenceBlockProps, PRESETS, PostMcpOauthScreen, type ReasoningCardProps, ReasoningContainer, ResumeUnavailable, ResumeUnavailableContainer, type ResumeUnavailableProps, type RoutePlace, type RoutesConfig, SandboxArtifactDownload, type SandboxArtifactDownloadProps, SandboxToolCallCard, type SandboxToolCallCardProps, SaveAgentButton, ScrollToBottomButton, type ScrollToBottomButtonProps, SelectAgentEmptyState, type SelectLibraryAgentRequest, type SemanticTokens, ServerProvider, ShellActionsActionSlot, type ShellMode, ShellModeProvider, type SlotOverrides, SlotsProvider, SubAgentCard, type SubAgentCardProps, Switch, type SwitchProps, type SwitchSize, SyntaxHighlighter, type SyntaxHighlighterProps, type ThemeConfig, type IconProps$1 as ThemeIconProps, type ThemeMode, type ThemePreset, ThemeProvider, Thread, ThreadComposerAreaShell, type ThreadComposerAreaShellProps, ThreadContainer, type ThreadContainerProps, type ThreadGroupPart, ThreadListContainer, type ThreadListContainerProps, ThreadListEmptyState, type ThreadListEmptyStateProps, ThreadListNewButton, type ThreadListNewButtonProps, ThreadListRow, type ThreadListRowProps, ThreadListRowSkeleton, type ThreadListRowSkeletonProps, ThreadListShell, type ThreadListShellProps, type ThreadPauseState, ThreadRootShell, type ThreadRootShellProps, ThreadViewportShell, type ThreadViewportShellProps, Toast, type ToastProps, ToastStack, type ToastStackProps, ToasterProvider, ToolApprovalBar, type ToolApprovalBarProps, ToolApprovalContainer, type ToolApprovalOption, ToolCallCard, type ToolCallCardProps, ToolCallContainer, ToolCallContentBlock, ToolCallContentBlockContainer, type ToolCallContentBlockProps, type ToolCallStatus, ToolGroupCard, type ToolGroupCardProps, ToolGroupContainer, type TrueForgeBuiltInServerConfig, type TrueForgeServerConfig, TrueForgeUI, type TrueForgeUIProps, TrueFoundryChatProvider, type TrueFoundryChatProviderProps, USER_MESSAGE_ATTACHMENT_PREVIEW_REM, type UseMCPAuthOptions, UserEditComposerContainer, UserMessageActionBar, type UserMessageActionBarProps, UserMessageBubble, type UserMessageBubbleProps, UserMessageContainer, UserMessageEdit, type UserMessageEditProps, WelcomeScreen, type WelcomeScreenProps, computeAgentStepsSplit, defaultSlots, getErrorMessage, libraryAgentId, preloadMarkdownOpenUI, resolvePresetTokens, shellIsMutable, threadHasPendingMcpAuth, useBrand, useBrandName, useCatalogServer, useComposerBusyState, useComposerPauseView, useContentClassNames, useDraftCatalog, useMCPAuth, useOptionalCatalogServer, useOptionalContentClassNames, useOptionalServer, useOptionalShellMode, useServer, useServerCapabilities, useShellMode, useSlot, useTheme, useThemeIcons, useThemeMode, useToaster, useToasterOptional };
1683
+ export { type AgentConfig, type AgentStepPart, AgentStepsCard, type AgentStepsCardProps, AgentStepsContainer, type AgentStepsContainerProps, type AgentStepsSplitResult, AgentsLibrary, AgentsLibraryButton, type AgentsLibraryButtonProps, type AgentsLibraryProps, type AskUserAnswerDraft, type AnsweredQuestion as AskUserAnsweredQuestion, AskUserContainer, type AskUserPromptProps, type Question as AskUserQuestion, type AskUserPromptProps as AskUserQuestionCardProps, AssistantMessageBubble, type AssistantMessageBubbleProps, AssistantMessageContainer, AssistantTextContainer, type PublicAtomSlots as AtomSlots, AttachmentCard, type AttachmentCardProps, type AttachmentCardSize, AttachmentPickerButton, type AttachmentPickerButtonProps, AttachmentPreviewDialog, type AttachmentPreviewDialogProps, Avatar, AvatarFallback, type AvatarFallbackProps, AvatarImage, type AvatarImageProps, type AvatarProps, BottomSheet, type BottomSheetProps, type BrandChrome, type BrandConfig, type BrandImage, BrandLogo, type BrandLogoConfig, type BrandMode, type ButtonProps, type ButtonSize, type ButtonVariant, CenteredModal, type CenteredModalProps, ChatFileDownload, type ChatFileDownloadFile, type ChatFileDownloadProps, type ChatLayout, ClearChatButton, CodeEditor, type CodeEditorProps, ComposerAttachmentPickerContainer, ComposerAttachmentsContainer, ComposerBusyProvider, type ComposerBusyState, ComposerContainer, type ComposerContainerProps, ComposerLeftSection, type ComposerLeftSectionProps, type ComposerPauseView, ComposerRightSection, type ComposerRightSectionProps, ComposerSendButton, type ComposerSendButtonProps, ComposerShell, type ComposerShellProps, type ContentClassNames, CustomActionContainer, type CustomActionRendererProps, type CustomActionRenderers, CustomActionRenderersProvider, DEFAULT_AGENT_CONFIG, DraftCatalogProvider, DraftComposerLeftSection, DraftComposerRightSection, DraftCompositeSelector, type DraftCompositeSelectorProps, DraftModelSelector, type DraftModelSelectorProps, HistoryLoader, HistoryLoaderContainer, type HistoryLoaderProps, Icon, type IconButtonProps, type IconMap, type IconProps, type LayoutProp, MCP_AUTH_POPUP_CHANNEL, Markdown, type MarkdownProps, type McpAuthCallback, type McpAuthPromptProps as McpAuthCardProps, McpAuthContainer, type McpAuthPopupMessage, type McpAuthPromptProps, type McpServer as McpAuthServer, MessageActionBar, type MessageActionBarProps, MessageAttachmentsContainer, MessageErrorBanner, type MessageErrorBannerProps, MessageGroup, type MessageGroupProps, MessageIndicator, type MessageIndicatorProps, MessageListSkeleton, type MessageListSkeletonProps, MessageTimestamp, type MessageTimestampProps, MonacoEditorCore, type MonacoEditorCoreProps, OpenUiFenceBlock, type OpenUiFenceBlockProps, PRESETS, PostMcpOauthScreen, type ReasoningCardProps, ReasoningContainer, ResumeUnavailable, ResumeUnavailableContainer, type ResumeUnavailableProps, type RoutePlace, type RoutesConfig, SandboxArtifactDownload, type SandboxArtifactDownloadProps, SandboxToolCallCard, type SandboxToolCallCardProps, SaveAgentButton, ScrollToBottomButton, type ScrollToBottomButtonProps, SelectAgentEmptyState, type SelectLibraryAgentRequest, type SemanticTokens, ServerProvider, ShellActionsActionSlot, type ShellMode, ShellModeProvider, type SlotOverrides, SlotsProvider, SubAgentCard, type SubAgentCardProps, Switch, type SwitchProps, type SwitchSize, SyntaxHighlighter, type SyntaxHighlighterProps, type ThemeConfig, type IconProps$1 as ThemeIconProps, type ThemeMode, type ThemePreset, ThemeProvider, Thread, ThreadComposerAreaShell, type ThreadComposerAreaShellProps, ThreadContainer, type ThreadContainerProps, type ThreadGroupPart, ThreadListContainer, type ThreadListContainerProps, ThreadListEmptyState, type ThreadListEmptyStateProps, ThreadListNewButton, type ThreadListNewButtonProps, ThreadListRow, type ThreadListRowProps, ThreadListRowSkeleton, type ThreadListRowSkeletonProps, ThreadListShell, type ThreadListShellProps, type ThreadPauseState, ThreadRootShell, type ThreadRootShellProps, ThreadViewportShell, type ThreadViewportShellProps, Toast, type ToastProps, ToastStack, type ToastStackProps, ToasterProvider, ToolApprovalBar, type ToolApprovalBarProps, ToolApprovalContainer, type ToolApprovalOption, ToolCallCard, type ToolCallCardProps, ToolCallContainer, ToolCallContentBlock, ToolCallContentBlockContainer, type ToolCallContentBlockProps, type ToolCallStatus, ToolGroupCard, type ToolGroupCardProps, ToolGroupContainer, type TrueForgeBuiltInServerConfig, type TrueForgeServerConfig, TrueForgeUI, type TrueForgeUIProps, TrueFoundryChatProvider, type TrueFoundryChatProviderProps, USER_MESSAGE_ATTACHMENT_PREVIEW_REM, type UseMCPAuthOptions, UserEditComposerContainer, UserMessageActionBar, type UserMessageActionBarProps, UserMessageBubble, type UserMessageBubbleProps, UserMessageContainer, UserMessageEdit, type UserMessageEditProps, WelcomeScreen, type WelcomeScreenProps, computeAgentStepsSplit, defaultSlots, getErrorMessage, libraryAgentId, preloadMarkdownOpenUI, resolveBrandChrome, resolvePresetTokens, shellIsMutable, threadHasPendingMcpAuth, useBrand, useBrandName, useCatalogServer, useComposerBusyState, useComposerPauseView, useContentClassNames, useDraftCatalog, useMCPAuth, useOptionalCatalogServer, useOptionalContentClassNames, useOptionalCustomActionRenderers, useOptionalServer, useOptionalShellMode, useServer, useServerCapabilities, useShellMode, useSlot, useTheme, useThemeIcons, useThemeMode, useToaster, useToasterOptional };