1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4061],{10081:(e,t,s)=>{s.d(t,{C8:()=>i,OW:()=>d,P3:()=>o,YJ:()=>l,aW:()=>c,oO:()=>u,r7:()=>a,w9:()=>h});let r=new Map,n="sap-auth-context-runtime-updated";function i(e){return(e??"").trim().toUpperCase()}function o(e,t){return`${e}::${i(t)}`}function a(e){let[t,s=""]=e.split("::",2);return{systemId:t,sapUsername:s}}function l(e){r.set(o(e.system_id,e.sap_username),e),window.dispatchEvent(new Event(n))}function d(e,t){return r.get(o(e,t))??null}function h(e,t){return r.has(o(e,t))}function c(e){for(let t of r.values())if(t.system_id===e&&"inline"===t.auth_mode&&"string"==typeof t.sap_password&&t.sap_password.length>0)return!0;return!1}function u(e){return window.addEventListener(n,e),()=>{window.removeEventListener(n,e)}}},29875:(e,t,s)=>{s.d(t,{cn:()=>i});var r=s(1982);let n=(0,s(74924).zu)({extend:{classGroups:{mb:["mb-design-tiny","mb-design-xsm","mb-design-sm","mb-design-default","mb-design-md","mb-design-lg","mb-design-xlg"],mt:["mt-design-tiny","mt-design-xsm","mt-design-sm","mt-design-default","mt-design-md","mt-design-lg","mt-design-xlg"],"font-size":["design-display-1","design-display-2","design-display-3","design-display-4","design-display-5","design-display-6","design-display-7","design-display-8","design-display-9","design-display-10","design-display-mbl-1","design-display-mbl-2","design-display-mbl-3","design-display-mbl-4","design-display-mbl-5","design-display-mbl-6","design-display-mbl-7","design-display-mbl-8","design-display-mbl-9","design-display-mbl-10","design-display-mbp-1","design-display-mbp-2","design-display-mbp-3","design-display-mbp-4","design-display-mbp-5","design-display-mbp-6","design-display-mbp-7","design-display-mbp-8","design-display-mbp-9","design-display-mbp-10","design-display-tablet-1","design-display-tablet-2","design-display-tablet-3","design-display-tablet-4","design-display-tablet-5","design-display-tablet-6","design-display-tablet-7","design-display-tablet-8","design-display-tablet-9","design-display-tablet-10"]}}});function i(...e){return n((0,r.$)(e))}},35226:(e,t,s)=>{s.d(t,{c4:()=>n,wR:()=>i});var r=s(81287);function n(){return r.A.get("session_jwt")||null}function i(){let e=n();return null!==e&&e.length>0}},37993:(e,t,s)=>{function r(e,t){if(void 0===e)return null;if(0===e)return"network";if(401===e)return"unauthorized";if(402===e)return"payment_required";if(403===e)return"permission_denied";if(404===e)return"not_found";if(400===e||422===e)return"bad_request";if(408===e)return"timeout";if(429===e)return t&&"object"==typeof t&&("string"==typeof t.error&&("token_limit_reached"===t.error||t.error.endsWith("_token_limit_reached"))||"token_limit"in t)?"token_limit_reached":"rate_limited";return e>=500?"server_error":null}function n(e){return e&&"object"==typeof e?"string"==typeof e.reason&&e.reason?e.reason:r("number"==typeof e.statusCode?e.statusCode:"number"==typeof e.status?e.status:void 0,e.details??e.detail):null}s.d(t,{S:()=>n,U:()=>r})},47245:(e,t,s)=>{s.d(t,{E:()=>l});var r=s(81454);s(98238);var n=s(72359),i=s(1392),o=s(29875);let a=(0,i.F)("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function l({className:e,variant:t,asChild:s=!1,...i}){let l=s?n.DX:"span";return(0,r.jsx)(l,{"data-slot":"badge",className:(0,o.cn)(a({variant:t}),e),...i})}},48217:(e,t,s)=>{s.d(t,{d:()=>i,l:()=>n});var r=s(63310);function n(){return(0,r.A)()}function i(e,t=50){let s=e.replace(/<\/(p|div|h[1-6]|li|blockquote)>/gi," ").replace(/<br\s*\/?>/gi," ").replace(/<[^>]*>/g,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;|'/g,"'").replace(/\s+/g," ").trim();return s.length>t?s.slice(0,t)+"...":s}
1},58490:(e,t,s)=>{s.d(t,{a:()=>a});var r=s(71129),n=s(48217),i=s(88733),o=s(37993);class a{constructor(e,t){this.endpoints=e,this.tokenInput=t}get token(){return"function"==typeof this.tokenInput?this.tokenInput():this.tokenInput}async createConversation(e,t,s){let i=(0,r.yS)(this.endpoints,void 0,this.token),o={initial_state:t,display_name:s||(0,n.d)(e)};try{return await i.createConversation(o)}catch(e){throw console.error("Failed to create conversation:",e),this.handleError(e)}}async sendMessage(e,t,s,o,a,l,d){let h=(0,r.yS)(this.endpoints,void 0,this.token),c=d?.localMcpServers,u=c?(0,i.cX)(c):void 0,p=d?.executeExternalTools,y={query_id:(0,n.l)(),text:t,files:a??[],state_update:l,output_kind:d?.outputKind,output_schema:d?.outputSchema,local_mcp_tools:u,local_mcp_servers:c,exclude_builtin_tools:d?.excludeBuiltinTools};try{p&&u&&u.length>0?await this.runWithCallerTools(h,e,y,s,p,u,o):await h.sendMessage(e,y,s,o)}catch(e){throw console.error("Failed to send message:",e),this.handleError(e)}}async runWithCallerTools(e,t,s,r,n,o,a){if(!e.submitToolResults)throw new i.hD("This agent does not support local MCP tools (no tool-results endpoint).");let l={value:null},d={...r,onExternalToolCalls:e=>{l.value=e,r.onExternalToolCalls?.(e)}},h={...d,onStreamStart:void 0};for(await e.sendMessage(t,s,d,a);l.value;){if(a?.aborted)throw new DOMException("Aborted","AbortError");let r=l.value;l.value=null;let i=await n(r.calls),d={query_id:r.query_id,tool_results:i,local_mcp_tools:o,local_mcp_servers:s.local_mcp_servers,output_kind:s.output_kind,output_schema:s.output_schema,exclude_builtin_tools:s.exclude_builtin_tools};try{await e.submitToolResults(t,d,h,a)}catch(s){let e=s?.status,t=s?.detail;if(409===e&&t?.error==="tool_already_resolved")return;throw s}}}async interruptConversation(e,t){let s=(0,r.yS)(this.endpoints,void 0,this.token),n=this.endpoints.authenticated.interruptConversation;if(!s.forwardRequest||!n)return null;let i=n.replace("{id}",encodeURIComponent(e))+(t?.force?"?force=true":"");return await s.forwardRequest("POST",i)}async interruptCallerTools(e){let t=(0,r.yS)(this.endpoints,void 0,this.token),s=this.endpoints.authenticated.interruptCallerTools;if(!t.forwardRequest||!s)return[];let n=s.replace("{id}",encodeURIComponent(e)),i=await t.forwardRequest("POST",n);return i?.interrupted_tool_use_ids??[]}async getConversation(e){let t=(0,r.yS)(this.endpoints,void 0,this.token);try{return await t.getConversation(e)}catch(e){throw console.error("Failed to get conversation:",e),this.handleError(e)}}async getConversationHistory(e,t){let s=(0,r.yS)(this.endpoints,void 0,this.token);try{return await s.getConversationHistory(e,t)}catch(e){throw console.error("Failed to get conversation history:",e),this.handleError(e)}}async getMessagesAfter(e,t){let s=(0,r.yS)(this.endpoints,void 0,this.token);try{return await s.getMessagesAfter(e,t)}catch(e){throw console.error("Failed to get messages after reference:",e),this.handleError(e)}}async getTokenLimitStatus(e){let t=(0,r.yS)(this.endpoints,void 0,this.token);try{return await t.getTokenLimitStatus(e)}catch(e){throw console.error("Failed to get token limit status:",e),this.handleError(e)}}async listConversations(e){let t=(0,r.yS)(this.endpoints,void 0,this.token);try{return await t.listConversations(e)}catch(e){throw console.error("Failed to list conversations:",e),this.handleError(e)}}async updateDisplayName(e,t){let s=(0,r.yS)(this.endpoints,void 0,this.token);try{return await s.updateDisplayName(e,t)}catch(e){throw console.error("Failed to update conversation display name:",e),this.handleError(e)}}async generateName(e,t){let s=(0,r.yS)(this.endpoints,void 0,this.token);try{return await s.generateName(e,t)}catch(e){throw console.error("Failed to generate conversation name:",e),this.handleError(e)}}async deleteConversation(e){let t=(0,r.yS)(this.endpoints,void 0,this.token);if(!t.deleteConversation)throw new i.hD("This agent does not support deleting conversations.");try{return await t.deleteConversation(e)}catch(e){throw console.error("Failed to delete conversation:",e),this.handleError(e)}}async getAvailableSystems(){let e=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof e.getAvailableSystems)throw new i.hD("Remote dev systems are not configured for this agent");try{return await e.getAvailableSystems()}catch(e){throw console.error("Failed to fetch available systems:",e),this.handleError(e)}}async openSession(e,t,s){let n=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof n.openSession)throw new i.hD("Remote dev systems are not configured for this agent");try{let r=await n.openSession(e,t,s);return(0,i.R$)(r)}catch(e){throw console.error("Failed to open session:",e),this.handleError(e)}}async addSessionToConversation(e,t){let s=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof s.addSessionToConversation)throw new i.hD("Remote dev systems are not configured for this agent");try{return await s.addSessionToConversation(e,t)}catch(e){throw console.error("Failed to add session to conversation:",e),this.handleError(e)}}async sessionHeartbeat(e){let t=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof t.sessionHeartbeat)throw new i.hD("Remote dev systems are not configured for this agent");try{return await t.sessionHeartbeat(e)}catch(e){throw console.error("Failed to send session heartbeat:",e),this.handleError(e)}}async maybeRefreshSessions(e){let t=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof t.maybeRefreshSessions)throw new i.hD("Remote dev systems are not configured for this agent");try{return await t.maybeRefreshSessions(e)}catch(e){throw console.error("Failed to refresh sessions:",e),this.handleError(e)}}async closeSession(e,t){let s=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof s.closeSession)throw new i.hD("Remote dev systems are not configured for this agent");try{return await s.closeSession(e,t)}catch(e){throw console.error("Failed to close session:",e),this.handleError(e)}}async downloadFile(e,t){let s=(0,r.yS)(this.endpoints,void 0,this.token);try{if(t.includes("/download-file"))return await s.downloadDirectUrl(t);let r=encodeURIComponent(t);return await s.downloadFile(e,r)}catch(e){throw console.error("Failed to download file:",e),this.handleError(e)}}async listSapSystems(){let e=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof e.listSapSystems)throw new i.hD("SAP systems management is not configured for this agent");try{let t=await e.listSapSystems();return Array.isArray(t.data)?t.data:[]}catch(e){throw console.error("Failed to list SAP systems:",e),this.handleError(e)}}async createSapSystem(e){let t=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof t.createSapSystem)throw new i.hD("SAP systems management is not configured for this agent");try{return await t.createSapSystem(e)}catch(e){throw console.error("Failed to create SAP system:",e),this.handleError(e)}}async setEnablerSicfBaseUrl(e,t){let s=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof s.setEnablerSicfBaseUrl)throw new i.hD("SAP systems management is not configured for this agent");try{return await s.setEnablerSicfBaseUrl(e,t)}catch(e){throw console.error("Failed to set enabler base URL:",e),this.handleError(e)}}async deleteSapSystem(e){let t=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof t.deleteSapSystem)throw new i.hD("SAP systems management is not configured for this agent");try{await t.deleteSapSystem(e)}catch(e){throw console.error("Failed to delete SAP system:",e),this.handleError(e)}}async testSapConnection(e){let t=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof t.testSapConnection)throw new i.hD("SAP systems management is not configured for this agent");try{await t.testSapConnection(e)}catch(e){throw console.error("Failed to test SAP connection:",e),this.handleError(e)}}async checkEccBootstrapStatus(e,t){let s=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof s.checkEccBootstrapStatus)throw new i.hD("ECC bootstrap status is not configured for this agent");try{return await s.checkEccBootstrapStatus(e,t)}catch(e){throw console.error("Failed to check ECC bootstrap status:",e),this.handleError(e)}}async installEccRuntime(e,t){let s=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof s.installEccRuntime)throw new i.hD("ECC install is not configured for this agent");try{return await s.installEccRuntime(e,t)}catch(e){throw console.error("Failed to schedule ECC install:",e),this.handleError(e)}}async getEccInstallStatus(e){let t=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof t.getEccInstallStatus)throw new i.hD("ECC install status is not configured for this agent");try{return await t.getEccInstallStatus(e)}catch(e){throw console.error("Failed to get ECC install status:",e),this.handleError(e)}}async downloadEccBootstrapBundle(){let e=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof e.downloadEccBootstrapBundle)throw new i.hD("ECC bootstrap bundle is not configured for this agent");try{return await e.downloadEccBootstrapBundle()}catch(e){throw console.error("Failed to download ECC bootstrap bundle:",e),this.handleError(e)}}
1async createAndTestSapSystem(e,t,s){let r=await this.createSapSystem(e);try{await this.testSapConnection({system_id:r.system_id,sap_username:t,sap_auth_context:s})}catch(s){let e=null;try{await this.deleteSapSystem(r.system_id)}catch(t){console.error("Failed to rollback system after test failure",t),e=t instanceof Error?t.message:"Rollback failed"}let t=s instanceof Error?s.message:"Connection test failed";if(e)throw new i.hD(`${t}. We could not auto-remove this connection: ${e}.`);throw new i.hD(`${t}. Connection was not saved.`)}return r}async eccTreeExpand(e,t){let s=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof s.eccTreeExpand)throw new i.hD("ECC tree is not configured for this agent");try{return await s.eccTreeExpand(e,t)}catch(e){throw console.error("Failed to expand ECC tree node:",e),this.handleError(e)}}async eccTreeFacets(e,t){let s=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof s.eccTreeFacets)throw new i.hD("ECC tree is not configured for this agent");try{return await s.eccTreeFacets(e,t)}catch(e){throw console.error("Failed to fetch ECC tree facets:",e),this.handleError(e)}}async eccTreeNodeStructure(e,t){let s=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof s.eccTreeNodeStructure)throw new i.hD("ECC tree is not configured for this agent");try{return await s.eccTreeNodeStructure(e,t)}catch(e){throw console.error("Failed to fetch ECC tree node structure:",e),this.handleError(e)}}async eccAdtSearch(e,t){let s=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof s.eccAdtSearch)throw new i.hD("ECC adtsearch is not configured for this agent");try{return await s.eccAdtSearch(e,t)}catch(e){throw console.error("Failed to ECC adtsearch:",e),this.handleError(e)}}async eccSourceRead(e,t){let s=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof s.eccSourceRead)throw new i.hD("ECC source-read is not configured for this agent");try{return await s.eccSourceRead(e,t)}catch(e){throw console.error("Failed to ECC source-read:",e),this.handleError(e)}}async listFavorites(e){let t=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof t.listFavorites)throw new i.hD("Favorites are not configured for this agent");try{return await t.listFavorites(e)}catch(e){throw console.error("Failed to list favorites:",e),this.handleError(e)}}async addFavorite(e,t){let s=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof s.addFavorite)throw new i.hD("Favorites are not configured for this agent");try{return await s.addFavorite(e,t)}catch(e){throw console.error("Failed to add favorite:",e),this.handleError(e)}}async updateFavorite(e,t,s){let n=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof n.updateFavorite)throw new i.hD("Favorites are not configured for this agent");try{return await n.updateFavorite(e,t,s)}catch(e){throw console.error("Failed to update favorite:",e),this.handleError(e)}}async deleteFavorite(e,t){let s=(0,r.yS)(this.endpoints,!0,this.token);if("function"!=typeof s.deleteFavorite)throw new i.hD("Favorites are not configured for this agent");try{await s.deleteFavorite(e,t)}catch(e){throw console.error("Failed to delete favorite:",e),this.handleError(e)}}handleError(e){if(e instanceof Error&&"AbortError"===e.name||e instanceof i.hD)return e;if(e instanceof Error){let t=new i.hD(e.message,"number"==typeof e.status?e.status:void 0,void 0,e.detail);return t.reason=(0,o.S)(e)??void 0,t}return new i.hD("An unknown error occurred")}}},71129:(e,t,s)=>{s.d(t,{yS:()=>d});var r=s(88733),n=s(37993);class i{constructor(e,t={}){this.baseUrl=e,this.timeout=t.timeout||3e4,this.retryAttempts=t.retryAttempts||3,this.retryDelay=t.retryDelay||1e3}getHeaders(){return{"Content-Type":"application/json"}}buildUrl(e,t){if(!this.baseUrl)throw Error("baseUrl is not set. Check NEXT_PUBLIC_BE_URL environment variable.");let s=new URL(e,this.baseUrl);return t&&Object.entries(t).forEach(([e,t])=>{s.searchParams.append(e,t)}),s.toString()}async request(e,t={}){let{method:s="GET",headers:n={},body:i,signal:o,timeout:a}=t,l={...this.getHeaders(),...n},d=a??this.timeout,h=null;for(let t=0;t<=this.retryAttempts;t++)try{let t=new AbortController,r=setTimeout(()=>t.abort(),d),n=o?this.combineAbortSignals([o,t.signal]):t.signal,a=await fetch(e,{method:s,headers:l,body:i?JSON.stringify(i):void 0,signal:n});
1if(clearTimeout(r),!a.ok)throw await this.handleErrorResponse(a);return await a.json()}catch(e){if(h=e,e instanceof r.hD&&e.statusCode&&e.statusCode>=400&&e.statusCode<500||e instanceof Error&&"AbortError"===e.name)throw e;t<this.retryAttempts&&await this.delay(this.retryDelay*Math.pow(2,t))}throw h||new r.Dr("Request failed after retries")}async requestSSE(e,t){let{body:s,headers:i={},callbacks:o,signal:a}=t,l={...this.getHeaders(),...i,Accept:"text/event-stream"};try{let t=new AbortController,n=a?this.combineAbortSignals([a,t.signal]):t.signal,i=await fetch(e,{method:"POST",headers:l,body:s?JSON.stringify(s):void 0,signal:n});if(!i.ok)throw await this.handleErrorResponse(i);if(!i.body)throw new r.hD("Response body is empty");await this.processSSEStream(i.body,o)}catch(t){if(t instanceof Error&&"AbortError"===t.name)return void o.onStreamEnd?.({reason:"aborted"});let e=t instanceof r.hD?t:new r.hD("Something went wrong. Please try again later. If it's urgent, please contact us at [email protected]",void 0,void 0,t);throw e.reason||t instanceof r.hD||(e.reason=(0,n.S)(t)??"network"),t.__onErrorReported||o.onError?.({error:e.code||"SSE_ERROR",message:e.message,reason:e.reason??null}),e}}async processSSEStream(e,t){let s=e.getReader(),r=new TextDecoder,n="",i="";try{for(;;){let{done:e,value:o}=await s.read();if(e){t.onStreamEnd?.({reason:"completed"});break}let a=(n+=r.decode(o,{stream:!0})).split("\n");for(let e of(n=a.pop()||"",a)){let s=e.trim();if(s){if(s.startsWith("event: "))i=s.slice(7);else if(s.startsWith("data: "))try{let e=s.slice(6),r=JSON.parse(e),n={event:i||"message",data:r};this.handleSSEEvent(n,t),i=""}catch(e){console.error("Failed to parse SSE data:",e,s)}else if(s.startsWith("id: "))continue}}}}catch(e){throw e instanceof Error&&"AbortError"!==e.name&&(t.onError?.({error:"STREAM_ERROR",message:e.message,reason:"network"}),e.__onErrorReported=!0),e}finally{s.releaseLock()}}handleSSEEvent(e,t){switch(e.event){case"stream_start":t.onStreamStart?.(e.data);break;case"user_message_saved":t.onUserMessageSaved?.(e.data);break;case"ai_message":t.onAIMessage?.(e.data);break;case"turn_finished":t.onTurnFinished?.(e.data);break;case"stream_end":t.onStreamEnd?.(e.data);break;case"error":t.onError?.(e.data);break;case"conversation_summary":t.onConversationSummary?.(e.data);break;case"tool_status":t.onToolStatus?.(e.data);break;case"conversation_state":t.onConversationState?.(e.data);break;case"parallel_tool_calls_start":t.onParallelToolCallsStart?.(e.data);break;case"parallel_tool_call_complete":t.onParallelToolCallComplete?.(e.data);break;case"external_tool_calls":t.onExternalToolCalls?.(e.data);break;case"turn_paused":t.onTurnPaused?.(e.data);break;case"message_steered":t.onMessageSteered?.(e.data)}}async handleErrorResponse(e){let t={};try{t=await e.json()}catch{t={message:e.statusText}}let s="object"==typeof t.detail&&null!==t.detail?t.detail:void 0,i=s&&"message"in s?String(s.message):"string"==typeof t.detail?t.detail:void 0,o=(0,n.U)(e.status,s);if(429===e.status){let e=t.message||i||"Token limit reached",n=new r.B2(e,s);return o&&(n.reason=o),n}if(402===e.status){let e=t.message||i||"Payment required";return new r.yP(e,s)}let a=t.message||t.error||i||`HTTP ${e.status} error`,l=new r.hD(a,e.status,`HTTP_${e.status}`,s);return o&&(l.reason=o),l}combineAbortSignals(e){let t=new AbortController;for(let s of e){if(s.aborted){t.abort();break}s.addEventListener("abort",()=>t.abort())}return t.signal}delay(e){return new Promise(t=>setTimeout(t,e))}replacePathParams(e,t){let s=e;return Object.entries(t).forEach(([e,t])=>{s=s.replace(`{${e}}`,encodeURIComponent(t))}),s}}class o extends i{constructor(e){super(e.baseUrl),this.endpoints=e}async createConversation(e){let t=this.buildUrl(this.endpoints.conversations);return await this.request(t,{method:"POST",body:e})}async sendMessage(e,t,s,r){let n=this.replacePathParams(this.endpoints.message,{id:e}),i=this.buildUrl(n);await this.requestSSE(i,{body:t,callbacks:s,signal:r})}async getConversation(e){let t=this.replacePathParams(this.endpoints.getConversation,{id:e}),s=this.buildUrl(t);return await this.request(s,{method:"GET"})}async getConversationHistory(e,t){let s=this.replacePathParams(this.endpoints.history,{id:e}),r={page_number:t.pageNumber.toString(),page_size:t.pageSize.toString()};t.reference_message_id&&(r.reference_message_id=t.reference_message_id);let n=this.buildUrl(s,r);return await this.request(n,{method:"GET",signal:t.signal})}
1async getMessagesAfter(e,t){let s=this.replacePathParams(this.endpoints.messagesAfter,{id:e}),r={reference_message_id:t.reference_message_id},n=this.buildUrl(s,r);return await this.request(n,{method:"GET",signal:t.signal})}async getTokenLimitStatus(e){let t=this.replacePathParams(this.endpoints.tokenLimitStatus,{id:e}),s=this.buildUrl(t);return await this.request(s,{method:"GET"})}async listConversations(e){throw new r.v3("Listing conversations requires authentication")}async updateDisplayName(e,t){throw new r.v3("Updating conversation display name requires authentication")}async generateName(e,t){throw new r.v3("Generating conversation name requires authentication")}async downloadFile(e,t){let s=this.replacePathParams(this.endpoints.downloadFile,{id:e}),r=this.buildUrl(`${s}?url=${t}`),n=await fetch(r,{method:"GET"});if(!n.ok)throw Error(`Download failed: ${n.status} ${n.statusText}`);return await n.blob()}async downloadDirectUrl(e){let t=await fetch(e,{method:"GET"});if(!t.ok)throw Error(`Download failed: ${t.status} ${t.statusText}`);return await t.blob()}async getCommandList(){let e=this.buildUrl(this.endpoints.commandList);return await this.request(e,{method:"GET"})}async getFileSystemTree(e){let t=this.replacePathParams(this.endpoints.fileSystemTree,{scope_id:e.scope_id}),s={};e.workflow_name&&(s.workflow_name=e.workflow_name);let r=this.buildUrl(t,s);return await this.request(r,{method:"GET"})}async getFileContent(e){let t=this.replacePathParams(this.endpoints.fileSystemFile,{scope_id:e.scope_id,encoded_path:e.file_path}),s={};e.workflow_name&&(s.workflow_name=e.workflow_name);let r=this.buildUrl(t,s);return await this.request(r,{method:"GET"})}async executeChromaSQL(e){let t={};e.system&&(t.sys=e.system),e.collection_name&&(t.collection=e.collection_name);let s=this.buildUrl(this.endpoints.chromaSQLExecute,t);return await this.request(s,{method:"POST",body:e.request})}async fetchChromaSQLIndices(e){let t={};e.system&&(t.sys=e.system),e.collection_name&&(t.collection=e.collection_name);let s=this.buildUrl(this.endpoints.chromaSQLIndices,t),r=await this.request(s,{method:"GET"});return Array.isArray(r)?r:r?[r]:[]}async getInstalledComponents(e){let t=this.replacePathParams(this.endpoints.installedComponents,{agent_version:e.agent_version}),s=this.buildUrl(t),r=await fetch(s,{method:"GET"});if(!r.ok)throw Error(`Failed to fetch installed components: ${r.status} ${r.statusText}`);return await r.text()}async getUxAnnotations(e){let t="uxAnnotations"in this.endpoints&&"string"==typeof this.endpoints.uxAnnotations?this.endpoints.uxAnnotations:null;if(!t)throw Error("UX annotations endpoint not configured for this agent");let s=this.replacePathParams(t,{system_id:e}),r=this.buildUrl(s);return await this.request(r,{method:"GET"})}}class a extends i{constructor(e,t){if(super(e.baseUrl),this.endpoints=e,this.authToken=t,!t)throw new r.v3("Auth token is required for authenticated strategy")}getHeaders(){return{...super.getHeaders(),Authorization:`Bearer ${this.authToken}`}}async createConversation(e){let t=this.buildUrl(this.endpoints.conversations);return await this.request(t,{method:"POST",body:e})}async sendMessage(e,t,s,r){let n=this.replacePathParams(this.endpoints.message,{id:e}),i=this.buildUrl(n);await this.requestSSE(i,{body:t,callbacks:s,signal:r})}async submitToolResults(e,t,s,r){let n=this.endpoints.toolResults;if(!n)throw Error("submitToolResults: no `toolResults` endpoint configured for this agent");let i=this.replacePathParams(n,{id:e}),o=this.buildUrl(i);await this.requestSSE(o,{body:t,callbacks:s,signal:r})}async getConversation(e){let t=this.replacePathParams(this.endpoints.getConversation,{id:e}),s=this.buildUrl(t);return await this.request(s,{method:"GET"})}async getConversationHistory(e,t){let s=this.replacePathParams(this.endpoints.history,{id:e}),r={page_number:t.pageNumber.toString(),page_size:t.pageSize.toString()};t.reference_message_id&&(r.reference_message_id=t.reference_message_id);let n=this.buildUrl(s,r);return await this.request(n,{method:"GET",signal:t.signal})}async getMessagesAfter(e,t){let s=this.replacePathParams(this.endpoints.messagesAfter,{id:e}),r={reference_message_id:t.reference_message_id},n=this.buildUrl(s,r);return await this.request(n,{method:"GET",signal:t.signal})}async getTokenLimitStatus(e){let t=this.replacePathParams(this.endpoints.tokenLimitStatus,{id:e}),s=this.buildUrl(t);return await this.request(s,{method:"GET"})}async listConversations(e){let t=this.buildUrl(this.endpoints.conversations,{page_size:e.pageSize.toString(),page_number:e.pageNumber.toString()});return await this.request(t,{method:"GET",signal:e.signal})}async updateDisplayName(e,t){let s=this.replacePathParams(this.endpoints.updateDisplayName,{id:e}),r=this.buildUrl(s);return await this.request(r,{method:"PUT",body:t})}async generateName(e,t){let s=this.replacePathParams(this.endpoints.generateName,{id:e}),r=this.buildUrl(s);return await this.request(r,{method:"POST",body:t})}async deleteConversation(e){if(!this.endpoints.deleteConversation)throw new r.hD("This agent does not support deleting conversations.");let t=this.replacePathParams(this.endpoints.deleteConversation,{id:e}),s=this.buildUrl(t);return await this.request(s,{method:"DELETE"})}async downloadFile(e,t){let s=this.replacePathParams(this.endpoints.downloadFile,{id:e}),r=this.buildUrl(`${s}?url=${t}`),n=await fetch(r,{method:"GET",headers:this.getHeaders()});if(!n.ok)throw Error(`Download failed: ${n.status} ${n.statusText}`);return await n.blob()}async downloadDirectUrl(e){let t=await fetch(e,{method:"GET",headers:this.getHeaders()});if(!t.ok)throw Error(`Download failed: ${t.status} ${t.statusText}`);return await t.blob()}updateAuthToken(e){if(!e)throw new r.v3("Auth token cannot be empty");this.authToken=e}async getCommandList(){let e=this.buildUrl(this.endpoints.commandList);return await this.request(e,{method:"GET"})}async getFileSystemTree(e){let t=this.replacePathParams(this.endpoints.fileSystemTree,{scope_id:e.scope_id}),s={};e.workflow_name&&(s.workflow_name=e.workflow_name);let r=this.buildUrl(t,s);return await this.request(r,{method:"GET"})}async getFileContent(e){let t=this.replacePathParams(this.endpoints.fileSystemFile,{scope_id:e.scope_id,encoded_path:e.file_path}),s={};e.workflow_name&&(s.workflow_name=e.workflow_name);let r=this.buildUrl(t,s);return await this.request(r,{method:"GET"})}async executeChromaSQL(e){let t={};
1e.system&&(t.sys=e.system),e.collection_name&&(t.collection=e.collection_name);let s=this.buildUrl(this.endpoints.chromaSQLExecute,t);return await this.request(s,{method:"POST",body:e.request})}async fetchChromaSQLIndices(e){let t={};e.system&&(t.sys=e.system),e.collection_name&&(t.collection=e.collection_name);let s=this.buildUrl(this.endpoints.chromaSQLIndices,t),r=await this.request(s,{method:"GET"});return Array.isArray(r)?r:r?[r]:[]}async getInstalledComponents(e){let t=this.replacePathParams(this.endpoints.installedComponents,{agent_version:e.agent_version}),s=this.buildUrl(t),r=await fetch(s,{method:"GET",headers:this.getHeaders()});if(!r.ok)throw Error(`Failed to fetch installed components: ${r.status} ${r.statusText}`);return await r.text()}async getAvailableSystems(){let e="availableSystems"in this.endpoints&&"string"==typeof this.endpoints.availableSystems?this.endpoints.availableSystems:null;if(!e)throw Error("Available systems endpoint not configured for this agent");let t=this.buildUrl(e);return await this.request(t,{method:"GET"})}async openSession(e,t,s){let r="openSession"in this.endpoints&&"string"==typeof this.endpoints.openSession?this.endpoints.openSession:null;if(!r)throw Error("Open session endpoint not configured for this agent");let n=this.buildUrl(r),i={system_id:e};return t&&(i.sap_username=t),s&&(i.sap_auth_context=s),await this.request(n,{method:"POST",body:i,headers:s?{"X-SAP-Auth-Context":JSON.stringify(s)}:void 0,timeout:7e4})}async addSessionToConversation(e,t){let s="addSessionToConversation"in this.endpoints&&"string"==typeof this.endpoints.addSessionToConversation?this.endpoints.addSessionToConversation:null;if(!s)throw Error("Add session to conversation endpoint not configured for this agent");let r=this.replacePathParams(s,{id:e}),n=this.buildUrl(r);return await this.request(n,{method:"POST",body:{session_id:t}})}async sessionHeartbeat(e){let t="sessionHeartbeat"in this.endpoints&&"string"==typeof this.endpoints.sessionHeartbeat?this.endpoints.sessionHeartbeat:null;if(!t)throw Error("Session heartbeat endpoint not configured for this agent");let s=this.replacePathParams(t,{session_id:e}),r=this.buildUrl(s);return await this.request(r,{method:"POST",timeout:7e4})}async maybeRefreshSessions(e){let t="maybeRefreshSessions"in this.endpoints&&"string"==typeof this.endpoints.maybeRefreshSessions?this.endpoints.maybeRefreshSessions:null;if(!t)throw Error("Maybe refresh sessions endpoint not configured for this agent");let s=this.buildUrl(t),r="conversationId"in e?{conversation_id:e.conversationId}:{session_id:e.sessionId};return await this.request(s,{method:"POST",body:r,timeout:7e4})}async closeSession(e,t){let s="closeSession"in this.endpoints&&"string"==typeof this.endpoints.closeSession?this.endpoints.closeSession:null;if(!s)throw Error("Close session endpoint not configured for this agent");let r=this.replacePathParams(s,{id:e}),n=this.buildUrl(r);return await this.request(n,{method:"POST",body:{system_id:t},timeout:7e4})}async getUxAnnotations(e){let t="uxAnnotations"in this.endpoints&&"string"==typeof this.endpoints.uxAnnotations?this.endpoints.uxAnnotations:null;if(!t)throw Error("UX annotations endpoint not configured for this agent");let s=this.replacePathParams(t,{system_id:e}),r=this.buildUrl(s);return await this.request(r,{method:"GET"})}async listSapSystems(){let e="listSapSystems"in this.endpoints&&"string"==typeof this.endpoints.listSapSystems?this.endpoints.listSapSystems:null;if(!e)throw Error("List SAP systems endpoint not configured for this agent");let t=this.buildUrl(e);return await this.request(t,{method:"GET"})}async createSapSystem(e){let t="createSapSystem"in this.endpoints&&"string"==typeof this.endpoints.createSapSystem?this.endpoints.createSapSystem:null;if(!t)throw Error("Create SAP system endpoint not configured for this agent");let s=this.buildUrl(t);return await this.request(s,{method:"POST",body:e})}async setEnablerSicfBaseUrl(e,t){let s="setEnablerSicfBaseUrl"in this.endpoints&&"string"==typeof this.endpoints.setEnablerSicfBaseUrl?this.endpoints.setEnablerSicfBaseUrl:null;if(!s)throw Error("Set enabler base URL endpoint not configured for this agent");let r=this.replacePathParams(s,{system_id:e}),n=this.buildUrl(r);return await this.request(n,{method:"PUT",body:t})}async deleteSapSystem(e){let t="deleteSapSystem"in this.endpoints&&"string"==typeof this.endpoints.deleteSapSystem?this.endpoints.deleteSapSystem:null;if(!t)throw Error("Delete SAP system endpoint not configured for this agent");let s=this.replacePathParams(t,{system_id:e}),r=this.buildUrl(s);await this.request(r,{method:"DELETE"})}async testSapConnection(e){let t="testSapConnection"in this.endpoints&&"string"==typeof this.endpoints.testSapConnection?this.endpoints.testSapConnection:null;if(!t)throw Error("Test SAP connection endpoint not configured for this agent");let s=this.buildUrl(t);return await this.request(s,{method:"POST",body:e,timeout:7e4})}async checkEccBootstrapStatus(e,t){let s="checkEccBootstrapStatus"in this.endpoints&&"string"==typeof this.endpoints.checkEccBootstrapStatus?this.endpoints.checkEccBootstrapStatus:null;if(!s)throw Error("ECC bootstrap-status endpoint not configured for this agent");let r=this.replacePathParams(s,{system_id:e}),n=this.buildUrl(r);return await this.request(n,{method:"POST",body:t})}async installEccRuntime(e,t){let s="installEccRuntime"in this.endpoints&&"string"==typeof this.endpoints.installEccRuntime?this.endpoints.installEccRuntime:null;if(!s)throw Error("ECC install endpoint not configured for this agent");let r=this.replacePathParams(s,{system_id:e}),n=this.buildUrl(r);return await this.request(n,{method:"POST",body:t})}async getEccInstallStatus(e){let t="getEccInstallStatus"in this.endpoints&&"string"==typeof this.endpoints.getEccInstallStatus?this.endpoints.getEccInstallStatus:null;if(!t)throw Error("ECC install-status endpoint not configured for this agent");let s=this.replacePathParams(t,{system_id:e}),r=this.buildUrl(s);return await this.request(r,{method:"GET"})}async downloadEccBootstrapBundle(){let e="downloadEccBootstrapBundle"in this.endpoints&&"string"==typeof this.endpoints.downloadEccBootstrapBundle?this.endpoints.downloadEccBootstrapBundle:null;if(!e)throw Error("ECC bootstrap bundle endpoint not configured for this agent");let t=this.buildUrl(e),s=await fetch(t,{method:"GET",headers:this.getHeaders()});if(!s.ok)throw Error(`Bootstrap bundle download failed: ${s.status} ${s.statusText}`);return await s.blob()}async eccTreeExpand(e,t){return this._eccTreePost(e,t,"eccTreeExpand")}async eccTreeFacets(e,t){return this._eccTreePost(e,t,"eccTreeFacets")}async eccTreeNodeStructure(e,t){return this._eccTreePost(e,t,"eccTreeNodeStructure")}
1async eccAdtSearch(e,t){let s="eccAdtSearch"in this.endpoints&&"string"==typeof this.endpoints.eccAdtSearch?this.endpoints.eccAdtSearch:null;if(!s)throw Error("ECC adtsearch endpoint not configured");let r=this.replacePathParams(s,{system_id:e});return await this.request(this.buildUrl(r),{method:"POST",body:t})}async eccSourceRead(e,t){let s="eccSourceRead"in this.endpoints&&"string"==typeof this.endpoints.eccSourceRead?this.endpoints.eccSourceRead:null;if(!s)throw Error("ECC source-read endpoint not configured");let r=this.replacePathParams(s,{system_id:e});return await this.request(this.buildUrl(r),{method:"POST",body:t})}async _eccTreePost(e,t,s){let r=s in this.endpoints&&"string"==typeof this.endpoints[s]?this.endpoints[s]:null;if(!r)throw Error(`ECC tree endpoint '${s}' not configured`);let n=this.replacePathParams(r,{system_id:e}),i=this.buildUrl(n);return await this.request(i,{method:"POST",body:t})}async listFavorites(e){let t="listFavorites"in this.endpoints&&"string"==typeof this.endpoints.listFavorites?this.endpoints.listFavorites:null;if(!t)throw Error("listFavorites endpoint not configured");let s=this.replacePathParams(t,{system_id:e});return await this.request(this.buildUrl(s),{method:"GET"})}async addFavorite(e,t){let s="addFavorite"in this.endpoints&&"string"==typeof this.endpoints.addFavorite?this.endpoints.addFavorite:null;if(!s)throw Error("addFavorite endpoint not configured");let r=this.replacePathParams(s,{system_id:e});return await this.request(this.buildUrl(r),{method:"POST",body:t})}async updateFavorite(e,t,s){let r="updateFavorite"in this.endpoints&&"string"==typeof this.endpoints.updateFavorite?this.endpoints.updateFavorite:null;if(!r)throw Error("updateFavorite endpoint not configured");let n=this.replacePathParams(r,{system_id:e,favorite_id:t});return await this.request(this.buildUrl(n),{method:"PATCH",body:s})}async deleteFavorite(e,t){let s="deleteFavorite"in this.endpoints&&"string"==typeof this.endpoints.deleteFavorite?this.endpoints.deleteFavorite:null;if(!s)throw Error("deleteFavorite endpoint not configured");let r=this.replacePathParams(s,{system_id:e,favorite_id:t});await this.request(this.buildUrl(r),{method:"DELETE"})}}var l=s(35226);function d(e,t,s){let r=s??(0,l.c4)();return(void 0!==t?t:null!==r)&&r?new a(e.authenticated,r):new o(e.unauthenticated)}class h{static{this.instances=new Map}static getInstance(e,t,s){let r=void 0!==s?s:(0,l.wR)(),n=`${e}-${r?"auth":"unauth"}`;return this.instances.has(n)||this.instances.set(n,d(t,s)),this.instances.get(n)}static clearCache(){this.instances.clear()}static clearInstance(e){let t=`${e}-auth`,s=`${e}-unauth`;this.instances.delete(t),this.instances.delete(s)}}},73892:(e,t,s)=>{s.d(t,{$:()=>l,r:()=>a});var r=s(81454);s(98238);var n=s(72359),i=s(1392),o=s(29875);let a=(0,i.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function l({className:e,variant:t,size:s,asChild:i=!1,...l}){let d=i?n.DX:"button";return(0,r.jsx)(d,{"data-slot":"button",className:(0,o.cn)(a({variant:t,size:s,className:e})),...l})}},88733:(e,t,s)=>{function r(e){return e.flatMap(e=>e.tools.map(t=>({server_name:e.server_name,tool_name:t.tool_name,description:t.description,input_schema:t.input_schema})))}function n(e){let t=function(e){let t=e.task_id??e.session_id;if(null==t||""===t)throw Error("Open session response must include task_id or session_id");return t}(e),s=e.state;return{session_id:t,system_id:e.system_id,system_name:e.system_name,sap_host:e.sap_host,sap_user:e.sap_user,connector_id:e.connector_id,strategy:e.strategy,state:s&&["connecting","connected","active","recovering","failed"].includes(s)?s:"active"}}
1s.d(t,{B2:()=>l,Dr:()=>a,R$:()=>n,cX:()=>r,hD:()=>i,v3:()=>o,yP:()=>d});class i extends Error{constructor(e,t,s,r){super(e),this.statusCode=t,this.code=s,this.details=r,this.name="ApiError"}}class o extends i{constructor(e="Authentication required"){super(e,401,"AUTHENTICATION_ERROR"),this.name="AuthenticationError",this.reason="unauthorized"}}class a extends i{constructor(e="Network error occurred"){super(e,0,"NETWORK_ERROR"),this.name="NetworkError",this.reason="network"}}class l extends i{constructor(e,t){super(e,429,"TOKEN_LIMIT_REACHED",t),this.name="TokenLimitError",this.reason="token_limit_reached",t&&"object"==typeof t&&"token_count"in t&&"token_limit"in t&&(this.tokenCount=t.token_count,this.tokenLimit=t.token_limit)}}class d extends i{constructor(e,t){super(e,402,"PAYMENT_REQUIRED",t),this.name="PaymentRequiredError",this.reason="payment_required"}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.