@agents24/chat-react 0.5.0 → 0.5.1

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 (133) hide show
  1. package/README.md +90 -21
  2. package/compatibility.json +10 -10
  3. package/dist/chunk-SSUO4EPD.js +189 -0
  4. package/dist/chunk-SSUO4EPD.js.map +1 -0
  5. package/dist/chunk-ZCNHLFRB.js +108 -0
  6. package/dist/chunk-ZCNHLFRB.js.map +1 -0
  7. package/dist/index.cjs +112 -95
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.ts +0 -1
  10. package/dist/index.js +362 -68
  11. package/dist/index.js.map +1 -1
  12. package/dist/mcp-oauth.d.ts +13 -0
  13. package/dist/runtime/index.cjs +594 -0
  14. package/dist/runtime/index.cjs.map +1 -0
  15. package/dist/runtime/index.d.ts +2 -0
  16. package/dist/runtime/index.js +458 -0
  17. package/dist/runtime/index.js.map +1 -0
  18. package/dist/runtime/input-contract.d.ts +20 -0
  19. package/dist/runtime/use-agent-chat-runtime.d.ts +83 -0
  20. package/dist/scaffold/app.d.ts +30 -0
  21. package/dist/scaffold/components/chat/chat-composer.d.ts +21 -0
  22. package/dist/scaffold/components/chat/chat-message.d.ts +21 -0
  23. package/dist/scaffold/components/chat/chat-shell.d.ts +8 -0
  24. package/dist/scaffold/components/chat/collapsible-user-message.d.ts +3 -0
  25. package/dist/scaffold/components/chat/external-link-dialog.d.ts +2 -0
  26. package/dist/scaffold/components/chat/identity-control.d.ts +4 -0
  27. package/dist/scaffold/components/chat/message-parts.d.ts +12 -0
  28. package/dist/scaffold/components/chat/theme-menu.d.ts +1 -0
  29. package/dist/scaffold/components/chat/thread-sidebar.d.ts +16 -0
  30. package/dist/scaffold/components/chat/timeline-loading.d.ts +7 -0
  31. package/dist/scaffold/components/chat/turn-outline.d.ts +4 -0
  32. package/dist/scaffold/components/theme-provider.d.ts +20 -0
  33. package/dist/scaffold/components/ui/attachment.d.ts +24 -0
  34. package/dist/scaffold/components/ui/bubble.d.ts +17 -0
  35. package/dist/scaffold/components/ui/button-group.d.ts +11 -0
  36. package/dist/scaffold/components/ui/button.d.ts +10 -0
  37. package/dist/scaffold/components/ui/dialog.d.ts +17 -0
  38. package/dist/scaffold/components/ui/dropdown-menu.d.ts +29 -0
  39. package/dist/scaffold/components/ui/input.d.ts +3 -0
  40. package/dist/scaffold/components/ui/marker.d.ts +11 -0
  41. package/dist/scaffold/components/ui/message-scroller.d.ts +10 -0
  42. package/dist/scaffold/components/ui/message.d.ts +10 -0
  43. package/dist/scaffold/components/ui/popover.d.ts +6 -0
  44. package/dist/scaffold/components/ui/select.d.ts +8 -0
  45. package/dist/scaffold/components/ui/separator.d.ts +4 -0
  46. package/dist/scaffold/components/ui/sheet.d.ts +14 -0
  47. package/dist/scaffold/components/ui/sidebar.d.ts +69 -0
  48. package/dist/scaffold/components/ui/skeleton.d.ts +2 -0
  49. package/dist/scaffold/components/ui/textarea.d.ts +3 -0
  50. package/dist/scaffold/components/ui/tooltip.d.ts +15 -0
  51. package/dist/scaffold/hooks/use-mobile.d.ts +1 -0
  52. package/dist/scaffold/identity.d.ts +10 -0
  53. package/dist/scaffold/index.cjs +2270 -0
  54. package/dist/scaffold/index.cjs.map +1 -0
  55. package/dist/scaffold/index.d.ts +14 -0
  56. package/dist/scaffold/index.js +2244 -0
  57. package/dist/scaffold/index.js.map +1 -0
  58. package/dist/scaffold/lib/utils.d.ts +2 -0
  59. package/dist/styles.css +137 -378
  60. package/dist/types.d.ts +3 -13
  61. package/dist/ui/adapters.d.ts +1 -1
  62. package/dist/ui/agent-chat-actions.d.ts +12 -5
  63. package/dist/ui/agent-chat-composer.d.ts +2 -1
  64. package/dist/ui/agent-chat-context-compression-row.d.ts +5 -0
  65. package/dist/ui/agent-chat-context-status.d.ts +13 -0
  66. package/dist/ui/agent-chat-message.d.ts +7 -5
  67. package/dist/ui/agent-response-timeline.d.ts +29 -7
  68. package/dist/ui/ask-user-interaction-state.d.ts +20 -0
  69. package/dist/ui/ask-user-interaction.d.ts +8 -0
  70. package/dist/ui/index.cjs +1391 -271
  71. package/dist/ui/index.cjs.map +1 -1
  72. package/dist/ui/index.d.ts +5 -0
  73. package/dist/ui/index.js +2380 -65
  74. package/dist/ui/index.js.map +1 -1
  75. package/dist/ui/tool-sessions.d.ts +70 -0
  76. package/dist/ui/use-audio-recorder.d.ts +8 -0
  77. package/package.json +27 -12
  78. package/scaffold/components.json +25 -0
  79. package/scaffold/manifest.json +28 -0
  80. package/scaffold/src/app.tsx +71 -0
  81. package/scaffold/src/chat.css +54 -0
  82. package/scaffold/src/components/chat/chat-composer.tsx +237 -0
  83. package/scaffold/src/components/chat/chat-message.tsx +76 -0
  84. package/scaffold/src/components/chat/chat-shell.tsx +257 -0
  85. package/scaffold/src/components/chat/collapsible-user-message.tsx +37 -0
  86. package/scaffold/src/components/chat/external-link-dialog.tsx +48 -0
  87. package/scaffold/src/components/chat/identity-control.tsx +69 -0
  88. package/scaffold/src/components/chat/message-parts.tsx +83 -0
  89. package/scaffold/src/components/chat/theme-menu.tsx +79 -0
  90. package/scaffold/src/components/chat/thread-sidebar.tsx +114 -0
  91. package/scaffold/src/components/chat/timeline-loading.ts +17 -0
  92. package/scaffold/src/components/chat/turn-outline.tsx +73 -0
  93. package/scaffold/src/components/theme-provider.tsx +91 -0
  94. package/scaffold/src/components/ui/attachment.tsx +204 -0
  95. package/scaffold/src/components/ui/bubble.tsx +125 -0
  96. package/scaffold/src/components/ui/button-group.tsx +83 -0
  97. package/scaffold/src/components/ui/button.tsx +65 -0
  98. package/scaffold/src/components/ui/dialog.tsx +171 -0
  99. package/scaffold/src/components/ui/dropdown-menu.tsx +271 -0
  100. package/scaffold/src/components/ui/input.tsx +19 -0
  101. package/scaffold/src/components/ui/marker.tsx +69 -0
  102. package/scaffold/src/components/ui/message-scroller.tsx +129 -0
  103. package/scaffold/src/components/ui/message.tsx +92 -0
  104. package/scaffold/src/components/ui/popover.tsx +40 -0
  105. package/scaffold/src/components/ui/select.tsx +92 -0
  106. package/scaffold/src/components/ui/separator.tsx +28 -0
  107. package/scaffold/src/components/ui/sheet.tsx +150 -0
  108. package/scaffold/src/components/ui/sidebar.tsx +677 -0
  109. package/scaffold/src/components/ui/skeleton.tsx +13 -0
  110. package/scaffold/src/components/ui/textarea.tsx +18 -0
  111. package/scaffold/src/components/ui/tooltip.tsx +56 -0
  112. package/scaffold/src/hooks/use-mobile.ts +24 -0
  113. package/scaffold/src/identity.ts +17 -0
  114. package/scaffold/src/index.css +222 -0
  115. package/scaffold/src/index.tsx +39 -0
  116. package/scaffold/src/lib/utils.ts +6 -0
  117. package/scaffold/styles.css +3 -0
  118. package/dist/chunk-CHAU7FNW.js +0 -140
  119. package/dist/chunk-CHAU7FNW.js.map +0 -1
  120. package/dist/chunk-LI67M74F.js +0 -445
  121. package/dist/chunk-LI67M74F.js.map +0 -1
  122. package/dist/chunk-R7WFL3YR.js +0 -1327
  123. package/dist/chunk-R7WFL3YR.js.map +0 -1
  124. package/dist/renderers.d.ts +0 -10
  125. package/dist/templates/agent-chat-app.d.ts +0 -18
  126. package/dist/templates/agent-chat-layout.d.ts +0 -77
  127. package/dist/templates/agent-chat-shell.d.ts +0 -37
  128. package/dist/templates/appearance-control.d.ts +0 -5
  129. package/dist/templates/index.cjs +0 -2600
  130. package/dist/templates/index.cjs.map +0 -1
  131. package/dist/templates/index.d.ts +0 -4
  132. package/dist/templates/index.js +0 -846
  133. package/dist/templates/index.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/runtime/use-agent-chat-runtime.ts","../../src/runtime/input-contract.ts"],"sourcesContent":["import type {\n AgentClient,\n Agents24ClientError,\n ClientBootstrap,\n EffectiveResourcePolicy,\n HitlResponse,\n PortableUpload,\n} from \"@agents24/client\";\nimport type { ContextCompression, ContextWindow } from \"@agents24/client/protocol\";\nimport {\n type AgentChatController,\n type ChatHitlPart,\n useAgentAttachments,\n useAgentChat,\n useAgentMcp,\n} from \"@agents24/react\";\nimport * as React from \"react\";\n\nimport {\n browserChatCrypto,\n createMcpPkceProof,\n validateMcpCallbackResult,\n waitForMcpOauthComplete,\n} from \"../mcp-oauth\";\nimport type { ChatMcpOauthCompletion } from \"../types\";\nimport { validateAgentChatSubmission } from \"./input-contract\";\n\nexport type AgentChatRuntimeAgent = {\n name: string;\n description?: string | null;\n handle?: string | null;\n avatarUrl?: string | null;\n};\n\nexport type AgentChatRuntimeModel = {\n id: string;\n label: string;\n};\n\nexport type AgentChatRuntimeViewState =\n | \"ready\"\n | \"loading\"\n | \"streaming\"\n | \"reconnecting\"\n | \"paused\"\n | \"cancelling\"\n | \"cancelled\"\n | \"offline\"\n | \"denied\"\n | \"quota\"\n | \"failed\"\n | \"expired\";\n\nexport type AgentChatRuntimeConnectionState =\n | \"connected\"\n | \"connecting\"\n | \"reconnecting\"\n | \"offline\"\n | \"expired\";\n\nexport type AgentChatThreadChangeReason = \"created\" | \"opened\" | \"new\" | \"deleted\";\n\nexport type AgentChatActiveThreadChange = {\n threadId: string | null;\n reason: AgentChatThreadChangeReason;\n};\n\nexport type AgentChatActiveThreadChangeHandler = (\n change: AgentChatActiveThreadChange,\n) => void;\n\nexport type AgentChatMcpAuthorizationCompletion = (input: {\n completion: ChatMcpOauthCompletion;\n codeVerifier: string;\n serverId: string;\n}) => Promise<void>;\n\nexport type AgentChatRuntimeSubmit = {\n text: string;\n files?: readonly PortableUpload[];\n};\n\nexport type AgentChatRuntimeHitlActionState = {\n action: string;\n error?: string | null;\n status: \"connecting\" | \"resuming\" | \"error\";\n};\n\nexport type UseAgentChatRuntimeOptions = {\n activeThreadId?: string | null;\n agent?: AgentChatRuntimeAgent;\n client: AgentClient;\n completeMcpAuthorization?: AgentChatMcpAuthorizationCompletion;\n mcpRedirectUri?: string;\n modelId?: string | null;\n onActiveThreadIdChange?: AgentChatActiveThreadChangeHandler;\n onModelChange?: (modelId: string) => void;\n};\n\nexport type AgentChatRuntime = {\n agent: AgentChatRuntimeAgent;\n inputContract: ClientBootstrap[\"features\"][\"inputs\"] | null;\n allowFeedback: boolean;\n backgroundError: unknown;\n bootstrap: ClientBootstrap | null;\n capabilities: readonly string[];\n changeModel(modelId: string): void;\n clearOperationError(): void;\n connectionState: AgentChatRuntimeConnectionState;\n contextWindow: ContextWindow | null;\n contextCompression: ContextCompression | null;\n controller: AgentChatController;\n deleteThread(threadId: string): Promise<void>;\n errorMessage: string | null;\n fatalError: unknown;\n getHitlActionState(part: ChatHitlPart): AgentChatRuntimeHitlActionState | undefined;\n isBootstrapping: boolean;\n isSubmitting: boolean;\n isUploading: boolean;\n modelId: string | null;\n models: AgentChatRuntimeModel[];\n newThread(): void;\n onHitlAction(part: ChatHitlPart, response: HitlResponse): Promise<void>;\n openThread(threadId: string): Promise<void>;\n operationError: unknown;\n retryBootstrap(): Promise<void>;\n state: AgentChatRuntimeViewState;\n submit(input: AgentChatRuntimeSubmit): Promise<void>;\n};\n\ntype PendingThreadTransition = {\n reason: \"opened\" | \"deleted\";\n value: string | null;\n};\n\nexport function agentChatRuntimeStateFromError(error: unknown): AgentChatRuntimeViewState {\n const typed = error as Partial<Agents24ClientError> | null;\n if (typed?.kind === \"authentication\") return \"expired\";\n if (typed?.kind === \"authorization\") return \"denied\";\n if (typed?.kind === \"quota\" || typed?.kind === \"rate_limit\") return \"quota\";\n if (typed?.kind === \"network\") return \"offline\";\n return \"failed\";\n}\n\nexport function agentChatRuntimeErrorMessage(error: unknown): string | null {\n if (!error) return null;\n return error instanceof Error ? error.message : String(error);\n}\n\nexport function modelsFromAgentChatBootstrap(bootstrap: ClientBootstrap): {\n defaultModelId: string | null;\n models: AgentChatRuntimeModel[];\n} {\n const modelFeatures = bootstrap.features.models;\n const selectable = bootstrap.capabilities.includes(\"models.select\") && modelFeatures?.selectable === true;\n if (!selectable) return { defaultModelId: null, models: [] };\n const models = Array.isArray(modelFeatures.options)\n ? modelFeatures.options.flatMap((option) => (\n typeof option?.id === \"string\" && option.id.trim()\n ? [{ id: option.id, label: typeof option.label === \"string\" && option.label.trim() ? option.label : option.id }]\n : []\n ))\n : [];\n const configuredDefault = models.some((model) => model.id === modelFeatures.default_id)\n ? modelFeatures.default_id\n : null;\n return {\n defaultModelId: configuredDefault,\n models,\n };\n}\n\nfunction modelsFromEffectivePolicy(policy: EffectiveResourcePolicy): {\n defaultModelId: string | null;\n models: AgentChatRuntimeModel[];\n} {\n const models = policy.model_selection.selectable\n ? policy.model_selection.options.map((option) => ({ id: option.id, label: option.label }))\n : [];\n return {\n defaultModelId: models.some((model) => model.id === policy.model_selection.default_id)\n ? policy.model_selection.default_id\n : null,\n models,\n };\n}\n\nfunction hitlKey(part: ChatHitlPart): string {\n return part.interruptId || part.id;\n}\n\nexport function useAgentChatRuntime(options: UseAgentChatRuntimeOptions): AgentChatRuntime {\n const {\n activeThreadId,\n agent: agentOverride,\n client,\n completeMcpAuthorization,\n mcpRedirectUri,\n modelId,\n onActiveThreadIdChange,\n onModelChange,\n } = options;\n const controller = useAgentChat(\n activeThreadId === undefined ? { client } : { activeThreadId, client },\n );\n const attachments = useAgentAttachments();\n const mcp = useAgentMcp();\n const [bootstrap, setBootstrap] = React.useState<ClientBootstrap | null>(null);\n const [effectivePolicy, setEffectivePolicy] = React.useState<EffectiveResourcePolicy | null>(null);\n const [isBootstrapping, setIsBootstrapping] = React.useState(true);\n const [bootstrapError, setBootstrapError] = React.useState<unknown>(null);\n const [localOperationError, setLocalOperationError] = React.useState<unknown>(null);\n const [selectedModelId, setSelectedModelId] = React.useState<string | null>(modelId ?? null);\n const [isSubmitting, setIsSubmitting] = React.useState(false);\n const submitPromiseRef = React.useRef<Promise<void> | null>(null);\n const [hitlStates, setHitlStates] = React.useState<Record<string, AgentChatRuntimeHitlActionState>>({});\n const hitlStatesRef = React.useRef(hitlStates);\n hitlStatesRef.current = hitlStates;\n\n const mountedRef = React.useRef(true);\n const clientRef = React.useRef(client);\n clientRef.current = client;\n const bootstrapPromiseRef = React.useRef<{ client: AgentClient; promise: Promise<void> } | null>(null);\n React.useEffect(() => {\n mountedRef.current = true;\n return () => { mountedRef.current = false; };\n }, []);\n\n const previousControlledThreadRef = React.useRef(activeThreadId);\n const controlledSyncTargetRef = React.useRef<{ value: string | null } | null>(null);\n const previousControllerThreadRef = React.useRef(controller.activeThreadId);\n const pendingThreadTransitionRef = React.useRef<PendingThreadTransition | null>(null);\n const lastReportedThreadRef = React.useRef<string | null>(activeThreadId ?? controller.activeThreadId);\n if (activeThreadId !== previousControlledThreadRef.current) {\n previousControlledThreadRef.current = activeThreadId;\n if (activeThreadId !== undefined) {\n controlledSyncTargetRef.current = { value: activeThreadId };\n lastReportedThreadRef.current = activeThreadId;\n }\n }\n\n const reportActiveThread = React.useCallback((\n threadId: string | null,\n reason: AgentChatThreadChangeReason,\n ) => {\n if (lastReportedThreadRef.current === threadId) return;\n lastReportedThreadRef.current = threadId;\n onActiveThreadIdChange?.({ threadId, reason });\n }, [onActiveThreadIdChange]);\n\n const retryBootstrap = React.useCallback((): Promise<void> => {\n if (bootstrapPromiseRef.current?.client === client) return bootstrapPromiseRef.current.promise;\n const requestClient = client;\n const request = (async () => {\n if (mountedRef.current) {\n setIsBootstrapping(true);\n setBootstrapError(null);\n setBootstrap(null);\n setEffectivePolicy(null);\n }\n try {\n const result = await requestClient.bootstrap();\n if (!mountedRef.current || clientRef.current !== requestClient) return;\n setBootstrap(result);\n const entitlement = await requestClient.resourcePolicies.getEffective();\n if (!mountedRef.current || clientRef.current !== requestClient) return;\n setEffectivePolicy(entitlement);\n const availableModels = modelsFromEffectivePolicy(entitlement);\n if (modelId === undefined) {\n setSelectedModelId((current) => availableModels.models.some((item) => item.id === current)\n ? current\n : availableModels.defaultModelId);\n }\n await controller.refreshThreads().catch(() => undefined);\n } catch (error) {\n if (mountedRef.current && clientRef.current === requestClient) setBootstrapError(error);\n } finally {\n if (mountedRef.current && clientRef.current === requestClient) setIsBootstrapping(false);\n }\n })();\n bootstrapPromiseRef.current = { client: requestClient, promise: request };\n void request.finally(() => {\n if (bootstrapPromiseRef.current?.promise === request) bootstrapPromiseRef.current = null;\n });\n return request;\n }, [client, controller.refreshThreads, modelId]);\n\n const refreshEffectivePolicy = React.useCallback(async () => {\n const entitlement = await client.resourcePolicies.getEffective();\n if (!mountedRef.current || clientRef.current !== client) return;\n setEffectivePolicy(entitlement);\n if (modelId === undefined) {\n const available = modelsFromEffectivePolicy(entitlement);\n setSelectedModelId((current) => available.models.some((item) => item.id === current)\n ? current\n : available.defaultModelId);\n }\n }, [client, modelId]);\n\n React.useEffect(() => {\n void retryBootstrap();\n }, [retryBootstrap]);\n\n React.useEffect(() => {\n if (modelId !== undefined) setSelectedModelId(modelId);\n }, [modelId]);\n\n React.useEffect(() => {\n hitlStatesRef.current = {};\n setHitlStates({});\n }, [client, controller.activeThreadId]);\n\n React.useEffect(() => {\n if (controlledSyncTargetRef.current?.value === null && controller.activeThreadId) {\n controller.startNewThread();\n }\n }, [activeThreadId, controller.activeThreadId, controller.startNewThread]);\n\n React.useEffect(() => {\n const previous = previousControllerThreadRef.current;\n const current = controller.activeThreadId;\n previousControllerThreadRef.current = current;\n const controlledTarget = controlledSyncTargetRef.current;\n if (controlledTarget) {\n if (current === controlledTarget.value) controlledSyncTargetRef.current = null;\n return;\n }\n const pendingTransition = pendingThreadTransitionRef.current;\n if (pendingTransition && current === pendingTransition.value) return;\n if (previous === null && current !== null) reportActiveThread(current, \"created\");\n }, [activeThreadId, controller.activeThreadId, reportActiveThread]);\n\n const clearOperationError = React.useCallback(() => {\n setLocalOperationError(null);\n controller.clearOperationError();\n }, [controller.clearOperationError]);\n\n const submit = React.useCallback((input: AgentChatRuntimeSubmit): Promise<void> => {\n if (submitPromiseRef.current) return submitPromiseRef.current;\n clearOperationError();\n setIsSubmitting(true);\n const request = (async () => {\n try {\n if (!bootstrap) throw new Error(\"The agent input contract is unavailable.\");\n const inputError = validateAgentChatSubmission(bootstrap.features.inputs, input.text, input.files || []);\n if (inputError) throw new Error(inputError);\n const uploaded = input.files?.length\n ? await attachments.uploadBatch({\n uploads: input.files,\n threadId: controller.activeThreadId || undefined,\n })\n : [];\n await controller.submit({\n text: input.text,\n attachmentIds: uploaded.flatMap((attachment) => attachment.id ? [attachment.id] : []),\n attachments: uploaded,\n requestedModelId: selectedModelId || undefined,\n });\n } catch (error) {\n setLocalOperationError(error);\n const typed = error as Partial<Agents24ClientError>;\n if (typed.kind === \"quota\" || typed.kind === \"authorization\") {\n await refreshEffectivePolicy().catch(() => undefined);\n }\n throw error;\n } finally {\n setIsSubmitting(false);\n }\n })();\n submitPromiseRef.current = request;\n const clearRequest = () => {\n if (submitPromiseRef.current === request) submitPromiseRef.current = null;\n };\n void request.then(clearRequest, clearRequest);\n return request;\n }, [attachments, bootstrap, clearOperationError, controller.activeThreadId, controller.submit, refreshEffectivePolicy, selectedModelId]);\n\n const completeMcp = React.useCallback(async (part: ChatHitlPart) => {\n if (!mcpRedirectUri) throw new Error(\"mcpRedirectUri is required for MCP Connect.\");\n const serverId = String(part.presentation.server_id || \"\").trim();\n if (!serverId) throw new Error(\"MCP authorization is missing its server identity.\");\n const runId = controller.activeRunId || controller.messages.find((message) => message.parts.includes(part))?.runId;\n if (!runId) throw new Error(\"MCP authorization is missing its paused run.\");\n const popupNonce = browserChatCrypto().randomUUID();\n const proof = await createMcpPkceProof();\n const popup = window.open(\"about:blank\", \"agents24-mcp\", \"popup,width=560,height=720\");\n if (!popup) throw new Error(\"Allow popups to connect this MCP account.\");\n popup.document.title = \"Connecting to MCP\";\n popup.document.body.textContent = \"Opening secure connection…\";\n try {\n const started = await mcp.startAuthorization({\n runId,\n serverId,\n interruptId: part.interruptId,\n redirectUri: mcpRedirectUri,\n popupNonce,\n codeChallenge: proof.challenge,\n });\n if (!started.callback_origin) throw new Error(\"MCP authorization did not return a callback origin.\");\n popup.location.replace(started.authorization_url);\n const completion = await waitForMcpOauthComplete({\n popup,\n callbackOrigin: started.callback_origin,\n popupNonce,\n requireConnectionId: Boolean(completeMcpAuthorization),\n serverId,\n });\n if (completeMcpAuthorization) {\n await completeMcpAuthorization({ completion, codeVerifier: proof.verifier, serverId });\n } else {\n const redeemed = await mcp.redeemCallback({ code: completion.code, codeVerifier: proof.verifier });\n validateMcpCallbackResult(redeemed, serverId);\n }\n } finally {\n popup.close();\n }\n }, [completeMcpAuthorization, controller.activeRunId, controller.messages, mcp, mcpRedirectUri]);\n\n const onHitlAction = React.useCallback(async (part: ChatHitlPart, response: HitlResponse) => {\n const action = response.action;\n const key = hitlKey(part);\n const current = hitlStatesRef.current[key];\n if (current?.status === \"connecting\" || current?.status === \"resuming\") return;\n clearOperationError();\n const pending: AgentChatRuntimeHitlActionState = {\n action,\n status: part.hitlKind === \"mcp_auth\" && action === \"connect\" ? \"connecting\" : \"resuming\",\n };\n hitlStatesRef.current = { ...hitlStatesRef.current, [key]: pending };\n setHitlStates(hitlStatesRef.current);\n try {\n if (part.hitlKind === \"mcp_auth\" && action === \"connect\") await completeMcp(part);\n await controller.resumeHitl(part, response);\n setHitlStates((states) => {\n const next = { ...states };\n delete next[key];\n hitlStatesRef.current = next;\n return next;\n });\n } catch (error) {\n setLocalOperationError(error);\n const failedState = {\n ...hitlStatesRef.current,\n [key]: { action, error: agentChatRuntimeErrorMessage(error), status: \"error\" },\n } satisfies Record<string, AgentChatRuntimeHitlActionState>;\n hitlStatesRef.current = failedState;\n setHitlStates(failedState);\n throw error;\n }\n }, [clearOperationError, completeMcp, controller.resumeHitl]);\n\n const newThread = React.useCallback(() => {\n clearOperationError();\n pendingThreadTransitionRef.current = null;\n reportActiveThread(null, \"new\");\n controller.startNewThread();\n }, [clearOperationError, controller.startNewThread, reportActiveThread]);\n\n const openThread = React.useCallback(async (threadId: string) => {\n clearOperationError();\n pendingThreadTransitionRef.current = { reason: \"opened\", value: threadId };\n try {\n await controller.openThread(threadId);\n reportActiveThread(threadId, \"opened\");\n } catch (error) {\n setLocalOperationError(error);\n throw error;\n } finally {\n if (pendingThreadTransitionRef.current?.value === threadId) pendingThreadTransitionRef.current = null;\n }\n }, [clearOperationError, controller.openThread, reportActiveThread]);\n\n const deleteThread = React.useCallback(async (threadId: string) => {\n clearOperationError();\n const wasActive = controller.activeThreadId === threadId;\n if (wasActive) pendingThreadTransitionRef.current = { reason: \"deleted\", value: null };\n try {\n await controller.deleteThread(threadId);\n if (wasActive) reportActiveThread(null, \"deleted\");\n } catch (error) {\n setLocalOperationError(error);\n throw error;\n } finally {\n if (wasActive && pendingThreadTransitionRef.current?.reason === \"deleted\") {\n pendingThreadTransitionRef.current = null;\n }\n }\n }, [clearOperationError, controller.activeThreadId, controller.deleteThread, reportActiveThread]);\n\n const changeModel = React.useCallback((nextModelId: string) => {\n if (modelId === undefined) setSelectedModelId(nextModelId);\n onModelChange?.(nextModelId);\n }, [modelId, onModelChange]);\n\n const modelOptions = effectivePolicy\n ? modelsFromEffectivePolicy(effectivePolicy).models\n : bootstrap\n ? modelsFromAgentChatBootstrap(bootstrap).models\n : [];\n const fatalError = bootstrapError || controller.error;\n const operationError = localOperationError || controller.operationError?.cause;\n const state: AgentChatRuntimeViewState = isBootstrapping\n ? \"loading\"\n : fatalError\n ? agentChatRuntimeStateFromError(fatalError)\n : controller.runState === \"streaming\"\n ? \"streaming\"\n : controller.runState === \"reconnecting\"\n ? \"reconnecting\"\n : controller.runState === \"paused\"\n ? \"paused\"\n : controller.runState === \"cancelling\"\n ? \"cancelling\"\n : controller.runState === \"cancelled\"\n ? \"cancelled\"\n : \"ready\";\n const connectionState: AgentChatRuntimeConnectionState = state === \"offline\"\n ? \"offline\"\n : state === \"expired\"\n ? \"expired\"\n : state === \"reconnecting\"\n ? \"reconnecting\"\n : isBootstrapping\n ? \"connecting\"\n : \"connected\";\n return {\n agent: agentOverride || { name: bootstrap?.deployment.name || \"Agent\" },\n inputContract: bootstrap?.features.inputs || null,\n allowFeedback: Boolean(bootstrap?.capabilities.includes(\"feedback.write\")),\n backgroundError: controller.backgroundError?.cause || null,\n bootstrap,\n capabilities: bootstrap?.capabilities || [],\n changeModel,\n clearOperationError,\n connectionState,\n contextWindow: controller.contextWindow,\n contextCompression: controller.contextCompression,\n controller,\n deleteThread,\n errorMessage: agentChatRuntimeErrorMessage(fatalError || operationError),\n fatalError,\n getHitlActionState: (part) => hitlStates[hitlKey(part)],\n isBootstrapping,\n isSubmitting: isSubmitting || controller.isSubmitting,\n isUploading: attachments.isUploading,\n modelId: selectedModelId,\n models: modelOptions,\n newThread,\n onHitlAction,\n openThread,\n operationError,\n retryBootstrap,\n state,\n submit,\n };\n}\n","import type { ClientInputFeature, PortableUpload } from \"@agents24/client\";\n\nexport type AgentChatInputContract = ClientInputFeature;\n\nexport const SUPPORTED_INPUT_MIME_TYPES = {\n files: [\"application/pdf\", \"text/plain\", \"text/markdown\", \"text/csv\", \"application/json\"],\n images: [\"image/png\", \"image/jpeg\", \"image/webp\"],\n audio: [\"audio/wav\", \"audio/mpeg\", \"audio/webm\", \"audio/mp4\"],\n} as const;\n\nexport type WorkflowInputRule = {\n key: string;\n enabled?: boolean;\n required?: boolean;\n};\n\nexport function workflowInputRule(\n inputs: readonly WorkflowInputRule[] | null | undefined,\n key: string,\n): { enabled: boolean; required: boolean } {\n const input = inputs?.find((candidate) => candidate.key === key);\n return {\n enabled: input?.enabled !== false,\n required: input?.required === true,\n };\n}\n\nexport function validateWorkflowInputSubmission(\n inputs: readonly WorkflowInputRule[] | null | undefined,\n text: string,\n attachmentMimeTypes: readonly string[],\n): string | null {\n const present = { files: false, images: false, audio: false };\n if (text.trim() && !workflowInputRule(inputs, \"text\").enabled) {\n return \"This workflow does not accept text input.\";\n }\n for (const rawMimeType of attachmentMimeTypes) {\n const mimeType = canonicalInputMimeType(rawMimeType);\n const modality = mimeType.startsWith(\"image/\") ? \"images\" : mimeType.startsWith(\"audio/\") ? \"audio\" : \"files\";\n const supported = (SUPPORTED_INPUT_MIME_TYPES[modality] as readonly string[]).includes(mimeType);\n if (!supported || !workflowInputRule(inputs, modality).enabled) {\n return `The attachment type ${mimeType || \"unknown\"} is not accepted.`;\n }\n present[modality] = true;\n }\n if (workflowInputRule(inputs, \"text\").required && !text.trim()) return \"Text input is required.\";\n for (const modality of [\"files\", \"images\", \"audio\"] as const) {\n if (workflowInputRule(inputs, modality).required && !present[modality]) {\n return `${modality[0].toUpperCase()}${modality.slice(1)} input is required.`;\n }\n }\n return null;\n}\n\nexport function canonicalInputMimeType(value: string): string {\n const normalized = value.split(\";\", 1)[0]?.trim().toLowerCase() || \"\";\n if (normalized === \"image/jpg\") return \"image/jpeg\";\n if ([\"audio/x-wav\"].includes(normalized)) return \"audio/wav\";\n if ([\"audio/x-m4a\", \"audio/m4a\"].includes(normalized)) return \"audio/mp4\";\n return normalized;\n}\n\nfunction uploadByteSize(data: PortableUpload[\"data\"]): number {\n if (data instanceof Uint8Array || data instanceof ArrayBuffer) return data.byteLength;\n return data.size;\n}\n\nexport function inputMimeTypes(contract: AgentChatInputContract | null | undefined): string[] {\n if (!contract) return [];\n return [\n ...contract.modalities.files.allowed_mime_types,\n ...contract.modalities.images.allowed_mime_types,\n ...contract.modalities.audio.allowed_mime_types,\n ];\n}\n\nexport function validateAgentChatSubmission(\n contract: AgentChatInputContract,\n text: string,\n files: readonly Pick<PortableUpload, \"mediaType\" | \"data\">[],\n): string | null {\n const { modalities, limits } = contract;\n const normalizedText = text.trim();\n if (normalizedText && !modalities.text.enabled) return \"This agent does not accept text input.\";\n if (modalities.text.required && !normalizedText) return \"Text input is required.\";\n if (files.length > limits.max_attachments_per_turn) {\n return `You can attach up to ${limits.max_attachments_per_turn} items per message.`;\n }\n let totalBytes = 0;\n const present = { files: false, images: false, audio: false };\n for (const file of files) {\n const mediaType = canonicalInputMimeType(file.mediaType);\n const modality = mediaType.startsWith(\"image/\") ? \"images\" : mediaType.startsWith(\"audio/\") ? \"audio\" : \"files\";\n const rule = modalities[modality];\n if (!rule.enabled || !rule.allowed_mime_types.includes(mediaType)) {\n return `The attachment type ${mediaType || \"unknown\"} is not accepted.`;\n }\n const byteSize = uploadByteSize(file.data);\n if (byteSize > limits.max_file_bytes) return \"An attachment exceeds the per-file size limit.\";\n totalBytes += byteSize;\n present[modality] = true;\n }\n if (totalBytes > limits.max_total_bytes) return \"Attachments exceed the total size limit.\";\n for (const modality of [\"files\", \"images\", \"audio\"] as const) {\n if (modalities[modality].required && !present[modality]) return `${modality[0].toUpperCase()}${modality.slice(1)} input is required.`;\n }\n return null;\n}\n"],"mappings":";;;;;;;;AASA;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,YAAY,WAAW;;;ACZhB,IAAM,6BAA6B;AAAA,EACxC,OAAO,CAAC,mBAAmB,cAAc,iBAAiB,YAAY,kBAAkB;AAAA,EACxF,QAAQ,CAAC,aAAa,cAAc,YAAY;AAAA,EAChD,OAAO,CAAC,aAAa,cAAc,cAAc,WAAW;AAC9D;AAQO,SAAS,kBACd,QACA,KACyC;AACzC,QAAM,QAAQ,QAAQ,KAAK,CAAC,cAAc,UAAU,QAAQ,GAAG;AAC/D,SAAO;AAAA,IACL,SAAS,OAAO,YAAY;AAAA,IAC5B,UAAU,OAAO,aAAa;AAAA,EAChC;AACF;AAEO,SAAS,gCACd,QACA,MACA,qBACe;AACf,QAAM,UAAU,EAAE,OAAO,OAAO,QAAQ,OAAO,OAAO,MAAM;AAC5D,MAAI,KAAK,KAAK,KAAK,CAAC,kBAAkB,QAAQ,MAAM,EAAE,SAAS;AAC7D,WAAO;AAAA,EACT;AACA,aAAW,eAAe,qBAAqB;AAC7C,UAAM,WAAW,uBAAuB,WAAW;AACnD,UAAM,WAAW,SAAS,WAAW,QAAQ,IAAI,WAAW,SAAS,WAAW,QAAQ,IAAI,UAAU;AACtG,UAAM,YAAa,2BAA2B,QAAQ,EAAwB,SAAS,QAAQ;AAC/F,QAAI,CAAC,aAAa,CAAC,kBAAkB,QAAQ,QAAQ,EAAE,SAAS;AAC9D,aAAO,uBAAuB,YAAY,SAAS;AAAA,IACrD;AACA,YAAQ,QAAQ,IAAI;AAAA,EACtB;AACA,MA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AAU,iBACR,iBACA,kBACE,eACA;AACV,SAAO;AAAA,IACL,OAAO,iBAAiB,EAAE,MAAM,WAAW,WAAW,QAAQ,QAAQ;AAAA,IACtE,eAAe,WAAW,SAAS,UAAU;AAAA,IAC7C,eAAe,QAAQ,WAAW,aAAa,SAAS,gBAAgB,CAAC;AAAA,IACzE,iBAAiB,WAAW,iBAAiB,SAAS;AAAA,IACtD;AAAA,IACA,cAAc,WAAW,gBAAgB,CAAC;AAAA,IAC1C;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe,WAAW;AAAA,IAC1B,oBAAoB,WAAW;AAAA,IAC/B;AAAA,IACA;AAAA,IACA,cAAc,6BAA6B,cAAc,cAAc;AAAA,IACvE;AAAA,IACA,oBAAoB,CAAC,SAAS,WAAW,QAAQ,IAAI,CAAC;AAAA,IACtD;AAAA,IACA,cAAc,gBAAgB,WAAW;AAAA,IACzC,aAAa,YAAY;AAAA,IACzB,SAAS;AAAA,IACT,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,20 @@
