@axiom-lattice/react-sdk 10.8.0 → 10.9.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.
- package/dist/{AgentDetailSideApp-MC2QAFUQ.mjs → AgentDetailSideApp-KIJALOS5.mjs} +7 -7
- package/dist/{AgentGovernanceWorkbench-PR2CUMHR.mjs → AgentGovernanceWorkbench-MQX3BH35.mjs} +8 -8
- package/dist/{AgentWebAppProvider-CIabimVC.d.mts → AgentWebAppProvider-x5lVhkhO.d.mts} +6 -0
- package/dist/{AgentWebAppProvider-CIabimVC.d.ts → AgentWebAppProvider-x5lVhkhO.d.ts} +6 -0
- package/dist/{MessageGraph-IUDE2EDC.mjs → MessageGraph-6EQTQAAR.mjs} +2 -2
- package/dist/{ReactChart-TPOQ6BXW.mjs → ReactChart-DZICSFTV.mjs} +2 -2
- package/dist/{TasksSideApp-QDLOQLZS.mjs → TasksSideApp-CLHMMR4L.mjs} +3 -3
- package/dist/{TopologyRuntimeView-JKGKNV7C.mjs → TopologyRuntimeView-BLBB5PQP.mjs} +3 -3
- package/dist/{WorkflowAutomationView-5AJ2QGM2.mjs → WorkflowAutomationView-IPW72SR6.mjs} +5 -5
- package/dist/agent-chat-loader.js +1 -1
- package/dist/{chunk-IIB5BEMF.mjs → chunk-2BFZHC3S.mjs} +2 -2
- package/dist/{chunk-BFKG2OIX.mjs → chunk-3S4RAOOF.mjs} +4 -4
- package/dist/{chunk-WCBQEED7.mjs → chunk-6XN2KL76.mjs} +2 -2
- package/dist/{chunk-DTZPCOY2.mjs → chunk-FVJMVJR2.mjs} +4 -2
- package/dist/chunk-FVJMVJR2.mjs.map +1 -0
- package/dist/{chunk-4AQVKTZZ.mjs → chunk-J7NG35IU.mjs} +2 -2
- package/dist/{chunk-25QAUXI3.mjs → chunk-OTQDEU5U.mjs} +10 -9
- package/dist/chunk-OTQDEU5U.mjs.map +1 -0
- package/dist/{chunk-YGZX4CDC.mjs → chunk-QJTPXXPS.mjs} +4 -4
- package/dist/{chunk-PPMYPBGP.mjs → chunk-YGNARZGO.mjs} +10 -10
- package/dist/{embed-page-AgentDetailSideApp-L2GPADRT.js → embed-page-AgentDetailSideApp-OXIDUA5Q.js} +1 -1
- package/dist/{embed-page-AgentGovernanceWorkbench-YXVJ5FJK.js → embed-page-AgentGovernanceWorkbench-AMQYURAT.js} +1 -1
- package/dist/{embed-page-MessageGraph-IFPNLCXQ.js → embed-page-MessageGraph-3DHT34VK.js} +1 -1
- package/dist/{embed-page-ReactChart-LBU6Y2BP.js → embed-page-ReactChart-V7HF2DHF.js} +1 -1
- package/dist/{embed-page-TasksSideApp-GRQXWFJ2.js → embed-page-TasksSideApp-KTQESBCT.js} +1 -1
- package/dist/{embed-page-TopologyRuntimeView-MAQLZ4DX.js → embed-page-TopologyRuntimeView-MIDX2DWN.js} +1 -1
- package/dist/{embed-page-WorkflowAutomationView-VZPD4WA3.js → embed-page-WorkflowAutomationView-4IR6R7HJ.js} +1 -1
- package/dist/{embed-page-chunk-R4YUWCMY.js → embed-page-chunk-3KAR3CFT.js} +1 -1
- package/dist/{embed-page-chunk-2XQNSJVY.js → embed-page-chunk-6X6A2D25.js} +5 -5
- package/dist/{embed-page-chunk-7PUQYEF4.js → embed-page-chunk-CEOKXM64.js} +1 -1
- package/dist/{embed-page-chunk-BMLFBT5Q.js → embed-page-chunk-TA3SPNRO.js} +1 -1
- package/dist/{embed-page-chunk-OXQV7DZF.js → embed-page-chunk-W6NJJTMF.js} +1 -1
- package/dist/embed-page-chunk-YVQDSZ77.js +8 -0
- package/dist/embed-page.js +3 -3
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/web-app.d.mts +2 -2
- package/dist/web-app.d.ts +2 -2
- package/dist/web-app.js +7 -4
- package/dist/web-app.js.map +1 -1
- package/dist/web-app.mjs +5 -4
- package/dist/web-app.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-25QAUXI3.mjs.map +0 -1
- package/dist/chunk-DTZPCOY2.mjs.map +0 -1
- package/dist/embed-page-chunk-PNDVX33M.js +0 -8
- /package/dist/{AgentDetailSideApp-MC2QAFUQ.mjs.map → AgentDetailSideApp-KIJALOS5.mjs.map} +0 -0
- /package/dist/{AgentGovernanceWorkbench-PR2CUMHR.mjs.map → AgentGovernanceWorkbench-MQX3BH35.mjs.map} +0 -0
- /package/dist/{MessageGraph-IUDE2EDC.mjs.map → MessageGraph-6EQTQAAR.mjs.map} +0 -0
- /package/dist/{ReactChart-TPOQ6BXW.mjs.map → ReactChart-DZICSFTV.mjs.map} +0 -0
- /package/dist/{TasksSideApp-QDLOQLZS.mjs.map → TasksSideApp-CLHMMR4L.mjs.map} +0 -0
- /package/dist/{TopologyRuntimeView-JKGKNV7C.mjs.map → TopologyRuntimeView-BLBB5PQP.mjs.map} +0 -0
- /package/dist/{WorkflowAutomationView-5AJ2QGM2.mjs.map → WorkflowAutomationView-IPW72SR6.mjs.map} +0 -0
- /package/dist/{chunk-IIB5BEMF.mjs.map → chunk-2BFZHC3S.mjs.map} +0 -0
- /package/dist/{chunk-BFKG2OIX.mjs.map → chunk-3S4RAOOF.mjs.map} +0 -0
- /package/dist/{chunk-WCBQEED7.mjs.map → chunk-6XN2KL76.mjs.map} +0 -0
- /package/dist/{chunk-4AQVKTZZ.mjs.map → chunk-J7NG35IU.mjs.map} +0 -0
- /package/dist/{chunk-YGZX4CDC.mjs.map → chunk-QJTPXXPS.mjs.map} +0 -0
- /package/dist/{chunk-PPMYPBGP.mjs.map → chunk-YGNARZGO.mjs.map} +0 -0
package/dist/web-app.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentWebAppRuntimeClient,
|
|
3
3
|
AgentWebAppRuntimeClientError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FVJMVJR2.mjs";
|
|
5
5
|
import {
|
|
6
6
|
XMarkdown_default,
|
|
7
7
|
formatErrorMessage,
|
|
@@ -150,11 +150,11 @@ function requestModelKey(bootstrap, modelKey) {
|
|
|
150
150
|
}
|
|
151
151
|
function AgentWebAppProvider(props) {
|
|
152
152
|
validateProps(props);
|
|
153
|
-
const scopeKey = `${props.gatewayUrl}\0${props.webAppId}\0${props.identity.mode === "unverified" ? props.identity.userId : "verified:token"}`;
|
|
153
|
+
const scopeKey = `${props.gatewayUrl}\0${props.webAppId}\0${props.identity.mode === "unverified" ? props.identity.userId : "verified:token"}\0${props.credentials ?? "omit"}`;
|
|
154
154
|
const locale = readStoredLocale(DEFAULT_LOCALE_STORAGE_KEY) ?? "en-US";
|
|
155
155
|
return /* @__PURE__ */ jsx(LocaleLayerIfAbsent, { locale, storageKey: DEFAULT_LOCALE_STORAGE_KEY, children: /* @__PURE__ */ jsx(ScopedAgentWebAppProvider, { ...props }, scopeKey) });
|
|
156
156
|
}
|
|
157
|
-
function ScopedAgentWebAppProvider({ gatewayUrl, webAppId, identity, children, onError, fetch: fetchImplementation }) {
|
|
157
|
+
function ScopedAgentWebAppProvider({ gatewayUrl, webAppId, identity, children, onError, fetch: fetchImplementation, credentials }) {
|
|
158
158
|
const t = useT();
|
|
159
159
|
const [state, dispatch] = useReducer(agentWebAppReducer, initialAgentWebAppState);
|
|
160
160
|
const stateRef = useRef(state);
|
|
@@ -185,7 +185,8 @@ function ScopedAgentWebAppProvider({ gatewayUrl, webAppId, identity, children, o
|
|
|
185
185
|
}
|
|
186
186
|
},
|
|
187
187
|
translate: t,
|
|
188
|
-
...fetchImplementation ? { fetch: fetchImplementation } : {}
|
|
188
|
+
...fetchImplementation ? { fetch: fetchImplementation } : {},
|
|
189
|
+
...credentials ? { credentials } : {}
|
|
189
190
|
});
|
|
190
191
|
}
|
|
191
192
|
const client = clientRef.current;
|
package/dist/web-app.mjs.map
CHANGED
|
@@ -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 { formatErrorMessage } from \"../../utils/errorMessage\";\nimport { DEFAULT_LOCALE_STORAGE_KEY, readStoredLocale, useT } from \"../../i18n\";\nimport type { LatticeLocale, SdkTFunction } from \"../../i18n\";\nimport { LocaleLayerIfAbsent } from \"../../i18n/LocaleLayerIfAbsent\";\nimport { agentWebAppReducer, initialAgentWebAppState } from \"./state/agentWebAppReducer\";\nimport type {\n AgentWebAppBootstrap,\n AgentWebAppInterrupt,\n AgentWebAppInterruptResponse,\n AgentWebAppRuntimeMessage,\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, t: SdkTFunction): AgentWebAppRuntimeClientError {\n if (error instanceof AgentWebAppRuntimeClientError) return error;\n return new AgentWebAppRuntimeClientError(\"INTERNAL_ERROR\", t(\"integration.error.requestFailed\"), 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 const locale: LatticeLocale = readStoredLocale(DEFAULT_LOCALE_STORAGE_KEY) ?? \"en-US\";\n return (\n <LocaleLayerIfAbsent locale={locale} storageKey={DEFAULT_LOCALE_STORAGE_KEY}>\n <ScopedAgentWebAppProvider key={scopeKey} {...props} />\n </LocaleLayerIfAbsent>\n );\n}\n\nfunction ScopedAgentWebAppProvider({ gatewayUrl, webAppId, identity, children, onError, fetch: fetchImplementation }: AgentWebAppProviderProps): React.ReactElement {\n const t = useT();\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\", t(\"integration.error.identityTokenFailed\"), true);\n }\n },\n },\n translate: t,\n ...(fetchImplementation ? { fetch: fetchImplementation } : {}),\n });\n }\n const client = clientRef.current;\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, t);\n dispatch({ type: \"ERROR_SET\", error: normalized });\n return normalized;\n }, [t]);\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 if (bootstrap?.webApp.features.hitl) {\n const assistantId = bootstrap.webApp.assistant.id;\n dispatch({ type: \"INTERRUPTS_LOADING\", loading: true });\n const status = await threadControlled((signal) => client.getThreadStatus(assistantId, thread.id, projectId ? { projectId } : {}, signal));\n if (generation === generationRef.current && threadGeneration === threadGenerationRef.current) {\n dispatch({ type: \"INTERRUPTS_LOADING\", loading: false });\n for (const interrupt of status.interrupts) dispatch({ type: \"INTERRUPT_ADD\", interrupt });\n }\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: \"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\", t(\"integration.error.notReady\"), true));\n if (!bootstrap.webApp.features.projectSelector) throw featureDisabled(t(\"integration.error.projectSelectionDisabled\"));\n if (!bootstrap.projects.some((project) => project.id === projectId)) throw report(new AgentWebAppRuntimeClientError(\"PROJECT_NOT_ALLOWED\", t(\"integration.error.projectNotAllowed\"), 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, t]);\n\n const selectModel = useCallback((modelKey: string): void => {\n const bootstrap = stateRef.current.bootstrap;\n if (!bootstrap) throw report(new AgentWebAppRuntimeClientError(\"INVALID_REQUEST\", t(\"integration.error.notReady\"), true));\n if (!bootstrap.webApp.features.modelSelector) throw featureDisabled(t(\"integration.error.modelSelectionDisabled\"));\n if (!bootstrap.models.some((model) => model.key === modelKey)) throw report(new AgentWebAppRuntimeClientError(\"MODEL_NOT_ALLOWED\", t(\"integration.error.modelNotAllowed\"), false));\n dispatch({ type: \"MODEL_SELECTED\", modelKey });\n }, [report, t]);\n\n const requireThreadManagement = useCallback((): void => {\n if (!stateRef.current.bootstrap?.webApp.features.threadManagement) throw featureDisabled(t(\"integration.error.threadManagementDisabled\"));\n }, [t]);\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\", t(\"integration.error.threadOtherProject\"), 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, t]);\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, t]);\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\", t(\"integration.error.threadNotFound\"), 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, t]);\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\", t(\"integration.error.threadNotFound\"), 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, t]);\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, t(\"integration.error.streamError\")), 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, t]);\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\", t(\"integration.error.alreadyStreaming\"), false);\n if (!current.activeThread || !current.projectId) throw report(new AgentWebAppRuntimeClientError(\"THREAD_NOT_FOUND\", t(\"integration.error.noActiveThread\"), false));\n if (!content.trim()) throw report(new AgentWebAppRuntimeClientError(\"INVALID_REQUEST\", t(\"integration.error.contentRequired\"), 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: async (onEvent, signal) => {\n const bootstrap = stateRef.current.bootstrap;\n const runtimeAssistantId = bootstrap?.webApp.assistant.id;\n if (!runtimeAssistantId) throw new AgentWebAppRuntimeClientError(\"INTERNAL_ERROR\", t(\"integration.error.notReady\"), true);\n const selection = { ...(projectId ? { projectId } : {}), ...(modelKey ? { modelKey } : {}) };\n const result = await client.commandsRunStart(runtimeAssistantId, current.activeThread!.id, {\n input: { message: content, ...(refs.length ? { files: refs } : {}) },\n config: modelKey ? { modelConfig: { modelKey } } : undefined,\n multitask_strategy: \"enqueue\",\n }, selection, signal);\n await client.streamThreadEvents(runtimeAssistantId, current.activeThread!.id, {\n ...selection,\n anchor: result.messageId,\n allowInterrupts: bootstrap?.webApp.features.hitl ?? false,\n allowGenUI: bootstrap?.webApp.features.genUI ?? false,\n }, onEvent, signal);\n },\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, t]);\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\", t(\"integration.error.noFailedMessage\"), false));\n await send(failed.text, failed.attachmentIds);\n }, [report, send, t]);\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(t(\"integration.error.attachmentsDisabled\"));\n if (!current.activeThread) throw report(new AgentWebAppRuntimeClientError(\"THREAD_NOT_FOUND\", t(\"integration.error.noActiveThread\"), 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, t]);\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\", t(\"integration.error.alreadyStreaming\"), false));\n if (!current.bootstrap?.webApp.features.hitl) throw featureDisabled(t(\"integration.error.humanReviewDisabled\"));\n if (!current.activeThread || !current.projectId) throw report(new AgentWebAppRuntimeClientError(\"THREAD_NOT_FOUND\", t(\"integration.error.noActiveThread\"), false));\n if (!current.interrupts.some((item) => item.id === interruptId)) throw report(new AgentWebAppRuntimeClientError(\"INVALID_REQUEST\", t(\"integration.error.interruptNotFound\"), 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: async (onEvent, signal) => {\n const bootstrap = stateRef.current.bootstrap;\n const runtimeAssistantId = bootstrap?.webApp.assistant.id;\n if (!runtimeAssistantId) throw new AgentWebAppRuntimeClientError(\"INTERNAL_ERROR\", t(\"integration.error.notReady\"), true);\n const selection = { ...(projectId ? { projectId } : {}), ...(modelKey ? { modelKey } : {}) };\n const result = await client.commandsRespond(runtimeAssistantId, activeThread.id, {\n interrupt_id: interruptId,\n resume: response !== null && typeof response === \"object\" ? { ...response, message } : { response, message },\n config: modelKey ? { modelConfig: { modelKey } } : undefined,\n }, selection, signal);\n if (result.accepted === false) {\n throw new AgentWebAppRuntimeClientError(\"INVALID_REQUEST\", t(\"integration.error.interruptNotAccepted\"), false);\n }\n await client.streamThreadEvents(runtimeAssistantId, activeThread.id, {\n ...selection,\n anchor: result.messageId,\n allowInterrupts: bootstrap?.webApp.features.hitl ?? false,\n allowGenUI: bootstrap?.webApp.features.genUI ?? false,\n }, onEvent, signal);\n },\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, t]);\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\";\nimport { useT } from \"../../../i18n\";\n\nexport interface WidgetAttachmentsProps { className?: string; attachLabel?: string; }\n\nexport function WidgetAttachments({ className, attachLabel }: WidgetAttachmentsProps): React.ReactElement | null {\n const t = useT();\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 label = attachLabel ?? t(\"integration.attach.files\");\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, t)); }\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={t(\"integration.attach.removeNamed\", { name: attachment.name })} onClick={() => removeAttachment(attachment.ref)}>{t(\"integration.attach.remove\")}</button></span>)}</div>}{error && <p className=\"axiom-web-app__error\" role=\"alert\">{error}</p>}<label className=\"axiom-web-app__attach\"><span>{isLoading || pending ? t(\"integration.attach.uploading\") : label}</span><input ref={inputRef} type=\"file\" multiple aria-label={label} disabled={!activeThread || isLoading || pending} onChange={(event) => void upload(event)} /></label></div>;\n}\n","import { formatErrorMessage } from \"../../../utils/errorMessage\";\nimport type { SdkTFunction } from \"../../../i18n\";\n\nexport function widgetErrorMessage(error: unknown, t: SdkTFunction): string {\n return formatErrorMessage(error, t(\"integration.error.requestFailed\"));\n}\n","import React, { useRef, useState } from \"react\";\nimport { useWidgetChat } from \"../hooks/useWidgetChat\";\nimport { widgetErrorMessage } from \"./widget-utils\";\nimport { useT } from \"../../../i18n\";\n\nexport interface WidgetComposerProps { className?: string; messageLabel?: string; placeholder?: string; sendLabel?: string; abortLabel?: string; leadingSlot?: React.ReactNode; }\n\nexport function WidgetComposer({ className, messageLabel, placeholder, sendLabel, abortLabel, leadingSlot }: WidgetComposerProps): React.ReactElement {\n const t = useT();\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, t)); }\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, t));\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 ?? t(\"integration.composer.message\")}</span><textarea aria-label={messageLabel ?? t(\"integration.composer.message\")} value={text} placeholder={placeholder ?? t(\"integration.composer.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}>{t(\"integration.composer.retryFailed\")}</button>}{isStreaming ? <button type=\"button\" disabled={pending} onClick={() => void run(abort)}>{abortLabel ?? t(\"integration.composer.stop\")}</button> : <button type=\"submit\" disabled={!activeThread || !text.trim() || pending}>{sendLabel ?? t(\"integration.composer.send\")}</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\";\nimport { useT } from \"../../../i18n\";\nimport type { SdkTFunction } from \"../../../i18n\";\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, t: SdkTFunction): string {\n return formatErrorMessage(error, t(\"integration.interrupt.submitFailed\"));\n}\n\nexport function WidgetInterruptView({ interrupt, onSubmit, className, approveLabel, rejectLabel, feedbackLabel, disabled = false }: WidgetInterruptViewProps): React.ReactElement {\n const t = useT();\n const review = useReviewDecision(async (decision, feedback) => {\n const approved = decision === \"approve\";\n await onSubmit(interrupt.id, { approved, ...(feedback ? { feedback } : {}) }, feedback || (approved ? t(\"integration.interrupt.approvedMessage\") : t(\"integration.interrupt.changesRequestedMessage\")));\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={t(\"integration.interrupt.aria\")}>\n <strong>{interrupt.prompt}</strong>\n {interrupt.data && <p className=\"axiom-web-app__interrupt-fallback\">{t(\"integration.interrupt.detailsUnavailable\")}</p>}\n <label className=\"axiom-web-app__feedback\">\n <span>{feedbackLabel ?? t(\"integration.interrupt.feedback\")}</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, t)}</p>}\n <div className=\"axiom-web-app__interrupt-actions\">\n <button type=\"button\" disabled={disabled || review.pending !== null} onClick={() => void submit(false)}>{rejectLabel ?? t(\"integration.interrupt.reject\")}</button>\n <button type=\"button\" disabled={disabled || review.pending !== null} onClick={() => void submit(true)}>{approveLabel ?? t(\"integration.interrupt.approve\")}</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\";\nimport { useT } from \"../../../i18n\";\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 t = useT();\n const safeHref = safeUrl(src);\n const label = alt?.trim() || t(\"integration.markdown.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 }: WidgetMarkdownProps): React.ReactElement {\n const t = useT();\n if (typeof content !== \"string\") return <span className={className}>{unsupportedLabel ?? t(\"integration.markdown.unsupported\")}</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\";\nimport { useT } from \"../../../i18n\";\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 t = useT();\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 ?? t(\"integration.genui.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 ?? t(\"integration.genui.dataTable\")}>\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\";\nimport { useT } from \"../../../i18n\";\nimport type { SdkTFunction } from \"../../../i18n\";\n\nexport interface WidgetMessageListProps { className?: string; listLabel?: string; emptyLabel?: string; toolActivityLabel?: string; emptySlot?: React.ReactNode; }\n\nfunction roleName(message: AgentWebAppRuntimeMessage, t: SdkTFunction): string {\n if (message.role === \"human\") return t(\"integration.messages.roleYou\");\n if (message.role === \"ai\") return t(\"integration.messages.roleAssistant\");\n return message.role;\n}\n\nexport function WidgetMessageList({ className, listLabel, emptyLabel, toolActivityLabel, emptySlot }: WidgetMessageListProps): React.ReactElement {\n const t = useT();\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 ?? t(\"integration.messages.aria\")} aria-live=\"polite\">{!isLoading && messages.length === 0 && (emptySlot || <p className=\"axiom-web-app__empty\">{emptyLabel ?? t(\"integration.messages.empty\")}</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, t)}</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 ?? t(\"integration.messages.activity\")}>{tools.map((tool) => <div className=\"axiom-web-app__tool\" key={tool.id}><span aria-hidden=\"true\">{tool.status === \"running\" ? \"...\" : \"OK\"}</span> {tool.name || t(\"integration.messages.tool\")}</div>)}</section>}</div>;\n}\n","import React, { useState } from \"react\";\nimport { useWidgetProject } from \"../hooks/useWidgetProject\";\nimport { widgetErrorMessage } from \"./widget-utils\";\nimport { useT } from \"../../../i18n\";\n\nexport interface WidgetModelSelectorProps { className?: string; label?: string; }\n\nexport function WidgetModelSelector({ className, label }: WidgetModelSelectorProps): React.ReactElement | null {\n const t = useT();\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 fieldLabel = label ?? t(\"integration.model.label\");\n const select = (key: string): void => {\n setError(null);\n try { selectModel(key); } catch (selectionError) { setError(widgetErrorMessage(selectionError, t)); }\n };\n return <div className={className}><label className=\"axiom-web-app__field\"><span>{fieldLabel}</span><select aria-label={fieldLabel} 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\";\nimport { useT } from \"../../../i18n\";\n\nexport interface WidgetProjectSelectorProps { className?: string; label?: string; }\n\nexport function WidgetProjectSelector({ className, label }: WidgetProjectSelectorProps): React.ReactElement | null {\n const t = useT();\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 fieldLabel = label ?? t(\"integration.project.label\");\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, t)); }\n finally { pendingRef.current = false; setPending(false); }\n };\n return <div className={className}><label className=\"axiom-web-app__field\"><span>{fieldLabel}</span><select aria-label={fieldLabel} 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\";\nimport { useT } from \"../../../i18n\";\nimport type { SdkTFunction } from \"../../../i18n\";\n\nexport interface WidgetThreadListProps { className?: string; navigationLabel?: string; newThreadLabel?: string; emptyLabel?: string; }\nfunction threadName(thread: AgentWebAppRuntimeThread, index: number, t: SdkTFunction): string { return thread.label?.trim() || t(\"integration.threads.defaultName\", { index: index + 1 }); }\n\nexport function WidgetThreadList({ className, navigationLabel, newThreadLabel, emptyLabel }: WidgetThreadListProps): React.ReactElement | null {\n const t = useT();\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, t)); }\n finally { pendingRef.current = false; setPending(false); }\n };\n return <nav className={`axiom-web-app__sidebar${className ? ` ${className}` : \"\"}`} aria-label={navigationLabel ?? t(\"integration.threads.aria\")}>{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 ?? t(\"integration.threads.new\")}</button><div className=\"axiom-web-app__thread-list\">{!isLoading && threads.length === 0 && <p className=\"axiom-web-app__empty\">{emptyLabel ?? t(\"integration.threads.empty\")}</p>}{threads.map((thread, index) => { const name = threadName(thread, index, t); 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={t(\"integration.threads.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={t(\"integration.threads.renameNamed\", { name })} onClick={() => { setRenameTarget(thread); setRenameValue(name); }}>{t(\"integration.threads.rename\")}</button><button type=\"button\" disabled={pending} className=\"axiom-web-app__thread-delete\" aria-label={t(\"integration.threads.deleteNamed\", { name })} onClick={() => setDeleteTarget(thread)}>{t(\"integration.threads.delete\")}</button></div>; })}</div><Modal title={t(\"integration.threads.renameTitle\")} open={renameTarget !== null} onCancel={() => { if (!pending) setRenameTarget(null); }} onOk={() => renameTarget && void run(() => renameThread(renameTarget.id, renameValue.trim()), () => setRenameTarget(null))} okText={t(\"common.save\")} cancelText={t(\"common.cancel\")} okButtonProps={{ loading: pending, disabled: !renameValue.trim() }} cancelButtonProps={{ disabled: pending }}><label className=\"axiom-web-app__modal-field\"><span>{t(\"integration.threads.nameLabel\")}</span><input aria-label={t(\"integration.threads.nameLabel\")} value={renameValue} disabled={pending} onChange={(event) => setRenameValue(event.target.value)} /></label></Modal><Modal title={t(\"integration.threads.deleteTitle\")} open={deleteTarget !== null} onCancel={() => { if (!pending) setDeleteTarget(null); }} onOk={() => deleteTarget && void run(() => deleteThread(deleteTarget.id), () => setDeleteTarget(null))} okText={t(\"common.delete\")} cancelText={t(\"common.cancel\")} okButtonProps={{ danger: true, loading: pending }} cancelButtonProps={{ disabled: pending }}><p>{t(\"integration.threads.deleteConfirm\")}</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;A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AAAA,IAAQ,gBAAAA,MAAC,SAAM,OAAO,EAAE,iCAAiC,GAAG,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,QAAQ,EAAE,eAAe,GAAG,YAAY,EAAE,eAAe,GAAG,eAAe,EAAE,QAAQ,MAAM,SAAS,QAAQ,GAAG,mBAAmB,EAAE,UAAU,QAAQ,GAAG,0BAAAA,MAAC,OAAG,YAAE,mCAAmC,GAAE,GAAI;AAAA,KAAQ;AACrtF;","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 { DEFAULT_LOCALE_STORAGE_KEY, readStoredLocale, useT } from \"../../i18n\";\nimport type { LatticeLocale, SdkTFunction } from \"../../i18n\";\nimport { LocaleLayerIfAbsent } from \"../../i18n/LocaleLayerIfAbsent\";\nimport { agentWebAppReducer, initialAgentWebAppState } from \"./state/agentWebAppReducer\";\nimport type {\n AgentWebAppBootstrap,\n AgentWebAppInterrupt,\n AgentWebAppInterruptResponse,\n AgentWebAppRuntimeMessage,\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 * Fetch credentials mode for runtime requests. Defaults to `\"omit\"` (no\n * cookies). Set `\"same-origin\"` when a same-origin proxy/session cookie must\n * accompany runtime calls.\n */\n credentials?: RequestCredentials;\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, t: SdkTFunction): AgentWebAppRuntimeClientError {\n if (error instanceof AgentWebAppRuntimeClientError) return error;\n return new AgentWebAppRuntimeClientError(\"INTERNAL_ERROR\", t(\"integration.error.requestFailed\"), 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\"}\\u0000${props.credentials ?? \"omit\"}`;\n const locale: LatticeLocale = readStoredLocale(DEFAULT_LOCALE_STORAGE_KEY) ?? \"en-US\";\n return (\n <LocaleLayerIfAbsent locale={locale} storageKey={DEFAULT_LOCALE_STORAGE_KEY}>\n <ScopedAgentWebAppProvider key={scopeKey} {...props} />\n </LocaleLayerIfAbsent>\n );\n}\n\nfunction ScopedAgentWebAppProvider({ gatewayUrl, webAppId, identity, children, onError, fetch: fetchImplementation, credentials }: AgentWebAppProviderProps): React.ReactElement {\n const t = useT();\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\", t(\"integration.error.identityTokenFailed\"), true);\n }\n },\n },\n translate: t,\n ...(fetchImplementation ? { fetch: fetchImplementation } : {}),\n ...(credentials ? { credentials } : {}),\n });\n }\n const client = clientRef.current;\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, t);\n dispatch({ type: \"ERROR_SET\", error: normalized });\n return normalized;\n }, [t]);\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 if (bootstrap?.webApp.features.hitl) {\n const assistantId = bootstrap.webApp.assistant.id;\n dispatch({ type: \"INTERRUPTS_LOADING\", loading: true });\n const status = await threadControlled((signal) => client.getThreadStatus(assistantId, thread.id, projectId ? { projectId } : {}, signal));\n if (generation === generationRef.current && threadGeneration === threadGenerationRef.current) {\n dispatch({ type: \"INTERRUPTS_LOADING\", loading: false });\n for (const interrupt of status.interrupts) dispatch({ type: \"INTERRUPT_ADD\", interrupt });\n }\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: \"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\", t(\"integration.error.notReady\"), true));\n if (!bootstrap.webApp.features.projectSelector) throw featureDisabled(t(\"integration.error.projectSelectionDisabled\"));\n if (!bootstrap.projects.some((project) => project.id === projectId)) throw report(new AgentWebAppRuntimeClientError(\"PROJECT_NOT_ALLOWED\", t(\"integration.error.projectNotAllowed\"), 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, t]);\n\n const selectModel = useCallback((modelKey: string): void => {\n const bootstrap = stateRef.current.bootstrap;\n if (!bootstrap) throw report(new AgentWebAppRuntimeClientError(\"INVALID_REQUEST\", t(\"integration.error.notReady\"), true));\n if (!bootstrap.webApp.features.modelSelector) throw featureDisabled(t(\"integration.error.modelSelectionDisabled\"));\n if (!bootstrap.models.some((model) => model.key === modelKey)) throw report(new AgentWebAppRuntimeClientError(\"MODEL_NOT_ALLOWED\", t(\"integration.error.modelNotAllowed\"), false));\n dispatch({ type: \"MODEL_SELECTED\", modelKey });\n }, [report, t]);\n\n const requireThreadManagement = useCallback((): void => {\n if (!stateRef.current.bootstrap?.webApp.features.threadManagement) throw featureDisabled(t(\"integration.error.threadManagementDisabled\"));\n }, [t]);\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\", t(\"integration.error.threadOtherProject\"), 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, t]);\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, t]);\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\", t(\"integration.error.threadNotFound\"), 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, t]);\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\", t(\"integration.error.threadNotFound\"), 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, t]);\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, t(\"integration.error.streamError\")), 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, t]);\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\", t(\"integration.error.alreadyStreaming\"), false);\n if (!current.activeThread || !current.projectId) throw report(new AgentWebAppRuntimeClientError(\"THREAD_NOT_FOUND\", t(\"integration.error.noActiveThread\"), false));\n if (!content.trim()) throw report(new AgentWebAppRuntimeClientError(\"INVALID_REQUEST\", t(\"integration.error.contentRequired\"), 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: async (onEvent, signal) => {\n const bootstrap = stateRef.current.bootstrap;\n const runtimeAssistantId = bootstrap?.webApp.assistant.id;\n if (!runtimeAssistantId) throw new AgentWebAppRuntimeClientError(\"INTERNAL_ERROR\", t(\"integration.error.notReady\"), true);\n const selection = { ...(projectId ? { projectId } : {}), ...(modelKey ? { modelKey } : {}) };\n const result = await client.commandsRunStart(runtimeAssistantId, current.activeThread!.id, {\n input: { message: content, ...(refs.length ? { files: refs } : {}) },\n config: modelKey ? { modelConfig: { modelKey } } : undefined,\n multitask_strategy: \"enqueue\",\n }, selection, signal);\n await client.streamThreadEvents(runtimeAssistantId, current.activeThread!.id, {\n ...selection,\n anchor: result.messageId,\n allowInterrupts: bootstrap?.webApp.features.hitl ?? false,\n allowGenUI: bootstrap?.webApp.features.genUI ?? false,\n }, onEvent, signal);\n },\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, t]);\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\", t(\"integration.error.noFailedMessage\"), false));\n await send(failed.text, failed.attachmentIds);\n }, [report, send, t]);\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(t(\"integration.error.attachmentsDisabled\"));\n if (!current.activeThread) throw report(new AgentWebAppRuntimeClientError(\"THREAD_NOT_FOUND\", t(\"integration.error.noActiveThread\"), 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, t]);\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\", t(\"integration.error.alreadyStreaming\"), false));\n if (!current.bootstrap?.webApp.features.hitl) throw featureDisabled(t(\"integration.error.humanReviewDisabled\"));\n if (!current.activeThread || !current.projectId) throw report(new AgentWebAppRuntimeClientError(\"THREAD_NOT_FOUND\", t(\"integration.error.noActiveThread\"), false));\n if (!current.interrupts.some((item) => item.id === interruptId)) throw report(new AgentWebAppRuntimeClientError(\"INVALID_REQUEST\", t(\"integration.error.interruptNotFound\"), 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: async (onEvent, signal) => {\n const bootstrap = stateRef.current.bootstrap;\n const runtimeAssistantId = bootstrap?.webApp.assistant.id;\n if (!runtimeAssistantId) throw new AgentWebAppRuntimeClientError(\"INTERNAL_ERROR\", t(\"integration.error.notReady\"), true);\n const selection = { ...(projectId ? { projectId } : {}), ...(modelKey ? { modelKey } : {}) };\n const result = await client.commandsRespond(runtimeAssistantId, activeThread.id, {\n interrupt_id: interruptId,\n resume: response !== null && typeof response === \"object\" ? { ...response, message } : { response, message },\n config: modelKey ? { modelConfig: { modelKey } } : undefined,\n }, selection, signal);\n if (result.accepted === false) {\n throw new AgentWebAppRuntimeClientError(\"INVALID_REQUEST\", t(\"integration.error.interruptNotAccepted\"), false);\n }\n await client.streamThreadEvents(runtimeAssistantId, activeThread.id, {\n ...selection,\n anchor: result.messageId,\n allowInterrupts: bootstrap?.webApp.features.hitl ?? false,\n allowGenUI: bootstrap?.webApp.features.genUI ?? false,\n }, onEvent, signal);\n },\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, t]);\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\";\nimport { useT } from \"../../../i18n\";\n\nexport interface WidgetAttachmentsProps { className?: string; attachLabel?: string; }\n\nexport function WidgetAttachments({ className, attachLabel }: WidgetAttachmentsProps): React.ReactElement | null {\n const t = useT();\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 label = attachLabel ?? t(\"integration.attach.files\");\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, t)); }\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={t(\"integration.attach.removeNamed\", { name: attachment.name })} onClick={() => removeAttachment(attachment.ref)}>{t(\"integration.attach.remove\")}</button></span>)}</div>}{error && <p className=\"axiom-web-app__error\" role=\"alert\">{error}</p>}<label className=\"axiom-web-app__attach\"><span>{isLoading || pending ? t(\"integration.attach.uploading\") : label}</span><input ref={inputRef} type=\"file\" multiple aria-label={label} disabled={!activeThread || isLoading || pending} onChange={(event) => void upload(event)} /></label></div>;\n}\n","import { formatErrorMessage } from \"../../../utils/errorMessage\";\nimport type { SdkTFunction } from \"../../../i18n\";\n\nexport function widgetErrorMessage(error: unknown, t: SdkTFunction): string {\n return formatErrorMessage(error, t(\"integration.error.requestFailed\"));\n}\n","import React, { useRef, useState } from \"react\";\nimport { useWidgetChat } from \"../hooks/useWidgetChat\";\nimport { widgetErrorMessage } from \"./widget-utils\";\nimport { useT } from \"../../../i18n\";\n\nexport interface WidgetComposerProps { className?: string; messageLabel?: string; placeholder?: string; sendLabel?: string; abortLabel?: string; leadingSlot?: React.ReactNode; }\n\nexport function WidgetComposer({ className, messageLabel, placeholder, sendLabel, abortLabel, leadingSlot }: WidgetComposerProps): React.ReactElement {\n const t = useT();\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, t)); }\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, t));\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 ?? t(\"integration.composer.message\")}</span><textarea aria-label={messageLabel ?? t(\"integration.composer.message\")} value={text} placeholder={placeholder ?? t(\"integration.composer.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}>{t(\"integration.composer.retryFailed\")}</button>}{isStreaming ? <button type=\"button\" disabled={pending} onClick={() => void run(abort)}>{abortLabel ?? t(\"integration.composer.stop\")}</button> : <button type=\"submit\" disabled={!activeThread || !text.trim() || pending}>{sendLabel ?? t(\"integration.composer.send\")}</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\";\nimport { useT } from \"../../../i18n\";\nimport type { SdkTFunction } from \"../../../i18n\";\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, t: SdkTFunction): string {\n return formatErrorMessage(error, t(\"integration.interrupt.submitFailed\"));\n}\n\nexport function WidgetInterruptView({ interrupt, onSubmit, className, approveLabel, rejectLabel, feedbackLabel, disabled = false }: WidgetInterruptViewProps): React.ReactElement {\n const t = useT();\n const review = useReviewDecision(async (decision, feedback) => {\n const approved = decision === \"approve\";\n await onSubmit(interrupt.id, { approved, ...(feedback ? { feedback } : {}) }, feedback || (approved ? t(\"integration.interrupt.approvedMessage\") : t(\"integration.interrupt.changesRequestedMessage\")));\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={t(\"integration.interrupt.aria\")}>\n <strong>{interrupt.prompt}</strong>\n {interrupt.data && <p className=\"axiom-web-app__interrupt-fallback\">{t(\"integration.interrupt.detailsUnavailable\")}</p>}\n <label className=\"axiom-web-app__feedback\">\n <span>{feedbackLabel ?? t(\"integration.interrupt.feedback\")}</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, t)}</p>}\n <div className=\"axiom-web-app__interrupt-actions\">\n <button type=\"button\" disabled={disabled || review.pending !== null} onClick={() => void submit(false)}>{rejectLabel ?? t(\"integration.interrupt.reject\")}</button>\n <button type=\"button\" disabled={disabled || review.pending !== null} onClick={() => void submit(true)}>{approveLabel ?? t(\"integration.interrupt.approve\")}</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\";\nimport { useT } from \"../../../i18n\";\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 t = useT();\n const safeHref = safeUrl(src);\n const label = alt?.trim() || t(\"integration.markdown.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 }: WidgetMarkdownProps): React.ReactElement {\n const t = useT();\n if (typeof content !== \"string\") return <span className={className}>{unsupportedLabel ?? t(\"integration.markdown.unsupported\")}</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\";\nimport { useT } from \"../../../i18n\";\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 t = useT();\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 ?? t(\"integration.genui.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 ?? t(\"integration.genui.dataTable\")}>\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\";\nimport { useT } from \"../../../i18n\";\nimport type { SdkTFunction } from \"../../../i18n\";\n\nexport interface WidgetMessageListProps { className?: string; listLabel?: string; emptyLabel?: string; toolActivityLabel?: string; emptySlot?: React.ReactNode; }\n\nfunction roleName(message: AgentWebAppRuntimeMessage, t: SdkTFunction): string {\n if (message.role === \"human\") return t(\"integration.messages.roleYou\");\n if (message.role === \"ai\") return t(\"integration.messages.roleAssistant\");\n return message.role;\n}\n\nexport function WidgetMessageList({ className, listLabel, emptyLabel, toolActivityLabel, emptySlot }: WidgetMessageListProps): React.ReactElement {\n const t = useT();\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 ?? t(\"integration.messages.aria\")} aria-live=\"polite\">{!isLoading && messages.length === 0 && (emptySlot || <p className=\"axiom-web-app__empty\">{emptyLabel ?? t(\"integration.messages.empty\")}</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, t)}</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 ?? t(\"integration.messages.activity\")}>{tools.map((tool) => <div className=\"axiom-web-app__tool\" key={tool.id}><span aria-hidden=\"true\">{tool.status === \"running\" ? \"...\" : \"OK\"}</span> {tool.name || t(\"integration.messages.tool\")}</div>)}</section>}</div>;\n}\n","import React, { useState } from \"react\";\nimport { useWidgetProject } from \"../hooks/useWidgetProject\";\nimport { widgetErrorMessage } from \"./widget-utils\";\nimport { useT } from \"../../../i18n\";\n\nexport interface WidgetModelSelectorProps { className?: string; label?: string; }\n\nexport function WidgetModelSelector({ className, label }: WidgetModelSelectorProps): React.ReactElement | null {\n const t = useT();\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 fieldLabel = label ?? t(\"integration.model.label\");\n const select = (key: string): void => {\n setError(null);\n try { selectModel(key); } catch (selectionError) { setError(widgetErrorMessage(selectionError, t)); }\n };\n return <div className={className}><label className=\"axiom-web-app__field\"><span>{fieldLabel}</span><select aria-label={fieldLabel} 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\";\nimport { useT } from \"../../../i18n\";\n\nexport interface WidgetProjectSelectorProps { className?: string; label?: string; }\n\nexport function WidgetProjectSelector({ className, label }: WidgetProjectSelectorProps): React.ReactElement | null {\n const t = useT();\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 fieldLabel = label ?? t(\"integration.project.label\");\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, t)); }\n finally { pendingRef.current = false; setPending(false); }\n };\n return <div className={className}><label className=\"axiom-web-app__field\"><span>{fieldLabel}</span><select aria-label={fieldLabel} 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\";\nimport { useT } from \"../../../i18n\";\nimport type { SdkTFunction } from \"../../../i18n\";\n\nexport interface WidgetThreadListProps { className?: string; navigationLabel?: string; newThreadLabel?: string; emptyLabel?: string; }\nfunction threadName(thread: AgentWebAppRuntimeThread, index: number, t: SdkTFunction): string { return thread.label?.trim() || t(\"integration.threads.defaultName\", { index: index + 1 }); }\n\nexport function WidgetThreadList({ className, navigationLabel, newThreadLabel, emptyLabel }: WidgetThreadListProps): React.ReactElement | null {\n const t = useT();\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, t)); }\n finally { pendingRef.current = false; setPending(false); }\n };\n return <nav className={`axiom-web-app__sidebar${className ? ` ${className}` : \"\"}`} aria-label={navigationLabel ?? t(\"integration.threads.aria\")}>{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 ?? t(\"integration.threads.new\")}</button><div className=\"axiom-web-app__thread-list\">{!isLoading && threads.length === 0 && <p className=\"axiom-web-app__empty\">{emptyLabel ?? t(\"integration.threads.empty\")}</p>}{threads.map((thread, index) => { const name = threadName(thread, index, t); 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={t(\"integration.threads.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={t(\"integration.threads.renameNamed\", { name })} onClick={() => { setRenameTarget(thread); setRenameValue(name); }}>{t(\"integration.threads.rename\")}</button><button type=\"button\" disabled={pending} className=\"axiom-web-app__thread-delete\" aria-label={t(\"integration.threads.deleteNamed\", { name })} onClick={() => setDeleteTarget(thread)}>{t(\"integration.threads.delete\")}</button></div>; })}</div><Modal title={t(\"integration.threads.renameTitle\")} open={renameTarget !== null} onCancel={() => { if (!pending) setRenameTarget(null); }} onOk={() => renameTarget && void run(() => renameThread(renameTarget.id, renameValue.trim()), () => setRenameTarget(null))} okText={t(\"common.save\")} cancelText={t(\"common.cancel\")} okButtonProps={{ loading: pending, disabled: !renameValue.trim() }} cancelButtonProps={{ disabled: pending }}><label className=\"axiom-web-app__modal-field\"><span>{t(\"integration.threads.nameLabel\")}</span><input aria-label={t(\"integration.threads.nameLabel\")} value={renameValue} disabled={pending} onChange={(event) => setRenameValue(event.target.value)} /></label></Modal><Modal title={t(\"integration.threads.deleteTitle\")} open={deleteTarget !== null} onCancel={() => { if (!pending) setDeleteTarget(null); }} onOk={() => deleteTarget && void run(() => deleteThread(deleteTarget.id), () => setDeleteTarget(null))} okText={t(\"common.delete\")} cancelText={t(\"common.cancel\")} okButtonProps={{ danger: true, loading: pending }} cancelButtonProps={{ disabled: pending }}><p>{t(\"integration.threads.deleteConfirm\")}</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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eAAe,GAAG,eAAe,EAAE,QAAQ,MAAM,SAAS,QAAQ,GAAG,mBAAmB,EAAE,UAAU,QAAQ,GAAG,0BAAAA,MAAC,OAAG,YAAE,mCAAmC,GAAE,GAAI;AAAA,KAAQ;AACrtF;","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"]}
|