@axiom-lattice/react-sdk 4.3.0 → 4.4.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 (65) hide show
  1. package/dist/{AgentDetailSideApp-TI7723CK.mjs → AgentDetailSideApp-RW6B3BGT.mjs} +7 -7
  2. package/dist/AgentGovernanceWorkbench-OXGHJNFL.mjs +19 -0
  3. package/dist/{MessageGraph-ES3P4VLY.mjs → MessageGraph-BVP2M3TM.mjs} +3 -3
  4. package/dist/{ReactChart-6AYFMCMD.mjs → ReactChart-3XHMWXL6.mjs} +3 -3
  5. package/dist/{TasksSideApp-7R42CIFG.mjs → TasksSideApp-MLG7XUQA.mjs} +4 -4
  6. package/dist/{TeamWorkspace-JQ762PEX.mjs → TeamWorkspace-IENL2T4X.mjs} +3 -3
  7. package/dist/{TopologyRuntimeView-OJ35YYVM.mjs → TopologyRuntimeView-B5TVUTAB.mjs} +4 -4
  8. package/dist/{WorkflowAutomationView-3AS77NKN.mjs → WorkflowAutomationView-ZKTUYMPU.mjs} +6 -6
  9. package/dist/{chunk-4FI66ZJ3.mjs → chunk-2NCNDHTI.mjs} +2 -2
  10. package/dist/{chunk-ENLK3ODS.mjs → chunk-3JNBTKKB.mjs} +2 -2
  11. package/dist/{chunk-2ZK7AUQW.mjs → chunk-ADZRYRP6.mjs} +9 -5
  12. package/dist/chunk-ADZRYRP6.mjs.map +1 -0
  13. package/dist/{chunk-4SVLWYLW.mjs → chunk-AJLGOGUB.mjs} +2 -2
  14. package/dist/{chunk-NSGSGYM7.mjs → chunk-HLVE2SB7.mjs} +48 -1
  15. package/dist/chunk-HLVE2SB7.mjs.map +1 -0
  16. package/dist/{chunk-YUV4WO25.mjs → chunk-N5VEHSQU.mjs} +160 -69
  17. package/dist/chunk-N5VEHSQU.mjs.map +1 -0
  18. package/dist/{chunk-3NR7UAPT.mjs → chunk-ORTSDZD4.mjs} +26 -44
  19. package/dist/chunk-ORTSDZD4.mjs.map +1 -0
  20. package/dist/{chunk-DBTFQUSQ.mjs → chunk-XE2ZIE2L.mjs} +4 -4
  21. package/dist/{embed-page-AgentDetailSideApp-PSRQVFNR.js → embed-page-AgentDetailSideApp-2BDEWFQ6.js} +1 -1
  22. package/dist/embed-page-AgentGovernanceWorkbench-WG7E3G5T.js +5 -0
  23. package/dist/{embed-page-MessageGraph-PDNQ67T4.js → embed-page-MessageGraph-5SWPEQ4V.js} +1 -1
  24. package/dist/{embed-page-ReactChart-25KAFLQ3.js → embed-page-ReactChart-ZYWRXIMC.js} +1 -1
  25. package/dist/{embed-page-TasksSideApp-DLH5LRMS.js → embed-page-TasksSideApp-X6255GEF.js} +1 -1
  26. package/dist/{embed-page-TeamWorkspace-2WJJWF25.js → embed-page-TeamWorkspace-XNZM7AV7.js} +1 -1
  27. package/dist/{embed-page-TopologyRuntimeView-WDQRHDMO.js → embed-page-TopologyRuntimeView-DGSHSTIU.js} +1 -1
  28. package/dist/{embed-page-WorkflowAutomationView-BAMJ2WVB.js → embed-page-WorkflowAutomationView-BHIRIWV3.js} +1 -1
  29. package/dist/embed-page-chunk-DEDTYRZE.js +245 -0
  30. package/dist/{embed-page-chunk-XVUA7UHE.js → embed-page-chunk-HEO7X7LH.js} +1 -1
  31. package/dist/{embed-page-chunk-TL2AYM76.js → embed-page-chunk-JMZ7OODN.js} +1 -1
  32. package/dist/{embed-page-chunk-OBM5EUWZ.js → embed-page-chunk-SPC4BYNU.js} +192 -192
  33. package/dist/{embed-page-chunk-LOXLXZNP.js → embed-page-chunk-XUXEGF3S.js} +1 -1
  34. package/dist/{embed-page-chunk-MQDYZS3S.js → embed-page-chunk-YCX5YZRP.js} +1 -1
  35. package/dist/embed-page.js +1 -1
  36. package/dist/index.d.mts +27 -1
  37. package/dist/index.d.ts +27 -1
  38. package/dist/index.js +2029 -1890
  39. package/dist/index.js.map +1 -1
  40. package/dist/index.mjs +13 -8
  41. package/dist/index.mjs.map +1 -1
  42. package/dist/web-app.js +48 -3
  43. package/dist/web-app.js.map +1 -1
  44. package/dist/web-app.mjs +5 -4
  45. package/dist/web-app.mjs.map +1 -1
  46. package/package.json +3 -3
  47. package/dist/AgentGovernanceWorkbench-2MPAB6UF.mjs +0 -19
  48. package/dist/chunk-2ZK7AUQW.mjs.map +0 -1
  49. package/dist/chunk-3NR7UAPT.mjs.map +0 -1
  50. package/dist/chunk-NSGSGYM7.mjs.map +0 -1
  51. package/dist/chunk-YUV4WO25.mjs.map +0 -1
  52. package/dist/embed-page-AgentGovernanceWorkbench-UPQHJZD7.js +0 -5
  53. package/dist/embed-page-chunk-SSC7ANWV.js +0 -245
  54. /package/dist/{AgentDetailSideApp-TI7723CK.mjs.map → AgentDetailSideApp-RW6B3BGT.mjs.map} +0 -0
  55. /package/dist/{AgentGovernanceWorkbench-2MPAB6UF.mjs.map → AgentGovernanceWorkbench-OXGHJNFL.mjs.map} +0 -0
  56. /package/dist/{MessageGraph-ES3P4VLY.mjs.map → MessageGraph-BVP2M3TM.mjs.map} +0 -0
  57. /package/dist/{ReactChart-6AYFMCMD.mjs.map → ReactChart-3XHMWXL6.mjs.map} +0 -0
  58. /package/dist/{TasksSideApp-7R42CIFG.mjs.map → TasksSideApp-MLG7XUQA.mjs.map} +0 -0
  59. /package/dist/{TeamWorkspace-JQ762PEX.mjs.map → TeamWorkspace-IENL2T4X.mjs.map} +0 -0
  60. /package/dist/{TopologyRuntimeView-OJ35YYVM.mjs.map → TopologyRuntimeView-B5TVUTAB.mjs.map} +0 -0
  61. /package/dist/{WorkflowAutomationView-3AS77NKN.mjs.map → WorkflowAutomationView-ZKTUYMPU.mjs.map} +0 -0
  62. /package/dist/{chunk-4FI66ZJ3.mjs.map → chunk-2NCNDHTI.mjs.map} +0 -0
  63. /package/dist/{chunk-ENLK3ODS.mjs.map → chunk-3JNBTKKB.mjs.map} +0 -0
  64. /package/dist/{chunk-4SVLWYLW.mjs.map → chunk-AJLGOGUB.mjs.map} +0 -0
  65. /package/dist/{chunk-DBTFQUSQ.mjs.map → chunk-XE2ZIE2L.mjs.map} +0 -0
package/dist/web-app.mjs CHANGED
@@ -4,8 +4,9 @@ import {
4
4
  } from "./chunk-7QQKL657.mjs";
5
5
  import {
6
6
  XMarkdown_default,
7
+ formatErrorMessage,
7
8
  useReviewDecision
8
- } from "./chunk-NSGSGYM7.mjs";
9
+ } from "./chunk-HLVE2SB7.mjs";
9
10
  import "./chunk-SH6YXSHR.mjs";
10
11
 
11
12
  // src/integrations/web-app/AgentWebAppProvider.tsx