1
+ import type { ClientInputFeature, PortableUpload } from "@agents24/client";
2
+ export type AgentChatInputContract = ClientInputFeature;
3
+ export declare const SUPPORTED_INPUT_MIME_TYPES: {
4
+ readonly files: readonly ["application/pdf", "text/plain", "text/markdown", "text/csv", "application/json"];
5
+ readonly images: readonly ["image/png", "image/jpeg", "image/webp"];
6
+ readonly audio: readonly ["audio/wav", "audio/mpeg", "audio/webm", "audio/mp4"];
7
+ };
8
+ export type WorkflowInputRule = {
9
+ key: string;
10
+ enabled?: boolean;
11
+ required?: boolean;
12
+ };
13
+ export declare function workflowInputRule(inputs: readonly WorkflowInputRule[] | null | undefined, key: string): {
14
+ enabled: boolean;
15
+ required: boolean;
16
+ };
17
+ export declare function validateWorkflowInputSubmission(inputs: readonly WorkflowInputRule[] | null | undefined, text: string, attachmentMimeTypes: readonly string[]): string | null;
18
+ export declare function canonicalInputMimeType(value: string): string;
19
+ export declare function inputMimeTypes(contract: AgentChatInputContract | null | undefined): string[];
20
+ export declare function validateAgentChatSubmission(contract: AgentChatInputContract, text: string, files: readonly Pick<PortableUpload, "mediaType" | "data">[]): string | null;
@@ -0,0 +1,83 @@
1
+ import type { AgentClient, ClientBootstrap, HitlResponse, PortableUpload } from "@agents24/client";
2
+ import type { ContextCompression, ContextWindow } from "@agents24/client/protocol";
3
+ import { type AgentChatController, type ChatHitlPart } from "@agents24/react";
4
+ import type { ChatMcpOauthCompletion } from "../types";
5
+ export type AgentChatRuntimeAgent = {
6
+ name: string;
7
+ description?: string | null;
8
+ handle?: string | null;
9
+ avatarUrl?: string | null;
10
+ };
11
+ export type AgentChatRuntimeModel = {
12
+ id: string;
13
+ label: string;
14
+ };
15
+ export type AgentChatRuntimeViewState = "ready" | "loading" | "streaming" | "reconnecting" | "paused" | "cancelling" | "cancelled" | "offline" | "denied" | "quota" | "failed" | "expired";
16
+ export type AgentChatRuntimeConnectionState = "connected" | "connecting" | "reconnecting" | "offline" | "expired";
17
+ export type AgentChatThreadChangeReason = "created" | "opened" | "new" | "deleted";
18
+ export type AgentChatActiveThreadChange = {
19
+ threadId: string | null;
20
+ reason: AgentChatThreadChangeReason;
21
+ };
22
+ export type AgentChatActiveThreadChangeHandler = (change: AgentChatActiveThreadChange) => void;
23
+ export type AgentChatMcpAuthorizationCompletion = (input: {
24
+ completion: ChatMcpOauthCompletion;
25
+ codeVerifier: string;
26
+ serverId: string;
27
+ }) => Promise<void>;
28
+ export type AgentChatRuntimeSubmit = {
29
+ text: string;
30
+ files?: readonly PortableUpload[];
31
+ };
32
+ export type AgentChatRuntimeHitlActionState = {
33
+ action: string;
34
+ error?: string | null;
35
+ status: "connecting" | "resuming" | "error";
36
+ };
37
+ export type UseAgentChatRuntimeOptions = {
38
+ activeThreadId?: string | null;
39
+ agent?: AgentChatRuntimeAgent;
40
+ client: AgentClient;
41
+ completeMcpAuthorization?: AgentChatMcpAuthorizationCompletion;
42
+ mcpRedirectUri?: string;
43
+ modelId?: string | null;
44
+ onActiveThreadIdChange?: AgentChatActiveThreadChangeHandler;
45
+ onModelChange?: (modelId: string) => void;
46
+ };
47
+ export type AgentChatRuntime = {
48
+ agent: AgentChatRuntimeAgent;
49
+ inputContract: ClientBootstrap["features"]["inputs"] | null;
50
+ allowFeedback: boolean;
51
+ backgroundError: unknown;
52
+ bootstrap: ClientBootstrap | null;
53
+ capabilities: readonly string[];
54
+ changeModel(modelId: string): void;
55
+ clearOperationError(): void;
56
+ connectionState: AgentChatRuntimeConnectionState;
57
+ contextWindow: ContextWindow | null;
58
+ contextCompression: ContextCompression | null;
59
+ controller: AgentChatController;
60
+ deleteThread(threadId: string): Promise<void>;
61
+ errorMessage: string | null;
62
+ fatalError: unknown;
63
+ getHitlActionState(part: ChatHitlPart): AgentChatRuntimeHitlActionState | undefined;
64
+ isBootstrapping: boolean;
65
+ isSubmitting: boolean;
66
+ isUploading: boolean;
67
+ modelId: string | null;
68
+ models: AgentChatRuntimeModel[];
69
+ newThread(): void;
70
+ onHitlAction(part: ChatHitlPart, response: HitlResponse): Promise<void>;
71
+ openThread(threadId: string): Promise<void>;
72
+ operationError: unknown;
73
+ retryBootstrap(): Promise<void>;
74
+ state: AgentChatRuntimeViewState;
75
+ submit(input: AgentChatRuntimeSubmit): Promise<void>;
76
+ };
77
+ export declare function agentChatRuntimeStateFromError(error: unknown): AgentChatRuntimeViewState;
78
+ export declare function agentChatRuntimeErrorMessage(error: unknown): string | null;
79
+ export declare function modelsFromAgentChatBootstrap(bootstrap: ClientBootstrap): {
80
+ defaultModelId: string | null;
81
+ models: AgentChatRuntimeModel[];
82
+ };
83
+ export declare function useAgentChatRuntime(options: UseAgentChatRuntimeOptions): AgentChatRuntime;
@@ -0,0 +1,30 @@
1
+ import type { AgentClient, HitlResponse } from "@agents24/client";
2
+ import { type AgentChatActiveThreadChangeHandler, type AgentChatMcpAuthorizationCompletion, type AgentChatRuntimeAgent } from "@agents24/chat-react/runtime";
3
+ import type { HitlActionState } from "@agents24/chat-react/ui";
4
+ import { type ChatHitlPart, type ChatMessage, type ChatPart } from "@agents24/react";
5
+ import * as React from "react";
6
+ import { type Agents24ChatIdentity } from "./identity";
7
+ export type Agents24ChatAppProps = {
8
+ activeThreadId?: string | null;
9
+ agent?: AgentChatRuntimeAgent;
10
+ client: AgentClient;
11
+ completeMcpAuthorization?: AgentChatMcpAuthorizationCompletion;
12
+ mcpRedirectUri?: string;
13
+ modelId?: string | null;
14
+ onActiveThreadIdChange?: AgentChatActiveThreadChangeHandler;
15
+ onModelChange?: (modelId: string) => void;
16
+ identity?: Agents24ChatIdentity;
17
+ components?: Agents24ChatScaffoldComponents;
18
+ };
19
+ export type Agents24ChatScaffoldComponents = {
20
+ Timeline?: React.ComponentType<Agents24ChatTimelineSlotProps>;
21
+ };
22
+ export type ChatHitlResponse = HitlResponse;
23
+ export type Agents24ChatTimelineSlotProps = {
24
+ message: ChatMessage;
25
+ parts: readonly ChatPart[];
26
+ isLoading: boolean;
27
+ getHitlActionState: (part: ChatHitlPart) => HitlActionState | undefined;
28
+ onHitlAction: (part: ChatHitlPart, response: ChatHitlResponse) => void;
29
+ };
30
+ export declare function App(props: Agents24ChatAppProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { type AgentChatInputContract } from "@agents24/chat-react/runtime";
2
+ import type { ContextWindow } from "@agents24/client/protocol";
3
+ type ChatComposerProps = {
4
+ inputContract: AgentChatInputContract;
5
+ disabled?: boolean;
6
+ contextWindow?: ContextWindow | null;
7
+ forceExpanded?: boolean;
8
+ isCancelling?: boolean;
9
+ isRunning: boolean;
10
+ modelId: string | null;
11
+ models: Array<{
12
+ id: string;
13
+ label: string;
14
+ }>;
15
+ onModelChange: (modelId: string) => void;
16
+ onStop: () => void;
17
+ onSubmit: (text: string, files: File[]) => Promise<void>;
18
+ utilityRow?: "inline" | "below";
19
+ };
20
+ export declare function ChatComposer({ inputContract, disabled, contextWindow, forceExpanded, isCancelling, isRunning, modelId, models, onModelChange, onStop, onSubmit, utilityRow, }: ChatComposerProps): import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { ChatHitlPart, ChatMessage as ChatMessageModel } from "@agents24/react";
2
+ import type { FeedbackReason, HitlResponse } from "@agents24/client";
3
+ import type { AgentChatRuntimeHitlActionState } from "@agents24/chat-react/runtime";
4
+ import * as React from "react";
5
+ import type { Agents24ChatTimelineSlotProps } from "../../app";
6
+ type Props = {
7
+ message: ChatMessageModel;
8
+ getHitlActionState: (part: ChatHitlPart) => AgentChatRuntimeHitlActionState | undefined;
9
+ isLoading: boolean;
10
+ onHitlAction: (part: ChatHitlPart, response: HitlResponse) => Promise<void>;
11
+ onRegenerate: () => Promise<void>;
12
+ allowFeedback: boolean;
13
+ onSetFeedback: (input: {
14
+ rating: "like" | "dislike" | null;
15
+ reason?: FeedbackReason | null;
16
+ comment?: string | null;
17
+ }) => Promise<void>;
18
+ Timeline?: React.ComponentType<Agents24ChatTimelineSlotProps>;
19
+ };
20
+ export declare function ChatMessage({ allowFeedback, getHitlActionState, isLoading, message, onHitlAction, onRegenerate, onSetFeedback, Timeline, }: Props): import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -0,0 +1,8 @@
1
+ import { type AgentChatRuntime } from "@agents24/chat-react/runtime";
2
+ import type { Agents24ChatScaffoldComponents } from "../../app";
3
+ import type { Agents24ChatIdentity } from "../../identity";
4
+ export declare function ChatShell({ components, identity, runtime, }: {
5
+ components?: Agents24ChatScaffoldComponents;
6
+ identity: Agents24ChatIdentity;
7
+ runtime: AgentChatRuntime;
8
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export declare function CollapsibleUserMessage({ content }: {
2
+ content: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { LinkSafetyModalProps } from "streamdown";
2
+ export declare function ExternalLinkDialog({ isOpen, onClose, onConfirm, url }: LinkSafetyModalProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import type { Agents24ChatIdentity } from "../../identity";
2
+ export declare function IdentityControl({ identity }: {
3
+ identity: Agents24ChatIdentity;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import type { ChatHitlPart, ChatMessage } from "@agents24/react";
2
+ import type { HitlResponse } from "@agents24/client";
3
+ import type { AgentChatRuntimeHitlActionState } from "@agents24/chat-react/runtime";
4
+ import * as React from "react";
5
+ import type { Agents24ChatTimelineSlotProps } from "../../app";
6
+ export declare function MessageParts({ message, getHitlActionState, isLoading, onHitlAction, Timeline, }: {
7
+ message: ChatMessage;
8
+ getHitlActionState: (part: ChatHitlPart) => AgentChatRuntimeHitlActionState | undefined;
9
+ isLoading: boolean;
10
+ onHitlAction: (part: ChatHitlPart, response: HitlResponse) => Promise<void>;
11
+ Timeline?: React.ComponentType<Agents24ChatTimelineSlotProps>;
12
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function ThemeMenu(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { type StoredChatThread } from "@agents24/react";
2
+ import type { Agents24ChatIdentity } from "../../identity";
3
+ type Props = {
4
+ activeThreadId: string | null;
5
+ hasMore: boolean;
6
+ isLoading: boolean;
7
+ isLoadingMore: boolean;
8
+ onDelete: (threadId: string) => Promise<void>;
9
+ onLoadMore: () => Promise<void>;
10
+ onNew: () => void;
11
+ onOpen: (threadId: string) => Promise<void>;
12
+ threads: StoredChatThread[];
13
+ identity: Agents24ChatIdentity;
14
+ };
15
+ export declare function ThreadSidebar({ activeThreadId, hasMore, identity, isLoading, isLoadingMore, onDelete, onLoadMore, onNew, onOpen, threads }: Props): import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { AgentChatRunState, ChatMessage } from "@agents24/react";
2
+ export declare function isScaffoldTimelineLoading({ activeRunId, message, runState, streamingMessageId, }: {
3
+ activeRunId: string | null;
4
+ message: ChatMessage;
5
+ runState: AgentChatRunState;
6
+ streamingMessageId: string | null;
7
+ }): boolean;
@@ -0,0 +1,4 @@
1
+ import type { ChatMessage } from "@agents24/react";
2
+ export declare function TurnOutline({ messages }: {
3
+ messages: ChatMessage[];
4
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,20 @@
1
+ import * as React from "react";
2
+ export type Agents24ChatAppearance = "system" | "light" | "dark";
3
+ export type Agents24ChatTheme = "soft" | "sharp";
4
+ export type Agents24ChatAppearanceController = {
5
+ appearance: Agents24ChatAppearance;
6
+ setAppearance: (appearance: Agents24ChatAppearance) => void;
7
+ };
8
+ type ThemeContextValue = {
9
+ appearance: Agents24ChatAppearance;
10
+ portalContainer: HTMLElement | null;
11
+ setAppearance: (appearance: Agents24ChatAppearance) => void;
12
+ };
13
+ export declare function ThemeProvider({ children, controller, theme, }: {
14
+ children: React.ReactNode;
15
+ controller?: Agents24ChatAppearanceController;
16
+ theme?: Agents24ChatTheme;
17
+ }): import("react/jsx-runtime").JSX.Element;
18
+ export declare function useTheme(): ThemeContextValue;
19
+ export declare function useThemePortalContainer(): HTMLElement | null;
20
+ export {};
@@ -0,0 +1,24 @@
1
+ import * as React from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ import { Button } from "./button";
4
+ declare const attachmentVariants: (props?: ({
5
+ size?: "default" | "xs" | "sm" | null | undefined;
6
+ orientation?: "horizontal" | "vertical" | null | undefined;
7
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
+ declare function Attachment({ className, state, size, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof attachmentVariants> & {
9
+ state?: "idle" | "uploading" | "processing" | "error" | "done";
10
+ }): import("react/jsx-runtime").JSX.Element;
11
+ declare const attachmentMediaVariants: (props?: ({
12
+ variant?: "icon" | "image" | null | undefined;
13
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
14
+ declare function AttachmentMedia({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof attachmentMediaVariants>): import("react/jsx-runtime").JSX.Element;
15
+ declare function AttachmentContent({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
16
+ declare function AttachmentTitle({ className, ...props }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
17
+ declare function AttachmentDescription({ className, ...props }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
18
+ declare function AttachmentActions({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
19
+ declare function AttachmentAction({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): import("react/jsx-runtime").JSX.Element;
20
+ declare function AttachmentTrigger({ className, asChild, type, ...props }: React.ComponentProps<"button"> & {
21
+ asChild?: boolean;
22
+ }): import("react/jsx-runtime").JSX.Element;
23
+ declare function AttachmentGroup({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
24
+ export { Attachment, AttachmentGroup, AttachmentMedia, AttachmentContent, AttachmentTitle, AttachmentDescription, AttachmentActions, AttachmentAction, AttachmentTrigger, };
@@ -0,0 +1,17 @@
1
+ import * as React from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ declare function BubbleGroup({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
4
+ declare const bubbleVariants: (props?: ({
5
+ variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "muted" | "tinted" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ declare function Bubble({ variant, align, className, ...props }: React.ComponentProps<"div"> & VariantProps<typeof bubbleVariants> & {
8
+ align?: "start" | "end";
9
+ }): import("react/jsx-runtime").JSX.Element;
10
+ declare function BubbleContent({ asChild, className, ...props }: React.ComponentProps<"div"> & {
11
+ asChild?: boolean;
12
+ }): import("react/jsx-runtime").JSX.Element;
13
+ declare function BubbleReactions({ side, align, className, ...props }: React.ComponentProps<"div"> & {
14
+ align?: "start" | "end";
15
+ side?: "top" | "bottom";
16
+ }): import("react/jsx-runtime").JSX.Element;
17
+ export { BubbleGroup, Bubble, BubbleContent, BubbleReactions };
@@ -0,0 +1,11 @@
1
+ import { type VariantProps } from "class-variance-authority";
2
+ import { Separator } from "./separator";
3
+ declare const buttonGroupVariants: (props?: ({
4
+ orientation?: "horizontal" | "vertical" | null | undefined;
5
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
+ declare function ButtonGroup({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>): import("react/jsx-runtime").JSX.Element;
7
+ declare function ButtonGroupText({ className, asChild, ...props }: React.ComponentProps<"div"> & {
8
+ asChild?: boolean;
9
+ }): import("react/jsx-runtime").JSX.Element;
10
+ declare function ButtonGroupSeparator({ className, orientation, ...props }: React.ComponentProps<typeof Separator>): import("react/jsx-runtime").JSX.Element;
11
+ export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants, };
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ declare const buttonVariants: (props?: ({
4
+ variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | null | undefined;
5
+ size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
8
+ asChild?: boolean;
9
+ }): import("react/jsx-runtime").JSX.Element;
10
+ export { Button, buttonVariants };
@@ -0,0 +1,17 @@
1
+ import * as React from "react";
2
+ import { Dialog as DialogPrimitive } from "radix-ui";
3
+ declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
5
+ declare function DialogPortal({ container, ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
6
+ declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
7
+ declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
8
+ declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
9
+ showCloseButton?: boolean;
10
+ }): import("react/jsx-runtime").JSX.Element;
11
+ declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
12
+ declare function DialogFooter({ className, showCloseButton, children, ...props }: React.ComponentProps<"div"> & {
13
+ showCloseButton?: boolean;
14
+ }): import("react/jsx-runtime").JSX.Element;
15
+ declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
16
+ declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): import("react/jsx-runtime").JSX.Element;
17
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
@@ -0,0 +1,29 @@
1
+ import * as React from "react";
2
+ import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
3
+ declare function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ declare function DropdownMenuPortal({ container, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
5
+ declare function DropdownMenuTrigger({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
6
+ declare function DropdownMenuContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
7
+ declare function DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>): import("react/jsx-runtime").JSX.Element;
8
+ declare function DropdownMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
9
+ inset?: boolean;
10
+ variant?: "default" | "destructive";
11
+ }): import("react/jsx-runtime").JSX.Element;
12
+ declare function DropdownMenuCheckboxItem({ className, children, checked, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem> & {
13
+ inset?: boolean;
14
+ }): import("react/jsx-runtime").JSX.Element;
15
+ declare function DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): import("react/jsx-runtime").JSX.Element;
16
+ declare function DropdownMenuRadioItem({ className, children, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem> & {
17
+ inset?: boolean;
18
+ }): import("react/jsx-runtime").JSX.Element;
19
+ declare function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
20
+ inset?: boolean;
21
+ }): import("react/jsx-runtime").JSX.Element;
22
+ declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
23
+ declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
24
+ declare function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>): import("react/jsx-runtime").JSX.Element;
25
+ declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
26
+ inset?: boolean;
27
+ }): import("react/jsx-runtime").JSX.Element;
28
+ declare function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): import("react/jsx-runtime").JSX.Element;
29
+ export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ declare function Input({ className, type, ...props }: React.ComponentProps<"input">): import("react/jsx-runtime").JSX.Element;
3
+ export { Input };
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ declare const markerVariants: (props?: ({
4
+ variant?: "default" | "separator" | "border" | null | undefined;
5
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
+ declare function Marker({ className, variant, asChild, ...props }: React.ComponentProps<"div"> & VariantProps<typeof markerVariants> & {
7
+ asChild?: boolean;
8
+ }): import("react/jsx-runtime").JSX.Element;
9
+ declare function MarkerIcon({ className, ...props }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
10
+ declare function MarkerContent({ className, ...props }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
11
+ export { Marker, MarkerIcon, MarkerContent, markerVariants };
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ import { MessageScroller as MessageScrollerPrimitive, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility } from "@shadcn/react/message-scroller";
3
+ import { Button } from "./button";
4
+ declare function MessageScrollerProvider(props: React.ComponentProps<typeof MessageScrollerPrimitive.Provider>): import("react/jsx-runtime").JSX.Element;
5
+ declare function MessageScroller({ className, ...props }: React.ComponentProps<typeof MessageScrollerPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
6
+ declare function MessageScrollerViewport({ className, ...props }: React.ComponentProps<typeof MessageScrollerPrimitive.Viewport>): import("react/jsx-runtime").JSX.Element;
7
+ declare function MessageScrollerContent({ className, ...props }: React.ComponentProps<typeof MessageScrollerPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
8
+ declare function MessageScrollerItem({ className, scrollAnchor, ...props }: React.ComponentProps<typeof MessageScrollerPrimitive.Item>): import("react/jsx-runtime").JSX.Element;
9
+ declare function MessageScrollerButton({ direction, className, children, render, variant, size, ...props }: React.ComponentProps<typeof MessageScrollerPrimitive.Button> & Pick<React.ComponentProps<typeof Button>, "variant" | "size">): import("react/jsx-runtime").JSX.Element;
10
+ export { MessageScrollerProvider, MessageScroller, MessageScrollerViewport, MessageScrollerContent, MessageScrollerItem, MessageScrollerButton, useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVisibility, };
@@ -0,0 +1,10 @@
1
+ import * as React from "react";
2
+ declare function MessageGroup({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
3
+ declare function Message({ className, align, ...props }: React.ComponentProps<"div"> & {
4
+ align?: "start" | "end";
5
+ }): import("react/jsx-runtime").JSX.Element;
6
+ declare function MessageAvatar({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
7
+ declare function MessageContent({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
8
+ declare function MessageHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
9
+ declare function MessageFooter({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
10
+ export { MessageGroup, Message, MessageAvatar, MessageContent, MessageFooter, MessageHeader, };
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import { Popover as PopoverPrimitive } from "radix-ui";
3
+ declare function Popover(props: React.ComponentProps<typeof PopoverPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ declare function PopoverTrigger(props: React.ComponentProps<typeof PopoverPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
5
+ declare function PopoverContent({ align, className, sideOffset, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
6
+ export { Popover, PopoverContent, PopoverTrigger };
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ import { Select as SelectPrimitive } from "radix-ui";
3
+ declare function Select(props: React.ComponentProps<typeof SelectPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ declare function SelectValue(props: React.ComponentProps<typeof SelectPrimitive.Value>): import("react/jsx-runtime").JSX.Element;
5
+ declare function SelectTrigger({ children, className, ...props }: React.ComponentProps<typeof SelectPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
6
+ declare function SelectContent({ align, children, className, sideOffset, ...props }: React.ComponentProps<typeof SelectPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
7
+ declare function SelectItem({ children, className, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>): import("react/jsx-runtime").JSX.Element;
8
+ export { Select, SelectContent, SelectItem, SelectTrigger, SelectValue };
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import { Separator as SeparatorPrimitive } from "radix-ui";
3
+ declare function Separator({ className, orientation, decorative, ...props }: React.ComponentProps<typeof SeparatorPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ export { Separator };
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ import { Dialog as SheetPrimitive } from "radix-ui";
3
+ declare function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
+ declare function SheetTrigger({ ...props }: React.ComponentProps<typeof SheetPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
5
+ declare function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
6
+ declare function SheetContent({ className, children, side, showCloseButton, ...props }: React.ComponentProps<typeof SheetPrimitive.Content> & {
7
+ side?: "top" | "right" | "bottom" | "left";
8
+ showCloseButton?: boolean;
9
+ }): import("react/jsx-runtime").JSX.Element;
10
+ declare function SheetHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
11
+ declare function SheetFooter({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
12
+ declare function SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
13
+ declare function SheetDescription({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Description>): import("react/jsx-runtime").JSX.Element;
14
+ export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, };