UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

2 lines • 59.5 kB
import{n as e}from"./rolldown-runtime-8BhlS34s.js";import{Gu as t,Ll as n,Ol as r,Pu as i,Rl as a,Wl as o,Wu as s,kl as c,mc as l,qu as u,xu as d,yu as f,zl as p,zu as m}from"./control-ui-core-CBJ5efDh.js";import{A as h,I as g,N as _,j as ee}from"./control-ui-boot-shared-gZIpWrfw.js";import{Ga as v,Ka as y,bn as te,hn as b,in as x,mr as S,nn as ne,pr as re,rn as ie}from"./control-ui-core-DtLivg_r.js";import{Ct as C,Er as w,Jn as T,M as E,St as ae,Yn as oe,j as se}from"./control-ui-boot-shared-CkXlyZBY.js";import{G as ce,K as le,P as ue,U as de,W as fe}from"./control-ui-boot-chat-Ye5j4vAg.js";import{$n as pe,Bi as me,Br as he,Di as ge,Ei as _e,Fi as ve,Ft as ye,Lr as be,Ni as xe,Oi as Se,Pt as Ce,Yr as we,Zr as Te,ci as D,di as Ee,hi as O,ii as De,ir as Oe,li as ke,mi as Ae,oa as je,oi as Me,pi as Ne,ri as Pe,sa as Fe,si as Ie,ui as k,ur as Le,zi as Re}from"./control-ui-boot-shared-UG5ko-VG.js";import{Bi as A,Di as ze,Fo as j,Jt as Be,Ki as Ve,Oi as He,Ot as Ue,Tt as M,Ui as We,Xt as Ge,ao as Ke,ci as qe,ea as Je,ha as Ye,io as Xe,jo as Ze,wa as N,xa as P,ya as F}from"./ui-CmSP4d14.js";import{A as Qe,C as $e,S as et,b as tt,k as nt}from"./control-ui-boot-shared-VLPz5vN2.js";import{$t as rt,Ct as it,Pt as at,Qt as ot,St as st,Yt as ct,Zt as lt,fa as ut,ga as dt,ha as ft,kt as pt,pa as mt}from"./control-ui-boot-shared-XreXSF7h.js";import{$d as ht,af as gt,if as _t,sf as vt}from"./control-ui-boot-shared-dOnP4mAA.js";import{Ot as yt,St as bt,jt as xt,wt as St}from"./control-ui-boot-chat-CmENwCKi.js";var I,Ct;function wt(){return(wt=e((()=>{t(),I={custodian:{pluginPlaceholder:`Ask OpenClaw about {plugin}`,pluginIntroTitle:`Ask about {plugin}`,pluginStarterPurpose:`What does it do?`,pluginStarterTools:`What tools does it have?`,pluginStarterSetup:`How do I set it up?`,pluginPromptPurpose:`What does {plugin} do?`,pluginPromptTools:`What tools does {plugin} provide?`,pluginPromptSetup:`How do I set up {plugin}?`,pluginHelpQuestion:`Explain {setting}`,pluginHelpFailed:`Could not prepare the setting question. Try Ask OpenClaw again.`,pluginHelpUnset:`Not set`,pluginHelpValue:`Current value: {value}`},pluginsPage:{installProgress:{title:`Installation progress`,stopped:`Installation stopped`,rejected:{title:`Plugin not installed`,recovery:`This attempt did not install the plugin. Resolve the reported issue, then select Retry install.`},saved:{title:`Installation saved`,recovery:`The installation was saved. Resolve the reported issue before reloading the plugin; do not install it again.`},unknown:{title:`Installation status unknown`,recovery:`The Gateway did not confirm the installation outcome. Reconnect and check installed plugins before trying again.`},retry:{title:`Installation failed`,recovery:`Resolve the reported issue, then select Retry install to try again.`},details:`Failure details`,viewStatus:`View status`,failure:`Installation failed`,resolve:{started:`Resolving package`,completed:`Package resolved`,failed:`Package resolution failed`},download:{started:`Downloading plugin`,completed:`Plugin downloaded`,failed:`Plugin download failed`},extract:{started:`Extracting archive`,completed:`Archive extracted`,failed:`Archive extraction failed`},files:{started:`Preparing plugin files`,completed:`Plugin files prepared`,failed:`Plugin file preparation failed`},dependencies:{started:`Installing plugin dependencies`,completed:`Plugin dependencies installed`,failed:`Dependency installation failed`},runtime:{started:`Applying plugin to Gateway`,completed:`Plugin applied to Gateway`,failed:`Plugin could not be applied to Gateway`}},editor:{title:`{name} settings`,search:`Search settings`,navigation:`Settings sections`,other:`Other`,noMatches:`No matching settings.`,empty:`This plugin has no configurable settings.`,permissions:`Permissions`,actions:`Actions for {name}`,reset:`Reset value`,ask:`Ask OpenClaw`},credentials:{stored:`••••••••`,replace:`Enter a new key to replace the stored credential.`,reveal:`Show API key`,hide:`Hide API key`,signup:`Get an API key`,useReference:`Use a secret reference`,editReference:`Edit reference`,viewSource:`View source`,fromSource:`From {source}`,environment:`From environment · {name}`,referenceTitle:`Secret reference`,referenceHelp:`Choose where this credential is stored. Saving changes the reference only; it does not rotate or test the secret.`,environmentHelp:`This credential comes from {name} in the Gateway environment. Change that environment variable at its source. Its value is never shown here.`,source:`Source`,provider:`Provider`,identifier:`Identifier`,sources:{env:`Environment`,file:`File`,exec:`Command provider`,store:`Secret store`},help:{env:`Use the environment variable name, for example SEARCH_API_KEY.`,file:`Use a JSON pointer such as /search/apiKey, or value for a single-value file provider.`,exec:`Use the identifier accepted by the configured command provider, such as team/search-key.`,store:`Use the stored secret name, for example SEARCH_API_KEY.`},unresolved:`This reference is currently unresolved. The configured source must provide the secret before the plugin can use it.`,invalid:`The setting could not accept this value. Check the source, provider, and identifier.`,invalidStored:`This credential has an invalid stored value. Replace it or edit its reference.`,stale:`Configuration changed. Reload this reference before editing it.`,saveFailed:`The credential could not be saved. Your draft is still available; try saving again.`},detailCapabilities:`Capabilities`,uiCapabilities:{page:{name:`Pages`,description:`Adds pages to OpenClaw.`},navigation:{name:`Navigation`,description:`Adds links to OpenClaw navigation.`},panel:{name:`Panels`,description:`Adds interface panels.`},action:{name:`Actions`,description:`Adds buttons or menu actions.`},accessory:{name:`Session accessories`,description:`Adds information or controls alongside sessions.`},widget:{name:`Dashboard widgets`,description:`Adds widgets to the dashboard.`},replacement:{name:`Interface replacements`,description:`Replaces supported parts of the interface.`},"link-reader":{name:`Link previews`,description:`Shows previews and details for supported links.`}},capabilityFamilies:{speechProviders:{name:`Text to speech`,description:`Turn text into spoken audio.`},realtimeTranscriptionProviders:{name:`Live transcription`,description:`Transcribe audio as it arrives.`},realtimeVoiceProviders:{name:`Realtime voice`,description:`Support live voice conversations.`},mediaUnderstandingProviders:{name:`Media understanding`,description:`Analyze supported media inputs.`},imageGenerationProviders:{name:`Image generation`,description:`Create images from prompts and supported references.`},videoGenerationProviders:{name:`Video generation`,description:`Create video with supported generation models.`},musicGenerationProviders:{name:`Music generation`,description:`Create music with supported generation models.`},embeddingProviders:{name:`Embeddings`,description:`Represent content for semantic search and retrieval.`},webSearchProviders:{name:`Web search`,description:`Find information on the web.`},webFetchProviders:{name:`Web fetching`,description:`Read content from web pages.`},webContentExtractors:{name:`Web content extraction`,description:`Extract readable content from web pages.`},documentExtractors:{name:`Document extraction`,description:`Extract content from supported documents.`},transcriptSourceProviders:{name:`Transcripts`,description:`Capture or import transcripts from supported sources.`},migrationProviders:{name:`Migration`,description:`Bring supported data into OpenClaw.`}},breadcrumb:`Breadcrumb`,settingsDescription:`Configure installed plugins, access, and lifecycle.`,settingsTabs:`Plugin settings sections`,settingsInstalled:`Installed`,settingsInstalledDescription:`Search and configure plugins available to this gateway.`,advanced:`Advanced`,advancedDescription:`Global plugin loading, allow and deny lists, and capability slot ownership.`,searchInstalled:`Search installed plugins`,noSettingsMatches:`No installed plugins match this search.`,noInstalled:`No plugins are installed.`,connectToManage:`Connect to the gateway to inspect plugins.`,auth:{accounts:`Accounts`,credentials:`Credentials`,edit:`Edit`,connected:`Connected`,configured:`Configured`,editAccount:`Edit {name} connection`,editCredential:`Edit {name}`,connectAccount:`Connect {name}`,configure:`Configure`,configureCredential:`Configure {name}`,connect:`Connect`,requestFailed:`Sign-in did not finish. Try connecting again.`,sessionExpired:`This sign-in session expired. Try connecting again.`},toggleNamed:`Enable or disable {name}`,schemaUnavailable:`Plugin settings schema is unavailable.`,pluginNotFound:`This installed plugin could not be found.`,configuration:`Configuration`,configurationDescription:`Settings declared by this plugin.`,accessCapabilities:`Access & capabilities`,accessCapabilitiesDescription:`What this plugin can access with the current policy.`,promptContextAccess:`Add context to prompts`,promptContextAccessDescription:`Allows hooks to add plugin context before a model runs.`,conversationAccess:`Read conversation context`,conversationAccessDescription:`Allows hooks to inspect conversation content.`,modelOverrideAccess:`Override model selection`,modelOverrideAccessDescription:`Allows plugin actions or subagents to choose another model.`,accessAllowed:`Allowed`,accessBlocked:`Blocked`,lifecycle:`Lifecycle`,lifecycleDescription:`Installed source, version, trust, and removal controls.`,version:`Version`,installedSource:`Installed source`,integrity:`Integrity`,trustStatus:`Trust status`,setupRequiredDescription:`Complete the required configuration before enabling this plugin.`,additionalConfigurationRequired:`This plugin requires additional configuration`,uninstall:`Uninstall`,uninstallNamed:`Uninstall {name}`,uninstallDescription:`Remove this plugin package and its configured entries.`,managedCannotUninstall:`This plugin is managed by its installation source and cannot be uninstalled here.`,searchLabel:`Search plugins`,hubTablistLabel:`Plugins sections`,workshopTab:`Workshop`,backToSkills:`Back to Skills`,installedPluginsTitle:`Installed plugins`,featuredTitle:`Featured`,loadingFeatured:`Loading featured plugins…`,noFeaturedResults:`No featured plugins are available right now.`,exploreTitle:`Explore plugins`,loadingDiscovery:`Loading ClawHub plugins…`,loadMore:`Load more`,loadingMore:`Loading more…`,discoveryOffline:`Connect to browse plugins from ClawHub.`,noDiscoveryResults:`No plugins found`,noDiscoveryResultsHint:`Try a different search or choose another filter.`,searchClawHub:`Search ClawHub plugins`,searchPlugins:`Search plugins`,viewsLabel:`Catalog views`,intentAll:`All`,intentTrending:`Trending`,intentOfficial:`Official`,intentBundled:`Bundled`,loadingCategories:`Loading plugin categories…`,categoriesLabel:`Plugin categories`,categoriesTitle:`Categories`,allCategories:`All categories`,catalogPaginationLabel:`Plugin catalog pages`,previousPage:`Back`,nextPage:`Next`,pageNumber:`Page {page}`,downloadCount:`{count} downloads`,catalogPluginColumn:`Plugin`,catalogDownloadsColumn:`Downloads`,localPopularityUnavailable:`This plugin has not been published to ClawHub and does not have download metrics.`,detailBack:`Back to Explore plugins`,detailLoading:`Loading plugin details…`,detailSections:`Plugin details`,detailViewOnClawHub:`View on ClawHub`,detailUpdated:`Updated`,detailPublished:`Published`,detailRepository:`Repository`,detailDocumentation:`Documentation`,detailCategories:`Categories`,detailInstalledVersion:`Installed version`,detailSettings:`Settings`,detailEnable:`Enable`,detailDisable:`Disable`,detailTools:`Tools`,detailToolInputs:`Inputs`,detailType:`Type`,detailSecurity:`Security audit`,detailSecurityAudit:`View security audit`,detailNoReadme:`This plugin does not include a README.`,detailNoSkills:`This plugin does not declare any skills.`,detailNoConfiguration:`This plugin does not declare any configuration fields.`,detailNoCompatibility:`No compatibility requirements were published.`,detailNoVersions:`No release history is available.`,detailRequired:`Required`,detailOptional:`Optional`,detailSensitive:`Sensitive`,detailMinimumGateway:`Minimum Gateway version`,detailPluginApi:`Plugin API`,detailBuiltWith:`Built with OpenClaw`,detailSdkVersion:`Plugin SDK`,detailSourceCommit:`Source commit`,detailSourcePath:`Source path`,detailMcpServer:`MCP Server`,detailMcpServers:`MCP Servers`,mcpDetails:{endpoint:`Endpoint`,endpointRedacted:`Withheld because the endpoint may contain private connection details.`,transport:`Transport`,authentication:`Authentication`,scope:`Requested permissions`,unavailable:`Connection details are not included in this plugin’s catalog metadata.`,auth:{oauth:`OAuth`,"api-key":`API key`,none:`None`}},detailTabs:{readme:`README`,skills:`Skills`,configuration:`Configuration`,mcpServers:`MCP Servers`,commands:`Commands`,hooks:`Hooks`,lspServers:`LSP servers`,compatibility:`Compatibility`,versions:`Versions`,access:`Access`,lifecycle:`Lifecycle`,advanced:`Advanced`},installCount:`{count} installs`,installed:`Installed`,installedDisabled:`Installed · Disabled`,pluginSettings:`Plugin settings`,setupRequired:`Setup required`,setupRequiredNotice:`Additional configuration required before this plugin can be enabled.`,searchInstalledPlaceholder:`Search installed plugins`,showAllPlugins:`Show all {count}`,viewAllInstalledPlugins:`View all`,hideInstalledPlugins:`Hide`,tryAgain:`Try again`,loading:`Loading plugins…`,noInstalledTitle:`No optional plugins installed`,noInstalledMatchTitle:`No installed plugins match`,categoryChannels:`Channels`,categoryModels:`Models`,categoryMemory:`Memory`,categoryContext:`Context`,categoryWeb:`Web`,categoryVoice:`Voice`,categoryMedia:`Media`,categoryProviders:`Model providers`,categoryTools:`Tools`,categoryRuntime:`Runtime`,categoryGateway:`Gateway`,categorySecurity:`Security`,categoryOther:`Other`,categoryUncategorized:`Uncategorized`,remove:`Remove`,removeConfirmTitle:`Remove {name}?`,removeConfirmMessage:`This removes the plugin package and all of its entries. Active work using this plugin finishes before removal.`,cancel:`Cancel`,reload:`Reload`,installSaved:`Installation of {name} was saved. {error}`,installSavedNotApplied:`Installation of {name} was saved, but the Gateway has not applied it. {error} Fix the reported problem, then run openclaw plugins reload {name}.`,runtimeFailurePhase:`Runtime phase: {phase}.`,enableAction:`Enable`,working:`Working…`,detailOrigin:`Source`,detailPackage:`Package`,detailPluginId:`Plugin ID`,offlineBody:`Connect to browse installed and recommended plugins.`,optionalCapability:`Optional OpenClaw capability.`,enabled:`Enabled`,disabled:`Disabled`,available:`Available`,needsAttention:`Needs attention`,included:`Included`,global:`Global`,workspace:`Workspace`,config:`Config`,official:`Official`,community:`Community`,verifiedSource:`Verified source`,codePlugin:`Code plugin`,bundlePlugin:`Bundle plugin`,unavailable:`Unavailable`,install:`Install`,retryInstall:`Retry install`,retryInstallNamed:`Retry install of {name}`,viewInstallStatusNamed:`View status of {name} installation`,installing:`Installing`,installNamed:`Install {name}`,connectToChange:`Connect to the gateway to change plugins.`,adminRequired:`Plugin changes require operator.admin access.`,changesDisabled:`This gateway does not allow plugin changes.`,configRefreshFailed:`Could not refresh Control UI configuration: {error}`,continueInstall:`Continue installation`,installAvailabilityChanged:`Plugin availability changed. Refresh the catalog to see its current state.`,installDestinationChanged:`The Gateway or operator changed. Install the plugin again to request a fresh review.`}},Ct=Object.assign(()=>{Object.assign(s.custodian,I.custodian),s.pluginsPage=I.pluginsPage},{catalog:I})})))()}function Tt(e){if(e.id===M.TUI)return`terminal`;if(e.mode===`webchat`||e.id===M.CONTROL_UI||e.id===M.BROWSER_COPILOT||e.id===M.WEBCHAT_UI||e.id===M.WEBCHAT)return`web`;if(e.id===M.CLI||e.mode===`cli`)return`cli`;if(e.mode===`ui`||e.id===M.MACOS_APP||e.id===M.LINUX_APP||e.id===M.IOS_APP||e.id===M.WATCHOS_APP||e.id===M.ANDROID_APP)return`app`}function Et(){return(Et=e((()=>{Ue()})))()}function Dt(e){let t=e.map(e=>{let t=Tt(e)??`rpc`,n=m(`chat.messages.sourceKinds.${t}`);return e.displayName&&e.displayName!==n?`${n} (${e.displayName})`:n});return m(`chat.messages.viaSource`,{source:[...new Set(t)].join(`, `)})}function Ot(){return(Ot=e((()=>{i(),Re(),Et(),me()})))()}function kt(e){return e.replace(/^\/(?:Users|home)\/[^/]+(\/|$)/,`~$1`).replace(/^[A-Za-z]:\\Users\\[^\\]+(\\|$)/i,`~$1`)}function At(e){let t=E({name:e.name,args:e.args}),n=ce(t.name),r=Ze(n),i=Vt[r],a=ye(n),o=i?.label??i?.title??de(n),{detail:s}=le({toolKey:r,args:t.args,spec:i,fallbackDetailKeys:Bt.detailKeys,detailMode:`first`,toolDetailMode:e.detailMode,detailCoerce:{includeFalsy:!0}});return s&&=kt(s),{name:n,icon:a,label:o,detail:s}}function jt(e){return e.detail?`with ${e.detail}`:void 0}function Mt(e){return e===Rt||e.startsWith(`${Rt}/`)||e===Lt||e.startsWith(`${Lt}/`)}function Nt(e,t=!1){let n=URL.parse(e,`http://localhost`);if(n)return n.origin===`http://localhost`?Mt(n.pathname)?`${n.pathname}${n.search}${n.hash}`:void 0:t&&oe(n)?n.toString():void 0}function Pt(e){let t=e?.trim();return!!(t&&Nt(t,!1))}function Ft(e,t,n=!1){let r=e?.trim();if(!r)return;let i=Nt(r,n);if(i){if(!t?.trim())return i;try{let e=new URL(t),n=e.pathname.replace(/\/+$/,``);if(!n.startsWith(zt))return i;let r=new URL(i,e.origin);return Mt(r.pathname)?(r.protocol=e.protocol,r.username=e.username,r.password=e.password,r.host=e.host,r.pathname=`${n}${r.pathname}`,r.toString()):i}catch{return i}}}function It(e,t){return t===`strict`||e===`strict`?``:e===`trusted`&&t!==`scripts`?`allow-scripts allow-same-origin`:`allow-scripts`}var Lt,Rt,zt,Bt,Vt;function Ht(){return(Ht=e((()=>{T(),nt(),se(),fe(),Ce(),Lt=`/__openclaw__/a2ui`,Rt=`/__openclaw__/canvas`,zt=`/__openclaw__/cap`,Bt=Qe.fallback,Vt=Qe.tools})))()}var Ut,Wt;function Gt(){return(Gt=e((()=>{t(),Ut={browser:{unavailable:`Browser control is unavailable for this connection. Reconnect with browser access.`,navigationBlocked:`The current browser navigation rules block this address. Select another tab or enter an allowed address.`,navigationCheckFailed:`OpenClaw couldn’t verify this tab’s address. Refresh to try again.`,tabUnavailable:`This tab is no longer available. Select another tab.`,noChatTarget:`Open a chat session first so the annotation has somewhere to go.`,annotationLimitReached:`Remove a browser annotation before retrying (maximum 4 cards and 8,000 characters of generated context).`,inspectUnavailable:`Element inspection is disabled (browser.evaluateEnabled=false).`,annotationSent:`Annotation added to the chat composer.`,dashboardSessionShared:`You and your agent share this isolated session browser`,dashboardShared:`You and your agent share this browser page`,dashboardStopped:`This dashboard's browser is stopped.`,dashboardStopping:`Browser stop is pending. Retry to finish closing its tab.`,dashboardStop:`Stop browser`,dashboardRetryStop:`Retry stop`,dashboardResume:`Resume browser`,dashboardReconnect:`Reconnect`,dashboardUnavailable:`Connect to a Gateway with browser access to use this dashboard.`,dashboardMissingIdentity:`Save this dashboard widget again before opening its browser.`,dashboardInvalidReply:`The browser response does not match this dashboard. Reconnect and try again.`,downloading:`Downloading…`,downloadFile:`Download file`,inputLabel:`Browser input: click a field in the page, then type or paste`,manualTextCorrection:`Autocorrect is unavailable in browser control. Edit the text directly.`,errors:{pasteFailed:`Could not paste. Reconnect to a managed browser and try again.`,requestFailed:`Browser request failed: {error}`,downloadFailed:`Could not download this file: {error}. Try again, or open it in your browser to save it.`,downloadEmpty:`No file returned.`,screenshotPathMissing:`Browser screenshot did not return a media path.`,screenshotFetchTimedOut:`Screenshot fetch timed out.`,screenshotFetchFailed:`Screenshot fetch failed ({status}).`,screenshotReadFailed:`Screenshot read failed.`,screenshotDecodeFailed:`Screenshot decode failed.`,canvasUnavailable:`Canvas 2D context unavailable.`},annotatePrompt:{browserTarget:`Browser target: {target}`,introTitled:`I annotated the page at {url} (page-reported title: "{title}") — the attached screenshot shows my markup.`,introUntitled:`I annotated the page at {url} — the attached screenshot shows my markup.`,region:`Marked region {index}: centered around {x}% across / {y}% down, spanning about {width}% × {height}% of the view.`,moreRegions:`…plus {count} more marked region(s), all visible in the screenshot.`,elementDetail:`Marked element (page-reported): {descriptor} — {width}×{height}px at ({x}, {y}).`,outro:`Please look at the marked area and tell me what you make of it.`}}},Wt=Object.assign(()=>{let{errors:e,annotatePrompt:t,...n}=Ut.browser;Object.assign(s.browser,n),Object.assign(s.browser.errors,e),Object.assign(s.browser.annotatePrompt,t)},{catalog:Ut})})))()}function Kt(e){return e.callId??e.messageId??e.previewRevision}function qt(e,t){let n=Yt.get(e);if(n?.toolMessages===t)return n.latest;let r=new Map;for(let n of[e,t])for(let e of n)if(N(e))for(let t of pe(e)){let e=Kt(t);if(t.browserTab&&e&&Le(t,!1)===`succeeded`){let n=ft(t.browserTab);r.delete(n),r.set(n,{tab:t.browserTab,revision:e})}}return Yt.set(e,{toolMessages:t,latest:r}),r}function Jt(e){let t=ft(e.tab),n=Xt.get(e.client);n||(n={tabs:new Map,images:new Map},Xt.set(e.client,n));let{tabs:r,images:i}=n,a=r.get(t);if(a||(a={revisions:new Set},r.set(t,a)),a.revisions.has(e.revision))return a.pending??Promise.resolve(i.get(t));a.revisions.add(e.revision);let o=(a.pending??Promise.resolve()).then(async()=>{try{let n=await St(bt(e.client,e.tab),e.tab.targetId),r=await yt({resourceBasePath:e.resourceBasePath,authToken:e.authToken,path:n.path});if(i.delete(t),i.set(t,r),i.size>Zt){let e=i.keys().next().value;e!==void 0&&i.delete(e)}return r}catch{i.delete(t);return}finally{a.pending===o&&(a.pending=void 0)}});return a.pending=o,o}var Yt,Xt,Zt;function Qt(){return(Qt=e((()=>{xt(),dt(),Oe(),Yt=new WeakMap,Xt=new WeakMap,Zt=32})))()}function $t(e){return!e.outputTruncated&&(e.toolOutput?.captureTruncated===!0||!e.toolOutput&&/\n\.\.\.\(OpenClaw truncated Codex native tool output: original \d+ chars, showing \d+; rerun with narrower args\.\)\s*$/u.test(e.outputText??``))}function en(e){return m(e.toolOutput?.source===`provider-response`?`chat.toolCards.providerResponse`:e.toolOutput?.source===`execution`?`chat.toolCards.executionOutput`:`chat.toolCards.toolOutput`)}function tn(e){let t=ze(e),n=N(t)&&typeof t.wall_time_seconds==`number`&&typeof t.exit_code==`number`&&typeof t.output==`string`&&Object.keys(t).every(e=>[`chunk_id`,`wall_time_seconds`,`exit_code`,`original_token_count`,`output`].includes(e))?{text:t.output,exitCode:t.exit_code}:void 0,r=n?.text??e,i=rt(r)?.root?tt(r,et(r,void 0,{insertSpaces:!0,tabSize:2})):r;return n&&n.exitCode!==0?`${m(`chat.toolCards.exitCode`,{code:String(n.exitCode)})}\n${i}`:i}function nn(e){let t=e.outputText;if(t===void 0||e.preview||e.toolOutput?.source!==`provider-response`||e.name!==`exec`||!N(e.args)||typeof e.args.input!=`string`)return t;let n=ze(t);return!Array.isArray(n)||n.length===0||!n.every(e=>N(e)&&e.type===`input_text`&&typeof e.text==`string`)?t:n.filter((e,t)=>t!==0||n.length===1||!/^Script completed\nWall time [\d.]+ seconds\nOutput:\n$/u.test(e.text)).map(e=>tn(e.text)).join(`
`)}var rn;function an(){return(an=e((()=>{qe(),$e(),ot(),i(),rn=8e3})))()}var on;function sn(){return(sn=e((()=>{d(),on=class{constructor(){this.entries=new Map}clear(){this.entries.clear()}prune(e){let t=new Set(e.filter(e=>e.contentKind===`mcp-app`).map(e=>this.key(e)));for(let e of this.entries.keys())t.has(e)||this.entries.delete(e)}async resolve(e,t,n){let r=this.key(e);return n&&this.entries.delete(r),await Ye(this.entries,r,()=>t().then(e=>({status:`ready`,...e})).catch(e=>({status:`stale`,error:f(e)})))}key(e){return`${e.name}\0${e.revision}\0${e.instanceId??``}\0${e.grantState}`}}})))()}function cn(e){return{sessionKey:e,revision:0,tabs:[],widgets:[]}}function ln(e){let t=e?.trim()??``;return t?w(t,80):void 0}function un(){return(un=e((()=>{})))()}var L,R;function dn(){return(dn=e((()=>{L=class{constructor(e){this.value=e,this.listeners=new Set}subscribe(e){return Je(this.listeners,e)}set(e){this.value=e;for(let e of this.listeners)e()}},R=class{constructor(){this.listeners=new Set}subscribe(e){return Je(this.listeners,e)}emit(e){for(let t of this.listeners)t(e)}}})))()}function fn(e){let t=14695981039346656037n;for(let n of new TextEncoder().encode(e))t^=BigInt(n),t=BigInt.asUintN(64,t*1099511628211n);return t.toString(16).padStart(16,`0`)}function pn(e){let t=`canvas-${e.toLowerCase().replace(/[^a-z0-9._-]/gu,`-`)}`;return t===`canvas-${e}`&&t.length<=64?t:`${t.slice(0,47).replace(/[._-]+$/gu,``)||`canvas-widget`}-${fn(e)}`}function mn(e){return`mcp-app-${fn(e)}`}function hn(){return(hn=e((()=>{})))()}function gn(e,t=Date.now()){e.viewTicket&&e.viewTicketTtlMs&&z.set(e,t)}function _n(e,t,n){gn(e,z.get(t)??n)}function vn(e){let t=Date.now(),n=e.viewTicketTtlMs;if(!e.viewTicket||!n)return;let r=z.get(e);return r===void 0?n:Math.max(0,n-(t-r))}var z;function yn(){return(yn=e((()=>{z=new WeakMap})))()}function bn(e,t){return{...e,...t.frameUrl===void 0?{}:{frameUrl:t.frameUrl},...t.viewTicket===void 0?{}:{viewTicket:t.viewTicket},...t.viewTicketTtlMs===void 0?{}:{viewTicketTtlMs:t.viewTicketTtlMs},...t.viewGeneration===void 0?{}:{viewGeneration:t.viewGeneration},...t.sandboxUrl===void 0?{}:{sandboxUrl:t.sandboxUrl},...t.sandboxPort===void 0?{}:{sandboxPort:t.sandboxPort},...t.sandboxOrigin===void 0?{}:{sandboxOrigin:t.sandboxOrigin}}}var xn;function Sn(){return(Sn=e((()=>{Ge(),We(),d(),c(),sn(),un(),dn(),yn(),xn=class{constructor(e,t,n=!0){this.session=e,this.client=t,this.connected=n,this.canPinWidgets=!0,this.canPinMcpApps=!1,this.canMutate=!0,this.canGrant=!0,this.loadErrorSignal=new L(null),this.eventStream=new R,this.retiredClients=new WeakSet,this.clientGeneration=0,this.refreshRequested=!1,this.userRefreshRequested=!1,this.changedWidgets=new Set,this.stateGeneration=0,this.appViews=new on,this.disposed=!1,this.snapshotLoaded=!1,this.snapshotSignal=new L(cn(this.sessionKey)),this.snapshot$=this.snapshotSignal,this.loadError$=this.loadErrorSignal,this.events=this.eventStream,this.subscribe(t),n&&this.activate()}get sessionKey(){return this.session.sessionKey}attachClient(e,t=!0){if(this.disposed||e!==this.client&&this.retiredClients.has(e))return;let n=t!==this.connected,r=t&&!this.connected;if(this.connected=t,t||this.wakeRetryDelay?.(),e===this.client){n&&(this.clientGeneration+=1,this.stateGeneration+=1,this.appViews.clear(),this.publishAppViewGeneration()),r&&this.activate();return}this.retiredClients.add(this.client),this.unsubscribe?.(),this.client=e,this.clientGeneration+=1,this.stateGeneration+=1,this.changedWidgets.clear(),this.appViews.clear(),this.snapshotLoaded=!1,this.setLoadError(null),this.snapshotSignal.set(cn(this.sessionKey)),this.subscribe(e),t&&this.activate()}activate(){return this.requestRefresh()}get hasLoadedSnapshot(){return this.snapshotLoaded}get appViewGeneration(){return this.clientGeneration}dispose(){this.disposed||(this.disposed=!0,this.connected=!1,this.unsubscribe?.(),this.unsubscribe=void 0,this.clientGeneration+=1,this.stateGeneration+=1,this.refreshRequested=!1,this.userRefreshRequested=!1,this.changedWidgets.clear(),this.appViews.clear(),this.wakeRetryDelay?.())}async applyOps(e){await this.mutate(`board.update`,{...this.session,ops:e})}async grant(e,t){let n=this.snapshotSignal.value.widgets.find(t=>t.name===e);if(!n)throw this.requestRefresh(),Error(`Dashboard widget not found: ${e}`);await this.mutate(`board.widget.grant`,{...this.session,name:e,decision:t,revision:n.revision,...n.instanceId?{instanceId:n.instanceId}:{}})}pinWidget(e){return this.pinBoardWidget(e,e.name??pn(e.docId),{kind:`canvas-doc`,docId:e.docId})}pinMcpApp(e){return this.pinBoardWidget(e,e.name??mn(e.viewId),{kind:`mcp-app`,viewId:e.viewId})}async pinBoardWidget(e,t,n){let r=ln(e.title);await this.mutate(`board.widget.put`,{...this.session,name:t,...r?{title:r}:{},content:n,...e.tabId||e.size||e.after?{placement:{...e.tabId?{tabId:e.tabId}:{},...e.size?{size:e.size}:{},...e.after?{after:e.after}:{}}}:{}},t)}widgetFrameUrl(e,t){return this.snapshotSignal.value.widgets.find(n=>n.name===e&&n.revision===t)?.frameUrl??``}refreshWidgetFrame(e){return this.requestRefresh(e,!0)}async widgetAppView(e,t){return await this.resolveWidgetAppView(e,t,!1)}async refreshWidgetAppView(e,t){return await this.resolveWidgetAppView(e,t,!0)}async resolveWidgetAppView(e,t,n){if(this.disposed||!this.connected)return{status:`stale`,error:`Dashboard MCP App view unavailable`};let r=this.snapshotSignal.value.widgets.find(n=>n.name===e&&n.revision===t&&n.contentKind===`mcp-app`);if(!r)return{status:`stale`,error:`Dashboard MCP App widget unavailable`};let i=this.client,a=this.clientGeneration,o=await this.appViews.resolve(r,async()=>await i.request(`board.widget.appView`,{...this.session,name:e,revision:t,...r.instanceId?{instanceId:r.instanceId}:{}}),n);return this.disposed||!this.connected||i!==this.client||a!==this.clientGeneration?{status:`stale`,error:`Dashboard MCP App view unavailable`}:o}subscribe(e){this.unsubscribe=e.addEventListener(t=>{if(!(this.disposed||e!==this.client)){if(t.event===`board.changed`){let e=t.payload;e&&this.matchesSession(e.sessionKey)&&(this.stateGeneration+=1,this.requestRefresh(e.widget));return}if(t.event===`board.command`){let e=t.payload;e?.command&&this.matchesSession(e.sessionKey,e.agentId)&&this.eventStream.emit({sessionKey:this.snapshotSignal.value.sessionKey,command:e.command})}}})}matchesSession(e,t){if(typeof e!=`string`)return!1;let n=o({},this.sessionKey,this.session.agentId);if(t){let r=o({},e,t);return n.sessionKey===r.sessionKey&&n.agentId===r.agentId}if(!this.snapshotLoaded){let t=p(e);return!(!t||t.agentId!==n.agentId||a(e)!==n.sessionKey&&a(t.rest)!==n.sessionKey)}return a(e)===a(this.snapshotSignal.value.sessionKey)}requestRefresh(e,t=!1){return this.disposed?Promise.resolve():(this.refreshRequested=!0,this.userRefreshRequested||=t,e&&this.changedWidgets.add(e),this.wakeRetryDelay?.(),this.refreshLoop??=this.runRefreshLoop().finally(()=>{this.refreshLoop=void 0,this.refreshRequested&&(this.connected||this.userRefreshRequested)&&this.requestRefresh()}),this.refreshLoop)}async runRefreshLoop(){let e={delayMs:1e3};for(;this.refreshRequested;){if(this.disposed){this.refreshRequested=!1;return}if(!this.connected&&!this.userRefreshRequested)return;this.userRefreshRequested=!1;let t=new Set(this.changedWidgets);this.changedWidgets.clear();let n=this.client,r=this.stateGeneration;try{let i=await n.request(`board.get`,this.session);if(this.disposed)return;if(n!==this.client){this.refreshRequested=!0;continue}if(this.userRefreshRequested=!1,r!==this.stateGeneration){this.refreshRequested=!0;for(let e of t)this.changedWidgets.add(e);continue}for(let e of this.changedWidgets)t.add(e);this.changedWidgets.clear(),this.refreshRequested=!1,this.setSnapshot(i,t),e.delayMs=1e3}catch(i){if(this.disposed)return;if(this.refreshRequested=!0,n!==this.client)continue;this.setLoadError(f(i));for(let e of t)this.changedWidgets.add(e);if(i instanceof Be&&i.gatewayCode===`UNAVAILABLE`&&!i.retryable){this.refreshRequested=this.stateGeneration!==r||this.userRefreshRequested;continue}if(!this.connected){if(this.userRefreshRequested)continue;return}let a=e.delayMs;e.delayMs=Math.min(a*2,3e4),await this.waitForRetry(a);continue}}}async waitForRetry(e){let t=new AbortController,n=()=>t.abort();this.wakeRetryDelay=n,await Ve(e,t.signal).catch(()=>void 0),this.wakeRetryDelay===n&&(this.wakeRetryDelay=void 0)}async mutate(e,t,n){if(this.disposed)throw Error(`Session dashboard provider is no longer active`);let r=this.client,i=this.clientGeneration,a=++this.stateGeneration,o=()=>!this.disposed&&r===this.client&&i===this.clientGeneration&&a===this.stateGeneration;try{let i=await r.request(e,t);o()&&(this.stateGeneration+=1,this.setSnapshot(i,n?new Set([n]):new Set,!0))}catch(e){throw o()&&this.requestRefresh(),e}}setSnapshot(e,t=new Set,n=!1){let r=Date.now(),i=new Map(this.snapshotSignal.value.widgets.map(e=>[e.name,e])),a=e.widgets.map(e=>{let a=i.get(e.name);if(a&&!t.has(e.name)&&a.revision===e.revision&&a.instanceId===e.instanceId){if(n&&e.viewGeneration===void 0){let t=bn(e,a);return _n(t,a,r),t}if(a.viewGeneration===e.viewGeneration&&!e.sandboxUrl&&a.frameUrl){let t={...e,frameUrl:a.frameUrl};return gn(t,r),t}}return gn(e,r),e});this.appViews.prune(a),this.snapshotLoaded=!0,this.snapshotSignal.set({...e,widgets:a}),this.setLoadError(null)}setLoadError(e){this.loadErrorSignal.value!==e&&this.loadErrorSignal.set(e)}publishAppViewGeneration(){let e=this.snapshotSignal.value;e.widgets.some(e=>e.contentKind===`mcp-app`)&&this.snapshotSignal.set({...e,widgets:e.widgets.map(e=>e.contentKind===`mcp-app`?Object.assign({},e):e)})}}})))()}function Cn(e){return e.tabs.length>0||e.widgets.length>0}function wn(e){let t=async()=>{throw Error(`Session dashboard unavailable`)},n=async()=>({status:`stale`,error:`Session dashboard unavailable`});return{sessionKey:e,appViewGeneration:0,canMutate:!1,canGrant:!1,canPinWidgets:!1,canPinMcpApps:!1,hasLoadedSnapshot:!0,loadError$:new L(null),snapshot$:new L(cn(e)),events:new R,async applyOps(){},async grant(){},pinWidget:t,pinMcpApp:t,widgetFrameUrl:()=>``,async refreshWidgetFrame(){},widgetAppView:n,refreshWidgetAppView:n}}function Tn(e){let t=o({},n(e.sessionKey),e.agentId);return JSON.stringify([e.agentId??t.agentId,t.sessionKey])}function En(e,t=!0){let r=Tn(e),i=n(e.sessionKey),a=t?B.get(r)?.provider:void 0;if(a)return a;let o=On.get(r);return o||(o=wn(i),On.set(r,o)),o}function Dn(e,t,r=!0,i=!0,a=!1,o=!0,s=!0){let c=Tn(e),l=B.get(c);if(l)l.provider.attachClient(t,r);else{let i={...e,sessionKey:n(e.sessionKey)};l={provider:new xn(i,t,r),consumers:0},B.set(c,l)}let u=l.provider,d={canPinWidgets:i,canPinMcpApps:a,canMutate:o,canGrant:s};l.consumers+=1;let f=!1,p=(e,t)=>{if(!e)throw Error(`Session dashboard ${t} unavailable`)};return{provider:{loadError$:u.loadError$,snapshot$:u.snapshot$,events:u.events,widgetFrameUrl:u.widgetFrameUrl.bind(u),refreshWidgetFrame:u.refreshWidgetFrame.bind(u),widgetAppView:u.widgetAppView.bind(u),refreshWidgetAppView:u.refreshWidgetAppView.bind(u),get sessionKey(){return u.sessionKey},get appViewGeneration(){return u.appViewGeneration},get hasLoadedSnapshot(){return u.hasLoadedSnapshot},get canPinWidgets(){return!f&&d.canPinWidgets},get canPinMcpApps(){return!f&&d.canPinMcpApps},get canMutate(){return!f&&d.canMutate},get canGrant(){return!f&&d.canGrant},async applyOps(e){p(this.canMutate,`mutation`),await u.applyOps(e)},async grant(e,t){p(this.canGrant,`approval`),await u.grant(e,t)},async pinWidget(e){p(this.canMutate&&this.canPinWidgets,`widget pinning`),await u.pinWidget(e)},async pinMcpApp(e){p(this.canMutate&&this.canPinMcpApps,`MCP App pinning`),await u.pinMcpApp(e)}},update:(e,t,n)=>{f||B.get(c)?.provider!==l.provider||(d=n,l.provider.attachClient(e,t))},release:()=>{if(f)return;f=!0;let e=B.get(c);e&&e.provider===l.provider&&(--e.consumers,!(e.consumers>0)&&(B.delete(c),e.provider.dispose()))}}}var On,B;function kn(){return(kn=e((()=>{c(),Sn(),un(),dn(),On=new Map,B=new Map})))()}function An(e){if(e===null)return 0;let t;if(/^\d+$/u.test(e))t=Number(e);else{let n=/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/iu.exec(e);if(!n||!e)return;t=Number(n[1]??0)*3600+Number(n[2]??0)*60+Number(n[3]??0)}return Number.isSafeInteger(t)&&t>=0?t:void 0}function jn(e){if(!e)return;let t=URL.parse(e);if(!t||t.protocol!==`https:`||t.username||t.password||t.port)return;let n=t.searchParams,r=new URLSearchParams(t.hash.slice(1));if([`v`,`start`,`t`].some(e=>n.getAll(e).length>1)||r.getAll(`t`).length>1)return;let i;if(Mn.has(t.hostname)&&t.pathname===`/watch`)i=n.get(`v`)??void 0;else{if(n.has(`v`))return;t.hostname===`youtu.be`?i=/^\/([A-Za-z0-9_-]{11})\/?$/u.exec(t.pathname)?.[1]:Mn.has(t.hostname)?i=/^\/(?:shorts|live|embed)\/([A-Za-z0-9_-]{11})\/?$/u.exec(t.pathname)?.[1]:Nn.has(t.hostname)&&(i=/^\/embed\/([A-Za-z0-9_-]{11})\/?$/u.exec(t.pathname)?.[1])}if(!i||!Pn.test(i))return;let a=An(n.get(`start`)??n.get(`t`)??r.get(`t`));if(a===void 0)return;let o=new URL(`https://www.youtube.com/watch`);o.searchParams.set(`v`,i);let s=new URL(`https://www.youtube-nocookie.com/embed/${i}`);return s.searchParams.set(`playsinline`,`1`),a>0&&(o.searchParams.set(`t`,String(a)),s.searchParams.set(`start`,String(a))),{videoId:i,startSeconds:a,watchUrl:o.href,embedUrl:s.href,thumbnailUrl:`https://i.ytimg.com/vi/${i}/hqdefault.jpg`}}var Mn,Nn,Pn;function Fn(){return(Fn=e((()=>{Mn=new Set([`youtube.com`,`www.youtube.com`,`m.youtube.com`]),Nn=new Set([`youtube-nocookie.com`,`www.youtube-nocookie.com`]),Pn=/^[A-Za-z0-9_-]{11}$/u})))()}function In(e){if(!e.startsWith(Gn))return;let t=JSON.parse(e.slice(9));if(!Array.isArray(t)||t.length!==2||typeof t[0]!=`string`||!t[0]||typeof t[1]!=`string`||!t[1])throw Error(`Invalid outbox recovery transfer`);return{account:t[0],sourceId:t[1]}}function V(e,t){return JSON.stringify(e)===JSON.stringify(t)}function H(e,t){let n=t.slice(t.indexOf(`:`)+1),r=e.sessions[n];return t.startsWith(`legacy-session:`)?r&&{sourceVersion:4,sourceScopeKey:n,session:r}:e.recovery[n]}function Ln(e,t){let n=t.slice(t.indexOf(`:`)+1);t.startsWith(`legacy-session:`)?delete e.sessions[n]:delete e.recovery[n]}function Rn(e,t,n){let r=[n],i=t.unscopedKey+`:account:`;for(let n=0;n<e.length;n++){let a=e.key(n);a?.startsWith(i)&&r.push(D(e,{...t,key:a,recoveryScope:decodeURIComponent(a.slice(i.length))}))}return r.flatMap(e=>Object.entries(e.recovery).flatMap(([e,t])=>{let n=In(e);return n?[{...n,entry:t}]:[]}))}function zn(e){let t=u();if(!t)throw Error(`Browser storage is unavailable`);let n=k(e),r=D(t,n),i=n.recoveryScope?D(t,Ee(e.settings?.gatewayUrl)):null,a={},o=(e,t,r=!1)=>{let i=In(e)?.account;if(i&&i!==n.recoveryScope)return;let o=r&&!i?`legacy-recovery:`+e:e;if(a[o]&&!V(a[o],t))throw Error(`Conflicting outbox recovery transfer`);a[o]=t};for(let[e,t]of Object.entries(r.recovery))o(e,t);if(i){let n=Rn(t,Ee(e.settings?.gatewayUrl),i),r=(e,t)=>n.some(n=>n.sourceId===e&&V(n.entry,t));for(let[e,t]of Object.entries(i.sessions)){let n=`legacy-session:`+e,i={sourceVersion:4,sourceScopeKey:e,session:t};r(n,i)||(a[n]=i)}for(let[e,t]of Object.entries(i.recovery))r(`legacy-recovery:`+e,t)||o(e,t,!0)}return{entries:Object.entries(a).filter(([,t])=>(Pe(t.session)||!!t.session.queue?.length)&&(t.session.queue??[]).every(t=>O(e,t))).map(([e,t])=>Object.assign({},t,{id:e,owner:{gatewayOwner:n.gatewayOwner,recoveryScope:n.recoveryScope}})),blocked:r.recoveryBlocked===!0||i?.recoveryBlocked===!0}}function Bn(e,t){let n=u(),i=S(e);if(!n||!i||!r(e)||e.selectedChatSessionIncognito||Ke(t.sessionKey)||e.connected&&e.client&&!e.client.recoveryScopeReady)return null;let a=k(e),s=D(n,a);ke(s,e);let c=l(o(e,t.sessionKey,t.agentId)),d=s.sessions[c]??null;return{scope:t,gatewayOwner:a.gatewayOwner,recoveryScope:i,session:JSON.stringify(d),input:JSON.stringify([e.sessionKey,e.currentSessionId,e.connectionEpoch,e.chatMessage,e.chatMentions,e.chatGoalDraftMode,e.chatReplyTarget,e.chatAttachments,e.chatQueue]),revision:Se(n,a.key,c,d?.draftRevision).latestAttempt}}function Vn(e,t,n,r=0){let i=Wn(e,t,n,r);return i===`completed`?`restored`:i}function Hn(e,t,n=()=>!0){let r=Wn(e,t,null,0,n);return r===`completed`?`discarded`:r}function Un(e,t){if(!t.length||!e.sessionKey||!r(e))return`unchanged`;let n=e.chatMessages,i=e.currentSessionId,a=l(o(e,e.sessionKey)),s=()=>e.chatMessages===n&&e.currentSessionId===i&&!!e.sessionKey&&l(o(e,e.sessionKey))===a,c=e=>{if(e.sessionId&&e.sessionId!==i)return!1;let t=je(n,e.sendRunId,!0);return!(!t||t.id===null&&t.sequence===null)},u=!1;for(let n of t){let t=Ie(n.sourceScopeKey);if(!t||l(t)!==a||!n.session.queue?.some(c)||(n.id.startsWith(`legacy-session:`)||n.id.startsWith(`legacy-recovery:`))&&(Pe(n.session)||!n.session.queue.every(c)))continue;let r=Wn(e,n,null,0,s,c);if(r!==`completed`)return r;u=!0}return u?`retired`:`unchanged`}function Wn(e,t,n,r=0,i=()=>!0,a){let s=u();if(!s)return`storage-failed`;if(U.has(s))return`conflict`;U.add(s);try{let c=e.client,d=k(e),f=e.connectionEpoch,p=()=>i()&&u()===s&&e.client===c&&e.connectionEpoch===f&&!e.selectedChatSessionIncognito&&!Ke(e.sessionKey)&&!!d.recoveryScope&&t.owner.gatewayOwner===d.gatewayOwner&&t.owner.recoveryScope===d.recoveryScope&&JSON.stringify(k(e))===JSON.stringify(d)&&(!n||JSON.stringify(Bn(e,n.scope))===JSON.stringify(n));if(!p())return`conflict`;let m=(e,t,n,r={})=>Ne(s,e,t,{requiredSessionKey:r.requiredSessionKey,beforeCommit:()=>{if(r.validate&&!r.validate()||JSON.stringify(D(s,e))!==n||!p())throw new W}}),h=t=>{if(!n)return null;let r=o(e,n.scope.sessionKey,n.scope.agentId),i=l(r),a=t.sessions[i];return i!==l(n.scope)||a?.draft||a?.goalMode||a?.replyTarget||a?.queue?.length?null:{scope:r,key:i}},g=D(s,d);if(n&&!h(g))return`conflict`;let{id:_,owner:ee,...v}=t,y=Ee(e.settings?.gatewayUrl),te=In(_),b=te?.account,x=te?.sourceId??_,S=_,ne=!!(b||_.startsWith(`legacy-`)),re=()=>{if(!ne)return!0;let e=D(s,y);return!e.recovery[S]&&!V(H(e,x),v)};if(b||_.startsWith(`legacy-`)){if(b&&b!==d.recoveryScope)return`conflict`;let n=D(s,y);if(S=b?_:Gn+JSON.stringify([d.recoveryScope,_]),!b){let r=H(n,_);if(r){if(!V(r,v)||Rn(s,y,n).some(e=>e.sourceId===_&&V(e.entry,v))||n.recovery[S]||g.recovery[S]||!(t.session.queue??[]).every(t=>O(e,t))||!p())return`conflict`;let i=JSON.stringify(n);if(n.recovery[S]=v,Ln(n,_),m(y,n,i),n=D(s,y),!V(n.recovery[S],v))return`storage-failed`}}let r=n.recovery[S],i=g.recovery[S];if(!r&&!i||r&&!V(r,v)||i&&!V(i,v)||!(t.session.queue??[]).every(t=>O(e,t))||!p())return`conflict`;if(b&&V(H(n,x),v)){let e=JSON.stringify(n);if(n.recovery[S]=v,Ln(n,x),m(y,n,e),n=D(s,y),r=n.recovery[S],!V(r,v)||V(H(n,x),v))return`storage-failed`}if(r){if(g=D(s,d),g.recovery[S]&&!V(g.recovery[S],v))return`conflict`;if(!g.recovery[S]){if(!p())return`conflict`;let e=JSON.stringify(g);if(g.recovery[S]=v,m(d,g,e),g=D(s,d),!V(g.recovery[S],v))return`storage-failed`}if(n=D(s,y),!V(n.recovery[S],v)||V(H(n,x),v)||!p())return`conflict`;let e=JSON.stringify(n);if(delete n.recovery[S],m(y,n,e),!re())return`conflict`}g=D(s,d)}if(!V(g.recovery[S],v)||!(t.session.queue??[]).every(t=>O(e,t))||!p())return`conflict`;let ie=JSON.stringify(g),C;if(n){let e=h(g);if(!e)return`conflict`;let{scope:i}=e;C=e.key;let a=t.session;g.sessions[C]={...a,awaitingDefaults:void 0,draftRevision:ge(Math.max(r,n.revision,a.draftRevision??0)),queue:a.queue?.map(e=>Object.assign({},e,i,{storageScope:JSON.stringify([n.gatewayOwner,n.recoveryScope]),sendState:e.sendState===`held`?`held`:(e.sendAttempts??0)>0||e.sendState===`unconfirmed`?`unconfirmed`:`failed`,sendError:e.sendError??`Recovered message. Review this destination and retry only if it did not arrive.`}))}}let w=g.recovery[S],T=a?w.session.queue?.filter(e=>!a(e)):[],E=a&&(Pe(w.session)||T?.length)?{...w,session:ve({...w.session,queue:T})}:void 0;if(E?g.recovery[S]=E:delete g.recovery[S],!p())return`conflict`;m(d,g,ie,{requiredSessionKey:C,validate:re});let ae=D(s,d);return!V(ae.recovery[S],E)||C!==void 0&&JSON.stringify(ae.sessions[C])!==JSON.stringify(ve(g.sessions[C]))?`storage-failed`:(Me(),`completed`)}catch(e){return e instanceof W?`conflict`:`storage-failed`}finally{U.delete(s)}}var Gn,U,W;function Kn(){return(Kn=e((()=>{Xe(),re(),c(),Fe(),Ae(),xe(),_e(),De(),Gn=`transfer:`,U=new WeakSet,W=class extends Error{}})))()}var G,qn;function Jn(){return(Jn=e((()=>{t(),G={chat:{detailPanel:{close:`Close sidebar`,copyPath:`Copy path`,discard:`Discard`,editFile:`Edit file`,searchInFile:`Search in file`,showInFiles:`Show in Files`,unavailable:`Unable to open`,outsideSessionBoundary:`This file is outside {session}'s workspace, and you can't open it.`,assetsUnavailable:`Some assets couldn't be loaded ({count})`,previousMatch:`Previous match`,nextMatch:`Next match`,overwrite:`Overwrite`,viewRawText:`View Raw Text`,viewSource:`Source`,renderedMarkdown:`Rendered Markdown`,renderedMarkdownHint:`Sanitized rich-text preview for quick reading.`,noPreviewableMarkdown:`No previewable markdown content.`,noContent:`No content available`,fullContentOversized:`Full content is unavailable because the stored transcript entry is too large to return safely.`,fullContentNotVisible:`Full content is unavailable because this transcript entry does not have a visible WebChat projection.`,fullContentUnavailable:`Full content is no longer available for this transcript entry.`,copyContents:`Copy file contents`,fileChanged:`File changed on disk since it was loaded.`,renderPreview:`Render preview`,imagePreview:`Image preview`,file:`File`,markdownPreview:`Markdown preview`,toolDetails:`Tool details`,reloadFailed:`Failed to reload the latest file.`,reloadBlocked:`Save or discard your file edits before reloading.`,draftRecovery:{review:`Review file drafts`,description:`Copy or download unsaved edits before discarding them. This only changes drafts in this tab, not files on disk. After resolving all drafts, try Refresh again.`,copy:`Copy {name}`,download:`Download {name}`,discard:`Discard {name}`,keep:`Keep drafts`,changed:`These edits changed. Close this dialog and review the drafts again.`,copyFailed:`Could not copy the edits. Select the text or download the draft instead.`},overwriteLoadFailed:`Failed to load the latest file before overwriting.`,fullContentLoadFailed:`Failed to load full content: {error}`}},filePreview:{bundle:{binary:`This binary file is included in the bundle but cannot be displayed as text.`,"too-large":`This file exceeds the preview limit. Its contents have not been truncated or loaded.`,unavailable:`This file could not be read safely or is unavailable. Close and reopen the skill to try again.`,incomplete:`Some bundle content is unavailable. Select a file to see its status.`},listLabel:`Files`,searchPlaceholder:`Search files…`,readOnly:`read-only`,emptyTitle:`No files match`,emptySubtitle:`Try another file name or content search.`,copyFile:`Copy file`,fileCount:`{count} files`,filteredFileCount:`{count}/{total} files`,noMatches:`No files match.`,navigate:`navigate`,kind:{text:`Text`,shell:`Shell`,file:`File`}}},qn=Object.assign(()=>{Object.assign(s.chat.detailPanel,G.chat.detailPanel),Object.assign(s.filePreview,G.filePreview)},{catalog:G})})))()}function K(e,t,n){return Math.min(n,Math.max(t,Number.isFinite(e)?Math.round(e):t))}function Yn(e,t){return{name:e.name,w:e.w,h:e.h,order:t}}function q(e,t=J){return e.map(e=>({name:e.name,w:K(e.w,1,12),h:K(e.h,1,t),order:Number.isFinite(e.order)?e.order:0})).toSorted((e,t)=>e.order-t.order||e.name.localeCompare(t.name)).map(Yn)}function Xn(e,t,n,r,i){let a=(1<<r)-1<<t;for(let t=n;t<n+i;t+=1)if((e[t]??0)&a)return!1;return!0}function Zn(e,t){for(let n=0;;n+=1)for(let r=0;r<=12-t.w;r+=1)if(Xn(e,r,n,t.w,t.h)){let i=(1<<t.w)-1<<r;for(let r=n;r<n+t.h;r+=1)e[r]=(e[r]??0)|i;return{name:t.name,x:r,y:n,w:t.w,h:t.h}}}function Qn(e,t=J){return $n(q(e,t))}function $n(e){let t=[];return e.map(e=>Zn(t,e))}function er(e,t){return t.x>=e.x&&t.x<e.x+e.w&&t.y>=e.y&&t.y<e.y+e.h}function tr(e,t,n){let r=q(e),i=r.findIndex(e=>e.name===t);if(i<0)return r;let a=$n(r),o=a.find(e=>e.name===n.name)??n,s={x:K(o.x,0,11),y:Math.max(0,Number.isFinite(o.y)?Math.floor(o.y):0)},c=a.find(e=>e.name===t);if(c&&er(c,s))return r;let l=r.splice(i,1),u=a.find(e=>e.name!==t&&er(e,s))??a.filter(e=>e.name!==t&&(e.y>s.y||e.y===s.y&&e.x>=s.x)).toSorted((e,t)=>e.y-t.y||e.x-t.x)[0],d=u?r.findIndex(e=>e.name===u.name):r.length;return r.splice(Math.max(0,d),0,...l),r.map(Yn)}function nr(e,t,n,r){return q(e).map(e=>e.name===t?{name:e.name,w:K(n,1,12),h:K(r,1,J),order:e.order}:e)}function rr(e,t,n){let r=q(e),i=r.findIndex(e=>e.name===t);if(i<0)return r;let a=n===`left`||n===`up`?-1:1,o=Math.min(r.length-1,Math.max(0,i+a));return o!==i&&r.splice(o,0,...r.splice(i,1)),r.map(Yn)}function ir(e){return`grid-column: ${e.x+1} / span ${e.w}; grid-row: ${e.y+1} / span ${e.h};`}function ar(){return typeof window.matchMedia==`function`&&!window.matchMedia(`(hover: hover) and (pointer: fine)`).matches?pr:0}function or(e,t,n){if(!(e.contentKind!==`html`||e.heightMode===`fixed`||t===void 0||!Number.isFinite(t)||t<=0))return t+2+n+((e.presentation??`card`)===`card`?24:0)}function sr(e){return e*56+(e-1)*12}function cr(e,t,n=0,r=fr){let i=or(e,t,n);if(i===void 0)return e.sizeH;let a=Math.ceil((i+12)/68);return Math.min(r,Math.max(dr,a))}function lr(e,t,n=0,r=fr){let i=or(e,t,n);if(i!==void 0)return Math.min(i,sr(cr(e,t,n,r)))}function ur(e,t,n=!1,r=``){let i=ar();return e.map(e=>({name:e.name,w:e.sizeW,h:cr(e,t.get(e.name),e.name===r?0:i,n?240:void 0),order:e.position}))}var J,dr,fr,pr,mr;function hr(){return(hr=e((()=>{J=20,dr=2,fr=20,pr=38,mr=`(hover: hover) and (pointer: fine)`})))()}function gr(e){let t=A(e.replace(/\s+/g,` `).trim(),vr);return t?`Regarding "${t}": `:null}function _r(e){return e.trim().replace(/^\/(?:btw|side)(?::\s*|\s+|$)/i,``).trim()}var vr;function yr(){return(yr=e((()=>{vr=300})))()}function Y(e){return typeof e==`string`?C(e):void 0}function br(e,t={}){let n=P(e),r=P(n?.messages),i=P(r?.queue),a=Y(P(i?.byChannel)?.webchat)??Y(i?.mode),o=Y(t.effectiveMode),s=Y(t.sessionMode);if(s)return s;if(t.configNeedsApply)return o;if(o||t.sessionMetadataLoaded!==!1&&n)return a??o??`steer`}function xr(e,t){return te(e)??t}function Sr(){return(Sr=e((()=>{ae(),ue(),b()})))()}var Cr,wr;function Tr(){return(Tr=e((()=>{t(),Cr={chat:{pullRequests:{checksQueued:`Queued`,checksSkippedCount:`{count} skipped`,checksLoading:`Loading jobs and steps…`,checksEmpty:`No check details are available for this commit.`,checksUnavailable:`Couldn’t load all CI details. Try again or open the checks on GitHub.`,checksStale:`Some CI details are unavailable or out of date. Try again or open the job on GitHub.`,checksRateLimited:`GitHub’s rate limit was reached. CI details may be out of date.`,checksRetryAfter:`Try again in {duration}.`,checksNoSteps:`This check does not provide GitHub Actions steps.`,checksStepsUnavailable:`Step details are not available yet.`,openJob:`Open job on GitHub`,openCheck:`Open check details`,automationLabel:`Pull request automations`,automationAutoFix:`Auto-fix CI & address comments`,automationAutoMerge:`Auto-merge when ready`,automationAutoArchive:`Auto-archive on merge or close`,automationSchedulerDisabled:`The scheduler is disabled. Enabled jobs will not run.`,automationSessionRequired:`Automations need a verified session identity. Reopen this session and try again.`,automationReadRequired:`Connect with read access to view automations.`,automationAdminRequired:`Administrator access is required to change automations.`,automationLoadFailed:`Couldn’t load automations. Try again.`,automationSaveFailed:`Couldn’t confirm the change. Refresh to check the current state before trying again.`,automationScheduleDisabled:`Automatically disabled after {count} scheduling errors.`,automationFailureDisabled:`Automatically disabled after {count} failed runs.`,automationLastError:`Last error: {error}`,automationNoChecks:`No CI checks reported.`,automationRetry:`Try again`}}},wr=Object.assign(()=>Object.assign(s.chat.pullRequests,Cr.chat.pullRequests),{catalog:Cr})})))()}function Er(e){if(e.status!==503)return;let t=e.headers?.get(`retry-after`)?.trim();if(!t||!/^\d+$/.test(t))return;let n=Number(t)*1e3;return Number.isSafeInteger(n)&&n>0&&n<=jr?n:void 0}function Dr(e,t){X.get(e)===t&&(X.delete(e),t.retryTimer!==void 0&&(clearTimeout(t.retryTimer),t.retryTimer=void 0),t.controller.abort(),t.blobUrl&&URL.revokeObjectURL(t.blobUrl))}function Or(e,t){let n=X.get(e);n&&(n.consumers.delete(t),!(n.consumers.size>0||n.releaseTimer!==void 0)&&(n.releaseTimer=setTimeout(()=>{n.releaseTimer=void 0,!(X.get(e)!==n||n.consumers.size>0)&&Dr(e,n)},0)))}async function kr(e,t,n,r,i){i.unavailable=!1;let a=setTimeout(()=>i.controller.abort(),Ar),o=null,s=!1,c;try{for(let e of n.length>0?n:[``]){let n=await ne(t,{...e?{headers:{Authorization:`Bearer ${e}`}}:{},signal:i.controller.signal});if(n.ok){o=URL.createObjectURL(await n.blob());break}if(s=n.status===404,i.unavailable=r&&n.status===503,c=i.unavailable?Er(n):void 0,n.status!==401&&n.status!==403)break}}catch{}finally{clearTimeout(a)}if(X.get(e)!==i){o&&URL.revokeObjectURL(o);return}if(!o){if(s)return;if(i.unavailable&&i.consumers.size>0){c!==void 0&&i.retryAttempts<Mr&&(i.retryAttempts+=1,i.retryTimer=setTimeout(()=>{i.retryTimer=void 0,X.get(e)===i&&i.consumers.size!==0&&(i.controller=new AbortController,kr(e,t,n,r,i))},c));return}Dr(e,i);return}i.unavailable=!1,i.blobUrl=o;for(let e of i.consumers.values())e()}var Ar,jr,Mr,X,Nr;function Pr(){return(Pr=e((()=>{ie(),Ar=3e4,jr=3e4,Mr=3,X=new Map,Nr=class{constructor(e,t={}){this.host=e,this.options=t,this.owner=Symbol(`authenticated-avatar-route-owner`),this.keys=new Set,this.connected=!1,this.onUpdate=()=>{this.connected&&this.host.requestUpdate()},e.addController(this)}hostConnected(){this.connected=!0,this.stopAuthRecovery??=x(()=>{for(let e of this.keys){let t=X.get(e);t?.unavailable&&t.retryTimer===void 0&&Dr(e,t)}this.onUpdate()}),this.host.requestUpdate()}hostDisconnected(){this.connected=!1,this.stopAuthRecovery?.(),this.stopAuthRecovery=void 0,this.reset()}reset(){for(let e of this.keys)Or(e,this.owner);this.keys.clear()}withActiveRoutes(e){let t=this.keys;this.keys=new Set;try{return e()}finally{for(let e of t)this.keys.has(e)||Or(e,this.owner)}}resolve(e,t,n=``){if(!e.startsWith(`/`))return e;if(!this.connected)return null;let r=this.options.retryUnavailable===!0,i=JSON.stringify([r,t,n,e]),a=X.get(i);return a||(a={blobUrl:null,consumers:new Map,controller:new AbortController,releaseTimer:void 0,retryTimer:void 0,retryAttempts:0,unavailable:!1},X.set(i,a),kr(i,e,t,r,a)),a.releaseTimer!==void 0&&(clearTimeout(a.releaseTimer),a.releaseTimer=void 0),a.consumers.set(this.owner,this.onUpdate),this.keys.add(i),a.blobUrl}}})))()}function Fr(e){return e===`web_search`||e===`web_fetch`?e:void 0}function Z(e){if(typeof e!=`string`||e.length>2048||!oe(e))return null;let t=new URL(e);return t.username||t.password?null:t}function Q(e){let t=new URL(e);return t.hash=``,t.href}function Ir(e){return e.map(e=>e.type===`text`||e.type===`code_inline`?e.content:e.type===`softbreak`||e.type===`hardbreak`?` `:``).join(``).replace(/\s+/gu,` `).trim()}function Lr(e){return Yr.parse(lt(e),{})}function Rr(e,t){if(typeof e!=`string`||e.length>qr)return;let n=t===`web_search`?`Web Search`:`Web Fetch`,r=/(?:^|\n)<<<EXTERNAL_UNTRUSTED_CONTENT id="([a-f0-9]{16})">>>\r?\nSource: ([^\r\n]+)\r?\n---\r?\n([\s\S]*?)\r?\n<<<END_EXTERNAL_UNTRUSTED_CONTENT id="\1">>>/u.exec(e);return r?.[2]===n&&A(r[3]?.trim()??``,Kr)||void 0}function zr(e,t){let n=Rr(e,t);if(!n)return;let r=Lr(n).filter(e=>e.type===`inline`).map(e=>Ir(e.children??[])).join(` `).trim();return r?A(r,180):void 0}function Br(e,t){let n=Rr(e,t);if(!n)return;let r=Lr(n),i=r.flatMap((e,n)=>e.type===`inline`&&r[n-1]?.type===`paragraph_open`&&(t===`web_search`||r[n-1]?.level===0)?[Ir(e.children??[])]:[]).find(e=>e.length>=(t===`web_fetch`?60:1));if(i)return i.length>Jr?`${A(i,279).trimEnd()}…`:i}function Vr(e){return e.details===void 0?!e.outputText||e.outputText.length>1e5?null:He(e.outputText)??null:F(e.details)}function Hr(e,t,n){let r=Vr(e),i=F(r?.externalContent);if(!r||i?.source!==t||i.untrusted!==!0||i.wrapped!==!0)return[];let a=(e,r,i,a=[Q(e)])=>a.some(e=>n.has(e))?[{candidate:{url:e,name:t,title:r.title,excerpt:i?r[i]:void 0},keys:a}]:[];if(t===`web_search`){let e=r.kind===`results`?r.results:r.kind===`answer`?r.citations:void 0;return Array.isArray(e)?e.slice(0,20).flatMap(e=>{let t=F(e),n=Z(t?.url);return t&&n?a(n,t,r.kind===`results`?`snippet`:void 0):[]}):[]}if(typeof r.status!=`number`||r.status<200||r.status>=300)return[];let o=Z(r.url),s=Z(r.finalUrl);return o&&s?a(s,r,`text`,[...new Set([Q(o),Q(s)])]):[]}function Ur(e){let t=e.source,n=e.page&&Br(e.page.excerpt,`web_fetch`),r=n||e.search&&Br(e.search.excerpt,`web_search`);return{url:t.url.href,title:zr(t.title,t.name)??t.url.hostname,domain:t.url.hostname,...r?{excerpt:r,excerptKind:n?`page`:`search`}:{}}}function Wr(e){let t=F(e.answer);if(!t||_t(t)!==e.runId)return[];let n=we(e.answer);if(!n||n.length>Kr)return[];let r=$.get(t),i=r?.text===n?r.links:Lr(n).flatMap(e=>(e.children??[]).flatMap(e=>{let t=e.type===`link_open`?Z(e.attrGet(`href`)):null;return t?[Q(t)]:[]}));if(r?.text!==n&&$.set(t,{text:n,links:i,inputs:[],previews:[]}),i.length===0)return[];let a=e.basePath??y(globalThis.location.pathname)[0],o=[e.runId,a,e.sessionPublicOrigin,globalThis.location.origin],s=[],c=!1;frameInputs:for(let n of e.groups)if(o.push(n.runId),n.runId===e.runId)for(let{message:e}of n.messages){if(o.push(e),e===t){c=!0;break frameInputs}let n=F(e);if(n){s.push(n),o.push(n.role,n.toolName,n.tool_name,n.content,_t(n));for(let e of pe(n))o.push(e,e.callId,e.runId,e.name,e.completed,e.live,e.isError,e.outputText,e.details)}}if(!c)return[];if(r?.text===n&&o.length===r.inputs.length&&o.every((e,t)=>Object.is(e,r.inputs[t])))return r.previews;let l=new Set(i),u=new Map,d=new Map,f=new Map;for(let t of s){let n=typeof t.role==`string`?he(t.role):``;if(n!==`assistant`&&n!==`tool`||_t(t)!==e.runId)continue;let r=Array.isArray(t.content)?t.content:[];if(r.some(t=>{let n=F(t),r=j(n?.runId);return n&&(ee(n.type)||_(n.type))&&r&&r!==e.runId}))continue;let i=j(t.toolName)??j(t.tool_name);for(let n of r){let r=F(n),i=r&&ee(r.type)?g(r)??j(t.toolCallId):void 0,a=j(r?.name);i&&a&&f.set(gt(e.runId,i),a)}for(let n of pe(t)){if(n.runId!==e.runId||Le(n,!1)!==`succeeded`)continue;let t=Fr((n.callId?f.get(gt(e.runId,n.callId)):void 0)??i);if(!(!t||n.name!==t||i&&i!==t))for(let{candidate:e,keys:r}of Hr(n,t,l)){let n=Q(e.url),i=u.get(n)??{source:e};if(t===`web_fetch`){i.source=e,i.page=e,i.search??=r.map(e=>u.get(e)?.search).find(e=>e!==void 0),l.add(n);for(let e of r)e!==n&&d.set(e,n);d.delete(n)}else i.search?.excerpt||(i.search=e,i.page||(i.source=e));u.set(n,i)}}}let p=new Map,m=t=>mt(t)!==null||at(t,{basePath:a,publicOrigin:e.sessionPublicOrigin})!==null;for(let e of i){if(m(e))continue;let t=e;for(let e=d.get(t);e;e=d.get(t))t=e;let n=u.get(t);if(n&&!p.has(t)&&!m(t)&&p.set(t,Ur(n)),p.size>=Gr)break}let h=[...p.values()];return $.set(t,{text:n,links:i,inputs:o,previews:h}),h}var Gr,Kr,qr,Jr,Yr,$;function Xr(){return(Xr=e((()=>{T(),qe(),h(),v(),ut(),it(),pt(),ct(),ht(),vt(),Te(),be(),Oe(),Gr=8,Kr=3e4,qr=1e5,Jr=280,Yr=st(),$=new WeakMap})))()}export{Gt as $,Vn as A,vn as B,ir as C,Hn as D,Bn as E,Cn as F,nn as G,hn as H,Tn as I,en as J,an as K,En as L,Fn as M,jn as N,Kn as O,Dn as P,Jt as Q,kn as R,nr as S,qn as T,mn as U,pn as V,rn as W,Qt as X,Kt as Y,qt as Z,lr as _,Tr as a,It as at,rr as b,xr as c,Dt as ct,_r as d,wt as dt,Wt as et,yr as f,Ct as ft,cr as g,ur as h,Pr as i,Ft as it,Un as j,zn as k,br as l,Tt as lt,ar as m,Xr as n,Ht as nt,wr as o,At as ot,mr as p,$t as q,Nr as r,Pt as rt,Sr as s,Ot as st,Wr as t,jt as tt,gr as u,Et as ut,hr as v,Jn as w,tr as x,Qn as y,yn as z};