@@ -456,7 +457,7 @@ function ScopedAgentWebAppProvider({ gatewayUrl, webAppId, identity, children, o
456
457
  await input.run((event) => {
457
458
  if (event.type === "error") {
458
459
  if (input.generation === generationRef.current && input.streamGeneration === streamGenerationRef.current) {
459
- eventError = new AgentWebAppRuntimeClientError(event.error.code, event.error.message, event.error.retryable);
460
+ eventError = new AgentWebAppRuntimeClientError(event.error.code, formatErrorMessage(event.error.message, "Stream error"), event.error.retryable);
460
461
  }
461
462
  return;
462
463
  }
@@ -691,7 +692,7 @@ import { useRef as useRef2, useState } from "react";
691
692
 
692
693
  // src/integrations/web-app/components/widget-utils.ts
693
694
  function widgetErrorMessage(error) {
694
- return error instanceof Error ? error.message : "Request failed";
695
+ return formatErrorMessage(error, "Request failed");
695
696
  }
696
697
 
697
698
  // src/integrations/web-app/components/WidgetAttachments.tsx
@@ -802,7 +803,7 @@ function WidgetComposer({ className, messageLabel = "Message", placeholder = "As
802
803
  // src/integrations/web-app/components/WidgetInterruptView.tsx
803
804
  import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
804
805
  function errorMessage(error) {
805
- return error instanceof Error ? error.message : "Unable to submit review";
806
+ return formatErrorMessage(error, "Unable to submit review");
806
807
  }
807
808
  function WidgetInterruptView({ interrupt, onSubmit, className, approveLabel = "Approve", rejectLabel = "Reject", feedbackLabel = "Feedback", disabled = false }) {
808
809
  const review = useReviewDecision(async (decision, feedback) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/integrations/web-app/AgentWebAppProvider.tsx","../src/integrations/web-app/AgentWebAppContext.ts","../src/integrations/web-app/state/agentWebAppReducer.ts","../src/integrations/web-app/hooks/useAgentWebApp.ts","../src/integrations/web-app/hooks/useWidgetAttachments.ts","../src/integrations/web-app/hooks/useWidgetChat.ts","../src/integrations/web-app/hooks/useWidgetInterrupts.ts","../src/integrations/web-app/hooks/useWidgetProject.ts","../src/integrations/web-app/hooks/useWidgetThreads.ts","../src/integrations/web-app/components/WidgetAttachments.tsx","../src/integrations/web-app/components/widget-utils.ts","../src/integrations/web-app/components/WidgetComposer.tsx","../src/integrations/web-app/components/WidgetInterruptView.tsx","../src/integrations/web-app/components/WidgetInterrupt.tsx","../src/integrations/web-app/components/WidgetMarkdown.tsx","../src/integrations/web-app/components/WidgetGenUIRenderer.tsx","../src/integrations/web-app/components/WidgetMessageList.tsx","../src/integrations/web-app/components/WidgetModelSelector.tsx","../src/integrations/web-app/components/WidgetProjectSelector.tsx","../src/integrations/web-app/components/WidgetThreadList.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useReducer, useRef } from \"react\";\nimport { AgentWebAppContext, featureDisabled } from \"./AgentWebAppContext\";\nimport { AgentWebAppRuntimeClient } from \"./client\";\nimport { AgentWebAppRuntimeClientError } from \"./error\";\nimport { agentWebAppReducer, initialAgentWebAppState } from \"./state/agentWebAppReducer\";\nimport type {\n AgentWebAppBootstrap,\n AgentWebAppInterruptResponse,\n AgentWebAppRuntimeThread,\n AgentWebAppStreamEvent,\n} from \"./types\";\n\nexport type AgentWebAppIdentity =\n | { mode: \"unverified\"; userId: string; displayName?: string }\n | { mode: \"verified\"; tokenProvider: () => Promise<string> };\n\nexport interface AgentWebAppProviderProps {\n gatewayUrl: string;\n webAppId: string;\n identity: AgentWebAppIdentity;\n children: React.ReactNode;\n onError?: (error: AgentWebAppRuntimeClientError) => void;\n fetch?: typeof globalThis.fetch;\n}\n\nfunction validateProps(props: AgentWebAppProviderProps): void {\n if (!props.gatewayUrl.trim()) throw new Error(\"AgentWebAppProvider requires gatewayUrl\");\n try { new URL(props.gatewayUrl); } catch { throw new Error(\"AgentWebAppProvider gatewayUrl must be a valid URL\"); }\n if (props.identity.mode === \"unverified\") {\n if (!props.identity.userId.trim()) throw new Error(\"AgentWebAppProvider requires identity.userId\");\n } else if (typeof props.identity.tokenProvider !== \"function\") {\n throw new Error(\"AgentWebAppProvider requires identity.tokenProvider\");\n }\n if (!props.fetch && typeof globalThis.fetch !== \"function\") throw new Error(\"AgentWebAppProvider requires a fetch implementation\");\n}\n\nfunction runtimeError(error: unknown): AgentWebAppRuntimeClientError {\n if (error instanceof AgentWebAppRuntimeClientError) return error;\n return new AgentWebAppRuntimeClientError(\"INTERNAL_ERROR\", \"Request failed\", true);\n}\n\nfunction isAbortError(error: unknown): boolean {\n return typeof error === \"object\" && error !== null && \"name\" in error && error.name === \"AbortError\";\n}\n\nfunction newestThread(threads: AgentWebAppRuntimeThread[]): AgentWebAppRuntimeThread | null {\n return threads.reduce<AgentWebAppRuntimeThread | null>((latest, item) => !latest || item.updatedAt > latest.updatedAt ? item : latest, null);\n}\n\nfunction requestProjectId(bootstrap: AgentWebAppBootstrap | null, projectId: string | null | undefined): string | undefined {\n return bootstrap?.webApp.features.projectSelector ? projectId ?? undefined : undefined;\n}\n\nfunction requestModelKey(bootstrap: AgentWebAppBootstrap | null, modelKey: string | null | undefined): string | undefined {\n return bootstrap?.webApp.features.modelSelector ? modelKey ?? undefined : undefined;\n}\n\nexport function AgentWebAppProvider(props: AgentWebAppProviderProps): React.ReactElement {\n validateProps(props);\n const scopeKey = `${props.gatewayUrl}\\u0000${props.webAppId}\\u0000${props.identity.mode === \"unverified\" ? props.identity.userId : \"verified:token\"}`;\n return <ScopedAgentWebAppProvider key={scopeKey} {...props} />;\n}\n\nfunction ScopedAgentWebAppProvider({ gatewayUrl, webAppId, identity, children, onError, fetch: fetchImplementation }: AgentWebAppProviderProps): React.ReactElement {\n const [state, dispatch] = useReducer(agentWebAppReducer, initialAgentWebAppState);\n const stateRef = useRef(state);\n stateRef.current = state;\n const generationRef = useRef(0);\n const threadGenerationRef = useRef(0);\n const streamGenerationRef = useRef(0);\n const controllersRef = useRef(new Set<AbortController>());\n const threadControllersRef = useRef(new Set<AbortController>());\n const streamRef = useRef<{ controller: AbortController; threadId: string; projectId?: string } | null>(null);\n const errorNotifiedRef = useRef<AgentWebAppRuntimeClientError | null>(null);\n const identityRef = useRef(identity);\n identityRef.current = identity;\n const clientRef = useRef<AgentWebAppRuntimeClient>();\n if (!clientRef.current) {\n clientRef.current = new AgentWebAppRuntimeClient({\n gatewayUrl,\n webAppId,\n identityProvider: {\n getIdentity: async () => {\n const current = identityRef.current;\n if (current.mode !== \"verified\") return { externalUserId: current.userId };\n try {\n return { bearerToken: await current.tokenProvider() };\n } catch {\n throw new AgentWebAppRuntimeClientError(\"USER_ID_REQUIRED\", \"Identity token provider failed\", true);\n }\n },\n },\n ...(fetchImplementation ? { fetch: fetchImplementation } : {}),\n });\n }\n const client = clientRef.current;\n\n const controlled = useCallback(async <T,>(operation: (signal: AbortSignal) => Promise<T>): Promise<T> => {\n const controller = new AbortController();\n controllersRef.current.add(controller);\n try { return await operation(controller.signal); }\n finally { controllersRef.current.delete(controller); }\n }, []);\n\n const threadControlled = useCallback(async <T,>(operation: (signal: AbortSignal) => Promise<T>): Promise<T> => {\n const controller = new AbortController();\n threadControllersRef.current.add(controller);\n try { return await operation(controller.signal); }\n finally { threadControllersRef.current.delete(controller); }\n }, []);\n\n const invalidateThreadWork = useCallback((): number => {\n const generation = ++threadGenerationRef.current;\n for (const controller of threadControllersRef.current) controller.abort();\n threadControllersRef.current.clear();\n return generation;\n }, []);\n\n const report = useCallback((error: unknown): AgentWebAppRuntimeClientError => {\n const normalized = runtimeError(error);\n dispatch({ type: \"ERROR_SET\", error: normalized });\n return normalized;\n }, []);\n\n const stopActiveStream = useCallback(async ({ abortBackend }: { abortBackend: boolean }): Promise<void> => {\n const active = streamRef.current;\n if (!active) return;\n streamGenerationRef.current += 1;\n streamRef.current = null;\n active.controller.abort();\n dispatch({ type: \"STREAM_SET\", streaming: false, assistantMessageId: null });\n if (abortBackend) await client.abort(active.threadId, active.projectId ? { projectId: active.projectId } : {});\n }, [client]);\n\n const loadMessages = useCallback(async (thread: AgentWebAppRuntimeThread, generation = generationRef.current, threadGeneration = threadGenerationRef.current, bootstrap = stateRef.current.bootstrap): Promise<void> => {\n dispatch({ type: \"MESSAGES_LOADING\", loading: true });\n try {\n const projectId = requestProjectId(bootstrap, thread.projectId);\n const result = await threadControlled((signal) => client.getMessages(thread.id, projectId ? { projectId } : {}, signal));\n if (generation === generationRef.current && threadGeneration === threadGenerationRef.current) dispatch({ type: \"MESSAGES_SET\", messages: result.messages });\n } catch (error) {\n if (!isAbortError(error) && generation === generationRef.current && threadGeneration === threadGenerationRef.current) report(error);\n } finally {\n if (generation === generationRef.current && threadGeneration === threadGenerationRef.current) dispatch({ type: \"MESSAGES_LOADING\", loading: false });\n }\n }, [client, report, threadControlled]);\n\n const loadManagedThreads = useCallback(async (projectId: string, generation = generationRef.current, threadGeneration = threadGenerationRef.current, bootstrap = stateRef.current.bootstrap): Promise<void> => {\n dispatch({ type: \"THREADS_LOADING\", loading: true });\n try {\n const selectedProjectId = requestProjectId(bootstrap, projectId);\n const result = await threadControlled((signal) => client.listThreads(selectedProjectId ? { projectId: selectedProjectId } : {}, signal));\n if (generation !== generationRef.current || threadGeneration !== threadGenerationRef.current) return;\n const latest = newestThread(result.records);\n if (streamRef.current && latest?.id !== stateRef.current.activeThread?.id) await stopActiveStream({ abortBackend: true });\n if (generation !== generationRef.current || threadGeneration !== threadGenerationRef.current) return;\n dispatch({ type: \"THREADS_SET\", threads: result.records });\n const currentActive = stateRef.current.activeThread;\n if (latest && latest.id === currentActive?.id) {\n dispatch({ type: \"ACTIVE_THREAD_UPDATED\", thread: latest });\n } else {\n threadGeneration = invalidateThreadWork();\n dispatch({ type: \"ACTIVE_THREAD_SET\", thread: latest });\n if (latest) await loadMessages(latest, generation, threadGeneration, bootstrap);\n }\n } catch (error) {\n if (!isAbortError(error) && generation === generationRef.current && threadGeneration === threadGenerationRef.current) report(error);\n } finally {\n if (generation === generationRef.current && threadGeneration === threadGenerationRef.current) dispatch({ type: \"THREADS_LOADING\", loading: false });\n }\n }, [client, invalidateThreadWork, loadMessages, report, stopActiveStream, threadControlled]);\n\n const bootstrapRuntime = useCallback(async (): Promise<void> => {\n try { await stopActiveStream({ abortBackend: true }); }\n catch (error) { if (!isAbortError(error)) report(error); }\n const generation = ++generationRef.current;\n for (const controller of controllersRef.current) controller.abort();\n controllersRef.current.clear();\n invalidateThreadWork();\n dispatch({ type: \"BOOTSTRAP_LOADING\" });\n try {\n const result = await controlled((signal) => client.bootstrap({}, signal));\n if (generation !== generationRef.current) return;\n const projectId = result.webApp.defaultProjectId;\n const modelKey = result.webApp.defaultModelKey ?? result.models[0]?.key ?? null;\n dispatch({ type: \"BOOTSTRAP_READY\", bootstrap: result, projectId, modelKey });\n if (result.webApp.features.threadManagement) {\n await loadManagedThreads(projectId, generation, threadGenerationRef.current, result);\n } else {\n const implicit = result.thread ?? null;\n dispatch({ type: \"THREADS_SET\", threads: implicit ? [implicit] : [] });\n dispatch({ type: \"ACTIVE_THREAD_SET\", thread: implicit });\n if (implicit) await loadMessages(implicit, generation, threadGenerationRef.current, result);\n }\n } catch (error) {\n if (!isAbortError(error) && generation === generationRef.current) report(error);\n } finally {\n if (generation === generationRef.current) dispatch({ type: \"BOOTSTRAP_SETTLED\" });\n }\n }, [client, controlled, invalidateThreadWork, loadManagedThreads, loadMessages, report, stopActiveStream]);\n\n useEffect(() => {\n void bootstrapRuntime();\n return () => {\n generationRef.current += 1;\n for (const controller of controllersRef.current) controller.abort();\n controllersRef.current.clear();\n invalidateThreadWork();\n void stopActiveStream({ abortBackend: true }).catch(() => undefined);\n };\n }, [bootstrapRuntime, invalidateThreadWork, stopActiveStream]);\n\n useEffect(() => {\n const error = state.errors.current;\n if (error && error !== errorNotifiedRef.current) {\n errorNotifiedRef.current = error;\n onError?.(error);\n }\n }, [onError, state.errors.current]);\n\n const abort = useCallback(async (): Promise<void> => {\n try { await stopActiveStream({ abortBackend: true }); }\n catch (error) { if (!isAbortError(error)) throw report(error); }\n }, [report, stopActiveStream]);\n\n const selectProject = useCallback(async (projectId: string): Promise<void> => {\n const current = stateRef.current;\n const bootstrap = current.bootstrap;\n if (!bootstrap) throw report(new AgentWebAppRuntimeClientError(\"INVALID_REQUEST\", \"Web App is not ready\", true));\n if (!bootstrap.webApp.features.projectSelector) throw featureDisabled(\"Project selection is disabled\");\n if (!bootstrap.projects.some((project) => project.id === projectId)) throw report(new AgentWebAppRuntimeClientError(\"PROJECT_NOT_ALLOWED\", \"Project is not allowed\", false));\n if (projectId === current.projectId) return;\n try { await stopActiveStream({ abortBackend: true }); }\n catch (error) { if (!isAbortError(error)) throw report(error); }\n const generation = generationRef.current;\n const threadGeneration = invalidateThreadWork();\n dispatch({ type: \"PROJECT_SELECTED\", projectId });\n if (bootstrap.webApp.features.threadManagement) await loadManagedThreads(projectId, generation, threadGeneration, bootstrap);\n else {\n const selectedProjectId = requestProjectId(bootstrap, projectId);\n const selectedModelKey = requestModelKey(bootstrap, current.modelKey);\n const result = await threadControlled((signal) => client.bootstrap({ ...(selectedProjectId ? { projectId: selectedProjectId } : {}), ...(selectedModelKey ? { modelKey: selectedModelKey } : {}) }, signal));\n if (generation !== generationRef.current || threadGeneration !== threadGenerationRef.current) return;\n const implicit = result.thread ?? null;\n dispatch({ type: \"THREADS_SET\", threads: implicit ? [implicit] : [] });\n dispatch({ type: \"ACTIVE_THREAD_SET\", thread: implicit });\n if (implicit) await loadMessages(implicit, generation, threadGeneration, result);\n }\n }, [client, invalidateThreadWork, loadManagedThreads, loadMessages, report, stopActiveStream, threadControlled]);\n\n const selectModel = useCallback((modelKey: string): void => {\n const bootstrap = stateRef.current.bootstrap;\n if (!bootstrap) throw report(new AgentWebAppRuntimeClientError(\"INVALID_REQUEST\", \"Web App is not ready\", true));\n if (!bootstrap.webApp.features.modelSelector) throw featureDisabled(\"Model selection is disabled\");\n if (!bootstrap.models.some((model) => model.key === modelKey)) throw report(new AgentWebAppRuntimeClientError(\"MODEL_NOT_ALLOWED\", \"Model is not allowed\", false));\n dispatch({ type: \"MODEL_SELECTED\", modelKey });\n }, [report]);\n\n const requireThreadManagement = useCallback((): void => {\n if (!stateRef.current.bootstrap?.webApp.features.threadManagement) throw featureDisabled(\"Thread management is disabled\");\n }, []);\n\n const refreshThreads = useCallback(async (): Promise<void> => {\n requireThreadManagement();\n const projectId = stateRef.current.projectId;\n if (projectId) await loadManagedThreads(projectId, generationRef.current, threadGenerationRef.current, stateRef.current.bootstrap);\n }, [loadManagedThreads, requireThreadManagement]);\n\n const selectThread = useCallback(async (thread: AgentWebAppRuntimeThread): Promise<void> => {\n if (thread.projectId !== stateRef.current.projectId) throw report(new AgentWebAppRuntimeClientError(\"PROJECT_NOT_ALLOWED\", \"Thread belongs to another project\", false));\n try { await stopActiveStream({ abortBackend: true }); }\n catch (error) { if (!isAbortError(error)) throw report(error); }\n const generation = generationRef.current;\n const threadGeneration = invalidateThreadWork();\n dispatch({ type: \"ACTIVE_THREAD_SET\", thread });\n await loadMessages(thread, generation, threadGeneration, stateRef.current.bootstrap);\n }, [invalidateThreadWork, loadMessages, report, stopActiveStream]);\n\n const createThread = useCallback(async (label?: string): Promise<AgentWebAppRuntimeThread> => {\n requireThreadManagement();\n try { await stopActiveStream({ abortBackend: true }); }\n catch (error) { if (!isAbortError(error)) throw report(error); }\n const threadGeneration = invalidateThreadWork();\n const generation = generationRef.current;\n const projectId = stateRef.current.projectId;\n const selectedProjectId = requestProjectId(stateRef.current.bootstrap, projectId);\n const created = await threadControlled((signal) => client.createThread({ ...(selectedProjectId ? { projectId: selectedProjectId } : {}), ...(label ? { label } : {}) }, signal));\n if (generation !== generationRef.current || threadGeneration !== threadGenerationRef.current) return created;\n dispatch({ type: \"THREAD_UPSERT\", thread: created });\n dispatch({ type: \"ACTIVE_THREAD_SET\", thread: created });\n return created;\n }, [client, invalidateThreadWork, report, requireThreadManagement, stopActiveStream, threadControlled]);\n\n const renameThread = useCallback(async (threadId: string, label: string): Promise<AgentWebAppRuntimeThread> => {\n requireThreadManagement();\n try { await stopActiveStream({ abortBackend: true }); }\n catch (error) { if (!isAbortError(error)) throw report(error); }\n const generation = generationRef.current;\n const threadGeneration = threadGenerationRef.current;\n const existing = stateRef.current.threads.find((item) => item.id === threadId);\n if (!existing) throw report(new AgentWebAppRuntimeClientError(\"THREAD_NOT_FOUND\", \"Thread not found\", false));\n const projectId = requestProjectId(stateRef.current.bootstrap, existing.projectId);\n const updated = await threadControlled((signal) => client.updateThread(threadId, { ...(projectId ? { projectId } : {}), label }, signal));\n if (generation !== generationRef.current || threadGeneration !== threadGenerationRef.current) return updated;\n dispatch({ type: \"THREAD_UPSERT\", thread: updated });\n return updated;\n }, [client, report, requireThreadManagement, threadControlled]);\n\n const deleteThread = useCallback(async (threadId: string): Promise<void> => {\n requireThreadManagement();\n const existing = stateRef.current.threads.find((item) => item.id === threadId);\n if (!existing) throw report(new AgentWebAppRuntimeClientError(\"THREAD_NOT_FOUND\", \"Thread not found\", false));\n if (stateRef.current.activeThread?.id === threadId) {\n try { await stopActiveStream({ abortBackend: true }); }\n catch (error) { if (!isAbortError(error)) throw report(error); }\n invalidateThreadWork();\n }\n const generation = generationRef.current;\n const threadGeneration = threadGenerationRef.current;\n const projectId = requestProjectId(stateRef.current.bootstrap, existing.projectId);\n await threadControlled((signal) => client.deleteThread(threadId, projectId ? { projectId } : {}, signal));\n if (generation !== generationRef.current || threadGeneration !== threadGenerationRef.current) return;\n dispatch({ type: \"THREAD_DELETED\", threadId });\n const remaining = stateRef.current.threads.filter((item) => item.id !== threadId);\n const next = newestThread(remaining);\n if (stateRef.current.activeThread?.id === threadId && next) {\n dispatch({ type: \"ACTIVE_THREAD_SET\", thread: next });\n await loadMessages(next);\n }\n }, [client, invalidateThreadWork, loadMessages, report, requireThreadManagement, stopActiveStream, threadControlled]);\n\n const handleStreamEvent = useCallback((event: AgentWebAppStreamEvent, assistantId: string, generation: number, streamGeneration: number): void => {\n if (generation !== generationRef.current || streamGeneration !== streamGenerationRef.current) return;\n switch (event.type) {\n case \"message.delta\": dispatch({ type: \"ASSISTANT_DELTA\", id: assistantId, text: event.text }); break;\n case \"message.completed\": dispatch({ type: \"ASSISTANT_COMPLETED\", temporaryId: assistantId, messageId: event.messageId }); break;\n case \"tool.started\": dispatch({ type: \"TOOL_STARTED\", id: event.id, name: event.name }); break;\n case \"tool.completed\": dispatch({ type: \"TOOL_COMPLETED\", id: event.id }); break;\n case \"interrupt.created\": if (stateRef.current.bootstrap?.webApp.features.hitl) dispatch({ type: \"INTERRUPT_ADD\", interrupt: event.interrupt }); break;\n case \"genui.render\": if (stateRef.current.bootstrap?.webApp.features.genUI) dispatch({ type: \"ASSISTANT_GENUI\", id: assistantId, block: event.block }); break;\n case \"error\": break;\n case \"stream.completed\": break;\n }\n }, []);\n\n const consumePublicStream = useCallback(async (input: {\n threadId: string; projectId?: string; assistantId: string; generation: number; streamGeneration: number;\n run(onEvent: (event: AgentWebAppStreamEvent) => void, signal: AbortSignal): Promise<void>;\n }): Promise<string> => {\n const controller = new AbortController();\n let eventError: AgentWebAppRuntimeClientError | null = null;\n let currentAssistantId = input.assistantId;\n streamRef.current = { controller, threadId: input.threadId, ...(input.projectId ? { projectId: input.projectId } : {}) };\n dispatch({ type: \"STREAM_SET\", streaming: true, assistantMessageId: input.assistantId });\n try {\n await input.run((event) => {\n if (event.type === \"error\") {\n if (input.generation === generationRef.current && input.streamGeneration === streamGenerationRef.current) {\n eventError = new AgentWebAppRuntimeClientError(event.error.code, event.error.message, event.error.retryable);\n }\n return;\n }\n if (event.type === \"message.completed\") currentAssistantId = event.messageId;\n handleStreamEvent(event, input.assistantId, input.generation, input.streamGeneration);\n }, controller.signal);\n if (eventError) throw eventError;\n return currentAssistantId;\n } finally {\n if (streamRef.current?.controller === controller) streamRef.current = null;\n if (input.generation === generationRef.current && input.streamGeneration === streamGenerationRef.current) dispatch({ type: \"STREAM_SET\", streaming: false });\n }\n }, [handleStreamEvent]);\n\n const send = useCallback(async (content: string, attachmentRefs?: string[]): Promise<void> => {\n const current = stateRef.current;\n if (streamRef.current || current.stream.isStreaming) throw new AgentWebAppRuntimeClientError(\"STREAM_CONFLICT\", \"A message is already streaming\", false);\n if (!current.activeThread || !current.projectId) throw report(new AgentWebAppRuntimeClientError(\"THREAD_NOT_FOUND\", \"No active thread\", false));\n if (!content.trim()) throw report(new AgentWebAppRuntimeClientError(\"INVALID_REQUEST\", \"Message content is required\", false));\n const generation = generationRef.current;\n const streamGeneration = ++streamGenerationRef.current;\n const assistantId = `pending-assistant-${Date.now()}-${Math.random().toString(36).slice(2)}`;\n const userId = `pending-user-${Date.now()}-${Math.random().toString(36).slice(2)}`;\n const refs = attachmentRefs ?? current.attachments.map((attachment) => attachment.ref);\n const projectId = requestProjectId(current.bootstrap, current.projectId);\n const modelKey = requestModelKey(current.bootstrap, current.modelKey);\n let currentAssistantId = assistantId;\n dispatch({ type: \"MESSAGE_APPEND\", message: { id: userId, role: \"human\", content } });\n try {\n currentAssistantId = await consumePublicStream({\n threadId: current.activeThread.id, projectId, assistantId, generation, streamGeneration,\n run: (onEvent, signal) => client.streamMessage(current.activeThread!.id, {\n content,\n ...(projectId ? { projectId } : {}),\n ...(modelKey ? { modelKey } : {}),\n ...(refs.length ? { attachmentRefs: refs } : {}),\n }, onEvent, signal),\n });\n if (generation === generationRef.current && streamGeneration === streamGenerationRef.current) {\n dispatch({ type: \"ATTACHMENTS_REMOVE\", refs });\n dispatch({ type: \"FAILED_SEND_SET\", failedSend: null });\n }\n } catch (error) {\n if (generation === generationRef.current && streamGeneration === streamGenerationRef.current) {\n dispatch({ type: \"MESSAGES_REMOVE\", ids: [userId, assistantId, `${assistantId}-genui`, currentAssistantId, `${currentAssistantId}-genui`] });\n if (!isAbortError(error)) {\n dispatch({ type: \"FAILED_SEND_SET\", failedSend: { text: content, attachmentIds: refs } });\n throw report(error);\n }\n }\n }\n }, [client, consumePublicStream, report]);\n\n const sendMessage = useCallback(async (content: string): Promise<void> => send(content), [send]);\n\n const retryLastMessage = useCallback(async (): Promise<void> => {\n const failed = stateRef.current.lastFailedSend;\n if (!failed) throw report(new AgentWebAppRuntimeClientError(\"INVALID_REQUEST\", \"No failed message to retry\", false));\n await send(failed.text, failed.attachmentIds);\n }, [report, send]);\n\n const uploadAttachment = useCallback(async (file: Blob): Promise<void> => {\n const current = stateRef.current;\n const generation = generationRef.current;\n const threadGeneration = threadGenerationRef.current;\n if (!current.bootstrap?.webApp.features.attachments) throw featureDisabled(\"Attachments are disabled\");\n if (!current.activeThread) throw report(new AgentWebAppRuntimeClientError(\"THREAD_NOT_FOUND\", \"No active thread\", false));\n dispatch({ type: \"ATTACHMENTS_LOADING\", loading: true });\n try {\n const projectId = requestProjectId(current.bootstrap, current.activeThread.projectId);\n const attachment = await threadControlled((signal) => client.uploadAttachment(current.activeThread!.id, file, projectId ? { projectId } : {}, signal));\n if (generation === generationRef.current && threadGeneration === threadGenerationRef.current) dispatch({ type: \"ATTACHMENT_ADD\", attachment });\n } catch (error) {\n if (!isAbortError(error) && generation === generationRef.current && threadGeneration === threadGenerationRef.current) throw report(error);\n } finally { if (generation === generationRef.current && threadGeneration === threadGenerationRef.current) dispatch({ type: \"ATTACHMENTS_LOADING\", loading: false }); }\n }, [client, report, threadControlled]);\n\n const resumeInterrupt = useCallback(async (interruptId: string, response: AgentWebAppInterruptResponse, message: string): Promise<void> => {\n const current = stateRef.current;\n const generation = generationRef.current;\n const threadGeneration = threadGenerationRef.current;\n if (streamRef.current || current.stream.isStreaming) throw report(new AgentWebAppRuntimeClientError(\"STREAM_CONFLICT\", \"A message is already streaming\", false));\n if (!current.bootstrap?.webApp.features.hitl) throw featureDisabled(\"Human review is disabled\");\n if (!current.activeThread || !current.projectId) throw report(new AgentWebAppRuntimeClientError(\"THREAD_NOT_FOUND\", \"No active thread\", false));\n if (!current.interrupts.some((item) => item.id === interruptId)) throw report(new AgentWebAppRuntimeClientError(\"INVALID_REQUEST\", \"Interrupt not found\", false));\n const activeThread = current.activeThread;\n const projectId = requestProjectId(current.bootstrap, current.projectId);\n const modelKey = requestModelKey(current.bootstrap, current.modelKey);\n const streamGeneration = ++streamGenerationRef.current;\n const assistantId = `pending-assistant-${Date.now()}-${Math.random().toString(36).slice(2)}`;\n dispatch({ type: \"INTERRUPTS_LOADING\", loading: true });\n try {\n await consumePublicStream({\n threadId: activeThread.id, projectId, assistantId, generation, streamGeneration,\n run: (onEvent, signal) => client.resumeInterrupt(activeThread.id, interruptId, {\n ...(projectId ? { projectId } : {}),\n ...(modelKey ? { modelKey } : {}), message, response,\n }, onEvent, signal),\n });\n if (generation !== generationRef.current || threadGeneration !== threadGenerationRef.current) return;\n dispatch({ type: \"INTERRUPT_REMOVE\", interruptId });\n await loadMessages(activeThread, generation, threadGeneration);\n } catch (error) {\n if (generation === generationRef.current && threadGeneration === threadGenerationRef.current) {\n dispatch({ type: \"MESSAGES_REMOVE\", ids: [assistantId, `${assistantId}-genui`] });\n if (!isAbortError(error)) throw report(error);\n }\n } finally {\n if (generation === generationRef.current && threadGeneration === threadGenerationRef.current) dispatch({ type: \"INTERRUPTS_LOADING\", loading: false });\n }\n }, [client, consumePublicStream, loadMessages, report]);\n\n const value = {\n ...state,\n retry: bootstrapRuntime,\n selectProject,\n selectModel,\n refreshThreads,\n selectThread,\n createThread,\n renameThread,\n deleteThread,\n sendMessage,\n retryLastMessage,\n abort,\n uploadAttachment,\n removeAttachment: (ref: string) => dispatch({ type: \"ATTACHMENT_REMOVE\", ref }),\n clearAttachments: () => dispatch({ type: \"ATTACHMENTS_CLEAR\" }),\n resumeInterrupt,\n clearError: () => dispatch({ type: \"ERROR_SET\", error: null }),\n };\n return <AgentWebAppContext.Provider value={value}>{children}</AgentWebAppContext.Provider>;\n}\n","import { createContext } from \"react\";\nimport type { AgentWebAppInterruptResponse, AgentWebAppRuntimeThread } from \"./types\";\nimport { AgentWebAppRuntimeClientError } from \"./error\";\nimport type { AgentWebAppState } from \"./state/agentWebAppReducer\";\n\nexport interface AgentWebAppContextValue extends AgentWebAppState {\n retry(): Promise<void>;\n selectProject(projectId: string): Promise<void>;\n selectModel(modelKey: string): void;\n refreshThreads(): Promise<void>;\n selectThread(thread: AgentWebAppRuntimeThread): Promise<void>;\n createThread(label?: string): Promise<AgentWebAppRuntimeThread>;\n renameThread(threadId: string, label: string): Promise<AgentWebAppRuntimeThread>;\n deleteThread(threadId: string): Promise<void>;\n sendMessage(content: string): Promise<void>;\n retryLastMessage(): Promise<void>;\n abort(): Promise<void>;\n uploadAttachment(file: Blob): Promise<void>;\n removeAttachment(ref: string): void;\n clearAttachments(): void;\n resumeInterrupt(interruptId: string, response: AgentWebAppInterruptResponse, message: string): Promise<void>;\n clearError(): void;\n}\n\nexport const AgentWebAppContext = createContext<AgentWebAppContextValue | null>(null);\n\nexport function featureDisabled(message: string): AgentWebAppRuntimeClientError {\n return new AgentWebAppRuntimeClientError(\"FEATURE_DISABLED\", message, false, 403);\n}\n","import type {\n AgentWebAppAttachment,\n AgentWebAppBootstrap,\n AgentWebAppInterrupt,\n AgentWebAppGenUIBlock,\n AgentWebAppRuntimeMessage,\n AgentWebAppRuntimeThread,\n} from \"../types\";\nimport type { AgentWebAppRuntimeClientError } from \"../error\";\n\nexport interface AgentWebAppToolState {\n id: string;\n name?: string;\n status: \"running\" | \"completed\";\n}\n\nexport interface AgentWebAppFailedSend {\n text: string;\n attachmentIds: string[];\n}\n\nexport interface AgentWebAppState {\n bootstrap: AgentWebAppBootstrap | null;\n projectId: string | null;\n modelKey: string | null;\n threads: AgentWebAppRuntimeThread[];\n activeThread: AgentWebAppRuntimeThread | null;\n messages: AgentWebAppRuntimeMessage[];\n stream: { isStreaming: boolean; assistantMessageId: string | null; tools: AgentWebAppToolState[] };\n lastFailedSend: AgentWebAppFailedSend | null;\n attachments: AgentWebAppAttachment[];\n interrupts: AgentWebAppInterrupt[];\n errors: { current: AgentWebAppRuntimeClientError | null };\n loading: { bootstrap: boolean; threads: boolean; messages: boolean; attachments: boolean; interrupts: boolean };\n}\n\nexport const initialAgentWebAppState: AgentWebAppState = {\n bootstrap: null,\n projectId: null,\n modelKey: null,\n threads: [],\n activeThread: null,\n messages: [],\n stream: { isStreaming: false, assistantMessageId: null, tools: [] },\n lastFailedSend: null,\n attachments: [],\n interrupts: [],\n errors: { current: null },\n loading: { bootstrap: true, threads: false, messages: false, attachments: false, interrupts: false },\n};\n\nexport type AgentWebAppAction =\n | { type: \"BOOTSTRAP_LOADING\" }\n | { type: \"BOOTSTRAP_READY\"; bootstrap: AgentWebAppBootstrap; projectId: string; modelKey: string | null }\n | { type: \"BOOTSTRAP_SETTLED\" }\n | { type: \"PROJECT_SELECTED\"; projectId: string }\n | { type: \"MODEL_SELECTED\"; modelKey: string }\n | { type: \"THREADS_LOADING\"; loading: boolean }\n | { type: \"THREADS_SET\"; threads: AgentWebAppRuntimeThread[] }\n | { type: \"THREAD_UPSERT\"; thread: AgentWebAppRuntimeThread }\n | { type: \"THREAD_DELETED\"; threadId: string }\n | { type: \"ACTIVE_THREAD_SET\"; thread: AgentWebAppRuntimeThread | null }\n | { type: \"ACTIVE_THREAD_UPDATED\"; thread: AgentWebAppRuntimeThread }\n | { type: \"MESSAGES_LOADING\"; loading: boolean }\n | { type: \"MESSAGES_SET\"; messages: AgentWebAppRuntimeMessage[] }\n | { type: \"MESSAGE_APPEND\"; message: AgentWebAppRuntimeMessage }\n | { type: \"MESSAGES_REMOVE\"; ids: string[] }\n | { type: \"ASSISTANT_DELTA\"; id: string; text: string }\n | { type: \"ASSISTANT_GENUI\"; id: string; block: AgentWebAppGenUIBlock }\n | { type: \"ASSISTANT_COMPLETED\"; temporaryId: string; messageId: string }\n | { type: \"STREAM_SET\"; streaming: boolean; assistantMessageId?: string | null }\n | { type: \"TOOL_STARTED\"; id: string; name: string }\n | { type: \"TOOL_COMPLETED\"; id: string }\n | { type: \"ATTACHMENTS_LOADING\"; loading: boolean }\n | { type: \"ATTACHMENT_ADD\"; attachment: AgentWebAppAttachment }\n | { type: \"ATTACHMENT_REMOVE\"; ref: string }\n | { type: \"ATTACHMENTS_CLEAR\" }\n | { type: \"ATTACHMENTS_REMOVE\"; refs: string[] }\n | { type: \"INTERRUPT_ADD\"; interrupt: AgentWebAppInterrupt }\n | { type: \"INTERRUPT_REMOVE\"; interruptId: string }\n | { type: \"INTERRUPTS_LOADING\"; loading: boolean }\n | { type: \"ERROR_SET\"; error: AgentWebAppRuntimeClientError | null }\n | { type: \"FAILED_SEND_SET\"; failedSend: AgentWebAppFailedSend | null };\n\nexport function agentWebAppReducer(state: AgentWebAppState, action: AgentWebAppAction): AgentWebAppState {\n switch (action.type) {\n case \"BOOTSTRAP_LOADING\": return { ...initialAgentWebAppState, loading: { ...initialAgentWebAppState.loading, bootstrap: true } };\n case \"BOOTSTRAP_READY\": return { ...state, bootstrap: action.bootstrap, projectId: action.projectId, modelKey: action.modelKey, loading: { ...state.loading, bootstrap: false } };\n case \"BOOTSTRAP_SETTLED\": return { ...state, loading: { ...state.loading, bootstrap: false } };\n case \"PROJECT_SELECTED\": return { ...state, projectId: action.projectId, threads: [], activeThread: null, messages: [], attachments: [], interrupts: [], stream: initialAgentWebAppState.stream, lastFailedSend: null, loading: { ...state.loading, messages: false, attachments: false, interrupts: false } };\n case \"MODEL_SELECTED\": return { ...state, modelKey: action.modelKey };\n case \"THREADS_LOADING\": return { ...state, loading: { ...state.loading, threads: action.loading } };\n case \"THREADS_SET\": return { ...state, threads: action.threads, loading: { ...state.loading, threads: false } };\n case \"THREAD_UPSERT\": return { ...state, threads: [action.thread, ...state.threads.filter((item) => item.id !== action.thread.id)], activeThread: state.activeThread?.id === action.thread.id ? action.thread : state.activeThread };\n case \"THREAD_DELETED\": return { ...state, threads: state.threads.filter((item) => item.id !== action.threadId), activeThread: state.activeThread?.id === action.threadId ? null : state.activeThread, messages: state.activeThread?.id === action.threadId ? [] : state.messages, lastFailedSend: state.activeThread?.id === action.threadId ? null : state.lastFailedSend };\n case \"ACTIVE_THREAD_SET\": return { ...state, activeThread: action.thread, messages: [], attachments: [], interrupts: [], stream: initialAgentWebAppState.stream, lastFailedSend: null, loading: { ...state.loading, messages: false, attachments: false, interrupts: false } };\n case \"ACTIVE_THREAD_UPDATED\": return { ...state, activeThread: action.thread };\n case \"MESSAGES_LOADING\": return { ...state, loading: { ...state.loading, messages: action.loading } };\n case \"MESSAGES_SET\": return { ...state, messages: action.messages, loading: { ...state.loading, messages: false } };\n case \"MESSAGE_APPEND\": return { ...state, messages: [...state.messages, action.message] };\n case \"MESSAGES_REMOVE\": return { ...state, messages: state.messages.filter((message) => !action.ids.includes(message.id)) };\n case \"ASSISTANT_DELTA\": {\n const index = state.messages.findIndex((message) => message.id === action.id);\n if (index < 0) return { ...state, messages: [...state.messages, { id: action.id, role: \"ai\", content: action.text }] };\n return { ...state, messages: state.messages.map((message, itemIndex) => itemIndex === index ? { ...message, content: `${message.content ?? \"\"}${action.text}` } : message) };\n }\n case \"ASSISTANT_GENUI\": {\n const widgetMessageId = `${action.id}-genui`;\n const index = state.messages.findIndex((message) => message.id === widgetMessageId);\n if (index < 0) return { ...state, messages: [...state.messages, { id: widgetMessageId, role: \"ai\", content: [action.block] }] };\n return { ...state, messages: state.messages.map((message, itemIndex) => itemIndex === index\n ? { ...message, content: [...(Array.isArray(message.content) ? message.content : []), action.block] }\n : message) };\n }\n case \"ASSISTANT_COMPLETED\": return { ...state, messages: state.messages.map((message) => message.id === action.temporaryId\n ? { ...message, id: action.messageId }\n : message.id === `${action.temporaryId}-genui` ? { ...message, id: `${action.messageId}-genui` } : message), stream: { ...state.stream, assistantMessageId: action.messageId } };\n case \"STREAM_SET\": return { ...state, stream: { ...state.stream, isStreaming: action.streaming, assistantMessageId: action.assistantMessageId === undefined ? state.stream.assistantMessageId : action.assistantMessageId, ...(action.streaming ? { tools: [] } : {}) } };\n case \"TOOL_STARTED\": return { ...state, stream: { ...state.stream, tools: [...state.stream.tools.filter((tool) => tool.id !== action.id), { id: action.id, name: action.name, status: \"running\" }] } };\n case \"TOOL_COMPLETED\": return { ...state, stream: { ...state.stream, tools: state.stream.tools.map((tool) => tool.id === action.id ? { ...tool, status: \"completed\" } : tool) } };\n case \"ATTACHMENTS_LOADING\": return { ...state, loading: { ...state.loading, attachments: action.loading } };\n case \"ATTACHMENT_ADD\": return { ...state, attachments: [...state.attachments, action.attachment], loading: { ...state.loading, attachments: false } };\n case \"ATTACHMENT_REMOVE\": return { ...state, attachments: state.attachments.filter((item) => item.ref !== action.ref) };\n case \"ATTACHMENTS_CLEAR\": return { ...state, attachments: [] };\n case \"ATTACHMENTS_REMOVE\": return { ...state, attachments: state.attachments.filter((item) => !action.refs.includes(item.ref)) };\n case \"INTERRUPT_ADD\": return { ...state, interrupts: [...state.interrupts.filter((item) => item.id !== action.interrupt.id), action.interrupt] };\n case \"INTERRUPT_REMOVE\": return { ...state, interrupts: state.interrupts.filter((item) => item.id !== action.interruptId), loading: { ...state.loading, interrupts: false } };\n case \"INTERRUPTS_LOADING\": return { ...state, loading: { ...state.loading, interrupts: action.loading } };\n case \"ERROR_SET\": return { ...state, errors: { current: action.error }, loading: action.error && !state.bootstrap ? { ...state.loading, bootstrap: false } : state.loading };\n case \"FAILED_SEND_SET\": return { ...state, lastFailedSend: action.failedSend };\n }\n}\n","import { useContext } from \"react\";\nimport { AgentWebAppContext } from \"../AgentWebAppContext\";\n\nexport function useAgentWebApp() {\n const context = useContext(AgentWebAppContext);\n if (!context) throw new Error(\"useAgentWebApp must be used within AgentWebAppProvider\");\n return context;\n}\n","import { useContext } from \"react\";\nimport { AgentWebAppContext } from \"../AgentWebAppContext\";\n\nexport function useWidgetAttachments() {\n const context = useContext(AgentWebAppContext);\n if (!context) throw new Error(\"useWidgetAttachments must be used within AgentWebAppProvider\");\n return {\n attachments: context.attachments,\n isLoading: context.loading.attachments,\n error: context.errors.current,\n uploadAttachment: context.uploadAttachment,\n removeAttachment: context.removeAttachment,\n clearAttachments: context.clearAttachments,\n };\n}\n","import { useContext } from \"react\";\nimport { AgentWebAppContext } from \"../AgentWebAppContext\";\n\nexport function useWidgetChat() {\n const context = useContext(AgentWebAppContext);\n if (!context) throw new Error(\"useWidgetChat must be used within AgentWebAppProvider\");\n return {\n activeThread: context.activeThread,\n messages: context.messages,\n tools: context.stream.tools,\n isStreaming: context.stream.isStreaming,\n isLoading: context.loading.messages,\n lastFailedSend: context.lastFailedSend,\n error: context.errors.current,\n sendMessage: context.sendMessage,\n retry: context.retryLastMessage,\n abort: context.abort,\n };\n}\n","import { useContext } from \"react\";\nimport { AgentWebAppContext } from \"../AgentWebAppContext\";\n\nexport function useWidgetInterrupts() {\n const context = useContext(AgentWebAppContext);\n if (!context) throw new Error(\"useWidgetInterrupts must be used within AgentWebAppProvider\");\n return {\n interrupts: context.interrupts,\n isLoading: context.loading.interrupts,\n error: context.errors.current,\n resumeInterrupt: context.resumeInterrupt,\n };\n}\n","import { useContext } from \"react\";\nimport { AgentWebAppContext } from \"../AgentWebAppContext\";\n\nexport function useWidgetProject() {\n const context = useContext(AgentWebAppContext);\n if (!context) throw new Error(\"useWidgetProject must be used within AgentWebAppProvider\");\n return {\n bootstrap: context.bootstrap,\n projectId: context.projectId,\n modelKey: context.modelKey,\n selectProject: context.selectProject,\n selectModel: context.selectModel,\n isLoading: context.loading.bootstrap || context.loading.threads,\n error: context.errors.current,\n };\n}\n","import { useContext } from \"react\";\nimport { AgentWebAppContext } from \"../AgentWebAppContext\";\n\nexport function useWidgetThreads() {\n const context = useContext(AgentWebAppContext);\n if (!context) throw new Error(\"useWidgetThreads must be used within AgentWebAppProvider\");\n return {\n threads: context.threads,\n activeThread: context.activeThread,\n isLoading: context.loading.bootstrap || context.loading.threads,\n error: context.errors.current,\n refreshThreads: context.refreshThreads,\n selectThread: context.selectThread,\n createThread: context.createThread,\n renameThread: context.renameThread,\n deleteThread: context.deleteThread,\n };\n}\n","import React, { useRef, useState } from \"react\";\nimport { useWidgetAttachments } from \"../hooks/useWidgetAttachments\";\nimport { useWidgetChat } from \"../hooks/useWidgetChat\";\nimport { useWidgetProject } from \"../hooks/useWidgetProject\";\nimport { widgetErrorMessage } from \"./widget-utils\";\n\nexport interface WidgetAttachmentsProps { className?: string; attachLabel?: string; }\n\nexport function WidgetAttachments({ className, attachLabel = \"Attach files\" }: WidgetAttachmentsProps): React.ReactElement | null {\n const { bootstrap } = useWidgetProject();\n const { activeThread } = useWidgetChat();\n const { attachments, isLoading, uploadAttachment, removeAttachment } = useWidgetAttachments();\n const pendingRef = useRef(false);\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n if (!bootstrap?.webApp.features.attachments) return null;\n const upload = async (event: React.ChangeEvent<HTMLInputElement>): Promise<void> => {\n if (pendingRef.current) return;\n pendingRef.current = true;\n setPending(true);\n setError(null);\n try { for (const file of Array.from(event.target.files ?? [])) await uploadAttachment(file); }\n catch (uploadError) { setError(widgetErrorMessage(uploadError)); }\n finally { pendingRef.current = false; setPending(false); if (inputRef.current) inputRef.current.value = \"\"; }\n };\n return <div className={className}>{attachments.length > 0 && <div className=\"axiom-web-app__attachments\">{attachments.map((attachment) => <span className=\"axiom-web-app__attachment\" key={attachment.ref}>{attachment.name}<button type=\"button\" aria-label={`Remove ${attachment.name}`} onClick={() => removeAttachment(attachment.ref)}>Remove</button></span>)}</div>}{error && <p className=\"axiom-web-app__error\" role=\"alert\">{error}</p>}<label className=\"axiom-web-app__attach\"><span>{isLoading || pending ? \"Uploading...\" : attachLabel}</span><input ref={inputRef} type=\"file\" multiple aria-label={attachLabel} disabled={!activeThread || isLoading || pending} onChange={(event) => void upload(event)} /></label></div>;\n}\n","export function widgetErrorMessage(error: unknown): string {\n return error instanceof Error ? error.message : \"Request failed\";\n}\n","import React, { useRef, useState } from \"react\";\nimport { useWidgetChat } from \"../hooks/useWidgetChat\";\nimport { widgetErrorMessage } from \"./widget-utils\";\n\nexport interface WidgetComposerProps { className?: string; messageLabel?: string; placeholder?: string; sendLabel?: string; abortLabel?: string; leadingSlot?: React.ReactNode; }\n\nexport function WidgetComposer({ className, messageLabel = \"Message\", placeholder = \"Ask a question\", sendLabel = \"Send message\", abortLabel = \"Stop response\", leadingSlot }: WidgetComposerProps): React.ReactElement {\n const { activeThread, isStreaming, sendMessage, abort, retry, lastFailedSend } = useWidgetChat();\n const pendingRef = useRef(false);\n const draftRef = useRef(\"\");\n const [pending, setPending] = useState(false);\n const [text, setText] = useState(\"\");\n const [error, setError] = useState<string | null>(null);\n const run = async (operation: () => Promise<void>): Promise<void> => {\n if (pendingRef.current) return;\n pendingRef.current = true; setPending(true); setError(null);\n try { await operation(); }\n catch (operationError) { setError(widgetErrorMessage(operationError)); }\n finally { pendingRef.current = false; setPending(false); }\n };\n const submit = (event: React.FormEvent): void => {\n event.preventDefault();\n const content = text.trim();\n if (!content || isStreaming) return;\n draftRef.current = \"\";\n setText(\"\");\n void (async () => {\n if (pendingRef.current) return;\n pendingRef.current = true; setPending(true); setError(null);\n try { await sendMessage(content); }\n catch (sendError) {\n setError(widgetErrorMessage(sendError));\n if (draftRef.current === \"\") { draftRef.current = content; setText(content); }\n } finally { pendingRef.current = false; setPending(false); }\n })();\n };\n return <form className={`axiom-web-app__composer${className ? ` ${className}` : \"\"}`} onSubmit={submit}>{leadingSlot}{error && <p className=\"axiom-web-app__error\" role=\"alert\">{error}</p>}<label className=\"axiom-web-app__composer-input\"><span className=\"axiom-web-app__sr-only\">{messageLabel}</span><textarea aria-label={messageLabel} value={text} placeholder={placeholder} disabled={!activeThread} onChange={(event) => { draftRef.current = event.target.value; setText(event.target.value); }} /></label><div className=\"axiom-web-app__composer-actions\">{lastFailedSend && <button type=\"button\" onClick={() => void run(retry)} disabled={isStreaming || pending}>Retry failed message</button>}{isStreaming ? <button type=\"button\" disabled={pending} onClick={() => void run(abort)}>{abortLabel}</button> : <button type=\"submit\" disabled={!activeThread || !text.trim() || pending}>{sendLabel}</button>}</div></form>;\n}\n","import React from \"react\";\nimport type { AgentWebAppInterrupt, AgentWebAppInterruptResponse } from \"../types\";\nimport { useReviewDecision } from \"../../../components/shared/useReviewDecision\";\n\nexport interface WidgetInterruptViewProps {\n interrupt: AgentWebAppInterrupt;\n onSubmit(interruptId: string, response: AgentWebAppInterruptResponse, message: string): Promise<void>;\n className?: string;\n approveLabel?: string;\n rejectLabel?: string;\n feedbackLabel?: string;\n disabled?: boolean;\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : \"Unable to submit review\";\n}\n\nexport function WidgetInterruptView({ interrupt, onSubmit, className, approveLabel = \"Approve\", rejectLabel = \"Reject\", feedbackLabel = \"Feedback\", disabled = false }: WidgetInterruptViewProps): React.ReactElement {\n const review = useReviewDecision(async (decision, feedback) => {\n const approved = decision === \"approve\";\n await onSubmit(interrupt.id, { approved, ...(feedback ? { feedback } : {}) }, feedback || (approved ? \"Approved\" : \"Changes requested\"));\n });\n\n const submit = async (approved: boolean): Promise<void> => {\n if (disabled) return;\n await review.submit(approved ? \"approve\" : \"reject\");\n };\n\n return (\n <section className={`axiom-web-app__interrupt${className ? ` ${className}` : \"\"}`} aria-label=\"Human review\">\n <strong>{interrupt.prompt}</strong>\n {interrupt.data && <p className=\"axiom-web-app__interrupt-fallback\">Additional review details are unavailable.</p>}\n <label className=\"axiom-web-app__feedback\">\n <span>{feedbackLabel}</span>\n <textarea value={review.feedback} disabled={disabled || review.pending !== null} onChange={(event) => review.setFeedback(event.target.value)} />\n </label>\n {review.error !== null && <p className=\"axiom-web-app__error\" role=\"alert\">{errorMessage(review.error)}</p>}\n <div className=\"axiom-web-app__interrupt-actions\">\n <button type=\"button\" disabled={disabled || review.pending !== null} onClick={() => void submit(false)}>{rejectLabel}</button>\n <button type=\"button\" disabled={disabled || review.pending !== null} onClick={() => void submit(true)}>{approveLabel}</button>\n </div>\n </section>\n );\n}\n","import React from \"react\";\nimport type { AgentWebAppInterrupt } from \"../types\";\nimport { useWidgetInterrupts } from \"../hooks/useWidgetInterrupts\";\nimport { useWidgetProject } from \"../hooks/useWidgetProject\";\nimport { WidgetInterruptView } from \"./WidgetInterruptView\";\n\nexport interface WidgetInterruptProps { interrupt: AgentWebAppInterrupt; className?: string; approveLabel?: string; rejectLabel?: string; feedbackLabel?: string; }\n\nexport function WidgetInterrupt(props: WidgetInterruptProps): React.ReactElement | null {\n const { bootstrap } = useWidgetProject();\n const { isLoading, resumeInterrupt } = useWidgetInterrupts();\n if (!bootstrap?.webApp.features.hitl) return null;\n return <WidgetInterruptView {...props} disabled={isLoading} onSubmit={resumeInterrupt} />;\n}\n","import XMarkdown, { type ComponentProps, type XMarkdownProps } from \"@ant-design/x-markdown\";\nimport React from \"react\";\n\nexport interface WidgetMarkdownProps {\n content: unknown;\n className?: string;\n unsupportedLabel?: string;\n}\n\nfunction safeUrl(value: unknown): string | null {\n if (typeof value !== \"string\") return null;\n try {\n const url = new URL(value, \"https://axiom.invalid\");\n return url.protocol === \"http:\" || url.protocol === \"https:\" || url.protocol === \"mailto:\" ? value : null;\n } catch {\n return null;\n }\n}\n\nconst SafeLink: React.FC<ComponentProps<{ href?: string }>> = ({ href, children }) => {\n const safeHref = safeUrl(href);\n return safeHref ? <a href={safeHref} target=\"_blank\" rel=\"noopener noreferrer\">{children}</a> : <span>{children}</span>;\n};\n\nconst SafeImage: React.FC<ComponentProps<{ src?: string; alt?: string }>> = ({ src, alt }) => {\n const safeHref = safeUrl(src);\n const label = alt?.trim() || \"Image\";\n return safeHref ? <a href={safeHref} target=\"_blank\" rel=\"noopener noreferrer\">{label}</a> : <span>{label}</span>;\n};\n\nconst SafeCode: React.FC<ComponentProps> = ({ children }) => <code>{children}</code>;\n\nconst REVIEWED_MARKDOWN_COMPONENTS = Object.freeze<XMarkdownProps[\"components\"]>({\n a: SafeLink,\n code: SafeCode,\n img: SafeImage,\n});\n\nexport function WidgetMarkdown({ content, className, unsupportedLabel = \"Unsupported message content\" }: WidgetMarkdownProps): React.ReactElement {\n if (typeof content !== \"string\") return <span className={className}>{unsupportedLabel}</span>;\n return <XMarkdown className={className} content={content} components={REVIEWED_MARKDOWN_COMPONENTS} paragraphTag=\"div\" escapeRawHtml />;\n}\n","import React from \"react\";\nimport type { AgentWebAppGenUIBlock } from \"../types\";\n\nexport interface WidgetGenUIRendererProps { block: AgentWebAppGenUIBlock }\n\n/** Immutable semantic renderer for the reviewed V1 declarative widget allowlist. */\nexport function WidgetGenUIRenderer({ block }: WidgetGenUIRendererProps): React.ReactElement {\n const widget = block.widget;\n if (widget.kind === \"callout\") {\n return <aside className={`axiom-web-app__callout axiom-web-app__callout--${widget.tone ?? \"info\"}`} aria-label={widget.title ?? \"Callout\"}>\n {widget.title && <strong>{widget.title}</strong>}<p>{widget.text}</p>\n </aside>;\n }\n return <table className=\"axiom-web-app__data-table\" aria-label={widget.caption ?? \"Data table\"}>\n {widget.caption && <caption>{widget.caption}</caption>}\n <thead><tr>{widget.columns.map((column, index) => <th key={`${index}-${column}`} scope=\"col\">{column}</th>)}</tr></thead>\n <tbody>{widget.rows.map((row, rowIndex) => <tr key={rowIndex}>{row.map((cell, columnIndex) => <td key={columnIndex}>{cell}</td>)}</tr>)}</tbody>\n </table>;\n}\n","import React from \"react\";\nimport type { AgentWebAppRuntimeMessage } from \"../types\";\nimport { useWidgetChat } from \"../hooks/useWidgetChat\";\nimport { WidgetMarkdown } from \"./WidgetMarkdown\";\nimport { WidgetGenUIRenderer } from \"./WidgetGenUIRenderer\";\n\nexport interface WidgetMessageListProps { className?: string; listLabel?: string; emptyLabel?: string; toolActivityLabel?: string; emptySlot?: React.ReactNode; }\n\nfunction roleName(message: AgentWebAppRuntimeMessage): string {\n if (message.role === \"human\") return \"You\";\n if (message.role === \"ai\") return \"Assistant\";\n return message.role;\n}\n\nexport function WidgetMessageList({ className, listLabel = \"Messages\", emptyLabel = \"Start a conversation\", toolActivityLabel = \"Activity\", emptySlot }: WidgetMessageListProps): React.ReactElement {\n const { messages, tools, isLoading } = useWidgetChat();\n return <div className={`axiom-web-app__message-area${className ? ` ${className}` : \"\"}`}><div className=\"axiom-web-app__messages\" role=\"log\" aria-label={listLabel} aria-live=\"polite\">{!isLoading && messages.length === 0 && (emptySlot || <p className=\"axiom-web-app__empty\">{emptyLabel}</p>)}{messages.map((message) => <article className={`axiom-web-app__message axiom-web-app__message--${message.role}`} key={message.id}><span className=\"axiom-web-app__message-role\">{roleName(message)}</span><div className=\"axiom-web-app__message-content\">{Array.isArray(message.content) ? message.content.map((block, index) => <WidgetGenUIRenderer key={index} block={block} />) : <WidgetMarkdown content={message.content ?? \"\"} />}</div></article>)}</div>{tools.length > 0 && <section className=\"axiom-web-app__tools\" aria-label={toolActivityLabel}>{tools.map((tool) => <div className=\"axiom-web-app__tool\" key={tool.id}><span aria-hidden=\"true\">{tool.status === \"running\" ? \"...\" : \"OK\"}</span> {tool.name || \"Tool\"}</div>)}</section>}</div>;\n}\n","import React, { useState } from \"react\";\nimport { useWidgetProject } from \"../hooks/useWidgetProject\";\nimport { widgetErrorMessage } from \"./widget-utils\";\n\nexport interface WidgetModelSelectorProps { className?: string; label?: string; }\n\nexport function WidgetModelSelector({ className, label = \"Model\" }: WidgetModelSelectorProps): React.ReactElement | null {\n const { bootstrap, modelKey, selectModel, isLoading } = useWidgetProject();\n const [error, setError] = useState<string | null>(null);\n if (!bootstrap?.webApp.features.modelSelector) return null;\n const select = (key: string): void => {\n setError(null);\n try { selectModel(key); } catch (selectionError) { setError(widgetErrorMessage(selectionError)); }\n };\n return <div className={className}><label className=\"axiom-web-app__field\"><span>{label}</span><select aria-label={label} value={modelKey ?? \"\"} disabled={isLoading} onChange={(event) => select(event.target.value)}>{bootstrap.models.map((model) => <option key={model.key} value={model.key}>{model.label}</option>)}</select></label>{error && <p className=\"axiom-web-app__error\" role=\"alert\">{error}</p>}</div>;\n}\n","import React, { useRef, useState } from \"react\";\nimport { useWidgetProject } from \"../hooks/useWidgetProject\";\nimport { widgetErrorMessage } from \"./widget-utils\";\n\nexport interface WidgetProjectSelectorProps { className?: string; label?: string; }\n\nexport function WidgetProjectSelector({ className, label = \"Project\" }: WidgetProjectSelectorProps): React.ReactElement | null {\n const { bootstrap, projectId, selectProject, isLoading } = useWidgetProject();\n const pendingRef = useRef(false);\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<string | null>(null);\n if (!bootstrap?.webApp.features.projectSelector) return null;\n const select = async (id: string): Promise<void> => {\n if (pendingRef.current) return;\n pendingRef.current = true; setPending(true); setError(null);\n try { await selectProject(id); }\n catch (selectionError) { setError(widgetErrorMessage(selectionError)); }\n finally { pendingRef.current = false; setPending(false); }\n };\n return <div className={className}><label className=\"axiom-web-app__field\"><span>{label}</span><select aria-label={label} value={projectId ?? \"\"} disabled={isLoading || pending} onChange={(event) => void select(event.target.value)}>{bootstrap.projects.map((project) => <option key={project.id} value={project.id}>{project.name}</option>)}</select></label>{error && <p className=\"axiom-web-app__error\" role=\"alert\">{error}</p>}</div>;\n}\n","import React, { useRef, useState } from \"react\";\nimport { Modal } from \"antd\";\nimport type { AgentWebAppRuntimeThread } from \"../types\";\nimport { useWidgetProject } from \"../hooks/useWidgetProject\";\nimport { useWidgetThreads } from \"../hooks/useWidgetThreads\";\nimport { widgetErrorMessage } from \"./widget-utils\";\n\nexport interface WidgetThreadListProps { className?: string; navigationLabel?: string; newThreadLabel?: string; emptyLabel?: string; }\nfunction threadName(thread: AgentWebAppRuntimeThread, index: number): string { return thread.label?.trim() || `Conversation ${index + 1}`; }\n\nexport function WidgetThreadList({ className, navigationLabel = \"Conversations\", newThreadLabel = \"New conversation\", emptyLabel = \"No conversations yet\" }: WidgetThreadListProps): React.ReactElement | null {\n const { bootstrap } = useWidgetProject();\n const { threads, activeThread, isLoading, selectThread, createThread, renameThread, deleteThread } = useWidgetThreads();\n const pendingRef = useRef(false);\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [renameTarget, setRenameTarget] = useState<AgentWebAppRuntimeThread | null>(null);\n const [renameValue, setRenameValue] = useState(\"\");\n const [deleteTarget, setDeleteTarget] = useState<AgentWebAppRuntimeThread | null>(null);\n if (!bootstrap?.webApp.features.threadManagement) return null;\n const run = async (operation: () => Promise<unknown>, complete?: () => void): Promise<void> => {\n if (pendingRef.current) return;\n pendingRef.current = true; setPending(true); setError(null);\n try { await operation(); complete?.(); }\n catch (operationError) { setError(widgetErrorMessage(operationError)); }\n finally { pendingRef.current = false; setPending(false); }\n };\n return <nav className={`axiom-web-app__sidebar${className ? ` ${className}` : \"\"}`} aria-label={navigationLabel}>{error && <p className=\"axiom-web-app__error\" role=\"alert\">{error}</p>}<button className=\"axiom-web-app__new-thread\" type=\"button\" disabled={isLoading || pending} onClick={() => void run(() => createThread())}>{newThreadLabel}</button><div className=\"axiom-web-app__thread-list\">{!isLoading && threads.length === 0 && <p className=\"axiom-web-app__empty\">{emptyLabel}</p>}{threads.map((thread, index) => { const name = threadName(thread, index); return <div className={`axiom-web-app__thread${activeThread?.id === thread.id ? \" axiom-web-app__thread--active\" : \"\"}`} key={thread.id}><button type=\"button\" disabled={pending} className=\"axiom-web-app__thread-select\" aria-label={`Open ${name}`} aria-current={activeThread?.id === thread.id ? \"page\" : undefined} onClick={() => void run(() => selectThread(thread))}><span className=\"axiom-web-app__thread-label\" title={name}>{name}</span></button><button type=\"button\" disabled={pending} className=\"axiom-web-app__thread-rename\" aria-label={`Rename ${name}`} onClick={() => { setRenameTarget(thread); setRenameValue(name); }}>Rename</button><button type=\"button\" disabled={pending} className=\"axiom-web-app__thread-delete\" aria-label={`Delete ${name}`} onClick={() => setDeleteTarget(thread)}>Delete</button></div>; })}</div><Modal title=\"Rename conversation\" open={renameTarget !== null} onCancel={() => { if (!pending) setRenameTarget(null); }} onOk={() => renameTarget && void run(() => renameThread(renameTarget.id, renameValue.trim()), () => setRenameTarget(null))} okText=\"Save\" cancelText=\"Cancel\" okButtonProps={{ loading: pending, disabled: !renameValue.trim() }} cancelButtonProps={{ disabled: pending }}><label className=\"axiom-web-app__modal-field\"><span>Conversation name</span><input aria-label=\"Conversation name\" value={renameValue} disabled={pending} onChange={(event) => setRenameValue(event.target.value)} /></label></Modal><Modal title=\"Delete conversation?\" open={deleteTarget !== null} onCancel={() => { if (!pending) setDeleteTarget(null); }} onOk={() => deleteTarget && void run(() => deleteThread(deleteTarget.id), () => setDeleteTarget(null))} okText=\"Delete\" cancelText=\"Cancel\" okButtonProps={{ danger: true, loading: pending }} cancelButtonProps={{ disabled: pending }}><p>This conversation and its messages will be permanently deleted.</p></Modal></nav>;\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAgB,aAAa,WAAW,YAAY,cAAc;;;ACAlE,SAAS,qBAAqB;AAwBvB,IAAM,qBAAqB,cAA8C,IAAI;AAE7E,SAAS,gBAAgB,SAAgD;AAC9E,SAAO,IAAI,8BAA8B,oBAAoB,SAAS,OAAO,GAAG;AAClF;;;ACQO,IAAM,0BAA4C;AAAA,EACvD,WAAW;AAAA,EACX,WAAW;AAAA,EACX,UAAU;AAAA,EACV,SAAS,CAAC;AAAA,EACV,cAAc;AAAA,EACd,UAAU,CAAC;AAAA,EACX,QAAQ,EAAE,aAAa,OAAO,oBAAoB,MAAM,OAAO,CAAC,EAAE;AAAA,EAClE,gBAAgB;AAAA,EAChB,aAAa,CAAC;AAAA,EACd,YAAY,CAAC;AAAA,EACb,QAAQ,EAAE,SAAS,KAAK;AAAA,EACxB,SAAS,EAAE,WAAW,MAAM,SAAS,OAAO,UAAU,OAAO,aAAa,OAAO,YAAY,MAAM;AACrG;AAmCO,SAAS,mBAAmB,OAAyB,QAA6C;AACvG,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK;AAAqB,aAAO,EAAE,GAAG,yBAAyB,SAAS,EAAE,GAAG,wBAAwB,SAAS,WAAW,KAAK,EAAE;AAAA,IAChI,KAAK;AAAmB,aAAO,EAAE,GAAG,OAAO,WAAW,OAAO,WAAW,WAAW,OAAO,WAA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U,MAAM;AAAE,UAAI,CAAC,QAAS,iBAAgB,IAAI;AAAA,IAAG,GAAG,MAAM,MAAM,gBAAgB,KAAK,IAAI,MAAM,aAAa,aAAa,EAAE,GAAG,MAAM,gBAAgB,IAAI,CAAC,GAAG,QAAO,UAAS,YAAW,UAAS,eAAe,EAAE,QAAQ,MAAM,SAAS,QAAQ,GAAG,mBAAmB,EAAE,UAAU,QAAQ,GAAG,0BAAAA,MAAC,OAAE,6EAA+D,GAAI;AAAA,KAAQ;AACt4E;","names":["useContext","useContext","useContext","useContext","useContext","useContext","useContext","useContext","useContext","useContext","useRef","jsx","useRef","useRef","useState","jsx","jsxs","useRef","useState","jsx","jsxs","jsx","jsx","jsx","jsxs","jsx","jsxs","useState","jsx","jsxs","useState","useRef","useState","jsx","jsxs","useRef","useState","useRef","useState","jsx","jsxs","useRef","useState"]}
1
+ {"version":3,"sources":["../src/integrations/web-app/AgentWebAppProvider.tsx","../src/integrations/web-app/AgentWebAppContext.ts","../src/integrations/web-app/state/agentWebAppReducer.ts","../src/integrations/web-app/hooks/useAgentWebApp.ts","../src/integrations/web-app/hooks/useWidgetAttachments.ts","../src/integrations/web-app/hooks/useWidgetChat.ts","../src/integrations/web-app/hooks/useWidgetInterrupts.ts","../src/integrations/web-app/hooks/useWidgetProject.ts","../src/integrations/web-app/hooks/useWidgetThreads.ts","../src/integrations/web-app/components/WidgetAttachments.tsx","../src/integrations/web-app/components/widget-utils.ts","../src/integrations/web-app/components/WidgetComposer.tsx","../src/integrations/web-app/components/WidgetInterruptView.tsx","../src/integrations/web-app/components/WidgetInterrupt.tsx","../src/integrations/web-app/components/WidgetMarkdown.tsx","../src/integrations/web-app/components/WidgetGenUIRenderer.tsx","../src/integrations/web-app/components/WidgetMessageList.tsx","../src/integrations/web-app/components/WidgetModelSelector.tsx","../src/integrations/web-app/components/WidgetProjectSelector.tsx","../src/integrations/web-app/components/WidgetThreadList.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useReducer, useRef } from \"react\";\nimport { AgentWebAppContext, featureDisabled } from \"./AgentWebAppContext\";\nimport { AgentWebAppRuntimeClient } from \"./client\";\nimport { AgentWebAppRuntimeClientError } from \"./error\";\nimport { formatErrorMessage } from \"../../utils/errorMessage\";\nimport { agentWebAppReducer, initialAgentWebAppState } from \"./state/agentWebAppReducer\";\nimport type {\n AgentWebAppBootstrap,\n AgentWebAppInterruptResponse,\n AgentWebAppRuntimeThread,\n AgentWebAppStreamEvent,\n} from \"./types\";\n\nexport type AgentWebAppIdentity =\n | { mode: \"unverified\"; userId: string; displayName?: string }\n | { mode: \"verified\"; tokenProvider: () => Promise<string> };\n\nexport interface AgentWebAppProviderProps {\n gatewayUrl: string;\n webAppId: string;\n identity: AgentWebAppIdentity;\n children: React.ReactNode;\n onError?: (error: AgentWebAppRuntimeClientError) => void;\n fetch?: typeof globalThis.fetch;\n}\n\nfunction validateProps(props: AgentWebAppProviderProps): void {\n if (!props.gatewayUrl.trim()) throw new Error(\"AgentWebAppProvider requires gatewayUrl\");\n try { new URL(props.gatewayUrl); } catch { throw new Error(\"AgentWebAppProvider gatewayUrl must be a valid URL\"); }\n if (props.identity.mode === \"unverified\") {\n if (!props.identity.userId.trim()) throw new Error(\"AgentWebAppProvider requires identity.userId\");\n } else if (typeof props.identity.tokenProvider !== \"function\") {\n throw new Error(\"AgentWebAppProvider requires identity.tokenProvider\");\n }\n if (!props.fetch && typeof globalThis.fetch !== \"function\") throw new Error(\"AgentWebAppProvider requires a fetch implementation\");\n}\n\nfunction runtimeError(error: unknown): AgentWebAppRuntimeClientError {\n if (error instanceof AgentWebAppRuntimeClientError) return error;\n return new AgentWebAppRuntimeClientError(\"INTERNAL_ERROR\", \"Request failed\", true);\n}\n\nfunction isAbortError(error: unknown): boolean {\n return typeof error === \"object\" && error !== null && \"name\" in error && error.name === \"AbortError\";\n}\n\nfunction newestThread(threads: AgentWebAppRuntimeThread[]): AgentWebAppRuntimeThread | null {\n return threads.reduce<AgentWebAppRuntimeThread | null>((latest, item) => !latest || item.updatedAt > latest.updatedAt ? item : latest, null);\n}\n\nfunction requestProjectId(bootstrap: AgentWebAppBootstrap | null, projectId: string | null | undefined): string | undefined {\n return bootstrap?.webApp.features.projectSelector ? projectId ?? undefined : undefined;\n}\n\nfunction requestModelKey(bootstrap: AgentWebAppBootstrap | null, modelKey: string | null | undefined): string | undefined {\n return bootstrap?.webApp.features.modelSelector ? modelKey ?? undefined : undefined;\n}\n\nexport function AgentWebAppProvider(props: AgentWebAppProviderProps): React.ReactElement {\n validateProps(props);\n const scopeKey = `${props.gatewayUrl}\\u0000${props.webAppId}\\u0000${props.identity.mode === \"unverified\" ? props.identity.userId : \"verified:token\"}`;\n return <ScopedAgentWebAppProvider key={scopeKey} {...props} />;\n}\n\nfunction ScopedAgentWebAppProvider({ gatewayUrl, webAppId, identity, children, onError, fetch: fetchImplementation }: AgentWebAppProviderProps): React.ReactElement {\n const [state, dispatch] = useReducer(agentWebAppReducer, initialAgentWebAppState);\n const stateRef = useRef(state);\n stateRef.current = state;\n const generationRef = useRef(0);\n const threadGenerationRef = useRef(0);\n const streamGenerationRef = useRef(0);\n const controllersRef = useRef(new Set<AbortController>());\n const threadControllersRef = useRef(new Set<AbortController>());\n const streamRef = useRef<{ controller: AbortController; threadId: string; projectId?: string } | null>(null);\n const errorNotifiedRef = useRef<AgentWebAppRuntimeClientError | null>(null);\n const identityRef = useRef(identity);\n identityRef.current = identity;\n const clientRef = useRef<AgentWebAppRuntimeClient>();\n if (!clientRef.current) {\n clientRef.current = new AgentWebAppRuntimeClient({\n gatewayUrl,\n webAppId,\n identityProvider: {\n getIdentity: async () => {\n const current = identityRef.current;\n if (current.mode !== \"verified\") return { externalUserId: current.userId };\n try {\n return { bearerToken: await current.tokenProvider() };\n } catch {\n throw new AgentWebAppRuntimeClientError(\"USER_ID_REQUIRED\", \"Identity token provider failed\", true);\n }\n },\n },\n ...(fetchImplementation ? { fetch: fetchImplementation } : {}),\n });\n }\n const client = clientRef.current;\n\n const controlled = useCallback(async <T,>(operation: (signal: AbortSignal) => Promise<T>): Promise<T> => {\n const controller = new AbortController();\n controllersRef.current.add(controller);\n try { return await operation(controller.signal); }\n finally { controllersRef.current.delete(controller); }\n }, []);\n\n const threadControlled = useCallback(async <T,>(operation: (signal: AbortSignal) => Promise<T>): Promise<T> => {\n const controller = new AbortController();\n threadControllersRef.current.add(controller);\n try { return await operation(controller.signal); }\n finally { threadControllersRef.current.delete(controller); }\n }, []);\n\n const invalidateThreadWork = useCallback((): number => {\n const generation = ++threadGenerationRef.current;\n for (const controller of threadControllersRef.current) controller.abort();\n threadControllersRef.current.clear();\n return generation;\n }, []);\n\n const report = useCallback((error: unknown): AgentWebAppRuntimeClientError => {\n const normalized = runtimeError(error);\n dispatch({ type: \"ERROR_SET\", error: normalized });\n return normalized;\n }, []);\n\n const stopActiveStream = useCallback(async ({ abortBackend }: { abortBackend: boolean }): Promise<void> => {\n const active = streamRef.current;\n if (!active) return;\n streamGenerationRef.current += 1;\n streamRef.current = null;\n active.controller.abort();\n dispatch({ type: \"STREAM_SET\", streaming: false, assistantMessageId: null });\n if (abortBackend) await client.abort(active.threadId, active.projectId ? { projectId: active.projectId } : {});\n }, [client]);\n\n const loadMessages = useCallback(async (thread: AgentWebAppRuntimeThread, generation = generationRef.current, threadGeneration = threadGenerationRef.current, bootstrap = stateRef.current.bootstrap): Promise<void> => {\n dispatch({ type: \"MESSAGES_LOADING\", loading: true });\n try {\n const projectId = requestProjectId(bootstrap, thread.projectId);\n const result = await threadControlled((signal) => client.getMessages(thread.id, projectId ? { projectId } : {}, signal));\n if (generation === generationRef.current && threadGeneration === threadGenerationRef.current) dispatch({ type: \"MESSAGES_SET\", messages: result.messages });\n } catch (error) {\n if (!isAbortError(error) && generation === generationRef.current && threadGeneration === threadGenerationRef.current) report(error);\n } finally {\n if (generation === generationRef.current && threadGeneration === threadGenerationRef.current) dispatch({ type: \"MESSAGES_LOADING\", loading: false });\n }\n }, [client, report, threadControlled]);\n\n const loadManagedThreads = useCallback(async (projectId: string, generation = generationRef.current, threadGeneration = threadGenerationRef.current, bootstrap = stateRef.current.bootstrap): Promise<void> => {\n dispatch({ type: \"THREADS_LOADING\", loading: true });\n try {\n const selectedProjectId = requestProjectId(bootstrap, projectId);\n const result = await threadControlled((signal) => client.listThreads(selectedProjectId ? { projectId: selectedProjectId } : {}, signal));\n if (generation !== generationRef.current || threadGeneration !== threadGenerationRef.current) return;\n const latest = newestThread(result.records);\n if (streamRef.current && latest?.id !== stateRef.current.activeThread?.id) await stopActiveStream({ abortBackend: true });\n if (generation !== generationRef.current || threadGeneration !== threadGenerationRef.current) return;\n dispatch({ type: \"THREADS_SET\", threads: result.records });\n const currentActive = stateRef.current.activeThread;\n if (latest && latest.id === currentActive?.id) {\n dispatch({ type: \"ACTIVE_THREAD_UPDATED\", thread: latest });\n } else {\n threadGeneration = invalidateThreadWork();\n dispatch({ type: \"ACTIVE_THREAD_SET\", thread: latest });\n if (latest) await loadMessages(latest, generation, threadGeneration, bootstrap);\n }\n } catch (error) {\n if (!isAbortError(error) && generation === generationRef.current && threadGeneration === threadGenerationRef.current) report(error);\n } finally {\n if (generation === generationRef.current && threadGeneration === threadGenerationRef.current) dispatch({ type: \"THREADS_LOADING\", loading: false });\n }\n }, [client, invalidateThreadWork, loadMessages, report, stopActiveStream, threadControlled]);\n\n const bootstrapRuntime = useCallback(async (): Promise<void> => {\n try { await stopActiveStream({ abortBackend: true }); }\n catch (error) { if (!isAbortError(error)) report(error); }\n const generation = ++generationRef.current;\n for (const controller of controllersRef.current) controller.abort();\n controllersRef.current.clear();\n invalidateThreadWork();\n dispatch({ type: \"BOOTSTRAP_LOADING\" });\n try {\n const result = await controlled((signal) => client.bootstrap({}, signal));\n if (generation !== generationRef.current) return;\n const projectId = result.webApp.defaultProjectId;\n const modelKey = result.webApp.defaultModelKey ?? result.models[0]?.key ?? null;\n dispatch({ type: \"BOOTSTRAP_READY\", bootstrap: result, projectId, modelKey });\n if (result.webApp.features.threadManagement) {\n await loadManagedThreads(projectId, generation, threadGenerationRef.current, result);\n } else {\n const implicit = result.thread ?? null;\n dispatch({ type: \"THREADS_SET\", threads: implicit ? [implicit] : [] });\n dispatch({ type: \"ACTIVE_THREAD_SET\", thread: implicit });\n if (implicit) await loadMessages(implicit, generation, threadGenerationRef.current, result);\n }\n } catch (error) {\n if (!isAbortError(error) && generation === generationRef.current) report(error);\n } finally {\n if (generation === generationRef.current) dispatch({ type: \"BOOTSTRAP_SETTLED\" });\n }\n }, [client, controlled, invalidateThreadWork, loadManagedThreads, loadMessages, report, stopActiveStream]);\n\n useEffect(() => {\n void bootstrapRuntime();\n return () => {\n generationRef.current += 1;\n for (const controller of controllersRef.current) controller.abort();\n controllersRef.current.clear();\n invalidateThreadWork();\n void stopActiveStream({ abortBackend: true }).catch(() => undefined);\n };\n }, [bootstrapRuntime, invalidateThreadWork, stopActiveStream]);\n\n useEffect(() => {\n const error = state.errors.current;\n if (error && error !== errorNotifiedRef.current) {\n errorNotifiedRef.current = error;\n onError?.(error);\n }\n }, [onError, state.errors.current]);\n\n const abort = useCallback(async (): Promise<void> => {\n try { await stopActiveStream({ abortBackend: true }); }\n catch (error) { if (!isAbortError(error)) throw report(error); }\n }, [report, stopActiveStream]);\n\n const selectProject = useCallback(async (projectId: string): Promise<void> => {\n const current = stateRef.current;\n const bootstrap = current.bootstrap;\n if (!bootstrap) throw report(new AgentWebAppRuntimeClientError(\"INVALID_REQUEST\", \"Web App is not ready\", true));\n if (!bootstrap.webApp.features.projectSelector) throw featureDisabled(\"Project selection is disabled\");\n if (!bootstrap.projects.some((project) => project.id === projectId)) throw report(new AgentWebAppRuntimeClientError(\"PROJECT_NOT_ALLOWED\", \"Project is not allowed\", false));\n if (projectId === current.projectId) return;\n try { await stopActiveStream({ abortBackend: true }); }\n catch (error) { if (!isAbortError(error)) throw report(error); }\n const generation = generationRef.current;\n const threadGeneration = invalidateThreadWork();\n dispatch({ type: \"PROJECT_SELECTED\", projectId });\n if (bootstrap.webApp.features.threadManagement) await loadManagedThreads(projectId, generation, threadGeneration, bootstrap);\n else {\n const selectedProjectId = requestProjectId(bootstrap, projectId);\n const selectedModelKey = requestModelKey(bootstrap, current.modelKey);\n const result = await threadControlled((signal) => client.bootstrap({ ...(selectedProjectId ? { projectId: selectedProjectId } : {}), ...(selectedModelKey ? { modelKey: selectedModelKey } : {}) }, signal));\n if (generation !== generationRef.current || threadGeneration !== threadGenerationRef.current) return;\n const implicit = result.thread ?? null;\n dispatch({ type: \"THREADS_SET\", threads: implicit ? [implicit] : [] });\n dispatch({ type: \"ACTIVE_THREAD_SET\", thread: implicit });\n if (implicit) await loadMessages(implicit, generation, threadGeneration, result);\n }\n }, [client, invalidateThreadWork, loadManagedThreads, loadMessages, report, stopActiveStream, threadControlled]);\n\n const selectModel = useCallback((modelKey: string): void => {\n const bootstrap = stateRef.current.bootstrap;\n if (!bootstrap) throw report(new AgentWebAppRuntimeClientError(\"INVALID_REQUEST\", \"Web App is not ready\", true));\n if (!bootstrap.webApp.features.modelSelector) throw featureDisabled(\"Model selection is disabled\");\n if (!bootstrap.models.some((model) => model.key === modelKey)) throw report(new AgentWebAppRuntimeClientError(\"MODEL_NOT_ALLOWED\", \"Model is not allowed\", false));\n dispatch({ type: \"MODEL_SELECTED\", modelKey });\n }, [report]);\n\n const requireThreadManagement = useCallback((): void => {\n if (!stateRef.current.bootstrap?.webApp.features.threadManagement) throw featureDisabled(\"Thread management is disabled\");\n }, []);\n\n const refreshThreads = useCallback(async (): Promise<void> => {\n requireThreadManagement();\n const projectId = stateRef.current.projectId;\n if (projectId) await loadManagedThreads(projectId, generationRef.current, threadGenerationRef.current, stateRef.current.bootstrap);\n }, [loadManagedThreads, requireThreadManagement]);\n\n const selectThread = useCallback(async (thread: AgentWebAppRuntimeThread): Promise<void> => {\n if (thread.projectId !== stateRef.current.projectId) throw report(new AgentWebAppRuntimeClientError(\"PROJECT_NOT_ALLOWED\", \"Thread belongs to another project\", false));\n try { await stopActiveStream({ abortBackend: true }); }\n catch (error) { if (!isAbortError(error)) throw report(error); }\n const generation = generationRef.current;\n const threadGeneration = invalidateThreadWork();\n dispatch({ type: \"ACTIVE_THREAD_SET\", thread });\n await loadMessages(thread, generation, threadGeneration, stateRef.current.bootstrap);\n }, [invalidateThreadWork, loadMessages, report, stopActiveStream]);\n\n const createThread = useCallback(async (label?: string): Promise<AgentWebAppRuntimeThread> => {\n requireThreadManagement();\n try { await stopActiveStream({ abortBackend: true }); }\n catch (error) { if (!isAbortError(error)) throw report(error); }\n const threadGeneration = invalidateThreadWork();\n const generation = generationRef.current;\n const projectId = stateRef.current.projectId;\n const selectedProjectId = requestProjectId(stateRef.current.bootstrap, projectId);\n const created = await threadControlled((signal) => client.createThread({ ...(selectedProjectId ? { projectId: selectedProjectId } : {}), ...(label ? { label } : {}) }, signal));\n if (generation !== generationRef.current || threadGeneration !== threadGenerationRef.current) return created;\n dispatch({ type: \"THREAD_UPSERT\", thread: created });\n dispatch({ type: \"ACTIVE_THREAD_SET\", thread: created });\n return created;\n }, [client, invalidateThreadWork, report, requireThreadManagement, stopActiveStream, threadControlled]);\n\n const renameThread = useCallback(async (threadId: string, label: string): Promise<AgentWebAppRuntimeThread> => {\n requireThreadManagement();\n try { await stopActiveStream({ abortBackend: true }); }\n catch (error) { if (!isAbortError(error)) throw report(error); }\n const generation = generationRef.current;\n const threadGeneration = threadGenerationRef.current;\n const existing = stateRef.current.threads.find((item) => item.id === threadId);\n if (!existing) throw report(new AgentWebAppRuntimeClientError(\"THREAD_NOT_FOUND\", \"Thread not found\", false));\n const projectId = requestProjectId(stateRef.current.bootstrap, existing.projectId);\n const updated = await threadControlled((signal) => client.updateThread(threadId, { ...(projectId ? { projectId } : {}), label }, signal));\n if (generation !== generationRef.current || threadGeneration !== threadGenerationRef.current) return updated;\n dispatch({ type: \"THREAD_UPSERT\", thread: updated });\n return updated;\n }, [client, report, requireThreadManagement, threadControlled]);\n\n const deleteThread = useCallback(async (threadId: string): Promise<void> => {\n requireThreadManagement();\n const existing = stateRef.current.threads.find((item) => item.id === threadId);\n if (!existing) throw report(new AgentWebAppRuntimeClientError(\"THREAD_NOT_FOUND\", \"Thread not found\", false));\n if (stateRef.current.activeThread?.id === threadId) {\n try { await stopActiveStream({ abortBackend: true }); }\n catch (error) { if (!isAbortError(error)) throw report(error); }\n invalidateThreadWork();\n }\n const generation = generationRef.current;\n const threadGeneration = threadGenerationRef.current;\n const projectId = requestProjectId(stateRef.current.bootstrap, existing.projectId);\n await threadControlled((signal) => client.deleteThread(threadId, projectId ? { projectId } : {}, signal));\n if (generation !== generationRef.current || threadGeneration !== threadGenerationRef.current) return;\n dispatch({ type: \"THREAD_DELETED\", threadId });\n const remaining = stateRef.current.threads.filter((item) => item.id !== threadId);\n const next = newestThread(remaining);\n if (stateRef.current.activeThread?.id === threadId && next) {\n dispatch({ type: \"ACTIVE_THREAD_SET\", thread: next });\n await loadMessages(next);\n }\n }, [client, invalidateThreadWork, loadMessages, report, requireThreadManagement, stopActiveStream, threadControlled]);\n\n const handleStreamEvent = useCallback((event: AgentWebAppStreamEvent, assistantId: string, generation: number, streamGeneration: number): void => {\n if (generation !== generationRef.current || streamGeneration !== streamGenerationRef.current) return;\n switch (event.type) {\n case \"message.delta\": dispatch({ type: \"ASSISTANT_DELTA\", id: assistantId, text: event.text }); break;\n case \"message.completed\": dispatch({ type: \"ASSISTANT_COMPLETED\", temporaryId: assistantId, messageId: event.messageId }); break;\n case \"tool.started\": dispatch({ type: \"TOOL_STARTED\", id: event.id, name: event.name }); break;\n case \"tool.completed\": dispatch({ type: \"TOOL_COMPLETED\", id: event.id }); break;\n case \"interrupt.created\": if (stateRef.current.bootstrap?.webApp.features.hitl) dispatch({ type: \"INTERRUPT_ADD\", interrupt: event.interrupt }); break;\n case \"genui.render\": if (stateRef.current.bootstrap?.webApp.features.genUI) dispatch({ type: \"ASSISTANT_GENUI\", id: assistantId, block: event.block }); break;\n case \"error\": break;\n case \"stream.completed\": break;\n }\n }, []);\n\n const consumePublicStream = useCallback(async (input: {\n threadId: string; projectId?: string; assistantId: string; generation: number; streamGeneration: number;\n run(onEvent: (event: AgentWebAppStreamEvent) => void, signal: AbortSignal): Promise<void>;\n }): Promise<string> => {\n const controller = new AbortController();\n let eventError: AgentWebAppRuntimeClientError | null = null;\n let currentAssistantId = input.assistantId;\n streamRef.current = { controller, threadId: input.threadId, ...(input.projectId ? { projectId: input.projectId } : {}) };\n dispatch({ type: \"STREAM_SET\", streaming: true, assistantMessageId: input.assistantId });\n try {\n await input.run((event) => {\n if (event.type === \"error\") {\n if (input.generation === generationRef.current && input.streamGeneration === streamGenerationRef.current) {\n eventError = new AgentWebAppRuntimeClientError(event.error.code, formatErrorMessage(event.error.message, \"Stream error\"), event.error.retryable);\n }\n return;\n }\n if (event.type === \"message.completed\") currentAssistantId = event.messageId;\n handleStreamEvent(event, input.assistantId, input.generation, input.streamGeneration);\n }, controller.signal);\n if (eventError) throw eventError;\n return currentAssistantId;\n } finally {\n if (streamRef.current?.controller === controller) streamRef.current = null;\n if (input.generation === generationRef.current && input.streamGeneration === streamGenerationRef.current) dispatch({ type: \"STREAM_SET\", streaming: false });\n }\n }, [handleStreamEvent]);\n\n const send = useCallback(async (content: string, attachmentRefs?: string[]): Promise<void> => {\n const current = stateRef.current;\n if (streamRef.current || current.stream.isStreaming) throw new AgentWebAppRuntimeClientError(\"STREAM_CONFLICT\", \"A message is already streaming\", false);\n if (!current.activeThread || !current.projectId) throw report(new AgentWebAppRuntimeClientError(\"THREAD_NOT_FOUND\", \"No active thread\", false));\n if (!content.trim()) throw report(new AgentWebAppRuntimeClientError(\"INVALID_REQUEST\", \"Message content is required\", false));\n const generation = generationRef.current;\n const streamGeneration = ++streamGenerationRef.current;\n const assistantId = `pending-assistant-${Date.now()}-${Math.random().toString(36).slice(2)}`;\n const userId = `pending-user-${Date.now()}-${Math.random().toString(36).slice(2)}`;\n const refs = attachmentRefs ?? current.attachments.map((attachment) => attachment.ref);\n const projectId = requestProjectId(current.bootstrap, current.projectId);\n const modelKey = requestModelKey(current.bootstrap, current.modelKey);\n let currentAssistantId = assistantId;\n dispatch({ type: \"MESSAGE_APPEND\", message: { id: userId, role: \"human\", content } });\n try {\n currentAssistantId = await consumePublicStream({\n threadId: current.activeThread.id, projectId, assistantId, generation, streamGeneration,\n run: (onEvent, signal) => client.streamMessage(current.activeThread!.id, {\n content,\n ...(projectId ? { projectId } : {}),\n ...(modelKey ? { modelKey } : {}),\n ...(refs.length ? { attachmentRefs: refs } : {}),\n }, onEvent, signal),\n });\n if (generation === generationRef.current && streamGeneration === streamGenerationRef.current) {\n dispatch({ type: \"ATTACHMENTS_REMOVE\", refs });\n dispatch({ type: \"FAILED_SEND_SET\", failedSend: null });\n }\n } catch (error) {\n if (generation === generationRef.current && streamGeneration === streamGenerationRef.current) {\n dispatch({ type: \"MESSAGES_REMOVE\", ids: [userId, assistantId, `${assistantId}-genui`, currentAssistantId, `${currentAssistantId}-genui`] });\n if (!isAbortError(error)) {\n dispatch({ type: \"FAILED_SEND_SET\", failedSend: { text: content, attachmentIds: refs } });\n throw report(error);\n }\n }\n }\n }, [client, consumePublicStream, report]);\n\n const sendMessage = useCallback(async (content: string): Promise<void> => send(content), [send]);\n\n const retryLastMessage = useCallback(async (): Promise<void> => {\n const failed = stateRef.current.lastFailedSend;\n if (!failed) throw report(new AgentWebAppRuntimeClientError(\"INVALID_REQUEST\", \"No failed message to retry\", false));\n await send(failed.text, failed.attachmentIds);\n }, [report, send]);\n\n const uploadAttachment = useCallback(async (file: Blob): Promise<void> => {\n const current = stateRef.current;\n const generation = generationRef.current;\n const threadGeneration = threadGenerationRef.current;\n if (!current.bootstrap?.webApp.features.attachments) throw featureDisabled(\"Attachments are disabled\");\n if (!current.activeThread) throw report(new AgentWebAppRuntimeClientError(\"THREAD_NOT_FOUND\", \"No active thread\", false));\n dispatch({ type: \"ATTACHMENTS_LOADING\", loading: true });\n try {\n const projectId = requestProjectId(current.bootstrap, current.activeThread.projectId);\n const attachment = await threadControlled((signal) => client.uploadAttachment(current.activeThread!.id, file, projectId ? { projectId } : {}, signal));\n if (generation === generationRef.current && threadGeneration === threadGenerationRef.current) dispatch({ type: \"ATTACHMENT_ADD\", attachment });\n } catch (error) {\n if (!isAbortError(error) && generation === generationRef.current && threadGeneration === threadGenerationRef.current) throw report(error);\n } finally { if (generation === generationRef.current && threadGeneration === threadGenerationRef.current) dispatch({ type: \"ATTACHMENTS_LOADING\", loading: false }); }\n }, [client, report, threadControlled]);\n\n const resumeInterrupt = useCallback(async (interruptId: string, response: AgentWebAppInterruptResponse, message: string): Promise<void> => {\n const current = stateRef.current;\n const generation = generationRef.current;\n const threadGeneration = threadGenerationRef.current;\n if (streamRef.current || current.stream.isStreaming) throw report(new AgentWebAppRuntimeClientError(\"STREAM_CONFLICT\", \"A message is already streaming\", false));\n if (!current.bootstrap?.webApp.features.hitl) throw featureDisabled(\"Human review is disabled\");\n if (!current.activeThread || !current.projectId) throw report(new AgentWebAppRuntimeClientError(\"THREAD_NOT_FOUND\", \"No active thread\", false));\n if (!current.interrupts.some((item) => item.id === interruptId)) throw report(new AgentWebAppRuntimeClientError(\"INVALID_REQUEST\", \"Interrupt not found\", false));\n const activeThread = current.activeThread;\n const projectId = requestProjectId(current.bootstrap, current.projectId);\n const modelKey = requestModelKey(current.bootstrap, current.modelKey);\n const streamGeneration = ++streamGenerationRef.current;\n const assistantId = `pending-assistant-${Date.now()}-${Math.random().toString(36).slice(2)}`;\n dispatch({ type: \"INTERRUPTS_LOADING\", loading: true });\n try {\n await consumePublicStream({\n threadId: activeThread.id, projectId, assistantId, generation, streamGeneration,\n run: (onEvent, signal) => client.resumeInterrupt(activeThread.id, interruptId, {\n ...(projectId ? { projectId } : {}),\n ...(modelKey ? { modelKey } : {}), message, response,\n }, onEvent, signal),\n });\n if (generation !== generationRef.current || threadGeneration !== threadGenerationRef.current) return;\n dispatch({ type: \"INTERRUPT_REMOVE\", interruptId });\n await loadMessages(activeThread, generation, threadGeneration);\n } catch (error) {\n if (generation === generationRef.current && threadGeneration === threadGenerationRef.current) {\n dispatch({ type: \"MESSAGES_REMOVE\", ids: [assistantId, `${assistantId}-genui`] });\n if (!isAbortError(error)) throw report(error);\n }\n } finally {\n if (generation === generationRef.current && threadGeneration === threadGenerationRef.current) dispatch({ type: \"INTERRUPTS_LOADING\", loading: false });\n }\n }, [client, consumePublicStream, loadMessages, report]);\n\n const value = {\n ...state,\n retry: bootstrapRuntime,\n selectProject,\n selectModel,\n refreshThreads,\n selectThread,\n createThread,\n renameThread,\n deleteThread,\n sendMessage,\n retryLastMessage,\n abort,\n uploadAttachment,\n removeAttachment: (ref: string) => dispatch({ type: \"ATTACHMENT_REMOVE\", ref }),\n clearAttachments: () => dispatch({ type: \"ATTACHMENTS_CLEAR\" }),\n resumeInterrupt,\n clearError: () => dispatch({ type: \"ERROR_SET\", error: null }),\n };\n return <AgentWebAppContext.Provider value={value}>{children}</AgentWebAppContext.Provider>;\n}\n","import { createContext } from \"react\";\nimport type { AgentWebAppInterruptResponse, AgentWebAppRuntimeThread } from \"./types\";\nimport { AgentWebAppRuntimeClientError } from \"./error\";\nimport type { AgentWebAppState } from \"./state/agentWebAppReducer\";\n\nexport interface AgentWebAppContextValue extends AgentWebAppState {\n retry(): Promise<void>;\n selectProject(projectId: string): Promise<void>;\n selectModel(modelKey: string): void;\n refreshThreads(): Promise<void>;\n selectThread(thread: AgentWebAppRuntimeThread): Promise<void>;\n createThread(label?: string): Promise<AgentWebAppRuntimeThread>;\n renameThread(threadId: string, label: string): Promise<AgentWebAppRuntimeThread>;\n deleteThread(threadId: string): Promise<void>;\n sendMessage(content: string): Promise<void>;\n retryLastMessage(): Promise<void>;\n abort(): Promise<void>;\n uploadAttachment(file: Blob): Promise<void>;\n removeAttachment(ref: string): void;\n clearAttachments(): void;\n resumeInterrupt(interruptId: string, response: AgentWebAppInterruptResponse, message: string): Promise<void>;\n clearError(): void;\n}\n\nexport const AgentWebAppContext = createContext<AgentWebAppContextValue | null>(null);\n\nexport function featureDisabled(message: string): AgentWebAppRuntimeClientError {\n return new AgentWebAppRuntimeClientError(\"FEATURE_DISABLED\", message, false, 403);\n}\n","import type {\n AgentWebAppAttachment,\n AgentWebAppBootstrap,\n AgentWebAppInterrupt,\n AgentWebAppGenUIBlock,\n AgentWebAppRuntimeMessage,\n AgentWebAppRuntimeThread,\n} from \"../types\";\nimport type { AgentWebAppRuntimeClientError } from \"../error\";\n\nexport interface AgentWebAppToolState {\n id: string;\n name?: string;\n status: \"running\" | \"completed\";\n}\n\nexport interface AgentWebAppFailedSend {\n text: string;\n attachmentIds: string[];\n}\n\nexport interface AgentWebAppState {\n bootstrap: AgentWebAppBootstrap | null;\n projectId: string | null;\n modelKey: string | null;\n threads: AgentWebAppRuntimeThread[];\n activeThread: AgentWebAppRuntimeThread | null;\n messages: AgentWebAppRuntimeMessage[];\n stream: { isStreaming: boolean; assistantMessageId: string | null; tools: AgentWebAppToolState[] };\n lastFailedSend: AgentWebAppFailedSend | null;\n attachments: AgentWebAppAttachment[];\n interrupts: AgentWebAppInterrupt[];\n errors: { current: AgentWebAppRuntimeClientError | null };\n loading: { bootstrap: boolean; threads: boolean; messages: boolean; attachments: boolean; interrupts: boolean };\n}\n\nexport const initialAgentWebAppState: AgentWebAppState = {\n bootstrap: null,\n projectId: null,\n modelKey: null,\n threads: [],\n activeThread: null,\n messages: [],\n stream: { isStreaming: false, assistantMessageId: null, tools: [] },\n lastFailedSend: null,\n attachments: [],\n interrupts: [],\n errors: { current: null },\n loading: { bootstrap: true, threads: false, messages: false, attachments: false, interrupts: false },\n};\n\nexport type AgentWebAppAction =\n | { type: \"BOOTSTRAP_LOADING\" }\n | { type: \"BOOTSTRAP_READY\"; bootstrap: AgentWebAppBootstrap; projectId: string; modelKey: string | null }\n | { type: \"BOOTSTRAP_SETTLED\" }\n | { type: \"PROJECT_SELECTED\"; projectId: string }\n | { type: \"MODEL_SELECTED\"; modelKey: string }\n | { type: \"THREADS_LOADING\"; loading: boolean }\n | { type: \"THREADS_SET\"; threads: AgentWebAppRuntimeThread[] }\n | { type: \"THREAD_UPSERT\"; thread: AgentWebAppRuntimeThread }\n | { type: \"THREAD_DELETED\"; threadId: string }\n | { type: \"ACTIVE_THREAD_SET\"; thread: AgentWebAppRuntimeThread | null }\n | { type: \"ACTIVE_THREAD_UPDATED\"; thread: AgentWebAppRuntimeThread }\n | { type: \"MESSAGES_LOADING\"; loading: boolean }\n | { type: \"MESSAGES_SET\"; messages: AgentWebAppRuntimeMessage[] }\n | { type: \"MESSAGE_APPEND\"; message: AgentWebAppRuntimeMessage }\n | { type: \"MESSAGES_REMOVE\"; ids: string[] }\n | { type: \"ASSISTANT_DELTA\"; id: string; text: string }\n | { type: \"ASSISTANT_GENUI\"; id: string; block: AgentWebAppGenUIBlock }\n | { type: \"ASSISTANT_COMPLETED\"; temporaryId: string; messageId: string }\n | { type: \"STREAM_SET\"; streaming: boolean; assistantMessageId?: string | null }\n | { type: \"TOOL_STARTED\"; id: string; name: string }\n | { type: \"TOOL_COMPLETED\"; id: string }\n | { type: \"ATTACHMENTS_LOADING\"; loading: boolean }\n | { type: \"ATTACHMENT_ADD\"; attachment: AgentWebAppAttachment }\n | { type: \"ATTACHMENT_REMOVE\"; ref: string }\n | { type: \"ATTACHMENTS_CLEAR\" }\n | { type: \"ATTACHMENTS_REMOVE\"; refs: string[] }\n | { type: \"INTERRUPT_ADD\"; interrupt: AgentWebAppInterrupt }\n | { type: \"INTERRUPT_REMOVE\"; interruptId: string }\n | { type: \"INTERRUPTS_LOADING\"; loading: boolean }\n | { type: \"ERROR_SET\"; error: AgentWebAppRuntimeClientError | null }\n | { type: \"FAILED_SEND_SET\"; failedSend: AgentWebAppFailedSend | null };\n\nexport function agentWebAppReducer(state: AgentWebAppState, action: AgentWebAppAction): AgentWebAppState {\n switch (action.type) {\n case \"BOOTSTRAP_LOADING\": return { ...initialAgentWebAppState, loading: { ...initialAgentWebAppState.loading, bootstrap: true } };\n case \"BOOTSTRAP_READY\": return { ...state, bootstrap: action.bootstrap, projectId: action.projectId, modelKey: action.modelKey, loading: { ...state.loading, bootstrap: false } };\n case \"BOOTSTRAP_SETTLED\": return { ...state, loading: { ...state.loading, bootstrap: false } };\n case \"PROJECT_SELECTED\": return { ...state, projectId: action.projectId, threads: [], activeThread: null, messages: [], attachments: [], interrupts: [], stream: initialAgentWebAppState.stream, lastFailedSend: null, loading: { ...state.loading, messages: false, attachments: false, interrupts: false } };\n case \"MODEL_SELECTED\": return { ...state, modelKey: action.modelKey };\n case \"THREADS_LOADING\": return { ...state, loading: { ...state.loading, threads: action.loading } };\n case \"THREADS_SET\": return { ...state, threads: action.threads, loading: { ...state.loading, threads: false } };\n case \"THREAD_UPSERT\": return { ...state, threads: [action.thread, ...state.threads.filter((item) => item.id !== action.thread.id)], activeThread: state.activeThread?.id === action.thread.id ? action.thread : state.activeThread };\n case \"THREAD_DELETED\": return { ...state, threads: state.threads.filter((item) => item.id !== action.threadId), activeThread: state.activeThread?.id === action.threadId ? null : state.activeThread, messages: state.activeThread?.id === action.threadId ? [] : state.messages, lastFailedSend: state.activeThread?.id === action.threadId ? null : state.lastFailedSend };\n case \"ACTIVE_THREAD_SET\": return { ...state, activeThread: action.thread, messages: [], attachments: [], interrupts: [], stream: initialAgentWebAppState.stream, lastFailedSend: null, loading: { ...state.loading, messages: false, attachments: false, interrupts: false } };\n case \"ACTIVE_THREAD_UPDATED\": return { ...state, activeThread: action.thread };\n case \"MESSAGES_LOADING\": return { ...state, loading: { ...state.loading, messages: action.loading } };\n case \"MESSAGES_SET\": return { ...state, messages: action.messages, loading: { ...state.loading, messages: false } };\n case \"MESSAGE_APPEND\": return { ...state, messages: [...state.messages, action.message] };\n case \"MESSAGES_REMOVE\": return { ...state, messages: state.messages.filter((message) => !action.ids.includes(message.id)) };\n case \"ASSISTANT_DELTA\": {\n const index = state.messages.findIndex((message) => message.id === action.id);\n if (index < 0) return { ...state, messages: [...state.messages, { id: action.id, role: \"ai\", content: action.text }] };\n return { ...state, messages: state.messages.map((message, itemIndex) => itemIndex === index ? { ...message, content: `${message.content ?? \"\"}${action.text}` } : message) };\n }\n case \"ASSISTANT_GENUI\": {\n const widgetMessageId = `${action.id}-genui`;\n const index = state.messages.findIndex((message) => message.id === widgetMessageId);\n if (index < 0) return { ...state, messages: [...state.messages, { id: widgetMessageId, role: \"ai\", content: [action.block] }] };\n return { ...state, messages: state.messages.map((message, itemIndex) => itemIndex === index\n ? { ...message, content: [...(Array.isArray(message.content) ? message.content : []), action.block] }\n : message) };\n }\n case \"ASSISTANT_COMPLETED\": return { ...state, messages: state.messages.map((message) => message.id === action.temporaryId\n ? { ...message, id: action.messageId }\n : message.id === `${action.temporaryId}-genui` ? { ...message, id: `${action.messageId}-genui` } : message), stream: { ...state.stream, assistantMessageId: action.messageId } };\n case \"STREAM_SET\": return { ...state, stream: { ...state.stream, isStreaming: action.streaming, assistantMessageId: action.assistantMessageId === undefined ? state.stream.assistantMessageId : action.assistantMessageId, ...(action.streaming ? { tools: [] } : {}) } };\n case \"TOOL_STARTED\": return { ...state, stream: { ...state.stream, tools: [...state.stream.tools.filter((tool) => tool.id !== action.id), { id: action.id, name: action.name, status: \"running\" }] } };\n case \"TOOL_COMPLETED\": return { ...state, stream: { ...state.stream, tools: state.stream.tools.map((tool) => tool.id === action.id ? { ...tool, status: \"completed\" } : tool) } };\n case \"ATTACHMENTS_LOADING\": return { ...state, loading: { ...state.loading, attachments: action.loading } };\n case \"ATTACHMENT_ADD\": return { ...state, attachments: [...state.attachments, action.attachment], loading: { ...state.loading, attachments: false } };\n case \"ATTACHMENT_REMOVE\": return { ...state, attachments: state.attachments.filter((item) => item.ref !== action.ref) };\n case \"ATTACHMENTS_CLEAR\": return { ...state, attachments: [] };\n case \"ATTACHMENTS_REMOVE\": return { ...state, attachments: state.attachments.filter((item) => !action.refs.includes(item.ref)) };\n case \"INTERRUPT_ADD\": return { ...state, interrupts: [...state.interrupts.filter((item) => item.id !== action.interrupt.id), action.interrupt] };\n case \"INTERRUPT_REMOVE\": return { ...state, interrupts: state.interrupts.filter((item) => item.id !== action.interruptId), loading: { ...state.loading, interrupts: false } };\n case \"INTERRUPTS_LOADING\": return { ...state, loading: { ...state.loading, interrupts: action.loading } };\n case \"ERROR_SET\": return { ...state, errors: { current: action.error }, loading: action.error && !state.bootstrap ? { ...state.loading, bootstrap: false } : state.loading };\n case \"FAILED_SEND_SET\": return { ...state, lastFailedSend: action.failedSend };\n }\n}\n","import { useContext } from \"react\";\nimport { AgentWebAppContext } from \"../AgentWebAppContext\";\n\nexport function useAgentWebApp() {\n const context = useContext(AgentWebAppContext);\n if (!context) throw new Error(\"useAgentWebApp must be used within AgentWebAppProvider\");\n return context;\n}\n","import { useContext } from \"react\";\nimport { AgentWebAppContext } from \"../AgentWebAppContext\";\n\nexport function useWidgetAttachments() {\n const context = useContext(AgentWebAppContext);\n if (!context) throw new Error(\"useWidgetAttachments must be used within AgentWebAppProvider\");\n return {\n attachments: context.attachments,\n isLoading: context.loading.attachments,\n error: context.errors.current,\n uploadAttachment: context.uploadAttachment,\n removeAttachment: context.removeAttachment,\n clearAttachments: context.clearAttachments,\n };\n}\n","import { useContext } from \"react\";\nimport { AgentWebAppContext } from \"../AgentWebAppContext\";\n\nexport function useWidgetChat() {\n const context = useContext(AgentWebAppContext);\n if (!context) throw new Error(\"useWidgetChat must be used within AgentWebAppProvider\");\n return {\n activeThread: context.activeThread,\n messages: context.messages,\n tools: context.stream.tools,\n isStreaming: context.stream.isStreaming,\n isLoading: context.loading.messages,\n lastFailedSend: context.lastFailedSend,\n error: context.errors.current,\n sendMessage: context.sendMessage,\n retry: context.retryLastMessage,\n abort: context.abort,\n };\n}\n","import { useContext } from \"react\";\nimport { AgentWebAppContext } from \"../AgentWebAppContext\";\n\nexport function useWidgetInterrupts() {\n const context = useContext(AgentWebAppContext);\n if (!context) throw new Error(\"useWidgetInterrupts must be used within AgentWebAppProvider\");\n return {\n interrupts: context.interrupts,\n isLoading: context.loading.interrupts,\n error: context.errors.current,\n resumeInterrupt: context.resumeInterrupt,\n };\n}\n","import { useContext } from \"react\";\nimport { AgentWebAppContext } from \"../AgentWebAppContext\";\n\nexport function useWidgetProject() {\n const context = useContext(AgentWebAppContext);\n if (!context) throw new Error(\"useWidgetProject must be used within AgentWebAppProvider\");\n return {\n bootstrap: context.bootstrap,\n projectId: context.projectId,\n modelKey: context.modelKey,\n selectProject: context.selectProject,\n selectModel: context.selectModel,\n isLoading: context.loading.bootstrap || context.loading.threads,\n error: context.errors.current,\n };\n}\n","import { useContext } from \"react\";\nimport { AgentWebAppContext } from \"../AgentWebAppContext\";\n\nexport function useWidgetThreads() {\n const context = useContext(AgentWebAppContext);\n if (!context) throw new Error(\"useWidgetThreads must be used within AgentWebAppProvider\");\n return {\n threads: context.threads,\n activeThread: context.activeThread,\n isLoading: context.loading.bootstrap || context.loading.threads,\n error: context.errors.current,\n refreshThreads: context.refreshThreads,\n selectThread: context.selectThread,\n createThread: context.createThread,\n renameThread: context.renameThread,\n deleteThread: context.deleteThread,\n };\n}\n","import React, { useRef, useState } from \"react\";\nimport { useWidgetAttachments } from \"../hooks/useWidgetAttachments\";\nimport { useWidgetChat } from \"../hooks/useWidgetChat\";\nimport { useWidgetProject } from \"../hooks/useWidgetProject\";\nimport { widgetErrorMessage } from \"./widget-utils\";\n\nexport interface WidgetAttachmentsProps { className?: string; attachLabel?: string; }\n\nexport function WidgetAttachments({ className, attachLabel = \"Attach files\" }: WidgetAttachmentsProps): React.ReactElement | null {\n const { bootstrap } = useWidgetProject();\n const { activeThread } = useWidgetChat();\n const { attachments, isLoading, uploadAttachment, removeAttachment } = useWidgetAttachments();\n const pendingRef = useRef(false);\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n if (!bootstrap?.webApp.features.attachments) return null;\n const upload = async (event: React.ChangeEvent<HTMLInputElement>): Promise<void> => {\n if (pendingRef.current) return;\n pendingRef.current = true;\n setPending(true);\n setError(null);\n try { for (const file of Array.from(event.target.files ?? [])) await uploadAttachment(file); }\n catch (uploadError) { setError(widgetErrorMessage(uploadError)); }\n finally { pendingRef.current = false; setPending(false); if (inputRef.current) inputRef.current.value = \"\"; }\n };\n return <div className={className}>{attachments.length > 0 && <div className=\"axiom-web-app__attachments\">{attachments.map((attachment) => <span className=\"axiom-web-app__attachment\" key={attachment.ref}>{attachment.name}<button type=\"button\" aria-label={`Remove ${attachment.name}`} onClick={() => removeAttachment(attachment.ref)}>Remove</button></span>)}</div>}{error && <p className=\"axiom-web-app__error\" role=\"alert\">{error}</p>}<label className=\"axiom-web-app__attach\"><span>{isLoading || pending ? \"Uploading...\" : attachLabel}</span><input ref={inputRef} type=\"file\" multiple aria-label={attachLabel} disabled={!activeThread || isLoading || pending} onChange={(event) => void upload(event)} /></label></div>;\n}\n","import { formatErrorMessage } from \"../../../utils/errorMessage\";\n\nexport function widgetErrorMessage(error: unknown): string {\n return formatErrorMessage(error, \"Request failed\");\n}\n","import React, { useRef, useState } from \"react\";\nimport { useWidgetChat } from \"../hooks/useWidgetChat\";\nimport { widgetErrorMessage } from \"./widget-utils\";\n\nexport interface WidgetComposerProps { className?: string; messageLabel?: string; placeholder?: string; sendLabel?: string; abortLabel?: string; leadingSlot?: React.ReactNode; }\n\nexport function WidgetComposer({ className, messageLabel = \"Message\", placeholder = \"Ask a question\", sendLabel = \"Send message\", abortLabel = \"Stop response\", leadingSlot }: WidgetComposerProps): React.ReactElement {\n const { activeThread, isStreaming, sendMessage, abort, retry, lastFailedSend } = useWidgetChat();\n const pendingRef = useRef(false);\n const draftRef = useRef(\"\");\n const [pending, setPending] = useState(false);\n const [text, setText] = useState(\"\");\n const [error, setError] = useState<string | null>(null);\n const run = async (operation: () => Promise<void>): Promise<void> => {\n if (pendingRef.current) return;\n pendingRef.current = true; setPending(true); setError(null);\n try { await operation(); }\n catch (operationError) { setError(widgetErrorMessage(operationError)); }\n finally { pendingRef.current = false; setPending(false); }\n };\n const submit = (event: React.FormEvent): void => {\n event.preventDefault();\n const content = text.trim();\n if (!content || isStreaming) return;\n draftRef.current = \"\";\n setText(\"\");\n void (async () => {\n if (pendingRef.current) return;\n pendingRef.current = true; setPending(true); setError(null);\n try { await sendMessage(content); }\n catch (sendError) {\n setError(widgetErrorMessage(sendError));\n if (draftRef.current === \"\") { draftRef.current = content; setText(content); }\n } finally { pendingRef.current = false; setPending(false); }\n })();\n };\n return <form className={`axiom-web-app__composer${className ? ` ${className}` : \"\"}`} onSubmit={submit}>{leadingSlot}{error && <p className=\"axiom-web-app__error\" role=\"alert\">{error}</p>}<label className=\"axiom-web-app__composer-input\"><span className=\"axiom-web-app__sr-only\">{messageLabel}</span><textarea aria-label={messageLabel} value={text} placeholder={placeholder} disabled={!activeThread} onChange={(event) => { draftRef.current = event.target.value; setText(event.target.value); }} /></label><div className=\"axiom-web-app__composer-actions\">{lastFailedSend && <button type=\"button\" onClick={() => void run(retry)} disabled={isStreaming || pending}>Retry failed message</button>}{isStreaming ? <button type=\"button\" disabled={pending} onClick={() => void run(abort)}>{abortLabel}</button> : <button type=\"submit\" disabled={!activeThread || !text.trim() || pending}>{sendLabel}</button>}</div></form>;\n}\n","import React from \"react\";\nimport type { AgentWebAppInterrupt, AgentWebAppInterruptResponse } from \"../types\";\nimport { useReviewDecision } from \"../../../components/shared/useReviewDecision\";\nimport { formatErrorMessage } from \"../../../utils/errorMessage\";\n\nexport interface WidgetInterruptViewProps {\n interrupt: AgentWebAppInterrupt;\n onSubmit(interruptId: string, response: AgentWebAppInterruptResponse, message: string): Promise<void>;\n className?: string;\n approveLabel?: string;\n rejectLabel?: string;\n feedbackLabel?: string;\n disabled?: boolean;\n}\n\nfunction errorMessage(error: unknown): string {\n return formatErrorMessage(error, \"Unable to submit review\");\n}\n\nexport function WidgetInterruptView({ interrupt, onSubmit, className, approveLabel = \"Approve\", rejectLabel = \"Reject\", feedbackLabel = \"Feedback\", disabled = false }: WidgetInterruptViewProps): React.ReactElement {\n const review = useReviewDecision(async (decision, feedback) => {\n const approved = decision === \"approve\";\n await onSubmit(interrupt.id, { approved, ...(feedback ? { feedback } : {}) }, feedback || (approved ? \"Approved\" : \"Changes requested\"));\n });\n\n const submit = async (approved: boolean): Promise<void> => {\n if (disabled) return;\n await review.submit(approved ? \"approve\" : \"reject\");\n };\n\n return (\n <section className={`axiom-web-app__interrupt${className ? ` ${className}` : \"\"}`} aria-label=\"Human review\">\n <strong>{interrupt.prompt}</strong>\n {interrupt.data && <p className=\"axiom-web-app__interrupt-fallback\">Additional review details are unavailable.</p>}\n <label className=\"axiom-web-app__feedback\">\n <span>{feedbackLabel}</span>\n <textarea value={review.feedback} disabled={disabled || review.pending !== null} onChange={(event) => review.setFeedback(event.target.value)} />\n </label>\n {review.error !== null && <p className=\"axiom-web-app__error\" role=\"alert\">{errorMessage(review.error)}</p>}\n <div className=\"axiom-web-app__interrupt-actions\">\n <button type=\"button\" disabled={disabled || review.pending !== null} onClick={() => void submit(false)}>{rejectLabel}</button>\n <button type=\"button\" disabled={disabled || review.pending !== null} onClick={() => void submit(true)}>{approveLabel}</button>\n </div>\n </section>\n );\n}\n","import React from \"react\";\nimport type { AgentWebAppInterrupt } from \"../types\";\nimport { useWidgetInterrupts } from \"../hooks/useWidgetInterrupts\";\nimport { useWidgetProject } from \"../hooks/useWidgetProject\";\nimport { WidgetInterruptView } from \"./WidgetInterruptView\";\n\nexport interface WidgetInterruptProps { interrupt: AgentWebAppInterrupt; className?: string; approveLabel?: string; rejectLabel?: string; feedbackLabel?: string; }\n\nexport function WidgetInterrupt(props: WidgetInterruptProps): React.ReactElement | null {\n const { bootstrap } = useWidgetProject();\n const { isLoading, resumeInterrupt } = useWidgetInterrupts();\n if (!bootstrap?.webApp.features.hitl) return null;\n return <WidgetInterruptView {...props} disabled={isLoading} onSubmit={resumeInterrupt} />;\n}\n","import XMarkdown, { type ComponentProps, type XMarkdownProps } from \"@ant-design/x-markdown\";\nimport React from \"react\";\n\nexport interface WidgetMarkdownProps {\n content: unknown;\n className?: string;\n unsupportedLabel?: string;\n}\n\nfunction safeUrl(value: unknown): string | null {\n if (typeof value !== \"string\") return null;\n try {\n const url = new URL(value, \"https://axiom.invalid\");\n return url.protocol === \"http:\" || url.protocol === \"https:\" || url.protocol === \"mailto:\" ? value : null;\n } catch {\n return null;\n }\n}\n\nconst SafeLink: React.FC<ComponentProps<{ href?: string }>> = ({ href, children }) => {\n const safeHref = safeUrl(href);\n return safeHref ? <a href={safeHref} target=\"_blank\" rel=\"noopener noreferrer\">{children}</a> : <span>{children}</span>;\n};\n\nconst SafeImage: React.FC<ComponentProps<{ src?: string; alt?: string }>> = ({ src, alt }) => {\n const safeHref = safeUrl(src);\n const label = alt?.trim() || \"Image\";\n return safeHref ? <a href={safeHref} target=\"_blank\" rel=\"noopener noreferrer\">{label}</a> : <span>{label}</span>;\n};\n\nconst SafeCode: React.FC<ComponentProps> = ({ children }) => <code>{children}</code>;\n\nconst REVIEWED_MARKDOWN_COMPONENTS = Object.freeze<XMarkdownProps[\"components\"]>({\n a: SafeLink,\n code: SafeCode,\n img: SafeImage,\n});\n\nexport function WidgetMarkdown({ content, className, unsupportedLabel = \"Unsupported message content\" }: WidgetMarkdownProps): React.ReactElement {\n if (typeof content !== \"string\") return <span className={className}>{unsupportedLabel}</span>;\n return <XMarkdown className={className} content={content} components={REVIEWED_MARKDOWN_COMPONENTS} paragraphTag=\"div\" escapeRawHtml />;\n}\n","import React from \"react\";\nimport type { AgentWebAppGenUIBlock } from \"../types\";\n\nexport interface WidgetGenUIRendererProps { block: AgentWebAppGenUIBlock }\n\n/** Immutable semantic renderer for the reviewed V1 declarative widget allowlist. */\nexport function WidgetGenUIRenderer({ block }: WidgetGenUIRendererProps): React.ReactElement {\n const widget = block.widget;\n if (widget.kind === \"callout\") {\n return <aside className={`axiom-web-app__callout axiom-web-app__callout--${widget.tone ?? \"info\"}`} aria-label={widget.title ?? \"Callout\"}>\n {widget.title && <strong>{widget.title}</strong>}<p>{widget.text}</p>\n </aside>;\n }\n return <table className=\"axiom-web-app__data-table\" aria-label={widget.caption ?? \"Data table\"}>\n {widget.caption && <caption>{widget.caption}</caption>}\n <thead><tr>{widget.columns.map((column, index) => <th key={`${index}-${column}`} scope=\"col\">{column}</th>)}</tr></thead>\n <tbody>{widget.rows.map((row, rowIndex) => <tr key={rowIndex}>{row.map((cell, columnIndex) => <td key={columnIndex}>{cell}</td>)}</tr>)}</tbody>\n </table>;\n}\n","import React from \"react\";\nimport type { AgentWebAppRuntimeMessage } from \"../types\";\nimport { useWidgetChat } from \"../hooks/useWidgetChat\";\nimport { WidgetMarkdown } from \"./WidgetMarkdown\";\nimport { WidgetGenUIRenderer } from \"./WidgetGenUIRenderer\";\n\nexport interface WidgetMessageListProps { className?: string; listLabel?: string; emptyLabel?: string; toolActivityLabel?: string; emptySlot?: React.ReactNode; }\n\nfunction roleName(message: AgentWebAppRuntimeMessage): string {\n if (message.role === \"human\") return \"You\";\n if (message.role === \"ai\") return \"Assistant\";\n return message.role;\n}\n\nexport function WidgetMessageList({ className, listLabel = \"Messages\", emptyLabel = \"Start a conversation\", toolActivityLabel = \"Activity\", emptySlot }: WidgetMessageListProps): React.ReactElement {\n const { messages, tools, isLoading } = useWidgetChat();\n return <div className={`axiom-web-app__message-area${className ? ` ${className}` : \"\"}`}><div className=\"axiom-web-app__messages\" role=\"log\" aria-label={listLabel} aria-live=\"polite\">{!isLoading && messages.length === 0 && (emptySlot || <p className=\"axiom-web-app__empty\">{emptyLabel}</p>)}{messages.map((message) => <article className={`axiom-web-app__message axiom-web-app__message--${message.role}`} key={message.id}><span className=\"axiom-web-app__message-role\">{roleName(message)}</span><div className=\"axiom-web-app__message-content\">{Array.isArray(message.content) ? message.content.map((block, index) => <WidgetGenUIRenderer key={index} block={block} />) : <WidgetMarkdown content={message.content ?? \"\"} />}</div></article>)}</div>{tools.length > 0 && <section className=\"axiom-web-app__tools\" aria-label={toolActivityLabel}>{tools.map((tool) => <div className=\"axiom-web-app__tool\" key={tool.id}><span aria-hidden=\"true\">{tool.status === \"running\" ? \"...\" : \"OK\"}</span> {tool.name || \"Tool\"}</div>)}</section>}</div>;\n}\n","import React, { useState } from \"react\";\nimport { useWidgetProject } from \"../hooks/useWidgetProject\";\nimport { widgetErrorMessage } from \"./widget-utils\";\n\nexport interface WidgetModelSelectorProps { className?: string; label?: string; }\n\nexport function WidgetModelSelector({ className, label = \"Model\" }: WidgetModelSelectorProps): React.ReactElement | null {\n const { bootstrap, modelKey, selectModel, isLoading } = useWidgetProject();\n const [error, setError] = useState<string | null>(null);\n if (!bootstrap?.webApp.features.modelSelector) return null;\n const select = (key: string): void => {\n setError(null);\n try { selectModel(key); } catch (selectionError) { setError(widgetErrorMessage(selectionError)); }\n };\n return <div className={className}><label className=\"axiom-web-app__field\"><span>{label}</span><select aria-label={label} value={modelKey ?? \"\"} disabled={isLoading} onChange={(event) => select(event.target.value)}>{bootstrap.models.map((model) => <option key={model.key} value={model.key}>{model.label}</option>)}</select></label>{error && <p className=\"axiom-web-app__error\" role=\"alert\">{error}</p>}</div>;\n}\n","import React, { useRef, useState } from \"react\";\nimport { useWidgetProject } from \"../hooks/useWidgetProject\";\nimport { widgetErrorMessage } from \"./widget-utils\";\n\nexport interface WidgetProjectSelectorProps { className?: string; label?: string; }\n\nexport function WidgetProjectSelector({ className, label = \"Project\" }: WidgetProjectSelectorProps): React.ReactElement | null {\n const { bootstrap, projectId, selectProject, isLoading } = useWidgetProject();\n const pendingRef = useRef(false);\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<string | null>(null);\n if (!bootstrap?.webApp.features.projectSelector) return null;\n const select = async (id: string): Promise<void> => {\n if (pendingRef.current) return;\n pendingRef.current = true; setPending(true); setError(null);\n try { await selectProject(id); }\n catch (selectionError) { setError(widgetErrorMessage(selectionError)); }\n finally { pendingRef.current = false; setPending(false); }\n };\n return <div className={className}><label className=\"axiom-web-app__field\"><span>{label}</span><select aria-label={label} value={projectId ?? \"\"} disabled={isLoading || pending} onChange={(event) => void select(event.target.value)}>{bootstrap.projects.map((project) => <option key={project.id} value={project.id}>{project.name}</option>)}</select></label>{error && <p className=\"axiom-web-app__error\" role=\"alert\">{error}</p>}</div>;\n}\n","import React, { useRef, useState } from \"react\";\nimport { Modal } from \"antd\";\nimport type { AgentWebAppRuntimeThread } from \"../types\";\nimport { useWidgetProject } from \"../hooks/useWidgetProject\";\nimport { useWidgetThreads } from \"../hooks/useWidgetThreads\";\nimport { widgetErrorMessage } from \"./widget-utils\";\n\nexport interface WidgetThreadListProps { className?: string; navigationLabel?: string; newThreadLabel?: string; emptyLabel?: string; }\nfunction threadName(thread: AgentWebAppRuntimeThread, index: number): string { return thread.label?.trim() || `Conversation ${index + 1}`; }\n\nexport function WidgetThreadList({ className, navigationLabel = \"Conversations\", newThreadLabel = \"New conversation\", emptyLabel = \"No conversations yet\" }: WidgetThreadListProps): React.ReactElement | null {\n const { bootstrap } = useWidgetProject();\n const { threads, activeThread, isLoading, selectThread, createThread, renameThread, deleteThread } = useWidgetThreads();\n const pendingRef = useRef(false);\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [renameTarget, setRenameTarget] = useState<AgentWebAppRuntimeThread | null>(null);\n const [renameValue, setRenameValue] = useState(\"\");\n const [deleteTarget, setDeleteTarget] = useState<AgentWebAppRuntimeThread | null>(null);\n if (!bootstrap?.webApp.features.threadManagement) return null;\n const run = async (operation: () => Promise<unknown>, complete?: () => void): Promise<void> => {\n if (pendingRef.current) return;\n pendingRef.current = true; setPending(true); setError(null);\n try { await operation(); complete?.(); }\n catch (operationError) { setError(widgetErrorMessage(operationError)); }\n finally { pendingRef.current = false; setPending(false); }\n };\n return <nav className={`axiom-web-app__sidebar${className ? ` ${className}` : \"\"}`} aria-label={navigationLabel}>{error && <p className=\"axiom-web-app__error\" role=\"alert\">{error}</p>}<button className=\"axiom-web-app__new-thread\" type=\"button\" disabled={isLoading || pending} onClick={() => void run(() => createThread())}>{newThreadLabel}</button><div className=\"axiom-web-app__thread-list\">{!isLoading && threads.length === 0 && <p className=\"axiom-web-app__empty\">{emptyLabel}</p>}{threads.map((thread, index) => { const name = threadName(thread, index); return <div className={`axiom-web-app__thread${activeThread?.id === thread.id ? \" axiom-web-app__thread--active\" : \"\"}`} key={thread.id}><button type=\"button\" disabled={pending} className=\"axiom-web-app__thread-select\" aria-label={`Open ${name}`} aria-current={activeThread?.id === thread.id ? \"page\" : undefined} onClick={() => void run(() => selectThread(thread))}><span className=\"axiom-web-app__thread-label\" title={name}>{name}</span></button><button type=\"button\" disabled={pending} className=\"axiom-web-app__thread-rename\" aria-label={`Rename ${name}`} onClick={() => { setRenameTarget(thread); setRenameValue(name); }}>Rename</button><button type=\"button\" disabled={pending} className=\"axiom-web-app__thread-delete\" aria-label={`Delete ${name}`} onClick={() => setDeleteTarget(thread)}>Delete</button></div>; })}</div><Modal title=\"Rename conversation\" open={renameTarget !== null} onCancel={() => { if (!pending) setRenameTarget(null); }} onOk={() => renameTarget && void run(() => renameThread(renameTarget.id, renameValue.trim()), () => setRenameTarget(null))} okText=\"Save\" cancelText=\"Cancel\" okButtonProps={{ loading: pending, disabled: !renameValue.trim() }} cancelButtonProps={{ disabled: pending }}><label className=\"axiom-web-app__modal-field\"><span>Conversation name</span><input aria-label=\"Conversation name\" value={renameValue} disabled={pending} onChange={(event) => setRenameValue(event.target.value)} /></label></Modal><Modal title=\"Delete conversation?\" open={deleteTarget !== null} onCancel={() => { if (!pending) setDeleteTarget(null); }} onOk={() => deleteTarget && void run(() => deleteThread(deleteTarget.id), () => setDeleteTarget(null))} okText=\"Delete\" cancelText=\"Cancel\" okButtonProps={{ danger: true, loading: pending }} cancelButtonProps={{ disabled: pending }}><p>This conversation and its messages will be permanently deleted.</p></Modal></nav>;\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAgB,aAAa,WAAW,YAAY,cAAc;;;ACAlE,SAAS,qBAAqB;AAwBvB,IAAM,qBAAqB,cAA8C,IAAI;AAE7E,SAAS,gBAAgB,SAAgD;AAC9E,SAAO,IAAI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aAAlqB,OAAO,EAAoqB;AAAA,MAAQ,CAAC;AAAA,OAAE;AAAA,IAAM,gBAAAA,MAAC,SAAM,OAAM,uBAAsB,MAAM,iBAAiB,MAAM,UAAU,MAAM;AAAE,UAAI,CAAC,QAAS,iBAAgB,IAAI;AAAA,IAAG,GAAG,MAAM,MAAM,gBAAgB,KAAK,IAAI,MAAM,aAAa,aAAa,IAAI,YAAY,KAAK,CAAC,GAAG,MAAM,gBAAgB,IAAI,CAAC,GAAG,QAAO,QAAO,YAAW,UAAS,eAAe,EAAE,SAAS,SAAS,UAAU,CAAC,YAAY,KAAK,EAAE,GAAG,mBAAmB,EAAE,UAAU,QAAQ,GAAG,0BAAAC,MAAC,WAAM,WAAU,8BAA6B;AAAA,sBAAAD,MAAC,UAAK,+BAAiB;AAAA,MAAO,gBAAAA,MAAC,WAAM,cAAW,qBAAoB,OAAO,aAAa,UAAU,SAAS,UAAU,CAAC,UAAU,eAAe,MAAM,OAAO,KAAK,GAAG;AAAA,OAAE,GAAQ;AAAA,IAAQ,gBAAAA,MAAC,SAAM,OAAM,wBAAuB,MAAM,iBAAiB,MAAM,UAAU,MAAM;AAAE,UAAI,CAAC,QAAS,iBAAgB,IAAI;AAAA,IAAG,GAAG,MAAM,MAAM,gBAAgB,KAAK,IAAI,MAAM,aAAa,aAAa,EAAE,GAAG,MAAM,gBAAgB,IAAI,CAAC,GAAG,QAAO,UAAS,YAAW,UAAS,eAAe,EAAE,QAAQ,MAAM,SAAS,QAAQ,GAAG,mBAAmB,EAAE,UAAU,QAAQ,GAAG,0BAAAA,MAAC,OAAE,6EAA+D,GAAI;AAAA,KAAQ;AACt4E;","names":["useContext","useContext","useContext","useContext","useContext","useContext","useContext","useContext","useContext","useContext","useRef","jsx","useRef","useRef","useState","jsx","jsxs","useRef","useState","jsx","jsxs","jsx","jsx","jsx","jsxs","jsx","jsxs","useState","jsx","jsxs","useState","useRef","useState","jsx","jsxs","useRef","useState","useRef","useState","jsx","jsxs","useRef","useState"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiom-lattice/react-sdk",
3
- "version": "4.3.0",
3
+ "version": "4.4.0",
4
4
  "description": "React hooks for interacting with the Axiom Lattice Agent Service API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -92,8 +92,8 @@
92
92
  "react-i18next": "^15.4.1",
93
93
  "use-sync-external-store": "^1.5.0",
94
94
  "uuid": "^11.1.0",
95
- "@axiom-lattice/client-sdk": "4.5.0",
96
- "@axiom-lattice/protocols": "4.4.0"
95
+ "@axiom-lattice/client-sdk": "4.5.1",
96
+ "@axiom-lattice/protocols": "4.4.1"
97
97
  },
98
98
  "peerDependencies": {
99
99
  "react": ">=18.0.0",
@@ -1,19 +0,0 @@
1
- import {
2
- AgentGovernanceWorkbench
3
- } from "./chunk-2ZK7AUQW.mjs";
4
- import "./chunk-3NR7UAPT.mjs";
5
- import "./chunk-4FI66ZJ3.mjs";
6
- import "./chunk-ENLK3ODS.mjs";
7
- import "./chunk-7QQKL657.mjs";
8
- import "./chunk-4SVLWYLW.mjs";
9
- import "./chunk-7FWCKQNB.mjs";
10
- import "./chunk-YUV4WO25.mjs";
11
- import "./chunk-NSGSGYM7.mjs";
12
- import "./chunk-XC6TB6PI.mjs";
13
- import "./chunk-XAGSG72Y.mjs";
14
- import "./chunk-3VRRRJHP.mjs";
15
- import "./chunk-SH6YXSHR.mjs";
16
- export {
17
- AgentGovernanceWorkbench
18
- };
19
- //# sourceMappingURL=AgentGovernanceWorkbench-2MPAB6UF.mjs.map