@oonacode/win32-x64 0.3.286 → 0.3.290
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,7 +12,7 @@ Error generating stack: `+e.message+`
|
|
|
12
12
|
`).map(e=>e.trim().replace(/^#+\s*/,``).replace(/^\*+|\*+$/g,``).trim()).find(e=>e.length>0&&!e.startsWith(`<`)),n=t?`Subagent message — ${t}`:`Subagent message`;return n.length>96?`${n.slice(0,95)}…`:n}if(t.startsWith(`[Your previous response had no visible output.`))return`No visible reply — asked the model to answer`;if(t.startsWith(`Your response above was stopped by a safety classifier`))return`Response stopped by safety classifier`;if(t.startsWith(`The previous response failed to produce a valid tool call.`))return`Invalid tool call — asked the model to retry`;if(t.startsWith(`Output token limit hit. Resume directly`))return`Output token limit hit — asked the model to continue`;let n=e.split(`
|
|
13
13
|
`).map(e=>e.trim()).find(e=>e.length>0);if(!n)return`Engine note`;if(n.startsWith(`Base directory for this skill:`)){let e=n.slice(30).trim().replace(/[\\/]+$/,``).split(/[\\/]/).pop()??``;return e?`Skill instructions — ${e}`:`Skill instructions`}let r=n.replace(/^#+\s*/,``).replace(/^<system-reminder>\s*/,``);return r.length>96?`${r.slice(0,95)}…`:r||`Engine note`}var he=/\[Image: (?:source: [^\]\n]+?|original \d+x\d+, displayed at \d+x\d+\. Multiply coordinates by \d+(?:\.\d+)? to map to original image\.)(?:, original \d+x\d+, displayed at \d+x\d+\. Multiply coordinates by \d+(?:\.\d+)? to map to original image\.)?\]/g;function ge(e){return e.includes(`[Image: `)?e.replace(he,``):e}function _e(e){if(typeof e!=`object`||!e)return null;let t=e;return t.type!==`queue-operation`||t.operation!==`remove`||typeof t.content!=`string`||t.content.length===0?null:{text:t.content,deliveredAt:typeof t.timestamp==`string`?t.timestamp:null}}function ve(e){if(typeof e!=`object`||!e)return null;let t=e;if(t.type!==`attachment`||t.attachment?.type!==`queued_command`)return null;let n=t.attachment.prompt,r;if(typeof n==`string`)r=n;else if(Array.isArray(n))r=ge(n.filter(e=>typeof e==`object`&&!!e&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(`
|
|
14
14
|
`)).trim();else return null;let i=t.attachment.timestamp??t.timestamp,a=t.isMeta===!0||t.attachment.isMeta===!0||ue(r);return{text:r,content:n,sourceUuid:typeof t.attachment.source_uuid==`string`?t.attachment.source_uuid:null,timestamp:typeof i==`string`?i:null,...a?{isMeta:!0}:{}}}var ye=`<task-notification>`;function be(e){return e.trimStart().startsWith(ye)}function xe(e,t){let n=RegExp(`<${t}>([\\s\\S]*?)</${t}>`).exec(e);return(n?n[1].trim():``)||null}function Se(e){let t=[ye];return e.taskId&&t.push(`<task-id>${e.taskId}</task-id>`),e.toolUseId&&t.push(`<tool-use-id>${e.toolUseId}</tool-use-id>`),e.status&&t.push(`<status>${e.status}</status>`),e.summary&&t.push(`<summary>${e.summary}</summary>`),t.push(`</task-notification>`),t.join(`
|
|
15
|
-
`)}function Ce(e){return{taskId:xe(e,`task-id`),toolUseId:xe(e,`tool-use-id`),status:xe(e,`status`),summary:xe(e,`summary`),note:xe(e,`note`)}}var we=[`low`,`medium`,`high`,`xhigh`,`max`,`ultracode`],Te=[`low`,`medium`,`high`,`xhigh`,`max`];function Ee(e){return typeof e==`string`&&we.includes(e)}function De(e,t){if(Ee(e)&&!(!t||!t.includes(e)))return e}function Oe(e){if(e)return De(e.defaultEffort,ke(e))}function ke(e){return e?Array.isArray(e.effortLevels)?e.effortLevels:e.supportsThinking===!1?[]:Te:[]}function Ae(e){return e?.supportsTools!==!1}function je(e){return e.trim().replace(/\s+/g,` `).toLowerCase()}function Me(e){return e.replace(/\s+/g,` `).toLowerCase()}function Ne(e){let t=e.split(` `).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`\\s+`);return new RegExp(t,`gi`)}function Pe(e,t={}){let n=e.trim().replace(/\s+/g,` `);if(n===``)return null;let r=n.split(` `).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`\\s+`),i=t.wholeWord?`(?<![\\p{L}\\p{N}_])${r}(?![\\p{L}\\p{N}_])`:r;return new RegExp(i,t.caseSensitive?`gu`:`giu`)}function Fe(e,t,n={}){let r=Pe(t,n);return r!==null&&r.test(e)}function Ie(e,t,n){let r=je(t);if(r===``)return[];let i=[];for(let t=0;t<e.length;t++){let a=n(e[t]);a!==``&&Me(a).includes(r)&&i.push(t)}return i}function Le(e,t,n){return n<=0?-1:e<0||e>=n?t>=0?0:n-1:((e+t)%n+n)%n}function Re(e,t){return t<=0?`no matches`:`${e<0||e>=t?0:e+1}/${t}`}var ze={label:`Send now`,warning:`Stops what the agent is doing right now and sends this message immediately. The step that is running is cut.`,alreadyRead:`The agent has already read this message — there is nothing to hurry.`,allWarning:`Stops what the agent is doing right now and sends every queued message at once. The step that is running is cut.`,allRead:`The agent has already read these — there is nothing to hurry.`},Be={toolPacks:`tool_packs`,conversations:`conversations`,chatAbout:`chat_about`,scheduledTasks:`scheduled_tasks`,promptAck:`prompt_ack`,voiceSummaries:`voice_summaries`,chatFiles:`chat_files`,reach:`reach`,fileFetch:`file_fetch`,customModel:`custom_model`,removeEntries:`remove_entries`};function Ve(e){return typeof e==`object`&&!!e&&typeof e.type==`string`}var z={health:`/api/v1/health`,info:`/api/v1/info`,sessions:`/api/v1/sessions`,adoptLegacySessions:`/api/v1/sessions/adopt-legacy`,session:e=>`/api/v1/sessions/${e}`,sessionEntries:e=>`/api/v1/sessions/${e}/entries`,sessionSearch:`/api/v1/sessions/search`,agentTools:`/api/v1/agent-tools`,connectors:`/api/v1/connectors`,connector:e=>`/api/v1/connectors/${e}`,connectorSignIn:e=>`/api/v1/connectors/${e}/sign-in`,connectorSkills:e=>`/api/v1/connectors/${e}/skills`,mcpServers:`/api/v1/mcp-servers`,mcpServer:e=>`/api/v1/mcp-servers/${e}`,mcpServerTest:e=>`/api/v1/mcp-servers/${e}/test`,mcpServerTestDraft:`/api/v1/mcp-servers/test`,commands:`/api/v1/commands`,sessionCommands:e=>`/api/v1/sessions/${e}/commands`,skills:`/api/v1/skills`,skill:e=>`/api/v1/skills/${encodeURIComponent(e)}`,importClaudeSkills:`/api/v1/skills/import/claude`,modelSkills:`/api/v1/model-skills`,sessionModelSkills:e=>`/api/v1/sessions/${e}/model-skills`,sessionMessages:e=>`/api/v1/sessions/${e}/messages`,sessionPrompt:e=>`/api/v1/sessions/${e}/prompt`,sessionInterrupt:e=>`/api/v1/sessions/${e}/interrupt`,sessionQueued:(e,t)=>`/api/v1/sessions/${e}/queued/${encodeURIComponent(t)}`,sessionQueuedNow:(e,t)=>`/api/v1/sessions/${e}/queued/${encodeURIComponent(t)}/now`,sessionQueuedNowAll:e=>`/api/v1/sessions/${e}/queued/now`,sessionSavedPrompts:e=>`/api/v1/sessions/${e}/saved-prompts`,sessionSavedPrompt:(e,t)=>`/api/v1/sessions/${e}/saved-prompts/${encodeURIComponent(t)}`,sessionRemove:e=>`/api/v1/sessions/${e}/remove`,sessionModelUndo:e=>`/api/v1/sessions/${e}/model/undo`,sessionFork:e=>`/api/v1/sessions/${e}/fork`,sessionExport:e=>`/api/v1/sessions/${e}/export`,sessionsExportArchive:`/api/v1/sessions/export`,aiToolGrants:`/api/v1/ai-tools/grants`,aiToolGrant:e=>`/api/v1/ai-tools/grants/${e}`,aiToolMcp:`/api/v1/ai-tools/mcp`,sessionProject:e=>`/api/v1/sessions/${e}/project`,importClaude:`/api/v1/import/claude`,importSearch:`/api/v1/import/search`,sessionLink:e=>`/api/v1/sessions/${e}/link`,sessionSyncDown:e=>`/api/v1/sessions/${e}/sync-down`,projects:`/api/v1/projects`,projectInspect:`/api/v1/projects/inspect`,vaultProjects:`/api/v1/vault/projects`,vaultProject:e=>`/api/v1/vault/projects/${e}`,vaultNotes:`/api/v1/vault/notes`,vaultNote:e=>`/api/v1/vault/notes/${e}`,scheduledTasks:`/api/v1/scheduled-tasks`,scheduledTask:e=>`/api/v1/scheduled-tasks/${e}`,conversations:`/api/v1/conversations`,conversation:e=>`/api/v1/conversations/${e}`,conversationAction:(e,t)=>`/api/v1/conversations/${e}/${t}`,conversationsStopAll:`/api/v1/conversations/stop-all`,chatMessage:e=>`/api/v1/chat-messages/${e}`,sessionAbout:e=>`/api/v1/sessions/${e}/about`,agyStatus:`/api/v1/agy/status`,agyInstall:`/api/v1/agy/install`,agyLogin:`/api/v1/agy/login`,agyLoginCode:`/api/v1/agy/login/code`,museSetup:`/api/v1/muse/setup`,museLogin:`/api/v1/muse/login`,agyRequests:e=>`/api/v1/sessions/${e}/agy/requests`,agyRequestBody:(e,t)=>`/api/v1/sessions/${e}/agy/requests/${t}`,sessionAboutRegenerate:e=>`/api/v1/sessions/${e}/about/regenerate`,chatAbouts:`/api/v1/chat-abouts`,chatAboutsGenerateAll:`/api/v1/chat-abouts/generate-all`,chatAboutsGenerateAllStop:`/api/v1/chat-abouts/generate-all/stop`,chatAboutsGenerate:`/api/v1/chat-abouts/generate`,chatAboutsTranslationPlan:`/api/v1/chat-abouts/translation-plan`,sessionAboutTranslation:e=>`/api/v1/sessions/${e}/about/translation`,sessionVoiceSummaries:e=>`/api/v1/sessions/${e}/voice-summaries`,sessionVoiceSummary:(e,t)=>`/api/v1/sessions/${e}/voice-summaries/${t}`,sessionVoiceSummaryTranslations:(e,t)=>`/api/v1/sessions/${e}/voice-summaries/${t}/translations`,nextPrompts:`/api/v1/next-prompts`,nextPromptsReview:`/api/v1/next-prompts/review`,nextPromptsReviewStop:`/api/v1/next-prompts/review/stop`,sessionNextPrompt:e=>`/api/v1/sessions/${e}/next-prompt`,sessionNextPromptSent:e=>`/api/v1/sessions/${e}/next-prompt/sent`,sessionSeen:e=>`/api/v1/sessions/${e}/seen`,githubLink:`/api/v1/git/github`,githubLinkStart:`/api/v1/git/github/link`,providers:`/api/v1/providers`,providersActive:`/api/v1/providers/active`,providerTest:e=>`/api/v1/providers/${e}/test`,providerProbe:e=>`/api/v1/providers/${e}/probe`,providerSecret:e=>`/api/v1/providers/${e}/secret`,providerUsage:e=>`/api/v1/providers/${e}/usage`,models:`/api/v1/models`,settings:`/api/v1/settings`,account:`/api/v1/account`,accountLogin:`/api/v1/account/login`,accountLogout:`/api/v1/account/logout`,accountRemoveHost:`/api/v1/account/remove-host`,accountUnlock:`/api/v1/account/unlock`,accountPlan:`/api/v1/account/plan`,accountUsage:`/api/v1/account/usage`,accountLock:`/api/v1/account/lock`,accountResendVerification:`/api/v1/account/resend-verification`,accountLinkStart:`/api/v1/account/link/start`,accountLinkStatus:`/api/v1/account/link`,accountLinkCancel:`/api/v1/account/link/cancel`,accountApiKey:`/api/v1/account/api-key`,credentials:`/api/v1/credentials`,credential:e=>`/api/v1/credentials/${e}`,credentialTest:e=>`/api/v1/credentials/${e}/test`,syncNow:`/api/v1/sync/now`,subscriptionClaudeLogin:`/api/v1/subscription/claude/login`,subscriptionClaudeLoginState:`/api/v1/subscription/claude/login/state`,subscriptionClaudeLoginCode:`/api/v1/subscription/claude/login/code`,subscriptionClaudeLoginCancel:`/api/v1/subscription/claude/login/cancel`,subscriptionClaudeStatus:`/api/v1/subscription/claude`,subscriptionOauthLogin:e=>`/api/v1/subscription/oauth/${e}/login`,subscriptionOauthLoginState:e=>`/api/v1/subscription/oauth/${e}/login/state`,subscriptionOauthLoginCancel:e=>`/api/v1/subscription/oauth/${e}/login/cancel`,doctor:`/api/v1/doctor`,hostShutdown:`/api/v1/host/shutdown`,hostVaultUnlock:e=>`/api/v1/hosts/${encodeURIComponent(e)}/vault-unlock`,hosts:`/api/v1/hosts`,host:e=>`/api/v1/hosts/${e}`,hostSessions:e=>`/api/v1/hosts/${e}/sessions`,hostSessionEntries:(e,t)=>`/api/v1/hosts/${e}/sessions/${t}/entries`,hostSession:(e,t)=>`/api/v1/hosts/${e}/sessions/${t}`,hostSessionFork:(e,t)=>`/api/v1/hosts/${e}/sessions/${t}/fork`,hostSessionFiles:(e,t)=>`/api/v1/hosts/${e}/sessions/${t}/files`,hostSessionFile:(e,t)=>`/api/v1/hosts/${e}/sessions/${t}/files/content`,hostProjectsInspect:e=>`/api/v1/hosts/${e}/projects/inspect`,remoteWs:`/api/v1/relay/ws`,errorReport:`/api/v1/errors`,bugReport:`/api/v1/bug-reports`,sandboxRunToken:`/api/v1/sandbox/run-token`,sessionFiles:e=>`/api/v1/sessions/${e}/files`,sessionFile:e=>`/api/v1/sessions/${e}/files/content`,sessionFileSearch:e=>`/api/v1/sessions/${e}/files/search`,sessionLocalFile:e=>`/api/v1/sessions/${e}/local-file`,mediaOptions:`/api/v1/media/options`,sessionLocalFileGrant:e=>`/api/v1/sessions/${e}/local-file/grant`,sessionLocalFileStat:e=>`/api/v1/sessions/${e}/local-file/stat`,sessionLocalFileText:e=>`/api/v1/sessions/${e}/local-file/text`,sessionMedia:e=>`/api/v1/sessions/${e}/media`,sessionMediaContent:(e,t)=>`/api/v1/sessions/${e}/media/${t}/content`,sessionMediaGrant:e=>`/api/v1/sessions/${e}/media/grant`,sessionTmpFile:e=>`/api/v1/sessions/${e}/tmp-file`,saveTmpFile:`/api/v1/tmp-file`,sandboxRestore:`/api/v1/sandbox/restore`};function He(e){return e.enabled&&e.nextRunAt!==null}function Ue(e){if(He(e)||!e.updatedAt)return null;let t=Date.parse(e.updatedAt);return Number.isFinite(t)?new Date(t+864e6).toISOString():null}var We={busy:`This chat is working. Wait for it to finish, or press Stop, then try again.`,confirm:`This removes the messages from this chat and from what the model remembers. It cannot be undone.`,notAMessage:`That line is not one of your messages, so it cannot start a removal.`,notFound:`That message is not in this chat any more.`},Ge={health:`GET`,info:`GET`,listSessions:`GET`,createSession:`POST`,getSession:`GET`,updateSession:`PATCH`,deleteSession:`DELETE`,listEntries:`GET`,listMessages:`GET`,prompt:`POST`,interrupt:`POST`,cancelQueued:`DELETE`,sendQueuedNow:`POST`,sendQueuedNowAll:`POST`,removeEntries:`POST`,undoModelChange:`POST`,fork:`POST`,export:`GET`,exportArchive:`POST`,listAiToolGrants:`GET`,createAiToolGrant:`POST`,revokeAiToolGrant:`DELETE`,attachSessionProject:`POST`,listProjects:`GET`,scanClaudeSessions:`GET`,importClaudeSessions:`POST`,searchImportChats:`GET`,sessionLink:`GET`,syncSessionDown:`POST`,inspectProject:`GET`,listVaultProjects:`GET`,createVaultProject:`POST`,updateVaultProject:`PATCH`,deleteVaultProject:`DELETE`,listStickyNotes:`GET`,createStickyNote:`POST`,updateStickyNote:`PATCH`,deleteStickyNote:`DELETE`,listScheduledTasks:`GET`,createScheduledTask:`POST`,updateScheduledTask:`PATCH`,deleteScheduledTask:`DELETE`,listConversations:`GET`,getConversation:`GET`,conversationAction:`POST`,stopAllConversations:`POST`,cancelChatMessage:`DELETE`,getChatAbout:`GET`,updateChatAbout:`PATCH`,regenerateChatAbout:`POST`,listChatAbouts:`GET`,generateAllChatAbouts:`POST`,stopGenerateAllChatAbouts:`POST`,generateChatAbouts:`POST`,planChatAboutTranslations:`POST`,translateChatAbout:`POST`,listVoiceSummaries:`GET`,createVoiceSummary:`POST`,deleteVoiceSummary:`DELETE`,translateVoiceSummary:`POST`,listNextPrompts:`GET`,reviewNextPrompts:`POST`,stopNextPromptReview:`POST`,getNextPrompt:`GET`,suggestNextPrompt:`POST`,markNextPromptSent:`POST`,markSessionSeen:`POST`,searchEntries:`GET`,getGithubLink:`GET`,startGithubLink:`POST`,cancelGithubLink:`DELETE`,unlinkGithub:`DELETE`,listProviders:`GET`,setActiveProvider:`PUT`,providerTest:`POST`,providerProbe:`POST`,revealCredential:`GET`,listModels:`GET`,getSettings:`GET`,updateSettings:`PATCH`,getAccount:`GET`,login:`POST`,logout:`POST`,removeHostFromAccount:`POST`,unlock:`POST`,resendVerification:`POST`,linkStart:`POST`,linkStatus:`GET`,linkCancel:`POST`,listCredentials:`GET`,addCredential:`POST`,deleteCredential:`DELETE`,credentialTest:`POST`,syncNow:`POST`,claudeLogin:`POST`,claudeLoginState:`GET`,claudeLoginCode:`POST`,claudeLoginCancel:`POST`,claudeStatus:`GET`,oauthLogin:`POST`,oauthLoginState:`GET`,oauthLoginCancel:`POST`,doctor:`GET`,hostShutdown:`POST`,listHosts:`GET`,getHost:`GET`,updateHost:`PATCH`,listHostSessions:`GET`,deleteHostSession:`DELETE`,listHostSessionEntries:`GET`,errorReport:`POST`,bugReport:`POST`,listSessionFiles:`GET`,readSessionFile:`GET`,deleteSessionFile:`DELETE`,renameSessionFile:`POST`,searchSessionFiles:`GET`,writeSessionFileText:`PUT`,readLocalFile:`GET`,grantLocalFile:`POST`,statLocalPaths:`POST`,listChatMedia:`GET`,readChatMedia:`GET`,grantChatMedia:`POST`,listSavedPrompts:`GET`,saveSavedPrompt:`POST`,deleteSavedPrompt:`DELETE`,listCommands:`GET`,listSessionCommands:`GET`,listSkills:`GET`,deleteSkill:`DELETE`,scanClaudeSkills:`GET`,importClaudeSkills:`POST`,listChatSkills:`GET`,listSessionChatSkills:`GET`};function Ke(e){return typeof e==`object`&&!!e&&typeof e.type==`string`}function qe(e){return e===`attached`}var Je;function B(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Ye=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Xe=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Je=globalThis).__zod_globalConfig??(Je.__zod_globalConfig={});var Ze=globalThis.__zod_globalConfig;function Qe(e){return e&&Object.assign(Ze,e),Ze}function $e(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function et(e,t){return typeof t==`bigint`?t.toString():t}function tt(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function nt(e){return e==null}function rt(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function it(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var at=Symbol(`evaluating`);function ot(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==at)return r===void 0&&(r=at,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function st(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ct(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function lt(e){return JSON.stringify(e)}function ut(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var dt=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ft(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var pt=tt(()=>{if(Ze.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function mt(e){if(ft(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ft(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ht(e){return mt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var gt=new Set([`string`,`number`,`symbol`]);function _t(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function vt(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function yt(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function bt(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var xt={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function St(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return vt(e,ct(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return st(this,`shape`,e),e},checks:[]}))}function Ct(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return vt(e,ct(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return st(this,`shape`,r),r},checks:[]}))}function wt(e,t){if(!mt(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return vt(e,ct(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return st(this,`shape`,n),n}}))}function Tt(e,t){if(!mt(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return vt(e,ct(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return st(this,`shape`,n),n}}))}function Et(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return vt(e,ct(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return st(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Dt(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return vt(t,ct(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return st(this,`shape`,i),i},checks:[]}))}function Ot(e,t,n){return vt(t,ct(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return st(this,`shape`,i),i}}))}function kt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function At(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function jt(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Mt(e){return typeof e==`string`?e:e?.message}function Nt(e,t,n){let r=e.message?e.message:Mt(e.inst?._zod.def?.error?.(e))??Mt(t?.error?.(e))??Mt(n.customError?.(e))??Mt(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Pt(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ft(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var It=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,et,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Lt=B(`$ZodError`,It),Rt=B(`$ZodError`,It,{Parent:Error});function zt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Bt(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var Vt=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Ye;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Nt(e,a,Qe())));throw dt(t,i?.callee),t}return o.value},Ht=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Nt(e,a,Qe())));throw dt(t,i?.callee),t}return o.value},Ut=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Ye;return a.issues.length?{success:!1,error:new(e??Lt)(a.issues.map(e=>Nt(e,i,Qe())))}:{success:!0,data:a.value}},Wt=Ut(Rt),Gt=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Nt(e,i,Qe())))}:{success:!0,data:a.value}},Kt=Gt(Rt),qt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Vt(e)(t,n,i)},Jt=e=>(t,n,r)=>Vt(e)(t,n,r),Yt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ht(e)(t,n,i)},Xt=e=>async(t,n,r)=>Ht(e)(t,n,r),Zt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ut(e)(t,n,i)},Qt=e=>(t,n,r)=>Ut(e)(t,n,r),$t=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Gt(e)(t,n,i)},en=e=>async(t,n,r)=>Gt(e)(t,n,r),tn=/^[cC][0-9a-z]{6,}$/,nn=/^[0-9a-z]+$/,rn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,an=/^[0-9a-vA-V]{20}$/,on=/^[A-Za-z0-9]{27}$/,sn=/^[a-zA-Z0-9_-]{21}$/,cn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ln=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,un=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,dn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,fn=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function pn(){return new RegExp(fn,`u`)}var mn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,hn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,gn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,_n=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,vn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,yn=/^[A-Za-z0-9_-]*$/,bn=/^https?$/,xn=/^\+[1-9]\d{6,14}$/,Sn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Cn=RegExp(`^${Sn}$`);function wn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Tn(e){return RegExp(`^${wn(e)}$`)}function En(e){let t=wn({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Sn}T(?:${r})$`)}var Dn=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},On=/^-?\d+$/,kn=/^-?\d+(?:\.\d+)?$/,An=/^(?:true|false)$/i,jn=/^[^A-Z]*$/,Mn=/^[^a-z]*$/,Nn=B(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Pn={number:`number`,bigint:`bigint`,object:`date`},Fn=B(`$ZodCheckLessThan`,(e,t)=>{Nn.init(e,t);let n=Pn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),In=B(`$ZodCheckGreaterThan`,(e,t)=>{Nn.init(e,t);let n=Pn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ln=B(`$ZodCheckMultipleOf`,(e,t)=>{Nn.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):it(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Rn=B(`$ZodCheckNumberFormat`,(e,t)=>{Nn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=xt[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=On)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),zn=B(`$ZodCheckMaxLength`,(e,t)=>{var n;Nn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!nt(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Pt(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Bn=B(`$ZodCheckMinLength`,(e,t)=>{var n;Nn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!nt(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Pt(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Vn=B(`$ZodCheckLengthEquals`,(e,t)=>{var n;Nn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!nt(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Pt(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Hn=B(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Nn.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Un=B(`$ZodCheckRegex`,(e,t)=>{Hn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Wn=B(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=jn,Hn.init(e,t)}),Gn=B(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Mn,Hn.init(e,t)}),Kn=B(`$ZodCheckIncludes`,(e,t)=>{Nn.init(e,t);let n=_t(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),qn=B(`$ZodCheckStartsWith`,(e,t)=>{Nn.init(e,t);let n=RegExp(`^${_t(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Jn=B(`$ZodCheckEndsWith`,(e,t)=>{Nn.init(e,t);let n=RegExp(`.*${_t(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Yn=B(`$ZodCheckOverwrite`,(e,t)=>{Nn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Xn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
15
|
+
`)}function Ce(e){return{taskId:xe(e,`task-id`),toolUseId:xe(e,`tool-use-id`),status:xe(e,`status`),summary:xe(e,`summary`),note:xe(e,`note`)}}var we=[`low`,`medium`,`high`,`xhigh`,`max`,`ultracode`],Te=[`low`,`medium`,`high`,`xhigh`,`max`];function Ee(e){return typeof e==`string`&&we.includes(e)}function De(e,t){if(Ee(e)&&!(!t||!t.includes(e)))return e}function Oe(e){if(e)return De(e.defaultEffort,ke(e))}function ke(e){return e?Array.isArray(e.effortLevels)?e.effortLevels:e.supportsThinking===!1?[]:Te:[]}function Ae(e){return e?.supportsTools!==!1}function je(e){return e.trim().replace(/\s+/g,` `).toLowerCase()}function Me(e){return e.replace(/\s+/g,` `).toLowerCase()}function Ne(e){let t=e.split(` `).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`\\s+`);return new RegExp(t,`gi`)}function Pe(e,t={}){let n=e.trim().replace(/\s+/g,` `);if(n===``)return null;let r=n.split(` `).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`\\s+`),i=t.wholeWord?`(?<![\\p{L}\\p{N}_])${r}(?![\\p{L}\\p{N}_])`:r;return new RegExp(i,t.caseSensitive?`gu`:`giu`)}function Fe(e,t,n={}){let r=Pe(t,n);return r!==null&&r.test(e)}function Ie(e,t,n){let r=je(t);if(r===``)return[];let i=[];for(let t=0;t<e.length;t++){let a=n(e[t]);a!==``&&Me(a).includes(r)&&i.push(t)}return i}function Le(e,t,n){return n<=0?-1:e<0||e>=n?t>=0?0:n-1:((e+t)%n+n)%n}function Re(e,t){return t<=0?`no matches`:`${e<0||e>=t?0:e+1}/${t}`}var ze={label:`Send now`,warning:`Stops what the agent is doing right now and sends this message immediately. The step that is running is cut.`,alreadyRead:`The agent has already read this message — there is nothing to hurry.`,allWarning:`Stops what the agent is doing right now and sends every queued message at once. The step that is running is cut.`,allRead:`The agent has already read these — there is nothing to hurry.`},Be={toolPacks:`tool_packs`,conversations:`conversations`,chatAbout:`chat_about`,scheduledTasks:`scheduled_tasks`,promptAck:`prompt_ack`,voiceSummaries:`voice_summaries`,chatFiles:`chat_files`,reach:`reach`,fileFetch:`file_fetch`,customModel:`custom_model`,removeEntries:`remove_entries`};function Ve(e){return typeof e==`object`&&!!e&&typeof e.type==`string`}var z={health:`/api/v1/health`,info:`/api/v1/info`,sessions:`/api/v1/sessions`,adoptLegacySessions:`/api/v1/sessions/adopt-legacy`,session:e=>`/api/v1/sessions/${e}`,sessionEntries:e=>`/api/v1/sessions/${e}/entries`,sessionSearch:`/api/v1/sessions/search`,agentTools:`/api/v1/agent-tools`,connectors:`/api/v1/connectors`,connector:e=>`/api/v1/connectors/${e}`,connectorSignIn:e=>`/api/v1/connectors/${e}/sign-in`,connectorSkills:e=>`/api/v1/connectors/${e}/skills`,mcpServers:`/api/v1/mcp-servers`,mcpServer:e=>`/api/v1/mcp-servers/${e}`,mcpServerTest:e=>`/api/v1/mcp-servers/${e}/test`,mcpServerTestDraft:`/api/v1/mcp-servers/test`,commands:`/api/v1/commands`,sessionCommands:e=>`/api/v1/sessions/${e}/commands`,skills:`/api/v1/skills`,skill:e=>`/api/v1/skills/${encodeURIComponent(e)}`,importClaudeSkills:`/api/v1/skills/import/claude`,modelSkills:`/api/v1/model-skills`,sessionModelSkills:e=>`/api/v1/sessions/${e}/model-skills`,sessionMessages:e=>`/api/v1/sessions/${e}/messages`,sessionPrompt:e=>`/api/v1/sessions/${e}/prompt`,sessionInterrupt:e=>`/api/v1/sessions/${e}/interrupt`,sessionQueued:(e,t)=>`/api/v1/sessions/${e}/queued/${encodeURIComponent(t)}`,sessionQueuedNow:(e,t)=>`/api/v1/sessions/${e}/queued/${encodeURIComponent(t)}/now`,sessionQueuedNowAll:e=>`/api/v1/sessions/${e}/queued/now`,sessionSavedPrompts:e=>`/api/v1/sessions/${e}/saved-prompts`,sessionSavedPrompt:(e,t)=>`/api/v1/sessions/${e}/saved-prompts/${encodeURIComponent(t)}`,sessionBrowserOpen:e=>`/api/v1/sessions/${e}/browser/open`,sessionRemove:e=>`/api/v1/sessions/${e}/remove`,sessionModelUndo:e=>`/api/v1/sessions/${e}/model/undo`,sessionFork:e=>`/api/v1/sessions/${e}/fork`,sessionExport:e=>`/api/v1/sessions/${e}/export`,sessionsExportArchive:`/api/v1/sessions/export`,aiToolGrants:`/api/v1/ai-tools/grants`,aiToolGrant:e=>`/api/v1/ai-tools/grants/${e}`,aiToolMcp:`/api/v1/ai-tools/mcp`,sessionProject:e=>`/api/v1/sessions/${e}/project`,importClaude:`/api/v1/import/claude`,importSearch:`/api/v1/import/search`,sessionLink:e=>`/api/v1/sessions/${e}/link`,sessionSyncDown:e=>`/api/v1/sessions/${e}/sync-down`,projects:`/api/v1/projects`,projectInspect:`/api/v1/projects/inspect`,vaultProjects:`/api/v1/vault/projects`,vaultProject:e=>`/api/v1/vault/projects/${e}`,vaultNotes:`/api/v1/vault/notes`,vaultNote:e=>`/api/v1/vault/notes/${e}`,scheduledTasks:`/api/v1/scheduled-tasks`,scheduledTask:e=>`/api/v1/scheduled-tasks/${e}`,conversations:`/api/v1/conversations`,conversation:e=>`/api/v1/conversations/${e}`,conversationAction:(e,t)=>`/api/v1/conversations/${e}/${t}`,conversationsStopAll:`/api/v1/conversations/stop-all`,chatMessage:e=>`/api/v1/chat-messages/${e}`,sessionAbout:e=>`/api/v1/sessions/${e}/about`,agyStatus:`/api/v1/agy/status`,agyInstall:`/api/v1/agy/install`,agyLogin:`/api/v1/agy/login`,agyLoginCode:`/api/v1/agy/login/code`,museSetup:`/api/v1/muse/setup`,museLogin:`/api/v1/muse/login`,agyRequests:e=>`/api/v1/sessions/${e}/agy/requests`,agyRequestBody:(e,t)=>`/api/v1/sessions/${e}/agy/requests/${t}`,sessionAboutRegenerate:e=>`/api/v1/sessions/${e}/about/regenerate`,chatAbouts:`/api/v1/chat-abouts`,chatAboutsGenerateAll:`/api/v1/chat-abouts/generate-all`,chatAboutsGenerateAllStop:`/api/v1/chat-abouts/generate-all/stop`,chatAboutsGenerate:`/api/v1/chat-abouts/generate`,chatAboutsTranslationPlan:`/api/v1/chat-abouts/translation-plan`,sessionAboutTranslation:e=>`/api/v1/sessions/${e}/about/translation`,sessionVoiceSummaries:e=>`/api/v1/sessions/${e}/voice-summaries`,sessionVoiceSummary:(e,t)=>`/api/v1/sessions/${e}/voice-summaries/${t}`,sessionVoiceSummaryTranslations:(e,t)=>`/api/v1/sessions/${e}/voice-summaries/${t}/translations`,nextPrompts:`/api/v1/next-prompts`,nextPromptsReview:`/api/v1/next-prompts/review`,nextPromptsReviewStop:`/api/v1/next-prompts/review/stop`,sessionNextPrompt:e=>`/api/v1/sessions/${e}/next-prompt`,sessionNextPromptSent:e=>`/api/v1/sessions/${e}/next-prompt/sent`,sessionSeen:e=>`/api/v1/sessions/${e}/seen`,githubLink:`/api/v1/git/github`,githubLinkStart:`/api/v1/git/github/link`,providers:`/api/v1/providers`,providersActive:`/api/v1/providers/active`,providerTest:e=>`/api/v1/providers/${e}/test`,providerProbe:e=>`/api/v1/providers/${e}/probe`,providerSecret:e=>`/api/v1/providers/${e}/secret`,providerUsage:e=>`/api/v1/providers/${e}/usage`,models:`/api/v1/models`,settings:`/api/v1/settings`,account:`/api/v1/account`,accountLogin:`/api/v1/account/login`,accountLogout:`/api/v1/account/logout`,accountRemoveHost:`/api/v1/account/remove-host`,accountUnlock:`/api/v1/account/unlock`,accountPlan:`/api/v1/account/plan`,accountUsage:`/api/v1/account/usage`,accountLock:`/api/v1/account/lock`,accountResendVerification:`/api/v1/account/resend-verification`,accountLinkStart:`/api/v1/account/link/start`,accountLinkStatus:`/api/v1/account/link`,accountLinkCancel:`/api/v1/account/link/cancel`,accountApiKey:`/api/v1/account/api-key`,credentials:`/api/v1/credentials`,credential:e=>`/api/v1/credentials/${e}`,credentialTest:e=>`/api/v1/credentials/${e}/test`,syncNow:`/api/v1/sync/now`,subscriptionClaudeLogin:`/api/v1/subscription/claude/login`,subscriptionClaudeLoginState:`/api/v1/subscription/claude/login/state`,subscriptionClaudeLoginCode:`/api/v1/subscription/claude/login/code`,subscriptionClaudeLoginCancel:`/api/v1/subscription/claude/login/cancel`,subscriptionClaudeStatus:`/api/v1/subscription/claude`,subscriptionOauthLogin:e=>`/api/v1/subscription/oauth/${e}/login`,subscriptionOauthLoginState:e=>`/api/v1/subscription/oauth/${e}/login/state`,subscriptionOauthLoginCancel:e=>`/api/v1/subscription/oauth/${e}/login/cancel`,doctor:`/api/v1/doctor`,hostShutdown:`/api/v1/host/shutdown`,hostVaultUnlock:e=>`/api/v1/hosts/${encodeURIComponent(e)}/vault-unlock`,hosts:`/api/v1/hosts`,host:e=>`/api/v1/hosts/${e}`,hostSessions:e=>`/api/v1/hosts/${e}/sessions`,hostSessionEntries:(e,t)=>`/api/v1/hosts/${e}/sessions/${t}/entries`,hostSession:(e,t)=>`/api/v1/hosts/${e}/sessions/${t}`,hostSessionFork:(e,t)=>`/api/v1/hosts/${e}/sessions/${t}/fork`,hostSessionFiles:(e,t)=>`/api/v1/hosts/${e}/sessions/${t}/files`,hostSessionFile:(e,t)=>`/api/v1/hosts/${e}/sessions/${t}/files/content`,hostProjectsInspect:e=>`/api/v1/hosts/${e}/projects/inspect`,remoteWs:`/api/v1/relay/ws`,errorReport:`/api/v1/errors`,bugReport:`/api/v1/bug-reports`,sandboxRunToken:`/api/v1/sandbox/run-token`,sessionFiles:e=>`/api/v1/sessions/${e}/files`,sessionFile:e=>`/api/v1/sessions/${e}/files/content`,sessionFileSearch:e=>`/api/v1/sessions/${e}/files/search`,sessionLocalFile:e=>`/api/v1/sessions/${e}/local-file`,mediaOptions:`/api/v1/media/options`,sessionLocalFileGrant:e=>`/api/v1/sessions/${e}/local-file/grant`,sessionLocalFileStat:e=>`/api/v1/sessions/${e}/local-file/stat`,sessionLocalFileText:e=>`/api/v1/sessions/${e}/local-file/text`,sessionMedia:e=>`/api/v1/sessions/${e}/media`,sessionMediaContent:(e,t)=>`/api/v1/sessions/${e}/media/${t}/content`,sessionMediaGrant:e=>`/api/v1/sessions/${e}/media/grant`,sessionTmpFile:e=>`/api/v1/sessions/${e}/tmp-file`,saveTmpFile:`/api/v1/tmp-file`,sandboxRestore:`/api/v1/sandbox/restore`};function He(e){return e.enabled&&e.nextRunAt!==null}function Ue(e){if(He(e)||!e.updatedAt)return null;let t=Date.parse(e.updatedAt);return Number.isFinite(t)?new Date(t+864e6).toISOString():null}var We={busy:`This chat is working. Wait for it to finish, or press Stop, then try again.`,confirm:`This removes the messages from this chat and from what the model remembers. It cannot be undone.`,notAMessage:`That line is not one of your messages, so it cannot start a removal.`,notFound:`That message is not in this chat any more.`},Ge={health:`GET`,info:`GET`,listSessions:`GET`,createSession:`POST`,getSession:`GET`,updateSession:`PATCH`,deleteSession:`DELETE`,listEntries:`GET`,listMessages:`GET`,prompt:`POST`,interrupt:`POST`,cancelQueued:`DELETE`,sendQueuedNow:`POST`,sendQueuedNowAll:`POST`,removeEntries:`POST`,undoModelChange:`POST`,fork:`POST`,export:`GET`,exportArchive:`POST`,listAiToolGrants:`GET`,createAiToolGrant:`POST`,revokeAiToolGrant:`DELETE`,attachSessionProject:`POST`,listProjects:`GET`,scanClaudeSessions:`GET`,importClaudeSessions:`POST`,searchImportChats:`GET`,sessionLink:`GET`,syncSessionDown:`POST`,inspectProject:`GET`,listVaultProjects:`GET`,createVaultProject:`POST`,updateVaultProject:`PATCH`,deleteVaultProject:`DELETE`,listStickyNotes:`GET`,createStickyNote:`POST`,updateStickyNote:`PATCH`,deleteStickyNote:`DELETE`,listScheduledTasks:`GET`,createScheduledTask:`POST`,updateScheduledTask:`PATCH`,deleteScheduledTask:`DELETE`,listConversations:`GET`,getConversation:`GET`,conversationAction:`POST`,stopAllConversations:`POST`,cancelChatMessage:`DELETE`,getChatAbout:`GET`,updateChatAbout:`PATCH`,regenerateChatAbout:`POST`,listChatAbouts:`GET`,generateAllChatAbouts:`POST`,stopGenerateAllChatAbouts:`POST`,generateChatAbouts:`POST`,planChatAboutTranslations:`POST`,translateChatAbout:`POST`,listVoiceSummaries:`GET`,createVoiceSummary:`POST`,deleteVoiceSummary:`DELETE`,translateVoiceSummary:`POST`,listNextPrompts:`GET`,reviewNextPrompts:`POST`,stopNextPromptReview:`POST`,getNextPrompt:`GET`,suggestNextPrompt:`POST`,markNextPromptSent:`POST`,markSessionSeen:`POST`,searchEntries:`GET`,getGithubLink:`GET`,startGithubLink:`POST`,cancelGithubLink:`DELETE`,unlinkGithub:`DELETE`,listProviders:`GET`,setActiveProvider:`PUT`,providerTest:`POST`,providerProbe:`POST`,revealCredential:`GET`,listModels:`GET`,getSettings:`GET`,updateSettings:`PATCH`,getAccount:`GET`,login:`POST`,logout:`POST`,removeHostFromAccount:`POST`,unlock:`POST`,resendVerification:`POST`,linkStart:`POST`,linkStatus:`GET`,linkCancel:`POST`,listCredentials:`GET`,addCredential:`POST`,deleteCredential:`DELETE`,credentialTest:`POST`,syncNow:`POST`,claudeLogin:`POST`,claudeLoginState:`GET`,claudeLoginCode:`POST`,claudeLoginCancel:`POST`,claudeStatus:`GET`,oauthLogin:`POST`,oauthLoginState:`GET`,oauthLoginCancel:`POST`,doctor:`GET`,hostShutdown:`POST`,listHosts:`GET`,getHost:`GET`,updateHost:`PATCH`,listHostSessions:`GET`,deleteHostSession:`DELETE`,listHostSessionEntries:`GET`,errorReport:`POST`,bugReport:`POST`,listSessionFiles:`GET`,readSessionFile:`GET`,deleteSessionFile:`DELETE`,renameSessionFile:`POST`,searchSessionFiles:`GET`,writeSessionFileText:`PUT`,readLocalFile:`GET`,grantLocalFile:`POST`,statLocalPaths:`POST`,listChatMedia:`GET`,readChatMedia:`GET`,grantChatMedia:`POST`,listSavedPrompts:`GET`,saveSavedPrompt:`POST`,deleteSavedPrompt:`DELETE`,listCommands:`GET`,listSessionCommands:`GET`,listSkills:`GET`,deleteSkill:`DELETE`,scanClaudeSkills:`GET`,importClaudeSkills:`POST`,listChatSkills:`GET`,listSessionChatSkills:`GET`};function Ke(e){return typeof e==`object`&&!!e&&typeof e.type==`string`}function qe(e){return e===`attached`}var Je;function B(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Ye=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Xe=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Je=globalThis).__zod_globalConfig??(Je.__zod_globalConfig={});var Ze=globalThis.__zod_globalConfig;function Qe(e){return e&&Object.assign(Ze,e),Ze}function $e(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function et(e,t){return typeof t==`bigint`?t.toString():t}function tt(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function nt(e){return e==null}function rt(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function it(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var at=Symbol(`evaluating`);function ot(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==at)return r===void 0&&(r=at,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function st(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ct(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function lt(e){return JSON.stringify(e)}function ut(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var dt=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ft(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var pt=tt(()=>{if(Ze.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function mt(e){if(ft(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ft(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ht(e){return mt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var gt=new Set([`string`,`number`,`symbol`]);function _t(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function vt(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function yt(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function bt(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var xt={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function St(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return vt(e,ct(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return st(this,`shape`,e),e},checks:[]}))}function Ct(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return vt(e,ct(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return st(this,`shape`,r),r},checks:[]}))}function wt(e,t){if(!mt(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return vt(e,ct(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return st(this,`shape`,n),n}}))}function Tt(e,t){if(!mt(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return vt(e,ct(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return st(this,`shape`,n),n}}))}function Et(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return vt(e,ct(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return st(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Dt(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return vt(t,ct(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return st(this,`shape`,i),i},checks:[]}))}function Ot(e,t,n){return vt(t,ct(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return st(this,`shape`,i),i}}))}function kt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function At(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function jt(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Mt(e){return typeof e==`string`?e:e?.message}function Nt(e,t,n){let r=e.message?e.message:Mt(e.inst?._zod.def?.error?.(e))??Mt(t?.error?.(e))??Mt(n.customError?.(e))??Mt(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Pt(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ft(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var It=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,et,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Lt=B(`$ZodError`,It),Rt=B(`$ZodError`,It,{Parent:Error});function zt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Bt(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var Vt=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Ye;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Nt(e,a,Qe())));throw dt(t,i?.callee),t}return o.value},Ht=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Nt(e,a,Qe())));throw dt(t,i?.callee),t}return o.value},Ut=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Ye;return a.issues.length?{success:!1,error:new(e??Lt)(a.issues.map(e=>Nt(e,i,Qe())))}:{success:!0,data:a.value}},Wt=Ut(Rt),Gt=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Nt(e,i,Qe())))}:{success:!0,data:a.value}},Kt=Gt(Rt),qt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Vt(e)(t,n,i)},Jt=e=>(t,n,r)=>Vt(e)(t,n,r),Yt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ht(e)(t,n,i)},Xt=e=>async(t,n,r)=>Ht(e)(t,n,r),Zt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ut(e)(t,n,i)},Qt=e=>(t,n,r)=>Ut(e)(t,n,r),$t=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Gt(e)(t,n,i)},en=e=>async(t,n,r)=>Gt(e)(t,n,r),tn=/^[cC][0-9a-z]{6,}$/,nn=/^[0-9a-z]+$/,rn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,an=/^[0-9a-vA-V]{20}$/,on=/^[A-Za-z0-9]{27}$/,sn=/^[a-zA-Z0-9_-]{21}$/,cn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ln=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,un=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,dn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,fn=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function pn(){return new RegExp(fn,`u`)}var mn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,hn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,gn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,_n=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,vn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,yn=/^[A-Za-z0-9_-]*$/,bn=/^https?$/,xn=/^\+[1-9]\d{6,14}$/,Sn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Cn=RegExp(`^${Sn}$`);function wn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Tn(e){return RegExp(`^${wn(e)}$`)}function En(e){let t=wn({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Sn}T(?:${r})$`)}var Dn=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},On=/^-?\d+$/,kn=/^-?\d+(?:\.\d+)?$/,An=/^(?:true|false)$/i,jn=/^[^A-Z]*$/,Mn=/^[^a-z]*$/,Nn=B(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Pn={number:`number`,bigint:`bigint`,object:`date`},Fn=B(`$ZodCheckLessThan`,(e,t)=>{Nn.init(e,t);let n=Pn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),In=B(`$ZodCheckGreaterThan`,(e,t)=>{Nn.init(e,t);let n=Pn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ln=B(`$ZodCheckMultipleOf`,(e,t)=>{Nn.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):it(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Rn=B(`$ZodCheckNumberFormat`,(e,t)=>{Nn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=xt[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=On)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),zn=B(`$ZodCheckMaxLength`,(e,t)=>{var n;Nn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!nt(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Pt(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Bn=B(`$ZodCheckMinLength`,(e,t)=>{var n;Nn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!nt(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Pt(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Vn=B(`$ZodCheckLengthEquals`,(e,t)=>{var n;Nn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!nt(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Pt(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Hn=B(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Nn.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Un=B(`$ZodCheckRegex`,(e,t)=>{Hn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Wn=B(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=jn,Hn.init(e,t)}),Gn=B(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Mn,Hn.init(e,t)}),Kn=B(`$ZodCheckIncludes`,(e,t)=>{Nn.init(e,t);let n=_t(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),qn=B(`$ZodCheckStartsWith`,(e,t)=>{Nn.init(e,t);let n=RegExp(`^${_t(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Jn=B(`$ZodCheckEndsWith`,(e,t)=>{Nn.init(e,t);let n=RegExp(`.*${_t(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Yn=B(`$ZodCheckOverwrite`,(e,t)=>{Nn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Xn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
16
16
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
17
17
|
`))}},Zn={major:4,minor:4,patch:3},Qn=B(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Zn;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=kt(e),i;for(let a of t){if(a._zod.def.when){if(At(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Ye;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=kt(e,t))});else{if(e.issues.length===t)continue;r||=kt(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(kt(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Ye;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Ye;return o.then(e=>t(e,r,a))}return t(o,r,a)}}ot(e,`~standard`,()=>({validate:t=>{try{let n=Wt(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Kt(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),$n=B(`$ZodString`,(e,t)=>{Qn.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Dn(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),er=B(`$ZodStringFormat`,(e,t)=>{Hn.init(e,t),$n.init(e,t)}),tr=B(`$ZodGUID`,(e,t)=>{t.pattern??=ln,er.init(e,t)}),nr=B(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=un(e)}else t.pattern??=un();er.init(e,t)}),rr=B(`$ZodEmail`,(e,t)=>{t.pattern??=dn,er.init(e,t)}),ir=B(`$ZodURL`,(e,t)=>{er.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===bn.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),n.value=t.normalize?i.href:r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),ar=B(`$ZodEmoji`,(e,t)=>{t.pattern??=pn(),er.init(e,t)}),or=B(`$ZodNanoID`,(e,t)=>{t.pattern??=sn,er.init(e,t)}),sr=B(`$ZodCUID`,(e,t)=>{t.pattern??=tn,er.init(e,t)}),cr=B(`$ZodCUID2`,(e,t)=>{t.pattern??=nn,er.init(e,t)}),lr=B(`$ZodULID`,(e,t)=>{t.pattern??=rn,er.init(e,t)}),ur=B(`$ZodXID`,(e,t)=>{t.pattern??=an,er.init(e,t)}),dr=B(`$ZodKSUID`,(e,t)=>{t.pattern??=on,er.init(e,t)}),fr=B(`$ZodISODateTime`,(e,t)=>{t.pattern??=En(t),er.init(e,t)}),pr=B(`$ZodISODate`,(e,t)=>{t.pattern??=Cn,er.init(e,t)}),mr=B(`$ZodISOTime`,(e,t)=>{t.pattern??=Tn(t),er.init(e,t)}),hr=B(`$ZodISODuration`,(e,t)=>{t.pattern??=cn,er.init(e,t)}),gr=B(`$ZodIPv4`,(e,t)=>{t.pattern??=mn,er.init(e,t),e._zod.bag.format=`ipv4`}),_r=B(`$ZodIPv6`,(e,t)=>{t.pattern??=hn,er.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),vr=B(`$ZodCIDRv4`,(e,t)=>{t.pattern??=gn,er.init(e,t)}),yr=B(`$ZodCIDRv6`,(e,t)=>{t.pattern??=_n,er.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function br(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var xr=B(`$ZodBase64`,(e,t)=>{t.pattern??=vn,er.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{br(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Sr(e){if(!yn.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return br(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Cr=B(`$ZodBase64URL`,(e,t)=>{t.pattern??=yn,er.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Sr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),wr=B(`$ZodE164`,(e,t)=>{t.pattern??=xn,er.init(e,t)});function Tr(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Er=B(`$ZodJWT`,(e,t)=>{er.init(e,t),e._zod.check=n=>{Tr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Dr=B(`$ZodNumber`,(e,t)=>{Qn.init(e,t),e._zod.pattern=e._zod.bag.pattern??kn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Or=B(`$ZodNumberFormat`,(e,t)=>{Rn.init(e,t),Dr.init(e,t)}),kr=B(`$ZodBoolean`,(e,t)=>{Qn.init(e,t),e._zod.pattern=An,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Ar=B(`$ZodUnknown`,(e,t)=>{Qn.init(e,t),e._zod.parse=e=>e}),jr=B(`$ZodNever`,(e,t)=>{Qn.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Mr(e,t,n){e.issues.length&&t.issues.push(...jt(n,e.issues)),t.value[n]=e.value}var Nr=B(`$ZodArray`,(e,t)=>{Qn.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Mr(t,n,e))):Mr(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Pr(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...jt(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Fr(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=bt(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Ir(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Pr(e,n,i,t,u,d))):Pr(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Lr=B(`$ZodObject`,(e,t)=>{if(Qn.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=tt(()=>Fr(t));ot(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=ft,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>Pr(n,t,e,s,r,i))):Pr(a,t,e,s,r,i)}return i?Ir(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Rr=B(`$ZodObjectJIT`,(e,t)=>{Lr.init(e,t);let n=e._zod.parse,r=tt(()=>Fr(t)),i=e=>{let t=new Xn([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=lt(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=lt(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
18
18
|
if (${n}.issues.length) {
|
|
@@ -77,7 +77,7 @@ Error generating stack: `+e.message+`
|
|
|
77
77
|
|
|
78
78
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ba(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Ca(t,`input`,e.processors),output:Ca(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function xa(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return xa(r.element,n);if(r.type===`set`)return xa(r.valueType,n);if(r.type===`lazy`)return xa(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return xa(r.innerType,n);if(r.type===`intersection`)return xa(r.left,n)||xa(r.right,n);if(r.type===`record`||r.type===`map`)return xa(r.keyType,n)||xa(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:xa(r.in,n)||xa(r.out,n);if(r.type===`object`){for(let e in r.shape)if(xa(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(xa(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(xa(e,n))return!0;return!!(r.rest&&xa(r.rest,n))}return!1}var Sa=(e,t={})=>n=>{let r=_a({...n,processors:t});return va(e,r),ya(r,e),ba(r,e)},Ca=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=_a({...i??{},target:a,io:t,processors:n});return va(e,o),ya(o,e),ba(o,e)},wa={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ta=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=wa[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Ea=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Da=(e,t,n,r)=>{n.type=`boolean`},Oa=(e,t,n,r)=>{n.not={}},ka=(e,t,n,r)=>{let i=e._zod.def,a=$e(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Aa=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},ja=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Ma=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Na=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=va(a.element,t,{...r,path:[...r.path,`items`]})},Pa=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=va(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=va(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Fa=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>va(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ia=(e,t,n,r)=>{let i=e._zod.def,a=va(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=va(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},La=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=va(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=va(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=va(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Ra=(e,t,n,r)=>{let i=e._zod.def,a=va(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},za=(e,t,n,r)=>{let i=e._zod.def;va(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ba=(e,t,n,r)=>{let i=e._zod.def;va(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Va=(e,t,n,r)=>{let i=e._zod.def;va(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ha=(e,t,n,r)=>{let i=e._zod.def;va(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Ua=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;va(o,t,r);let s=t.seen.get(e);s.ref=o},Wa=(e,t,n,r)=>{let i=e._zod.def;va(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ga=(e,t,n,r)=>{let i=e._zod.def;va(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ka=B(`ZodISODateTime`,(e,t)=>{fr.init(e,t),yo.init(e,t)});function qa(e){return Ri(Ka,e)}var Ja=B(`ZodISODate`,(e,t)=>{pr.init(e,t),yo.init(e,t)});function Ya(e){return zi(Ja,e)}var Xa=B(`ZodISOTime`,(e,t)=>{mr.init(e,t),yo.init(e,t)});function Za(e){return Bi(Xa,e)}var Qa=B(`ZodISODuration`,(e,t)=>{hr.init(e,t),yo.init(e,t)});function $a(e){return Vi(Qa,e)}var eo=B(`ZodError`,(e,t)=>{Lt.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Bt(e,t)},flatten:{value:t=>zt(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,et,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,et,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),to=Vt(eo),no=Ht(eo),ro=Ut(eo),io=Gt(eo),ao=qt(eo),oo=Jt(eo),so=Yt(eo),co=Xt(eo),lo=Zt(eo),uo=Qt(eo),fo=$t(eo),po=en(eo),mo=new WeakMap;function ho(e,t,n){let r=Object.getPrototypeOf(e),i=mo.get(r);if(i||(i=new Set,mo.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var go=B(`ZodType`,(e,t)=>(Qn.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Ca(e,`input`),output:Ca(e,`output`)}}),e.toJSONSchema=Sa(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>to(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ro(e,t,n),e.parseAsync=async(t,n)=>no(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>io(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ao(e,t,n),e.decode=(t,n)=>oo(e,t,n),e.encodeAsync=async(t,n)=>so(e,t,n),e.decodeAsync=async(t,n)=>co(e,t,n),e.safeEncode=(t,n)=>lo(e,t,n),e.safeDecode=(t,n)=>uo(e,t,n),e.safeEncodeAsync=async(t,n)=>fo(e,t,n),e.safeDecodeAsync=async(t,n)=>po(e,t,n),ho(e,`ZodType`,{check(...e){let t=this.def;return this.clone(ct(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return vt(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ms(e,t))},superRefine(e,t){return this.check(Ns(e,t))},overwrite(e){return this.check(sa(e))},optional(){return ms(this)},exactOptional(){return gs(this)},nullable(){return vs(this)},nullish(){return ms(vs(this))},nonoptional(e){return ws(this,e)},array(){return Xo(this)},or(e){return es([this,e])},and(e){return is(this,e)},transform(e){return Os(this,fs(e))},default(e){return bs(this,e)},prefault(e){return Ss(this,e)},catch(e){return Es(this,e)},pipe(e){return Os(this,e)},readonly(){return As(this)},describe(e){let t=this.clone();return mi.add(t,{description:e}),t},meta(...e){if(e.length===0)return mi.get(this);let t=this.clone();return mi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return mi.get(e)?.description},configurable:!0}),e)),_o=B(`_ZodString`,(e,t)=>{$n.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ta(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,ho(e,`_ZodString`,{regex(...e){return this.check(ta(...e))},includes(...e){return this.check(ia(...e))},startsWith(...e){return this.check(aa(...e))},endsWith(...e){return this.check(oa(...e))},min(...e){return this.check($i(...e))},max(...e){return this.check(Qi(...e))},length(...e){return this.check(ea(...e))},nonempty(...e){return this.check($i(1,...e))},lowercase(e){return this.check(na(e))},uppercase(e){return this.check(ra(e))},trim(){return this.check(la())},normalize(...e){return this.check(ca(...e))},toLowerCase(){return this.check(ua())},toUpperCase(){return this.check(da())},slugify(){return this.check(fa())}})}),vo=B(`ZodString`,(e,t)=>{$n.init(e,t),_o.init(e,t),e.email=t=>e.check(gi(bo,t)),e.url=t=>e.check(Si(Co,t)),e.jwt=t=>e.check(Li(Ro,t)),e.emoji=t=>e.check(Ci(wo,t)),e.guid=t=>e.check(_i(xo,t)),e.uuid=t=>e.check(vi(So,t)),e.uuidv4=t=>e.check(yi(So,t)),e.uuidv6=t=>e.check(bi(So,t)),e.uuidv7=t=>e.check(xi(So,t)),e.nanoid=t=>e.check(wi(To,t)),e.guid=t=>e.check(_i(xo,t)),e.cuid=t=>e.check(Ti(Eo,t)),e.cuid2=t=>e.check(Ei(Do,t)),e.ulid=t=>e.check(Di(Oo,t)),e.base64=t=>e.check(Pi(Fo,t)),e.base64url=t=>e.check(Fi(Io,t)),e.xid=t=>e.check(Oi(ko,t)),e.ksuid=t=>e.check(ki(Ao,t)),e.ipv4=t=>e.check(Ai(jo,t)),e.ipv6=t=>e.check(ji(Mo,t)),e.cidrv4=t=>e.check(Mi(No,t)),e.cidrv6=t=>e.check(Ni(Po,t)),e.e164=t=>e.check(Ii(Lo,t)),e.datetime=t=>e.check(qa(t)),e.date=t=>e.check(Ya(t)),e.time=t=>e.check(Za(t)),e.duration=t=>e.check($a(t))});function V(e){return hi(vo,e)}var yo=B(`ZodStringFormat`,(e,t)=>{er.init(e,t),_o.init(e,t)}),bo=B(`ZodEmail`,(e,t)=>{rr.init(e,t),yo.init(e,t)}),xo=B(`ZodGUID`,(e,t)=>{tr.init(e,t),yo.init(e,t)}),So=B(`ZodUUID`,(e,t)=>{nr.init(e,t),yo.init(e,t)}),Co=B(`ZodURL`,(e,t)=>{ir.init(e,t),yo.init(e,t)}),wo=B(`ZodEmoji`,(e,t)=>{ar.init(e,t),yo.init(e,t)}),To=B(`ZodNanoID`,(e,t)=>{or.init(e,t),yo.init(e,t)}),Eo=B(`ZodCUID`,(e,t)=>{sr.init(e,t),yo.init(e,t)}),Do=B(`ZodCUID2`,(e,t)=>{cr.init(e,t),yo.init(e,t)}),Oo=B(`ZodULID`,(e,t)=>{lr.init(e,t),yo.init(e,t)}),ko=B(`ZodXID`,(e,t)=>{ur.init(e,t),yo.init(e,t)}),Ao=B(`ZodKSUID`,(e,t)=>{dr.init(e,t),yo.init(e,t)}),jo=B(`ZodIPv4`,(e,t)=>{gr.init(e,t),yo.init(e,t)}),Mo=B(`ZodIPv6`,(e,t)=>{_r.init(e,t),yo.init(e,t)}),No=B(`ZodCIDRv4`,(e,t)=>{vr.init(e,t),yo.init(e,t)}),Po=B(`ZodCIDRv6`,(e,t)=>{yr.init(e,t),yo.init(e,t)}),Fo=B(`ZodBase64`,(e,t)=>{xr.init(e,t),yo.init(e,t)}),Io=B(`ZodBase64URL`,(e,t)=>{Cr.init(e,t),yo.init(e,t)}),Lo=B(`ZodE164`,(e,t)=>{wr.init(e,t),yo.init(e,t)}),Ro=B(`ZodJWT`,(e,t)=>{Er.init(e,t),yo.init(e,t)}),zo=B(`ZodNumber`,(e,t)=>{Dr.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ea(e,t,n,r),ho(e,`ZodNumber`,{gt(e,t){return this.check(Yi(e,t))},gte(e,t){return this.check(Xi(e,t))},min(e,t){return this.check(Xi(e,t))},lt(e,t){return this.check(qi(e,t))},lte(e,t){return this.check(Ji(e,t))},max(e,t){return this.check(Ji(e,t))},int(e){return this.check(Ho(e))},safe(e){return this.check(Ho(e))},positive(e){return this.check(Yi(0,e))},nonnegative(e){return this.check(Xi(0,e))},negative(e){return this.check(qi(0,e))},nonpositive(e){return this.check(Ji(0,e))},multipleOf(e,t){return this.check(Zi(e,t))},step(e,t){return this.check(Zi(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Bo(e){return Hi(zo,e)}var Vo=B(`ZodNumberFormat`,(e,t)=>{Or.init(e,t),zo.init(e,t)});function Ho(e){return Ui(Vo,e)}var Uo=B(`ZodBoolean`,(e,t)=>{kr.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Da(e,t,n,r)});function Wo(e){return Wi(Uo,e)}var Go=B(`ZodUnknown`,(e,t)=>{Ar.init(e,t),go.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ko(){return Gi(Go)}var qo=B(`ZodNever`,(e,t)=>{jr.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oa(e,t,n,r)});function Jo(e){return Ki(qo,e)}var Yo=B(`ZodArray`,(e,t)=>{Nr.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Na(e,t,n,r),e.element=t.element,ho(e,`ZodArray`,{min(e,t){return this.check($i(e,t))},nonempty(e){return this.check($i(1,e))},max(e,t){return this.check(Qi(e,t))},length(e,t){return this.check(ea(e,t))},unwrap(){return this.element}})});function Xo(e,t){return pa(Yo,e,t)}var Zo=B(`ZodObject`,(e,t)=>{Rr.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pa(e,t,n,r),ot(e,`shape`,()=>t.shape),ho(e,`ZodObject`,{keyof(){return cs(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Ko()})},loose(){return this.clone({...this._zod.def,catchall:Ko()})},strict(){return this.clone({...this._zod.def,catchall:Jo()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return wt(this,e)},safeExtend(e){return Tt(this,e)},merge(e){return Et(this,e)},pick(e){return St(this,e)},omit(e){return Ct(this,e)},partial(...e){return Dt(ps,this,e[0])},required(...e){return Ot(Cs,this,e[0])}})});function Qo(e,t){return new Zo({type:`object`,shape:e??{},...yt(t)})}var $o=B(`ZodUnion`,(e,t)=>{Br.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fa(e,t,n,r),e.options=t.options});function es(e,t){return new $o({type:`union`,options:e,...yt(t)})}var ts=B(`ZodDiscriminatedUnion`,(e,t)=>{$o.init(e,t),Vr.init(e,t)});function ns(e,t,n){return new ts({type:`union`,options:t,discriminator:e,...yt(n)})}var rs=B(`ZodIntersection`,(e,t)=>{Hr.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ia(e,t,n,r)});function is(e,t){return new rs({type:`intersection`,left:e,right:t})}var as=B(`ZodRecord`,(e,t)=>{Gr.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>La(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function os(e,t,n){return!t||!t._zod?new as({type:`record`,keyType:V(),valueType:e,...yt(t)}):new as({type:`record`,keyType:e,valueType:t,...yt(n)})}var ss=B(`ZodEnum`,(e,t)=>{Kr.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ka(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new ss({...t,checks:[],...yt(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new ss({...t,checks:[],...yt(r),entries:i})}});function cs(e,t){return new ss({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...yt(t)})}var ls=B(`ZodLiteral`,(e,t)=>{qr.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aa(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function us(e,t){return new ls({type:`literal`,values:Array.isArray(e)?e:[e],...yt(t)})}var ds=B(`ZodTransform`,(e,t)=>{Jr.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ma(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Xe(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ft(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Ft(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function fs(e){return new ds({type:`transform`,transform:e})}var ps=B(`ZodOptional`,(e,t)=>{Xr.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ga(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ms(e){return new ps({type:`optional`,innerType:e})}var hs=B(`ZodExactOptional`,(e,t)=>{Zr.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ga(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gs(e){return new hs({type:`optional`,innerType:e})}var _s=B(`ZodNullable`,(e,t)=>{Qr.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ra(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function vs(e){return new _s({type:`nullable`,innerType:e})}var ys=B(`ZodDefault`,(e,t)=>{$r.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ba(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function bs(e,t){return new ys({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ht(t)}})}var xs=B(`ZodPrefault`,(e,t)=>{ti.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Va(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ss(e,t){return new xs({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ht(t)}})}var Cs=B(`ZodNonOptional`,(e,t)=>{ni.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>za(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ws(e,t){return new Cs({type:`nonoptional`,innerType:e,...yt(t)})}var Ts=B(`ZodCatch`,(e,t)=>{ii.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ha(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Es(e,t){return new Ts({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Ds=B(`ZodPipe`,(e,t)=>{ai.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ua(e,t,n,r),e.in=t.in,e.out=t.out});function Os(e,t){return new Ds({type:`pipe`,in:e,out:t})}var ks=B(`ZodReadonly`,(e,t)=>{si.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function As(e){return new ks({type:`readonly`,innerType:e})}var js=B(`ZodCustom`,(e,t)=>{li.init(e,t),go.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ja(e,t,n,r)});function Ms(e,t={}){return ma(js,e,t)}function Ns(e,t){return ha(e,t)}var Ps={artificial_analysis_intelligence_index:{label:`Intelligence index`,scale:`index`},artificial_analysis_coding_index:{label:`Coding index`,scale:`index`},artificial_analysis_math_index:{label:`Math index`,scale:`index`},gpqa:{label:`GPQA Diamond`,scale:`fraction`},hle:{label:`Humanity's Last Exam`,scale:`fraction`},lcr:{label:`Long-context reasoning`,scale:`fraction`},livecodebench:{label:`LiveCodeBench`,scale:`fraction`},scicode:{label:`SciCode`,scale:`fraction`},math_500:{label:`MATH-500`,scale:`fraction`},aime:{label:`AIME`,scale:`fraction`},aime_25:{label:`AIME 2025`,scale:`fraction`},ifbench:{label:`IFBench`,scale:`fraction`},mmlu_pro:{label:`MMLU Pro`,scale:`fraction`},tau2:{label:`τ²-bench (agentic)`,scale:`fraction`},tau_banking:{label:`τ-bench banking`,scale:`fraction`},terminalbench_hard:{label:`Terminal-Bench Hard`,scale:`fraction`},terminalbench_v2_1:{label:`Terminal-Bench 2.1`,scale:`fraction`}};function Fs(e){return(e.credentialVariants??[]).filter(e=>!e.operatorOnly)}function Is(e){let t=new Set(e.map(e=>e.definition.id));return e.filter(e=>!e.definition.clientGroup||e.definition.clientGroup===e.definition.id||!t.has(e.definition.clientGroup))}function Ls(e,t){return e.filter(e=>e.definition.id===t||e.definition.clientGroup===t&&e.definition.id!==t)}function Rs(e){return Is(e).filter(e=>e.definition.enabled&&e.definition.credentialClass!==`none`&&e.definition.poolOnly!==!0&&T(e.definition.id)&&!D(e.definition.id))}function zs(e){if(!e)return!1;try{let t=new URL(e).hostname.toLowerCase();return t===`127.0.0.1`||t===`localhost`||t===`::1`||t===`[::1]`}catch{return!1}}function Bs(e,t={}){let n=e.displayName,r=t.credentialClass??e.credentialClass,i=t.baseUrl??e.baseUrl;return e.id===`oonacode`?{kind:`pool`,badge:`via OonaCode`,detail:`Runs on OonaCode's own provider accounts, through the OonaCode gateway. Priced models are billed to your account in credits; free models cost nothing on any plan.`,viaGateway:!0}:e.engine===`agy`?{kind:`subscription-direct`,badge:`agy · direct to Google`,detail:`Runs on Google’s own agy CLI on this PC, with your Google plan. Each request is recorded here and goes straight from this PC to Google — never through the OonaCode gateway, and OonaCode does not translate it.`,viaGateway:!1}:e.route===`direct`?{kind:`subscription-direct`,badge:`direct to provider`,detail:`Your ${n} subscription runs straight from this PC to the provider — it never passes through the OonaCode gateway.`,viaGateway:!1}:r===`api_key`&&e.kind!==`anthropic-passthrough`?{kind:`own-key-translated`,badge:`direct to provider`,detail:`Your ${n} key stays on this PC: OonaCode translates the request here and calls ${n} from this machine. The gateway sees neither the key nor the traffic.`,viaGateway:!1}:zs(i)?{kind:`local-server`,badge:`on this machine`,detail:`Runs against ${n} on this machine (${i}) — the request never leaves the PC.`,viaGateway:!1}:r===`api_key`&&e.kind===`anthropic-passthrough`&&e.directCapable===!0?{kind:`own-key-direct`,badge:`direct to provider`,detail:`Your ${n} key runs straight from this PC to ${n} — the OonaCode gateway is not in the path.`,viaGateway:!1}:{kind:`gateway`,badge:`via OonaCode`,detail:`Routed to ${n} through the OonaCode gateway.`,viaGateway:!0}}var Vs=ns(`type`,[Qo({type:us(`oauth-device`),deviceAuthorizationUrl:V().url(),tokenUrl:V().url(),clientId:V().min(1),scopes:Xo(V().min(1)).min(1),signInLabel:V().min(1).optional(),referrer:V().min(1).optional()}),Qo({type:us(`openai-device`),deviceAuthorizationUrl:V().url(),pollUrl:V().url(),tokenUrl:V().url(),verificationUri:V().url(),redirectUri:V().url(),clientId:V().min(1),signInLabel:V().min(1).optional()})]),Hs=Qo({type:us(`google-loopback`),authorizationUrl:V().url(),tokenUrl:V().url(),redirectUri:V().url(),scopes:Xo(V().min(1)).min(1),clientIdSetting:V().min(1),clientSecretSetting:V().min(1),userinfoUrl:V().url().optional(),signInLabel:V().min(1).optional()}),Us=Qo({id:V().min(1),displayName:V().min(1),upstreamId:V().min(1).optional(),servedBy:Xo(V().min(1)).optional(),subscriptionServedBy:Xo(V().min(1)).optional(),contextWindow:Bo().int().positive().optional(),maxOutputTokens:Bo().int().positive().optional(),supportsTools:Wo().optional(),supportsThinking:Wo().optional(),effortLevels:Xo(cs(we)).optional(),defaultEffort:cs(we).optional(),helperModel:V().min(1).optional(),supportsVision:Wo().optional(),inputPricePerM:Bo().nonnegative().optional(),outputPricePerM:Bo().nonnegative().optional(),creditsPerM:Qo({input:Bo().nonnegative(),output:Bo().nonnegative(),maxInput:Bo().nonnegative().optional(),maxOutput:Bo().nonnegative().optional()}).optional(),notes:V().optional(),free:Wo().optional(),aaIntelligence:Bo().optional(),aaCoding:Bo().optional(),aaOutputTps:Bo().optional(),aaTtft:Bo().optional(),aa:Qo({fetchedAt:V(),creator:V().optional(),releaseDate:V().optional(),benchmarks:os(V(),Bo()).optional()}).loose().optional()}).loose(),Ws=Qo({id:V().regex(/^[a-z0-9][a-z0-9-]{1,40}$/,`provider id must be lowercase kebab-case`),displayName:V().min(1),kind:cs([`anthropic-passthrough`,`openai-compatible`,`gemini`]),route:cs([`gateway`,`direct`]),credentialClass:cs([`api_key`,`subscription`,`none`]),baseUrl:V().url(),messagesPath:V().startsWith(`/`).optional(),modelsPath:V().startsWith(`/`).optional(),auth:Qo({header:cs([`x-api-key`,`authorization-bearer`,`api-key`,`x-goog-api-key`,`none`]),extraHeaders:os(V(),V()).optional()}),models:Xo(Us),defaultModel:V().min(1),modelAliases:os(V(),V()).optional(),helperModel:V().min(1).optional(),capabilities:Qo({streaming:Wo(),tools:Wo(),thinking:Wo(),vision:Wo(),countTokens:Wo(),promptCaching:Wo(),promptCacheTtlSec:Bo().int().positive().optional()}),translate:Qo({maxTokensParam:cs([`max_tokens`,`max_completion_tokens`]).optional(),reasoningEffortFromBudget:Wo().optional(),reasoningContentField:V().nullable().optional(),supportsParallelToolCalls:Wo().optional(),systemRole:cs([`system`,`developer`]).optional(),streamIncludeUsage:Wo().optional(),wire:cs([`chat`,`responses`,`gemini-code-assist`]).optional()}).optional(),passthrough:Qo({stripCacheControl:Wo().optional(),cacheChain:Wo().optional(),toolSchemaRequiredArray:Wo().optional(),toolDescriptionRequired:Wo().optional(),keepOutputConfig:Wo().optional(),allowedBetas:Xo(V()).optional(),anthropicVersion:V().optional()}).optional(),userBaseUrl:Wo().optional(),engineEnv:os(V(),V()).optional(),directCapable:Wo().optional(),subscriptionLogin:Vs.optional(),museCliLogin:Qo({type:us(`muse-cli`),signInLabel:V().min(1).optional()}).optional(),poolOnly:Wo().optional(),contributorMode:Qo({suffix:V().min(1),summary:V().min(1)}).optional(),phase:es([us(1),us(2)]),enabled:Wo(),docsUrl:V().url().optional(),notes:V().optional(),references:Xo(Qo({label:V().min(1),url:V().url(),kind:cs([`docs`,`pricing`,`models`,`console`,`status`,`keys`,`signup`,`other`]).optional()})).optional(),keyFormat:V().optional(),credentialVariants:Xo(Qo({id:V().min(1),label:V().min(1),header:cs([`x-api-key`,`authorization-bearer`,`api-key`,`x-goog-api-key`,`none`]).optional(),extraHeaders:os(V(),V()).optional(),operatorOnly:Wo().optional(),requiresClaudeCodeIdentity:Wo().optional(),subscriptionLogin:Vs.optional(),loopbackLogin:Hs.optional(),agyLogin:Qo({type:us(`agy-server`),signInLabel:V().optional()}).optional(),codexLogin:Qo({type:us(`codex-server`),signInLabel:V().optional()}).optional(),museLogin:Qo({type:us(`muse-server`),signInLabel:V().optional()}).optional(),claudeCodeShape:Qo({betas:V().min(1),userAgent:V().min(1),billingHeader:V().min(1),headers:os(V(),V()).optional()}).optional(),baseUrl:V().url().optional(),keyFormat:V().optional(),notes:V().optional()})).optional(),adminGroup:V().optional(),clientGroup:V().optional(),recordLabel:V().optional(),engine:us(`agy`).optional(),effortLevels:Xo(cs(we)).optional(),defaultEffort:cs(we).optional()});Qo({version:Bo().int().positive(),updatedAt:V(),providers:Xo(Ws)});function Gs(e,t){return Ks(e,tc(e,t))}function Ks(e,t){return e.models.find(e=>e.id===t)?.upstreamId??t}function qs(e){return/^claude-/i.test(e)}function Js(e){return/^claude-.+-\d{8}$/i.test(e)?e.replace(/-\d{8}$/,``):null}function Ys(e){return e.replace(/\[1m\]$/i,``)}var Xs=new Set([`opus`,`sonnet`,`haiku`,`fable`]);function Zs(e){return Xs.has(e.toLowerCase())}function Qs(e,t){let n=Ys(t);if(Zs(n)||e.models.some(e=>e.id===n))return null;let r=e.modelAliases;if(!r)return null;let i=Js(n);if(i!==null&&e.models.some(e=>e.id===i))return null;let a=r[n]??(i===null?void 0:r[i]);return a!==void 0&&e.models.some(e=>e.id===a)?a:null}function $s(e,t){return{images:e.models.find(e=>e.id===t)?.supportsVision??e.capabilities.vision,documents:qs(t)}}function ec(e,t,n){let r=$s(e,t),i=e.engine===`agy`,a=new Set;for(let e of n){let t=e?.type;t===`image`&&(i||!r.images)&&a.add(`image`),t===`document`&&(i||!r.documents)&&a.add(`document`)}return a}function tc(e,t){if(!t)return e.defaultModel;if(e.models.some(e=>e.id===t))return t;let n=e.modelAliases?.[t];if(n)return n;let r=Qs(e,t);if(r)return r;let i=t.toLowerCase(),a=i.includes(`haiku`)?`haiku`:i.includes(`opus`)?`opus`:i.includes(`sonnet`)?`sonnet`:i.includes(`fable`)?`fable`:null;if(a){if(e.modelAliases?.[a])return e.modelAliases[a];let t=e.models.find(e=>e.id.toLowerCase().includes(a));if(t)return t.id}return e.defaultModel}var nc={messages:`/v1/messages`,countTokens:`/v1/messages/count_tokens`,models:`/v1/models`,providerMessages:e=>`/p/${e}/v1/messages`,providerCountTokens:e=>`/p/${e}/v1/messages/count_tokens`,providerModels:e=>`/p/${e}/v1/models`,voiceTranslation:`/v1/oonacode/voice-translation`,health:`/api/health`,streamCheck:`/api/stream-check`,register:`/api/auth/register`,login:`/api/auth/login`,refresh:`/api/auth/refresh`,logout:`/api/auth/logout`,me:`/api/auth/me`,prelogin:`/api/auth/prelogin`,tokens:`/api/me/tokens`,token:e=>`/api/me/tokens/${e}`,tokenPurge:e=>`/api/me/tokens/${e}/purge`,tokenSealed:e=>`/api/me/tokens/${e}/sealed`,tokenUsage:e=>`/api/me/tokens/${e}/usage`,providers:`/api/me/providers`,provider:e=>`/api/me/providers/${e}`,providerTest:e=>`/api/me/providers/${e}/test`,routing:`/api/me/routing`,usage:`/api/me/usage`,usageSession:e=>`/api/me/usage/sessions/${e}`,usageBreakdown:`/api/me/usage/breakdown`,devices:`/api/me/devices`,pushToken:`/api/me/push-token`,hostNotify:`/api/me/hosts/notify`,device:e=>`/api/me/devices/${e}`,hosts:`/api/me/hosts`,hostHeartbeat:`/api/me/hosts/heartbeat`,hostVaultUnlock:e=>`/api/me/hosts/${encodeURIComponent(e)}/vault-unlock`,host:e=>`/api/me/hosts/${encodeURIComponent(e)}`,vault:`/api/me/vault`,vaultEvents:`/api/me/vault/events`,registry:`/api/registry`,agentTools:`/api/agent-tools`,agentToolCalls:`/api/me/agent-tools/calls`,poolReleaseSession:`/api/me/pool/release-session`,poolAutoRoute:`/api/me/pool/auto-route`,releasesLatest:`/api/releases/latest`,releasesHistory:`/api/releases`,team:`/api/me/team`,teamInvites:`/api/me/team/invites`,teamInvite:e=>`/api/me/team/invites/${e}`,teamInviteLookup:`/api/team/invites/lookup`,teamInviteDecline:`/api/team/invites/decline`,teamJoin:`/api/me/team/join`,teamInvitations:`/api/me/team/invitations`,teamInvitationAccept:e=>`/api/me/team/invitations/${e}/accept`,teamInvitationDecline:e=>`/api/me/team/invitations/${e}/decline`,teamMember:e=>`/api/me/team/members/${e}`,teamLeave:`/api/me/team/leave`,teamTransfer:`/api/me/team/transfer`,teamAudit:`/api/me/team/audit`,teamCheckout:`/api/me/team/checkout`,teamTopup:`/api/me/team/topup`,teamSeats:`/api/me/team/seats`,googleConfig:`/api/auth/google/config`,googleStart:`/api/auth/google/start`,googleCallback:`/api/auth/google/callback`,githubConfig:`/api/auth/github/config`,githubStart:`/api/auth/github/start`,githubCallback:`/api/auth/github/callback`,googleUnlink:`/api/me/google`,telegramConfig:`/api/auth/telegram/config`,telegramAuth:`/api/auth/telegram`,telegram:`/api/me/telegram`,telegramWebhook:`/api/webhooks/telegram`,passphraseSetup:`/api/auth/passphrase/setup`,passphraseRekey:`/api/me/passphrase/rekey`,recovery:`/api/me/recovery`,recoveryChallenge:`/api/auth/recovery/challenge`,recoveryConsume:`/api/auth/recovery/consume`,deviceApprovals:`/api/me/device-approvals`,deviceApproval:e=>`/api/me/device-approvals/${e}`,deviceApprovalApprove:e=>`/api/me/device-approvals/${e}/approve`,deviceApprovalDeny:e=>`/api/me/device-approvals/${e}/deny`,passwordResetRequest:`/api/auth/password-reset/request`,passwordResetConfirm:`/api/auth/password-reset/confirm`,vaultRekeyComplete:`/api/me/vault/rekey-complete`,vaultRekeyPending:`/api/me/vault/rekey-pending`,emailVerifySend:`/api/auth/email/verify/send`,emailVerifyConfirm:`/api/auth/email/verify/confirm`,emailVerifyWatch:`/api/auth/email/verify/watch`,twoFactor:`/api/me/2fa`,twoFactorEnroll:`/api/me/2fa/enroll`,twoFactorConfirm:`/api/me/2fa/confirm`,twoFactorDisable:`/api/me/2fa/disable`,twoFactorDisableRequest:`/api/me/2fa/disable/request`,twoFactorRecoveryCodes:`/api/me/2fa/recovery-codes`,twoFactorVerify:`/api/auth/2fa/verify`,deviceLinkStart:`/api/auth/device/start`,deviceLinkPoll:`/api/auth/device/poll`,deviceLinks:`/api/me/device-links`,deviceLink:e=>`/api/me/device-links/${e}`,deviceLinkApprove:e=>`/api/me/device-links/${e}/approve`,deviceLinkDeny:e=>`/api/me/device-links/${e}/deny`,hostLogs:`/api/me/hosts/logs`,errorReport:`/api/me/errors`,bugReports:`/api/me/bug-reports`,plans:`/api/plans`,myPlan:`/api/me/plan`,checkout:`/api/me/plan/checkout`,creditsTopup:`/api/me/credits/topup`,billing:`/api/me/billing`},rc=2048,ic=16384,ac=8e3,oc=5242880,sc=12582912;new Set(`BCDFGHJKLMNPQRSTVWXZ`.split(``));var cc=`discard-my-vault-and-history`,lc=`Anyone who can use this device can use your saved provider keys without your passphrase. Turn this off on shared or public computers. You can revoke it any time from Devices.`,uc={notes:100,title:80,text:1e5,totalText:1e6},dc={name:120,instructions:2e4,goal:2e3,repositories:50,repositoryUrl:500,memory:2e4,minIntervalFloor:1,minIntervalCeiling:10080},fc=`⏰ Scheduled task "`;function pc(e){if(!e.startsWith(fc))return null;let t=e.indexOf(`"
|
|
79
79
|
|
|
80
|
-
`,18);return t<0?null:{title:e.slice(18,t),prompt:e.slice(t+3)}}Object.freeze({tengu_amber_sentinel:!0,tengu_groovy_eclipse:!0,tengu_humble_hammock:!0});function mc(e){return e===null||!Number.isFinite(e)?`neutral`:e>30?`ok`:e>10?`warn`:`danger`}var hc=3e4,gc=1440,_c=6e4,vc=[`mon`,`tue`,`wed`,`thu`,`fri`,`sat`,`sun`],yc=/^([01]\d|2[0-3]):[0-5]\d$/;Qo({tz:V().min(1),windows:Xo(Qo({from:V().regex(yc,`HH:MM`),to:V().regex(yc,`HH:MM`),days:Xo(cs(vc)).optional(),kind:cs([`peak`,`offpeak`])})),offpeakDiscount:Bo().nonnegative().max(1).optional()});var bc=[`priceInputCacheMissPeak`,`priceInputCacheMissOffpeak`,`priceInputCacheHitPeak`,`priceInputCacheHitOffpeak`,`priceCacheWritePeak`,`priceCacheWriteOffpeak`,`priceOutputPeak`,`priceOutputOffpeak`],xc=Qo({inputCacheMiss:Bo().nonnegative(),inputCacheHit:Bo().nonnegative().optional(),cacheWrite:Bo().nonnegative().optional(),output:Bo().nonnegative()});Qo({by:us(`prompt_tokens`),tiers:Xo(Qo({upToPromptTokens:Bo().int().positive().optional(),price:xc.optional(),cost:xc.optional()})).min(1),note:V().optional()}).superRefine((e,t)=>{let n=0;e.tiers.forEach((r,i)=>{!r.cost&&!r.price&&t.addIssue({code:`custom`,message:`a tier needs its cost (the provider’s rates; retail is cost × the record’s ratio)`,path:[`tiers`,i,`cost`]});let a=r.upToPromptTokens;if(a===void 0){i!==e.tiers.length-1&&t.addIssue({code:`custom`,message:`only the LAST tier may omit upToPromptTokens`,path:[`tiers`,i]});return}a<=n&&t.addIssue({code:`custom`,message:`tiers must ascend: ${a} does not exceed ${n}`,path:[`tiers`,i,`upToPromptTokens`]}),n=a})}),[...bc];var Sc={realtime:`/v1/realtime`,translations:`/v1/realtime/translations`,live:`/v1/live/sessions`,speechStream:`/v1/audio/speech/stream`,transcriptionStream:`/v1/audio/transcriptions/stream`,clientSecrets:`/v1/realtime/client_secrets`,translationClientSecrets:`/v1/realtime/translations/client_secrets`};Sc.realtime,Sc.translations,Sc.live,Sc.speechStream,Sc.transcriptionStream;var Cc=`M0.72 12a11.28 11.28 0 1 0 22.56 0a11.28 11.28 0 1 0 -22.56 0ZM4.8 12a7.2 7.2 0 1 0 14.4 0a7.2 7.2 0 1 0 -14.4 0ZM7.44 12a4.56 4.56 0 1 0 9.12 0a4.56 4.56 0 1 0 -9.12 0Z`,wc=`M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z`,Tc=`M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z`,Ec=`M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81`,Dc={oonacode:{hex:`#000000`,owner:`OonaCode`,d:Cc,fillRule:`evenodd`},anthropic:{hex:`#D97757`,owner:`Anthropic`,d:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`},"anthropic-subscription":{hex:`#D97757`,owner:`Anthropic`,d:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`},openai:{hex:`#000000`,owner:`OpenAI`,d:Tc},xai:{hex:`#000000`,owner:`xAI`,d:wc},deepseek:{hex:`#5786FE`,owner:`DeepSeek`,d:`M23.748 4.651c-.254-.124-.364.113-.512.233-.051.04-.094.09-.137.137-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.155-.708-.311-.955-.65-.172-.24-.219-.509-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.094.172.187.129.323-.082.28-.18.553-.266.833-.055.179-.137.218-.328.14a5.5 5.5 0 0 1-1.737-1.179c-.857-.828-1.631-1.743-2.597-2.46a12 12 0 0 0-.689-.47c-.985-.957.13-1.743.387-1.836.27-.098.094-.433-.778-.428-.872.003-1.67.295-2.687.685a3 3 0 0 1-.465.136 9.6 9.6 0 0 0-2.883-.101c-1.885.21-3.39 1.1-4.497 2.622C.082 8.776-.231 10.854.152 13.02c.403 2.284 1.568 4.175 3.36 5.653 1.857 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.132-.284 4.994-1.86.47.234.962.328 1.78.398.629.058 1.235-.031 1.705-.129.735-.155.684-.836.418-.961-2.155-1.004-1.682-.595-2.112-.926 1.095-1.295 2.768-3.598 3.284-6.733.05-.346.115-.834.108-1.114-.004-.171.035-.238.23-.257a4.2 4.2 0 0 0 1.545-.475c1.397-.763 1.96-2.016 2.093-3.517.02-.23-.004-.467-.247-.588M11.58 18.168c-2.088-1.642-3.101-2.183-3.52-2.16-.39.024-.32.472-.234.763.09.288.207.487.371.74.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.168-1.361-.801-2.5-1.86-3.301-3.306-.775-1.393-1.225-2.888-1.299-4.482-.02-.385.094-.522.477-.592a4.7 4.7 0 0 1 1.53-.038c2.131.311 3.946 1.264 5.467 2.774.868.86 1.525 1.887 2.202 2.89.72 1.066 1.494 2.082 2.48 2.915.348.291.626.513.892.677-.802.09-2.14.109-3.055-.615zm1.001-6.44a.306.306 0 0 1 .415-.287.3.3 0 0 1 .113.074.3.3 0 0 1 .086.214c0 .17-.136.307-.308.307a.303.303 0 0 1-.306-.307m3.11 1.596c-.2.081-.4.151-.591.16a1.25 1.25 0 0 1-.798-.254c-.274-.23-.47-.358-.551-.758a1.7 1.7 0 0 1 .015-.588c.07-.327-.007-.537-.238-.727-.188-.156-.426-.199-.689-.199a.6.6 0 0 1-.254-.078.253.253 0 0 1-.114-.358 1 1 0 0 1 .192-.21c.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.392.451.462.576.685.915.176.264.336.536.446.848.066.194-.02.353-.25.45`},kimi:{hex:`#000000`,owner:`Moonshot`,d:`M21.765.351C22.998.351 24 1.353 24 2.586S22.998 4.82 21.765 4.82h-1.974c-.15 0-.26-.12-.26-.26V2.586A2.237 2.237 0 0 1 21.765.35M9.41 13.388l8.447-8.377c.16-.16.07-.471-.14-.471h-4.55s-.1.02-.14.06l-9.099 9.029c-.14.14-.35.02-.35-.21V4.81c0-.15-.1-.27-.221-.27H.22c-.12 0-.22.12-.22.27v18.57c0 .15.1.27.22.27h3.137c.12 0 .22-.12.22-.27v-3.79c0-.08.03-.16.08-.21l2.826-2.796c.07-.07.16-.08.241-.03l7.546 5.551a8.9 8.9 0 0 0 4.018 1.493c.12.01.23-.11.23-.27V19.76c0-.14-.08-.25-.19-.26a5.8 5.8 0 0 1-2.355-.942l-6.533-4.73c-.14-.09-.15-.32-.03-.441`},qwen:{hex:`#6950EF`,owner:`Alibaba`,d:`M23.919 14.545 20.817 9.17l1.47-2.544a.56.56 0 0 0 0-.566l-1.633-2.83a.57.57 0 0 0-.49-.283h-6.207L12.487.402a.57.57 0 0 0-.49-.284H8.732a.56.56 0 0 0-.49.284L5.139 5.775h-2.94a.56.56 0 0 0-.49.284L.077 8.887a.56.56 0 0 0 0 .567L3.18 14.83l-1.47 2.545a.56.56 0 0 0 0 .566l1.634 2.83a.57.57 0 0 0 .49.283h6.205l1.47 2.545a.57.57 0 0 0 .49.284h3.266a.57.57 0 0 0 .49-.284l3.104-5.375h2.94a.57.57 0 0 0 .49-.283l1.634-2.828a.55.55 0 0 0-.004-.568M8.733.686l1.634 2.828-1.634 2.828H21.8L20.164 9.17H7.425L5.63 6.06Zm1.306 19.801-6.205-.002 1.634-2.83h3.265L2.201 6.344h3.267q3.182 5.517 6.367 11.032zm10.124-5.66L18.53 12l-6.532 11.315-1.634-2.83c2.129-3.673 4.25-7.351 6.373-11.028h3.592l3.102 5.374z`},"xai-subscription":{hex:`#000000`,owner:`xAI`,d:wc},"openai-subscription":{hex:`#000000`,owner:`OpenAI`,d:Tc},"openai-codex":{hex:`#000000`,owner:`OpenAI`,d:Tc},"google-agy":{hex:`#8E75B2`,owner:`Google`,d:Ec},antigravity:{hex:`#8E75B2`,owner:`Google`,d:Ec},mimo:{hex:`#FF6900`,owner:`Xiaomi`,d:`M12 0C8.016 0 4.756.255 2.493 2.516.23 4.776 0 8.033 0 12.012c0 3.98.23 7.235 2.494 9.497C4.757 23.77 8.017 24 12 24c3.983 0 7.243-.23 9.506-2.491C23.77 19.247 24 15.99 24 12.012c0-3.984-.233-7.243-2.502-9.504C19.234.252 15.978 0 12 0zM4.906 7.405h5.624c1.47 0 3.007.068 3.764.827.746.746.827 2.233.83 3.676v4.54a.15.15 0 0 1-.152.147h-1.947a.15.15 0 0 1-.152-.148V11.83c-.002-.806-.048-1.634-.464-2.051-.358-.36-1.026-.441-1.72-.458H7.158a.15.15 0 0 0-.151.147v6.98a.15.15 0 0 1-.152.148H4.906a.15.15 0 0 1-.15-.148V7.554a.15.15 0 0 1 .15-.149zm12.131 0h1.949a.15.15 0 0 1 .15.15v8.892a.15.15 0 0 1-.15.148h-1.949a.15.15 0 0 1-.151-.148V7.554a.15.15 0 0 1 .151-.149zM8.92 10.948h2.046c.083 0 .15.066.15.147v5.352a.15.15 0 0 1-.15.148H8.92a.15.15 0 0 1-.152-.148v-5.352a.15.15 0 0 1 .152-.147Z`}};function Oc(e){return Dc[e]??null}function kc(e){let t=e.replace(/\(.*?\)/g,` `).split(/[\s/_-]+/).filter(Boolean);return t.length===0?`?`:t.length===1?t[0].slice(0,2).toUpperCase():`${t[0][0]}${t[1][0]}`.toUpperCase()}var Ac=9230,jc=1024,Mc=65534,Nc=`127.0.0.1`;Object.freeze({enabled:!1,port:Ac,inspectMain:!1}),Object.freeze({port:null,listening:!1,fromCommandLine:!1,inspectPort:null,inspectProblem:null});function Pc(e){return e+1}function Fc(e){return typeof e==`number`&&Number.isInteger(e)}function Ic(e){return!Fc(e)||e<1024||e>65534?`The port must be a whole number from ${jc.toLocaleString(`en-US`)} to ${Mc.toLocaleString(`en-US`)} (the main-process inspector takes the next one).`:null}function Lc(e){return e.port!==null||e.inspectPort!==null}function Rc(e,t){let n=e.enabled?e.port:null,r=e.enabled&&e.inspectMain?Pc(e.port):null;return!t.fromCommandLine&&t.port!==n||t.inspectPort!==r}function zc(e){let t=[];return e.port!==null&&t.push(`${Nc}:${e.port}`),e.inspectPort!==null&&t.push(`${Nc}:${e.inspectPort}`),t.length===2?`${t[0]} (windows) and ${t[1]} (main process)`:e.inspectPort===null?t[0]??``:`${t[0]} (main process)`}var Bc=[`stable`,`dev`];function Vc(e){return typeof e==`string`&&Bc.includes(e)}function Hc(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return Vc(t)?t:null}var Uc=[`win32`,`linux`,`darwin`],Wc=[`x64`,`arm64`];function Gc(e,t){let n=Hc(e)??`stable`,r=[];return n!==`stable`&&r.push(`channel=${encodeURIComponent(n)}`),t&&Uc.includes(t.platform)&&(r.push(`platform=${t.platform}`),t.arch&&Wc.includes(t.arch)&&r.push(`arch=${t.arch}`)),r.length>0?`${nc.releasesLatest}?${r.join(`&`)}`:nc.releasesLatest}function Kc(e,t){let n=Hc(t)??`stable`;return n===`stable`?e:`${e} (${n})`}var qc={safeguards:`safeguards`,safety_filters:`safety filters`},Jc=[{vendor:`Alibaba (Model Studio / DashScope — Qwen, and the DeepSeek/GLM it hosts)`,seenAs:`400 {"error":{"code":"data_inspection_failed","message":"Input data may contain inappropriate content."}}`,pattern:/data[_ ]?inspection[_ ]?failed|may contain inappropriate content/i},{vendor:`Zhipu (GLM)`,seenAs:`400 {"error":{"code":"1301","message":"系统检测到输入或生成内容可能包含不安全或敏感内容…"}} (contentFilter)`,pattern:/"code"\s*:\s*"?1301"?|不安全或敏感内容|unsafe or sensitive content|contentFilter/i},{vendor:`DeepSeek`,seenAs:`400 {"error":{"message":"Content Exists Risk","type":"invalid_request_error"}}`,pattern:/content exists risk/i},{vendor:`Moonshot (Kimi)`,seenAs:`400 {"error":{"type":"content_filter","message":"The request was rejected because it was considered high risk"}}`,pattern:/"type"\s*:\s*"content_filter"|considered high risk/i},{vendor:`xAI (Grok)`,seenAs:`400 "Content violates usage guidelines. Failed check: SAFETY_CHECK_TYPE_…"`,pattern:/content violates usage guidelines|SAFETY_CHECK_TYPE_/i},{vendor:`OpenAI (and Azure-style filters)`,seenAs:`400 {"error":{"code":"content_filter" | "content_policy_violation" | "moderation_blocked"}}`,pattern:/"code"\s*:\s*"(?:content_filter|content_policy_violation|moderation_blocked)"/i},{vendor:`Google (Gemini)`,seenAs:`This request was blocked by Gemini's filters. They can occasionally trigger by mistake on safe coding, security, or biology-related queries.`,pattern:/blocked by Gemini(?:'s)? filters|Gemini(?:'s)? filters/i}],Yc=/blocked by (?:the )?(?:content[ -]safety|Gemini(?:'s)?) filters?|content safety filters?|blocked by Gemini(?:'s)? filters?/i,Xc=/blocked by Gemini(?:'s)? filters|Gemini(?:'s)? filters\.? They can occasionally trigger/i;function Zc(e){return typeof e==`string`&&Xc.test(e)}function Qc(e){return typeof e!=`string`||e===``||!/^\s*(?:Failed to authenticate\.\s*)?API Error\b/i.test(e)?null:Jc.find(t=>t.pattern.test(e))??null}function $c(e){return typeof e==`string`&&(Zc(e)||Yc.test(e)&&/blocked/i.test(e))}var el=`:free`;function tl(e){return e.endsWith(el)}function nl(e){return tl(e)?e.slice(0,-5):e}var rl=`model_refusal_fallback`,il=`model_refusal_no_fallback`;function al(e){return typeof e==`string`&&e.trim()!==``?e.trim():null}function ol(e,t,n){return al(e[t])??al(e[n])}function sl(e){if(typeof e!=`object`||!e)return null;let t=e,n=t.subtype,r=n===`model_refusal_fallback`?`fallback`:n===`model_refusal_no_fallback`?`no_fallback`:t.kind===`fallback`||t.kind===`no_fallback`?t.kind:null;if(!r||t.type!==void 0&&t.type!==`system`)return null;let i=t.retracted_message_uuids??t.retractedMessageUuids??t.retractedUuids;return{kind:r,scope:t.scope===`local`?`local`:`session`,originalModel:ol(t,`original_model`,`originalModel`),fallbackModel:r===`fallback`?ol(t,`fallback_model`,`fallbackModel`):null,category:ol(t,`api_refusal_category`,`apiRefusalCategory`)??al(t.category),explanation:ol(t,`api_refusal_explanation`,`apiRefusalExplanation`)??al(t.explanation),text:typeof t.content==`string`?t.content.trim():al(t.text)??``,retractedUuids:Array.isArray(i)?i.filter(e=>typeof e==`string`):[]}}function cl(e,t){switch(t.type){case`notice`:return t.notice.kind!==`fallback`||t.notice.scope!==`session`?e:{notice:t.notice,at:t.at,live:t.live};case`engine_start`:case`model_change`:return null}}function ll(e,t){return!e||t.alive===!1||!e.live&&t.since!==null&&e.at!==null&&e.at<t.since?null:e}function ul(e){let t=Ys(e.trim()),n=t.slice(t.lastIndexOf(`/`)+1),r=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),i=n.split(`-`);if(i[0]?.toLowerCase()!==`claude`)return t;let a=i.slice(1).filter(e=>!/^\d{6,}$/.test(e)),o=a.filter(e=>!/^\d+$/.test(e)),s=a.filter(e=>/^\d+$/.test(e));return o.length!==1||s.length===0?t:`${r(o[0])} ${s.join(`.`)}`}function dl(e,t=[]){let n=Ys(e.trim()),r=null;for(let e of t)for(let t of e.definition.models){if(t.id===n||Ys(t.id)===n)return t.displayName;r===null&&(t.upstreamId===n||nl(t.id)===n)&&(r=t.displayName)}return r??ul(n)}function fl(e){return`${e} (safeguard)`}var pl=`none`,ml={mode:`auto`,model:null,perModel:{}};function hl(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0&&t.length<=200&&/^[A-Za-z0-9._:@/[\]-]+$/.test(t)?t:null}function gl(e){return Ys(e.trim()).toLowerCase()}function _l(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e:{},n=hl(t.model),r=t.mode,i=r===`off`?`off`:r===`model`&&n!==null?`model`:`auto`,a={},o=t.perModel;if(typeof o==`object`&&o&&!Array.isArray(o))for(let[e,t]of Object.entries(o)){let n=hl(e),r=t===`none`?pl:hl(t);if(n!==null&&r!==null&&gl(n)!==gl(r)&&(a[gl(n)]=r,Object.keys(a).length>=64))break}return{mode:i,model:i===`model`?n:null,perModel:a}}function vl(e){return e===w}var yl=`oona settings safeguard-fallback auto`;function bl(e,t=[]){if(!e)return`the model`;let n=gl(e);return t.find(e=>gl(e.id)===n||e.upstreamId&&gl(e.upstreamId)===n)?.displayName??ul(e)}function xl(e,t=e=>bl(e)){let n=`blocked by ${qc[e.reason]}`;if(e.outcome===`retried`)return`${n} → retried on ${e.retriedOn?t(e.retriedOn):`another model`}`;switch(e.blocked){case`off`:return`${n} · fallback off (${yl})`;case`no_model`:return`${n} · no fallback model`;case`unavailable`:return`${n} · fallback not available here`;case`refused_again`:return`${n} · fallback refused too`;case`not_retryable`:return`${n} · not retried`;default:return n}}var Sl=5e4,Cl=6,wl=[`sessions`,`search`,`files`],Tl=[`media`,`sessionInfo`];function El(e){return typeof e==`string`&&wl.includes(e)?e:null}function Dl(e){if(!Array.isArray(e))return null;let t=[];for(let n of e)typeof n==`string`&&Tl.includes(n)&&!t.includes(n)&&t.push(n);return t}var Ol=[`bg`,`surface`,`surface-2`,`surface-3`,`border`,`fg`,`fg-muted`,`fg-faint`,`accent`,`accent-fg`,`accent-soft`,`project`,`ok`,`ok-soft`,`warn`,`warn-soft`,`danger`,`danger-soft`,`think`,`think-soft`,`code-bg`,`user-bubble`],kl=/^[A-Za-z0-9 ,'"_-]+$/,Al=/^(?:[A-Za-z0-9 _-]+|'[A-Za-z0-9 _-]+'|"[A-Za-z0-9 _-]+")$/;function jl(e){let t=typeof e==`number`&&Number.isFinite(e)?Math.round(e):NaN;return Number.isFinite(t)?Math.min(28,Math.max(10,t)):null}function Ml(e){if(typeof e!=`string`)return null;let t=e.trim().slice(0,160).trim();return t.length===0||!kl.test(t)?null:t.split(`,`).every(e=>Al.test(e.trim()))?t:null}function Nl(e){let t=$l(e);return{family:Ml(t.family),size:jl(t.size)}}function Pl(e){let t=$l(e);return{chat:Nl(t.chat),sidebar:Nl(t.sidebar)}}var Fl={agentFinished:!1,permissionRequired:!0,errorOccurred:!0},Il={autoAcceptPermissions:!1,autosaveFiles:!1,safeguardFallback:ml,showReasoningSummaries:!0,notifications:Fl,showAgentPicker:!0,transcriptWindowSize:500,openTabs:[],draftTabs:[],draftTitles:{},activeTab:null,editorLayout:null,remoteTabs:{},sessionPanelOpen:!1,explorerOpen:!1,leftPanelSection:`sessions`,leftPanelOpen:!0,rightPanelSections:[],rightPanelCollapsed:[],sidebarWidth:288,sessionPanelWidth:288,mediaPanelWidth:320,rightPanelWidth:320,sidebarPinned:!0,dismissedUpdateVersion:null,lastSeenReleaseNotes:null,claudeImportOffered:!1,claudeImportOffers:0,collapsedProjects:[],themeColors:{light:{},dark:{}},fonts:{chat:{family:null,size:null},sidebar:{family:null,size:null}},pinned:[],sidebarView:`recent`};function Ll(e){return Math.min(Math.max(typeof e==`number`&&Number.isFinite(e)?Math.floor(e):0,0),3)}function Rl(e){return Math.min(640,Math.max(200,typeof e==`number`&&Number.isFinite(e)?Math.round(e):288))}function zl(e,t){return Math.min(720,Math.max(240,typeof e==`number`&&Number.isFinite(e)?Math.round(e):t))}function Bl(e){return Math.min(Sl,Math.max(100,typeof e==`number`&&Number.isFinite(e)?Math.round(e):500))}function Vl(e,t){return typeof e==`boolean`?e:t}function Hl(e){return typeof e==`string`&&e.length>0&&e.length<=64?e:null}function Ul(e,t=50){if(!Array.isArray(e))return[];let n=[];for(let r of e)if(!(typeof r!=`string`||r.length===0||r.length>200)&&!n.includes(r)&&(n.push(r),n.length>=t))break;return n}function Wl(e,t=50){if(typeof e!=`object`||!e||Array.isArray(e))return{};let n={};for(let[r,i]of Object.entries(e))if(!(r.length===0||r.length>200)&&!(typeof i!=`string`||i.length===0||i.length>200)&&(n[r]=i,Object.keys(n).length>=t))break;return n}function Gl(e){if(typeof e!=`string`)return null;let t=e.trim();return/^#[0-9a-fA-F]{6}$/.test(t)?t.toLowerCase():null}function Kl(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e)){if(!Ol.includes(n))continue;let e=Gl(r);e!==null&&(t[n]=e)}return t}function ql(e){let t=typeof e==`object`&&e?e:{};return{light:Kl(t.light),dark:Kl(t.dark)}}function Jl(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!=`object`||!n)continue;let e=n.kind,r=n.id;if((e===`chat`||e===`project`)&&!(typeof r!=`string`||r.length===0||r.length>200)&&!t.some(t=>t.kind===e&&t.id===r)&&(t.push({kind:e,id:r}),t.length>=50))break}return t}function Yl(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return null;let n=e,r=new Set(t),i=new Set,a=0,o=(e,t)=>{if(t>Cl||typeof e!=`object`||!e)return null;let n=e,s=n.group;if(typeof s==`object`&&s&&!Array.isArray(s)){if(a>=8)return null;let e=s,t=[];for(let n of Array.isArray(e.tabs)?e.tabs:[])typeof n!=`string`||!r.has(n)||i.has(n)||(i.add(n),t.push(n));return t.length===0?null:(a+=1,{group:{tabs:t,active:(typeof e.active==`string`&&t.includes(e.active)?e.active:null)??t[t.length-1]}})}let c=n.split;if(c!==`row`&&c!==`column`)return null;let l=Array.isArray(n.children)?n.children:[],u=Array.isArray(n.sizes)?n.sizes:[],d=[],f=[];if(l.slice(0,8).forEach((e,n)=>{let r=o(e,t+1);if(!r)return;d.push(r);let i=u[n];f.push(typeof i==`number`&&Number.isFinite(i)&&i>0?i:0)}),d.length===0)return null;if(d.length===1)return d[0];let p=f.filter(e=>e>0),m=p.length>0?p.reduce((e,t)=>e+t,0)/p.length:1,h=f.map(e=>e>0?e:m),g=h.reduce((e,t)=>e+t,0);return{split:c,sizes:h.map(e=>e/g),children:d}},s=o(n.root,0);if(!s||a<2)return null;let c=n.focused;return{root:s,focused:typeof c==`number`&&Number.isInteger(c)&&c>=0&&c<a?c:0}}function Xl(e,t,n){return e.some(e=>e.kind===t&&e.id===n)}function Zl(e,t,n,r){return r===Xl(e,t,n)?e:r?[...e.length>=50?e.slice(e.length-50+1):e,{kind:t,id:n}]:e.filter(e=>e.kind!==t||e.id!==n)}function Ql(e){let t=typeof e==`object`&&e?e:{},n=typeof t.notifications==`object`&&t.notifications!==null?t.notifications:{},r=Ul(t.openTabs),i=Ul(t.draftTabs).filter(e=>!r.includes(e)),a={};for(let[e,n]of Object.entries(Wl(t.draftTitles)))i.includes(e)&&(a[e]=n);let o=[...r,...i],s=t.activeTab,c=typeof s==`string`&&o.includes(s)?s:o[o.length-1]??null,l=Vl(t.sessionPanelOpen,Il.sessionPanelOpen),u=Vl(t.explorerOpen,Il.explorerOpen),d=Dl(t.rightPanelSections)??(l?[`sessionInfo`]:[]),f=(Dl(t.rightPanelCollapsed)??[]).filter(e=>d.includes(e));return{autoAcceptPermissions:Vl(t.autoAcceptPermissions,Il.autoAcceptPermissions),autosaveFiles:Vl(t.autosaveFiles,Il.autosaveFiles),safeguardFallback:_l(t.safeguardFallback),showReasoningSummaries:Vl(t.showReasoningSummaries,Il.showReasoningSummaries),notifications:{agentFinished:Vl(n.agentFinished,Fl.agentFinished),permissionRequired:Vl(n.permissionRequired,Fl.permissionRequired),errorOccurred:Vl(n.errorOccurred,Fl.errorOccurred)},showAgentPicker:Vl(t.showAgentPicker,Il.showAgentPicker),transcriptWindowSize:Bl(t.transcriptWindowSize),openTabs:r,draftTabs:i,draftTitles:a,activeTab:c,editorLayout:Yl(t.editorLayout,o),remoteTabs:Wl(t.remoteTabs),sessionPanelOpen:l,explorerOpen:u,leftPanelSection:El(t.leftPanelSection)??(u?`files`:`sessions`),leftPanelOpen:Vl(t.leftPanelOpen,Il.leftPanelOpen),rightPanelSections:d,rightPanelCollapsed:f,sidebarWidth:Rl(t.sidebarWidth),sessionPanelWidth:zl(t.sessionPanelWidth,288),mediaPanelWidth:zl(t.mediaPanelWidth,320),rightPanelWidth:zl(t.rightPanelWidth??t.mediaPanelWidth??t.sessionPanelWidth,320),sidebarPinned:Vl(t.sidebarPinned,Il.sidebarPinned),dismissedUpdateVersion:Hl(t.dismissedUpdateVersion),lastSeenReleaseNotes:Hl(t.lastSeenReleaseNotes),claudeImportOffered:Vl(t.claudeImportOffered,Il.claudeImportOffered),claudeImportOffers:Ll(t.claudeImportOffers),collapsedProjects:Ul(t.collapsedProjects),themeColors:ql(t.themeColors),fonts:Pl(t.fonts),pinned:Jl(t.pinned),sidebarView:t.sidebarView===`projects`?`projects`:`recent`}}new Set(Object.keys(Il));function $l(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}var eu=3650,tu=[{version:`0.3.286`,date:`2026-10-31`,added:[`The terminal can choose the picture, video and speech model for a chat: oona --image-model, --video-model and --audio-model, also when you continue a chat with -c or -r. Leave a flag out and that kind stays on the default.`],fixed:[]},{version:`0.3.285`,date:`2026-10-31`,added:[`Save to send later: each saved message has an ✕, so you can delete it from the list without sending it.`],fixed:[]},{version:`0.3.284`,date:`2026-10-30`,added:[`Your chats on this PC are now encrypted, so no other program and no copy of the file can read them. It happens by itself, once, on the first start of this version — about a minute for every 3 GB of history, with the progress on the start screen. If the app closes meanwhile, nothing is lost: it starts over next time.`,`The key is held by Windows (or your Mac’s keychain or Linux keyring) for your user account, with a copy in your vault. If your PC ever loses it, oona db recover-key brings it back.`,`Once your chats are encrypted, the old history files in Documents\\OonaCode-backups are moved into the encrypted database and the plain files are deleted.`,`Encryption protects the file at rest. Programs running as you while OonaCode is open can still reach what you can, as with any app.`],fixed:[]},{version:`0.3.283`,date:`2026-10-30`,added:[`File → Connect an AI tool…: let Claude Code or another AI tool read your chats on this PC — all of them, chosen ones or one project, for an hour, a day or until you revoke it. Read-only, and the tool never gets your password or vault key. Every read is listed, and one click ends it.`,`Videos: Wan 3.0 animates a photo to a song (a reference picture plus reference audio), takes a document or a web page as a brief, reference clips with pictures, and prompts up to 20,000 characters. Wan 2.7, Wan 2.6, HappyHorse and Grok Imagine gained the options their makers offer that were missing here.`,`Pictures: each model now offers everything its maker does — for example a transparent background, JPEG or WebP and masked edits on GPT Image, image sets on Wan 2.7, and a thinking mode on Qwen-Image 3.0. One call can make several pictures, and chats can use every picture and video model the service runs.`,`This version can open an encrypted chat database. The next update encrypts the chats on this PC by itself, once, with the progress on the start screen.`,`oona db recover-key brings this PC’s chat-database key back from your vault, if Windows or your keyring ever loses it.`],fixed:[`A negative prompt on Wan video models is now actually applied (it was sent where the provider never reads it).`,`Pictures from Qwen, Wan and Grok Imagine models are saved in the chat again; they used to fail to save.`,`A sound clip longer than 15 seconds for Wan 3.0 now says how long it is, instead of a wrong “goes without a picture” error.`,`Very long chats keep their older history inside OonaCode’s database, not as plain text files in Documents\\OonaCode-backups. The files earlier versions wrote there are moved back in once the database is encrypted.`]},{version:`0.3.282`,date:`2026-10-30`,added:[`Allow Telegram to reach this PC (Settings → This PC): the OonaCode bot can list, open and answer this PC’s chats only while it is on. It starts off — turn it on for each PC you want to use from Telegram.`,`The desktop app, the VS Code panel and a browser window each remember their own open chats, saved the moment they change. One of them can no longer close the chats another had open.`,`The groundwork for encrypting the chats stored on your PC: OonaCode now uses a database engine that can encrypt them. Nothing is encrypted yet — that comes in a later update, by itself.`],fixed:[`Chats an earlier update closed come back on the first start of this one, wherever the window still had its own copy of them (the desktop app usually does).`,`The Windows install command no longer waits for ever on a download that has stopped moving; it tries again.`]},{version:`0.3.281`,date:`2026-10-30`,added:[],fixed:[`Stop now really stops the answer: the model’s provider is told to stop too, so nobody pays for output that is no longer read — on your own key and on the OonaCode pool.`,`The message box no longer loses the keyboard to a video or sound player in the chat while you type.`,`A firewall, proxy or Cloudflare page answering in place of OonaCode no longer signs your PC out.`,`Two open tabs of the website no longer sign each other out.`,`Deleting a chat that still had messages waiting to send no longer brings the chat back.`,`Credits are no longer kept on hold when a request fails on our side before it reaches the model.`,`A long chat on a model whose context size is unknown now says when its oldest part was left out on resume, instead of dropping it silently.`,`A crafted link can no longer point your local OonaCode window at another server.`,`Opening a file from a chat refuses more kinds of programs (help files, add-ins and others).`]},{version:`0.3.280`,date:`2026-10-29`,added:[],fixed:[`Google agy chats now retry temporary INVALID_ARGUMENT failures and no longer report an old failure again after a later reply succeeds.`,`Hosted agents keep the model explicitly requested instead of silently substituting the pool default when that model is absent from the public list.`]},{version:`0.3.279`,date:`2026-10-29`,platforms:[`darwin`],added:[`HappyHorse 1.1 is in the video model list: text-to-video, image-to-video and reference-to-video (up to 9 pictures), 3–15 seconds at up to 1080P. Pick it for a chat under Tools → Video model.`,`Asking the video tool what it accepts now lists every video model the chat can use — each with its own inputs (Grok Imagine 1.5’s preset voices included) — and marks the one this chat uses, so you can see what switching models would give you.`,`Save to send later: the clock button to the right of Send keeps the message you typed in this chat instead of sending it. The badge on the button counts what is saved; with an empty message box, the button opens the list (oldest first) — pick one to put it back in the box, edit it if you like, and sending it takes it off the list.`,`The video tool now offers everything the video model you picked actually takes — not just a description and a first picture. Wan 3.0 can be handed a clip to edit and reference clips and sounds, Grok Imagine 1.5 takes preset voices for the speakers and pictures pinned inside the clip, and models that accept a last frame, a “what must not appear” note, a seed or a watermark offer those too.`],fixed:[`Files a reply names — a plan, a report, any plain file, not just pictures, clips and sounds — now appear in the chat’s Media panel under Files.`,`Ctrl+F opens the chat’s find bar on Armenian, Farsi and other non-Latin keyboard layouts too.`,`A clip or a sound in the chat no longer starts playing by itself when you send a new message.`]},{version:`0.3.278`,date:`2026-10-29`,added:[`HappyHorse 1.1 is in the video model list: text-to-video, image-to-video and reference-to-video (up to 9 pictures), 3–15 seconds at up to 1080P. Pick it for a chat under Tools → Video model.`,`Asking the video tool what it accepts now lists every video model the chat can use — each with its own inputs (Grok Imagine 1.5’s preset voices included) — and marks the one this chat uses, so you can see what switching models would give you.`],fixed:[`The “save to send later” clock now sits to the right of the Send/Queue button.`]},{version:`0.3.277`,date:`2026-10-29`,added:[`Save to send later: the clock button beside Send keeps the message you typed in this chat instead of sending it. The badge on the button counts what is saved; with an empty message box, the button opens the list (oldest first) — pick one to put it back in the box, edit it if you like, and sending it takes it off the list.`,`The video tool now offers everything the video model you picked actually takes — not just a description and a first picture. Wan 3.0 can be handed a clip to edit and reference clips and sounds, Grok Imagine 1.5 takes preset voices for the speakers and pictures pinned inside the clip, and models that accept a last frame, a “what must not appear” note, a seed or a watermark offer those too. Ask the chat what its video model accepts, or just describe what you want: it checks against the model and says what does not fit.`],fixed:[`Files a reply names — a plan, a report, any plain file, not just pictures, clips and sounds — now appear in the chat’s Media panel under Files. Before, a file like a Markdown plan printed in the chat was missing there.`,`Ctrl+F opens the chat’s find bar on Armenian, Farsi and other non-Latin keyboard layouts too. Before it only worked when the layout typed a Latin “f”, so on those layouts nothing happened.`,`A clip or a sound in the chat no longer starts playing by itself when you send a new message.`]},{version:`0.3.276`,date:`2026-10-27`,added:[`Kimi now accepts a Kimi Code subscription key (the sk-kimi… key from the Kimi Code console) as well as a Moonshot API key. With a Kimi Code key, resting the pointer on the model box shows how much of your 5-hour and monthly allowance is used and when each resets.`],fixed:[`A chat on Google’s agy can now use the GitHub account you linked: git and gh are signed in there too. Before, agy chats had no GitHub access at all, because agy keeps to its own private home.`,`When GitHub answers “not found” for a repository of an organization that has not approved OonaCode (the organization’s owner approves “OonaCode Git” in its OAuth app settings), the chat now says that instead of concluding the repository does not exist.`]},{version:`0.3.275`,date:`2026-10-27`,added:[`Kimi (Moonshot) is back as a provider you connect with your own Moonshot API key: Kimi K3, K3.1 Pro, K2.7 Code and K2.6. Your PC talks to Moonshot directly — nothing goes through OonaCode’s servers. (The Kimi Code subscription is a different service and is not included.)`],fixed:[`The app keeps up with the provider and model list from OonaCode’s server again. After the server added a provider for Google’s voices, builds before this one could not read the new list and quietly kept the old one, so new models and providers did not appear until the next update.`,`A chat that was set to Gemini is told that the provider was removed and asked to pick another, instead of failing with “unknown provider”. Gemini itself was never available to use.`]},{version:`0.3.274`,date:`2026-10-27`,added:[],fixed:[`A big chat you reopen (Ctrl+R, or after a restart) now ends on its newest messages. Before, the transcripts of old agents were listed after the whole chat, so their cards piled up at the bottom and the last few minutes of the conversation sat above them, out of the window.`,`The note that earlier messages were left out of the request is shown as its folded line after a reload too, not as raw <local-command-stdout> text.`]},{version:`0.3.273`,date:`2026-10-26`,added:[`Rest the pointer on the model box (or focus it with the keyboard) to see how much of that model’s plan or key you have used: the bars and when each limit resets, with the model you are on first. For your own Claude plan it shows what Claude itself reported on its last answer; when that is older than 10 minutes, OonaCode asks again with one tiny message (a few tokens of your own plan or key), or you press “Check now”. Settings → This PC can switch the check off or change the 10 minutes.`],fixed:[`A picture or file sent in a chat on Google’s agy — any of its models, Claude through Google included — is no longer refused with “takes text only”: OonaCode saves it in the chat’s folder and gives the model its path, as it does for every other model.`,`A Google agy chat no longer repeats “Google answered “service unavailable” — continuing in …” (and redoes its last step each time) when Google had in fact answered every request of the turn. A real Google outage is still waited out as before.`]},{version:`0.3.272`,date:`2026-10-26`,added:[`A find-in-page field in the top bar, next to the MCP servers icon: it searches everything visible in OonaCode and highlights the matches (Enter and Shift+Enter step through them). Ctrl+F opens it when no chat find takes the key; Ctrl+Shift+F always does.`,`On the website’s API keys page, a key you create from now on can be shown again with “Reveal key” — it is sealed in your browser with your vault key, so the server still cannot read it. Keys made before this still show only their last four characters.`,`Removing a message now also removes the summary the engine wrote after it, if the chat was summarised later (the summary was made from that message); the confirmation says so. The model then reads the earlier messages themselves again.`],fixed:[`Messages you type while a Google agy turn is running now all go together when the turn ends, instead of one turn per message with “2 queued” left over. The waiting strip says when they will be read, how long they have waited, what the agent is doing and how long earlier turns took.`,`The media panel starts over when OonaCode comes back after an update: it asks for a fresh access grant and reads the list again, and a failed read has a Try again button.`,`The Session info panel shows a chat’s context size as soon as you open it, not only after its next reply.`,`A sub-agent’s “Conversation compacted” line stays inside that agent’s card instead of appearing loose at the end of the chat.`,`When a chat’s own model cannot write its About or the summary of older messages, OonaCode now says so instead of quietly answering with another model.`]},{version:`0.3.271`,date:`2026-10-25`,added:[`Messages can be removed from a chat, and from what the model remembers. Right-click one of your messages, or any reply, tool call or thought of its exchange: “Remove this exchange…” takes out your message and everything the agent did for it; “Remove this and everything after…” also takes out every later message. Open windows update at once, and the chat starts fresh from what is left on its next message. Text already sent to a provider stays in that provider’s own logs.`,`When the provider is throttling OonaCode for a short while, the pool now holds your request and sends it the moment the provider is ready, instead of failing it straight away. It holds up to 90 seconds at a time, and a longer pause is waited out over the engine’s next retry.`,`Your PC’s agy and Muse helper move to the versions tested on the server (agy 1.4.7, Muse 1.4.13).`],fixed:[`Chats on a ChatGPT plan (Codex) no longer fail their About, titles and the summary of older messages with a 400 error.`,`Chats on Claude through Google, and chats on your own NVIDIA key, keep a summary of the messages that no longer fit the model’s window: their background calls now use a model the key can actually reach.`,`A chat on another of your PCs shows “PC linked · N folders” again after a restart, instead of asking you to link the same folders once more.`,`The agy note “still reports Individual quota reached…” is gone from the chat; the turn is still treated as the success it was.`,`The file explorer is back in VS Code, the chat font now also covers the message box, and a tool call at the edge of an older page of a remote chat keeps its name and input.`,`“Not delivered — the chat couldn’t start” now appears only when OonaCode itself could not start the turn, never for an error the model returned, so Send again cannot double a message.`]},{version:`0.3.270`,date:`2026-10-25`,added:[`One left panel: an icon strip on the far left switches between Sessions, Search and Files, and the file explorer now has the sidebar’s width and resize handle. Sessions and Files each have a filter box at the top.`,`Search has its own section with two scopes: Chats (every option the old search had) and Files & contents, which searches the open chat’s folder and shows the matching lines.`,`Settings → Theme → Fonts: choose the typeface and size for the chat and for the sidebar separately. Left alone, everything looks as before.`,`Hover a provider you use with your own key or subscription in the model picker to see its usage: quota bars with the time each resets.`,`On a Mac, updating now shows a window saying what is happening — it closes by itself when the new OonaCode opens, so you know whether to wait. Windows has had one since 0.3.92.`],fixed:[`Dark mode: Settings → Theme now has the Colour scheme switch (Light, Dark, System), and the colour editor opens on the colours you are actually looking at. Its old Light | Dark buttons only chose which colours to edit, so choosing Dark there seemed to do nothing. On System, the file editor also follows Windows’ dark setting now.`,`A chat on another of your PCs opens with its newest 500 messages and loads earlier ones as you scroll up, instead of pulling thousands at once over a slow link.`,`A message sent into a chat that then failed to start is marked “Not delivered — the chat couldn’t start”, with Send again. It used to look sent although the model never received it.`,`Subagents always run on the chat’s own model.`,`On a Mac, an update that could not close OonaCode used to report “done” and leave the old app in place — the terminal half updated and the app did not, sometimes for days. It now closes the app even when its window is frozen, and says plainly if it still could not, instead of claiming success.`,`After an update on a Mac, OonaCode opens again by itself. It used to reopen only if the update had closed it.`,`A browser the agent opened no longer leaves processes behind when it is closed or when OonaCode restarts. Helpers of a browser whose window was already gone could keep running for days — one of them found using most of a processor core — and they also stopped old browser versions from being cleaned up.`]},{version:`0.3.269`,date:`2026-10-25`,added:[],fixed:[`OonaCode can be quit again. Since 0.3.244, Quit (and ⌘Q on a Mac) did nothing at all unless a chat happened to be working: the question that warns about working chats answered itself when nothing was running, forgot it had answered, and asked again for ever — so the app stayed open and kept a processor core busy trying to close. If an app of yours has been sitting at high CPU, this was why.`]},{version:`0.3.268`,date:`2026-10-25`,added:[],fixed:[`Long chats no longer fail to start with “SessionStore.load() timed out after 60000ms”. Since 0.3.264 a chat’s start waited for the summary of its older messages, and the first one of a long chat could take longer than the engine allows; a chat now starts after at most 15 seconds, and the summary finishes in the background for the next start.`,`Stop now always stops a turn, even when the model is stuck retrying.`,`There is one Session info button on a wide window (on the right edge) instead of two.`]},{version:`0.3.267`,date:`2026-10-25`,added:[`Claude through Google now takes chats up to 500,000 tokens (it was 200,000), so a long chat on it keeps far more of its own history before anything is left out.`],fixed:[]},{version:`0.3.266`,date:`2026-10-25`,added:[],fixed:[`A chat’s “about” in Session info is now always written in English, whatever language the chat or its files are in — it used to follow pasted text, so an English chat could get a Persian about. The briefing and Listen still translate it into your language when you ask.`,`An about that ran over its length is now cut at the end of a whole sentence instead of in the middle of a thought, and the model is told to keep it short so the “where it stands now” part is not lost.`]},{version:`0.3.265`,date:`2026-10-25`,added:[],fixed:[`A model’s context limit now comes from the server instead of a copy kept in the app, so changing it in the admin reaches every PC. If a model ever refuses a chat as too long and names its limit, OonaCode remembers that limit and plans the next start by it, instead of hitting the same wall again.`]},{version:`0.3.264`,date:`2026-10-25`,added:[`A long chat keeps its older part in view. When a chat has grown past what the model can read, OonaCode gives the model as much of the recent conversation as fits and, in front of it, a short summary of the older part — what you asked for, what was decided and done, and what is left — instead of simply dropping it. The summary is written once, kept on this PC, and only extended as the chat grows; it appears in Usage as “Long-chat summaries”.`],fixed:[`A chat that was one very long piece of work followed by a short message no longer answers that it cannot see any earlier context: the model now gets the newest steps of that work under your original request.`,`The “invalid request” and “Autocompact is thrashing” errors that long runs of work could end in on models with a smaller window are gone: a chat is no longer handed to the model larger than the model accepts.`,`The note that earlier messages were left out now says when the cut fell inside your latest request, and when a summary was given in their place.`]},{version:`0.3.263`,date:`2026-10-25`,added:[`The right-hand side is now one dock: an icon strip on the edge, and Media and Session info stacked in it as sections. Each icon puts its section in or takes it out, both can be open at once, and a header folds its section to a line without losing what it had loaded.`,`The dock has one width and one drag handle for both sections, and it remembers which sections are in and which are folded.`],fixed:[]},{version:`0.3.262`,date:`2026-10-24`,added:[`xAI text-to-speech can now use a pronunciation map, so you can keep the written words while supplying IPA or a spoken replacement for names and multilingual dubbing.`],fixed:[`Voice and media requests recover onto another eligible operator key when one key reaches its limit, rather than failing the request immediately.`,`Google text-to-speech limits are now tracked per model, so a limit on one voice model does not make another available voice model unavailable.`,`OonaCode now presents the current versions of the Muse and Grok coding clients to their providers.`]},{version:`0.3.261`,date:`2026-10-24`,platforms:[`darwin`],added:[`“Bring this PC into the chat” remembers the folders you picked for that chat. Switching between two remote chats, reopening one, or reloading the window comes back linked to exactly those folders — you choose them once. Unlink still clears them for good.`,`A model change says what it came from: “Set model to X for this session only (previous model was Y)”, with the model you just picked in blue and the one it left in grey.`,`You can set a model typed by id on a chat that runs on another one of your PCs, instead of having to go to that PC to change it.`,`A file named in a chat opens in OonaCode, even when it is outside the chat folder. Text and code can be edited; a sound, picture or video plays as before.`,`An edited file no longer has a Save button. A changed tab shows *, Ctrl+S saves it, and Settings → General → Autosave files saves each change as you type.`,`Right-clicking a file the chat names offers “Copy relative path” and “Copy absolute path”.`,`A change to the model list or to settings now reaches this PC on its next check-in with the server, without restarting.`,`The chat’s browser no longer shows a “Restore pages?” bubble or brings back the tabs it had last time. OonaCode closes it on every exit, which used to look like a crash.`],fixed:[`One “Send now” for the whole queue: it sends every queued message at once and empties the list, instead of one button per message.`,`A message the agent had already read gets its receipt instead of staying pinned in the queue, where pressing Send now answered “The agent has already read that message”.`,`Stopping a reply, or pressing Send now while one is running, no longer shows an error. The chat says “User requested stop”.`,`Closing a file you have changed asks whether to save it, with Save, Don’t save and Cancel.`,`A file you edit keeps the line endings it had on disk when you save it, and a file the model writes while you have it open no longer replaces what you are typing in it.`,`After an admin changes a provider’s offered models, this PC’s list keeps every model’s prices and limits — no stale or emptied list in between.`,`A PC that checks in with the server on a slow schedule no longer reads as offline between check-ins; a change reaches it within a minute.`,`A Google Gemini chat no longer shows an error after a complete answer when the connection closes. The answer stays, and a real failure still shows as an error.`,`A folder you linked that may no longer be linked (a drive root, your home folder, a network share, OonaCode’s own data) is dropped when the link comes back, and never a folder you did not pick is added.`]},{version:`0.3.260`,date:`2026-10-24`,platforms:[`win32`],added:[`“Bring this PC into the chat” remembers the folders you picked for that chat. Switching between two remote chats, reopening one, or reloading the window comes back linked to exactly those folders — you choose them once. Unlink still clears them for good.`],fixed:[`One “Send now” for the whole queue on the phone too: it sends every queued message at once and empties the list, instead of one button per message.`,`A folder you linked that may no longer be linked (a drive root, your home folder, a network share, OonaCode’s own data) is dropped when the link comes back, and never a folder you did not pick is added.`]},{version:`0.3.260`,date:`2026-10-24`,platforms:[`linux`],added:[`“Bring this PC into the chat” remembers the folders you picked for that chat. Switching between two remote chats, reopening one, or reloading the window comes back linked to exactly those folders — you choose them once. Unlink still clears them for good.`,`This is Linux’s first update since 0.3.250, so it also brings everything in between: a model change says what it came from (“Set model to X for this session only (previous model was Y)”, the model you picked in blue and the one it left in grey); a model typed by id can be set on a chat that runs on another of your PCs; right-clicking a file the chat names offers “Copy relative path” and “Copy absolute path”; a file named in a chat opens in OonaCode even outside the chat folder and its text can be edited; an edited file is saved with Ctrl+S (and Settings → General → Autosave files saves as you type); the sticky notes button shows how many note tabs you have; and a Google Gemini chat in Build asks before running a command, like every other chat.`],fixed:[`One “Send now” for the whole queue on the phone too: it sends every queued message at once and empties the list, instead of one button per message.`,`A folder you linked that may no longer be linked (a drive root, your home folder, a network share, OonaCode’s own data) is dropped when the link comes back, and never a folder you did not pick is added.`,`Also from in between: stopping a reply, or pressing Send now while one is running, says “User requested stop” instead of an error; closing a file you have changed asks whether to save it; a file you edit keeps the line endings it had on disk and a file the model writes while you have it open no longer replaces what you are typing in it; after an admin changes a provider’s offered models, this PC’s list keeps every model’s prices and limits; a PC that checks in with the server on a slow schedule no longer reads as offline between check-ins; a Google Gemini chat no longer shows an error after a complete answer when the connection closes; and a message the agent had already read gets its receipt instead of staying pinned in the queue.`]},{version:`0.3.259`,date:`2026-10-24`,platforms:[`win32`],added:[`A model change says what it came from: “Set model to X for this session only (previous model was Y)”, with the model you just picked in blue and the one it left in grey.`,`You can set a model typed by id on a chat that runs on another one of your PCs, instead of having to go to that PC to change it.`],fixed:[`One “Send now” sends the whole queue at once and empties it, instead of one button per message.`,`A message the agent had already read gets its receipt instead of staying pinned in the queue, where pressing Send now answered “The agent has already read that message”.`]},{version:`0.3.258`,date:`2026-10-23`,platforms:[`win32`],added:[`Right-clicking a file the chat names offers “Copy relative path” and “Copy absolute path”.`],fixed:[`A file you edit keeps the line endings it had on disk when you save it, and a file the model writes while you have it open no longer replaces what you are typing in it.`,`A Google Gemini chat in Build asks before running a command again, and Allow runs that command.`,`After an admin changes a provider’s offered models, this PC’s list keeps every model’s prices and limits — no stale or emptied list in between.`,`A PC that checks in with the server on a slow schedule no longer reads as offline between check-ins; a change reaches it within a minute.`]},{version:`0.3.257`,date:`2026-10-23`,platforms:[`win32`],added:[],fixed:[`Stopping a reply, or pressing Send now while one is running, no longer shows an error. The chat says “User requested stop”.`,`Closing a file you have changed asks whether to save it, with Save, Don’t save and Cancel.`]},{version:`0.3.256`,date:`2026-10-22`,platforms:[`win32`],added:[`A change to the model list or to settings now reaches this PC on its next check-in with the server, without restarting.`],fixed:[]},{version:`0.3.255`,date:`2026-10-22`,platforms:[`win32`],added:[],fixed:[`A Google Gemini chat no longer shows an error after a complete answer when agy’s local connection closes. The answer stays, and a real failure still shows as an error.`]},{version:`0.3.254`,date:`2026-10-22`,platforms:[`win32`],added:[`A file named in a chat opens in OonaCode, even when it is outside the chat folder. Text and code can be edited; a sound, picture or video plays as before.`,`An edited file no longer has a Save button. A changed tab shows *, Ctrl+S saves it, and Settings → General → Autosave files saves each change as you type.`],fixed:[]},{version:`0.3.252`,date:`2026-10-21`,platforms:[`win32`,`darwin`],added:[`The sticky notes button shows how many note tabs you have, as a blue number.`],fixed:[]},{version:`0.3.251`,date:`2026-10-21`,platforms:[`win32`],added:[`A Google Gemini chat in Build now asks before running a command, using the same permission card as every other chat. Autonomous and auto-accept still run commands without asking.`],fixed:[]},{version:`0.3.250`,date:`2026-10-21`,added:[`The file list now has Show in Explorer, which opens the file or folder selected in your computer’s file manager, and Rename for both files and folders.`,`A text file opened from the file list can now be edited. Change it, then press Save or Ctrl+S. Pictures, videos, sounds and PDF files stay view-only.`],fixed:[]},{version:`0.3.249`,date:`2026-10-20`,added:[`When the model reads a picture, a video or a sound file, that step in the chat now opens by itself: you see the picture, or get a player for the video or sound, without clicking. Click the step to close it. Steps that read ordinary text files stay closed as before.`],fixed:[]},{version:`0.3.248`,date:`2026-10-20`,added:[],fixed:[`A chat on Google Gemini (through your Google plan) no longer ends a finished turn with an error. Google’s agy tool can keep repeating an old “quota reached” message at the end of a long chat even though your limit was fine and the answer arrived; OonaCode now shows the answer as done and adds a short note. A limit you really hit still shows as an error.`,`When you do reach your Google limit in a Gemini chat, OonaCode now shows Google’s own message, including when it resets, instead of a message about the OonaCode pool that did not apply to you.`]},{version:`0.3.247`,date:`2026-10-20`,added:[`On the Android app, a short tap on a message now opens a menu: Reply (quotes it above the box), Copy, Forward (opens it as a draft in another chat you pick), Share and Save text to… A long press still selects text.`,`On the Android app, a picture, video, sound or file that a reply names now opens from your PC: pictures show right in the chat, videos and sounds play in the chat, and other files open in the app you choose or are saved where you say. A file larger than 25 MB asks first.`,`This PC now hands those files to your phone over the same private link as your chats — only files that the chat itself named or that sit in its folder, one piece at a time.`],fixed:[]},{version:`0.3.246`,date:`2026-10-19`,added:[`Every chat can now make videos and spoken audio, not only pictures: ask for a short clip or a voice-over and the model makes it, saves it in the chat’s folder and plays it right in the chat. Video and Speech sit beside Images in the Tools menu, switched on by default.`,`In the Tools menu each of the three has a model choice for this chat (its default follows the model you are chatting with: a Grok chat uses Grok’s, an Alibaba chat Alibaba’s) and an “Ask me first” switch. With it on — the default for video — the model asks you for the length, resolution and shape and tells you the price in credits before anything is spent.`,`Pictures, videos and speech are paid with your OonaCode credits like any other message, whatever model or key the chat runs on, and the credits charged are shown in the answer.`,`On Apple Silicon Macs (M1 and later) Oonak Browser is now the native build: it quits with its last window, shows its own Dock icon and never asks for notification permission.`],fixed:[]},{version:`0.3.245`,date:`2026-10-19`,added:[`A picture, video or sound that a model reply named but that is not on your PC any more is now left out of the Media explorer, with a line under the list saying how many were left out and a Show button to see them.`,`A picture the model made now shows up in the chat as a small square beside its name — you no longer need the Media panel to notice it — and a click enlarges it.`,`A file the model names (a PDF, a Word or Excel document, a zip and so on) now shows its type’s icon in the chat and in the Media explorer; a file of any other type gets a plain file icon.`],fixed:[`The Media explorer no longer lists a website path such as /logo.svg or /favicon.png from a model reply as if it were a file on your PC, and a card that cannot be opened now shows the file name and date instead of only “Moved or deleted”.`]},{version:`0.3.244`,date:`2026-10-19`,added:[`When the agent enters plan mode (and when you approve its plan) the Build / Plan / Ask picker now follows it, so the picker always shows the mode the chat is really in.`],fixed:[`Four engine tools nobody uses here — ListAgents, EnterWorktree, ExitWorktree and ReportFindings — are switched off in every chat, which makes each request a little smaller.`]},{version:`0.3.243`,date:`2026-10-18`,added:[`OonaCode now asks before it quits or updates while any chat is still working — including chats whose tabs you closed — and names them, so nothing is interrupted by accident.`],fixed:[]},{version:`0.3.242`,date:`2026-10-18`,added:[`Every model can now take any attachment: a picture or PDF that the chosen model cannot read (Google’s agy, text-only Qwen or GLM models, and so on) is saved in the chat’s temporary folder and the model is given its file path instead of the message being refused.`,`The media panel can filter by All, Mine or Replies, so the pictures, videos, sounds and links that the model’s replies name are listed too, and every item has a right-click menu (View or Play, Show in chat, Show in folder, Copy path or link).`,`The “Media in this chat” and “Session info” panels can be resized by dragging their left edge; double-click the edge for the default width.`,`Web search is now in every chat, always: there is no Tools-menu switch for it any more, and chats that had it switched off search again.`],fixed:[]},{version:`0.3.241`,date:`2026-10-17`,added:[`Remote sessions in the sidebar now have a full right-click context menu and actions button (Pin to top, Move to Project, Project settings, Change folder, Details, Listen to this chat, Files, Rename, Fork and Delete) plus a details card on hover.`,`The Files explorer and file viewer now work for remote chats over the blind relay, so you can browse folders, view code, Markdown and images, copy paths and delete files on the remote PC.`,`Oonak Browser is now available for macOS chats as well as Windows and Linux.`],fixed:[`Newly created or renamed remote chats now appear immediately in the Remote section of the left sidebar, and the sidebar automatically recovers after a brief server or connection blip.`,`Opening a long remote chat with many screenshots no longer disconnects the relay for backpressure or stops loading recent messages.`]},{version:`0.3.240`,date:`2026-10-17`,added:[`Every Thought block now shows how long the model spent thinking (for example “Thought · 42 words · 12s”), both live and when a chat is reopened.`,`Remote chat tabs now show a badge naming the PC they run on, and you can rename a remote chat directly from its tab or from the Remote list in the sidebar.`,`Files attached from the Android app are uploaded into the chat’s folder on the PC that runs the chat.`],fixed:[`Subagent reports and continuation notes now fold into a single Engine note line instead of staying pinned at the bottom of the chat or replacing the pinned user question.`,`Local video and file paths in replies (including Windows paths with forward slashes, paths with spaces, and Markdown links) now reliably show their Play, View and Open in folder buttons.`,`Chats on a ChatGPT (Codex) subscription no longer fail when the model calls tools.`,`Google agy chats wait and retry automatically (5 s, 20 s, 1 min, 2 min) when Google answers with a temporary 503 Unavailable.`]},{version:`0.3.239`,date:`2026-10-16`,platforms:[`win32`],added:[`Media in every chat: the gallery button at the top right of a chat lists the photos, videos, audio, files and links you sent in it. Photos open in the viewer (← → step through them), videos and audio play in place, files open or show in their folder, and “Show in chat” jumps to the message.`],fixed:[`Google agy chats no longer flash a command window when they start. OonaCode now keeps agy up to date itself, quietly, while no agy chat is running.`,`An agy command that waits for someone to type (a password prompt, an ssh question) no longer holds the chat for hours: after 15 minutes with no output and no work, OonaCode ends that command, says so in the chat, and agy carries on.`,`The coding engine is updated (Claude Code 2.1.301): long answers are no longer cut off after three minutes of silence, a long chat no longer compacts again and again, and a tool no longer runs twice.`,`If the app’s window crashes (for example when the computer runs out of memory), it reloads by itself.`,`A chat on your own Meta Muse or ChatGPT plan that started on another provider no longer fails with “call_id must be at most 64 characters”.`,`Your other PCs keep one order in the Remote list instead of reshuffling.`,"`oona -p` with an OonaCode API key says what went wrong instead of asking you to sign in."]},{version:`0.3.239`,date:`2026-10-16`,platforms:[`darwin`],added:[`Media in every chat: the gallery button at the top right of a chat lists the photos, videos, audio, files and links you sent in it. Photos open in the viewer (← → step through them), videos and audio play in place, files open or show in their folder, and “Show in chat” jumps to the message.`],fixed:[`The coding engine is updated (Claude Code 2.1.301): long answers are no longer cut off after three minutes of silence, a long chat no longer compacts again and again, and a tool no longer runs twice.`,`If the app’s window crashes (for example when the computer runs out of memory), it reloads by itself.`,`A chat on your own Meta Muse or ChatGPT plan that started on another provider no longer fails with “call_id must be at most 64 characters”.`,`Your other PCs keep one order in the Remote list instead of reshuffling.`,`A download cut part-way during an update is resumed instead of starting over.`,"`oona -p` with an OonaCode API key says what went wrong instead of asking you to sign in."]},{version:`0.3.239`,date:`2026-10-16`,platforms:[`linux`],added:[`Media in every chat: the gallery button at the top right of a chat lists the photos, videos, audio, files and links you sent in it. Photos open in the viewer (← → step through them), videos and audio play in place, files open or show in their folder, and “Show in chat” jumps to the message.`],fixed:[`“Restart now” in Settings opens the app again instead of closing it for good.`,`The OonaCode service starts again after a quick reboot.`,`A power cut no longer empties the files that keep you signed in and unlocked.`,`A download cut part-way (weak Wi-Fi) during an install or update is resumed instead of giving up.`,`Notifications come from “OonaCode”.`,`The coding engine is updated (Claude Code 2.1.301): long answers are no longer cut off after three minutes of silence, a long chat no longer compacts again and again, and a tool no longer runs twice.`,`If the app’s window crashes (for example when the computer runs out of memory), it reloads by itself.`,`A chat on your own Meta Muse or ChatGPT plan that started on another provider no longer fails with “call_id must be at most 64 characters”.`,`Your other PCs keep one order in the Remote list instead of reshuffling.`,"`oona -p` with an OonaCode API key says what went wrong instead of asking you to sign in."]},{version:`0.3.238`,date:`2026-10-16`,added:[`Auto in the OonaCode pool: pick “Auto” and each new message runs on the pool model that suits it — how hard the task is, how big the chat is, whether a model already has the chat in its cache, speed and cost — at an effort it picks too. The model button shows which model Auto chose, like “Auto (Qwen3.8 Max)”. (It appears once OonaCode switches it on.)`,`Window control in the Tools menu: when you ask, the agent can list, hide, show, minimise, restore or focus the windows on your computer (Windows; apps on macOS; X11 and KDE on Linux).`,`The conversations popup in a chat shows when each conversation started and when it was last active.`],fixed:[`A Google agy chat that hits a temporary “service unavailable” from Google now waits a few seconds and carries on in the same conversation instead of ending the turn.`,`The agent keeps Oonak Browser’s window visible: no hidden or headless browser unless you ask for one.`]},{version:`0.3.237`,date:`2026-10-15`,platforms:[`win32`,`darwin`],added:[`When a long chat no longer fits the model, the chat shows one line saying how many earlier messages the request left out; click it for the explanation.`],fixed:[`The model picker no longer has an “All models” list, which showed the same model twice when a provider offers it both by key and by subscription. Pick a provider to see its models.`,`Google’s agy: Gemini 3.7 Flash, 3.6 Flash and 3.1 Pro are gone from the picker, because Google no longer offers them, and the picker shows only the models your own Google plan lists. A chat that was on one of them asks you to pick another model.`,`A picture or PDF attached to a chat on Google’s agy is refused with words that say agy takes text only on every one of its models, and that another provider’s model can read it.`,`A thought with no words in it (Meta Muse hides its thinking) no longer leaves an empty “Thought” card in the chat.`,`Conversations between chats read “idle” when nothing is going on.`]},{version:`0.3.237`,date:`2026-10-15`,platforms:[`linux`],added:[`The model picker is redone: your providers on the left, each with how many models it has, and the chosen provider’s models on the right, best first by independent intelligence rating. Each side has its own search. After you pick a model from another provider, its button says “next message” until your next message runs on it.`,`Every model shows its own effort levels, and the effort picker starts on the model’s default. A model with no effort levels shows no picker.`,`Meta Muse: Muse Spark 1.3 and 1.2, Wonder 1.0 and Wonder Full 1.0 — paste your Muse key in Connect or press “Sign in with Meta”.`,`ChatGPT plans: GPT-6.1 Sol, GPT-6 Sol, GPT-6 Astra and GPT-5.6 Sol when your plan lists them; chats keep their thinking across tool calls and use the effort you pick.`,`NVIDIA is back for your own NVIDIA key, with twelve hosted models that call tools. Your own SuperGrok subscription offers Grok 4.7 Fast.`,`Bring this PC into the chat: on a chat that runs on another PC, pick folders on this PC and what the chat may do there; it asks you before every change. And a Tools switch lets a chat list, read and message the chats on your other PCs.`,`Sticky notes beside the bug button, saved in your vault so they follow you to your other computers.`,`Suggest, beside Listen in every chat, proposes what to send next, and the project manager does it for several chats at once. Nothing is sent until you press Send.`,`Listen to this chat is a player with a seek bar, a speed you can change while it plays, and the spoken word highlighted.`,`A tab whose chat finished a turn you have not looked at yet wears a dot. A long chat folds old agents into one “N earlier agents” row, and every block shows its time.`,`When a long chat no longer fits the model, one line says how many earlier messages the request left out.`],fixed:[`A message sent while a chat is working, right after you picked another model, waits for the running turn and is answered by the model you picked.`,`A PC you sign in later appears in the left panel by itself.`,`A thought with no words in it no longer leaves an empty “Thought” card.`,`The Claude Code engine is updated to 2.1.296.`]},{version:`0.3.236`,date:`2026-10-14`,platforms:[`win32`,`darwin`],added:[`Every model now shows its own effort levels, and the effort picker starts on the model’s default — so you can see what level a chat really runs at. A model that has no effort levels no longer shows a picker at all.`,`A collapsed thought block now shows how the thought begins, like a command does: “Thought 42 words: First I read the file…”.`,`Meta Muse requests now match Meta’s own Muse CLI, so its thinking, tool calls, pictures and PDFs show up properly in the chat.`],fixed:[`Grok 4.5 no longer offers an “extra high” effort that xAI treats as high, and GPT-4.1 no longer shows an effort picker it cannot use.`]},{version:`0.3.235`,date:`2026-10-13`,platforms:[`win32`,`darwin`],added:[`Meta Muse: use Meta’s Muse Spark 1.3, Spark 1.2, Wonder 1.0 and Wonder Full 1.0 in your chats. Open Connect, pick Meta Muse, and either paste your Muse key or press “Sign in with Meta” — OonaCode downloads Meta’s Muse once (about 360 MB, after you agree), you confirm the code on Meta’s page, and the key is kept in your vault.`,`ChatGPT plans: GPT-6.1 Sol (500k context), GPT-6 Sol, GPT-6 Astra and GPT-5.6 Sol are available when your plan lists them, next to the models you already had.`,`Google’s agy: Gemini 4 Argon appears in the model picker when your Google plan includes it (Ultra), at Low, Medium and High.`],fixed:[]},{version:`0.3.234`,date:`2026-10-13`,platforms:[`win32`,`darwin`],added:[`Bring this PC into the chat: on a chat that runs on another PC, press the button in the chat’s toolbar, pick folders on this PC and tick Read, Create, Edit or Delete for each. The chat can then work with those files. It asks you before it creates, changes, moves or deletes anything, and the link ends when you close the tab. Both PCs need this version.`,`Chats on my other PCs: a new switch in the Tools menu lets a chat list your other PCs and their chats, read them, message them and start new chats there on the model you choose. You confirm every new chat.`,`The Tools menu now works on a chat that runs on another PC, so you can switch its tools from here.`],fixed:[`A PC you sign in after OonaCode has started now appears in the left panel by itself, without opening Settings → Devices first.`]},{version:`0.3.233`,date:`2026-10-12`,platforms:[`win32`,`darwin`],added:[`The model picker now tells you when a pick is not in use yet: after you pick a model from another provider, its button says “next message” and explains that the chat keeps running on its current model until your next message.`,`A long chat folds the agents that ran long ago into one “N earlier agents” row that says when they ran, instead of one card for each of them under your newest message.`],fixed:[`A message you send while a chat is working, right after you picked another model or provider, now waits for the running turn and is answered by the model you picked. It used to go to the model that was already running, so the chat kept answering as the old one while the picker showed the new one.`,`Every block in a chat now shows the time it happened — also the notes the app writes itself and the cards for earlier agents.`]},{version:`0.3.232`,date:`2026-10-12`,platforms:[`win32`],added:[`The model picker is redone: your providers on the left, each with how many models it has, and the chosen provider’s models on the right, best first by independent intelligence rating (unrated ones last). Each side has its own search, and the one over the providers finds a model across every provider, showing only the providers that carry it.`,`NVIDIA is back for your own NVIDIA key: twelve hosted models that call tools, among them Nemotron 3 Ultra and Super, Kimi K3, GLM-5.3, DeepSeek V4.1 Flash and Gemma 4.`],fixed:[`Models hosted as vendor/model (Kimi K3 on NVIDIA and the like) now show their intelligence rating.`]},{version:`0.3.232`,date:`2026-10-12`,platforms:[`darwin`],added:[`Sticky notes: the note button beside the bug button at the top opens your notes as tabs. Make as many as you like, name them with a double-click, and write — every change is saved by itself in your vault, so the notes follow you to your other computers. Text only.`,`Chats on your own ChatGPT plan keep their thinking across tool calls, use the effort level you pick (up to max where the model has it), and list the models your account really offers.`,`The model picker is redone: your providers on the left, each with how many models it has, and the chosen provider’s models on the right, best first by independent intelligence rating (unrated ones last). Each side has its own search, and the one over the providers finds a model across every provider, showing only the providers that carry it.`,`NVIDIA is back for your own NVIDIA key: twelve hosted models that call tools, among them Nemotron 3 Ultra and Super, Kimi K3, GLM-5.3, DeepSeek V4.1 Flash and Gemma 4.`],fixed:[`Suggest no longer starts reading the chat the moment you open it: pick how many hours to read, then press Suggest.`,`The Claude Code engine is updated to 2.1.296.`,`Models hosted as vendor/model (Kimi K3 on NVIDIA and the like) now show their intelligence rating.`]},{version:`0.3.231`,date:`2026-10-12`,platforms:[`android`],added:[`On the phone: any text in a chat can be selected and copied, and About became Session info.`],fixed:[]},{version:`0.3.230`,date:`2026-10-11`,platforms:[`win32`],added:[`Sticky notes: the note button beside the bug button at the top opens your notes as tabs. Make as many as you like, name them with a double-click, and write — every change is saved by itself in your vault, so the notes follow you to your other PCs. Text only.`,`Chats on your own ChatGPT plan keep their thinking across tool calls, use the effort level you pick (up to max where the model has it), and list the models your account really offers.`],fixed:[`Suggest no longer starts reading the chat the moment you open it: pick how many hours to read, then press Suggest.`,`A Gemini chat on your own Google plan no longer repeats, turn after turn, a command it refused earlier.`,`The Claude Code engine is updated to 2.1.296.`]},{version:`0.3.229`,date:`2026-10-11`,platforms:[`darwin`],added:[`Suggest, beside Listen in every chat: it reads the last few hours of the chat and suggests what to send it next. You edit it, put it in the message box or send it — nothing runs by itself.`,`The project manager, beside the "about" button over the chat list: tick chats, press Review, and each gets a suggestion you can edit and send with its own button.`,`A tab whose chat finished a turn you have not looked at yet wears a dot (red when the turn failed), and so does its row in the list.`,`Listen to this chat is a player: a seek bar, play and pause, ten seconds back and forward, the previous or next sentence, a speed you can change while it plays, the spoken word highlighted (click any word to play from it), and every summary listed newest first on top.`,`MCP servers: add them in Settings → MCP Servers from a directory of popular ones (PostgreSQL, Supabase, GitHub, Sentry, Slack, Notion, Linear and more) or your own, and switch each on or off per chat.`,`Connectors: Supabase, Railway and Vercel in the Tools menu — sign in once, switch one on in a chat, and the agent can look at your projects, databases, logs and deployments; read-only until you allow changes, and it asks before each one.`,`Pictures: ask any chat for an image and it makes one, saved in the chat’s folder and shown in the chat (a few credits each; Images in the Tools menu turns it off).`,`Web search for every model, from your Mac, with no key and no credits.`,`Claude Haiku 5.5 with a 1M-token window, and Grok 4.7 Fast on your own SuperGrok subscription.`,`Pasting a very long text, or a video, sound or large picture, saves it in the chat’s folder and attaches it as a file.`,`Hover a “Read …png” line in the chat and the picture shows at once.`],fixed:[`A compacted chat reopens with its whole history, not only what came after its last compaction.`,`Deleting a chat frees its OonaCode pool seat at once.`,`Large chats resume faster.`,`The chat summary (“About”) no longer fails on models that think at length.`,`A refusal by Gemini’s safety filter is retried once on another model, like the others.`,`Error notes in the chat read as plain sentences instead of codes or raw data.`,`The message navigator always shows at least four lines and no longer vanishes on the way to it.`]},{version:`0.3.228`,date:`2026-10-11`,platforms:[`win32`],added:[`Suggest, beside Listen in every chat: it reads the last few hours of the chat and suggests what to send it next. You edit it, put it in the message box or send it — nothing runs by itself.`,`The project manager, beside the "about" button over the chat list: tick chats, press Review, and each gets a suggestion you can edit and send with its own button.`,`A tab whose chat finished a turn you have not looked at yet wears a dot (red when the turn failed), and so does its row in the list.`],fixed:[]},{version:`0.3.227`,date:`2026-10-11`,platforms:[`win32`],added:[`Listen to this chat is a player: a seek bar, play and pause, ten seconds back and forward, the previous or next sentence, and a speed you can change while it plays.`,`The word being spoken is highlighted in the summary, and clicking any word plays from there.`,`Every summary the chat has is listed on top, newest first; pick one to hear it, with the languages it was already translated into.`],fixed:[]},{version:`0.3.226`,date:`2026-10-11`,platforms:[`win32`],added:[`Google Gemini (agy) chats show what agy looked at: a picture it viewed appears in the chat, and a sound or video it named plays inside the tool card.`,`Your own SuperGrok subscription offers Grok 4.7 Fast.`,`The Android app groups this PC’s chats by the project each one is filed under.`],fixed:[`Google Gemini (agy) tool steps read in words — View file, Run command, Edit — with their file or command, instead of raw arguments.`,`Your own SuperGrok sign-in presents the current Grok CLI (1.0.50), so xAI does not refuse it as outdated.`]},{version:`0.3.225`,date:`2026-10-10`,platforms:[`win32`,`linux`],added:[`Per-credential usage keys: operator credentials can now store their own console session keys (such as Xiaomi MiMo account credentials) directly in the Admin Panel to monitor individual token plan quotas and balances.`,`Google agy thinking blocks: local Google Antigravity (Gemini) sessions now extract and display model thinking blocks and rich tool arguments in chat from agy transcripts.`],fixed:[`Session info regeneration: fixed an issue where regenerating the session summary for Google Antigravity (Gemini) sessions would fail with a missing subscription token error.`,`Xiaomi MiMo cleanup: removed redundant and withdrawn mimo-v2.5 and mimo-v2.5-pro models from the registry and models catalog; replaced by mimo-v2.6-pro and mimo-v2.6-flash.`]},{version:`0.3.224`,date:`2026-10-09`,platforms:[`win32`,`linux`],added:[`Auto-save clipboard files and large pasted text: pasting text exceeding 10,000 characters or 300 lines automatically saves into your workspace .oonacode/tmp folder and attaches as a file without bloating the composer. Clipboard videos, audio, and large images are similarly saved and attached as local paths.`],fixed:[`Error display in chat: masked internal error codes, raw JSON, and provider balance exhaustion notices from the user chat bubble, displaying clean status indicators instead.`,`Google Antigravity pool plan access: included Gemini 3.8 Flash and 3.7 Flash across all active subscription plans (Standard, Pro, Team Standard, Team Premium, Free).`,`Session info panel: fixed an issue where switching between chats could leave stale child views mounted in the session info panel.`]},{version:`0.3.223`,date:`2026-10-09`,platforms:[`win32`,`linux`],added:[`MCP Servers settings & Antigravity catalog: configure stdio, sse, and http Model Context Protocol servers in File -> Settings -> MCP Servers. Choose from a rich directory of popular providers (PostgreSQL, Supabase, Redis, SQLite, MongoDB Atlas, GitHub, GitLab, Sentry, Cloudflare, Slack, Notion, Linear, PostHog, Brave Search) or add custom servers.`,`TopBar MCP badge: see your configured MCP servers count at a glance next to the Bug Report button, and click to open MCP settings directly.`,`Per-chat MCP server toggles: selectively enable or disable configured MCP servers per conversation in the composer toolbar to eliminate prompt token overhead.`],fixed:[]},{version:`0.3.222`,date:`2026-10-09`,platforms:[`win32`,`linux`],added:[],fixed:[`Chat summary "About": increased housekeeper output token headroom to prevent thinking and verbose models (e.g. Qwen, Gemini) from exceeding the token ceiling and failing with "Claude's response exceeded the 700 output token maximum".`]},{version:`0.3.221`,date:`2026-10-09`,platforms:[`win32`,`linux`],added:[`Web search for every model: all models can now search the web via keyless local DuckDuckGo search from your PC, with no extra credentials or credits needed.`,`Claude Haiku 5.5: available with 1M context, 128K output, and tiered pricing (replaces Haiku 4.5).`],fixed:[`Deleting a chat immediately frees its pool seat on the server, instead of keeping it held until the session cache window expires.`,`Session info panel headers: distinct icons for About (sparkle) and Scheduled tasks (bell) so sections no longer repeat the same info glyph.`,`Large sessions resume faster and safer with reverse-bounded transcript loading and auto-trimming to disk.`,`Gemini content safety filter blocks are now caught by safeguard fallback and retried on the fallback model.`]},{version:`0.3.220`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[],fixed:[`A chat on a Google Claude model no longer stops with “Autocompact is thrashing”. Its window was set to 100,000 tokens, so the chat compacted again right after every compaction and the engine gave up; it is now 200,000, and if the engine ever gives up this way the next message starts from a shorter history instead of repeating the same state.`]},{version:`0.3.219`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[`Pictures: ask any chat for an image — “generate a realistic tiger fighting a crocodile” — and it now makes one, with any model, the way Google’s Antigravity does. The picture is saved in the chat’s folder and shown right in the chat; click it for the full viewer. It costs a few OonaCode credits per picture, you can edit a picture file from the folder too, and it can be switched off in the Tools menu (Images).`,`The Google Claude models (typed by exact id in the model picker’s Custom model row) show their real 100,000-token window in the session panel, and the chat now compacts before the limit instead of being refused and re-sent.`],fixed:[`Google-hosted Claude and Gemini chats re-used almost none of Google’s prompt cache, so big chats ate the 5-hour window in minutes. They now reuse about 98 % of the prompt, which makes them far cheaper and faster.`,`The hidden /setcustommodel command and the admin custom-model tool are gone — the model picker’s Custom model row does the same job.`]},{version:`0.3.218`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[`Connectors: Supabase, Railway and Vercel in the Tools menu. Sign in once with the service’s own page, switch the connector on in a chat, and the agent can look at your projects, databases, logs and deployments. It is read-only until you turn on “Allow changes”, and then it asks you before every change; purchases, billing and secret or key readers are never offered. Each shows whether the service’s command-line tool is installed and can add the vendor’s own skills. In the terminal: oona connectors. Guide: /docs/connectors.`,`Hover a “Read …png” line in the chat and the picture shows at once; click the picture for the full viewer with zoom, like a picture you sent.`],fixed:[`A chat that was compacted no longer reopens showing only what came after its last compaction: the whole history is there again.`,`The message navigator always shows at least four lines, and its list no longer vanishes while the pointer crosses the gap to it.`]},{version:`0.3.217`,date:`2026-10-07`,platforms:[`darwin`],added:[`Pictures you attach open large: click one in the box or in a sent message for a viewer with zoom (buttons, wheel, drag, Fit and 100 %). Click a PDF or text file and it opens in its own program.`,`When a model refuses a message on safety grounds, OonaCode retries it once on another model and says so in the chat. Choose how in Settings → Safeguards: switch automatically, always switch to a model you pick, or never — with a fallback for each model. The same in the terminal: oona settings safeguard-fallback and --fallback-model. Works for Claude, Gemini and Google’s agy.`,`The terminal signs in two ways: your OonaCode account (through your browser) or an OonaCode API key. A fresh oona asks which; oona login --api-key-stdin stores a key for scripts, oona whoami says which one is in use, and oona logout removes it. The terminal manual is on the website: /docs/cli.`,`The conversations badge reads like the agents badge — “3 conversations · 1 active” — and the Conversations window lists every limit: messages, tokens, credits, depth, rates and the idle close.`,`A chat can start a new chat for you on another provider, model, effort or project — it asks you first, and a chat that was itself started by a chat cannot start more.`,`The message navigator’s list shows each message’s date and opens on your latest one; messages further back than 5,000 lines are greyed.`],fixed:[`A chat that was compacted no longer reopens showing only what came after its last compaction: the whole history is there again.`,`The message navigator always shows at least four lines, and its list no longer vanishes while the pointer crosses the gap to it. A click on it now takes you to older messages even while the chat is still replying (the page used to jump straight back).`,`oona: a wrong command or flag now exits with code 2, oona sessions list no longer breaks on multi-line titles, piping oona into head no longer prints an error, and the plain-prompt mode can send a message again.`,`One-shot terminal runs reuse the engine already on the Mac instead of downloading it every time, and a model you typed with /model that is not in the picker keeps its name after OonaCode restarts.`]},{version:`0.3.216`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[`The terminal signs in two ways: your OonaCode account (through your browser) or an OonaCode API key. A fresh oona asks which; oona login --api-key-stdin stores a key for scripts and servers, oona whoami says which one is in use, and oona logout removes it. The key is sealed by the host and never written to the terminal’s config.`,`The terminal manual is on the website: /docs/cli, written from commands run on Debian and Ubuntu servers.`],fixed:[`oona: a wrong command or flag now exits with code 2, oona sessions list no longer breaks on multi-line titles, piping oona into head no longer prints an error, and the plain-prompt mode can send a message again.`,`One-shot terminal runs reuse the engine already on the PC instead of downloading it every time.`,`A model you typed with /model that is not in the picker keeps its name after OonaCode restarts.`]},{version:`0.3.215`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[`Pictures you attach open large: click one in the box or in a sent message for a viewer with zoom (buttons, wheel, drag, Fit and 100 %). Click a PDF or text file and it opens in its own program.`,`When a model refuses a message on safety grounds, OonaCode retries it once on another model and says so in the chat. Choose how in Settings → Safeguards: switch automatically, always switch to a model you pick, or never — with a fallback for each model. The same in the terminal: oona settings safeguard-fallback and --fallback-model. Works for Claude, Gemini and Google’s agy.`,`The conversations badge reads like the agents badge — “3 conversations · 1 active” — and the Conversations window lists every limit: messages, tokens, credits, depth, rates and the idle close.`,`A chat can start a new chat for you on another provider, model, effort or project — it asks you first, and a chat that was itself started by a chat cannot start more.`,`The message navigator’s list shows each message’s date and opens on your latest one; messages further back than 5,000 lines are greyed.`],fixed:[`A click on the message navigator now takes you to older messages even while the chat is still replying (the page used to jump straight back).`,`The message navigator no longer touches the message times, and its lines are darker and longer.`]},{version:`0.3.214`,date:`2026-10-06`,platforms:[`darwin`],added:[`OonaCode runs natively on Apple Silicon Macs. The installer picks the Apple Silicon build by itself, and an Apple Silicon Mac that had the Intel one moves to it on its next install or update — the Intel build cannot run there on macOS 14 or older.`,`A message navigator on every chat: the small stack of lines at the middle-right of the chat is your own messages — rest on it, focus it or tap it and the list of everything you sent opens; click one and the chat scrolls straight to it.`],fixed:[`On an Apple Silicon Mac with macOS 14 or older, every chat crashed (“CPU lacks AVX support”) and Update did nothing. If yours did, run once in Terminal: curl -fsSL https://oonacode.oonak.ai/install.sh | bash`,`When an update cannot start, the app now says why and what to run instead of saying “Updating OonaCode…” while nothing happens.`,`File → Export chats… no longer freezes the window under a Save panel: the zip goes straight into Downloads and Finder shows it.`]},{version:`0.3.213`,date:`2026-10-06`,added:[`A message navigator on every chat: the small stack of lines at the middle-right of the chat is your own messages — rest on it, focus it or tap it and the list of everything you sent opens; click one and the chat scrolls straight to it. Escape closes the list.`],fixed:[],platforms:[`win32`,`linux`]},{version:`0.3.212`,date:`2026-10-06`,added:[`Headless one-shot runs without signing in: --api-key (or OONACODE_API_KEY) bills the run through the gateway on that OonaCode key — held in memory for the run only, never stored. For containers and CI.`],fixed:[`A keyed run no longer stops at the device-link screen, and no longer dies with "the OonaCode pool needs your OonaCode account": the key now also covers provider routing and the registry read on a machine that was never signed in.`],platforms:[`win32`,`linux`]},{version:`0.3.211`,date:`2026-10-06`,added:[`A message navigator on every chat: the small stack of lines at the middle-right of the chat is your own messages — rest on it and the list of everything you sent opens; click one and the chat scrolls straight to it.`,`One-shot runs without signing in: --api-key (or OONACODE_API_KEY) bills the run through the gateway on that OonaCode key — held in memory for the run only, never stored. For headless machines and containers.`],fixed:[],platforms:[`linux`]},{version:`0.3.210`,date:`2026-10-05`,added:[`Use a project folder opens on the folder the chat runs in — its project, or the workspace OonaCode made for it — instead of an empty box.`],fixed:[`Send now on one queued message no longer makes the other queued messages look sent: they stay under the chat, each with its own Send now, and get their tick when the agent reads them.`,`After you confirm the agent’s request to move a chat to another folder, the chat shows the new folder at once, not only after your next message.`]},{version:`0.3.209`,date:`2026-10-05`,platforms:[`win32`,`darwin`],added:[`Scheduled tasks say which model a run uses: always the chat’s model at the moment the task fires, named in the Scheduled tasks panel.`],fixed:[`A Google Gemini chat keeps Google’s agent running for half an hour between messages, so the next message after a pause no longer waits about four seconds for agy to start.`,`Commands run in a Google Gemini chat reach servers on your own PC (localhost) and plain http:// sites again.`]},{version:`0.3.209`,date:`2026-10-05`,platforms:[`linux`],added:[`Grok 4.7, xAI’s newest model, on the OonaCode pool and on your own SuperGrok subscription — and an effort picker for Grok 4.7, 4.6 and 4.5 (low, medium, high, extra high), sent the way xAI’s own Grok CLI sends it.`,`Every provider in the model picker shows its own logo — Google’s Gemini mark for Google, xAI’s for your SuperGrok, OpenAI’s for your ChatGPT plan, Z.ai’s for GLM — instead of two letters.`,`Scheduled tasks say which model a run uses: always the chat’s model at the moment the task fires, named in the Scheduled tasks panel.`],fixed:[`When a subscription behind the OonaCode pool refuses or fails a request, the same request is answered at once from the provider’s API key instead of showing you the error.`,`Grok on your own SuperGrok subscription and on the OonaCode pool works again: xAI started refusing the Grok CLI identity OonaCode presented as outdated.`,`When your own subscription’s sign-in stops working, the chat now says so and asks you to sign in again, instead of a confusing “own-subscription providers run directly to the provider” error.`,`A Google Gemini chat keeps Google’s agent running for half an hour between messages, so the next message after a pause no longer waits about four seconds for agy to start.`,`Commands run in a Google Gemini chat reach servers on your own PC (localhost) and plain http:// sites again.`]},{version:`0.3.208`,date:`2026-10-04`,platforms:[`win32`,`darwin`],added:[`Grok 4.7, xAI’s newest model, on the OonaCode pool and on your own SuperGrok subscription — and an effort picker for Grok 4.7, 4.6 and 4.5 (low, medium, high, extra high), sent the way xAI’s own Grok CLI sends it.`,`Every provider in the model picker shows its own logo — Google’s Gemini mark for Google, xAI’s for your SuperGrok, OpenAI’s for your ChatGPT plan, Z.ai’s for GLM — instead of two letters.`],fixed:[`When a subscription behind the OonaCode pool refuses or fails a request, the same request is answered at once from the provider’s API key instead of showing you the error.`,`Grok on your own SuperGrok subscription and on the OonaCode pool works again: xAI started refusing the Grok CLI identity OonaCode presented as outdated.`,`When your own subscription’s sign-in stops working, the chat now says so and asks you to sign in again, instead of a confusing “own-subscription providers run directly to the provider” error.`]},{version:`0.3.207`,date:`2026-10-04`,added:[`Every chat lists every provider you have connected and the OonaCode pool — Google Gemini too, whatever the chat ran on before. Switching keeps the conversation: a chat moving off Google continues with its whole history, and a chat moving onto Google gives Google’s agent the conversation so far, so it can carry on.`],fixed:[`Two messages sent a moment apart while a chat was starting no longer leave one of them stuck in the queued strip: the engine had read them together as one message, and OonaCode now recognises that.`]},{version:`0.3.206`,date:`2026-10-04`,platforms:[`win32`],added:[`Google Gemini installs Google’s agy by itself the first time you use it — open the provider in Settings → Providers, or send a message to a Google Gemini chat — instead of waiting for you to press Install.`],fixed:[`Deleting a chat now says what really happens: a chat is kept only on the PC it runs on, so deleting it there removes it everywhere.`,`oona doctor no longer tells you to change settings that OonaCode stopped reading.`]},{version:`0.3.206`,date:`2026-10-04`,platforms:[`linux`],added:[`Gemini on your own Google plan, through Google’s own agent. Open Settings → Providers → Google Gemini: OonaCode downloads Google’s agy for you and checks it. Then press Sign in with Google, sign in on Google’s own page and paste the one-time code back within the minute agy allows. OonaCode never sees your password. Every model your Google plan offers through agy is listed — Gemini 3.8, 3.7 and 3.6 Flash, Gemini 3.1 Pro, and Claude Opus 5.5, Claude Sonnet 5.5 and GPT-OSS 120B marked “via Google”. A Google Gemini chat runs Google’s agent as it is (Build or Autonomous mode, text only), and the chat’s info panel lists every request it made to Google.`,`Every provider in the model picker ends with a “Custom model…” row: type any model id and the chat runs it on that provider.`],fixed:[`The agents badge highlights what is happening now: “4 working” is blue and the total is grey.`,`Deleting a chat now says what really happens: a chat is kept only on the PC it runs on, so deleting it there removes it everywhere.`]},{version:`0.3.206`,date:`2026-10-04`,platforms:[`darwin`],added:[`Gemini on your own Google plan, through Google’s own agent. Open Settings → Providers → Google Gemini: OonaCode downloads Google’s agy for you and checks it. Then press Sign in with Google, sign in on Google’s own page and paste the one-time code back within the minute agy allows. OonaCode never sees your password. Every model your Google plan offers through agy is listed — Gemini 3.8, 3.7 and 3.6 Flash, Gemini 3.1 Pro, and Claude Opus 5.5, Claude Sonnet 5.5 and GPT-OSS 120B marked “via Google”. A Google Gemini chat runs Google’s agent as it is (Build or Autonomous mode, text only), and the chat’s info panel lists every request it made to Google.`,`Every provider in the model picker ends with a “Custom model…” row: type any model id and the chat runs it on that provider.`],fixed:[`The agents badge highlights what is happening now: “4 working” is blue and the total is grey.`,`The command line’s reinstall hint on a Mac is the one that works: curl -fsSL https://oonacode.oonak.ai/install.sh | bash.`]},{version:`0.3.205`,date:`2026-10-04`,platforms:[`win32`],added:[`Google Gemini now lists every model your Google plan offers through agy, not only Gemini: Claude Opus 5.5, Claude Sonnet 5.5 and GPT-OSS 120B (marked “via Google”) sit beside Gemini 3.8, 3.7 and 3.6 Flash and Gemini 3.1 Pro. They run on Google’s own agent with your Google plan, and have their own usage window.`],fixed:[]},{version:`0.3.204`,date:`2026-10-04`,platforms:[`win32`],added:[`Signing in to Google Gemini opens Google’s page for you and shows how many seconds are left: Google’s agy waits only one minute for the sign-in. Paste the code Google shows and it is sent at once.`],fixed:[`Signing in to Google Gemini finishes. The code you pasted never reached Google’s agy in the installed app (the window it types into dropped everything typed), so the sign-in waited out its minute and failed.`,`The Claude sign-in’s “paste the code” box, which used the same window, can type the code too.`]},{version:`0.3.203`,date:`2026-10-04`,platforms:[`win32`],added:[`Gemini on your own Google plan, through Google’s own agent. Open Settings → Providers → Google Gemini and press Install: OonaCode downloads Google’s agy for you and checks it. Then press Sign in with Google, sign in on Google’s own page and paste the one-time code back here. OonaCode never sees your password. A Google Gemini chat runs Google’s agent as it is (Build or Autonomous mode, text only, no pictures), and the chat’s info panel lists every request it made to Google.`,`Every provider in the model picker ends with a “Custom model…” row: type any model id and the chat runs it on that provider.`],fixed:[`The agents badge highlights what is happening now: “4 working” is blue and the total (“51 agents”) is grey, instead of the other way round.`]},{version:`0.3.202`,date:`2026-10-03`,platforms:[`darwin`],added:[`OonaCode runs on macOS 12 or newer: the agent, your chats, the background service and the desktop app, installed with the same one line as on Linux — curl -fsSL https://oonacode.oonak.ai/install.sh | bash. An Intel build; Apple Silicon Macs run it through Rosetta 2. Your sign-in key is kept in your login keychain.`,`Updating is the same line again, oona update in a terminal, or the update button in the app: it closes OonaCode, puts the new version in place and opens it again. The app is not signed by Apple yet, so it cannot be downloaded from a browser and does not update itself the way it does on Windows.`],fixed:[]},{version:`0.3.202`,date:`2026-10-03`,platforms:[`linux`],added:[],fixed:[`Your sign-in survives a restart on a PC that keeps OonaCode’s key in the login keyring (GNOME Keyring, KWallet): two of OonaCode’s keys shared one keyring entry and overwrote each other, and every start of the host wrote over the stored key — so after a restart you could find yourself signed out.`,`OonaCode never runs a Claude Code you installed yourself as its engine, even when it sits in the same folder as the Node.js that runs OonaCode (an nvm folder, for example).`,`oona update installs from the site your OonaCode was installed from, not always from oonacode.oonak.ai.`]},{version:`0.3.202`,date:`2026-10-03`,platforms:[`win32`],added:[],fixed:[`OonaCode never runs a Claude Code you installed yourself as its engine, even when it sits in the same folder as the Node.js that runs OonaCode.`]},{version:`0.3.201`,date:`2026-10-03`,added:[`The Tools menu lists only tools that work. Desktop control, Clipboard, Screen capture and Run as administrator were demos that never ran anything, and they are gone: the agent already reads and sets your clipboard, takes screenshots and asks Windows for administrator rights through its own commands.`],fixed:[`Oonak Browser keeps working when its window is behind other windows. A browser covered by the OonaCode window used to crawl, and some clicks and scrolls gave up after 30 seconds.`,`Oonak Browser no longer clicks a hidden copy of a link, or a link inside a closed menu, when a site has both a visible and a hidden one.`,`A message you send right after a reply failed no longer stays pinned above the box as “queued” once the agent has read it.`]},{version:`0.3.200`,date:`2026-10-03`,platforms:[`win32`],added:[`Everything OonaCode shows you is in credits, never in dollars: the model picker gives what an OonaCode pool model charges per 1M tokens in credits, and a chat’s spend, Usage, Conversations, Listen and the terminal all count credits. A chat on your own key or your own subscription says so instead of a price.`],fixed:[`Oonak Browser works on sites built from web components, Google’s own forms among them: it reads, finds, clicks and types inside them, where it used to answer “the page changed” or find nothing.`,`The model’s questions appear only in their own window: the chat no longer shows the question’s raw text while you answer, and afterwards keeps one line — “You answered 3 questions” — that opens to your answers.`]},{version:`0.3.200`,date:`2026-10-03`,platforms:[`linux`],added:[`Your chats now live only on the PC that runs them. Your phone, the website and your other PCs read a chat straight from its PC, through the same encrypted connection they use to continue it — OonaCode’s server no longer keeps any copy. While a PC is off or asleep its chats cannot be read from elsewhere; the window says so and they come back when it is online. Update OonaCode on each of your PCs: another device reads a PC’s chats only once that PC runs this version.`,`Everything OonaCode shows you is in credits, never in dollars: the model picker gives what an OonaCode pool model charges per 1M tokens in credits, and a chat’s spend, Usage, Conversations, Listen and the terminal all count credits. A chat on your own key or your own subscription says so instead of a price.`,`Listen has one button: Play. It writes a summary when the chat has none or has moved on, translates it once when you pick a new language, or just plays — saying only “Generating…” or “Translating…” while it works. A summary written in the last ten minutes is used for every language, so switching language never writes it again.`,`A morning briefing in View → What chats are about…: show the chats active in the last 24 hours, 3, 7, 10 or 30 days (or your own dates), tick the ones you want — or all — pick a language, a voice and a speed, and press Play. OonaCode reads each chat’s name and what it is about, one after another, with Next, Previous, Pause and Stop.`,`A chat can offer to move a task to a new chat. When a task deserves its own chat — a separate job, a chat that has grown long, work in another folder — the model proposes it with the first message written out; you can edit it, then Start new chat opens the new chat in a tab, sends the message and carries on there. Nothing starts without your yes.`,`Talk to other chats: a chat can now write to a chat whose switch is off. That chat’s switch stays off and it gets no new tools — it can only answer the chat that wrote to it. Finding a chat by name matches each word, in its name, project, folder and description, and spelling like “AI-control” or “aicontrol” no longer matters.`,`Oonak Browser acts like a person: every click, keystroke and scroll is a real input event, so sites that ignore scripted clicks now respond, and it works inside web components, Google’s own forms among them. Typing into a drop-down picks the option, and typing into an editor adds the text at its end.`,`Scheduled shows at a glance what will still run: paused tasks and one-time tasks that have already run are greyed out, with the day they will be removed — 10 days after their last change.`,`Settings → Developer → Allow debugging: opens a debugging port on this PC only, so a developer can look at and drive the app while fixing a problem with you. Off by default; while it is on, every window shows a red “Debugging on” badge.`],fixed:[`A chat keeps its Build / Plan / Ask first / Autonomous choice, and every device shows the same one. A chat set to “Ask first” now asks you before acting even when this PC answers prompts by itself.`,`A chat no longer ends up on a model nobody picked for it: a model the provider does not offer is refused instead of quietly switching the chat to the provider’s default, and Enter in the model picker no longer picks the row under the mouse pointer.`,`Chats talking to each other no longer ping-pong: a reply needs no answer, several messages from the same chat are read together in one turn, and a message card says “answer requested” until the answer has gone back, then “answered” with the time.`,`A tool you switch on while a chat is replying works for the message you send next, even mid-reply. After an update, a chat that had background tasks running shows one line saying how many stopped, instead of one card per task.`,`The model’s questions appear only in their own window: the chat no longer shows the question’s raw text while you answer, and afterwards keeps one line — “You answered 3 questions” — that opens to your answers.`,`A model your plan does not include now says “not in your plan”, instead of “Failed to authenticate … sign-in needed”.`,`A long message waiting in the queue no longer hides its “Send now” button: it is folded to a few lines, with Show all to read the rest.`,`The account window no longer stays on “offline · vault event stream responded 503” after a short server interruption.`]},{version:`0.3.199`,date:`2026-10-02`,platforms:[`win32`],added:[`Talk to other chats: a chat can now write to a chat whose switch is off. That chat’s switch stays off and it gets no new tools — it can only answer the chat that wrote to it. Finding a chat by name is smarter too: each word is matched, in its name, project, folder and description, and spelling like “AI-control” or “aicontrol” no longer matters.`,`Oonak Browser acts like a person: every click, keystroke and scroll is a real input event, so sites that ignore scripted clicks now respond. Typing into a drop-down picks the option, and typing into an editor adds the text at its end.`],fixed:[`A chat no longer ends up on a model nobody picked for it: a model the provider does not offer is refused instead of quietly switching the chat to the provider’s default, and Enter in the model picker no longer picks the row under the mouse pointer.`]},{version:`0.3.198`,date:`2026-10-01`,platforms:[`win32`],added:[`Listen has one button: Play. It writes a summary when the chat has none or has moved on, translates it once when you pick a new language, or just plays — saying only “Generating…” or “Translating…” while it works. A summary written in the last ten minutes is used for every language, so switching language never writes it again.`],fixed:[`A chat keeps its Build / Plan / Ask first / Autonomous choice, and every device shows the same one — the phone used to show “Ask first” for a Build chat. A chat set to “Ask first” now asks you before acting even when this PC answers prompts by itself.`,`Play in Listen is never greyed out for want of a voice: it gets the text ready and names the voice to install.`]},{version:`0.3.197`,date:`2026-10-01`,platforms:[`win32`],added:[`Oonak Browser, the browser your chats use, moves to version 151 by itself at its next use: a build with no Google services (no Safe Browsing warnings, push notifications or search suggestions). The download is checked against its fingerprint before anything is unpacked, and the old version is removed once no chat’s browser still runs from it.`],fixed:[`A model your plan does not include now says “not in your plan”, instead of “Failed to authenticate … sign-in needed”.`]},{version:`0.3.196`,date:`2026-10-01`,platforms:[`win32`],added:[`Your chats now live only on the PC that runs them. Your phone, the website and your other PCs read a chat straight from its PC, through the same encrypted connection they use to continue it — OonaCode’s server no longer keeps any copy. While a PC is off or asleep its chats cannot be read from elsewhere; the window says so and they come back when it is online. Update OonaCode on each of your PCs: another device reads a PC’s chats only once that PC runs this version.`],fixed:[`The account window no longer stays on “offline · vault event stream responded 503” after a short server interruption: the next sync that works clears it by itself.`]},{version:`0.3.195`,date:`2026-10-01`,platforms:[`win32`],added:[],fixed:[`Chats talking to each other no longer ping-pong. A message asks for an answer only when the chat really needs one; a reply needs no answer and is not answered with a new message; and several messages waiting from the same chat are read together in one turn. Fewer wake-ups, fewer tokens.`,`A message card says what is true: “answer requested” until the answer has gone back, then “answered” with the time — instead of an orange “reply expected” that never went away.`]},{version:`0.3.194`,date:`2026-10-01`,platforms:[`win32`],added:[`A chat can offer to move a task to a new chat. When a task deserves its own chat — a separate job, a chat that has grown long, work in another folder — the model proposes it with the first message written out; you can edit it, then Start new chat opens the new chat in a tab, sends the message and carries on there. Nothing starts without your yes.`,`Settings → Developer → Allow debugging: opens a debugging port on this PC only, so a developer can look at and drive the app while fixing a problem with you. Off by default; while it is on, every window shows a red “Debugging on” badge.`],fixed:[]},{version:`0.3.193`,date:`2026-10-01`,platforms:[`win32`],added:[],fixed:[`A tool you switch on while a chat is replying works for the message you send next, even mid-reply: that message now waits for the chat to restart with the new tool instead of reaching the model without it.`,`After an update, a chat that had background tasks running shows one line — “11 background tasks stopped — they were running when OonaCode restarted this chat” — instead of one card per task. Click it to see each one.`]},{version:`0.3.192`,date:`2026-09-30`,platforms:[`win32`],added:[`A morning briefing in View → What chats are about…: show the chats active in the last 24 hours, 3, 7, 10 or 30 days (or your own dates), tick the ones you want — or all — pick a language, a voice and a speed, and press Play. OonaCode reads each chat’s name and what it is about, one after another, with Next, Previous, Pause and Stop. Other languages are translated once and kept, so hearing the same briefing again costs nothing.`],fixed:[]},{version:`0.3.191`,date:`2026-09-30`,platforms:[`win32`],added:[`Scheduled shows at a glance what will still run: paused tasks and one-time tasks that have already run are greyed out, with the day they will be removed. They are deleted by themselves 10 days after their last change; resuming or editing a paused task gives it another 10 days.`],fixed:[]},{version:`0.3.190`,date:`2026-09-30`,platforms:[`win32`],added:[],fixed:[`A long message waiting in the queue no longer hides its “Send now” button: it is folded to a few lines, with Show all to read the rest.`]},{version:`0.3.189`,date:`2026-09-30`,platforms:[`linux`],added:[`Split views, like VS Code: drag a chat tab to the left, right, top or bottom of the chat area to open it beside the other one — a shaded area shows where it will land. Every chat on screen works on its own, with its own replies streaming and its own message box. Drag the divider to resize; Ctrl+\\ splits the current tab to the right, Ctrl+1, Ctrl+2… jump between views, and a tab’s menu has Split right, Split down and Move to other group.`,`Chats in windows of their own, like Chrome tabs: drag a tab out of the window, or choose “Move to new window” in its menu, and it opens in its own window; “Move to main window” brings it back. On Wayland desktops the new window opens at the usual place rather than under the pointer. Your split views and windows come back when you restart OonaCode.`,`Every language plays in Listen to a chat: each language picks the best voice on its own — OonaCode’s Armenian voices first, then your system’s voices, then eSpeak (install the espeak-ng package if your system has no voice for a language).`],fixed:[`Picking another language for a summary no longer needs a new summary: Play translates the one you have, keeps the translation, shows it and plays it.`,`“Summarise now” says “Up to date — nothing to summarise” while the chat has not changed, instead of seeming to do nothing.`]},{version:`0.3.188`,date:`2026-09-30`,platforms:[`win32`],added:[`Split views, like VS Code: drag a chat tab to the left, right, top or bottom of the chat area to open it beside the other one — a shaded area shows where it will land. Every chat on screen works on its own, with its own replies streaming and its own message box. Drag the divider to resize; Ctrl+\\ splits the current tab to the right, Ctrl+1, Ctrl+2… jump between views, and a tab’s menu has Split right, Split down and Move to other group.`,`Chats in windows of their own, like Chrome tabs: drag a tab out of the window, or choose “Move to new window” in its menu, and it opens in its own window. Drag it back onto the main window’s tabs, or choose “Move to main window”, to bring it back. Your split views and popped-out windows come back when you restart OonaCode.`],fixed:[]},{version:`0.3.187`,date:`2026-09-30`,platforms:[`win32`],added:[`Every language plays in Listen to a chat. Persian, Georgian, Ukrainian — and any language whose Windows voice is not installed — now speak with eSpeak, a free voice that comes with OonaCode (it sounds robotic, but it always works). Each language picks the best voice on its own: OonaCode’s Armenian voices first, then Windows’ own, then eSpeak.`],fixed:[`Picking another language for a summary no longer needs a new summary: Play translates the one you have, keeps the translation, shows it and plays it.`,`“Summarise now” says “Up to date — nothing to summarise” while the chat has not changed, instead of seeming to do nothing.`]},{version:`0.3.186`,date:`2026-09-30`,platforms:[`linux`],added:[`Listen to a chat: right-click a chat → Listen to this chat…, or the speaker button beside the chat’s title. The chat’s own model writes a short spoken summary — the goal, what was done, where it stands, what is left — and OonaCode reads it aloud on this PC, in the voice and at the speed you choose. Every summary is kept with its date, so you can play it again at any time; a new one is written only when the chat has moved on. Other languages are translated once and kept with the summary.`,`OonaCode brings two Armenian voices of its own, Astgh and Artsiv, and also speaks with your system’s voices through speech-dispatcher — install speech-dispatcher and espeak-ng for Persian, Russian and every other language; the Listen window names the packages for your distribution.`,`Listen to a chat from your phone: the OonaCode app’s 🔊 Listen reaches this PC’s summaries and plays them with the phone’s own voices. It needs this update on the PC and the next OonaCode app on the phone.`,`See where your credits go: Account → Usage. Pick the last 24 hours, 7, 30 or 90 days or your own dates, by hour or by day, for the coding agent or your API keys apart. A chart shows the credits over time by model or by what they were for, and the lists below give every model with its tokens and price, and every use — chat turns, a chat’s “about”, images, speech and the rest.`,`The chat list is laid out like the Claude desktop app: New, Projects, Scheduled, then your pinned chats and projects, then Today and Older. The old grouping by project is one click away — the small icon beside “Today”.`,`Projects opens a page of project cards — each with its goal, its chats and when it was last used — with search, sort and New project. Click a card to see that project’s chats, instructions and settings, and to start a new chat in it.`,`Scheduled shows every scheduled task from every chat on this PC in one place, with its next run, its chat, and pause, resume and delete. Pin any chat or project to the top of the list from its menu.`,`Claude Sonnet 5.5 is in the model picker — on the OonaCode pool and on your own Claude subscription — with a 1M-token context. It costs the same as Sonnet 5 per token and usually needs fewer tokens for the same work.`,`Type / at the start of a message to see the chat’s commands and skills, with what each does, in two titled sections. Type to narrow the list, then Enter or Tab. They work with every model, not only Claude.`,`Each chat has a Skills list beside Tools. Every skill starts off, so the model sees none of them and they cost nothing; switch one on to let the model use it by itself in that chat. Typing /name still runs any skill for one turn.`,`Your own skills: Settings → Skills lists the skills OonaCode gives every chat, and “Import from Claude Code…” copies the ones you choose from your Claude Code install — it only reads it, never changes it.`,`In the terminal app (oona), a command the chat’s engine knows — /context, /compact or a skill — now runs instead of answering “unknown command”.`,`Search in the Import window: find a chat by its name, its first or last message or its folder, or pick “Whole conversations” to search inside the chats themselves.`],fixed:[`Import chats shows every chat on this PC, grouped by the app it came from, with nothing folded away. Each row says whether it is new, already imported, moved on since, or deleted by you in OonaCode. Nothing is ticked when you open it yourself: search for a chat and tick it, or tick a whole group at once.`,`The message box fits a narrow chat: its buttons and pickers move onto a second line and the box grows to hold them — Stop and Queue no longer slip outside it.`,`Claude’s thoughts show their words again. Every “Thought” from Claude Opus, Sonnet and Fable came back empty — Anthropic leaves the text out unless it is asked for a summary, and now OonaCode asks. Only new replies change.`,`A chat’s “about” no longer starts in the middle of a sentence when the model wrote a long answer.`,`Commands that only duplicated OonaCode’s own controls or showed misleading numbers are gone from the / menu — /model, /usage, /autocompact, /output-style, /mcp, /list-agents and /reload-skills. Typed, they say why.`,`Skills you import or remove in Settings → Skills reach your chats by themselves, at each chat’s next message.`,`Claude Sonnet 5 is retired: a chat that was on it moves to Sonnet 5.5 at its next message.`,`The engine’s built-in keyboard-shortcuts helper is turned off: it would have edited your own Claude Code settings.`,`Typing /model in a chat updates the chat’s model and the model picker again, and command output such as /context reads the same while it arrives and after you reopen the chat.`,`A chat row’s ⋯ button shows only when you point at the row.`]},{version:`0.3.185`,date:`2026-09-30`,platforms:[`win32`],added:[`Listen to a chat from your phone: the OonaCode app’s 🔊 Listen reaches this PC’s summaries and plays them with the phone’s own voices. It needs this update on the PC and the next OonaCode app on the phone.`],fixed:[`Listening with a Windows voice no longer stops after the first sentence when the voice fails to say it has finished.`]},{version:`0.3.184`,date:`2026-09-30`,platforms:[`win32`],added:[`Listen to a chat: right-click a chat → Listen to this chat…, or the speaker button beside the chat’s title. The chat’s own model writes a short spoken summary — the goal, what was done, where it stands, what is left — and OonaCode reads it aloud on this PC, in the voice and at the speed you choose. Every summary is kept with its date, so you can play it again at any time; a new one is written only when the chat has moved on. Other languages are translated once and kept with the summary.`],fixed:[`A chat’s “about” no longer starts in the middle of a sentence when the model wrote a long answer.`]},{version:`0.3.183`,date:`2026-09-30`,platforms:[`win32`],added:[`See where your credits go: Account → Usage. Pick the last 24 hours, 7, 30 or 90 days or your own dates, by hour or by day, for the coding agent or your API keys apart. A chart shows the credits over time by model or by what they were for, and the lists below give every model with its tokens and price, and every use — chat turns, a chat’s “about”, images, speech and the rest.`],fixed:[]},{version:`0.3.182`,date:`2026-09-30`,platforms:[`win32`],added:[],fixed:[`Import chats shows every chat on this PC, grouped by the app it came from — Claude Code, the Claude app, Qwen Code, Cursor — with nothing folded away. Each row says whether it is new, already imported, moved on since, or deleted by you in OonaCode. Nothing is ticked when you open it yourself: search for a chat and tick it, or tick a whole group at once. The Import button says how many chats it will bring over.`]},{version:`0.3.181`,date:`2026-09-30`,platforms:[`win32`],added:[],fixed:[`The message box fits a narrow chat. In a small window, or with the side panels open, its buttons and pickers move onto a second line and the box grows to hold them — Stop and Queue no longer slip outside it, and the model and effort pickers keep their words readable.`]},{version:`0.3.180`,date:`2026-09-30`,platforms:[`win32`],added:[],fixed:[`Claude’s thoughts show their words again. Every “Thought” from Claude Opus, Sonnet and Fable came back empty — Anthropic leaves the text out unless it is asked for a summary, and now OonaCode asks. Other models were never affected. Only new replies change; older thoughts stay empty.`]},{version:`0.3.179`,date:`2026-09-29`,platforms:[`win32`],added:[],fixed:[`The / menu is easier to read: skills and commands in two titled sections, each with one short line — the full description shows when you point at it.`,`Commands that only duplicated OonaCode’s own controls or showed misleading numbers are gone from the / menu — /model (use the model picker), /usage (the engine’s own estimate, not your credits), /autocompact, /output-style, /mcp, /list-agents and /reload-skills. Typed, they say why.`,`Skills you import or remove in Settings → Skills reach your chats by themselves, at each chat’s next message.`]},{version:`0.3.178`,date:`2026-09-29`,platforms:[`win32`],added:[`The chat list is laid out like the Claude desktop app: New, Projects, Scheduled, then your pinned chats and projects, then Today and Older. The old grouping by project is one click away — the small icon beside “Today”.`,`Projects opens a page of project cards — each with its goal, its chats and when it was last used — with search, sort and New project. Click a card to see that project’s chats, instructions and settings, and to start a new chat in it.`,`Scheduled shows every scheduled task from every chat on this PC in one place, with its next run, its chat, and pause, resume and delete. A dot on it tells you when something is due soon.`,`Pin any chat or project to the top of the list from its menu.`],fixed:[`A chat row’s ⋯ button shows only when you point at the row.`]},{version:`0.3.177`,date:`2026-09-29`,platforms:[`win32`],added:[`Claude Sonnet 5.5 is in the model picker — on the OonaCode pool and on your own Claude subscription — with a 1M-token context. It costs the same as Sonnet 5 per token and usually needs fewer tokens for the same work.`],fixed:[`Claude Sonnet 5 is retired: a chat that was on it moves to Sonnet 5.5 at its next message, and the picker shows Sonnet 5.5.`]},{version:`0.3.176`,date:`2026-09-29`,platforms:[`win32`],added:[`Each chat has a Skills list beside Tools. Every skill starts off, so the model sees none of them and they cost nothing — about 1,400 tokens on every message until now. Switch one on to let the model use it by itself in that chat; the list shows what each one costs per message while on.`,`Typing /name still runs any skill for one turn, whether its switch is on or off.`],fixed:[`The engine’s built-in keyboard-shortcuts helper is turned off: it would have edited your own Claude Code settings.`]},{version:`0.3.175`,date:`2026-09-29`,platforms:[`win32`],added:[`Type / at the start of a message to see the chat’s commands and skills — the Claude Code engine’s own (/compact, /context, /review, /security-review, /init and more) and the skills in your project’s .claude folder — with what each does. Type to narrow the list, then Enter or Tab. They work with every model, not only Claude.`,`Your own skills: Settings → Skills lists the skills OonaCode gives every chat, and “Import from Claude Code…” copies the ones you choose from your Claude Code install — it only reads it, never changes it.`,`In the terminal app (oona), a command the chat’s engine knows — /context, /compact or a skill — now runs instead of answering “unknown command”.`],fixed:[`Typing /model in a chat updates the chat’s model and the model picker again.`,`Command output such as /context reads the same while it arrives and after you reopen the chat.`]},{version:`0.3.174`,date:`2026-09-28`,platforms:[`win32`],added:[`Search in the Import window. Type to find a chat by its name, its first or last message, or its folder — chats folded away as already imported or deleted here show up too when they match. Or open the search options and pick “Whole conversations” to search inside the chats themselves, with a few lines of each match under the chat. It only reads Claude Code, Cursor and the Claude app’s files, never changes them.`],fixed:[`Chats Claude Code switched to another model are answered by that model for real: OonaCode’s pool now serves the model the engine falls back to, and never answers a Claude request with another company’s model.`]},{version:`0.3.173`,date:`2026-09-28`,platforms:[`linux`],added:[`Every chat now has an “about”: a short note, written in the background by a cheap helper model of the chat’s own provider, saying what the chat works on. Your other chats read it — with each chat’s folder and when it was last active — when they look for the right chat to ask. See it, edit it or press Regenerate in the session info panel.`,`View → What chats are about… (and a sidebar button) lists every chat’s about and what writing them cost, with a switch to turn it off and “Generate for all chats now”. The switch and its numbers are also in Settings → This PC.`,`Your phone can now do from anywhere what this PC’s window does: switch each tool on or off per chat, see and control the conversations between your chats, read, edit and regenerate each chat’s “about”, and manage scheduled tasks. It needs this update on the PC and the next OonaCode app on the phone.`,`A chat can switch its own workspace. When the work belongs in another folder — a project you name that lives elsewhere, or a new project folder — the model proposes the switch and you answer Switch or Not now. It always asks you, even with “accept automatically” on, and the chat moves when its current step ends, with the conversation kept.`,`Right-click a chat tab → Delete (in red, under “Close all tabs”) deletes that chat after asking, just like Delete in the sidebar.`,`When Anthropic’s safeguards flag a chat and Claude Code moves it to another model for the rest of the run, the model box says so in red — for example “Opus 4.8 (safeguard)” — and the chat shows a notice at the switch. Picking a model takes the chat back to it at the next message.`],fixed:[`Typing in the message box while a chat is replying is no longer interrupted. With “accept automatically” on, an approval card flashed for an instant on some tool calls and took the cursor away from the box.`,`A permission card that appears while you are typing no longer takes the keyboard, so your next Space or Enter can never press Allow by accident.`,`“Send now” stays disabled and says “Sending now…” until the agent has taken the message — it can take a few seconds while the agent stops its current step, and a second press can no longer send it twice.`,`A message sent from your phone is confirmed by this PC, and the same message is never run twice when the phone sends it again after a lost connection.`,`File and folder names in a reply get their ▶, Open and Show in folder buttons only when they really exist on this PC. A bare file name is also looked for in the folder the reply named just before it.`,`A chat can no longer be moved into your home folder or the root folder through a link. Where /home is itself a link (Fedora Silverblue, Bazzite and similar systems), the home folder passed as an ordinary folder, and the chat would have loaded your own Claude Code settings as its project.`,`Signing in to your own Claude subscription inside the app works on Ubuntu 24.04, Debian, Linux Mint, Pop!_OS and Zorin OS again. There, a part of OonaCode built for newer systems did not load, and the sign-in fell back to a command you had to paste.`,"On Ubuntu, Linux Mint, Pop!_OS, Zorin OS and similar systems, `oona` now works in every new terminal right after you install or update. The installer used to leave it off your PATH until you logged out and back in; now it adds it for new terminals itself, and `oona uninstall` takes that line out again.",`Every way of uninstalling — “oona uninstall”, or the install command with --uninstall — now takes this PC off your account: keep your chats and they stay readable on your other devices; delete them and their copies go too. It never touches your Claude Code or the Claude app, and “oona uninstall” no longer gives up when the background service is stopped.`,`The installer now says at once when a system cannot run OonaCode — one older than Ubuntu 22.04, Debian 12 or RHEL 9, or one built on musl such as Alpine — instead of installing a copy that could not start. The .deb and .rpm tell apt and dnf the same.`]},{version:`0.3.172`,date:`2026-09-28`,platforms:[`win32`],added:[`When Anthropic’s safeguards flag a chat and Claude Code moves it to another model for the rest of the run, the model box says so in red — for example “Opus 4.8 (safeguard)” — and the chat shows a notice at the switch. Picking a model takes the chat back to it at the next message.`],fixed:[`Uninstalling from Settings → Apps now also takes this PC off your account, exactly like “oona uninstall”: keep your chats and they stay readable on your other devices; delete them and their copies go too.`,`“oona uninstall” no longer gives up when the background service is stopped.`,`The “Updating OonaCode…” window shows again on the newest Windows 11 versions (24H2 and later).`]},{version:`0.3.171`,date:`2026-09-28`,platforms:[`win32`],added:[`Oonak Browser now picks its own control port from a range no developer tool uses by default, so it can no longer take a port that Shopify CLI or a dev server wants. If a program needs a particular port kept free, or you want the browser on a specific one, just ask the chat.`],fixed:[`File and folder names in a reply get their ▶, Open and Show in folder buttons only when they really exist on this PC. A bare file name is also looked for in the folder the reply named just before it.`,`Uninstalling OonaCode from Settings → Apps now removes all of it — the app, the command line and its background service — and asks whether to keep your chats. Installing again afterwards no longer says it is already installed. Your Claude Code and Claude app are never touched.`,`“oona uninstall” works again on Windows 11.`,`A chat “about” you wrote yourself no longer shows “stale”.`]},{version:`0.3.170`,date:`2026-09-28`,platforms:[`win32`],added:[`Your phone can now do from anywhere what this PC’s window does: switch each tool on or off per chat, see and control the conversations between your chats, read, edit and regenerate each chat’s “about”, and manage scheduled tasks. It needs this update on the PC and the next OonaCode app on the phone.`],fixed:[`“Send now” stays disabled and says “Sending now…” until the agent has taken the message — it can take a few seconds while the agent stops its current step, and a second press can no longer send it twice.`,`A message sent from your phone is confirmed by this PC, and the same message is never run twice when the phone sends it again after a lost connection.`]},{version:`0.3.169`,date:`2026-09-28`,platforms:[`win32`],added:[`Every chat now has an “about”: a short note, written in the background by a cheap helper model of the chat’s own provider, saying what the chat works on. Your other chats read it — with each chat’s folder and when it was last active — when they look for the right chat to ask. See it, edit it or press Regenerate in the session info panel.`,`View → What chats are about… (and a sidebar button) lists every chat’s about and what writing them cost, with a switch to turn it off and “Generate for all chats now”. The switch and its numbers are also in Settings → This PC.`],fixed:[`A chat can no longer be moved into your user folder or a drive root through a link or junction that points there — its project settings would have been your own Claude Code settings.`]},{version:`0.3.167`,date:`2026-09-27`,platforms:[`win32`],added:[`A chat can switch its own workspace. When the work belongs in another folder — a project you name that lives elsewhere, or a new project folder — the model proposes the switch and you answer Switch or Not now. It always asks you, even with “accept automatically” on, and the chat moves when its current step ends, with the conversation kept.`],fixed:[]},{version:`0.3.166`,date:`2026-09-27`,platforms:[`win32`],added:[],fixed:[`Typing in the message box while a chat is replying is no longer interrupted. With “accept automatically” on, an approval card flashed for an instant on some tool calls and took the cursor away from the box.`,`A permission card that appears while you are typing no longer takes the keyboard, so your next Space or Enter can never press Allow by accident.`]},{version:`0.3.165`,date:`2026-09-27`,platforms:[`win32`],added:[`Right-click a chat tab → Delete (in red, under “Close all tabs”) deletes that chat after asking, just like Delete in the sidebar.`,`Chats now use Oonak Browser, in a window you can see, for everything that needs a web browser — not Chrome, Edge or a hidden script browser — unless you name another browser. It runs without a window (headless) only when you ask for that.`],fixed:[`After an update, the background service comes back by itself. An update could leave it unable to restart, and the app then showed “OonaCode could not start its host service” even though it went on to open normally.`]},{version:`0.3.164`,date:`2026-09-27`,platforms:[`win32`],added:[`Send now: a message you typed while the agent works has a Send now button while it waits. It stops what the agent is doing right now and sends your message immediately — the step that is running is cut. On the desktop and the phone.`,`Conversations → Map: see at a glance which chats are talking to each other. Each conversation is a hub with a line to each of its chats; working chats pulse; click a hub for its history or a chat to open it.`],fixed:[`A restart no longer signs this PC out when OonaCode’s stored key cannot be opened for a moment. OonaCode used to replace the key and lose your sign-in; it now keeps the key and signs you back in by itself as soon as it opens.`]},{version:`0.3.163`,date:`2026-09-27`,platforms:[`linux`],added:[`Send now: a message you typed while the agent works has a Send now button while it waits. It stops what the agent is doing right now and sends your message immediately — the step that is running is cut. On the desktop and the phone.`,`Conversations → Map: see at a glance which chats are talking to each other. Each conversation is a hub with a line to each of its chats; working chats pulse; click a hub for its history or a chat to open it.`],fixed:[`A restart no longer signs this PC out when its security chip is slow to open OonaCode’s stored key. After a system update and reboot, the chip on some machines refuses for a while; OonaCode used to replace the key and lose your sign-in. It now keeps the key and signs you back in by itself as soon as the chip opens it.`]},{version:`0.3.162`,date:`2026-09-27`,added:[],fixed:[`A chat switched to another model knows which model it is. After a switch from Claude to DeepSeek, the model used to keep saying it was Claude — the chat history and Claude Code’s own prompt told it so.`,`Oonak Browser is offered only where it can run. An older OonaCode no longer lists a browser tool it cannot use, so the model does not spend tokens working around it — update to get the browser.`]},{version:`0.3.161`,date:`2026-09-27`,added:[`Settings → This PC → “Replace pictures older than N days”: screenshots and pasted pictures in your chat history are replaced by a short note once they are older than a year (you choose the number, or 0 to keep them). The words of every chat stay; the database stops growing with pictures. It runs by itself.`],fixed:[`The model, Build/Plan/Ask and effort pickers under the message box now look like the dropdowns they are.`,`Switches that are off are easy to see in dark mode.`,`Error messages show what went wrong in words, without raw tags or a provider’s JSON.`,`The ✕ that removes an attachment or a reply is round.`,`Pressing Stop, or an update cutting a turn, no longer files an automatic bug report.`]},{version:`0.3.160`,date:`2026-09-27`,added:[`On Windows, the agent can use a real browser. Ask it to open a site, read a page, click, fill in a form or take a screenshot, and it does it in Oonak Browser, in a window you can see. The first time, OonaCode asks once to install the browser (about 210 MB); after that it opens straight away.`,`Each chat has its own browser profile, so a site you sign in to stays signed in for that chat. Switch the browser off for a chat in its Tools menu.`],fixed:[]},{version:`0.3.159`,date:`2026-09-27`,added:[],fixed:[`A chat reopened after an update no longer says “turn complete” the instant you send a message and then answer anyway. The engine’s own note about work that stopped during the update used to be taken for the end of your turn, with the whole earlier conversation’s tokens on the line.`,`A background task that stopped because OonaCode restarted now says so in plain words, instead of “Orphaned by a previous Claude Code process exit”.`]},{version:`0.3.158`,date:`2026-09-27`,added:[`Every thought in a chat shows how many words it has, so you can tell at a glance whether there is anything to read.`],fixed:[`A thought with nothing in it — some models return only a signature for their thinking — now says “Thought · empty” and no longer opens onto a blank box.`,`A command the agent was allowed to run no longer leaves an “Allowed Bash (automatically)” line under its own card: the card already shows the command and its result. Refusals are still shown.`]},{version:`0.3.157`,date:`2026-09-27`,added:[`On Linux, OonaCode has its own signed apt and dnf repositories. Install the app with apt (Debian, Ubuntu, Mint) or dnf (Fedora, RHEL, Rocky, Alma) — the commands are on the download page — and your package manager keeps it up to date with the rest of the system.`,`Every Linux release is signed with the OonaCode release key, and the one-line installer checks that signature before it installs anything.`],fixed:[`On Linux, the menu bar is drawn in the window in the app’s own colours, and it switches between light and dark with the app instead of keeping the desktop’s theme until a restart.`,`Upgrading the .rpm no longer removes the oonacode command, and removing it no longer leaves empty folders behind.`]},{version:`0.3.156`,date:`2026-09-27`,added:[`Chats can talk to each other. Turn on “Talk to other chats” in a chat’s Tools menu, and its agent can find your other chats that have it on, read them, and ask them for help — one chat or a whole group. A chat that is closed wakes up to answer; a busy one answers when it finishes. The reply comes back to the chat that asked.`,`The Conversations window (in the sidebar) shows every conversation between your chats: who said what to whom, what each answer cost, and buttons to pause, resume, close or stop them all. Each conversation has a budget — 20 messages and 1,000,000 new tokens by default — and pauses itself when it is used up, so chats can never talk forever.`,`Hover over any tool in a chat’s Tools menu to read what it does, how it works, what it costs and how to turn it off.`],fixed:[`A chat woken in the background — by a scheduled task or another chat — shows as working in the sidebar even when it is not open in a tab.`,`A scheduled task no longer slips into a chat at the same moment you send it a message; yours always goes first.`,`A message sent from the terminal no longer waits forever when a chat’s history cannot be resumed and the restart fails. It now says why.`,`Notes OonaCode writes into a chat — a model change, a conversation paused — are still there when you reopen it.`,`When every Claude seat in the OonaCode pool is taken, a new chat now says the model is busy and to try again in a few minutes or pick another model, instead of “Something went wrong on our side”.`,`On Linux, the app tells you it is updating while it swaps itself, so there is no need to start it again.`,`On Linux, removing the .deb or .rpm leaves nothing running and nothing failing at the next login, and the one-line installer checks for free disk space before it changes anything.`]},{version:`0.3.155`,date:`2026-09-27`,added:[`OonaCode runs on Linux. One command installs the command line, the background service and the desktop app: curl -fsSL https://oonacode.oonak.ai/install.sh | bash. The AppImage, .deb and .rpm are on the download page too.`,`On Linux the app lives in the system tray as it does on Windows, follows your desktop’s light or dark theme, and gets its own entry in the applications menu.`,`Uninstalling on Linux removes the desktop app along with the rest, and asks whether to keep your chats for a future install.`],fixed:[`A window no longer stays on “Unauthorized” after the background service restarts with a new key. It reconnects by itself.`]},{version:`0.3.154`,date:`2026-09-26`,added:[],fixed:[`A chat waiting on a long job no longer loses its watcher. OonaCode used to close a chat’s engine ten minutes after the model last spoke, which stopped any Monitor or background command it had left running. The engine now stays up while such work runs, up to 12 hours.`,`A chat moved into a project, or whose project you edit, now follows the project’s instructions from its next message. It used to keep the ones it started with.`]},{version:`0.3.153`,date:`2026-09-25`,added:[],fixed:[`A very long chat no longer answers “Prompt is too long” after OonaCode restarts or updates. The engine was judging the chat’s size by a figure left over from before the restart, and now gets an accurate one.`,`If a message is ever refused as too long before the model has started on it, OonaCode sends it again by itself with a shorter history. You see your message once and then the answer, not an error.`]},{version:`0.3.152`,date:`2026-09-25`,added:[],fixed:[`Uninstalling the app from Windows’ Apps list no longer stops the command-line OonaCode on the same PC from starting after a restart.`]},{version:`0.3.151`,date:`2026-09-25`,added:[`Files the agent names in a chat are clickable. Audio and video play right in the chat with a small player, pictures open as a preview, and in the app every file can be opened in its own program or shown in its folder.`,`Uninstalling the app asks whether to keep your chats on this PC. Keeping them means a new install signs in and continues every chat.`],fixed:[`Installing and updating no longer fail with “The operation has timed out” on PCs whose network drops the newer internet addresses, nor while our server restarts for an update.`]},{version:`0.3.150`,date:`2026-09-25`,added:[],fixed:[`The fix in 0.3.149 for long, sleeping turns now really reaches the agent: the Monitor tool and the block on long waits are on for every chat.`,`A chat compacted after a long pause no longer pays to cache a conversation it is about to replace, and the agent keeps each tool call in its history exactly as it wrote it — both as Claude Code does.`]},{version:`0.3.149`,date:`2026-09-25`,added:[`The agent can watch a long job with the Monitor tool, as Claude Code does, and is woken the moment the job finishes.`],fixed:[`Long chats no longer spend their time asleep. With no way to watch a background job, the agent had been polling it with waits of four to eight minutes. One chat spent more than three and a half hours of a day sleeping, and turns ran for hours while the model worked for a fraction of that. The agent now gets the same working rules as Claude Code, and long waits are blocked.`]},{version:`0.3.148`,date:`2026-09-25`,added:[],fixed:[`A scheduled task that could not be sent — the PC had just restarted, the vault was still locked, the server was not reachable yet — waits and tries again instead of switching itself off. Pausing, editing or deleting a task while its prompt is being sent is no longer undone, and a scheduled prompt no longer lands in a chat whose engine is still starting.`,`A chat on your own DeepSeek key, or one switched with a typed “/model opus”, is no longer shown as withdrawn and locked. “/model fable” picks Claude Fable instead of the default model.`,`Moving a chat to another model no longer lowers its saved effort level to what the old model offered, and a one-off “oona --effort” is no longer saved as the chat’s level.`,`After you pick another model for a locked chat and send, the chat no longer flashes the lock again while the engine starts; if the start fails, your pick is kept.`,`Coming back from a file tab no longer jumps the chat to an old reply or reopens the search bar.`,`The hidden sidebar slides away again when the pointer leaves the window past its edge, and the keyboard no longer tabs through it while it is hidden. Clicking ⓘ in Settings opens its note instead of closing it.`,`Subagents write their prompt cache for five minutes, as Claude Code does for its subscribers; the chat itself keeps the hour. Their cache writes cost less.`]},{version:`0.3.147`,date:`2026-09-25`,added:[`A chat’s scheduled tasks sit beside its subagents: a clock badge says how many are live and when the next one runs, and opens the list — each task’s schedule, its next and last run, Pause and Delete. The tasks run on this PC.`],fixed:[`A prompt the scheduler sends into a chat reads as a “Scheduled task” line, not as your own message waiting in the queue.`,`A chat whose model is no longer offered shows that model in red and waits for you to pick another; its history stays, and the old model is not in the list any more.`,`The effort list follows the server within minutes, without restarting the app. A chat set to a level that has been switched off moves to the nearest one — ultracode becomes xhigh. Chats on your own Claude subscription have an effort picker again.`]},{version:`0.3.146`,date:`2026-09-25`,added:[`A Tools menu beside the model picker: switch OonaCode’s own tools on or off for each chat — browser, desktop and window control, clipboard, screen capture, Office documents and run-as-administrator. Each tool costs the model only a short line until it is used, and the menu shows how much. The first tools are marked Demo while they are tested with every model: a demo tool answers what it would have done, and does nothing on your PC yet.`],fixed:[]},{version:`0.3.145`,date:`2026-09-25`,added:[],fixed:[`Every request of every chat, on every model, is about 3,200 tokens smaller: the engine’s own “auto memory” instructions are gone. OonaCode starts each engine in a fresh private folder and deletes it afterwards, so the notes the model was told to keep there were thrown away when the chat went idle — the model spent tool calls writing memories it would never read. A project’s memory is OonaCode’s own and stays.`,`The engine’s claude.ai Artifact tools are switched off everywhere OonaCode runs it — the app, the terminal, VS Code, the phone, Telegram and the agent API.`]},{version:`0.3.144`,date:`2026-09-25`,added:[],fixed:[`Long chats on Claude models in the OonaCode pool keep their cache for an hour, as Claude Code does for its subscribers. A pause of more than five minutes no longer re-sends the whole conversation at the full cache-write price, which in a large chat was the most expensive part of coming back to it.`,`The session panel’s Context shows how big the conversation is now, not the total of every request the chat ever made — a long chat read “10.7M / 1.0M tokens”.`,`The message box keeps the cursor after you send, so you can go straight on typing the next message.`,`A paid chat’s background work (titles, reading web pages) no longer goes to a free model of the same vendor.`]},{version:`0.3.143`,date:`2026-09-24`,added:[`Search inside your chats: open the search in the chat list, press the sliders button and choose Whole chats. It looks through every message of every chat on this PC, and you choose whose words — yours, the model’s, or both — plus, if you like, the tools’ commands and output and the subagents’ conversations. Results show each message with the words lit; a click opens the chat with its search on them.`,`More search options, for both kinds of search: one project only, a time window (today, 7 or 30 days), match case and whole words.`],fixed:[`While you search the chat list, projects with no matching chat are hidden too.`]},{version:`0.3.142`,date:`2026-09-24`,added:[],fixed:[`A reply you sent shows as the same small chip it had in the message box — “Reply to” and the first few words — instead of the whole quoted text; the full quote appears when you rest the pointer on it, and a click jumps to the message it answers.`,`The model now knows a reply points back into the conversation: it is told the quoted lines are from the chat history, not new input, and whose words they were — its own earlier reply, your earlier message, a file, or a tool’s output.`,`When the chat list is narrow, its buttons wrap onto a second line instead of spilling out of it.`]},{version:`0.3.141`,date:`2026-09-24`,added:[`The chat list on the left can be made wider or narrower: drag its right edge (double-click it for the usual width).`,`The chat list can hide: press the pin in its header, the button at the top left, or View → Sidebar (Ctrl+B). While hidden it slides in when the pointer reaches the left edge of the window, and slides away when you leave it.`,`Search in the chat list is a single magnifier now; click it and the search box opens across the top. Escape or × clears it.`],fixed:[`Opening OonaCode right after a restart no longer leaves the OonaCode pool models out of the model list: if they cannot be read yet, OonaCode asks again by itself a few seconds later and the list fills in.`,`The Artificial Analysis scores (intelligence, coding, speed and benchmarks) show on every model in the model list again — including the models of your own Claude and SuperGrok subscriptions, which never had them.`,`A chat’s details card no longer appears on top of its right-click menu.`]},{version:`0.3.140`,date:`2026-09-24`,added:[`Reply is tidier: the message you reply to shows as a small chip above the message box with its first few words, instead of filling the box. Click the chip — or the quote in a sent reply — to jump to that message; the × removes it.`,`Right-click a project in the sidebar for its settings: Project settings… opens Projects with that project already selected. The gear beside a project’s “+” does the same, and a chat filed in a project offers it in its own menu too.`,`Link GitHub. Under a project’s Repositories (and in Settings → Providers), link your GitHub account once: the agent’s git and gh then clone, pull and push your private repositories on every PC of yours. You type a short code on github.com; the token stays in your encrypted vault and never reaches the OonaCode server. Public repositories need nothing.`],fixed:[]},{version:`0.3.139`,date:`2026-09-24`,added:[`Every setting now says what it does, and resting the pointer on the ⓘ beside it tells you where in OonaCode it applies and what it does not do.`,`Export chats… is in the File menu (and on the sidebar in a browser window) instead of in Settings.`,`With Remote access turned off on a PC, your phone, Telegram, the website and your other PCs still show it — online or not — marked “remote access off”, and opening it tells you to turn Remote access back on in OonaCode on that PC.`],fixed:[`Turning Remote access off now tells your other devices at once. Before, the PC was already unreachable from them, but they could not say why.`,`The settings of This PC save the moment you change them — nothing is lost by closing the dialog.`,`Settings that did nothing, or repeated another one, are gone: the default permission mode (each chat’s Build / Plan / Ask first picker decides), the agent-picker switch, the Git Bash path, the engine path and the extra allowed origins. The server address is shown, not edited — signing in sets it.`]},{version:`0.3.138`,date:`2026-09-24`,added:[`Projects have settings now, like the Claude app’s: a goal, the repositories the project works on, what a new chat in it starts on (model, effort and folder), a project memory the agent keeps up to date, and whether its chats may schedule work — and how often at most. All of it is in Projects, and a Claude app project you import brings its own.`,`OonaCode has a scheduler. Ask the agent to do something later or on a repeat — “check the build every morning at nine” — and it schedules it on this PC; when it is due, the prompt arrives in the chat, even if the chat had gone quiet. The Projects dialog and the chat’s info panel list what is scheduled, where you can pause, resume or delete it.`],fixed:[`Saving a project’s instructions now reaches its chats at their next message, instead of waiting until the chat happened to restart.`]},{version:`0.3.137`,date:`2026-09-24`,added:[],fixed:[`After a PC restart the app could ask for a "host token" and sign you out: two copies of the OonaCode background service started at once and fought over your session. Only one ever runs now, and the app never shows the token page — if its service is replaced it reconnects by itself.`,`The unlock screen stays put until you unlock, and says what went wrong in place — a wrong password, or a connection it is re-establishing — instead of jumping to another page.`,`A message with a picture sent while the agent was working stayed “queued”, and removing it said it was already sent. It now shows as read the moment the agent takes it, and a reopened chat shows it with its picture.`,`In the model’s questions, typing your own answer now clears the options you had picked, and picking an option clears what you typed — the answer sent is exactly the one you chose. The same on the phone, in the terminal and in Telegram.`]},{version:`0.3.136`,date:`2026-09-24`,added:[`Every model now has its own housekeeper — the small, fast model of the same maker that writes a chat’s titles and reads the web pages it fetches. On the OonaCode pool a MiMo v2.6 Pro chat uses MiMo v2.6 Flash, a Qwen chat Qwen3.8 Flash, a GLM chat GLM-5.3 Flash and a GPT-5 chat GPT-5 mini, instead of doing that work on the big model itself. A free model keeps its own, so it stays free.`],fixed:[]},{version:`0.3.135`,date:`2026-09-24`,added:[],fixed:[`Claude models on the OonaCode pool — Opus 5.5, Opus 5, Sonnet 5 and Fable 5.1 — now use their whole 1M context. A long chat no longer stops to summarise itself every ~170k tokens, and its subagents get the same window.`,`Reading a web page is quick again in a Claude chat: pages are read by Claude Haiku, as in Claude Code, instead of a helper that took about a minute a page.`,`Changing a chat’s model now moves its subagents and background helpers to the new model too; before, they stayed on the old one until the app restarted.`,`MiMo v2.5 and v2.5 Pro chats now use their full 1M context too.`]},{version:`0.3.134`,date:`2026-09-23`,added:[],fixed:[`On the Android app, the model’s questions can be answered again. They come one at a time — “Question 2 of 3” — with Back, Next and Skip, and Answer sends them to your PC. The card used to show only the first question, hide the rest below it and wait for all of them, so it could not be sent.`]},{version:`0.3.133`,date:`2026-09-23`,added:[`Bring your Claude desktop app projects across: File → Import chats from other coding agents now lists every project the Claude app has opened on this PC. Each one arrives as an OonaCode project of the same name — its goal, instructions and what Claude noted about it become the project’s instructions — with its project chat and one chat per thread filed under it, ready to carry on.`,`A Claude Code chat you moved into a Claude app project is filed under that project here too.`,`A thread you never opened in the Claude app still comes across, with its task and every reply the project chat saw; open it once in the Claude app and import again for its whole conversation.`],fixed:[`Cursor chats appear in the import list again — they had been left out since September 10.`]},{version:`0.3.132`,date:`2026-09-23`,added:[`Reply to any part of a chat: select some text (or just right-click a block), choose Reply, and it is quoted in your message box — type your answer under it. A quote from a file the agent read names the file.`,`Right-click in a chat: copy what you selected, copy a whole reply or tool output, copy a code block or a link, find the selected words in the chat, or select a block.`,`Search in a chat opens the block its match is in — a folded tool card, a thought, a finished agent’s work — and scrolls to the words themselves.`,`Search matches are now bright orange, the current one strongest, so they stand out on code too.`,`The file viewer shows pictures (PNG, JPEG, GIF, WebP, SVG and more), plays audio and video, and shows Markdown formatted, with a switch to the source.`,`Right-click a file or folder in the explorer to copy its path or delete it.`],fixed:[`Moving a chat to another folder or project while it was working could delete the folder it was working in, start two agents at once, or send your next message to the old folder.`,`The working line no longer says a chat may be stuck while it waits for your approval or answer, or right after you send a message, and it counts time correctly (no more "4m 60s").`,`A date line no longer says "Today" for yesterday’s messages when the app stays open past midnight.`,"Installing with npm (`npm i -g oonacode`) installs this version again; earlier npm releases carried an old program.",`The What’s new window could open again on the next start, showing the same update a second time.`,`An older OonaCode window or VS Code extension no longer resets settings it does not know about, such as your theme colours or which project groups you folded.`,`A new install no longer opens with a list of changes; this window now appears only after an update.`,`The notification switch for permissions now says it also covers the agent’s questions.`]},{version:`0.3.131`,date:`2026-09-23`,added:[`Claude Opus 5.5 is here — the newest Opus, and cheaper to run than Opus 5. Choose it in the model picker, from the OonaCode pool or on your own Claude subscription. It runs on the newer Claude Code engine (2.1.280) that this update brings.`,`Every block in a chat shows its time at the bottom right, in your local time — hover it for the full date — and a date line marks where each day starts.`,`A running chat tells you how long the agent has been quiet, and after five minutes that it may be stuck and what to do.`,`After every update, OonaCode now opens this window to show you what changed.`],fixed:[`A reply that streamed in live had no time on it until the chat was opened again.`,`Chats open in tabs could fail to come back after a restart if a setting changed while they were being restored.`]}];function nu(e,t){let n=e=>{let[t,...n]=e.trim().replace(/^v/,``).split(`-`);return{nums:(t??``).split(`.`).map(e=>Number.parseInt(e,10)||0),pre:n.length>0?n.join(`-`):null}},r=n(e),i=n(t);for(let e=0;e<Math.max(r.nums.length,i.nums.length);e++){let t=(r.nums[e]??0)-(i.nums[e]??0);if(t!==0)return t}return r.pre===i.pre?0:r.pre===null?1:i.pre===null?-1:ru(r.pre,i.pre)}function ru(e,t){let n=e.split(`.`),r=t.split(`.`);for(let e=0;e<Math.max(n.length,r.length);e++){let t=n[e],i=r[e];if(t===i)continue;if(t===void 0)return-1;if(i===void 0)return 1;let a=/^\d+$/.test(t),o=/^\d+$/.test(i);if(a&&o){let e=Number(t)-Number(i);if(e!==0)return e;continue}return a===o?t<i?-1:1:a?-1:1}return 0}function iu(e,t,n=tu,r=null){if(!e||e===`0.0.0`)return[];let i=n.filter(t=>nu(t.version,e)<=0&&(!r||!t.platforms||t.platforms.includes(r)));return[...t===null?i.filter(t=>nu(t.version,e)===0):i.filter(e=>nu(e.version,t)>0)].sort((e,t)=>nu(t.version,e.version))}function au(e,t,n,r=tu,i=null){if(!e||e===`0.0.0`)return{record:null,show:[]};let a=null;for(let e of r)(a===null||nu(e.version,a)>0)&&(a=e.version);let o=a!==null&&nu(e,a)>0?a:e;return{record:t===null||nu(o,t)>0?o:null,show:t===null&&!n?[]:iu(e,t,r,i)}}function ou(e,t){if(t==null)return[...e];if(t.length===0)return[];let n=new Set(t),r=e.filter(e=>n.has(e.id));return r.length>0?r:[...e]}var su=`the user skipped the question`,cu=`(the user skipped this question)`;function lu(e){let t=e?.questions;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e;if(typeof t.question!=`string`)continue;let r=Array.isArray(t.options)?t.options.map(e=>e&&typeof e==`object`?e:null).filter(e=>e!==null&&typeof e.label==`string`).map(e=>({label:e.label,...typeof e.description==`string`?{description:e.description}:{}})):[];n.push({question:t.question,header:typeof t.header==`string`?t.header:``,options:r,multiSelect:t.multiSelect===!0})}return n}function uu(e,t,n={},r=new Set){let i={};return e.forEach((e,a)=>{if(r.has(a)){i[e.question]=cu;return}let o=(n[a]??``).trim();i[e.question]=o||(t[a]??[]).join(`, `)}),i}function du(e){let t=e.questions,n=t===1?`question`:`questions`,r=t===1?`the model’s question`:`the model’s questions`,i=t===1?`The model’s question was`:`The model’s questions were`;switch(e.outcome){case`answered`:{let r=e.answers?Object.values(e.answers):null,i=r?r.filter(e=>typeof e==`string`&&e!==``&&e!==`(the user skipped this question)`).length:t;return t>0&&i<t?`You answered ${i} of ${t} ${n}`:t===0?`You answered the model’s questions`:t===1?`You answered the model’s question`:`You answered ${t} ${n}`}case`skipped`:return`You skipped ${r}`;case`dismissed`:return`${i} dismissed`;case`unanswered`:return`${i} not answered — the turn ended`}}function fu(e){if(!e||typeof e!=`object`)return null;let t=e.answers;return t&&typeof t==`object`&&!Array.isArray(t)?t:null}var pu=[`oauth`,`token`];function mu(e){switch(e){case`signed-out`:return`Not signed in`;case`connecting`:return`Waiting for your sign-in…`;case`connected`:return`Connected`;case`expired`:return`Sign-in expired`;case`error`:return`Cannot reach the service`}}var hu=V().refine(e=>/^https:\/\/[^\s]+$/i.test(e),`must be an https address`),gu=Qo({vendor:V().min(1).max(60),mcpUrl:hu,readOnlyQuery:os(V(),V()).nullable(),auth:Qo({methods:Xo(cs(pu)).min(1),scopes:Xo(V()),offlineAccess:Wo(),token:Qo({label:V(),createUrl:hu,note:V().nullable()}).nullable()}),tools:Qo({deny:Xo(V()),allowWrites:Xo(V()),featured:Xo(V()),maxResultChars:Bo().int().min(1e3).max(2e5)}),cli:Qo({command:V().regex(/^[A-Za-z0-9._-]{1,40}$/),versionArg:V().regex(/^--?[A-Za-z0-9-]{1,20}$/),install:os(V(),V()),login:Qo({command:V(),tokenEnv:V().nullable()}),purpose:V()}).nullable(),skills:Xo(Qo({name:V().regex(/^[a-z0-9][a-z0-9_-]{0,47}$/),source:Qo({repo:V().regex(/^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/),ref:V().regex(/^[0-9a-f]{40}$/,`pin a full commit, never a branch`),path:V().refine(e=>!/(^|[\\/])\.\.([\\/]|$)|^[\\/]/.test(e),`relative path`)}),license:V(),exclude:Xo(V())})),docsUrl:hu}).loose();function _u(e){if(e.toolName!==`ConnectorChange`)return null;let t=e.input;if(!t||typeof t!=`object`||typeof t.connector!=`string`||typeof t.vendor!=`string`||typeof t.tool!=`string`)return null;let n=t.arguments!==null&&typeof t.arguments==`object`&&!Array.isArray(t.arguments)?t.arguments:{};return{connector:t.connector,vendor:t.vendor,tool:t.tool,description:typeof t.description==`string`?t.description:``,arguments:n}}function vu(e){let t=Object.keys(e.arguments).slice(0,8);return`${e.vendor}: ${e.tool}${t.length>0?` (${t.join(`, `)})`:``}`}var yu=[`win32`,`linux`,`darwin`],bu=[`demo`,`live`],xu=[`allow`,`ask`],Su=[`string`,`number`,`integer`,`boolean`,`array`,`object`];function Cu(e){let t=e/1048576;return t>=100?`${Math.round(t)} MB`:t>=1?`${t.toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function wu(e){if(e.toolName!==`InstallToolPack`)return null;let t=e.input;return!t||typeof t!=`object`||typeof t.pack!=`string`||typeof t.name!=`string`||typeof t.version!=`string`||typeof t.sizeBytes!=`number`||typeof t.path!=`string`?null:{pack:t.pack,name:t.name,version:t.version,sizeBytes:t.sizeBytes,path:t.path}}function Tu(e,t){let n=t?.[e.slug];return typeof n==`boolean`?n:e.defaultOn}function Eu(e,t){return e.filter(e=>Tu(e,t))}var Du={slug:48,name:80,entryTool:40,description:2e3,promptLine:1e3,details:8e3,actionDescription:1e3,params:30,paramName:48,paramDescription:400,enumValues:40,callArgKeys:20,callError:500,callBatch:100},Ou=/^[A-Za-z0-9_-]+$/;function ku(e){return typeof e==`string`&&e.length>0&&e.length<=Du.entryTool&&Ou.test(e)}function Au(e){return Math.ceil(e.length/4)}function ju(e){return Au(`${e.entryTool} ${e.description}`)+55}function Mu(e){return e.tokensPerRequest??ju(e)+(e.promptLine?Au(e.promptLine):0)}var Nu=Qo({type:cs(Su),required:Wo().optional(),enum:Xo(es([V(),Bo()])).optional(),description:V().optional()}),Pu=Qo({slug:V().min(1),description:V(),params:os(V(),Nu),permission:cs(xu),sort:Bo()}),Fu=Qo({version:V(),url:V(),sha256:V(),sizeBytes:Bo(),exe:V(),format:us(`zip`)}),Iu=Qo({slug:V().min(1),name:V(),entryTool:V().refine(ku,`not a valid tool name`),description:V(),promptLine:V().nullable(),details:V().nullable().optional(),status:cs(bu),defaultOn:Wo(),sort:Bo(),install:Fu.nullable(),actions:Xo(Pu),connector:gu.nullable().optional().catch(null)}).loose();Qo({platform:cs(yu),version:V(),packs:Xo(Iu),refreshMinutes:Bo()});var Lu=cs([`stdio`,`sse`,`http`]),Ru=Qo({id:V().trim().regex(/^[a-z0-9][a-z0-9._-]{0,63}$/i,`ID must be 1-64 alphanumeric, dash, dot, or underscore characters`),name:V().trim().min(1).max(100),description:V().max(500).optional(),transport:Lu,command:V().min(1).max(500).optional(),args:Xo(V()).max(100).optional(),env:os(V(),V()).optional(),url:V().url().max(2e3).optional(),headers:os(V(),V()).optional(),defaultOn:Wo(),enabled:Wo().optional(),catalogId:V().max(100).optional()});Ru.refine(e=>e.transport===`stdio`?typeof e.command==`string`&&e.command.length>0:typeof e.url==`string`&&e.url.length>0,{message:`stdio transport requires a command; sse/http transports require a url`}),Ru.partial(),os(V().regex(/^[a-z0-9][a-z0-9._-]{0,63}$/i),Wo()).refine(e=>Object.keys(e).length<=128,`At most 128 MCP server switches`);function zu(e,t){if(e.enabled===!1)return!1;let n=t?t[e.id]:void 0;return typeof n==`boolean`?n:e.defaultOn}function Bu(e,t,n){return{...e??{},[t]:n}}var Vu=[{id:`databases`,label:`Databases`},{id:`cloud`,label:`Cloud & DevOps`},{id:`productivity`,label:`Productivity`},{id:`analytics`,label:`Analytics`},{id:`ai`,label:`AI & Reasoning`},{id:`developer`,label:`Developer Tools`}],Hu=[{id:`postgres`,name:`PostgreSQL`,description:`Inspect schemas, query tables, run read operations and analyze database structures.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-postgres`,"${connectionString}"],parameters:[{key:`connectionString`,label:`Database Connection URL`,placeholder:`postgresql://user:password@localhost:5432/dbname`,type:`password`,required:!0,target:`arg`,templateIndex:2}],docsUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/postgres`},{id:`sqlite`,name:`SQLite`,description:`Direct SQL query and schema inspection for local SQLite database files.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-sqlite`,`--db-path`,"${dbPath}"],parameters:[{key:`dbPath`,label:`SQLite File Path`,placeholder:`C:/data/app.db or /var/data/app.db`,type:`string`,required:!0,target:`arg`,templateIndex:3}],docsUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/sqlite`},{id:`supabase`,name:`Supabase`,description:`Manage Supabase Postgres database, migrations, edge functions, and project config.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-supabase`],parameters:[{key:`SUPABASE_ACCESS_TOKEN`,label:`Personal Access Token`,type:`password`,required:!0,target:`env`},{key:`SUPABASE_PROJECT_REF`,label:`Project Reference ID`,placeholder:`abcdefghijklmnopqrst`,type:`string`,required:!0,target:`env`}],docsUrl:`https://supabase.com/docs/guides/ai/mcp`},{id:`redis`,name:`Redis`,description:`Inspect keys, data structures, and execute Redis operational commands.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-redis`,"${redisUrl}"],parameters:[{key:`redisUrl`,label:`Redis Connection URL`,placeholder:`redis://localhost:6379`,type:`string`,required:!0,target:`arg`,templateIndex:2}]},{id:`mongodb`,name:`MongoDB Atlas`,description:`Query collections, inspect schemas, and interact with MongoDB Atlas databases.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-mongodb`,"${connectionString}"],parameters:[{key:`connectionString`,label:`MongoDB Connection URI`,placeholder:`mongodb+srv://user:pass@cluster.mongodb.net/dbname`,type:`password`,required:!0,target:`arg`,templateIndex:2}]},{id:`github`,name:`GitHub`,description:`Search repositories, manage issues, pull requests, files, and branches.`,category:`cloud`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-github`],parameters:[{key:`GITHUB_PERSONAL_ACCESS_TOKEN`,label:`GitHub Personal Access Token (repo scope)`,placeholder:`ghp_...`,type:`password`,required:!0,target:`env`}],docsUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/github`},{id:`gitlab`,name:`GitLab`,description:`Access GitLab merge requests, project branches, issues, and pipelines.`,category:`cloud`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-gitlab`],parameters:[{key:`GITLAB_PERSONAL_ACCESS_TOKEN`,label:`GitLab Personal Access Token`,type:`password`,required:!0,target:`env`},{key:`GITLAB_API_URL`,label:`GitLab API URL (optional for self-hosted)`,placeholder:`https://gitlab.com/api/v4`,type:`string`,required:!1,target:`env`}]},{id:`cloudflare`,name:`Cloudflare`,description:`Inspect and manage Cloudflare Workers, KV namespaces, D1 databases, and DNS records.`,category:`cloud`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@cloudflare/mcp-server-cloudflare`],parameters:[{key:`CLOUDFLARE_API_TOKEN`,label:`API Token`,type:`password`,required:!0,target:`env`},{key:`CLOUDFLARE_ACCOUNT_ID`,label:`Account ID`,type:`string`,required:!0,target:`env`}]},{id:`sentry`,name:`Sentry`,description:`Retrieve real-time application errors, stack traces, and issue analytics.`,category:`cloud`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-sentry`],parameters:[{key:`SENTRY_AUTH_TOKEN`,label:`Auth Token`,type:`password`,required:!0,target:`env`}]},{id:`google-drive`,name:`Google Drive`,description:`Search, read, and export documents, spreadsheets, and files from Google Drive.`,category:`productivity`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-gdrive`],docsUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/gdrive`},{id:`slack`,name:`Slack`,description:`Read conversation history, search channel messages, and post updates to Slack channels.`,category:`productivity`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-slack`],parameters:[{key:`SLACK_BOT_TOKEN`,label:`Bot User OAuth Token (xoxb-...)`,type:`password`,required:!0,target:`env`},{key:`SLACK_TEAM_ID`,label:`Slack Workspace Team ID`,type:`string`,required:!0,target:`env`}]},{id:`notion`,name:`Notion`,description:`Read and update Notion workspaces, databases, pages, and blocks.`,category:`productivity`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-notion`],parameters:[{key:`NOTION_API_KEY`,label:`Internal Integration Secret (secret_...)`,type:`password`,required:!0,target:`env`}]},{id:`linear`,name:`Linear`,description:`Track issues, cycles, projects, and comments in Linear.`,category:`productivity`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-linear`],parameters:[{key:`LINEAR_API_KEY`,label:`Personal API Key`,type:`password`,required:!0,target:`env`}]},{id:`posthog`,name:`PostHog`,description:`Query product analytics funnels, trends, user session paths, and feature flags.`,category:`analytics`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@posthog/mcp-server-posthog`],parameters:[{key:`POSTHOG_API_KEY`,label:`Personal API Key`,type:`password`,required:!0,target:`env`},{key:`POSTHOG_PROJECT_ID`,label:`Project ID`,type:`string`,required:!0,target:`env`}]},{id:`brave-search`,name:`Brave Search`,description:`Search the live web and discover local points of interest via Brave Search API.`,category:`ai`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-brave-search`],parameters:[{key:`BRAVE_API_KEY`,label:`Brave Search API Key`,type:`password`,required:!0,target:`env`}]},{id:`memory-graph`,name:`Memory (Knowledge Graph)`,description:`Persistent knowledge-graph entity and relation memory across agent turns.`,category:`ai`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-memory`]},{id:`puppeteer`,name:`Puppeteer Headless Browser`,description:`Automate browser navigation, take page screenshots, and scrape dynamic web content.`,category:`ai`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-puppeteer`]},{id:`remote-sse`,name:`Remote SSE MCP Server`,description:`Connect to any hosted remote MCP server over Server-Sent Events (SSE).`,category:`developer`,transport:`sse`,defaultUrl:`https://`,parameters:[{key:`url`,label:`SSE Endpoint URL`,placeholder:`https://mcp.example.com/sse`,type:`string`,required:!0,target:`url`},{key:`Authorization`,label:`Authorization Header (optional, e.g. Bearer token)`,placeholder:`Bearer ...`,type:`password`,required:!1,target:`header`}]},{id:`remote-http`,name:`Remote Streamable HTTP Server`,description:`Connect to any remote MCP server using standard Streamable HTTP transport.`,category:`developer`,transport:`http`,defaultUrl:`https://`,parameters:[{key:`url`,label:`HTTP Endpoint URL`,placeholder:`https://mcp.example.com/mcp`,type:`string`,required:!0,target:`url`},{key:`Authorization`,label:`Authorization Header (optional, e.g. Bearer token)`,placeholder:`Bearer ...`,type:`password`,required:!1,target:`header`}]}],Uu=[`No answer needed.`,`"Talk to other chats" is off in this chat: this message is from another chat's agent, not the person, and you cannot message chats. Your final answer goes back to that chat by itself.`,`"Talk to other chats" is off in this chat: this message is from another chat's agent, not the person, and you cannot message chats. It asked for no answer, so nothing goes back.`,`Last hop of this chain: you cannot message chats in this turn; put what you have in your final answer.`];[`**Let this chat work together with your other chats.**`,``,`### What it does`,`- Finds your other chats on this PC and reads their recent messages.`,`- Sends one chat, or a group of chats, a message or a task.`,`- Brings their answers back to this chat, by itself.`,``,`### How it works`,`- A chat that is asleep is woken from its saved history. A busy one gets the message when its current turn ends, never in the middle of it.`,`- The other chat does the work with its own model, folder and tools. Its answer comes back here as a new message only when this chat asked for one.`,`- Several messages from one chat that wait for a busy chat are handed over together, in one turn, with one answer.`,`- Several chats can share one conversation (a group). An answer goes only to the chat that asked, so a group cannot multiply its own messages.`,`- A chat with this switch OFF can still be messaged by a chat that has it on. It does the work, and its final answer goes back to that chat when that chat asked for one. That is all it can do: it gets none of these tools, cannot message or read other chats, and its switch stays off.`,``,`### What it costs`,`- About 650 tokens on every request while it is on, read from the prompt cache. Nothing while it is off, even in a chat that is messaged.`,`- Every message makes the chat that receives it do a turn, which spends its own tokens.`,`- Switching it on or off in a chat that already has a conversation re-writes its prompt cache once.`,``,`### Safety limits`,`- Each conversation has a budget: 20 delivered messages and 1,000,000 new tokens by default (context read back from the prompt cache is not counted). Reaching either pauses the conversation, and the chats say so.`,`- A chain stops after 3 hops (a message caused by a message caused by a message).`,`- At most 5 messages between two chats and 20 from one chat in 10 minutes, and 10 waiting for any one chat. A chat cannot message itself.`,`- A conversation with no activity for 24 hours closes by itself.`,``,`### How to stop it`,`- Turn this switch off: the chat loses these tools, and what it sent and the answers it asked for pause. It still answers a chat that messages it.`,`- Or open the Conversations window and use Pause, Close or Stop all.`,``,`### Privacy`,`- Everything stays on your PC: the messages are kept in this PC's database, never on OonaCode's server.`,`- A message never grants anything. The other chat runs with its own permissions and asks you as usual.`,``,`Only a chat with this switch on can start a conversation; a chat with it off only answers.`].join(`
|
|
80
|
+
`,18);return t<0?null:{title:e.slice(18,t),prompt:e.slice(t+3)}}Object.freeze({tengu_amber_sentinel:!0,tengu_groovy_eclipse:!0,tengu_humble_hammock:!0});function mc(e){return e===null||!Number.isFinite(e)?`neutral`:e>30?`ok`:e>10?`warn`:`danger`}var hc=3e4,gc=1440,_c=6e4,vc=[`mon`,`tue`,`wed`,`thu`,`fri`,`sat`,`sun`],yc=/^([01]\d|2[0-3]):[0-5]\d$/;Qo({tz:V().min(1),windows:Xo(Qo({from:V().regex(yc,`HH:MM`),to:V().regex(yc,`HH:MM`),days:Xo(cs(vc)).optional(),kind:cs([`peak`,`offpeak`])})),offpeakDiscount:Bo().nonnegative().max(1).optional()});var bc=[`priceInputCacheMissPeak`,`priceInputCacheMissOffpeak`,`priceInputCacheHitPeak`,`priceInputCacheHitOffpeak`,`priceCacheWritePeak`,`priceCacheWriteOffpeak`,`priceOutputPeak`,`priceOutputOffpeak`],xc=Qo({inputCacheMiss:Bo().nonnegative(),inputCacheHit:Bo().nonnegative().optional(),cacheWrite:Bo().nonnegative().optional(),output:Bo().nonnegative()});Qo({by:us(`prompt_tokens`),tiers:Xo(Qo({upToPromptTokens:Bo().int().positive().optional(),price:xc.optional(),cost:xc.optional()})).min(1),note:V().optional()}).superRefine((e,t)=>{let n=0;e.tiers.forEach((r,i)=>{!r.cost&&!r.price&&t.addIssue({code:`custom`,message:`a tier needs its cost (the provider’s rates; retail is cost × the record’s ratio)`,path:[`tiers`,i,`cost`]});let a=r.upToPromptTokens;if(a===void 0){i!==e.tiers.length-1&&t.addIssue({code:`custom`,message:`only the LAST tier may omit upToPromptTokens`,path:[`tiers`,i]});return}a<=n&&t.addIssue({code:`custom`,message:`tiers must ascend: ${a} does not exceed ${n}`,path:[`tiers`,i,`upToPromptTokens`]}),n=a})}),[...bc];var Sc={realtime:`/v1/realtime`,translations:`/v1/realtime/translations`,live:`/v1/live/sessions`,speechStream:`/v1/audio/speech/stream`,transcriptionStream:`/v1/audio/transcriptions/stream`,clientSecrets:`/v1/realtime/client_secrets`,translationClientSecrets:`/v1/realtime/translations/client_secrets`};Sc.realtime,Sc.translations,Sc.live,Sc.speechStream,Sc.transcriptionStream;var Cc=`M0.72 12a11.28 11.28 0 1 0 22.56 0a11.28 11.28 0 1 0 -22.56 0ZM4.8 12a7.2 7.2 0 1 0 14.4 0a7.2 7.2 0 1 0 -14.4 0ZM7.44 12a4.56 4.56 0 1 0 9.12 0a4.56 4.56 0 1 0 -9.12 0Z`,wc=`M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z`,Tc=`M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z`,Ec=`M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81`,Dc={oonacode:{hex:`#000000`,owner:`OonaCode`,d:Cc,fillRule:`evenodd`},anthropic:{hex:`#D97757`,owner:`Anthropic`,d:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`},"anthropic-subscription":{hex:`#D97757`,owner:`Anthropic`,d:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`},openai:{hex:`#000000`,owner:`OpenAI`,d:Tc},xai:{hex:`#000000`,owner:`xAI`,d:wc},deepseek:{hex:`#5786FE`,owner:`DeepSeek`,d:`M23.748 4.651c-.254-.124-.364.113-.512.233-.051.04-.094.09-.137.137-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.155-.708-.311-.955-.65-.172-.24-.219-.509-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.094.172.187.129.323-.082.28-.18.553-.266.833-.055.179-.137.218-.328.14a5.5 5.5 0 0 1-1.737-1.179c-.857-.828-1.631-1.743-2.597-2.46a12 12 0 0 0-.689-.47c-.985-.957.13-1.743.387-1.836.27-.098.094-.433-.778-.428-.872.003-1.67.295-2.687.685a3 3 0 0 1-.465.136 9.6 9.6 0 0 0-2.883-.101c-1.885.21-3.39 1.1-4.497 2.622C.082 8.776-.231 10.854.152 13.02c.403 2.284 1.568 4.175 3.36 5.653 1.857 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.132-.284 4.994-1.86.47.234.962.328 1.78.398.629.058 1.235-.031 1.705-.129.735-.155.684-.836.418-.961-2.155-1.004-1.682-.595-2.112-.926 1.095-1.295 2.768-3.598 3.284-6.733.05-.346.115-.834.108-1.114-.004-.171.035-.238.23-.257a4.2 4.2 0 0 0 1.545-.475c1.397-.763 1.96-2.016 2.093-3.517.02-.23-.004-.467-.247-.588M11.58 18.168c-2.088-1.642-3.101-2.183-3.52-2.16-.39.024-.32.472-.234.763.09.288.207.487.371.74.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.168-1.361-.801-2.5-1.86-3.301-3.306-.775-1.393-1.225-2.888-1.299-4.482-.02-.385.094-.522.477-.592a4.7 4.7 0 0 1 1.53-.038c2.131.311 3.946 1.264 5.467 2.774.868.86 1.525 1.887 2.202 2.89.72 1.066 1.494 2.082 2.48 2.915.348.291.626.513.892.677-.802.09-2.14.109-3.055-.615zm1.001-6.44a.306.306 0 0 1 .415-.287.3.3 0 0 1 .113.074.3.3 0 0 1 .086.214c0 .17-.136.307-.308.307a.303.303 0 0 1-.306-.307m3.11 1.596c-.2.081-.4.151-.591.16a1.25 1.25 0 0 1-.798-.254c-.274-.23-.47-.358-.551-.758a1.7 1.7 0 0 1 .015-.588c.07-.327-.007-.537-.238-.727-.188-.156-.426-.199-.689-.199a.6.6 0 0 1-.254-.078.253.253 0 0 1-.114-.358 1 1 0 0 1 .192-.21c.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.392.451.462.576.685.915.176.264.336.536.446.848.066.194-.02.353-.25.45`},kimi:{hex:`#000000`,owner:`Moonshot`,d:`M21.765.351C22.998.351 24 1.353 24 2.586S22.998 4.82 21.765 4.82h-1.974c-.15 0-.26-.12-.26-.26V2.586A2.237 2.237 0 0 1 21.765.35M9.41 13.388l8.447-8.377c.16-.16.07-.471-.14-.471h-4.55s-.1.02-.14.06l-9.099 9.029c-.14.14-.35.02-.35-.21V4.81c0-.15-.1-.27-.221-.27H.22c-.12 0-.22.12-.22.27v18.57c0 .15.1.27.22.27h3.137c.12 0 .22-.12.22-.27v-3.79c0-.08.03-.16.08-.21l2.826-2.796c.07-.07.16-.08.241-.03l7.546 5.551a8.9 8.9 0 0 0 4.018 1.493c.12.01.23-.11.23-.27V19.76c0-.14-.08-.25-.19-.26a5.8 5.8 0 0 1-2.355-.942l-6.533-4.73c-.14-.09-.15-.32-.03-.441`},qwen:{hex:`#6950EF`,owner:`Alibaba`,d:`M23.919 14.545 20.817 9.17l1.47-2.544a.56.56 0 0 0 0-.566l-1.633-2.83a.57.57 0 0 0-.49-.283h-6.207L12.487.402a.57.57 0 0 0-.49-.284H8.732a.56.56 0 0 0-.49.284L5.139 5.775h-2.94a.56.56 0 0 0-.49.284L.077 8.887a.56.56 0 0 0 0 .567L3.18 14.83l-1.47 2.545a.56.56 0 0 0 0 .566l1.634 2.83a.57.57 0 0 0 .49.283h6.205l1.47 2.545a.57.57 0 0 0 .49.284h3.266a.57.57 0 0 0 .49-.284l3.104-5.375h2.94a.57.57 0 0 0 .49-.283l1.634-2.828a.55.55 0 0 0-.004-.568M8.733.686l1.634 2.828-1.634 2.828H21.8L20.164 9.17H7.425L5.63 6.06Zm1.306 19.801-6.205-.002 1.634-2.83h3.265L2.201 6.344h3.267q3.182 5.517 6.367 11.032zm10.124-5.66L18.53 12l-6.532 11.315-1.634-2.83c2.129-3.673 4.25-7.351 6.373-11.028h3.592l3.102 5.374z`},"xai-subscription":{hex:`#000000`,owner:`xAI`,d:wc},"openai-subscription":{hex:`#000000`,owner:`OpenAI`,d:Tc},"openai-codex":{hex:`#000000`,owner:`OpenAI`,d:Tc},"google-agy":{hex:`#8E75B2`,owner:`Google`,d:Ec},antigravity:{hex:`#8E75B2`,owner:`Google`,d:Ec},mimo:{hex:`#FF6900`,owner:`Xiaomi`,d:`M12 0C8.016 0 4.756.255 2.493 2.516.23 4.776 0 8.033 0 12.012c0 3.98.23 7.235 2.494 9.497C4.757 23.77 8.017 24 12 24c3.983 0 7.243-.23 9.506-2.491C23.77 19.247 24 15.99 24 12.012c0-3.984-.233-7.243-2.502-9.504C19.234.252 15.978 0 12 0zM4.906 7.405h5.624c1.47 0 3.007.068 3.764.827.746.746.827 2.233.83 3.676v4.54a.15.15 0 0 1-.152.147h-1.947a.15.15 0 0 1-.152-.148V11.83c-.002-.806-.048-1.634-.464-2.051-.358-.36-1.026-.441-1.72-.458H7.158a.15.15 0 0 0-.151.147v6.98a.15.15 0 0 1-.152.148H4.906a.15.15 0 0 1-.15-.148V7.554a.15.15 0 0 1 .15-.149zm12.131 0h1.949a.15.15 0 0 1 .15.15v8.892a.15.15 0 0 1-.15.148h-1.949a.15.15 0 0 1-.151-.148V7.554a.15.15 0 0 1 .151-.149zM8.92 10.948h2.046c.083 0 .15.066.15.147v5.352a.15.15 0 0 1-.15.148H8.92a.15.15 0 0 1-.152-.148v-5.352a.15.15 0 0 1 .152-.147Z`}};function Oc(e){return Dc[e]??null}function kc(e){let t=e.replace(/\(.*?\)/g,` `).split(/[\s/_-]+/).filter(Boolean);return t.length===0?`?`:t.length===1?t[0].slice(0,2).toUpperCase():`${t[0][0]}${t[1][0]}`.toUpperCase()}var Ac=9230,jc=1024,Mc=65534,Nc=`127.0.0.1`;Object.freeze({enabled:!1,port:Ac,inspectMain:!1}),Object.freeze({port:null,listening:!1,fromCommandLine:!1,inspectPort:null,inspectProblem:null});function Pc(e){return e+1}function Fc(e){return typeof e==`number`&&Number.isInteger(e)}function Ic(e){return!Fc(e)||e<1024||e>65534?`The port must be a whole number from ${jc.toLocaleString(`en-US`)} to ${Mc.toLocaleString(`en-US`)} (the main-process inspector takes the next one).`:null}function Lc(e){return e.port!==null||e.inspectPort!==null}function Rc(e,t){let n=e.enabled?e.port:null,r=e.enabled&&e.inspectMain?Pc(e.port):null;return!t.fromCommandLine&&t.port!==n||t.inspectPort!==r}function zc(e){let t=[];return e.port!==null&&t.push(`${Nc}:${e.port}`),e.inspectPort!==null&&t.push(`${Nc}:${e.inspectPort}`),t.length===2?`${t[0]} (windows) and ${t[1]} (main process)`:e.inspectPort===null?t[0]??``:`${t[0]} (main process)`}var Bc=[`stable`,`dev`];function Vc(e){return typeof e==`string`&&Bc.includes(e)}function Hc(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return Vc(t)?t:null}var Uc=[`win32`,`linux`,`darwin`],Wc=[`x64`,`arm64`];function Gc(e,t){let n=Hc(e)??`stable`,r=[];return n!==`stable`&&r.push(`channel=${encodeURIComponent(n)}`),t&&Uc.includes(t.platform)&&(r.push(`platform=${t.platform}`),t.arch&&Wc.includes(t.arch)&&r.push(`arch=${t.arch}`)),r.length>0?`${nc.releasesLatest}?${r.join(`&`)}`:nc.releasesLatest}function Kc(e,t){let n=Hc(t)??`stable`;return n===`stable`?e:`${e} (${n})`}var qc={safeguards:`safeguards`,safety_filters:`safety filters`},Jc=[{vendor:`Alibaba (Model Studio / DashScope — Qwen, and the DeepSeek/GLM it hosts)`,seenAs:`400 {"error":{"code":"data_inspection_failed","message":"Input data may contain inappropriate content."}}`,pattern:/data[_ ]?inspection[_ ]?failed|may contain inappropriate content/i},{vendor:`Zhipu (GLM)`,seenAs:`400 {"error":{"code":"1301","message":"系统检测到输入或生成内容可能包含不安全或敏感内容…"}} (contentFilter)`,pattern:/"code"\s*:\s*"?1301"?|不安全或敏感内容|unsafe or sensitive content|contentFilter/i},{vendor:`DeepSeek`,seenAs:`400 {"error":{"message":"Content Exists Risk","type":"invalid_request_error"}}`,pattern:/content exists risk/i},{vendor:`Moonshot (Kimi)`,seenAs:`400 {"error":{"type":"content_filter","message":"The request was rejected because it was considered high risk"}}`,pattern:/"type"\s*:\s*"content_filter"|considered high risk/i},{vendor:`xAI (Grok)`,seenAs:`400 "Content violates usage guidelines. Failed check: SAFETY_CHECK_TYPE_…"`,pattern:/content violates usage guidelines|SAFETY_CHECK_TYPE_/i},{vendor:`OpenAI (and Azure-style filters)`,seenAs:`400 {"error":{"code":"content_filter" | "content_policy_violation" | "moderation_blocked"}}`,pattern:/"code"\s*:\s*"(?:content_filter|content_policy_violation|moderation_blocked)"/i},{vendor:`Google (Gemini)`,seenAs:`This request was blocked by Gemini's filters. They can occasionally trigger by mistake on safe coding, security, or biology-related queries.`,pattern:/blocked by Gemini(?:'s)? filters|Gemini(?:'s)? filters/i}],Yc=/blocked by (?:the )?(?:content[ -]safety|Gemini(?:'s)?) filters?|content safety filters?|blocked by Gemini(?:'s)? filters?/i,Xc=/blocked by Gemini(?:'s)? filters|Gemini(?:'s)? filters\.? They can occasionally trigger/i;function Zc(e){return typeof e==`string`&&Xc.test(e)}function Qc(e){return typeof e!=`string`||e===``||!/^\s*(?:Failed to authenticate\.\s*)?API Error\b/i.test(e)?null:Jc.find(t=>t.pattern.test(e))??null}function $c(e){return typeof e==`string`&&(Zc(e)||Yc.test(e)&&/blocked/i.test(e))}var el=`:free`;function tl(e){return e.endsWith(el)}function nl(e){return tl(e)?e.slice(0,-5):e}var rl=`model_refusal_fallback`,il=`model_refusal_no_fallback`;function al(e){return typeof e==`string`&&e.trim()!==``?e.trim():null}function ol(e,t,n){return al(e[t])??al(e[n])}function sl(e){if(typeof e!=`object`||!e)return null;let t=e,n=t.subtype,r=n===`model_refusal_fallback`?`fallback`:n===`model_refusal_no_fallback`?`no_fallback`:t.kind===`fallback`||t.kind===`no_fallback`?t.kind:null;if(!r||t.type!==void 0&&t.type!==`system`)return null;let i=t.retracted_message_uuids??t.retractedMessageUuids??t.retractedUuids;return{kind:r,scope:t.scope===`local`?`local`:`session`,originalModel:ol(t,`original_model`,`originalModel`),fallbackModel:r===`fallback`?ol(t,`fallback_model`,`fallbackModel`):null,category:ol(t,`api_refusal_category`,`apiRefusalCategory`)??al(t.category),explanation:ol(t,`api_refusal_explanation`,`apiRefusalExplanation`)??al(t.explanation),text:typeof t.content==`string`?t.content.trim():al(t.text)??``,retractedUuids:Array.isArray(i)?i.filter(e=>typeof e==`string`):[]}}function cl(e,t){switch(t.type){case`notice`:return t.notice.kind!==`fallback`||t.notice.scope!==`session`?e:{notice:t.notice,at:t.at,live:t.live};case`engine_start`:case`model_change`:return null}}function ll(e,t){return!e||t.alive===!1||!e.live&&t.since!==null&&e.at!==null&&e.at<t.since?null:e}function ul(e){let t=Ys(e.trim()),n=t.slice(t.lastIndexOf(`/`)+1),r=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),i=n.split(`-`);if(i[0]?.toLowerCase()!==`claude`)return t;let a=i.slice(1).filter(e=>!/^\d{6,}$/.test(e)),o=a.filter(e=>!/^\d+$/.test(e)),s=a.filter(e=>/^\d+$/.test(e));return o.length!==1||s.length===0?t:`${r(o[0])} ${s.join(`.`)}`}function dl(e,t=[]){let n=Ys(e.trim()),r=null;for(let e of t)for(let t of e.definition.models){if(t.id===n||Ys(t.id)===n)return t.displayName;r===null&&(t.upstreamId===n||nl(t.id)===n)&&(r=t.displayName)}return r??ul(n)}function fl(e){return`${e} (safeguard)`}var pl=`none`,ml={mode:`auto`,model:null,perModel:{}};function hl(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0&&t.length<=200&&/^[A-Za-z0-9._:@/[\]-]+$/.test(t)?t:null}function gl(e){return Ys(e.trim()).toLowerCase()}function _l(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e:{},n=hl(t.model),r=t.mode,i=r===`off`?`off`:r===`model`&&n!==null?`model`:`auto`,a={},o=t.perModel;if(typeof o==`object`&&o&&!Array.isArray(o))for(let[e,t]of Object.entries(o)){let n=hl(e),r=t===`none`?pl:hl(t);if(n!==null&&r!==null&&gl(n)!==gl(r)&&(a[gl(n)]=r,Object.keys(a).length>=64))break}return{mode:i,model:i===`model`?n:null,perModel:a}}function vl(e){return e===w}var yl=`oona settings safeguard-fallback auto`;function bl(e,t=[]){if(!e)return`the model`;let n=gl(e);return t.find(e=>gl(e.id)===n||e.upstreamId&&gl(e.upstreamId)===n)?.displayName??ul(e)}function xl(e,t=e=>bl(e)){let n=`blocked by ${qc[e.reason]}`;if(e.outcome===`retried`)return`${n} → retried on ${e.retriedOn?t(e.retriedOn):`another model`}`;switch(e.blocked){case`off`:return`${n} · fallback off (${yl})`;case`no_model`:return`${n} · no fallback model`;case`unavailable`:return`${n} · fallback not available here`;case`refused_again`:return`${n} · fallback refused too`;case`not_retryable`:return`${n} · not retried`;default:return n}}var Sl=5e4,Cl=6,wl=[`sessions`,`search`,`files`],Tl=[`media`,`sessionInfo`];function El(e){return typeof e==`string`&&wl.includes(e)?e:null}function Dl(e){if(!Array.isArray(e))return null;let t=[];for(let n of e)typeof n==`string`&&Tl.includes(n)&&!t.includes(n)&&t.push(n);return t}var Ol=[`bg`,`surface`,`surface-2`,`surface-3`,`border`,`fg`,`fg-muted`,`fg-faint`,`accent`,`accent-fg`,`accent-soft`,`project`,`ok`,`ok-soft`,`warn`,`warn-soft`,`danger`,`danger-soft`,`think`,`think-soft`,`code-bg`,`user-bubble`],kl=/^[A-Za-z0-9 ,'"_-]+$/,Al=/^(?:[A-Za-z0-9 _-]+|'[A-Za-z0-9 _-]+'|"[A-Za-z0-9 _-]+")$/;function jl(e){let t=typeof e==`number`&&Number.isFinite(e)?Math.round(e):NaN;return Number.isFinite(t)?Math.min(28,Math.max(10,t)):null}function Ml(e){if(typeof e!=`string`)return null;let t=e.trim().slice(0,160).trim();return t.length===0||!kl.test(t)?null:t.split(`,`).every(e=>Al.test(e.trim()))?t:null}function Nl(e){let t=$l(e);return{family:Ml(t.family),size:jl(t.size)}}function Pl(e){let t=$l(e);return{chat:Nl(t.chat),sidebar:Nl(t.sidebar)}}var Fl={agentFinished:!1,permissionRequired:!0,errorOccurred:!0},Il={autoAcceptPermissions:!1,autosaveFiles:!1,safeguardFallback:ml,showReasoningSummaries:!0,notifications:Fl,showAgentPicker:!0,transcriptWindowSize:500,openTabs:[],draftTabs:[],draftTitles:{},activeTab:null,editorLayout:null,remoteTabs:{},sessionPanelOpen:!1,explorerOpen:!1,leftPanelSection:`sessions`,leftPanelOpen:!0,rightPanelSections:[],rightPanelCollapsed:[],sidebarWidth:288,sessionPanelWidth:288,mediaPanelWidth:320,rightPanelWidth:320,sidebarPinned:!0,dismissedUpdateVersion:null,lastSeenReleaseNotes:null,claudeImportOffered:!1,claudeImportOffers:0,collapsedProjects:[],themeColors:{light:{},dark:{}},fonts:{chat:{family:null,size:null},sidebar:{family:null,size:null}},pinned:[],sidebarView:`recent`};function Ll(e){return Math.min(Math.max(typeof e==`number`&&Number.isFinite(e)?Math.floor(e):0,0),3)}function Rl(e){return Math.min(640,Math.max(200,typeof e==`number`&&Number.isFinite(e)?Math.round(e):288))}function zl(e,t){return Math.min(720,Math.max(240,typeof e==`number`&&Number.isFinite(e)?Math.round(e):t))}function Bl(e){return Math.min(Sl,Math.max(100,typeof e==`number`&&Number.isFinite(e)?Math.round(e):500))}function Vl(e,t){return typeof e==`boolean`?e:t}function Hl(e){return typeof e==`string`&&e.length>0&&e.length<=64?e:null}function Ul(e,t=50){if(!Array.isArray(e))return[];let n=[];for(let r of e)if(!(typeof r!=`string`||r.length===0||r.length>200)&&!n.includes(r)&&(n.push(r),n.length>=t))break;return n}function Wl(e,t=50){if(typeof e!=`object`||!e||Array.isArray(e))return{};let n={};for(let[r,i]of Object.entries(e))if(!(r.length===0||r.length>200)&&!(typeof i!=`string`||i.length===0||i.length>200)&&(n[r]=i,Object.keys(n).length>=t))break;return n}function Gl(e){if(typeof e!=`string`)return null;let t=e.trim();return/^#[0-9a-fA-F]{6}$/.test(t)?t.toLowerCase():null}function Kl(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e)){if(!Ol.includes(n))continue;let e=Gl(r);e!==null&&(t[n]=e)}return t}function ql(e){let t=typeof e==`object`&&e?e:{};return{light:Kl(t.light),dark:Kl(t.dark)}}function Jl(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!=`object`||!n)continue;let e=n.kind,r=n.id;if((e===`chat`||e===`project`)&&!(typeof r!=`string`||r.length===0||r.length>200)&&!t.some(t=>t.kind===e&&t.id===r)&&(t.push({kind:e,id:r}),t.length>=50))break}return t}function Yl(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return null;let n=e,r=new Set(t),i=new Set,a=0,o=(e,t)=>{if(t>Cl||typeof e!=`object`||!e)return null;let n=e,s=n.group;if(typeof s==`object`&&s&&!Array.isArray(s)){if(a>=8)return null;let e=s,t=[];for(let n of Array.isArray(e.tabs)?e.tabs:[])typeof n!=`string`||!r.has(n)||i.has(n)||(i.add(n),t.push(n));return t.length===0?null:(a+=1,{group:{tabs:t,active:(typeof e.active==`string`&&t.includes(e.active)?e.active:null)??t[t.length-1]}})}let c=n.split;if(c!==`row`&&c!==`column`)return null;let l=Array.isArray(n.children)?n.children:[],u=Array.isArray(n.sizes)?n.sizes:[],d=[],f=[];if(l.slice(0,8).forEach((e,n)=>{let r=o(e,t+1);if(!r)return;d.push(r);let i=u[n];f.push(typeof i==`number`&&Number.isFinite(i)&&i>0?i:0)}),d.length===0)return null;if(d.length===1)return d[0];let p=f.filter(e=>e>0),m=p.length>0?p.reduce((e,t)=>e+t,0)/p.length:1,h=f.map(e=>e>0?e:m),g=h.reduce((e,t)=>e+t,0);return{split:c,sizes:h.map(e=>e/g),children:d}},s=o(n.root,0);if(!s||a<2)return null;let c=n.focused;return{root:s,focused:typeof c==`number`&&Number.isInteger(c)&&c>=0&&c<a?c:0}}function Xl(e,t,n){return e.some(e=>e.kind===t&&e.id===n)}function Zl(e,t,n,r){return r===Xl(e,t,n)?e:r?[...e.length>=50?e.slice(e.length-50+1):e,{kind:t,id:n}]:e.filter(e=>e.kind!==t||e.id!==n)}function Ql(e){let t=typeof e==`object`&&e?e:{},n=typeof t.notifications==`object`&&t.notifications!==null?t.notifications:{},r=Ul(t.openTabs),i=Ul(t.draftTabs).filter(e=>!r.includes(e)),a={};for(let[e,n]of Object.entries(Wl(t.draftTitles)))i.includes(e)&&(a[e]=n);let o=[...r,...i],s=t.activeTab,c=typeof s==`string`&&o.includes(s)?s:o[o.length-1]??null,l=Vl(t.sessionPanelOpen,Il.sessionPanelOpen),u=Vl(t.explorerOpen,Il.explorerOpen),d=Dl(t.rightPanelSections)??(l?[`sessionInfo`]:[]),f=(Dl(t.rightPanelCollapsed)??[]).filter(e=>d.includes(e));return{autoAcceptPermissions:Vl(t.autoAcceptPermissions,Il.autoAcceptPermissions),autosaveFiles:Vl(t.autosaveFiles,Il.autosaveFiles),safeguardFallback:_l(t.safeguardFallback),showReasoningSummaries:Vl(t.showReasoningSummaries,Il.showReasoningSummaries),notifications:{agentFinished:Vl(n.agentFinished,Fl.agentFinished),permissionRequired:Vl(n.permissionRequired,Fl.permissionRequired),errorOccurred:Vl(n.errorOccurred,Fl.errorOccurred)},showAgentPicker:Vl(t.showAgentPicker,Il.showAgentPicker),transcriptWindowSize:Bl(t.transcriptWindowSize),openTabs:r,draftTabs:i,draftTitles:a,activeTab:c,editorLayout:Yl(t.editorLayout,o),remoteTabs:Wl(t.remoteTabs),sessionPanelOpen:l,explorerOpen:u,leftPanelSection:El(t.leftPanelSection)??(u?`files`:`sessions`),leftPanelOpen:Vl(t.leftPanelOpen,Il.leftPanelOpen),rightPanelSections:d,rightPanelCollapsed:f,sidebarWidth:Rl(t.sidebarWidth),sessionPanelWidth:zl(t.sessionPanelWidth,288),mediaPanelWidth:zl(t.mediaPanelWidth,320),rightPanelWidth:zl(t.rightPanelWidth??t.mediaPanelWidth??t.sessionPanelWidth,320),sidebarPinned:Vl(t.sidebarPinned,Il.sidebarPinned),dismissedUpdateVersion:Hl(t.dismissedUpdateVersion),lastSeenReleaseNotes:Hl(t.lastSeenReleaseNotes),claudeImportOffered:Vl(t.claudeImportOffered,Il.claudeImportOffered),claudeImportOffers:Ll(t.claudeImportOffers),collapsedProjects:Ul(t.collapsedProjects),themeColors:ql(t.themeColors),fonts:Pl(t.fonts),pinned:Jl(t.pinned),sidebarView:t.sidebarView===`projects`?`projects`:`recent`}}new Set(Object.keys(Il));function $l(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}var eu=3650,tu=[{version:`0.3.290`,date:`2026-11-01`,added:[],fixed:[`When a model tries to run an MCP tool or dummy echo command inside Bash instead of calling the tool itself (such as Oonak Browser or web search after a long run of shell commands), OonaCode now stops the call at once, returns a short hint with the active tools and their input format, cleans earlier no-op echo loops from the request, and switches the retry onto the right tool.`]},{version:`0.3.289`,date:`2026-11-01`,platforms:[`darwin`],added:[`Session Info lists every Oonak Browser profile (user-data-dir) the model used in that chat, with a Restore browser button that opens Oonak Browser on that profile and reopens its saved tabs.`],fixed:[]},{version:`0.3.288`,date:`2026-11-01`,platforms:[`win32`],added:[`Session Info lists every Oonak Browser profile (user-data-dir) the model used in that chat, with a Restore browser button that opens Oonak Browser on that profile and reopens its saved tabs.`],fixed:[]},{version:`0.3.287`,date:`2026-10-31`,platforms:[`darwin`],added:[`On a Mac, the terminal can choose the picture, video and speech model for a chat: oona --image-model, --video-model and --audio-model, also when you continue a chat with -c or -r. Leave a flag out and that kind stays on the default.`,`Save to send later: each saved message has an ✕, so you can delete it from the list without sending it.`],fixed:[]},{version:`0.3.286`,date:`2026-10-31`,platforms:[`win32`],added:[`The terminal can choose the picture, video and speech model for a chat: oona --image-model, --video-model and --audio-model, also when you continue a chat with -c or -r. Leave a flag out and that kind stays on the default.`],fixed:[]},{version:`0.3.285`,date:`2026-10-31`,platforms:[`win32`],added:[`Save to send later: each saved message has an ✕, so you can delete it from the list without sending it.`],fixed:[]},{version:`0.3.284`,date:`2026-10-30`,added:[`Your chats on this PC are now encrypted, so no other program and no copy of the file can read them. It happens by itself, once, on the first start of this version — about a minute for every 3 GB of history, with the progress on the start screen. If the app closes meanwhile, nothing is lost: it starts over next time.`,`The key is held by Windows (or your Mac’s keychain or Linux keyring) for your user account, with a copy in your vault. If your PC ever loses it, oona db recover-key brings it back.`,`Once your chats are encrypted, the old history files in Documents\\OonaCode-backups are moved into the encrypted database and the plain files are deleted.`,`Encryption protects the file at rest. Programs running as you while OonaCode is open can still reach what you can, as with any app.`],fixed:[]},{version:`0.3.283`,date:`2026-10-30`,added:[`File → Connect an AI tool…: let Claude Code or another AI tool read your chats on this PC — all of them, chosen ones or one project, for an hour, a day or until you revoke it. Read-only, and the tool never gets your password or vault key. Every read is listed, and one click ends it.`,`Videos: Wan 3.0 animates a photo to a song (a reference picture plus reference audio), takes a document or a web page as a brief, reference clips with pictures, and prompts up to 20,000 characters. Wan 2.7, Wan 2.6, HappyHorse and Grok Imagine gained the options their makers offer that were missing here.`,`Pictures: each model now offers everything its maker does — for example a transparent background, JPEG or WebP and masked edits on GPT Image, image sets on Wan 2.7, and a thinking mode on Qwen-Image 3.0. One call can make several pictures, and chats can use every picture and video model the service runs.`,`This version can open an encrypted chat database. The next update encrypts the chats on this PC by itself, once, with the progress on the start screen.`,`oona db recover-key brings this PC’s chat-database key back from your vault, if Windows or your keyring ever loses it.`],fixed:[`A negative prompt on Wan video models is now actually applied (it was sent where the provider never reads it).`,`Pictures from Qwen, Wan and Grok Imagine models are saved in the chat again; they used to fail to save.`,`A sound clip longer than 15 seconds for Wan 3.0 now says how long it is, instead of a wrong “goes without a picture” error.`,`Very long chats keep their older history inside OonaCode’s database, not as plain text files in Documents\\OonaCode-backups. The files earlier versions wrote there are moved back in once the database is encrypted.`]},{version:`0.3.282`,date:`2026-10-30`,added:[`Allow Telegram to reach this PC (Settings → This PC): the OonaCode bot can list, open and answer this PC’s chats only while it is on. It starts off — turn it on for each PC you want to use from Telegram.`,`The desktop app, the VS Code panel and a browser window each remember their own open chats, saved the moment they change. One of them can no longer close the chats another had open.`,`The groundwork for encrypting the chats stored on your PC: OonaCode now uses a database engine that can encrypt them. Nothing is encrypted yet — that comes in a later update, by itself.`],fixed:[`Chats an earlier update closed come back on the first start of this one, wherever the window still had its own copy of them (the desktop app usually does).`,`The Windows install command no longer waits for ever on a download that has stopped moving; it tries again.`]},{version:`0.3.281`,date:`2026-10-30`,added:[],fixed:[`Stop now really stops the answer: the model’s provider is told to stop too, so nobody pays for output that is no longer read — on your own key and on the OonaCode pool.`,`The message box no longer loses the keyboard to a video or sound player in the chat while you type.`,`A firewall, proxy or Cloudflare page answering in place of OonaCode no longer signs your PC out.`,`Two open tabs of the website no longer sign each other out.`,`Deleting a chat that still had messages waiting to send no longer brings the chat back.`,`Credits are no longer kept on hold when a request fails on our side before it reaches the model.`,`A long chat on a model whose context size is unknown now says when its oldest part was left out on resume, instead of dropping it silently.`,`A crafted link can no longer point your local OonaCode window at another server.`,`Opening a file from a chat refuses more kinds of programs (help files, add-ins and others).`]},{version:`0.3.280`,date:`2026-10-29`,added:[],fixed:[`Google agy chats now retry temporary INVALID_ARGUMENT failures and no longer report an old failure again after a later reply succeeds.`,`Hosted agents keep the model explicitly requested instead of silently substituting the pool default when that model is absent from the public list.`]},{version:`0.3.279`,date:`2026-10-29`,platforms:[`darwin`],added:[`HappyHorse 1.1 is in the video model list: text-to-video, image-to-video and reference-to-video (up to 9 pictures), 3–15 seconds at up to 1080P. Pick it for a chat under Tools → Video model.`,`Asking the video tool what it accepts now lists every video model the chat can use — each with its own inputs (Grok Imagine 1.5’s preset voices included) — and marks the one this chat uses, so you can see what switching models would give you.`,`Save to send later: the clock button to the right of Send keeps the message you typed in this chat instead of sending it. The badge on the button counts what is saved; with an empty message box, the button opens the list (oldest first) — pick one to put it back in the box, edit it if you like, and sending it takes it off the list.`,`The video tool now offers everything the video model you picked actually takes — not just a description and a first picture. Wan 3.0 can be handed a clip to edit and reference clips and sounds, Grok Imagine 1.5 takes preset voices for the speakers and pictures pinned inside the clip, and models that accept a last frame, a “what must not appear” note, a seed or a watermark offer those too.`],fixed:[`Files a reply names — a plan, a report, any plain file, not just pictures, clips and sounds — now appear in the chat’s Media panel under Files.`,`Ctrl+F opens the chat’s find bar on Armenian, Farsi and other non-Latin keyboard layouts too.`,`A clip or a sound in the chat no longer starts playing by itself when you send a new message.`]},{version:`0.3.278`,date:`2026-10-29`,added:[`HappyHorse 1.1 is in the video model list: text-to-video, image-to-video and reference-to-video (up to 9 pictures), 3–15 seconds at up to 1080P. Pick it for a chat under Tools → Video model.`,`Asking the video tool what it accepts now lists every video model the chat can use — each with its own inputs (Grok Imagine 1.5’s preset voices included) — and marks the one this chat uses, so you can see what switching models would give you.`],fixed:[`The “save to send later” clock now sits to the right of the Send/Queue button.`]},{version:`0.3.277`,date:`2026-10-29`,added:[`Save to send later: the clock button beside Send keeps the message you typed in this chat instead of sending it. The badge on the button counts what is saved; with an empty message box, the button opens the list (oldest first) — pick one to put it back in the box, edit it if you like, and sending it takes it off the list.`,`The video tool now offers everything the video model you picked actually takes — not just a description and a first picture. Wan 3.0 can be handed a clip to edit and reference clips and sounds, Grok Imagine 1.5 takes preset voices for the speakers and pictures pinned inside the clip, and models that accept a last frame, a “what must not appear” note, a seed or a watermark offer those too. Ask the chat what its video model accepts, or just describe what you want: it checks against the model and says what does not fit.`],fixed:[`Files a reply names — a plan, a report, any plain file, not just pictures, clips and sounds — now appear in the chat’s Media panel under Files. Before, a file like a Markdown plan printed in the chat was missing there.`,`Ctrl+F opens the chat’s find bar on Armenian, Farsi and other non-Latin keyboard layouts too. Before it only worked when the layout typed a Latin “f”, so on those layouts nothing happened.`,`A clip or a sound in the chat no longer starts playing by itself when you send a new message.`]},{version:`0.3.276`,date:`2026-10-27`,added:[`Kimi now accepts a Kimi Code subscription key (the sk-kimi… key from the Kimi Code console) as well as a Moonshot API key. With a Kimi Code key, resting the pointer on the model box shows how much of your 5-hour and monthly allowance is used and when each resets.`],fixed:[`A chat on Google’s agy can now use the GitHub account you linked: git and gh are signed in there too. Before, agy chats had no GitHub access at all, because agy keeps to its own private home.`,`When GitHub answers “not found” for a repository of an organization that has not approved OonaCode (the organization’s owner approves “OonaCode Git” in its OAuth app settings), the chat now says that instead of concluding the repository does not exist.`]},{version:`0.3.275`,date:`2026-10-27`,added:[`Kimi (Moonshot) is back as a provider you connect with your own Moonshot API key: Kimi K3, K3.1 Pro, K2.7 Code and K2.6. Your PC talks to Moonshot directly — nothing goes through OonaCode’s servers. (The Kimi Code subscription is a different service and is not included.)`],fixed:[`The app keeps up with the provider and model list from OonaCode’s server again. After the server added a provider for Google’s voices, builds before this one could not read the new list and quietly kept the old one, so new models and providers did not appear until the next update.`,`A chat that was set to Gemini is told that the provider was removed and asked to pick another, instead of failing with “unknown provider”. Gemini itself was never available to use.`]},{version:`0.3.274`,date:`2026-10-27`,added:[],fixed:[`A big chat you reopen (Ctrl+R, or after a restart) now ends on its newest messages. Before, the transcripts of old agents were listed after the whole chat, so their cards piled up at the bottom and the last few minutes of the conversation sat above them, out of the window.`,`The note that earlier messages were left out of the request is shown as its folded line after a reload too, not as raw <local-command-stdout> text.`]},{version:`0.3.273`,date:`2026-10-26`,added:[`Rest the pointer on the model box (or focus it with the keyboard) to see how much of that model’s plan or key you have used: the bars and when each limit resets, with the model you are on first. For your own Claude plan it shows what Claude itself reported on its last answer; when that is older than 10 minutes, OonaCode asks again with one tiny message (a few tokens of your own plan or key), or you press “Check now”. Settings → This PC can switch the check off or change the 10 minutes.`],fixed:[`A picture or file sent in a chat on Google’s agy — any of its models, Claude through Google included — is no longer refused with “takes text only”: OonaCode saves it in the chat’s folder and gives the model its path, as it does for every other model.`,`A Google agy chat no longer repeats “Google answered “service unavailable” — continuing in …” (and redoes its last step each time) when Google had in fact answered every request of the turn. A real Google outage is still waited out as before.`]},{version:`0.3.272`,date:`2026-10-26`,added:[`A find-in-page field in the top bar, next to the MCP servers icon: it searches everything visible in OonaCode and highlights the matches (Enter and Shift+Enter step through them). Ctrl+F opens it when no chat find takes the key; Ctrl+Shift+F always does.`,`On the website’s API keys page, a key you create from now on can be shown again with “Reveal key” — it is sealed in your browser with your vault key, so the server still cannot read it. Keys made before this still show only their last four characters.`,`Removing a message now also removes the summary the engine wrote after it, if the chat was summarised later (the summary was made from that message); the confirmation says so. The model then reads the earlier messages themselves again.`],fixed:[`Messages you type while a Google agy turn is running now all go together when the turn ends, instead of one turn per message with “2 queued” left over. The waiting strip says when they will be read, how long they have waited, what the agent is doing and how long earlier turns took.`,`The media panel starts over when OonaCode comes back after an update: it asks for a fresh access grant and reads the list again, and a failed read has a Try again button.`,`The Session info panel shows a chat’s context size as soon as you open it, not only after its next reply.`,`A sub-agent’s “Conversation compacted” line stays inside that agent’s card instead of appearing loose at the end of the chat.`,`When a chat’s own model cannot write its About or the summary of older messages, OonaCode now says so instead of quietly answering with another model.`]},{version:`0.3.271`,date:`2026-10-25`,added:[`Messages can be removed from a chat, and from what the model remembers. Right-click one of your messages, or any reply, tool call or thought of its exchange: “Remove this exchange…” takes out your message and everything the agent did for it; “Remove this and everything after…” also takes out every later message. Open windows update at once, and the chat starts fresh from what is left on its next message. Text already sent to a provider stays in that provider’s own logs.`,`When the provider is throttling OonaCode for a short while, the pool now holds your request and sends it the moment the provider is ready, instead of failing it straight away. It holds up to 90 seconds at a time, and a longer pause is waited out over the engine’s next retry.`,`Your PC’s agy and Muse helper move to the versions tested on the server (agy 1.4.7, Muse 1.4.13).`],fixed:[`Chats on a ChatGPT plan (Codex) no longer fail their About, titles and the summary of older messages with a 400 error.`,`Chats on Claude through Google, and chats on your own NVIDIA key, keep a summary of the messages that no longer fit the model’s window: their background calls now use a model the key can actually reach.`,`A chat on another of your PCs shows “PC linked · N folders” again after a restart, instead of asking you to link the same folders once more.`,`The agy note “still reports Individual quota reached…” is gone from the chat; the turn is still treated as the success it was.`,`The file explorer is back in VS Code, the chat font now also covers the message box, and a tool call at the edge of an older page of a remote chat keeps its name and input.`,`“Not delivered — the chat couldn’t start” now appears only when OonaCode itself could not start the turn, never for an error the model returned, so Send again cannot double a message.`]},{version:`0.3.270`,date:`2026-10-25`,added:[`One left panel: an icon strip on the far left switches between Sessions, Search and Files, and the file explorer now has the sidebar’s width and resize handle. Sessions and Files each have a filter box at the top.`,`Search has its own section with two scopes: Chats (every option the old search had) and Files & contents, which searches the open chat’s folder and shows the matching lines.`,`Settings → Theme → Fonts: choose the typeface and size for the chat and for the sidebar separately. Left alone, everything looks as before.`,`Hover a provider you use with your own key or subscription in the model picker to see its usage: quota bars with the time each resets.`,`On a Mac, updating now shows a window saying what is happening — it closes by itself when the new OonaCode opens, so you know whether to wait. Windows has had one since 0.3.92.`],fixed:[`Dark mode: Settings → Theme now has the Colour scheme switch (Light, Dark, System), and the colour editor opens on the colours you are actually looking at. Its old Light | Dark buttons only chose which colours to edit, so choosing Dark there seemed to do nothing. On System, the file editor also follows Windows’ dark setting now.`,`A chat on another of your PCs opens with its newest 500 messages and loads earlier ones as you scroll up, instead of pulling thousands at once over a slow link.`,`A message sent into a chat that then failed to start is marked “Not delivered — the chat couldn’t start”, with Send again. It used to look sent although the model never received it.`,`Subagents always run on the chat’s own model.`,`On a Mac, an update that could not close OonaCode used to report “done” and leave the old app in place — the terminal half updated and the app did not, sometimes for days. It now closes the app even when its window is frozen, and says plainly if it still could not, instead of claiming success.`,`After an update on a Mac, OonaCode opens again by itself. It used to reopen only if the update had closed it.`,`A browser the agent opened no longer leaves processes behind when it is closed or when OonaCode restarts. Helpers of a browser whose window was already gone could keep running for days — one of them found using most of a processor core — and they also stopped old browser versions from being cleaned up.`]},{version:`0.3.269`,date:`2026-10-25`,added:[],fixed:[`OonaCode can be quit again. Since 0.3.244, Quit (and ⌘Q on a Mac) did nothing at all unless a chat happened to be working: the question that warns about working chats answered itself when nothing was running, forgot it had answered, and asked again for ever — so the app stayed open and kept a processor core busy trying to close. If an app of yours has been sitting at high CPU, this was why.`]},{version:`0.3.268`,date:`2026-10-25`,added:[],fixed:[`Long chats no longer fail to start with “SessionStore.load() timed out after 60000ms”. Since 0.3.264 a chat’s start waited for the summary of its older messages, and the first one of a long chat could take longer than the engine allows; a chat now starts after at most 15 seconds, and the summary finishes in the background for the next start.`,`Stop now always stops a turn, even when the model is stuck retrying.`,`There is one Session info button on a wide window (on the right edge) instead of two.`]},{version:`0.3.267`,date:`2026-10-25`,added:[`Claude through Google now takes chats up to 500,000 tokens (it was 200,000), so a long chat on it keeps far more of its own history before anything is left out.`],fixed:[]},{version:`0.3.266`,date:`2026-10-25`,added:[],fixed:[`A chat’s “about” in Session info is now always written in English, whatever language the chat or its files are in — it used to follow pasted text, so an English chat could get a Persian about. The briefing and Listen still translate it into your language when you ask.`,`An about that ran over its length is now cut at the end of a whole sentence instead of in the middle of a thought, and the model is told to keep it short so the “where it stands now” part is not lost.`]},{version:`0.3.265`,date:`2026-10-25`,added:[],fixed:[`A model’s context limit now comes from the server instead of a copy kept in the app, so changing it in the admin reaches every PC. If a model ever refuses a chat as too long and names its limit, OonaCode remembers that limit and plans the next start by it, instead of hitting the same wall again.`]},{version:`0.3.264`,date:`2026-10-25`,added:[`A long chat keeps its older part in view. When a chat has grown past what the model can read, OonaCode gives the model as much of the recent conversation as fits and, in front of it, a short summary of the older part — what you asked for, what was decided and done, and what is left — instead of simply dropping it. The summary is written once, kept on this PC, and only extended as the chat grows; it appears in Usage as “Long-chat summaries”.`],fixed:[`A chat that was one very long piece of work followed by a short message no longer answers that it cannot see any earlier context: the model now gets the newest steps of that work under your original request.`,`The “invalid request” and “Autocompact is thrashing” errors that long runs of work could end in on models with a smaller window are gone: a chat is no longer handed to the model larger than the model accepts.`,`The note that earlier messages were left out now says when the cut fell inside your latest request, and when a summary was given in their place.`]},{version:`0.3.263`,date:`2026-10-25`,added:[`The right-hand side is now one dock: an icon strip on the edge, and Media and Session info stacked in it as sections. Each icon puts its section in or takes it out, both can be open at once, and a header folds its section to a line without losing what it had loaded.`,`The dock has one width and one drag handle for both sections, and it remembers which sections are in and which are folded.`],fixed:[]},{version:`0.3.262`,date:`2026-10-24`,added:[`xAI text-to-speech can now use a pronunciation map, so you can keep the written words while supplying IPA or a spoken replacement for names and multilingual dubbing.`],fixed:[`Voice and media requests recover onto another eligible operator key when one key reaches its limit, rather than failing the request immediately.`,`Google text-to-speech limits are now tracked per model, so a limit on one voice model does not make another available voice model unavailable.`,`OonaCode now presents the current versions of the Muse and Grok coding clients to their providers.`]},{version:`0.3.261`,date:`2026-10-24`,platforms:[`darwin`],added:[`“Bring this PC into the chat” remembers the folders you picked for that chat. Switching between two remote chats, reopening one, or reloading the window comes back linked to exactly those folders — you choose them once. Unlink still clears them for good.`,`A model change says what it came from: “Set model to X for this session only (previous model was Y)”, with the model you just picked in blue and the one it left in grey.`,`You can set a model typed by id on a chat that runs on another one of your PCs, instead of having to go to that PC to change it.`,`A file named in a chat opens in OonaCode, even when it is outside the chat folder. Text and code can be edited; a sound, picture or video plays as before.`,`An edited file no longer has a Save button. A changed tab shows *, Ctrl+S saves it, and Settings → General → Autosave files saves each change as you type.`,`Right-clicking a file the chat names offers “Copy relative path” and “Copy absolute path”.`,`A change to the model list or to settings now reaches this PC on its next check-in with the server, without restarting.`,`The chat’s browser no longer shows a “Restore pages?” bubble or brings back the tabs it had last time. OonaCode closes it on every exit, which used to look like a crash.`],fixed:[`One “Send now” for the whole queue: it sends every queued message at once and empties the list, instead of one button per message.`,`A message the agent had already read gets its receipt instead of staying pinned in the queue, where pressing Send now answered “The agent has already read that message”.`,`Stopping a reply, or pressing Send now while one is running, no longer shows an error. The chat says “User requested stop”.`,`Closing a file you have changed asks whether to save it, with Save, Don’t save and Cancel.`,`A file you edit keeps the line endings it had on disk when you save it, and a file the model writes while you have it open no longer replaces what you are typing in it.`,`After an admin changes a provider’s offered models, this PC’s list keeps every model’s prices and limits — no stale or emptied list in between.`,`A PC that checks in with the server on a slow schedule no longer reads as offline between check-ins; a change reaches it within a minute.`,`A Google Gemini chat no longer shows an error after a complete answer when the connection closes. The answer stays, and a real failure still shows as an error.`,`A folder you linked that may no longer be linked (a drive root, your home folder, a network share, OonaCode’s own data) is dropped when the link comes back, and never a folder you did not pick is added.`]},{version:`0.3.260`,date:`2026-10-24`,platforms:[`win32`],added:[`“Bring this PC into the chat” remembers the folders you picked for that chat. Switching between two remote chats, reopening one, or reloading the window comes back linked to exactly those folders — you choose them once. Unlink still clears them for good.`],fixed:[`One “Send now” for the whole queue on the phone too: it sends every queued message at once and empties the list, instead of one button per message.`,`A folder you linked that may no longer be linked (a drive root, your home folder, a network share, OonaCode’s own data) is dropped when the link comes back, and never a folder you did not pick is added.`]},{version:`0.3.260`,date:`2026-10-24`,platforms:[`linux`],added:[`“Bring this PC into the chat” remembers the folders you picked for that chat. Switching between two remote chats, reopening one, or reloading the window comes back linked to exactly those folders — you choose them once. Unlink still clears them for good.`,`This is Linux’s first update since 0.3.250, so it also brings everything in between: a model change says what it came from (“Set model to X for this session only (previous model was Y)”, the model you picked in blue and the one it left in grey); a model typed by id can be set on a chat that runs on another of your PCs; right-clicking a file the chat names offers “Copy relative path” and “Copy absolute path”; a file named in a chat opens in OonaCode even outside the chat folder and its text can be edited; an edited file is saved with Ctrl+S (and Settings → General → Autosave files saves as you type); the sticky notes button shows how many note tabs you have; and a Google Gemini chat in Build asks before running a command, like every other chat.`],fixed:[`One “Send now” for the whole queue on the phone too: it sends every queued message at once and empties the list, instead of one button per message.`,`A folder you linked that may no longer be linked (a drive root, your home folder, a network share, OonaCode’s own data) is dropped when the link comes back, and never a folder you did not pick is added.`,`Also from in between: stopping a reply, or pressing Send now while one is running, says “User requested stop” instead of an error; closing a file you have changed asks whether to save it; a file you edit keeps the line endings it had on disk and a file the model writes while you have it open no longer replaces what you are typing in it; after an admin changes a provider’s offered models, this PC’s list keeps every model’s prices and limits; a PC that checks in with the server on a slow schedule no longer reads as offline between check-ins; a Google Gemini chat no longer shows an error after a complete answer when the connection closes; and a message the agent had already read gets its receipt instead of staying pinned in the queue.`]},{version:`0.3.259`,date:`2026-10-24`,platforms:[`win32`],added:[`A model change says what it came from: “Set model to X for this session only (previous model was Y)”, with the model you just picked in blue and the one it left in grey.`,`You can set a model typed by id on a chat that runs on another one of your PCs, instead of having to go to that PC to change it.`],fixed:[`One “Send now” sends the whole queue at once and empties it, instead of one button per message.`,`A message the agent had already read gets its receipt instead of staying pinned in the queue, where pressing Send now answered “The agent has already read that message”.`]},{version:`0.3.258`,date:`2026-10-23`,platforms:[`win32`],added:[`Right-clicking a file the chat names offers “Copy relative path” and “Copy absolute path”.`],fixed:[`A file you edit keeps the line endings it had on disk when you save it, and a file the model writes while you have it open no longer replaces what you are typing in it.`,`A Google Gemini chat in Build asks before running a command again, and Allow runs that command.`,`After an admin changes a provider’s offered models, this PC’s list keeps every model’s prices and limits — no stale or emptied list in between.`,`A PC that checks in with the server on a slow schedule no longer reads as offline between check-ins; a change reaches it within a minute.`]},{version:`0.3.257`,date:`2026-10-23`,platforms:[`win32`],added:[],fixed:[`Stopping a reply, or pressing Send now while one is running, no longer shows an error. The chat says “User requested stop”.`,`Closing a file you have changed asks whether to save it, with Save, Don’t save and Cancel.`]},{version:`0.3.256`,date:`2026-10-22`,platforms:[`win32`],added:[`A change to the model list or to settings now reaches this PC on its next check-in with the server, without restarting.`],fixed:[]},{version:`0.3.255`,date:`2026-10-22`,platforms:[`win32`],added:[],fixed:[`A Google Gemini chat no longer shows an error after a complete answer when agy’s local connection closes. The answer stays, and a real failure still shows as an error.`]},{version:`0.3.254`,date:`2026-10-22`,platforms:[`win32`],added:[`A file named in a chat opens in OonaCode, even when it is outside the chat folder. Text and code can be edited; a sound, picture or video plays as before.`,`An edited file no longer has a Save button. A changed tab shows *, Ctrl+S saves it, and Settings → General → Autosave files saves each change as you type.`],fixed:[]},{version:`0.3.252`,date:`2026-10-21`,platforms:[`win32`,`darwin`],added:[`The sticky notes button shows how many note tabs you have, as a blue number.`],fixed:[]},{version:`0.3.251`,date:`2026-10-21`,platforms:[`win32`],added:[`A Google Gemini chat in Build now asks before running a command, using the same permission card as every other chat. Autonomous and auto-accept still run commands without asking.`],fixed:[]},{version:`0.3.250`,date:`2026-10-21`,added:[`The file list now has Show in Explorer, which opens the file or folder selected in your computer’s file manager, and Rename for both files and folders.`,`A text file opened from the file list can now be edited. Change it, then press Save or Ctrl+S. Pictures, videos, sounds and PDF files stay view-only.`],fixed:[]},{version:`0.3.249`,date:`2026-10-20`,added:[`When the model reads a picture, a video or a sound file, that step in the chat now opens by itself: you see the picture, or get a player for the video or sound, without clicking. Click the step to close it. Steps that read ordinary text files stay closed as before.`],fixed:[]},{version:`0.3.248`,date:`2026-10-20`,added:[],fixed:[`A chat on Google Gemini (through your Google plan) no longer ends a finished turn with an error. Google’s agy tool can keep repeating an old “quota reached” message at the end of a long chat even though your limit was fine and the answer arrived; OonaCode now shows the answer as done and adds a short note. A limit you really hit still shows as an error.`,`When you do reach your Google limit in a Gemini chat, OonaCode now shows Google’s own message, including when it resets, instead of a message about the OonaCode pool that did not apply to you.`]},{version:`0.3.247`,date:`2026-10-20`,added:[`On the Android app, a short tap on a message now opens a menu: Reply (quotes it above the box), Copy, Forward (opens it as a draft in another chat you pick), Share and Save text to… A long press still selects text.`,`On the Android app, a picture, video, sound or file that a reply names now opens from your PC: pictures show right in the chat, videos and sounds play in the chat, and other files open in the app you choose or are saved where you say. A file larger than 25 MB asks first.`,`This PC now hands those files to your phone over the same private link as your chats — only files that the chat itself named or that sit in its folder, one piece at a time.`],fixed:[]},{version:`0.3.246`,date:`2026-10-19`,added:[`Every chat can now make videos and spoken audio, not only pictures: ask for a short clip or a voice-over and the model makes it, saves it in the chat’s folder and plays it right in the chat. Video and Speech sit beside Images in the Tools menu, switched on by default.`,`In the Tools menu each of the three has a model choice for this chat (its default follows the model you are chatting with: a Grok chat uses Grok’s, an Alibaba chat Alibaba’s) and an “Ask me first” switch. With it on — the default for video — the model asks you for the length, resolution and shape and tells you the price in credits before anything is spent.`,`Pictures, videos and speech are paid with your OonaCode credits like any other message, whatever model or key the chat runs on, and the credits charged are shown in the answer.`,`On Apple Silicon Macs (M1 and later) Oonak Browser is now the native build: it quits with its last window, shows its own Dock icon and never asks for notification permission.`],fixed:[]},{version:`0.3.245`,date:`2026-10-19`,added:[`A picture, video or sound that a model reply named but that is not on your PC any more is now left out of the Media explorer, with a line under the list saying how many were left out and a Show button to see them.`,`A picture the model made now shows up in the chat as a small square beside its name — you no longer need the Media panel to notice it — and a click enlarges it.`,`A file the model names (a PDF, a Word or Excel document, a zip and so on) now shows its type’s icon in the chat and in the Media explorer; a file of any other type gets a plain file icon.`],fixed:[`The Media explorer no longer lists a website path such as /logo.svg or /favicon.png from a model reply as if it were a file on your PC, and a card that cannot be opened now shows the file name and date instead of only “Moved or deleted”.`]},{version:`0.3.244`,date:`2026-10-19`,added:[`When the agent enters plan mode (and when you approve its plan) the Build / Plan / Ask picker now follows it, so the picker always shows the mode the chat is really in.`],fixed:[`Four engine tools nobody uses here — ListAgents, EnterWorktree, ExitWorktree and ReportFindings — are switched off in every chat, which makes each request a little smaller.`]},{version:`0.3.243`,date:`2026-10-18`,added:[`OonaCode now asks before it quits or updates while any chat is still working — including chats whose tabs you closed — and names them, so nothing is interrupted by accident.`],fixed:[]},{version:`0.3.242`,date:`2026-10-18`,added:[`Every model can now take any attachment: a picture or PDF that the chosen model cannot read (Google’s agy, text-only Qwen or GLM models, and so on) is saved in the chat’s temporary folder and the model is given its file path instead of the message being refused.`,`The media panel can filter by All, Mine or Replies, so the pictures, videos, sounds and links that the model’s replies name are listed too, and every item has a right-click menu (View or Play, Show in chat, Show in folder, Copy path or link).`,`The “Media in this chat” and “Session info” panels can be resized by dragging their left edge; double-click the edge for the default width.`,`Web search is now in every chat, always: there is no Tools-menu switch for it any more, and chats that had it switched off search again.`],fixed:[]},{version:`0.3.241`,date:`2026-10-17`,added:[`Remote sessions in the sidebar now have a full right-click context menu and actions button (Pin to top, Move to Project, Project settings, Change folder, Details, Listen to this chat, Files, Rename, Fork and Delete) plus a details card on hover.`,`The Files explorer and file viewer now work for remote chats over the blind relay, so you can browse folders, view code, Markdown and images, copy paths and delete files on the remote PC.`,`Oonak Browser is now available for macOS chats as well as Windows and Linux.`],fixed:[`Newly created or renamed remote chats now appear immediately in the Remote section of the left sidebar, and the sidebar automatically recovers after a brief server or connection blip.`,`Opening a long remote chat with many screenshots no longer disconnects the relay for backpressure or stops loading recent messages.`]},{version:`0.3.240`,date:`2026-10-17`,added:[`Every Thought block now shows how long the model spent thinking (for example “Thought · 42 words · 12s”), both live and when a chat is reopened.`,`Remote chat tabs now show a badge naming the PC they run on, and you can rename a remote chat directly from its tab or from the Remote list in the sidebar.`,`Files attached from the Android app are uploaded into the chat’s folder on the PC that runs the chat.`],fixed:[`Subagent reports and continuation notes now fold into a single Engine note line instead of staying pinned at the bottom of the chat or replacing the pinned user question.`,`Local video and file paths in replies (including Windows paths with forward slashes, paths with spaces, and Markdown links) now reliably show their Play, View and Open in folder buttons.`,`Chats on a ChatGPT (Codex) subscription no longer fail when the model calls tools.`,`Google agy chats wait and retry automatically (5 s, 20 s, 1 min, 2 min) when Google answers with a temporary 503 Unavailable.`]},{version:`0.3.239`,date:`2026-10-16`,platforms:[`win32`],added:[`Media in every chat: the gallery button at the top right of a chat lists the photos, videos, audio, files and links you sent in it. Photos open in the viewer (← → step through them), videos and audio play in place, files open or show in their folder, and “Show in chat” jumps to the message.`],fixed:[`Google agy chats no longer flash a command window when they start. OonaCode now keeps agy up to date itself, quietly, while no agy chat is running.`,`An agy command that waits for someone to type (a password prompt, an ssh question) no longer holds the chat for hours: after 15 minutes with no output and no work, OonaCode ends that command, says so in the chat, and agy carries on.`,`The coding engine is updated (Claude Code 2.1.301): long answers are no longer cut off after three minutes of silence, a long chat no longer compacts again and again, and a tool no longer runs twice.`,`If the app’s window crashes (for example when the computer runs out of memory), it reloads by itself.`,`A chat on your own Meta Muse or ChatGPT plan that started on another provider no longer fails with “call_id must be at most 64 characters”.`,`Your other PCs keep one order in the Remote list instead of reshuffling.`,"`oona -p` with an OonaCode API key says what went wrong instead of asking you to sign in."]},{version:`0.3.239`,date:`2026-10-16`,platforms:[`darwin`],added:[`Media in every chat: the gallery button at the top right of a chat lists the photos, videos, audio, files and links you sent in it. Photos open in the viewer (← → step through them), videos and audio play in place, files open or show in their folder, and “Show in chat” jumps to the message.`],fixed:[`The coding engine is updated (Claude Code 2.1.301): long answers are no longer cut off after three minutes of silence, a long chat no longer compacts again and again, and a tool no longer runs twice.`,`If the app’s window crashes (for example when the computer runs out of memory), it reloads by itself.`,`A chat on your own Meta Muse or ChatGPT plan that started on another provider no longer fails with “call_id must be at most 64 characters”.`,`Your other PCs keep one order in the Remote list instead of reshuffling.`,`A download cut part-way during an update is resumed instead of starting over.`,"`oona -p` with an OonaCode API key says what went wrong instead of asking you to sign in."]},{version:`0.3.239`,date:`2026-10-16`,platforms:[`linux`],added:[`Media in every chat: the gallery button at the top right of a chat lists the photos, videos, audio, files and links you sent in it. Photos open in the viewer (← → step through them), videos and audio play in place, files open or show in their folder, and “Show in chat” jumps to the message.`],fixed:[`“Restart now” in Settings opens the app again instead of closing it for good.`,`The OonaCode service starts again after a quick reboot.`,`A power cut no longer empties the files that keep you signed in and unlocked.`,`A download cut part-way (weak Wi-Fi) during an install or update is resumed instead of giving up.`,`Notifications come from “OonaCode”.`,`The coding engine is updated (Claude Code 2.1.301): long answers are no longer cut off after three minutes of silence, a long chat no longer compacts again and again, and a tool no longer runs twice.`,`If the app’s window crashes (for example when the computer runs out of memory), it reloads by itself.`,`A chat on your own Meta Muse or ChatGPT plan that started on another provider no longer fails with “call_id must be at most 64 characters”.`,`Your other PCs keep one order in the Remote list instead of reshuffling.`,"`oona -p` with an OonaCode API key says what went wrong instead of asking you to sign in."]},{version:`0.3.238`,date:`2026-10-16`,added:[`Auto in the OonaCode pool: pick “Auto” and each new message runs on the pool model that suits it — how hard the task is, how big the chat is, whether a model already has the chat in its cache, speed and cost — at an effort it picks too. The model button shows which model Auto chose, like “Auto (Qwen3.8 Max)”. (It appears once OonaCode switches it on.)`,`Window control in the Tools menu: when you ask, the agent can list, hide, show, minimise, restore or focus the windows on your computer (Windows; apps on macOS; X11 and KDE on Linux).`,`The conversations popup in a chat shows when each conversation started and when it was last active.`],fixed:[`A Google agy chat that hits a temporary “service unavailable” from Google now waits a few seconds and carries on in the same conversation instead of ending the turn.`,`The agent keeps Oonak Browser’s window visible: no hidden or headless browser unless you ask for one.`]},{version:`0.3.237`,date:`2026-10-15`,platforms:[`win32`,`darwin`],added:[`When a long chat no longer fits the model, the chat shows one line saying how many earlier messages the request left out; click it for the explanation.`],fixed:[`The model picker no longer has an “All models” list, which showed the same model twice when a provider offers it both by key and by subscription. Pick a provider to see its models.`,`Google’s agy: Gemini 3.7 Flash, 3.6 Flash and 3.1 Pro are gone from the picker, because Google no longer offers them, and the picker shows only the models your own Google plan lists. A chat that was on one of them asks you to pick another model.`,`A picture or PDF attached to a chat on Google’s agy is refused with words that say agy takes text only on every one of its models, and that another provider’s model can read it.`,`A thought with no words in it (Meta Muse hides its thinking) no longer leaves an empty “Thought” card in the chat.`,`Conversations between chats read “idle” when nothing is going on.`]},{version:`0.3.237`,date:`2026-10-15`,platforms:[`linux`],added:[`The model picker is redone: your providers on the left, each with how many models it has, and the chosen provider’s models on the right, best first by independent intelligence rating. Each side has its own search. After you pick a model from another provider, its button says “next message” until your next message runs on it.`,`Every model shows its own effort levels, and the effort picker starts on the model’s default. A model with no effort levels shows no picker.`,`Meta Muse: Muse Spark 1.3 and 1.2, Wonder 1.0 and Wonder Full 1.0 — paste your Muse key in Connect or press “Sign in with Meta”.`,`ChatGPT plans: GPT-6.1 Sol, GPT-6 Sol, GPT-6 Astra and GPT-5.6 Sol when your plan lists them; chats keep their thinking across tool calls and use the effort you pick.`,`NVIDIA is back for your own NVIDIA key, with twelve hosted models that call tools. Your own SuperGrok subscription offers Grok 4.7 Fast.`,`Bring this PC into the chat: on a chat that runs on another PC, pick folders on this PC and what the chat may do there; it asks you before every change. And a Tools switch lets a chat list, read and message the chats on your other PCs.`,`Sticky notes beside the bug button, saved in your vault so they follow you to your other computers.`,`Suggest, beside Listen in every chat, proposes what to send next, and the project manager does it for several chats at once. Nothing is sent until you press Send.`,`Listen to this chat is a player with a seek bar, a speed you can change while it plays, and the spoken word highlighted.`,`A tab whose chat finished a turn you have not looked at yet wears a dot. A long chat folds old agents into one “N earlier agents” row, and every block shows its time.`,`When a long chat no longer fits the model, one line says how many earlier messages the request left out.`],fixed:[`A message sent while a chat is working, right after you picked another model, waits for the running turn and is answered by the model you picked.`,`A PC you sign in later appears in the left panel by itself.`,`A thought with no words in it no longer leaves an empty “Thought” card.`,`The Claude Code engine is updated to 2.1.296.`]},{version:`0.3.236`,date:`2026-10-14`,platforms:[`win32`,`darwin`],added:[`Every model now shows its own effort levels, and the effort picker starts on the model’s default — so you can see what level a chat really runs at. A model that has no effort levels no longer shows a picker at all.`,`A collapsed thought block now shows how the thought begins, like a command does: “Thought 42 words: First I read the file…”.`,`Meta Muse requests now match Meta’s own Muse CLI, so its thinking, tool calls, pictures and PDFs show up properly in the chat.`],fixed:[`Grok 4.5 no longer offers an “extra high” effort that xAI treats as high, and GPT-4.1 no longer shows an effort picker it cannot use.`]},{version:`0.3.235`,date:`2026-10-13`,platforms:[`win32`,`darwin`],added:[`Meta Muse: use Meta’s Muse Spark 1.3, Spark 1.2, Wonder 1.0 and Wonder Full 1.0 in your chats. Open Connect, pick Meta Muse, and either paste your Muse key or press “Sign in with Meta” — OonaCode downloads Meta’s Muse once (about 360 MB, after you agree), you confirm the code on Meta’s page, and the key is kept in your vault.`,`ChatGPT plans: GPT-6.1 Sol (500k context), GPT-6 Sol, GPT-6 Astra and GPT-5.6 Sol are available when your plan lists them, next to the models you already had.`,`Google’s agy: Gemini 4 Argon appears in the model picker when your Google plan includes it (Ultra), at Low, Medium and High.`],fixed:[]},{version:`0.3.234`,date:`2026-10-13`,platforms:[`win32`,`darwin`],added:[`Bring this PC into the chat: on a chat that runs on another PC, press the button in the chat’s toolbar, pick folders on this PC and tick Read, Create, Edit or Delete for each. The chat can then work with those files. It asks you before it creates, changes, moves or deletes anything, and the link ends when you close the tab. Both PCs need this version.`,`Chats on my other PCs: a new switch in the Tools menu lets a chat list your other PCs and their chats, read them, message them and start new chats there on the model you choose. You confirm every new chat.`,`The Tools menu now works on a chat that runs on another PC, so you can switch its tools from here.`],fixed:[`A PC you sign in after OonaCode has started now appears in the left panel by itself, without opening Settings → Devices first.`]},{version:`0.3.233`,date:`2026-10-12`,platforms:[`win32`,`darwin`],added:[`The model picker now tells you when a pick is not in use yet: after you pick a model from another provider, its button says “next message” and explains that the chat keeps running on its current model until your next message.`,`A long chat folds the agents that ran long ago into one “N earlier agents” row that says when they ran, instead of one card for each of them under your newest message.`],fixed:[`A message you send while a chat is working, right after you picked another model or provider, now waits for the running turn and is answered by the model you picked. It used to go to the model that was already running, so the chat kept answering as the old one while the picker showed the new one.`,`Every block in a chat now shows the time it happened — also the notes the app writes itself and the cards for earlier agents.`]},{version:`0.3.232`,date:`2026-10-12`,platforms:[`win32`],added:[`The model picker is redone: your providers on the left, each with how many models it has, and the chosen provider’s models on the right, best first by independent intelligence rating (unrated ones last). Each side has its own search, and the one over the providers finds a model across every provider, showing only the providers that carry it.`,`NVIDIA is back for your own NVIDIA key: twelve hosted models that call tools, among them Nemotron 3 Ultra and Super, Kimi K3, GLM-5.3, DeepSeek V4.1 Flash and Gemma 4.`],fixed:[`Models hosted as vendor/model (Kimi K3 on NVIDIA and the like) now show their intelligence rating.`]},{version:`0.3.232`,date:`2026-10-12`,platforms:[`darwin`],added:[`Sticky notes: the note button beside the bug button at the top opens your notes as tabs. Make as many as you like, name them with a double-click, and write — every change is saved by itself in your vault, so the notes follow you to your other computers. Text only.`,`Chats on your own ChatGPT plan keep their thinking across tool calls, use the effort level you pick (up to max where the model has it), and list the models your account really offers.`,`The model picker is redone: your providers on the left, each with how many models it has, and the chosen provider’s models on the right, best first by independent intelligence rating (unrated ones last). Each side has its own search, and the one over the providers finds a model across every provider, showing only the providers that carry it.`,`NVIDIA is back for your own NVIDIA key: twelve hosted models that call tools, among them Nemotron 3 Ultra and Super, Kimi K3, GLM-5.3, DeepSeek V4.1 Flash and Gemma 4.`],fixed:[`Suggest no longer starts reading the chat the moment you open it: pick how many hours to read, then press Suggest.`,`The Claude Code engine is updated to 2.1.296.`,`Models hosted as vendor/model (Kimi K3 on NVIDIA and the like) now show their intelligence rating.`]},{version:`0.3.231`,date:`2026-10-12`,platforms:[`android`],added:[`On the phone: any text in a chat can be selected and copied, and About became Session info.`],fixed:[]},{version:`0.3.230`,date:`2026-10-11`,platforms:[`win32`],added:[`Sticky notes: the note button beside the bug button at the top opens your notes as tabs. Make as many as you like, name them with a double-click, and write — every change is saved by itself in your vault, so the notes follow you to your other PCs. Text only.`,`Chats on your own ChatGPT plan keep their thinking across tool calls, use the effort level you pick (up to max where the model has it), and list the models your account really offers.`],fixed:[`Suggest no longer starts reading the chat the moment you open it: pick how many hours to read, then press Suggest.`,`A Gemini chat on your own Google plan no longer repeats, turn after turn, a command it refused earlier.`,`The Claude Code engine is updated to 2.1.296.`]},{version:`0.3.229`,date:`2026-10-11`,platforms:[`darwin`],added:[`Suggest, beside Listen in every chat: it reads the last few hours of the chat and suggests what to send it next. You edit it, put it in the message box or send it — nothing runs by itself.`,`The project manager, beside the "about" button over the chat list: tick chats, press Review, and each gets a suggestion you can edit and send with its own button.`,`A tab whose chat finished a turn you have not looked at yet wears a dot (red when the turn failed), and so does its row in the list.`,`Listen to this chat is a player: a seek bar, play and pause, ten seconds back and forward, the previous or next sentence, a speed you can change while it plays, the spoken word highlighted (click any word to play from it), and every summary listed newest first on top.`,`MCP servers: add them in Settings → MCP Servers from a directory of popular ones (PostgreSQL, Supabase, GitHub, Sentry, Slack, Notion, Linear and more) or your own, and switch each on or off per chat.`,`Connectors: Supabase, Railway and Vercel in the Tools menu — sign in once, switch one on in a chat, and the agent can look at your projects, databases, logs and deployments; read-only until you allow changes, and it asks before each one.`,`Pictures: ask any chat for an image and it makes one, saved in the chat’s folder and shown in the chat (a few credits each; Images in the Tools menu turns it off).`,`Web search for every model, from your Mac, with no key and no credits.`,`Claude Haiku 5.5 with a 1M-token window, and Grok 4.7 Fast on your own SuperGrok subscription.`,`Pasting a very long text, or a video, sound or large picture, saves it in the chat’s folder and attaches it as a file.`,`Hover a “Read …png” line in the chat and the picture shows at once.`],fixed:[`A compacted chat reopens with its whole history, not only what came after its last compaction.`,`Deleting a chat frees its OonaCode pool seat at once.`,`Large chats resume faster.`,`The chat summary (“About”) no longer fails on models that think at length.`,`A refusal by Gemini’s safety filter is retried once on another model, like the others.`,`Error notes in the chat read as plain sentences instead of codes or raw data.`,`The message navigator always shows at least four lines and no longer vanishes on the way to it.`]},{version:`0.3.228`,date:`2026-10-11`,platforms:[`win32`],added:[`Suggest, beside Listen in every chat: it reads the last few hours of the chat and suggests what to send it next. You edit it, put it in the message box or send it — nothing runs by itself.`,`The project manager, beside the "about" button over the chat list: tick chats, press Review, and each gets a suggestion you can edit and send with its own button.`,`A tab whose chat finished a turn you have not looked at yet wears a dot (red when the turn failed), and so does its row in the list.`],fixed:[]},{version:`0.3.227`,date:`2026-10-11`,platforms:[`win32`],added:[`Listen to this chat is a player: a seek bar, play and pause, ten seconds back and forward, the previous or next sentence, and a speed you can change while it plays.`,`The word being spoken is highlighted in the summary, and clicking any word plays from there.`,`Every summary the chat has is listed on top, newest first; pick one to hear it, with the languages it was already translated into.`],fixed:[]},{version:`0.3.226`,date:`2026-10-11`,platforms:[`win32`],added:[`Google Gemini (agy) chats show what agy looked at: a picture it viewed appears in the chat, and a sound or video it named plays inside the tool card.`,`Your own SuperGrok subscription offers Grok 4.7 Fast.`,`The Android app groups this PC’s chats by the project each one is filed under.`],fixed:[`Google Gemini (agy) tool steps read in words — View file, Run command, Edit — with their file or command, instead of raw arguments.`,`Your own SuperGrok sign-in presents the current Grok CLI (1.0.50), so xAI does not refuse it as outdated.`]},{version:`0.3.225`,date:`2026-10-10`,platforms:[`win32`,`linux`],added:[`Per-credential usage keys: operator credentials can now store their own console session keys (such as Xiaomi MiMo account credentials) directly in the Admin Panel to monitor individual token plan quotas and balances.`,`Google agy thinking blocks: local Google Antigravity (Gemini) sessions now extract and display model thinking blocks and rich tool arguments in chat from agy transcripts.`],fixed:[`Session info regeneration: fixed an issue where regenerating the session summary for Google Antigravity (Gemini) sessions would fail with a missing subscription token error.`,`Xiaomi MiMo cleanup: removed redundant and withdrawn mimo-v2.5 and mimo-v2.5-pro models from the registry and models catalog; replaced by mimo-v2.6-pro and mimo-v2.6-flash.`]},{version:`0.3.224`,date:`2026-10-09`,platforms:[`win32`,`linux`],added:[`Auto-save clipboard files and large pasted text: pasting text exceeding 10,000 characters or 300 lines automatically saves into your workspace .oonacode/tmp folder and attaches as a file without bloating the composer. Clipboard videos, audio, and large images are similarly saved and attached as local paths.`],fixed:[`Error display in chat: masked internal error codes, raw JSON, and provider balance exhaustion notices from the user chat bubble, displaying clean status indicators instead.`,`Google Antigravity pool plan access: included Gemini 3.8 Flash and 3.7 Flash across all active subscription plans (Standard, Pro, Team Standard, Team Premium, Free).`,`Session info panel: fixed an issue where switching between chats could leave stale child views mounted in the session info panel.`]},{version:`0.3.223`,date:`2026-10-09`,platforms:[`win32`,`linux`],added:[`MCP Servers settings & Antigravity catalog: configure stdio, sse, and http Model Context Protocol servers in File -> Settings -> MCP Servers. Choose from a rich directory of popular providers (PostgreSQL, Supabase, Redis, SQLite, MongoDB Atlas, GitHub, GitLab, Sentry, Cloudflare, Slack, Notion, Linear, PostHog, Brave Search) or add custom servers.`,`TopBar MCP badge: see your configured MCP servers count at a glance next to the Bug Report button, and click to open MCP settings directly.`,`Per-chat MCP server toggles: selectively enable or disable configured MCP servers per conversation in the composer toolbar to eliminate prompt token overhead.`],fixed:[]},{version:`0.3.222`,date:`2026-10-09`,platforms:[`win32`,`linux`],added:[],fixed:[`Chat summary "About": increased housekeeper output token headroom to prevent thinking and verbose models (e.g. Qwen, Gemini) from exceeding the token ceiling and failing with "Claude's response exceeded the 700 output token maximum".`]},{version:`0.3.221`,date:`2026-10-09`,platforms:[`win32`,`linux`],added:[`Web search for every model: all models can now search the web via keyless local DuckDuckGo search from your PC, with no extra credentials or credits needed.`,`Claude Haiku 5.5: available with 1M context, 128K output, and tiered pricing (replaces Haiku 4.5).`],fixed:[`Deleting a chat immediately frees its pool seat on the server, instead of keeping it held until the session cache window expires.`,`Session info panel headers: distinct icons for About (sparkle) and Scheduled tasks (bell) so sections no longer repeat the same info glyph.`,`Large sessions resume faster and safer with reverse-bounded transcript loading and auto-trimming to disk.`,`Gemini content safety filter blocks are now caught by safeguard fallback and retried on the fallback model.`]},{version:`0.3.220`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[],fixed:[`A chat on a Google Claude model no longer stops with “Autocompact is thrashing”. Its window was set to 100,000 tokens, so the chat compacted again right after every compaction and the engine gave up; it is now 200,000, and if the engine ever gives up this way the next message starts from a shorter history instead of repeating the same state.`]},{version:`0.3.219`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[`Pictures: ask any chat for an image — “generate a realistic tiger fighting a crocodile” — and it now makes one, with any model, the way Google’s Antigravity does. The picture is saved in the chat’s folder and shown right in the chat; click it for the full viewer. It costs a few OonaCode credits per picture, you can edit a picture file from the folder too, and it can be switched off in the Tools menu (Images).`,`The Google Claude models (typed by exact id in the model picker’s Custom model row) show their real 100,000-token window in the session panel, and the chat now compacts before the limit instead of being refused and re-sent.`],fixed:[`Google-hosted Claude and Gemini chats re-used almost none of Google’s prompt cache, so big chats ate the 5-hour window in minutes. They now reuse about 98 % of the prompt, which makes them far cheaper and faster.`,`The hidden /setcustommodel command and the admin custom-model tool are gone — the model picker’s Custom model row does the same job.`]},{version:`0.3.218`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[`Connectors: Supabase, Railway and Vercel in the Tools menu. Sign in once with the service’s own page, switch the connector on in a chat, and the agent can look at your projects, databases, logs and deployments. It is read-only until you turn on “Allow changes”, and then it asks you before every change; purchases, billing and secret or key readers are never offered. Each shows whether the service’s command-line tool is installed and can add the vendor’s own skills. In the terminal: oona connectors. Guide: /docs/connectors.`,`Hover a “Read …png” line in the chat and the picture shows at once; click the picture for the full viewer with zoom, like a picture you sent.`],fixed:[`A chat that was compacted no longer reopens showing only what came after its last compaction: the whole history is there again.`,`The message navigator always shows at least four lines, and its list no longer vanishes while the pointer crosses the gap to it.`]},{version:`0.3.217`,date:`2026-10-07`,platforms:[`darwin`],added:[`Pictures you attach open large: click one in the box or in a sent message for a viewer with zoom (buttons, wheel, drag, Fit and 100 %). Click a PDF or text file and it opens in its own program.`,`When a model refuses a message on safety grounds, OonaCode retries it once on another model and says so in the chat. Choose how in Settings → Safeguards: switch automatically, always switch to a model you pick, or never — with a fallback for each model. The same in the terminal: oona settings safeguard-fallback and --fallback-model. Works for Claude, Gemini and Google’s agy.`,`The terminal signs in two ways: your OonaCode account (through your browser) or an OonaCode API key. A fresh oona asks which; oona login --api-key-stdin stores a key for scripts, oona whoami says which one is in use, and oona logout removes it. The terminal manual is on the website: /docs/cli.`,`The conversations badge reads like the agents badge — “3 conversations · 1 active” — and the Conversations window lists every limit: messages, tokens, credits, depth, rates and the idle close.`,`A chat can start a new chat for you on another provider, model, effort or project — it asks you first, and a chat that was itself started by a chat cannot start more.`,`The message navigator’s list shows each message’s date and opens on your latest one; messages further back than 5,000 lines are greyed.`],fixed:[`A chat that was compacted no longer reopens showing only what came after its last compaction: the whole history is there again.`,`The message navigator always shows at least four lines, and its list no longer vanishes while the pointer crosses the gap to it. A click on it now takes you to older messages even while the chat is still replying (the page used to jump straight back).`,`oona: a wrong command or flag now exits with code 2, oona sessions list no longer breaks on multi-line titles, piping oona into head no longer prints an error, and the plain-prompt mode can send a message again.`,`One-shot terminal runs reuse the engine already on the Mac instead of downloading it every time, and a model you typed with /model that is not in the picker keeps its name after OonaCode restarts.`]},{version:`0.3.216`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[`The terminal signs in two ways: your OonaCode account (through your browser) or an OonaCode API key. A fresh oona asks which; oona login --api-key-stdin stores a key for scripts and servers, oona whoami says which one is in use, and oona logout removes it. The key is sealed by the host and never written to the terminal’s config.`,`The terminal manual is on the website: /docs/cli, written from commands run on Debian and Ubuntu servers.`],fixed:[`oona: a wrong command or flag now exits with code 2, oona sessions list no longer breaks on multi-line titles, piping oona into head no longer prints an error, and the plain-prompt mode can send a message again.`,`One-shot terminal runs reuse the engine already on the PC instead of downloading it every time.`,`A model you typed with /model that is not in the picker keeps its name after OonaCode restarts.`]},{version:`0.3.215`,date:`2026-10-07`,platforms:[`win32`,`linux`],added:[`Pictures you attach open large: click one in the box or in a sent message for a viewer with zoom (buttons, wheel, drag, Fit and 100 %). Click a PDF or text file and it opens in its own program.`,`When a model refuses a message on safety grounds, OonaCode retries it once on another model and says so in the chat. Choose how in Settings → Safeguards: switch automatically, always switch to a model you pick, or never — with a fallback for each model. The same in the terminal: oona settings safeguard-fallback and --fallback-model. Works for Claude, Gemini and Google’s agy.`,`The conversations badge reads like the agents badge — “3 conversations · 1 active” — and the Conversations window lists every limit: messages, tokens, credits, depth, rates and the idle close.`,`A chat can start a new chat for you on another provider, model, effort or project — it asks you first, and a chat that was itself started by a chat cannot start more.`,`The message navigator’s list shows each message’s date and opens on your latest one; messages further back than 5,000 lines are greyed.`],fixed:[`A click on the message navigator now takes you to older messages even while the chat is still replying (the page used to jump straight back).`,`The message navigator no longer touches the message times, and its lines are darker and longer.`]},{version:`0.3.214`,date:`2026-10-06`,platforms:[`darwin`],added:[`OonaCode runs natively on Apple Silicon Macs. The installer picks the Apple Silicon build by itself, and an Apple Silicon Mac that had the Intel one moves to it on its next install or update — the Intel build cannot run there on macOS 14 or older.`,`A message navigator on every chat: the small stack of lines at the middle-right of the chat is your own messages — rest on it, focus it or tap it and the list of everything you sent opens; click one and the chat scrolls straight to it.`],fixed:[`On an Apple Silicon Mac with macOS 14 or older, every chat crashed (“CPU lacks AVX support”) and Update did nothing. If yours did, run once in Terminal: curl -fsSL https://oonacode.oonak.ai/install.sh | bash`,`When an update cannot start, the app now says why and what to run instead of saying “Updating OonaCode…” while nothing happens.`,`File → Export chats… no longer freezes the window under a Save panel: the zip goes straight into Downloads and Finder shows it.`]},{version:`0.3.213`,date:`2026-10-06`,added:[`A message navigator on every chat: the small stack of lines at the middle-right of the chat is your own messages — rest on it, focus it or tap it and the list of everything you sent opens; click one and the chat scrolls straight to it. Escape closes the list.`],fixed:[],platforms:[`win32`,`linux`]},{version:`0.3.212`,date:`2026-10-06`,added:[`Headless one-shot runs without signing in: --api-key (or OONACODE_API_KEY) bills the run through the gateway on that OonaCode key — held in memory for the run only, never stored. For containers and CI.`],fixed:[`A keyed run no longer stops at the device-link screen, and no longer dies with "the OonaCode pool needs your OonaCode account": the key now also covers provider routing and the registry read on a machine that was never signed in.`],platforms:[`win32`,`linux`]},{version:`0.3.211`,date:`2026-10-06`,added:[`A message navigator on every chat: the small stack of lines at the middle-right of the chat is your own messages — rest on it and the list of everything you sent opens; click one and the chat scrolls straight to it.`,`One-shot runs without signing in: --api-key (or OONACODE_API_KEY) bills the run through the gateway on that OonaCode key — held in memory for the run only, never stored. For headless machines and containers.`],fixed:[],platforms:[`linux`]},{version:`0.3.210`,date:`2026-10-05`,added:[`Use a project folder opens on the folder the chat runs in — its project, or the workspace OonaCode made for it — instead of an empty box.`],fixed:[`Send now on one queued message no longer makes the other queued messages look sent: they stay under the chat, each with its own Send now, and get their tick when the agent reads them.`,`After you confirm the agent’s request to move a chat to another folder, the chat shows the new folder at once, not only after your next message.`]},{version:`0.3.209`,date:`2026-10-05`,platforms:[`win32`,`darwin`],added:[`Scheduled tasks say which model a run uses: always the chat’s model at the moment the task fires, named in the Scheduled tasks panel.`],fixed:[`A Google Gemini chat keeps Google’s agent running for half an hour between messages, so the next message after a pause no longer waits about four seconds for agy to start.`,`Commands run in a Google Gemini chat reach servers on your own PC (localhost) and plain http:// sites again.`]},{version:`0.3.209`,date:`2026-10-05`,platforms:[`linux`],added:[`Grok 4.7, xAI’s newest model, on the OonaCode pool and on your own SuperGrok subscription — and an effort picker for Grok 4.7, 4.6 and 4.5 (low, medium, high, extra high), sent the way xAI’s own Grok CLI sends it.`,`Every provider in the model picker shows its own logo — Google’s Gemini mark for Google, xAI’s for your SuperGrok, OpenAI’s for your ChatGPT plan, Z.ai’s for GLM — instead of two letters.`,`Scheduled tasks say which model a run uses: always the chat’s model at the moment the task fires, named in the Scheduled tasks panel.`],fixed:[`When a subscription behind the OonaCode pool refuses or fails a request, the same request is answered at once from the provider’s API key instead of showing you the error.`,`Grok on your own SuperGrok subscription and on the OonaCode pool works again: xAI started refusing the Grok CLI identity OonaCode presented as outdated.`,`When your own subscription’s sign-in stops working, the chat now says so and asks you to sign in again, instead of a confusing “own-subscription providers run directly to the provider” error.`,`A Google Gemini chat keeps Google’s agent running for half an hour between messages, so the next message after a pause no longer waits about four seconds for agy to start.`,`Commands run in a Google Gemini chat reach servers on your own PC (localhost) and plain http:// sites again.`]},{version:`0.3.208`,date:`2026-10-04`,platforms:[`win32`,`darwin`],added:[`Grok 4.7, xAI’s newest model, on the OonaCode pool and on your own SuperGrok subscription — and an effort picker for Grok 4.7, 4.6 and 4.5 (low, medium, high, extra high), sent the way xAI’s own Grok CLI sends it.`,`Every provider in the model picker shows its own logo — Google’s Gemini mark for Google, xAI’s for your SuperGrok, OpenAI’s for your ChatGPT plan, Z.ai’s for GLM — instead of two letters.`],fixed:[`When a subscription behind the OonaCode pool refuses or fails a request, the same request is answered at once from the provider’s API key instead of showing you the error.`,`Grok on your own SuperGrok subscription and on the OonaCode pool works again: xAI started refusing the Grok CLI identity OonaCode presented as outdated.`,`When your own subscription’s sign-in stops working, the chat now says so and asks you to sign in again, instead of a confusing “own-subscription providers run directly to the provider” error.`]},{version:`0.3.207`,date:`2026-10-04`,added:[`Every chat lists every provider you have connected and the OonaCode pool — Google Gemini too, whatever the chat ran on before. Switching keeps the conversation: a chat moving off Google continues with its whole history, and a chat moving onto Google gives Google’s agent the conversation so far, so it can carry on.`],fixed:[`Two messages sent a moment apart while a chat was starting no longer leave one of them stuck in the queued strip: the engine had read them together as one message, and OonaCode now recognises that.`]},{version:`0.3.206`,date:`2026-10-04`,platforms:[`win32`],added:[`Google Gemini installs Google’s agy by itself the first time you use it — open the provider in Settings → Providers, or send a message to a Google Gemini chat — instead of waiting for you to press Install.`],fixed:[`Deleting a chat now says what really happens: a chat is kept only on the PC it runs on, so deleting it there removes it everywhere.`,`oona doctor no longer tells you to change settings that OonaCode stopped reading.`]},{version:`0.3.206`,date:`2026-10-04`,platforms:[`linux`],added:[`Gemini on your own Google plan, through Google’s own agent. Open Settings → Providers → Google Gemini: OonaCode downloads Google’s agy for you and checks it. Then press Sign in with Google, sign in on Google’s own page and paste the one-time code back within the minute agy allows. OonaCode never sees your password. Every model your Google plan offers through agy is listed — Gemini 3.8, 3.7 and 3.6 Flash, Gemini 3.1 Pro, and Claude Opus 5.5, Claude Sonnet 5.5 and GPT-OSS 120B marked “via Google”. A Google Gemini chat runs Google’s agent as it is (Build or Autonomous mode, text only), and the chat’s info panel lists every request it made to Google.`,`Every provider in the model picker ends with a “Custom model…” row: type any model id and the chat runs it on that provider.`],fixed:[`The agents badge highlights what is happening now: “4 working” is blue and the total is grey.`,`Deleting a chat now says what really happens: a chat is kept only on the PC it runs on, so deleting it there removes it everywhere.`]},{version:`0.3.206`,date:`2026-10-04`,platforms:[`darwin`],added:[`Gemini on your own Google plan, through Google’s own agent. Open Settings → Providers → Google Gemini: OonaCode downloads Google’s agy for you and checks it. Then press Sign in with Google, sign in on Google’s own page and paste the one-time code back within the minute agy allows. OonaCode never sees your password. Every model your Google plan offers through agy is listed — Gemini 3.8, 3.7 and 3.6 Flash, Gemini 3.1 Pro, and Claude Opus 5.5, Claude Sonnet 5.5 and GPT-OSS 120B marked “via Google”. A Google Gemini chat runs Google’s agent as it is (Build or Autonomous mode, text only), and the chat’s info panel lists every request it made to Google.`,`Every provider in the model picker ends with a “Custom model…” row: type any model id and the chat runs it on that provider.`],fixed:[`The agents badge highlights what is happening now: “4 working” is blue and the total is grey.`,`The command line’s reinstall hint on a Mac is the one that works: curl -fsSL https://oonacode.oonak.ai/install.sh | bash.`]},{version:`0.3.205`,date:`2026-10-04`,platforms:[`win32`],added:[`Google Gemini now lists every model your Google plan offers through agy, not only Gemini: Claude Opus 5.5, Claude Sonnet 5.5 and GPT-OSS 120B (marked “via Google”) sit beside Gemini 3.8, 3.7 and 3.6 Flash and Gemini 3.1 Pro. They run on Google’s own agent with your Google plan, and have their own usage window.`],fixed:[]},{version:`0.3.204`,date:`2026-10-04`,platforms:[`win32`],added:[`Signing in to Google Gemini opens Google’s page for you and shows how many seconds are left: Google’s agy waits only one minute for the sign-in. Paste the code Google shows and it is sent at once.`],fixed:[`Signing in to Google Gemini finishes. The code you pasted never reached Google’s agy in the installed app (the window it types into dropped everything typed), so the sign-in waited out its minute and failed.`,`The Claude sign-in’s “paste the code” box, which used the same window, can type the code too.`]},{version:`0.3.203`,date:`2026-10-04`,platforms:[`win32`],added:[`Gemini on your own Google plan, through Google’s own agent. Open Settings → Providers → Google Gemini and press Install: OonaCode downloads Google’s agy for you and checks it. Then press Sign in with Google, sign in on Google’s own page and paste the one-time code back here. OonaCode never sees your password. A Google Gemini chat runs Google’s agent as it is (Build or Autonomous mode, text only, no pictures), and the chat’s info panel lists every request it made to Google.`,`Every provider in the model picker ends with a “Custom model…” row: type any model id and the chat runs it on that provider.`],fixed:[`The agents badge highlights what is happening now: “4 working” is blue and the total (“51 agents”) is grey, instead of the other way round.`]},{version:`0.3.202`,date:`2026-10-03`,platforms:[`darwin`],added:[`OonaCode runs on macOS 12 or newer: the agent, your chats, the background service and the desktop app, installed with the same one line as on Linux — curl -fsSL https://oonacode.oonak.ai/install.sh | bash. An Intel build; Apple Silicon Macs run it through Rosetta 2. Your sign-in key is kept in your login keychain.`,`Updating is the same line again, oona update in a terminal, or the update button in the app: it closes OonaCode, puts the new version in place and opens it again. The app is not signed by Apple yet, so it cannot be downloaded from a browser and does not update itself the way it does on Windows.`],fixed:[]},{version:`0.3.202`,date:`2026-10-03`,platforms:[`linux`],added:[],fixed:[`Your sign-in survives a restart on a PC that keeps OonaCode’s key in the login keyring (GNOME Keyring, KWallet): two of OonaCode’s keys shared one keyring entry and overwrote each other, and every start of the host wrote over the stored key — so after a restart you could find yourself signed out.`,`OonaCode never runs a Claude Code you installed yourself as its engine, even when it sits in the same folder as the Node.js that runs OonaCode (an nvm folder, for example).`,`oona update installs from the site your OonaCode was installed from, not always from oonacode.oonak.ai.`]},{version:`0.3.202`,date:`2026-10-03`,platforms:[`win32`],added:[],fixed:[`OonaCode never runs a Claude Code you installed yourself as its engine, even when it sits in the same folder as the Node.js that runs OonaCode.`]},{version:`0.3.201`,date:`2026-10-03`,added:[`The Tools menu lists only tools that work. Desktop control, Clipboard, Screen capture and Run as administrator were demos that never ran anything, and they are gone: the agent already reads and sets your clipboard, takes screenshots and asks Windows for administrator rights through its own commands.`],fixed:[`Oonak Browser keeps working when its window is behind other windows. A browser covered by the OonaCode window used to crawl, and some clicks and scrolls gave up after 30 seconds.`,`Oonak Browser no longer clicks a hidden copy of a link, or a link inside a closed menu, when a site has both a visible and a hidden one.`,`A message you send right after a reply failed no longer stays pinned above the box as “queued” once the agent has read it.`]},{version:`0.3.200`,date:`2026-10-03`,platforms:[`win32`],added:[`Everything OonaCode shows you is in credits, never in dollars: the model picker gives what an OonaCode pool model charges per 1M tokens in credits, and a chat’s spend, Usage, Conversations, Listen and the terminal all count credits. A chat on your own key or your own subscription says so instead of a price.`],fixed:[`Oonak Browser works on sites built from web components, Google’s own forms among them: it reads, finds, clicks and types inside them, where it used to answer “the page changed” or find nothing.`,`The model’s questions appear only in their own window: the chat no longer shows the question’s raw text while you answer, and afterwards keeps one line — “You answered 3 questions” — that opens to your answers.`]},{version:`0.3.200`,date:`2026-10-03`,platforms:[`linux`],added:[`Your chats now live only on the PC that runs them. Your phone, the website and your other PCs read a chat straight from its PC, through the same encrypted connection they use to continue it — OonaCode’s server no longer keeps any copy. While a PC is off or asleep its chats cannot be read from elsewhere; the window says so and they come back when it is online. Update OonaCode on each of your PCs: another device reads a PC’s chats only once that PC runs this version.`,`Everything OonaCode shows you is in credits, never in dollars: the model picker gives what an OonaCode pool model charges per 1M tokens in credits, and a chat’s spend, Usage, Conversations, Listen and the terminal all count credits. A chat on your own key or your own subscription says so instead of a price.`,`Listen has one button: Play. It writes a summary when the chat has none or has moved on, translates it once when you pick a new language, or just plays — saying only “Generating…” or “Translating…” while it works. A summary written in the last ten minutes is used for every language, so switching language never writes it again.`,`A morning briefing in View → What chats are about…: show the chats active in the last 24 hours, 3, 7, 10 or 30 days (or your own dates), tick the ones you want — or all — pick a language, a voice and a speed, and press Play. OonaCode reads each chat’s name and what it is about, one after another, with Next, Previous, Pause and Stop.`,`A chat can offer to move a task to a new chat. When a task deserves its own chat — a separate job, a chat that has grown long, work in another folder — the model proposes it with the first message written out; you can edit it, then Start new chat opens the new chat in a tab, sends the message and carries on there. Nothing starts without your yes.`,`Talk to other chats: a chat can now write to a chat whose switch is off. That chat’s switch stays off and it gets no new tools — it can only answer the chat that wrote to it. Finding a chat by name matches each word, in its name, project, folder and description, and spelling like “AI-control” or “aicontrol” no longer matters.`,`Oonak Browser acts like a person: every click, keystroke and scroll is a real input event, so sites that ignore scripted clicks now respond, and it works inside web components, Google’s own forms among them. Typing into a drop-down picks the option, and typing into an editor adds the text at its end.`,`Scheduled shows at a glance what will still run: paused tasks and one-time tasks that have already run are greyed out, with the day they will be removed — 10 days after their last change.`,`Settings → Developer → Allow debugging: opens a debugging port on this PC only, so a developer can look at and drive the app while fixing a problem with you. Off by default; while it is on, every window shows a red “Debugging on” badge.`],fixed:[`A chat keeps its Build / Plan / Ask first / Autonomous choice, and every device shows the same one. A chat set to “Ask first” now asks you before acting even when this PC answers prompts by itself.`,`A chat no longer ends up on a model nobody picked for it: a model the provider does not offer is refused instead of quietly switching the chat to the provider’s default, and Enter in the model picker no longer picks the row under the mouse pointer.`,`Chats talking to each other no longer ping-pong: a reply needs no answer, several messages from the same chat are read together in one turn, and a message card says “answer requested” until the answer has gone back, then “answered” with the time.`,`A tool you switch on while a chat is replying works for the message you send next, even mid-reply. After an update, a chat that had background tasks running shows one line saying how many stopped, instead of one card per task.`,`The model’s questions appear only in their own window: the chat no longer shows the question’s raw text while you answer, and afterwards keeps one line — “You answered 3 questions” — that opens to your answers.`,`A model your plan does not include now says “not in your plan”, instead of “Failed to authenticate … sign-in needed”.`,`A long message waiting in the queue no longer hides its “Send now” button: it is folded to a few lines, with Show all to read the rest.`,`The account window no longer stays on “offline · vault event stream responded 503” after a short server interruption.`]},{version:`0.3.199`,date:`2026-10-02`,platforms:[`win32`],added:[`Talk to other chats: a chat can now write to a chat whose switch is off. That chat’s switch stays off and it gets no new tools — it can only answer the chat that wrote to it. Finding a chat by name is smarter too: each word is matched, in its name, project, folder and description, and spelling like “AI-control” or “aicontrol” no longer matters.`,`Oonak Browser acts like a person: every click, keystroke and scroll is a real input event, so sites that ignore scripted clicks now respond. Typing into a drop-down picks the option, and typing into an editor adds the text at its end.`],fixed:[`A chat no longer ends up on a model nobody picked for it: a model the provider does not offer is refused instead of quietly switching the chat to the provider’s default, and Enter in the model picker no longer picks the row under the mouse pointer.`]},{version:`0.3.198`,date:`2026-10-01`,platforms:[`win32`],added:[`Listen has one button: Play. It writes a summary when the chat has none or has moved on, translates it once when you pick a new language, or just plays — saying only “Generating…” or “Translating…” while it works. A summary written in the last ten minutes is used for every language, so switching language never writes it again.`],fixed:[`A chat keeps its Build / Plan / Ask first / Autonomous choice, and every device shows the same one — the phone used to show “Ask first” for a Build chat. A chat set to “Ask first” now asks you before acting even when this PC answers prompts by itself.`,`Play in Listen is never greyed out for want of a voice: it gets the text ready and names the voice to install.`]},{version:`0.3.197`,date:`2026-10-01`,platforms:[`win32`],added:[`Oonak Browser, the browser your chats use, moves to version 151 by itself at its next use: a build with no Google services (no Safe Browsing warnings, push notifications or search suggestions). The download is checked against its fingerprint before anything is unpacked, and the old version is removed once no chat’s browser still runs from it.`],fixed:[`A model your plan does not include now says “not in your plan”, instead of “Failed to authenticate … sign-in needed”.`]},{version:`0.3.196`,date:`2026-10-01`,platforms:[`win32`],added:[`Your chats now live only on the PC that runs them. Your phone, the website and your other PCs read a chat straight from its PC, through the same encrypted connection they use to continue it — OonaCode’s server no longer keeps any copy. While a PC is off or asleep its chats cannot be read from elsewhere; the window says so and they come back when it is online. Update OonaCode on each of your PCs: another device reads a PC’s chats only once that PC runs this version.`],fixed:[`The account window no longer stays on “offline · vault event stream responded 503” after a short server interruption: the next sync that works clears it by itself.`]},{version:`0.3.195`,date:`2026-10-01`,platforms:[`win32`],added:[],fixed:[`Chats talking to each other no longer ping-pong. A message asks for an answer only when the chat really needs one; a reply needs no answer and is not answered with a new message; and several messages waiting from the same chat are read together in one turn. Fewer wake-ups, fewer tokens.`,`A message card says what is true: “answer requested” until the answer has gone back, then “answered” with the time — instead of an orange “reply expected” that never went away.`]},{version:`0.3.194`,date:`2026-10-01`,platforms:[`win32`],added:[`A chat can offer to move a task to a new chat. When a task deserves its own chat — a separate job, a chat that has grown long, work in another folder — the model proposes it with the first message written out; you can edit it, then Start new chat opens the new chat in a tab, sends the message and carries on there. Nothing starts without your yes.`,`Settings → Developer → Allow debugging: opens a debugging port on this PC only, so a developer can look at and drive the app while fixing a problem with you. Off by default; while it is on, every window shows a red “Debugging on” badge.`],fixed:[]},{version:`0.3.193`,date:`2026-10-01`,platforms:[`win32`],added:[],fixed:[`A tool you switch on while a chat is replying works for the message you send next, even mid-reply: that message now waits for the chat to restart with the new tool instead of reaching the model without it.`,`After an update, a chat that had background tasks running shows one line — “11 background tasks stopped — they were running when OonaCode restarted this chat” — instead of one card per task. Click it to see each one.`]},{version:`0.3.192`,date:`2026-09-30`,platforms:[`win32`],added:[`A morning briefing in View → What chats are about…: show the chats active in the last 24 hours, 3, 7, 10 or 30 days (or your own dates), tick the ones you want — or all — pick a language, a voice and a speed, and press Play. OonaCode reads each chat’s name and what it is about, one after another, with Next, Previous, Pause and Stop. Other languages are translated once and kept, so hearing the same briefing again costs nothing.`],fixed:[]},{version:`0.3.191`,date:`2026-09-30`,platforms:[`win32`],added:[`Scheduled shows at a glance what will still run: paused tasks and one-time tasks that have already run are greyed out, with the day they will be removed. They are deleted by themselves 10 days after their last change; resuming or editing a paused task gives it another 10 days.`],fixed:[]},{version:`0.3.190`,date:`2026-09-30`,platforms:[`win32`],added:[],fixed:[`A long message waiting in the queue no longer hides its “Send now” button: it is folded to a few lines, with Show all to read the rest.`]},{version:`0.3.189`,date:`2026-09-30`,platforms:[`linux`],added:[`Split views, like VS Code: drag a chat tab to the left, right, top or bottom of the chat area to open it beside the other one — a shaded area shows where it will land. Every chat on screen works on its own, with its own replies streaming and its own message box. Drag the divider to resize; Ctrl+\\ splits the current tab to the right, Ctrl+1, Ctrl+2… jump between views, and a tab’s menu has Split right, Split down and Move to other group.`,`Chats in windows of their own, like Chrome tabs: drag a tab out of the window, or choose “Move to new window” in its menu, and it opens in its own window; “Move to main window” brings it back. On Wayland desktops the new window opens at the usual place rather than under the pointer. Your split views and windows come back when you restart OonaCode.`,`Every language plays in Listen to a chat: each language picks the best voice on its own — OonaCode’s Armenian voices first, then your system’s voices, then eSpeak (install the espeak-ng package if your system has no voice for a language).`],fixed:[`Picking another language for a summary no longer needs a new summary: Play translates the one you have, keeps the translation, shows it and plays it.`,`“Summarise now” says “Up to date — nothing to summarise” while the chat has not changed, instead of seeming to do nothing.`]},{version:`0.3.188`,date:`2026-09-30`,platforms:[`win32`],added:[`Split views, like VS Code: drag a chat tab to the left, right, top or bottom of the chat area to open it beside the other one — a shaded area shows where it will land. Every chat on screen works on its own, with its own replies streaming and its own message box. Drag the divider to resize; Ctrl+\\ splits the current tab to the right, Ctrl+1, Ctrl+2… jump between views, and a tab’s menu has Split right, Split down and Move to other group.`,`Chats in windows of their own, like Chrome tabs: drag a tab out of the window, or choose “Move to new window” in its menu, and it opens in its own window. Drag it back onto the main window’s tabs, or choose “Move to main window”, to bring it back. Your split views and popped-out windows come back when you restart OonaCode.`],fixed:[]},{version:`0.3.187`,date:`2026-09-30`,platforms:[`win32`],added:[`Every language plays in Listen to a chat. Persian, Georgian, Ukrainian — and any language whose Windows voice is not installed — now speak with eSpeak, a free voice that comes with OonaCode (it sounds robotic, but it always works). Each language picks the best voice on its own: OonaCode’s Armenian voices first, then Windows’ own, then eSpeak.`],fixed:[`Picking another language for a summary no longer needs a new summary: Play translates the one you have, keeps the translation, shows it and plays it.`,`“Summarise now” says “Up to date — nothing to summarise” while the chat has not changed, instead of seeming to do nothing.`]},{version:`0.3.186`,date:`2026-09-30`,platforms:[`linux`],added:[`Listen to a chat: right-click a chat → Listen to this chat…, or the speaker button beside the chat’s title. The chat’s own model writes a short spoken summary — the goal, what was done, where it stands, what is left — and OonaCode reads it aloud on this PC, in the voice and at the speed you choose. Every summary is kept with its date, so you can play it again at any time; a new one is written only when the chat has moved on. Other languages are translated once and kept with the summary.`,`OonaCode brings two Armenian voices of its own, Astgh and Artsiv, and also speaks with your system’s voices through speech-dispatcher — install speech-dispatcher and espeak-ng for Persian, Russian and every other language; the Listen window names the packages for your distribution.`,`Listen to a chat from your phone: the OonaCode app’s 🔊 Listen reaches this PC’s summaries and plays them with the phone’s own voices. It needs this update on the PC and the next OonaCode app on the phone.`,`See where your credits go: Account → Usage. Pick the last 24 hours, 7, 30 or 90 days or your own dates, by hour or by day, for the coding agent or your API keys apart. A chart shows the credits over time by model or by what they were for, and the lists below give every model with its tokens and price, and every use — chat turns, a chat’s “about”, images, speech and the rest.`,`The chat list is laid out like the Claude desktop app: New, Projects, Scheduled, then your pinned chats and projects, then Today and Older. The old grouping by project is one click away — the small icon beside “Today”.`,`Projects opens a page of project cards — each with its goal, its chats and when it was last used — with search, sort and New project. Click a card to see that project’s chats, instructions and settings, and to start a new chat in it.`,`Scheduled shows every scheduled task from every chat on this PC in one place, with its next run, its chat, and pause, resume and delete. Pin any chat or project to the top of the list from its menu.`,`Claude Sonnet 5.5 is in the model picker — on the OonaCode pool and on your own Claude subscription — with a 1M-token context. It costs the same as Sonnet 5 per token and usually needs fewer tokens for the same work.`,`Type / at the start of a message to see the chat’s commands and skills, with what each does, in two titled sections. Type to narrow the list, then Enter or Tab. They work with every model, not only Claude.`,`Each chat has a Skills list beside Tools. Every skill starts off, so the model sees none of them and they cost nothing; switch one on to let the model use it by itself in that chat. Typing /name still runs any skill for one turn.`,`Your own skills: Settings → Skills lists the skills OonaCode gives every chat, and “Import from Claude Code…” copies the ones you choose from your Claude Code install — it only reads it, never changes it.`,`In the terminal app (oona), a command the chat’s engine knows — /context, /compact or a skill — now runs instead of answering “unknown command”.`,`Search in the Import window: find a chat by its name, its first or last message or its folder, or pick “Whole conversations” to search inside the chats themselves.`],fixed:[`Import chats shows every chat on this PC, grouped by the app it came from, with nothing folded away. Each row says whether it is new, already imported, moved on since, or deleted by you in OonaCode. Nothing is ticked when you open it yourself: search for a chat and tick it, or tick a whole group at once.`,`The message box fits a narrow chat: its buttons and pickers move onto a second line and the box grows to hold them — Stop and Queue no longer slip outside it.`,`Claude’s thoughts show their words again. Every “Thought” from Claude Opus, Sonnet and Fable came back empty — Anthropic leaves the text out unless it is asked for a summary, and now OonaCode asks. Only new replies change.`,`A chat’s “about” no longer starts in the middle of a sentence when the model wrote a long answer.`,`Commands that only duplicated OonaCode’s own controls or showed misleading numbers are gone from the / menu — /model, /usage, /autocompact, /output-style, /mcp, /list-agents and /reload-skills. Typed, they say why.`,`Skills you import or remove in Settings → Skills reach your chats by themselves, at each chat’s next message.`,`Claude Sonnet 5 is retired: a chat that was on it moves to Sonnet 5.5 at its next message.`,`The engine’s built-in keyboard-shortcuts helper is turned off: it would have edited your own Claude Code settings.`,`Typing /model in a chat updates the chat’s model and the model picker again, and command output such as /context reads the same while it arrives and after you reopen the chat.`,`A chat row’s ⋯ button shows only when you point at the row.`]},{version:`0.3.185`,date:`2026-09-30`,platforms:[`win32`],added:[`Listen to a chat from your phone: the OonaCode app’s 🔊 Listen reaches this PC’s summaries and plays them with the phone’s own voices. It needs this update on the PC and the next OonaCode app on the phone.`],fixed:[`Listening with a Windows voice no longer stops after the first sentence when the voice fails to say it has finished.`]},{version:`0.3.184`,date:`2026-09-30`,platforms:[`win32`],added:[`Listen to a chat: right-click a chat → Listen to this chat…, or the speaker button beside the chat’s title. The chat’s own model writes a short spoken summary — the goal, what was done, where it stands, what is left — and OonaCode reads it aloud on this PC, in the voice and at the speed you choose. Every summary is kept with its date, so you can play it again at any time; a new one is written only when the chat has moved on. Other languages are translated once and kept with the summary.`],fixed:[`A chat’s “about” no longer starts in the middle of a sentence when the model wrote a long answer.`]},{version:`0.3.183`,date:`2026-09-30`,platforms:[`win32`],added:[`See where your credits go: Account → Usage. Pick the last 24 hours, 7, 30 or 90 days or your own dates, by hour or by day, for the coding agent or your API keys apart. A chart shows the credits over time by model or by what they were for, and the lists below give every model with its tokens and price, and every use — chat turns, a chat’s “about”, images, speech and the rest.`],fixed:[]},{version:`0.3.182`,date:`2026-09-30`,platforms:[`win32`],added:[],fixed:[`Import chats shows every chat on this PC, grouped by the app it came from — Claude Code, the Claude app, Qwen Code, Cursor — with nothing folded away. Each row says whether it is new, already imported, moved on since, or deleted by you in OonaCode. Nothing is ticked when you open it yourself: search for a chat and tick it, or tick a whole group at once. The Import button says how many chats it will bring over.`]},{version:`0.3.181`,date:`2026-09-30`,platforms:[`win32`],added:[],fixed:[`The message box fits a narrow chat. In a small window, or with the side panels open, its buttons and pickers move onto a second line and the box grows to hold them — Stop and Queue no longer slip outside it, and the model and effort pickers keep their words readable.`]},{version:`0.3.180`,date:`2026-09-30`,platforms:[`win32`],added:[],fixed:[`Claude’s thoughts show their words again. Every “Thought” from Claude Opus, Sonnet and Fable came back empty — Anthropic leaves the text out unless it is asked for a summary, and now OonaCode asks. Other models were never affected. Only new replies change; older thoughts stay empty.`]},{version:`0.3.179`,date:`2026-09-29`,platforms:[`win32`],added:[],fixed:[`The / menu is easier to read: skills and commands in two titled sections, each with one short line — the full description shows when you point at it.`,`Commands that only duplicated OonaCode’s own controls or showed misleading numbers are gone from the / menu — /model (use the model picker), /usage (the engine’s own estimate, not your credits), /autocompact, /output-style, /mcp, /list-agents and /reload-skills. Typed, they say why.`,`Skills you import or remove in Settings → Skills reach your chats by themselves, at each chat’s next message.`]},{version:`0.3.178`,date:`2026-09-29`,platforms:[`win32`],added:[`The chat list is laid out like the Claude desktop app: New, Projects, Scheduled, then your pinned chats and projects, then Today and Older. The old grouping by project is one click away — the small icon beside “Today”.`,`Projects opens a page of project cards — each with its goal, its chats and when it was last used — with search, sort and New project. Click a card to see that project’s chats, instructions and settings, and to start a new chat in it.`,`Scheduled shows every scheduled task from every chat on this PC in one place, with its next run, its chat, and pause, resume and delete. A dot on it tells you when something is due soon.`,`Pin any chat or project to the top of the list from its menu.`],fixed:[`A chat row’s ⋯ button shows only when you point at the row.`]},{version:`0.3.177`,date:`2026-09-29`,platforms:[`win32`],added:[`Claude Sonnet 5.5 is in the model picker — on the OonaCode pool and on your own Claude subscription — with a 1M-token context. It costs the same as Sonnet 5 per token and usually needs fewer tokens for the same work.`],fixed:[`Claude Sonnet 5 is retired: a chat that was on it moves to Sonnet 5.5 at its next message, and the picker shows Sonnet 5.5.`]},{version:`0.3.176`,date:`2026-09-29`,platforms:[`win32`],added:[`Each chat has a Skills list beside Tools. Every skill starts off, so the model sees none of them and they cost nothing — about 1,400 tokens on every message until now. Switch one on to let the model use it by itself in that chat; the list shows what each one costs per message while on.`,`Typing /name still runs any skill for one turn, whether its switch is on or off.`],fixed:[`The engine’s built-in keyboard-shortcuts helper is turned off: it would have edited your own Claude Code settings.`]},{version:`0.3.175`,date:`2026-09-29`,platforms:[`win32`],added:[`Type / at the start of a message to see the chat’s commands and skills — the Claude Code engine’s own (/compact, /context, /review, /security-review, /init and more) and the skills in your project’s .claude folder — with what each does. Type to narrow the list, then Enter or Tab. They work with every model, not only Claude.`,`Your own skills: Settings → Skills lists the skills OonaCode gives every chat, and “Import from Claude Code…” copies the ones you choose from your Claude Code install — it only reads it, never changes it.`,`In the terminal app (oona), a command the chat’s engine knows — /context, /compact or a skill — now runs instead of answering “unknown command”.`],fixed:[`Typing /model in a chat updates the chat’s model and the model picker again.`,`Command output such as /context reads the same while it arrives and after you reopen the chat.`]},{version:`0.3.174`,date:`2026-09-28`,platforms:[`win32`],added:[`Search in the Import window. Type to find a chat by its name, its first or last message, or its folder — chats folded away as already imported or deleted here show up too when they match. Or open the search options and pick “Whole conversations” to search inside the chats themselves, with a few lines of each match under the chat. It only reads Claude Code, Cursor and the Claude app’s files, never changes them.`],fixed:[`Chats Claude Code switched to another model are answered by that model for real: OonaCode’s pool now serves the model the engine falls back to, and never answers a Claude request with another company’s model.`]},{version:`0.3.173`,date:`2026-09-28`,platforms:[`linux`],added:[`Every chat now has an “about”: a short note, written in the background by a cheap helper model of the chat’s own provider, saying what the chat works on. Your other chats read it — with each chat’s folder and when it was last active — when they look for the right chat to ask. See it, edit it or press Regenerate in the session info panel.`,`View → What chats are about… (and a sidebar button) lists every chat’s about and what writing them cost, with a switch to turn it off and “Generate for all chats now”. The switch and its numbers are also in Settings → This PC.`,`Your phone can now do from anywhere what this PC’s window does: switch each tool on or off per chat, see and control the conversations between your chats, read, edit and regenerate each chat’s “about”, and manage scheduled tasks. It needs this update on the PC and the next OonaCode app on the phone.`,`A chat can switch its own workspace. When the work belongs in another folder — a project you name that lives elsewhere, or a new project folder — the model proposes the switch and you answer Switch or Not now. It always asks you, even with “accept automatically” on, and the chat moves when its current step ends, with the conversation kept.`,`Right-click a chat tab → Delete (in red, under “Close all tabs”) deletes that chat after asking, just like Delete in the sidebar.`,`When Anthropic’s safeguards flag a chat and Claude Code moves it to another model for the rest of the run, the model box says so in red — for example “Opus 4.8 (safeguard)” — and the chat shows a notice at the switch. Picking a model takes the chat back to it at the next message.`],fixed:[`Typing in the message box while a chat is replying is no longer interrupted. With “accept automatically” on, an approval card flashed for an instant on some tool calls and took the cursor away from the box.`,`A permission card that appears while you are typing no longer takes the keyboard, so your next Space or Enter can never press Allow by accident.`,`“Send now” stays disabled and says “Sending now…” until the agent has taken the message — it can take a few seconds while the agent stops its current step, and a second press can no longer send it twice.`,`A message sent from your phone is confirmed by this PC, and the same message is never run twice when the phone sends it again after a lost connection.`,`File and folder names in a reply get their ▶, Open and Show in folder buttons only when they really exist on this PC. A bare file name is also looked for in the folder the reply named just before it.`,`A chat can no longer be moved into your home folder or the root folder through a link. Where /home is itself a link (Fedora Silverblue, Bazzite and similar systems), the home folder passed as an ordinary folder, and the chat would have loaded your own Claude Code settings as its project.`,`Signing in to your own Claude subscription inside the app works on Ubuntu 24.04, Debian, Linux Mint, Pop!_OS and Zorin OS again. There, a part of OonaCode built for newer systems did not load, and the sign-in fell back to a command you had to paste.`,"On Ubuntu, Linux Mint, Pop!_OS, Zorin OS and similar systems, `oona` now works in every new terminal right after you install or update. The installer used to leave it off your PATH until you logged out and back in; now it adds it for new terminals itself, and `oona uninstall` takes that line out again.",`Every way of uninstalling — “oona uninstall”, or the install command with --uninstall — now takes this PC off your account: keep your chats and they stay readable on your other devices; delete them and their copies go too. It never touches your Claude Code or the Claude app, and “oona uninstall” no longer gives up when the background service is stopped.`,`The installer now says at once when a system cannot run OonaCode — one older than Ubuntu 22.04, Debian 12 or RHEL 9, or one built on musl such as Alpine — instead of installing a copy that could not start. The .deb and .rpm tell apt and dnf the same.`]},{version:`0.3.172`,date:`2026-09-28`,platforms:[`win32`],added:[`When Anthropic’s safeguards flag a chat and Claude Code moves it to another model for the rest of the run, the model box says so in red — for example “Opus 4.8 (safeguard)” — and the chat shows a notice at the switch. Picking a model takes the chat back to it at the next message.`],fixed:[`Uninstalling from Settings → Apps now also takes this PC off your account, exactly like “oona uninstall”: keep your chats and they stay readable on your other devices; delete them and their copies go too.`,`“oona uninstall” no longer gives up when the background service is stopped.`,`The “Updating OonaCode…” window shows again on the newest Windows 11 versions (24H2 and later).`]},{version:`0.3.171`,date:`2026-09-28`,platforms:[`win32`],added:[`Oonak Browser now picks its own control port from a range no developer tool uses by default, so it can no longer take a port that Shopify CLI or a dev server wants. If a program needs a particular port kept free, or you want the browser on a specific one, just ask the chat.`],fixed:[`File and folder names in a reply get their ▶, Open and Show in folder buttons only when they really exist on this PC. A bare file name is also looked for in the folder the reply named just before it.`,`Uninstalling OonaCode from Settings → Apps now removes all of it — the app, the command line and its background service — and asks whether to keep your chats. Installing again afterwards no longer says it is already installed. Your Claude Code and Claude app are never touched.`,`“oona uninstall” works again on Windows 11.`,`A chat “about” you wrote yourself no longer shows “stale”.`]},{version:`0.3.170`,date:`2026-09-28`,platforms:[`win32`],added:[`Your phone can now do from anywhere what this PC’s window does: switch each tool on or off per chat, see and control the conversations between your chats, read, edit and regenerate each chat’s “about”, and manage scheduled tasks. It needs this update on the PC and the next OonaCode app on the phone.`],fixed:[`“Send now” stays disabled and says “Sending now…” until the agent has taken the message — it can take a few seconds while the agent stops its current step, and a second press can no longer send it twice.`,`A message sent from your phone is confirmed by this PC, and the same message is never run twice when the phone sends it again after a lost connection.`]},{version:`0.3.169`,date:`2026-09-28`,platforms:[`win32`],added:[`Every chat now has an “about”: a short note, written in the background by a cheap helper model of the chat’s own provider, saying what the chat works on. Your other chats read it — with each chat’s folder and when it was last active — when they look for the right chat to ask. See it, edit it or press Regenerate in the session info panel.`,`View → What chats are about… (and a sidebar button) lists every chat’s about and what writing them cost, with a switch to turn it off and “Generate for all chats now”. The switch and its numbers are also in Settings → This PC.`],fixed:[`A chat can no longer be moved into your user folder or a drive root through a link or junction that points there — its project settings would have been your own Claude Code settings.`]},{version:`0.3.167`,date:`2026-09-27`,platforms:[`win32`],added:[`A chat can switch its own workspace. When the work belongs in another folder — a project you name that lives elsewhere, or a new project folder — the model proposes the switch and you answer Switch or Not now. It always asks you, even with “accept automatically” on, and the chat moves when its current step ends, with the conversation kept.`],fixed:[]},{version:`0.3.166`,date:`2026-09-27`,platforms:[`win32`],added:[],fixed:[`Typing in the message box while a chat is replying is no longer interrupted. With “accept automatically” on, an approval card flashed for an instant on some tool calls and took the cursor away from the box.`,`A permission card that appears while you are typing no longer takes the keyboard, so your next Space or Enter can never press Allow by accident.`]},{version:`0.3.165`,date:`2026-09-27`,platforms:[`win32`],added:[`Right-click a chat tab → Delete (in red, under “Close all tabs”) deletes that chat after asking, just like Delete in the sidebar.`,`Chats now use Oonak Browser, in a window you can see, for everything that needs a web browser — not Chrome, Edge or a hidden script browser — unless you name another browser. It runs without a window (headless) only when you ask for that.`],fixed:[`After an update, the background service comes back by itself. An update could leave it unable to restart, and the app then showed “OonaCode could not start its host service” even though it went on to open normally.`]},{version:`0.3.164`,date:`2026-09-27`,platforms:[`win32`],added:[`Send now: a message you typed while the agent works has a Send now button while it waits. It stops what the agent is doing right now and sends your message immediately — the step that is running is cut. On the desktop and the phone.`,`Conversations → Map: see at a glance which chats are talking to each other. Each conversation is a hub with a line to each of its chats; working chats pulse; click a hub for its history or a chat to open it.`],fixed:[`A restart no longer signs this PC out when OonaCode’s stored key cannot be opened for a moment. OonaCode used to replace the key and lose your sign-in; it now keeps the key and signs you back in by itself as soon as it opens.`]},{version:`0.3.163`,date:`2026-09-27`,platforms:[`linux`],added:[`Send now: a message you typed while the agent works has a Send now button while it waits. It stops what the agent is doing right now and sends your message immediately — the step that is running is cut. On the desktop and the phone.`,`Conversations → Map: see at a glance which chats are talking to each other. Each conversation is a hub with a line to each of its chats; working chats pulse; click a hub for its history or a chat to open it.`],fixed:[`A restart no longer signs this PC out when its security chip is slow to open OonaCode’s stored key. After a system update and reboot, the chip on some machines refuses for a while; OonaCode used to replace the key and lose your sign-in. It now keeps the key and signs you back in by itself as soon as the chip opens it.`]},{version:`0.3.162`,date:`2026-09-27`,added:[],fixed:[`A chat switched to another model knows which model it is. After a switch from Claude to DeepSeek, the model used to keep saying it was Claude — the chat history and Claude Code’s own prompt told it so.`,`Oonak Browser is offered only where it can run. An older OonaCode no longer lists a browser tool it cannot use, so the model does not spend tokens working around it — update to get the browser.`]},{version:`0.3.161`,date:`2026-09-27`,added:[`Settings → This PC → “Replace pictures older than N days”: screenshots and pasted pictures in your chat history are replaced by a short note once they are older than a year (you choose the number, or 0 to keep them). The words of every chat stay; the database stops growing with pictures. It runs by itself.`],fixed:[`The model, Build/Plan/Ask and effort pickers under the message box now look like the dropdowns they are.`,`Switches that are off are easy to see in dark mode.`,`Error messages show what went wrong in words, without raw tags or a provider’s JSON.`,`The ✕ that removes an attachment or a reply is round.`,`Pressing Stop, or an update cutting a turn, no longer files an automatic bug report.`]},{version:`0.3.160`,date:`2026-09-27`,added:[`On Windows, the agent can use a real browser. Ask it to open a site, read a page, click, fill in a form or take a screenshot, and it does it in Oonak Browser, in a window you can see. The first time, OonaCode asks once to install the browser (about 210 MB); after that it opens straight away.`,`Each chat has its own browser profile, so a site you sign in to stays signed in for that chat. Switch the browser off for a chat in its Tools menu.`],fixed:[]},{version:`0.3.159`,date:`2026-09-27`,added:[],fixed:[`A chat reopened after an update no longer says “turn complete” the instant you send a message and then answer anyway. The engine’s own note about work that stopped during the update used to be taken for the end of your turn, with the whole earlier conversation’s tokens on the line.`,`A background task that stopped because OonaCode restarted now says so in plain words, instead of “Orphaned by a previous Claude Code process exit”.`]},{version:`0.3.158`,date:`2026-09-27`,added:[`Every thought in a chat shows how many words it has, so you can tell at a glance whether there is anything to read.`],fixed:[`A thought with nothing in it — some models return only a signature for their thinking — now says “Thought · empty” and no longer opens onto a blank box.`,`A command the agent was allowed to run no longer leaves an “Allowed Bash (automatically)” line under its own card: the card already shows the command and its result. Refusals are still shown.`]},{version:`0.3.157`,date:`2026-09-27`,added:[`On Linux, OonaCode has its own signed apt and dnf repositories. Install the app with apt (Debian, Ubuntu, Mint) or dnf (Fedora, RHEL, Rocky, Alma) — the commands are on the download page — and your package manager keeps it up to date with the rest of the system.`,`Every Linux release is signed with the OonaCode release key, and the one-line installer checks that signature before it installs anything.`],fixed:[`On Linux, the menu bar is drawn in the window in the app’s own colours, and it switches between light and dark with the app instead of keeping the desktop’s theme until a restart.`,`Upgrading the .rpm no longer removes the oonacode command, and removing it no longer leaves empty folders behind.`]},{version:`0.3.156`,date:`2026-09-27`,added:[`Chats can talk to each other. Turn on “Talk to other chats” in a chat’s Tools menu, and its agent can find your other chats that have it on, read them, and ask them for help — one chat or a whole group. A chat that is closed wakes up to answer; a busy one answers when it finishes. The reply comes back to the chat that asked.`,`The Conversations window (in the sidebar) shows every conversation between your chats: who said what to whom, what each answer cost, and buttons to pause, resume, close or stop them all. Each conversation has a budget — 20 messages and 1,000,000 new tokens by default — and pauses itself when it is used up, so chats can never talk forever.`,`Hover over any tool in a chat’s Tools menu to read what it does, how it works, what it costs and how to turn it off.`],fixed:[`A chat woken in the background — by a scheduled task or another chat — shows as working in the sidebar even when it is not open in a tab.`,`A scheduled task no longer slips into a chat at the same moment you send it a message; yours always goes first.`,`A message sent from the terminal no longer waits forever when a chat’s history cannot be resumed and the restart fails. It now says why.`,`Notes OonaCode writes into a chat — a model change, a conversation paused — are still there when you reopen it.`,`When every Claude seat in the OonaCode pool is taken, a new chat now says the model is busy and to try again in a few minutes or pick another model, instead of “Something went wrong on our side”.`,`On Linux, the app tells you it is updating while it swaps itself, so there is no need to start it again.`,`On Linux, removing the .deb or .rpm leaves nothing running and nothing failing at the next login, and the one-line installer checks for free disk space before it changes anything.`]},{version:`0.3.155`,date:`2026-09-27`,added:[`OonaCode runs on Linux. One command installs the command line, the background service and the desktop app: curl -fsSL https://oonacode.oonak.ai/install.sh | bash. The AppImage, .deb and .rpm are on the download page too.`,`On Linux the app lives in the system tray as it does on Windows, follows your desktop’s light or dark theme, and gets its own entry in the applications menu.`,`Uninstalling on Linux removes the desktop app along with the rest, and asks whether to keep your chats for a future install.`],fixed:[`A window no longer stays on “Unauthorized” after the background service restarts with a new key. It reconnects by itself.`]},{version:`0.3.154`,date:`2026-09-26`,added:[],fixed:[`A chat waiting on a long job no longer loses its watcher. OonaCode used to close a chat’s engine ten minutes after the model last spoke, which stopped any Monitor or background command it had left running. The engine now stays up while such work runs, up to 12 hours.`,`A chat moved into a project, or whose project you edit, now follows the project’s instructions from its next message. It used to keep the ones it started with.`]},{version:`0.3.153`,date:`2026-09-25`,added:[],fixed:[`A very long chat no longer answers “Prompt is too long” after OonaCode restarts or updates. The engine was judging the chat’s size by a figure left over from before the restart, and now gets an accurate one.`,`If a message is ever refused as too long before the model has started on it, OonaCode sends it again by itself with a shorter history. You see your message once and then the answer, not an error.`]},{version:`0.3.152`,date:`2026-09-25`,added:[],fixed:[`Uninstalling the app from Windows’ Apps list no longer stops the command-line OonaCode on the same PC from starting after a restart.`]},{version:`0.3.151`,date:`2026-09-25`,added:[`Files the agent names in a chat are clickable. Audio and video play right in the chat with a small player, pictures open as a preview, and in the app every file can be opened in its own program or shown in its folder.`,`Uninstalling the app asks whether to keep your chats on this PC. Keeping them means a new install signs in and continues every chat.`],fixed:[`Installing and updating no longer fail with “The operation has timed out” on PCs whose network drops the newer internet addresses, nor while our server restarts for an update.`]},{version:`0.3.150`,date:`2026-09-25`,added:[],fixed:[`The fix in 0.3.149 for long, sleeping turns now really reaches the agent: the Monitor tool and the block on long waits are on for every chat.`,`A chat compacted after a long pause no longer pays to cache a conversation it is about to replace, and the agent keeps each tool call in its history exactly as it wrote it — both as Claude Code does.`]},{version:`0.3.149`,date:`2026-09-25`,added:[`The agent can watch a long job with the Monitor tool, as Claude Code does, and is woken the moment the job finishes.`],fixed:[`Long chats no longer spend their time asleep. With no way to watch a background job, the agent had been polling it with waits of four to eight minutes. One chat spent more than three and a half hours of a day sleeping, and turns ran for hours while the model worked for a fraction of that. The agent now gets the same working rules as Claude Code, and long waits are blocked.`]},{version:`0.3.148`,date:`2026-09-25`,added:[],fixed:[`A scheduled task that could not be sent — the PC had just restarted, the vault was still locked, the server was not reachable yet — waits and tries again instead of switching itself off. Pausing, editing or deleting a task while its prompt is being sent is no longer undone, and a scheduled prompt no longer lands in a chat whose engine is still starting.`,`A chat on your own DeepSeek key, or one switched with a typed “/model opus”, is no longer shown as withdrawn and locked. “/model fable” picks Claude Fable instead of the default model.`,`Moving a chat to another model no longer lowers its saved effort level to what the old model offered, and a one-off “oona --effort” is no longer saved as the chat’s level.`,`After you pick another model for a locked chat and send, the chat no longer flashes the lock again while the engine starts; if the start fails, your pick is kept.`,`Coming back from a file tab no longer jumps the chat to an old reply or reopens the search bar.`,`The hidden sidebar slides away again when the pointer leaves the window past its edge, and the keyboard no longer tabs through it while it is hidden. Clicking ⓘ in Settings opens its note instead of closing it.`,`Subagents write their prompt cache for five minutes, as Claude Code does for its subscribers; the chat itself keeps the hour. Their cache writes cost less.`]},{version:`0.3.147`,date:`2026-09-25`,added:[`A chat’s scheduled tasks sit beside its subagents: a clock badge says how many are live and when the next one runs, and opens the list — each task’s schedule, its next and last run, Pause and Delete. The tasks run on this PC.`],fixed:[`A prompt the scheduler sends into a chat reads as a “Scheduled task” line, not as your own message waiting in the queue.`,`A chat whose model is no longer offered shows that model in red and waits for you to pick another; its history stays, and the old model is not in the list any more.`,`The effort list follows the server within minutes, without restarting the app. A chat set to a level that has been switched off moves to the nearest one — ultracode becomes xhigh. Chats on your own Claude subscription have an effort picker again.`]},{version:`0.3.146`,date:`2026-09-25`,added:[`A Tools menu beside the model picker: switch OonaCode’s own tools on or off for each chat — browser, desktop and window control, clipboard, screen capture, Office documents and run-as-administrator. Each tool costs the model only a short line until it is used, and the menu shows how much. The first tools are marked Demo while they are tested with every model: a demo tool answers what it would have done, and does nothing on your PC yet.`],fixed:[]},{version:`0.3.145`,date:`2026-09-25`,added:[],fixed:[`Every request of every chat, on every model, is about 3,200 tokens smaller: the engine’s own “auto memory” instructions are gone. OonaCode starts each engine in a fresh private folder and deletes it afterwards, so the notes the model was told to keep there were thrown away when the chat went idle — the model spent tool calls writing memories it would never read. A project’s memory is OonaCode’s own and stays.`,`The engine’s claude.ai Artifact tools are switched off everywhere OonaCode runs it — the app, the terminal, VS Code, the phone, Telegram and the agent API.`]},{version:`0.3.144`,date:`2026-09-25`,added:[],fixed:[`Long chats on Claude models in the OonaCode pool keep their cache for an hour, as Claude Code does for its subscribers. A pause of more than five minutes no longer re-sends the whole conversation at the full cache-write price, which in a large chat was the most expensive part of coming back to it.`,`The session panel’s Context shows how big the conversation is now, not the total of every request the chat ever made — a long chat read “10.7M / 1.0M tokens”.`,`The message box keeps the cursor after you send, so you can go straight on typing the next message.`,`A paid chat’s background work (titles, reading web pages) no longer goes to a free model of the same vendor.`]},{version:`0.3.143`,date:`2026-09-24`,added:[`Search inside your chats: open the search in the chat list, press the sliders button and choose Whole chats. It looks through every message of every chat on this PC, and you choose whose words — yours, the model’s, or both — plus, if you like, the tools’ commands and output and the subagents’ conversations. Results show each message with the words lit; a click opens the chat with its search on them.`,`More search options, for both kinds of search: one project only, a time window (today, 7 or 30 days), match case and whole words.`],fixed:[`While you search the chat list, projects with no matching chat are hidden too.`]},{version:`0.3.142`,date:`2026-09-24`,added:[],fixed:[`A reply you sent shows as the same small chip it had in the message box — “Reply to” and the first few words — instead of the whole quoted text; the full quote appears when you rest the pointer on it, and a click jumps to the message it answers.`,`The model now knows a reply points back into the conversation: it is told the quoted lines are from the chat history, not new input, and whose words they were — its own earlier reply, your earlier message, a file, or a tool’s output.`,`When the chat list is narrow, its buttons wrap onto a second line instead of spilling out of it.`]},{version:`0.3.141`,date:`2026-09-24`,added:[`The chat list on the left can be made wider or narrower: drag its right edge (double-click it for the usual width).`,`The chat list can hide: press the pin in its header, the button at the top left, or View → Sidebar (Ctrl+B). While hidden it slides in when the pointer reaches the left edge of the window, and slides away when you leave it.`,`Search in the chat list is a single magnifier now; click it and the search box opens across the top. Escape or × clears it.`],fixed:[`Opening OonaCode right after a restart no longer leaves the OonaCode pool models out of the model list: if they cannot be read yet, OonaCode asks again by itself a few seconds later and the list fills in.`,`The Artificial Analysis scores (intelligence, coding, speed and benchmarks) show on every model in the model list again — including the models of your own Claude and SuperGrok subscriptions, which never had them.`,`A chat’s details card no longer appears on top of its right-click menu.`]},{version:`0.3.140`,date:`2026-09-24`,added:[`Reply is tidier: the message you reply to shows as a small chip above the message box with its first few words, instead of filling the box. Click the chip — or the quote in a sent reply — to jump to that message; the × removes it.`,`Right-click a project in the sidebar for its settings: Project settings… opens Projects with that project already selected. The gear beside a project’s “+” does the same, and a chat filed in a project offers it in its own menu too.`,`Link GitHub. Under a project’s Repositories (and in Settings → Providers), link your GitHub account once: the agent’s git and gh then clone, pull and push your private repositories on every PC of yours. You type a short code on github.com; the token stays in your encrypted vault and never reaches the OonaCode server. Public repositories need nothing.`],fixed:[]},{version:`0.3.139`,date:`2026-09-24`,added:[`Every setting now says what it does, and resting the pointer on the ⓘ beside it tells you where in OonaCode it applies and what it does not do.`,`Export chats… is in the File menu (and on the sidebar in a browser window) instead of in Settings.`,`With Remote access turned off on a PC, your phone, Telegram, the website and your other PCs still show it — online or not — marked “remote access off”, and opening it tells you to turn Remote access back on in OonaCode on that PC.`],fixed:[`Turning Remote access off now tells your other devices at once. Before, the PC was already unreachable from them, but they could not say why.`,`The settings of This PC save the moment you change them — nothing is lost by closing the dialog.`,`Settings that did nothing, or repeated another one, are gone: the default permission mode (each chat’s Build / Plan / Ask first picker decides), the agent-picker switch, the Git Bash path, the engine path and the extra allowed origins. The server address is shown, not edited — signing in sets it.`]},{version:`0.3.138`,date:`2026-09-24`,added:[`Projects have settings now, like the Claude app’s: a goal, the repositories the project works on, what a new chat in it starts on (model, effort and folder), a project memory the agent keeps up to date, and whether its chats may schedule work — and how often at most. All of it is in Projects, and a Claude app project you import brings its own.`,`OonaCode has a scheduler. Ask the agent to do something later or on a repeat — “check the build every morning at nine” — and it schedules it on this PC; when it is due, the prompt arrives in the chat, even if the chat had gone quiet. The Projects dialog and the chat’s info panel list what is scheduled, where you can pause, resume or delete it.`],fixed:[`Saving a project’s instructions now reaches its chats at their next message, instead of waiting until the chat happened to restart.`]},{version:`0.3.137`,date:`2026-09-24`,added:[],fixed:[`After a PC restart the app could ask for a "host token" and sign you out: two copies of the OonaCode background service started at once and fought over your session. Only one ever runs now, and the app never shows the token page — if its service is replaced it reconnects by itself.`,`The unlock screen stays put until you unlock, and says what went wrong in place — a wrong password, or a connection it is re-establishing — instead of jumping to another page.`,`A message with a picture sent while the agent was working stayed “queued”, and removing it said it was already sent. It now shows as read the moment the agent takes it, and a reopened chat shows it with its picture.`,`In the model’s questions, typing your own answer now clears the options you had picked, and picking an option clears what you typed — the answer sent is exactly the one you chose. The same on the phone, in the terminal and in Telegram.`]},{version:`0.3.136`,date:`2026-09-24`,added:[`Every model now has its own housekeeper — the small, fast model of the same maker that writes a chat’s titles and reads the web pages it fetches. On the OonaCode pool a MiMo v2.6 Pro chat uses MiMo v2.6 Flash, a Qwen chat Qwen3.8 Flash, a GLM chat GLM-5.3 Flash and a GPT-5 chat GPT-5 mini, instead of doing that work on the big model itself. A free model keeps its own, so it stays free.`],fixed:[]},{version:`0.3.135`,date:`2026-09-24`,added:[],fixed:[`Claude models on the OonaCode pool — Opus 5.5, Opus 5, Sonnet 5 and Fable 5.1 — now use their whole 1M context. A long chat no longer stops to summarise itself every ~170k tokens, and its subagents get the same window.`,`Reading a web page is quick again in a Claude chat: pages are read by Claude Haiku, as in Claude Code, instead of a helper that took about a minute a page.`,`Changing a chat’s model now moves its subagents and background helpers to the new model too; before, they stayed on the old one until the app restarted.`,`MiMo v2.5 and v2.5 Pro chats now use their full 1M context too.`]},{version:`0.3.134`,date:`2026-09-23`,added:[],fixed:[`On the Android app, the model’s questions can be answered again. They come one at a time — “Question 2 of 3” — with Back, Next and Skip, and Answer sends them to your PC. The card used to show only the first question, hide the rest below it and wait for all of them, so it could not be sent.`]},{version:`0.3.133`,date:`2026-09-23`,added:[`Bring your Claude desktop app projects across: File → Import chats from other coding agents now lists every project the Claude app has opened on this PC. Each one arrives as an OonaCode project of the same name — its goal, instructions and what Claude noted about it become the project’s instructions — with its project chat and one chat per thread filed under it, ready to carry on.`,`A Claude Code chat you moved into a Claude app project is filed under that project here too.`,`A thread you never opened in the Claude app still comes across, with its task and every reply the project chat saw; open it once in the Claude app and import again for its whole conversation.`],fixed:[`Cursor chats appear in the import list again — they had been left out since September 10.`]},{version:`0.3.132`,date:`2026-09-23`,added:[`Reply to any part of a chat: select some text (or just right-click a block), choose Reply, and it is quoted in your message box — type your answer under it. A quote from a file the agent read names the file.`,`Right-click in a chat: copy what you selected, copy a whole reply or tool output, copy a code block or a link, find the selected words in the chat, or select a block.`,`Search in a chat opens the block its match is in — a folded tool card, a thought, a finished agent’s work — and scrolls to the words themselves.`,`Search matches are now bright orange, the current one strongest, so they stand out on code too.`,`The file viewer shows pictures (PNG, JPEG, GIF, WebP, SVG and more), plays audio and video, and shows Markdown formatted, with a switch to the source.`,`Right-click a file or folder in the explorer to copy its path or delete it.`],fixed:[`Moving a chat to another folder or project while it was working could delete the folder it was working in, start two agents at once, or send your next message to the old folder.`,`The working line no longer says a chat may be stuck while it waits for your approval or answer, or right after you send a message, and it counts time correctly (no more "4m 60s").`,`A date line no longer says "Today" for yesterday’s messages when the app stays open past midnight.`,"Installing with npm (`npm i -g oonacode`) installs this version again; earlier npm releases carried an old program.",`The What’s new window could open again on the next start, showing the same update a second time.`,`An older OonaCode window or VS Code extension no longer resets settings it does not know about, such as your theme colours or which project groups you folded.`,`A new install no longer opens with a list of changes; this window now appears only after an update.`,`The notification switch for permissions now says it also covers the agent’s questions.`]},{version:`0.3.131`,date:`2026-09-23`,added:[`Claude Opus 5.5 is here — the newest Opus, and cheaper to run than Opus 5. Choose it in the model picker, from the OonaCode pool or on your own Claude subscription. It runs on the newer Claude Code engine (2.1.280) that this update brings.`,`Every block in a chat shows its time at the bottom right, in your local time — hover it for the full date — and a date line marks where each day starts.`,`A running chat tells you how long the agent has been quiet, and after five minutes that it may be stuck and what to do.`,`After every update, OonaCode now opens this window to show you what changed.`],fixed:[`A reply that streamed in live had no time on it until the chat was opened again.`,`Chats open in tabs could fail to come back after a restart if a setting changed while they were being restored.`]}];function nu(e,t){let n=e=>{let[t,...n]=e.trim().replace(/^v/,``).split(`-`);return{nums:(t??``).split(`.`).map(e=>Number.parseInt(e,10)||0),pre:n.length>0?n.join(`-`):null}},r=n(e),i=n(t);for(let e=0;e<Math.max(r.nums.length,i.nums.length);e++){let t=(r.nums[e]??0)-(i.nums[e]??0);if(t!==0)return t}return r.pre===i.pre?0:r.pre===null?1:i.pre===null?-1:ru(r.pre,i.pre)}function ru(e,t){let n=e.split(`.`),r=t.split(`.`);for(let e=0;e<Math.max(n.length,r.length);e++){let t=n[e],i=r[e];if(t===i)continue;if(t===void 0)return-1;if(i===void 0)return 1;let a=/^\d+$/.test(t),o=/^\d+$/.test(i);if(a&&o){let e=Number(t)-Number(i);if(e!==0)return e;continue}return a===o?t<i?-1:1:a?-1:1}return 0}function iu(e,t,n=tu,r=null){if(!e||e===`0.0.0`)return[];let i=n.filter(t=>nu(t.version,e)<=0&&(!r||!t.platforms||t.platforms.includes(r)));return[...t===null?i.filter(t=>nu(t.version,e)===0):i.filter(e=>nu(e.version,t)>0)].sort((e,t)=>nu(t.version,e.version))}function au(e,t,n,r=tu,i=null){if(!e||e===`0.0.0`)return{record:null,show:[]};let a=null;for(let e of r)(a===null||nu(e.version,a)>0)&&(a=e.version);let o=a!==null&&nu(e,a)>0?a:e;return{record:t===null||nu(o,t)>0?o:null,show:t===null&&!n?[]:iu(e,t,r,i)}}function ou(e,t){if(t==null)return[...e];if(t.length===0)return[];let n=new Set(t),r=e.filter(e=>n.has(e.id));return r.length>0?r:[...e]}var su=`the user skipped the question`,cu=`(the user skipped this question)`;function lu(e){let t=e?.questions;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e;if(typeof t.question!=`string`)continue;let r=Array.isArray(t.options)?t.options.map(e=>e&&typeof e==`object`?e:null).filter(e=>e!==null&&typeof e.label==`string`).map(e=>({label:e.label,...typeof e.description==`string`?{description:e.description}:{}})):[];n.push({question:t.question,header:typeof t.header==`string`?t.header:``,options:r,multiSelect:t.multiSelect===!0})}return n}function uu(e,t,n={},r=new Set){let i={};return e.forEach((e,a)=>{if(r.has(a)){i[e.question]=cu;return}let o=(n[a]??``).trim();i[e.question]=o||(t[a]??[]).join(`, `)}),i}function du(e){let t=e.questions,n=t===1?`question`:`questions`,r=t===1?`the model’s question`:`the model’s questions`,i=t===1?`The model’s question was`:`The model’s questions were`;switch(e.outcome){case`answered`:{let r=e.answers?Object.values(e.answers):null,i=r?r.filter(e=>typeof e==`string`&&e!==``&&e!==`(the user skipped this question)`).length:t;return t>0&&i<t?`You answered ${i} of ${t} ${n}`:t===0?`You answered the model’s questions`:t===1?`You answered the model’s question`:`You answered ${t} ${n}`}case`skipped`:return`You skipped ${r}`;case`dismissed`:return`${i} dismissed`;case`unanswered`:return`${i} not answered — the turn ended`}}function fu(e){if(!e||typeof e!=`object`)return null;let t=e.answers;return t&&typeof t==`object`&&!Array.isArray(t)?t:null}var pu=[`oauth`,`token`];function mu(e){switch(e){case`signed-out`:return`Not signed in`;case`connecting`:return`Waiting for your sign-in…`;case`connected`:return`Connected`;case`expired`:return`Sign-in expired`;case`error`:return`Cannot reach the service`}}var hu=V().refine(e=>/^https:\/\/[^\s]+$/i.test(e),`must be an https address`),gu=Qo({vendor:V().min(1).max(60),mcpUrl:hu,readOnlyQuery:os(V(),V()).nullable(),auth:Qo({methods:Xo(cs(pu)).min(1),scopes:Xo(V()),offlineAccess:Wo(),token:Qo({label:V(),createUrl:hu,note:V().nullable()}).nullable()}),tools:Qo({deny:Xo(V()),allowWrites:Xo(V()),featured:Xo(V()),maxResultChars:Bo().int().min(1e3).max(2e5)}),cli:Qo({command:V().regex(/^[A-Za-z0-9._-]{1,40}$/),versionArg:V().regex(/^--?[A-Za-z0-9-]{1,20}$/),install:os(V(),V()),login:Qo({command:V(),tokenEnv:V().nullable()}),purpose:V()}).nullable(),skills:Xo(Qo({name:V().regex(/^[a-z0-9][a-z0-9_-]{0,47}$/),source:Qo({repo:V().regex(/^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/),ref:V().regex(/^[0-9a-f]{40}$/,`pin a full commit, never a branch`),path:V().refine(e=>!/(^|[\\/])\.\.([\\/]|$)|^[\\/]/.test(e),`relative path`)}),license:V(),exclude:Xo(V())})),docsUrl:hu}).loose();function _u(e){if(e.toolName!==`ConnectorChange`)return null;let t=e.input;if(!t||typeof t!=`object`||typeof t.connector!=`string`||typeof t.vendor!=`string`||typeof t.tool!=`string`)return null;let n=t.arguments!==null&&typeof t.arguments==`object`&&!Array.isArray(t.arguments)?t.arguments:{};return{connector:t.connector,vendor:t.vendor,tool:t.tool,description:typeof t.description==`string`?t.description:``,arguments:n}}function vu(e){let t=Object.keys(e.arguments).slice(0,8);return`${e.vendor}: ${e.tool}${t.length>0?` (${t.join(`, `)})`:``}`}var yu=[`win32`,`linux`,`darwin`],bu=[`demo`,`live`],xu=[`allow`,`ask`],Su=[`string`,`number`,`integer`,`boolean`,`array`,`object`];function Cu(e){let t=e/1048576;return t>=100?`${Math.round(t)} MB`:t>=1?`${t.toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function wu(e){if(e.toolName!==`InstallToolPack`)return null;let t=e.input;return!t||typeof t!=`object`||typeof t.pack!=`string`||typeof t.name!=`string`||typeof t.version!=`string`||typeof t.sizeBytes!=`number`||typeof t.path!=`string`?null:{pack:t.pack,name:t.name,version:t.version,sizeBytes:t.sizeBytes,path:t.path}}function Tu(e,t){let n=t?.[e.slug];return typeof n==`boolean`?n:e.defaultOn}function Eu(e,t){return e.filter(e=>Tu(e,t))}var Du={slug:48,name:80,entryTool:40,description:2e3,promptLine:1e3,details:8e3,actionDescription:1e3,params:30,paramName:48,paramDescription:400,enumValues:40,callArgKeys:20,callError:500,callBatch:100},Ou=/^[A-Za-z0-9_-]+$/;function ku(e){return typeof e==`string`&&e.length>0&&e.length<=Du.entryTool&&Ou.test(e)}function Au(e){return Math.ceil(e.length/4)}function ju(e){return Au(`${e.entryTool} ${e.description}`)+55}function Mu(e){return e.tokensPerRequest??ju(e)+(e.promptLine?Au(e.promptLine):0)}var Nu=Qo({type:cs(Su),required:Wo().optional(),enum:Xo(es([V(),Bo()])).optional(),description:V().optional()}),Pu=Qo({slug:V().min(1),description:V(),params:os(V(),Nu),permission:cs(xu),sort:Bo()}),Fu=Qo({version:V(),url:V(),sha256:V(),sizeBytes:Bo(),exe:V(),format:us(`zip`)}),Iu=Qo({slug:V().min(1),name:V(),entryTool:V().refine(ku,`not a valid tool name`),description:V(),promptLine:V().nullable(),details:V().nullable().optional(),status:cs(bu),defaultOn:Wo(),sort:Bo(),install:Fu.nullable(),actions:Xo(Pu),connector:gu.nullable().optional().catch(null)}).loose();Qo({platform:cs(yu),version:V(),packs:Xo(Iu),refreshMinutes:Bo()});var Lu=cs([`stdio`,`sse`,`http`]),Ru=Qo({id:V().trim().regex(/^[a-z0-9][a-z0-9._-]{0,63}$/i,`ID must be 1-64 alphanumeric, dash, dot, or underscore characters`),name:V().trim().min(1).max(100),description:V().max(500).optional(),transport:Lu,command:V().min(1).max(500).optional(),args:Xo(V()).max(100).optional(),env:os(V(),V()).optional(),url:V().url().max(2e3).optional(),headers:os(V(),V()).optional(),defaultOn:Wo(),enabled:Wo().optional(),catalogId:V().max(100).optional()});Ru.refine(e=>e.transport===`stdio`?typeof e.command==`string`&&e.command.length>0:typeof e.url==`string`&&e.url.length>0,{message:`stdio transport requires a command; sse/http transports require a url`}),Ru.partial(),os(V().regex(/^[a-z0-9][a-z0-9._-]{0,63}$/i),Wo()).refine(e=>Object.keys(e).length<=128,`At most 128 MCP server switches`);function zu(e,t){if(e.enabled===!1)return!1;let n=t?t[e.id]:void 0;return typeof n==`boolean`?n:e.defaultOn}function Bu(e,t,n){return{...e??{},[t]:n}}var Vu=[{id:`databases`,label:`Databases`},{id:`cloud`,label:`Cloud & DevOps`},{id:`productivity`,label:`Productivity`},{id:`analytics`,label:`Analytics`},{id:`ai`,label:`AI & Reasoning`},{id:`developer`,label:`Developer Tools`}],Hu=[{id:`postgres`,name:`PostgreSQL`,description:`Inspect schemas, query tables, run read operations and analyze database structures.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-postgres`,"${connectionString}"],parameters:[{key:`connectionString`,label:`Database Connection URL`,placeholder:`postgresql://user:password@localhost:5432/dbname`,type:`password`,required:!0,target:`arg`,templateIndex:2}],docsUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/postgres`},{id:`sqlite`,name:`SQLite`,description:`Direct SQL query and schema inspection for local SQLite database files.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-sqlite`,`--db-path`,"${dbPath}"],parameters:[{key:`dbPath`,label:`SQLite File Path`,placeholder:`C:/data/app.db or /var/data/app.db`,type:`string`,required:!0,target:`arg`,templateIndex:3}],docsUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/sqlite`},{id:`supabase`,name:`Supabase`,description:`Manage Supabase Postgres database, migrations, edge functions, and project config.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-supabase`],parameters:[{key:`SUPABASE_ACCESS_TOKEN`,label:`Personal Access Token`,type:`password`,required:!0,target:`env`},{key:`SUPABASE_PROJECT_REF`,label:`Project Reference ID`,placeholder:`abcdefghijklmnopqrst`,type:`string`,required:!0,target:`env`}],docsUrl:`https://supabase.com/docs/guides/ai/mcp`},{id:`redis`,name:`Redis`,description:`Inspect keys, data structures, and execute Redis operational commands.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-redis`,"${redisUrl}"],parameters:[{key:`redisUrl`,label:`Redis Connection URL`,placeholder:`redis://localhost:6379`,type:`string`,required:!0,target:`arg`,templateIndex:2}]},{id:`mongodb`,name:`MongoDB Atlas`,description:`Query collections, inspect schemas, and interact with MongoDB Atlas databases.`,category:`databases`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-mongodb`,"${connectionString}"],parameters:[{key:`connectionString`,label:`MongoDB Connection URI`,placeholder:`mongodb+srv://user:pass@cluster.mongodb.net/dbname`,type:`password`,required:!0,target:`arg`,templateIndex:2}]},{id:`github`,name:`GitHub`,description:`Search repositories, manage issues, pull requests, files, and branches.`,category:`cloud`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-github`],parameters:[{key:`GITHUB_PERSONAL_ACCESS_TOKEN`,label:`GitHub Personal Access Token (repo scope)`,placeholder:`ghp_...`,type:`password`,required:!0,target:`env`}],docsUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/github`},{id:`gitlab`,name:`GitLab`,description:`Access GitLab merge requests, project branches, issues, and pipelines.`,category:`cloud`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-gitlab`],parameters:[{key:`GITLAB_PERSONAL_ACCESS_TOKEN`,label:`GitLab Personal Access Token`,type:`password`,required:!0,target:`env`},{key:`GITLAB_API_URL`,label:`GitLab API URL (optional for self-hosted)`,placeholder:`https://gitlab.com/api/v4`,type:`string`,required:!1,target:`env`}]},{id:`cloudflare`,name:`Cloudflare`,description:`Inspect and manage Cloudflare Workers, KV namespaces, D1 databases, and DNS records.`,category:`cloud`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@cloudflare/mcp-server-cloudflare`],parameters:[{key:`CLOUDFLARE_API_TOKEN`,label:`API Token`,type:`password`,required:!0,target:`env`},{key:`CLOUDFLARE_ACCOUNT_ID`,label:`Account ID`,type:`string`,required:!0,target:`env`}]},{id:`sentry`,name:`Sentry`,description:`Retrieve real-time application errors, stack traces, and issue analytics.`,category:`cloud`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-sentry`],parameters:[{key:`SENTRY_AUTH_TOKEN`,label:`Auth Token`,type:`password`,required:!0,target:`env`}]},{id:`google-drive`,name:`Google Drive`,description:`Search, read, and export documents, spreadsheets, and files from Google Drive.`,category:`productivity`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-gdrive`],docsUrl:`https://github.com/modelcontextprotocol/servers/tree/main/src/gdrive`},{id:`slack`,name:`Slack`,description:`Read conversation history, search channel messages, and post updates to Slack channels.`,category:`productivity`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-slack`],parameters:[{key:`SLACK_BOT_TOKEN`,label:`Bot User OAuth Token (xoxb-...)`,type:`password`,required:!0,target:`env`},{key:`SLACK_TEAM_ID`,label:`Slack Workspace Team ID`,type:`string`,required:!0,target:`env`}]},{id:`notion`,name:`Notion`,description:`Read and update Notion workspaces, databases, pages, and blocks.`,category:`productivity`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-notion`],parameters:[{key:`NOTION_API_KEY`,label:`Internal Integration Secret (secret_...)`,type:`password`,required:!0,target:`env`}]},{id:`linear`,name:`Linear`,description:`Track issues, cycles, projects, and comments in Linear.`,category:`productivity`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-linear`],parameters:[{key:`LINEAR_API_KEY`,label:`Personal API Key`,type:`password`,required:!0,target:`env`}]},{id:`posthog`,name:`PostHog`,description:`Query product analytics funnels, trends, user session paths, and feature flags.`,category:`analytics`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@posthog/mcp-server-posthog`],parameters:[{key:`POSTHOG_API_KEY`,label:`Personal API Key`,type:`password`,required:!0,target:`env`},{key:`POSTHOG_PROJECT_ID`,label:`Project ID`,type:`string`,required:!0,target:`env`}]},{id:`brave-search`,name:`Brave Search`,description:`Search the live web and discover local points of interest via Brave Search API.`,category:`ai`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-brave-search`],parameters:[{key:`BRAVE_API_KEY`,label:`Brave Search API Key`,type:`password`,required:!0,target:`env`}]},{id:`memory-graph`,name:`Memory (Knowledge Graph)`,description:`Persistent knowledge-graph entity and relation memory across agent turns.`,category:`ai`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-memory`]},{id:`puppeteer`,name:`Puppeteer Headless Browser`,description:`Automate browser navigation, take page screenshots, and scrape dynamic web content.`,category:`ai`,transport:`stdio`,defaultCommand:`npx`,defaultArgs:[`-y`,`@modelcontextprotocol/server-puppeteer`]},{id:`remote-sse`,name:`Remote SSE MCP Server`,description:`Connect to any hosted remote MCP server over Server-Sent Events (SSE).`,category:`developer`,transport:`sse`,defaultUrl:`https://`,parameters:[{key:`url`,label:`SSE Endpoint URL`,placeholder:`https://mcp.example.com/sse`,type:`string`,required:!0,target:`url`},{key:`Authorization`,label:`Authorization Header (optional, e.g. Bearer token)`,placeholder:`Bearer ...`,type:`password`,required:!1,target:`header`}]},{id:`remote-http`,name:`Remote Streamable HTTP Server`,description:`Connect to any remote MCP server using standard Streamable HTTP transport.`,category:`developer`,transport:`http`,defaultUrl:`https://`,parameters:[{key:`url`,label:`HTTP Endpoint URL`,placeholder:`https://mcp.example.com/mcp`,type:`string`,required:!0,target:`url`},{key:`Authorization`,label:`Authorization Header (optional, e.g. Bearer token)`,placeholder:`Bearer ...`,type:`password`,required:!1,target:`header`}]}],Uu=[`No answer needed.`,`"Talk to other chats" is off in this chat: this message is from another chat's agent, not the person, and you cannot message chats. Your final answer goes back to that chat by itself.`,`"Talk to other chats" is off in this chat: this message is from another chat's agent, not the person, and you cannot message chats. It asked for no answer, so nothing goes back.`,`Last hop of this chain: you cannot message chats in this turn; put what you have in your final answer.`];[`**Let this chat work together with your other chats.**`,``,`### What it does`,`- Finds your other chats on this PC and reads their recent messages.`,`- Sends one chat, or a group of chats, a message or a task.`,`- Brings their answers back to this chat, by itself.`,``,`### How it works`,`- A chat that is asleep is woken from its saved history. A busy one gets the message when its current turn ends, never in the middle of it.`,`- The other chat does the work with its own model, folder and tools. Its answer comes back here as a new message only when this chat asked for one.`,`- Several messages from one chat that wait for a busy chat are handed over together, in one turn, with one answer.`,`- Several chats can share one conversation (a group). An answer goes only to the chat that asked, so a group cannot multiply its own messages.`,`- A chat with this switch OFF can still be messaged by a chat that has it on. It does the work, and its final answer goes back to that chat when that chat asked for one. That is all it can do: it gets none of these tools, cannot message or read other chats, and its switch stays off.`,``,`### What it costs`,`- About 650 tokens on every request while it is on, read from the prompt cache. Nothing while it is off, even in a chat that is messaged.`,`- Every message makes the chat that receives it do a turn, which spends its own tokens.`,`- Switching it on or off in a chat that already has a conversation re-writes its prompt cache once.`,``,`### Safety limits`,`- Each conversation has a budget: 20 delivered messages and 1,000,000 new tokens by default (context read back from the prompt cache is not counted). Reaching either pauses the conversation, and the chats say so.`,`- A chain stops after 3 hops (a message caused by a message caused by a message).`,`- At most 5 messages between two chats and 20 from one chat in 10 minutes, and 10 waiting for any one chat. A chat cannot message itself.`,`- A conversation with no activity for 24 hours closes by itself.`,``,`### How to stop it`,`- Turn this switch off: the chat loses these tools, and what it sent and the answers it asked for pause. It still answers a chat that messages it.`,`- Or open the Conversations window and use Pause, Close or Stop all.`,``,`### Privacy`,`- Everything stays on your PC: the messages are kept in this PC's database, never on OonaCode's server.`,`- A message never grants anything. The other chat runs with its own permissions and asks you as usual.`,``,`Only a chat with this switch on can start a conversation; a chat with it off only answers.`].join(`
|
|
81
81
|
`);var Wu={hops:3,rateWindowMs:6e5,perPair:5,perSender:20,pendingPerTarget:10,idleCloseMs:864e5,messageChars:2e4,titleChars:80,conversationTitleChars:120,recipients:10,listChats:50,readMessages:50,budgetMessagesMax:1e4,budgetTokensMax:1e9},Gu={message:`✉️ Message from chat "`,reply:`↩️ Reply from chat "`,continue:`↻ Continue the message from chat "`},Ku=`⚠ `,qu=`<local-command-stdout>`,Ju=`</local-command-stdout>`,Yu=/^[A-Za-z0-9._:-]{1,128}$/;function Xu(e){let t=(e??``).replace(/["“”]/g,`'`).replace(/\s+/g,` `).trim();if(!t)return`Untitled chat`;let n=Wu.titleChars;return t.length>n?`${t.slice(0,n-1).trimEnd()}…`:t}function Zu(e){return Xu(e.title?.trim()||e.firstPrompt?.trim()||`Chat ${e.id.slice(0,8)}`)}function Qu(e,t){let n=Uu.filter(e=>t===`reply`||e!==`No answer needed.`),r=e;for(let e=!0;e;){e=!1;for(let t of n){if(r===t)return``;r.startsWith(`${t}\n\n`)&&(r=r.slice(t.length+2),e=!0)}}return r}var $u=/^\[conv:(\S+) chat:(\S+) host:(\S+) msg:(\S+?)(?: reply-to:(\S+?))?( reply expected)?\]$/;function ed(e){if(typeof e!=`string`)return null;let t=e;t.startsWith(qu)&&t.endsWith(Ju)&&(t=t.slice(22,t.length-23)),t=t.replace(/\r\n/g,`
|
|
82
82
|
`);let n=t.indexOf(`
|
|
83
83
|
`);if(n<0)return null;let r=t.slice(0,n),i=t.slice(n+1),a=i.indexOf(`
|
|
@@ -113,7 +113,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
113
113
|
`))/^\s*\|?\s*:?-{2,}/.test(e)||(e=e.replace(/\|/g,` `),e=e.replace(/^\s{0,3}#{1,6}\s+/,``).replace(/^\s*>\s?/,``).replace(/^\s*(?:[-*+•]|\d{1,3}[.)])\s+/,``).replace(/(\*\*|__)(.+?)\1/g,`$2`).replace(/(?<![\p{L}\p{N}])[*_]([^*_\n]+)[*_](?![\p{L}\p{N}])/gu,`$1`).replace(/~~(.+?)~~/g,`$1`).replace(/[*_#`~]+/g,` `).replace(/\s+/g,` `).trim(),e=e.replace(/\(\s*\)|\[\s*\]/g,``).replace(/\s+([,.;:!?،؛؟։])/g,`$1`).replace(/([,;:])(?:\s*[,;:])+/g,`$1`).trim(),!(!e||/^[\p{P}\s]+$/u.test(e))&&(/[.!?…։؟:;"'»”)]$/u.test(e)||(e+=`.`),n.push(e)));return n.join(`
|
|
114
114
|
`)}var zf=/([.!?…։؟。!?]+["'»”)]*)(\s+|$)/gu,Bf=/([,;:،؛՝、,;]\s+)/u;function Vf(e,t,n){let r=t,i=n;for(;r<i&&/\s/.test(e[r]);)r+=1;for(;i>r&&/\s/.test(e[i-1]);)--i;return[r,i]}function Hf(e,t=280){let n=[];for(let r of e.matchAll(/[^\n]+/g)){let[i,a]=Vf(e,r.index??0,(r.index??0)+r[0].length);if(i>=a)continue;let o=e.slice(i,a),s=0,c=[];for(let t of o.matchAll(zf)){let n=(t.index??0)+t[1].length;c.push(Vf(e,i+s,i+n)),s=n+(t[2]?.length??0)}s<o.length&&c.push(Vf(e,i+s,a));for(let[r,i]of c)if(!(r>=i))for(let a of Wf(e,r,i,t)){let e=n[n.length-1];e!==void 0&&a.spoken.length<12&&e.spoken.length+a.spoken.length+1<=t?n[n.length-1]={start:e.start,end:a.end,spoken:`${e.spoken} ${a.spoken}`}:n.push(a)}}return n}function Uf(e,t=280){return Hf(e,t).map(e=>e.spoken)}function Wf(e,t,n,r){let i=(t,n)=>{let[r,i]=Vf(e,t,n);return r<i?{start:r,end:i,spoken:e.slice(r,i)}:null};if(n-t<=r)return[{start:t,end:n,spoken:e.slice(t,n)}];let a=[],o=e=>{e&&a.push(e)},s=t,c=t,l=t;for(let a of e.slice(t,n).split(Bf)){let t=l;if(l+=a.length,a){if(c-s+a.length<=r){c=l;continue}for(o(i(s,c)),s=t,c=l;c-s>r;){let t=e.slice(s,c).lastIndexOf(` `,r),n=t>r/3?t:r;o(i(s,s+n)),s+=n}}}return o(i(s,c)),a}var Gf={version:2,drop:[`՛`,`՜`],numbers:{units:[`զրո`,`մեկ`,`երկու`,`երեք`,`չորս`,`հինգ`,`վեց`,`յոթ`,`ութ`,`ինը`],teens:[`տասը`,`տասնմեկ`,`տասներկու`,`տասներեք`,`տասնչորս`,`տասնհինգ`,`տասնվեց`,`տասնյոթ`,`տասնութ`,`տասնինը`],tens:[``,``,`քսան`,`երեսուն`,`քառասուն`,`հիսուն`,`վաթսուն`,`յոթանասուն`,`ութսուն`,`իննսուն`],hundred:`հարյուր`,thousand:`հազար`,million:`միլիոն`,ordinal_1_4:[``,`առաջին`,`երկրորդ`,`երրորդ`,`չորրորդ`],ordinal_suffix:`երորդ`,ordinal_marks:[`րդ`,`երորդ`]},latin:{visa:`վիզա`,mastercard:`մաստերքարդ`,paypal:`փեյփալ`,"wi-fi":`վայֆայ`,wifi:`վայֆայ`,bluetooth:`բլութութ`,usb:`յուէսբի`,gps:`ջիփիէս`,sms:`էսէմէս`,pdf:`փիդիէֆ`,qr:`քյուառ`,ok:`օքեյ`,online:`օնլայն`,offline:`օֆլայն`,email:`իմեյլ`,"e-mail":`իմեյլ`,iphone:`այֆոն`,android:`անդրոիդ`,windows:`վինդոուս`,google:`գուգլ`,facebook:`ֆեյսբուք`,youtube:`յութուբ`,instagram:`ինստագրամ`,telegram:`տելեգրամ`,whatsapp:`վաթսափ`,viber:`վայբեր`,zoom:`զում`,tiktok:`թիքթոք`,netflix:`նեթֆլիքս`,uber:`ուբեր`,apple:`էփլ`,samsung:`սամսունգ`,microsoft:`մայքրոսոֆթ`,arev:`Արև`,astgh:`Աստղ`,artsiv:`Արծիվ`},lexicon:[[`անգամ`,`անքամ`]]},Kf={oonacode:`ունակոդ`,claude:`քլոդ`,gemini:`ջեմինի`,github:`գիթհաբ`,linux:`լինուքս`,api:`էյփիայ`,app:`էփ`},qf=/(?<![\p{L}\p{N}_])(\p{Nd}{1,3}(?:[ \u00A0]\p{Nd}{3})+|\p{Nd}+)(?:-([ա-և]+))?/gu,Jf=/\p{Nd}/u,Yf=/[A-Za-z][A-Za-z0-9]*(?:[-'][A-Za-z0-9]+)*/g;function Xf(e){return e&&e[0].toUpperCase()+e.slice(1)}function Zf(e){let t=e.codePointAt(0);if(t>=48&&t<=57)return t-48;let n=t;for(;Jf.test(String.fromCodePoint(n-1));)--n;return(t-n)%10}function Qf(e,t){let n=Math.floor(e/100),r=e%100,i=[];if(n&&i.push(n===1?t.hundred:`${t.units[n]} ${t.hundred}`),r>=20){let e=r%10;i.push(t.tens[Math.floor(r/10)]+(e?t.units[e]:``))}else r>=10?i.push(t.teens[r-10]):(r||!i.length)&&i.push(t.units[r]);return i.join(` `)}function $f(e,t){if(e.length>9)return Array.from(e,e=>t.units[Number(e)]).join(` `);let n=Number(e),r=Math.floor(n/1e6);n%=1e6;let i=Math.floor(n/1e3);n%=1e3;let a=[];return r&&a.push(`${Qf(r,t)} ${t.million}`),i&&a.push(i===1?t.thousand:`${Qf(i,t)} ${t.thousand}`),(n||!a.length)&&a.push(Qf(n,t)),a.join(` `)}function ep(e,t){if(e.length===1&&e>=`1`&&e<=`4`)return t.ordinal_1_4[Number(e)];let n=$f(e,t);return(n.endsWith(`ը`)?n.slice(0,-1):n)+t.ordinal_suffix}function tp(e,t,n){if(n.ordinal_marks.includes(t))return ep(e,n);let r=$f(e,n);return r.endsWith(`ինը`)?r=`${r.slice(0,-1)}ն`:r.endsWith(`ը`)&&(r=r.slice(0,-1)),r+t}function np(e){let t=Gf,n=e;for(let e of t.drop)n=n.split(e).join(``);n=n.replace(qf,(e,n,r)=>{let i=``;for(let e of n)e!==` `&&e!==`\xA0`&&(i+=String(Zf(e)));return i=i.replace(/^0+(?=.)/,``),r?tp(i,r,t.numbers):$f(i,t.numbers)}),n=n.replace(Yf,e=>{let n=e.toLowerCase();return Object.prototype.hasOwnProperty.call(t.latin,n)?t.latin[n]:e});for(let[e,r]of t.lexicon)n=n.split(e).join(r).split(Xf(e)).join(Xf(r));return n}function rp(e){let t=np(e);return t=t.replace(Yf,e=>{let t=e.toLowerCase();return Object.prototype.hasOwnProperty.call(Kf,t)?Kf[t]:e}),t}var ip=/[\u06F0-\u06F9]/g,ap=/[\u0660-\u0669]/g;function op(e){return e.replace(ip,e=>String(e.charCodeAt(0)-1776)).replace(ap,e=>String(e.charCodeAt(0)-1632)).replace(/(\d)[\u066B](\d)/g,`$1.$2`).replace(/(\d)[\u066C](\d)/g,`$1$2`).replace(/\u066A/g,`%`).replace(/\u064A/g,`ی`).replace(/\u0643/g,`ک`).replace(/\u061F/g,`?`).replace(/\u060C/g,`,`).replace(/\u061B/g,`;`)}function sp(e,t){let n=t.toLowerCase().split(/[-_]/)[0];return n===`hy`?rp(e):n===`fa`?op(e):e}var cp=2.5,lp=e=>String.fromCharCode(e),up=lp(8204),dp=RegExp(`[${lp(12352)}-${lp(12543)}${lp(13312)}-${lp(19903)}${lp(19968)}-${lp(40959)}${lp(63744)}-${lp(64255)}]`,`u`),fp=RegExp(`[\\p{L}\\p{N}\\p{M}](?:[\\p{L}\\p{N}\\p{M}${up}'’-]|[.,](?=\\p{N}))*`,`gu`),pp=RegExp(`[-'’${up}]$`,`u`);function mp(e,t=0,n=e.length){let r=[],i=e.slice(t,n);for(let e of i.matchAll(fp)){let n=e[0];for(;pp.test(n);)n=n.slice(0,-1);if(!n)continue;let i=t+(e.index??0);if(!dp.test(n)){r.push({start:i,end:i+n.length,text:n});continue}let a=-1;for(let e=0;e<n.length;e+=1){let t=n[e];dp.test(t)?(a>=0&&(r.push({start:i+a,end:i+e,text:n.slice(a,e)}),a=-1),r.push({start:i+e,end:i+e+1,text:t})):a<0&&(a=e)}a>=0&&r.push({start:i+a,end:i+n.length,text:n.slice(a)})}return r}function hp(e,t,n=``){let r=0;if(dp.test(e))for(let t of e)r+=dp.test(t)?2.2:1;else{let n=sp(e,t);for(let e of n)/\p{N}/u.test(e)?r+=2.5:/[\p{L}\p{M}]/u.test(e)&&(r+=1)}return/^\s*[,;:—–،؛՝、,;]/u.test(n)&&(r+=cp),Math.max(1,r)}function gp(e,t){let n=[],r=[];for(let i of Hf(e,t.maxChars??280)){let a=r.length,o=mp(e,i.start,i.end),s=0;o.forEach((a,c)=>{let l=e.slice(a.end,o[c+1]?.start??i.end),u=hp(a.text,t.language,l);s+=u,r.push({index:r.length,sentence:n.length,start:a.start,end:a.end,text:a.text,weight:u,startSec:0,endSec:0})}),n.push({index:n.length,start:i.start,end:i.end,spoken:i.spoken,wordFrom:a,wordTo:r.length,weight:Math.max(1,s),startSec:0,durationSec:0,leadSec:0,tailSec:0,measured:!1})}return _p({text:e,language:t.language,sentences:n,words:r,totalSec:0,complete:n.length===0,secPerWeight:t.secPerWeight??.075})}function _p(e){let t=e.sentences.map(e=>({...e})),n=e.words.map(e=>({...e})),r=0;for(let i of t){i.measured||(i.durationSec=i.weight*e.secPerWeight,i.leadSec=0,i.tailSec=0),i.startSec=r;let t=i.leadSec,a=i.durationSec-i.leadSec-i.tailSec,o=r+t;a<=0&&(a=i.durationSec,o=r);let s=0;for(let e=i.wordFrom;e<i.wordTo;e+=1)s+=n[e].weight;let c=o;for(let e=i.wordFrom;e<i.wordTo;e+=1){let t=n[e],r=s>0?t.weight/s*a:0;t.startSec=c,t.endSec=c+r,c+=r}r+=i.durationSec}return{...e,sentences:t,words:n,totalSec:r,complete:t.every(e=>e.measured)}}function vp(e,t,n,r={}){if(!e.sentences[t]||!Number.isFinite(n)||n<=0)return e;let i=Math.max(0,Math.min(r.leadSec??0,n/2)),a=Math.max(0,Math.min(r.tailSec??0,n/2)),o=e.sentences.map(e=>e.index===t?{...e,durationSec:n,leadSec:i,tailSec:a,measured:!0}:e),s=0,c=0;for(let e of o)e.measured&&(s+=Math.max(0,e.durationSec-e.leadSec-e.tailSec)||e.durationSec,c+=e.weight);let l=c>0?s/c:e.secPerWeight;return _p({...e,sentences:o,secPerWeight:l})}function yp(e,t){let n=e.sentences;if(n.length===0)return-1;let r=0,i=n.length-1;for(;r<i;){let e=r+i+1>>1;n[e].startSec<=t?r=e:i=e-1}return r}function bp(e,t){let n=e.words;if(n.length===0)return-1;let r=0,i=n.length-1;for(;r<i;){let e=r+i+1>>1;n[e].startSec<=t?r=e:i=e-1}return r}function xp(e,t){let n=e.words[Math.max(0,Math.min(t,e.words.length-1))];return n?n.startSec:0}function Sp(e,t){let n=e.words;if(n.length===0)return-1;let r=0,i=n.length-1;for(;r<i;){let e=r+i>>1;n[e].end<=t?r=e+1:i=e}return r}function Cp(e,t,n){return Math.max(0,Math.min(e.totalSec,t+n))}function wp(e,t,n=1.5){let r=yp(e,t);if(r<0)return 0;let i=e.sentences[r].startSec;return t-i>n||r===0?i:e.sentences[r-1].startSec}function Tp(e,t){let n=yp(e,t),r=e.sentences[n+1];return r?r.startSec:e.totalSec}function Ep(e,t,n={}){let r=n.threshold??.01,i=Math.max(1,Math.round(t*(n.windowMs??10)/1e3)),a=Math.ceil(e.length/i),o=t=>{let n=0,a=Math.min(e.length,(t+1)*i);for(let r=t*i;r<a;r+=1)n+=e[r]*e[r];return Math.sqrt(n/Math.max(1,a-t*i))>r},s=-1;for(let e=0;e<a;e+=1)if(o(e)){s=e;break}if(s<0||t<=0)return{leadSec:0,tailSec:0};let c=s;for(let e=a-1;e>s;--e)if(o(e)){c=e;break}return{leadSec:s*i/t,tailSec:Math.max(0,(e.length-Math.min(e.length,(c+1)*i))/t)}}function Dp(e){let t=Math.max(0,Math.floor(Number.isFinite(e)?e:0)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=String(i).padStart(2,`0`);return n>0?`${n}:${String(r).padStart(2,`0`)}:${a}`:`${r}:${a}`}var Op=class{#e=0;#t=0;#n=1;#r=1/0;#i=!1;anchor(e,t,n){this.#e=e,this.#t=t,this.#n=n>0?n:1,this.#i=!0}hold(e){this.#e=e,this.#i=!1}setLimit(e){this.#r=e}get running(){return this.#i}now(e){if(!this.#i)return this.#e;let t=this.#e+(e-this.#t)/1e3*this.#n;return Math.min(this.#r,Math.max(this.#e,t))}};function kp(e){return[...e].sort((e,t)=>{let n=(Date.parse(t.createdAt)||0)-(Date.parse(e.createdAt)||0);return n===0?t.id.localeCompare(e.id):n})}var Ap=.5;function jp(e){return Number.isFinite(e)?Math.max(Ap,Math.min(2,e)):1}var Mp=class{#e;#t;#n;#r;#i=new Set;#a=new Op;#o;#s=`idle`;#c;#l=0;#u=0;#d=null;#f=0;#p=Promise.resolve();#m=!1;constructor(e,t,n={}){this.#e=e,this.#o=t,this.#t=n.mode??`sentences`,this.#c=jp(n.rate??1),this.#n=n.now??(()=>Date.now()),this.#r=n.errorText??(e=>`The speech engine could not say this${e instanceof Error&&e.message?` (${e.message})`:``}.`)}get timeline(){return this.#o}snapshot(){let e=this.#g(),t=this.#o,n=t.words.length===0?-1:this.#s===`playing`?bp(t,e):this.#u;return{status:this.#s,currentSec:e,durationSec:t.totalSec,durationExact:t.complete,wordIndex:n,sentenceIndex:n>=0?t.words[n].sentence:yp(t,e),rate:this.#c,error:this.#d}}subscribe(e){return this.#i.add(e),()=>this.#i.delete(e)}#h(){for(let e of[...this.#i])e()}#g(){return this.#s===`playing`?this.#a.now(this.#n()):this.#l}#_(e){this.#s=e,this.#h()}#v(){return this.#p=this.#p.then(async()=>{try{await this.#e.stop()}catch{}}),this.#p}#y(){(this.#s===`playing`||this.#s===`buffering`)&&(this.#l=this.#g(),this.#u=Math.max(0,bp(this.#o,this.#l))),this.#f+=1,this.#a.hold(this.#l),this.#v()}#b(e){let t=this.#o,n=t.words[e];if(!n)return[];let r=t.text,i=t.sentences[n.sentence];if(this.#t===`whole`){let a=t.sentences[t.sentences.length-1];return[{sentence:i.index,base:n.start,fromWord:e,whole:!1,lastSentence:a.index,text:r.slice(n.start,a.end)}]}let a=[{sentence:i.index,base:n.start,fromWord:e,whole:e===i.wordFrom,lastSentence:i.index,text:r.slice(n.start,i.end)}];for(let e=i.index+1;e<t.sentences.length;e+=1){let n=t.sentences[e];n.wordTo!==n.wordFrom&&a.push({sentence:e,base:n.start,fromWord:n.wordFrom,whole:!0,lastSentence:e,text:r.slice(n.start,n.end)})}return a}async#x(e){if(this.#m)return;let t=this.#o;if(t.words.length===0){this.#l=0,this.#_(`ended`);return}let n=++this.#f,r=Math.max(0,Math.min(e,t.words.length-1));if(this.#u=r,this.#l=xp(t,r),this.#a.hold(this.#l),this.#d=null,this.#_(`buffering`),await this.#v(),n!==this.#f||this.#m)return;let i=this.#b(r),a=this.#c,o=-1,s=e=>{let t=i[e];this.#e.speak(t.text,{rate:a,onStart:()=>{if(n!==this.#f)return;o=this.#n();let e=xp(this.#o,t.fromWord),r=this.#o.sentences[t.lastSentence];this.#a.setLimit(r.startSec+r.durationSec),this.#a.anchor(e,o,a),this.#u=t.fromWord,this.#s===`playing`?this.#h():this.#_(`playing`)},onBoundary:e=>{if(n!==this.#f)return;let r=Sp(this.#o,t.base+e);r<0||(this.#u=r,this.#a.anchor(xp(this.#o,r),this.#n(),a))},onEnd:()=>{if(n!==this.#f)return;if(t.whole&&o>=0){let e=(this.#n()-o)/1e3*a;e>.05&&(this.#o=vp(this.#o,t.sentence,e))}let r=this.#o.sentences[t.lastSentence];if(this.#l=r.startSec+r.durationSec,this.#a.hold(this.#l),e+1<i.length){this.#e.queueAhead||s(e+1),this.#h();return}this.#l=this.#o.totalSec,this.#u=this.#o.words.length-1,this.#f+=1,this.#_(`ended`)},onError:e=>{n===this.#f&&(this.#f+=1,this.#v(),this.#d=this.#r(e),this.#_(`error`))}})};if(this.#e.queueAhead)for(let e=0;e<i.length;e+=1)s(e);else s(0)}play(){if(this.#s===`playing`||this.#s===`buffering`)return;let e=this.#s===`ended`||this.#l>=this.#o.totalSec?0:this.#u;this.#x(e)}pause(){(this.#s===`playing`||this.#s===`buffering`)&&(this.#y(),this.#_(`paused`))}toggle(){this.#s===`playing`||this.#s===`buffering`?this.pause():this.play()}seek(e){let t=this.#o,n=Math.max(0,Math.min(t.totalSec,e));this.seekWord(Math.max(0,bp(t,n)))}seekWord(e){let t=this.#o;if(t.words.length===0)return;let n=Math.max(0,Math.min(e,t.words.length-1));if(this.#s===`playing`||this.#s===`buffering`){this.#x(n);return}this.#f+=1,this.#u=n,this.#l=xp(t,n),this.#a.hold(this.#l),this.#_(this.#s===`idle`?`idle`:`paused`)}skip(e){this.seek(Cp(this.#o,this.#g(),e))}nextSentence(){let e=Tp(this.#o,this.#g());e>=this.#o.totalSec||this.seek(e)}prevSentence(){this.seek(wp(this.#o,this.#g()))}setRate(e){let t=jp(e);if(t===this.#c)return;let n=this.#s===`playing`||this.#s===`buffering`,r=n?Math.max(0,bp(this.#o,this.#g())):this.#u;this.#c=t,n?this.#x(r):this.#h()}destroy(){this.#m||(this.#y(),this.#m=!0,this.#s=`idle`,this.#i.clear())}},Np={model:`claude-haiku-5-5`,windowHours:3,inputChars:12e3,maxOutputTokens:1500,concurrency:3,callTimeoutMs:9e4,maxPromptChars:4e3,fallbackMessages:20},Pp=[1,3,6,12,24];function Fp(e){let t=typeof e==`number`?e:Number(e);return Pp.includes(t)?t:Np.windowHours}var Ip={suggest:`Suggest`,suggestHint:`Read the last hours of this chat and suggest what to send it next`,reviewing:e=>`Reading the last ${e} h of this chat…`,managerTitle:`Project manager`,managerHint:`Tick the chats to review. For each, the manager says where it stands and what to send next — you edit it and send it, or not. Nothing runs by itself.`,costNote:e=>`Suggestions are written by ${e} on your OonaCode credits, for every chat — whatever model or key the chat itself uses. The chat's recent messages are sent through OonaCode's server for that one call and not kept there.`,decideYourself:`Only you can decide this one — see why above.`,noCredits:e=>`Suggest runs ${e} on your OonaCode credits and the account has none left — top up in Account, then try again.`,notInPlan:e=>`Your plan does not include ${e}, which Suggest uses.`,modelUnavailable:e=>`${e}, which Suggest uses, is not offered by the OonaCode pool right now.`,finishedUnseen:`Finished — not looked at yet`,finishedUnseenError:`Finished with an error — not looked at yet`};function Lp(e,t,n=Date.now()){let r=e?.summaries[0];if(!e||!r)return!0;if(t!==null&&t!==r.id&&e.summaries.some(e=>e.id===t)||!e.changedSinceNewest)return!1;let i=Date.parse(r.createdAt);return!(Number.isFinite(i)&&n-i<6e5)}function Rp(e){return[`en`,...e.translations.map(e=>e.language)]}function zp(e,t){return t===`en`?e.text:e.translations.find(e=>e.language===t)?.text??null}function Bp(e){let t=Math.max(0,Math.round(e));return t<60?`${t} s`:`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`}function Vp(e){if(e.credits!==null&&e.credits>0){let t=e.credits.toLocaleString(`en-US`,{maximumFractionDigits:2});return`${t} credit${t===`1`?``:`s`}`}return e.route===`subscription`?`your plan pays`:e.route===`own-key`?Ud(`own-key`):e.route===`pool`&&e.credits===0?`0 credits`:`not priced`}var Hp={title:`Listen to this chat`,intro:e=>`A spoken summary of ${e} — its goal, what was done, where it stands and what is pending — written by the chat’s own model, in English. Other languages are translated once by ${xf.label} on your OonaCode credits and kept with the summary.`,noSummaries:`No summary yet — Play writes one.`,changedSinceNewest:`The chat has moved on since the newest summary — Play writes a new one first.`,unchanged:e=>`Nothing has changed in the chat since the summary of ${e} — that one is used, and nothing was spent.`,generating:`Generating…`,translating:`Translating…`,heading:(e,t)=>t?`${e.name}${e.code===`en`?``:` — ${e.native}`}`:`English — not in ${e.name} yet: Play translates it once`,current:`current`,playerOnly:`Voice and speed only change how this device reads it — they cost nothing.`},Up={seq:0,conversationIds:null,sessionIds:null};function Wp(e,t){return e.conversationIds===null||e.sessionIds===null||t.sessionId&&e.sessionIds.includes(t.sessionId)?!0:(t.conversationIds??[]).some(t=>e.conversationIds.includes(t))}function Gp(e){let t=e.members.filter(e=>e.leftAt===null);return t.length>0?t:e.members}function Kp(e){if(e.title?.trim())return e.title.trim();let t=Gp(e).map(e=>e.title);return t.length>0?t.join(` · `):`Conversation`}function qp(e,t){return e.members.some(e=>e.sessionId===t&&e.leftAt===null)}function Jp(e,t){return e.filter(e=>e.status!==`closed`&&qp(e,t))}function Yp(e){return e.status===`active`&&(e.waiting>0||e.members.some(e=>e.leftAt===null&&e.state===`working`))}function Xp(e){return e.status===`paused`?`paused`:e.status===`closed`?`closed`:Yp(e)?`active`:`idle`}var Zp={active:`active`,idle:`idle`,paused:`paused`,closed:`closed`};function Qp(e){let t=Xp(e);return t===`active`?`ok`:t===`paused`?`warn`:`neutral`}function eee(e){let t=e.filter(Yp).length,n=e.filter(e=>e.status===`paused`).length;return[`${e.length} ${(e=>`conversation${e===1?``:`s`}`)(e.length)}`,t>0?`${t} active`:`none active`,...n>0?[`${n} paused`]:[]].join(` · `)}var $p={active:`active`,paused:`paused`,closed:`closed`},tee={message:`Message`,reply:`Reply`,continue:`Continue`,notice:`Notice`},nee={pending:`Waiting to be delivered: the other chat gets it when its current turn ends, or is woken for it.`,sending:`Being handed to a chat on another PC.`,delivering:`Being handed to the other chat right now.`,delivered:`The other chat is working on it.`,answered:`The other chat finished its turn on it.`,failed:`The other chat could not finish it (stopped, or an error). The sender was told.`,cancelled:`Withdrawn before it was delivered, or the conversation closed.`,paused:`On hold: the conversation is paused, or the chat that started this exchange has "Talk to other chats" off.`};function ree(e){switch(e){case`answered`:return`ok`;case`failed`:return`danger`;case`paused`:return`warn`;case`delivering`:case`delivered`:case`sending`:return`accent`;default:return`neutral`}}function iee(e){if(e.kind!==`notice`)return e.text;let t=ed(e.text);return t?t.body?`${t.headline}\n\n${t.body}`:t.headline:e.text}function aee(e){return e?.status===`answered`?{label:`answered`,answeredAt:e.finishedAt,help:`This chat finished its turn on this message, and its final answer went back to the chat that asked. Nothing more is owed.`}:e?.status===`failed`||e?.status===`cancelled`?{label:`answer requested`,answeredAt:null,help:e.status===`failed`?`The chat that sent this asked for an answer, but this chat's turn on it did not finish (stopped, or an error). The sender was told.`:`The chat that sent this asked for an answer, but the message was withdrawn or its conversation closed.`}:{label:`answer requested`,answeredAt:null,help:`The chat that sent this asked for an answer: this chat's final answer to it goes back by itself when its turn ends.`}}function oee(e){let t=new Map;for(let n of e??[])for(let e of n.answerRequests??[])t.set(e.messageId,e);return t}function see(e){return e.kind===`notice`||e.kind===`reply`||!e.expectsReply?null:e.status===`answered`?{text:`answered`,help:`The chat it went to finished its turn on it; its final answer went back as a reply.`}:e.status===`failed`||e.status===`cancelled`?{text:`not answered`,help:`It asked for an answer, but it was not answered: the turn on it failed, or it was withdrawn.`}:{text:`reply expected`,help:`The sender asked for an answer: the final answer of the turn on it will go back as a reply.`}}function cee(e){return e.batchOf?`handed over in one turn with other messages from the same chat; that turn answered them all`:null}function lee(e){return e.kind!==`notice`&&(e.status===`pending`||e.status===`paused`)}function uee(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||t<=0?+(e>0):Math.max(0,Math.min(1,e/t))}function dee(e){return e.length>400||e.split(`
|
|
115
115
|
`).length>8}function em(e,t){let n=(e,t,n)=>{let r=e.trim();if(!/^\d+$/.test(r))return`${n}: a whole number, please.`;let i=Number(r);return i<1?`${n}: at least 1.`:i>t?`${n}: at most ${t.toLocaleString()}.`:null};return n(e,Wu.budgetMessagesMax,`Messages`)??n(t,Wu.budgetTokensMax,`Tokens`)}function tm(e){return Bd(e!=null&&e>0?e:0)}function fee(e,t){return e.credits!==void 0&&e.credits>0?`${t} tokens · ${Bd(e.credits)}`:`${t} tokens`}var nm={window:`Chats on this PC that have "Talk to other chats" switched on can send each other messages and tasks. Every conversation between them is listed here, with all it said and what it cost.`,stopAll:`Pauses every active conversation on this PC and stops any turn a message between chats is running right now. Nothing is deleted: resume each one when you want.`,status:`Active: a message of it is waiting or one of its chats is on a turn. Idle: nothing is going on — it stays listed, a new message continues it, and it closes by itself after 24 hours without activity. Paused: held until you resume it. Closed: finished — only its history is kept.`,pause:`Holds this conversation: messages waiting in it are not delivered until you resume it. A chat already working on one finishes that turn.`,resume:`Lets the messages waiting in this conversation be delivered again. Not possible while it is over its budget — raise the budget first.`,close:`Ends this conversation for good. Messages still waiting in it are withdrawn; its history stays here.`,budget:`The most this conversation may use before it pauses by itself: delivered messages, and new tokens (context read back from the prompt cache is not counted). A budget below what is used pauses it; raising it resumes one the budget paused.`,removeMember:`Takes this chat out of the conversation: nothing more is delivered to it here. A conversation left with fewer than two chats closes.`,withdraw:`Takes this message back before it is delivered. The other chat never sees it.`,history:`Every message, reply and notice in this conversation, oldest first: who sent it to whom, when, whether it was delivered and answered, and what the turn it caused used. A message not delivered yet can be withdrawn.`,cost:`The credits the OonaCode pool charged for the turns these messages caused, and their new tokens (input and output, not the context read back from the cache). A chat on your own key or plan is not billed in credits: only its tokens count.`,openChat:`Open this chat in a tab.`,listView:`Every conversation, with its controls and its whole history.`,mapView:`Which chats are talking to each other: every chat is a dot (blue and pulsing while it works), every conversation a hub with a line to each of its chats — dashed for a chat that left. Click a hub to see that conversation, a chat to open it.`,showClosed:`Also draw the conversations that are closed, faded.`};function rm(e,t,n){return{...e??{},[t]:n}}function pee(e,t){let n=Eu(e,t);return{count:n.length,label:`Tools · ${n.length}`,title:n.length>0?`OonaCode tools on in this chat: ${n.map(e=>e.name).join(`, `)}`:`No OonaCode tools are on in this chat`}}function im(e){return e&&Object.keys(e).length>0?{toolPacks:{...e}}:{}}var am=`Switching a tool restarts this chat's agent; its next message re-reads the conversation once.`;function om(e){return e.details?.trim()||null}function sm(e){return e.description.trim()||`No details for this tool yet.`}var cm=`A demo: its calls are checked and logged, but nothing runs on your PC yet.`;function lm(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function um(e){if(`at`in e)return`once, ${lm(e.at)}`;if(`everyMinutes`in e){let t=e.everyMinutes;return t%1440==0?t===1440?`every day`:`every ${t/1440} days`:t%60==0?t===60?`every hour`:`every ${t/60} hours`:`every ${t} minutes`}return`cron ${e.cron}`}function dm(e,t){return t?e?`next ${lm(e)}`:`done`:e?`paused`:`done`}function fm(e){return`${e} is offline — its chats can be read while it is online.`}function pm(e,t,n){return n?`${e}::${n}::${t}`:`${e}::${t}`}function mm(e){let t=e.indexOf(`::`);if(t<=0)return null;let n=e.slice(0,t),r=e.slice(t+2);if(!n||!r)return null;let i=r.indexOf(`::`);if(i>0){let e=r.slice(0,i),t=r.slice(i+2);if(e&&t&&/^[a-z0-9-]+$/.test(e))return{providerId:n,variantId:e,modelId:t}}return{providerId:n,variantId:null,modelId:r}}function hm(e,t){return e===`oonacode`?-1:t}function gm(e){return e.filter(e=>e.definition.enabled&&e.configured&&e.definition.poolOnly!==!0&&T(e.definition.id)&&!D(e.definition.id)&&e.definition.models.length>0).map((e,t)=>({p:e,order:hm(e.definition.id,t)})).sort((e,t)=>e.order-t.order).map(e=>e.p)}function _m(e){let t=Fs(e.definition);if(t.length<2)return[{variantId:null,suffix:``}];let n=new Set((e.credentials??[]).map(e=>e.variantId??`payg`)),r=t.filter(e=>n.has(e.id));return r.length<2?[{variantId:null,suffix:``}]:r.map(e=>({variantId:e.id,suffix:` ${vm(e.id,e.label)}`}))}function vm(e,t){return e===`token-plan`?`Subscription`:e===`payg`||e===`api-key`?`API`:t}function ym(e,t){let n=gm(e),r=e=>{let t=e.definition.clientGroup,r=(t?n.find(e=>e.definition.id===t)?.definition:void 0)?.displayName??e.definition.displayName,i=n.filter(n=>(n.definition.clientGroup??n.definition.id)===(t??e.definition.id));return e.definition.recordLabel&&i.length>1?`${r} ${e.definition.recordLabel}`:r};return n.flatMap(n=>{let i=ou(n.definition.models,t?.[n.definition.id]),a=r(n);return _m(n).map(t=>({providerId:n.definition.id,variantId:t.variantId,label:`${a}${t.suffix}`,route:n.definition.route,models:i.map(r=>({providerId:n.definition.id,variantId:t.variantId,modelId:r.id,label:r.displayName||r.id,value:pm(n.definition.id,r.id,t.variantId),free:r.free===!0,details:{...r.aaIntelligence===void 0?{}:{intelligence:r.aaIntelligence},...r.aaCoding===void 0?{}:{coding:r.aaCoding},...r.aaOutputTps===void 0?{}:{outputTps:r.aaOutputTps},...r.aaTtft===void 0?{}:{ttft:r.aaTtft},...r.contextWindow===void 0?{}:{contextWindow:r.contextWindow},...r.maxOutputTokens===void 0?{}:{maxOutputTokens:r.maxOutputTokens},...r.supportsThinking===void 0?{}:{thinking:r.supportsThinking},...r.supportsVision===void 0?{}:{vision:r.supportsVision},...r.supportsTools===void 0?{}:{tools:r.supportsTools},...n.definition.id===`oonacode`?r.creditsPerM===void 0?r.free===!0?{creditsPerM:{input:0,output:0}}:{}:{creditsPerM:r.creditsPerM}:{},...r.notes===void 0?{}:{notes:r.notes},...r.auto===!0?{auto:!0}:{},...r.aa===void 0?{}:{aa:r.aa},...r.servedBy===void 0?{}:{providers:r.servedBy.map(t=>{let n=e.find(e=>e.definition.id===t)?.definition,i=n?.displayName??t;if(!r.subscriptionServedBy?.includes(t))return i;let a=n?.credentialVariants?.find(e=>e.id===`token-plan`)?.label;return`${i} — ${a?a.replace(/\s*\(.*\)\s*$/,``):`subscription`}`})}}}))}))}).filter(e=>e.models.length>0)}function bm(e,t){if(!t.providerId||!t.model)return!1;let n=e.find(e=>e.definition.id===t.providerId)?.definition;if(!n||n.models.length===0)return!1;let r=Ys(t.model);if(n.models.some(e=>e.id===r||e.upstreamId===r)||n.modelAliases?.[r]!==void 0||Qs(n,r)!==null)return!1;let i=r.toLowerCase();return!Zs(i)||n.modelAliases?.[i]===void 0&&!n.models.some(e=>e.id.toLowerCase().includes(i))}function xm(e){return e.map((e,t)=>({model:e,index:t})).sort((e,t)=>{if(e.model.details.auto!==t.model.details.auto)return e.model.details.auto?-1:1;let n=e.model.details.intelligence,r=t.model.details.intelligence;return n===void 0&&r===void 0?e.index-t.index:n===void 0?1:r===void 0?-1:r-n||e.index-t.index}).map(e=>e.model)}function Sm(e){return`${e.providerId}:${e.variantId??``}`}function Cm(e,t){let n=ym(e),r=n[0]??null,i=t.model?n.find(e=>e.models.some(e=>e.modelId===t.model)):null,a=t.providerId??i?.providerId??r?.providerId??null,o=t.variantId??(t.providerId?n.find(e=>e.providerId===a)?.variantId??null:i?.variantId??r?.variantId??null);if(!a)return{providerId:null,variantId:o,modelId:t.model??null};let s=e.find(e=>e.definition.id===a)?.definition;return t.model?{providerId:a,variantId:o,modelId:(s?Qs(s,t.model):null)??t.model}:{providerId:a,variantId:o,modelId:s?.defaultModel||n.find(e=>e.providerId===a)?.models[0]?.modelId||null}}function wm(e,t){if(!t)return!1;let n=typeof t==`object`?t.modelId:t;if(!n||e.modelId!==n)return!1;let r=typeof t==`object`?t.providerId??null:null;if(r!==null&&e.providerId!==r)return!1;let i=typeof t==`object`?t.variantId??null:null;return i===null||(e.variantId??null)===i}function Tm(e){return`Remote access is turned off on ${e}, so it cannot be reached from here. Turn it on in OonaCode on that PC — Settings → This PC → Remote access — then try again.`}function Em(e,t,n){switch(e){case`host_offline`:return fm(t);case`host_locked`:return`${t} is locked — unlock it to read its chats.`;case`host_remote_access_off`:return Tm(t);case`host_outdated`:return`${t} runs an older OonaCode — update it there to read its chats from here.`;case`no_answer`:return`${t} did not answer — try again in a moment.`;case`relay_off`:return`Remote access is off on this PC — turn it on in Settings to reach your other PCs.`;case`vault_locked`:return`Unlock your vault to read the chats on your other PCs.`;case`logged_out`:return`Sign in to your OonaCode account to see your other PCs.`;case`gateway_unreachable`:return`Your account server is unreachable right now.`;default:return n??null}}function Dm(e){if(typeof e!=`string`)return null;let t=/^(?:Failed to authenticate\.\s*)?API Error\b:?\s*(?:(\d{3})(?!\d)\s*)?([\s\S]*)$/i.exec(e.trim());return t?{status:t[1]===void 0?null:Number(t[1]),message:(t[2]??``).trim()}:null}function Om(e){return typeof e!=`string`||e===``?!1:/prompt is too long|maximum context length|context[ _-]?length[ _-]?exceeded|input token count exceeds|too many (?:input )?tokens|exceeds? the (?:maximum|model's) context/i.test(e)}var km=`chat too long for this model`;function Am(e){return typeof e!=`string`||e===``?!1:/safeguards? (?:have )?(?:flagged|blocked)/i.test(e)}var jm=`blocked by safeguards`,Mm=`blocked by safety filters`;function Nm(e){return typeof e!=`string`||e===``?!1:/\bnot included in (?:your|the [^.;]*?) plan\b/i.test(e)}var Pm=`not in your plan`;function Fm(e){if(Nm(e))return e.replace(/^\s*Failed to authenticate\.\s*/i,``);let t=Dm(e);if(t){let e=t.message.trim();if(e.startsWith(`{`)||e.startsWith(`[`)||/grok build|usage balance exhausted/i.test(e))return``}return e}function Im(e,t){if(Om(t))return km;if(Am(t))return jm;if(Qc(`API Error ${t??``}`))return Mm;if(Nm(t))return Pm;switch(e){case 400:case 422:return`invalid request`;case 401:return`sign-in needed`;case 402:return`insufficient credits`;case 403:return`not allowed`;case 404:return`model not found`;case 408:case 504:return`timed out`;case 413:return`request too large`;case 429:return`rate limited`;default:return e!==null&&e>=500&&e<=599?`provider error`:`API error`}}var Lm={error_max_turns:`max turns reached`,error_max_budget_usd:`budget reached`,error_during_execution:`error during execution`,error_max_structured_output_retries:`structured output failed`,interrupted:`interrupted`,success:`error`};function Rm(e){if(!e.isError)return e.subtype===`interrupted`?`User requested stop`:`turn complete`;if($c(e.text))return Mm;let t=Dm(e.text);if(t)return Im(t.status,t.message);let n=Lm[e.subtype];if(n!==void 0)return n;let r=e.subtype.replace(/_/g,` `).trim();return r===``?`error`:r}var zm={authentication_failed:`sign-in needed`,billing_error:`billing problem`,rate_limit:`rate limited`,invalid_request:`invalid request`,server_error:`provider error`};function Bm(e,t){if(typeof e!=`string`)return null;let n=e.trim();if(n===``)return null;if(Om(t))return km;if(Am(t))return jm;if(Qc(t)||$c(t))return Mm;if(Nm(t))return Pm;let r=zm[n];if(r!==void 0)return r;if(n===`unknown`){let e=Dm(t);return e?Im(e.status,e.message):Om(t)?km:`error`}return n.replace(/_/g,` `)}function Vm(e){return typeof e==`number`&&Number.isFinite(e)?e:0}function Hm(e,t){let n=typeof e==`object`&&e?e:{},r={input:Vm(n.input_tokens),cached:Vm(n.cache_read_input_tokens)+Vm(n.cache_creation_input_tokens),output:Vm(n.output_tokens)};if(r.input+r.cached+r.output>0||typeof t!=`object`||!t)return r;let i={input:0,cached:0,output:0};for(let e of Object.values(t)){if(typeof e!=`object`||!e)continue;let t=e;i.input+=Vm(t.inputTokens),i.cached+=Vm(t.cacheReadInputTokens)+Vm(t.cacheCreationInputTokens),i.output+=Vm(t.outputTokens)}return i}function Um(e,t){switch(e){case`chat`:return t===`api`?`Messages API`:t===`all`?`Chat turns & Messages API`:`Chat turns`;case`agent-run`:return`Agent API runs`;case`about`:return`Chat "about" (session info)`;case`voice-summary`:return`Voice — summary`;case`voice-translation`:return`Voice — translation`;case`next-prompt`:return`Project manager — suggestions`;case`context-summary`:return`Long-chat summaries`;case`image`:return`Images`;case`video`:return`Video`;case`speech`:return`Speech (text to speech)`;case`transcription`:return`Transcription`;case`audio-translation`:return`Audio translation`;case`voice-design`:return`Custom voices`;case`realtime`:return`Realtime voice`;case`key-check`:return`Key checks`}}function Wm(e,t){switch(e){case`chat`:return t===`api`?`Calls to /v1/messages with your API keys.`:t===`all`?`Chats on the account’s PCs (subagents, titles and page reading included) and /v1/messages calls with its API keys.`:`Your chats — every model call a turn makes, subagents, titles and page reading included.`;case`agent-run`:return`Model calls made by agent-API runs in their sandboxes.`;case`about`:return`The short background summary each chat keeps for your other chats.`;case`voice-summary`:return`Spoken summaries of replies, written by the housekeeper model.`;case`voice-translation`:return`Translation of what was said, done on the server.`;case`next-prompt`:return`What to send a chat next, suggested when you press Suggest or Review.`;case`context-summary`:return`A short summary of the older part of a chat that no longer fits the model’s window, kept so the model does not lose it.`;case`image`:return`Images generated.`;case`video`:return`Videos generated.`;case`speech`:return`Text turned into speech.`;case`transcription`:return`Audio turned into text.`;case`audio-translation`:return`Audio translated into English text.`;case`voice-design`:return`Custom voices made or cloned.`;case`realtime`:return`Live voice sessions, billed by the slice.`;case`key-check`:return`Tests of a key you once added; not charged.`}}var Gm={maxRangeDays:366,maxHourlyRangeDays:31,defaultRangeDays:30,autoHourlyMaxHours:48},Km=`mcp__oonacode__switch_workspace`,qm=`Switch workspace`;function Jm(e){if(e.toolName!==`SwitchWorkspace`)return null;let t=e.input;return!t||typeof t!=`object`||typeof t.from!=`string`||typeof t.to!=`string`?null:{from:t.from,to:t.to,create:t.create===!0}}function Ym(e){return`${e.from} → ${e.to}${e.create?` (new folder)`:``}`}var Xm=`mcp__oonacode__new_chat`,Zm=`New chat`,Qm={titleChars:120,reasonChars:500,promptChars:1e5,perStarter:3,maxDepth:1};function $m(e){return typeof e==`string`?e:null}function eh(e){if(e.toolName!==`NewChat`)return null;let t=e.input;if(!t||typeof t!=`object`)return null;let n=$m(t.title),r=$m(t.prompt),i=$m(t.fromId);return n===null||r===null||i===null?null:{title:n,prompt:r,reason:$m(t.reason)??``,folder:$m(t.folder),model:$m(t.model),providerId:$m(t.providerId),effort:$m(t.effort),project:$m(t.project),temporary:t.temporary===!0,fromId:i,fromTitle:$m(t.fromTitle)??``}}function th(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}function nh(e){return`“${th(e.replace(/["“”]/g,`'`),Qm.titleChars)||`Untitled chat`}”`}function rh(e){return e.folder??`a new workspace of its own`}function ih(e){return`${nh(e.title)} · ${rh(e)} · ${e.model??`default model`}`}var ah=`Started a new chat `,oh=/^Started a new chat “([^”\n]*)” for this task — chat ([0-9A-Za-z-]{8,64})$/;function sh(e){if(typeof e!=`string`)return null;let t=e.trim();if(t.startsWith(`<local-command-stdout>`)&&t.endsWith(`</local-command-stdout>`)&&(t=t.slice(22,t.length-23).trim()),!t.startsWith(ah))return null;let n=oh.exec(t);return n?{title:n[1]??``,sessionId:n[2]}:null}function ch(e,t,n=140){let r=wu({toolName:e,input:t});if(r){let e=`${r.name} ${r.version} (${Cu(r.sizeBytes)}) → ${r.path}`;return e.length>n?`${e.slice(0,n)}…`:e}let i=_u({toolName:e,input:t});if(i){let e=vu(i);return e.length>n?`${e.slice(0,n)}…`:e}let a=Jm({toolName:e,input:t});if(a){let e=Ym(a);return e.length>n?`…${e.slice(e.length-n)}`:e}let o=eh({toolName:e,input:t});if(o){let e=ih(o);return e.length>n?`${e.slice(0,n)}…`:e}let s=e===Km?qm:e===Xm?Zm:e;if(e===Xm){let e=t?.title;if(typeof e==`string`&&e.trim()){let t=e.replace(/\s+/g,` `).trim();return`${s}: ${t.length>n?`${t.slice(0,n)}…`:t}`}}let c=t??{};for(let e of[`command`,`file_path`,`pattern`,`query`,`url`,`path`,`prompt`]){let t=c[e];if(typeof t==`string`&&t.trim().length>0){let e=t.replace(/\s+/g,` `).trim();return`${s}: ${e.length>n?`${e.slice(0,n)}…`:e}`}}return s}var lh=`Set model to `,uh=/[A-Za-z0-9._:@/\\[\]-]+/,dh=/\((\s*previous model was\s+)(\S(?:[^)]*?\S)?)\s*\)/;function fh(e){if(typeof e!=`string`)return null;let t=ph(e);if(!t.startsWith(lh))return null;let n=t.slice(13),r=uh.exec(n);if(!r||r.index!==0)return null;let i=r[0],a=n.slice(i.length),o=dh.exec(a),s=o&&(o[2]??``).trim()||null,c=[],l=(e,t)=>{let n=c[c.length-1];n&&n.kind===e?n.text+=t:t&&c.push({kind:e,text:t})};if(l(`text`,lh),l(`model`,i),o&&s){let e=o.index+1+(o[1]?.length??0);l(`text`,a.slice(0,e)),l(`previous`,s),l(`text`,a.slice(e+s.length))}else l(`text`,a);return{model:i,previous:s,parts:c}}function ph(e){let t=e.trim();return t.startsWith(`<local-command-stdout>`)&&t.endsWith(`</local-command-stdout>`)&&(t=t.slice(22,t.length-23).trim()),t}function mh(){return{photo:0,video:0,audio:0,file:0,link:0}}function hh(e){return`Attached file ${e.name} (${e.mediaType}, ${e.sizeText}) — a local file, its content is NOT included:\n\`${e.path}\`\nWork with the file at that path if the task needs it.`}function gh(e){let t=/^Attached file (.+?) \(([^()\n]*), ([^(),\n]+)\) — a local file, its content is NOT included:\n`([^`\n]+)`/.exec(e);return t?{name:t[1],mediaType:t[2],sizeText:t[3],path:t[4]}:null}function _h(e){let t=/^Attached file ([^\n]+?):\n\n```\n([\s\S]*)\n```$/.exec(e);return t?{name:t[1],content:t[2]}:null}var vh=String.raw`[^\s\\/:*?"<>|()\[\]{}\`',;]`;new RegExp(String.raw`(?<![\w:/.\-~\\])(?:[A-Za-z]:[\\/]|/)(?:${vh}+[\\/])*${vh}+\.([A-Za-z0-9]{2,5})(?![\w/\\]|\.\w)`,`g`);var yh=`oonacode`,bh=Object.freeze({doctor:`off`,"update-config":`off`,"fewer-permission-prompts":`off`,loop:`off`,insights:`off`,"team-onboarding":`off`,"auto-mode-setup":`off`,"keybindings-help":`off`}),xh=Object.freeze({model:{refusedBy:`app`,reason:`Use the model picker under the message box — the chat keeps the model you pick there.`},usage:{aliases:[`cost`,`stats`],refusedBy:`host`,reason:`It shows the engine's own estimate at list prices, not your OonaCode credits — see Credits used in the chat's Session info, and Credits and plan in the title bar.`,terminalReason:`It shows the engine's own estimate at list prices, not your OonaCode credits — /cost shows what this chat was charged.`},autocompact:{refusedBy:`host`,reason:`OonaCode sets the context window from the model's real size at every engine start — nothing to set here.`},"output-style":{refusedBy:`host`,reason:`A style set here is lost at the chat's next engine start — ask the chat to answer in the style you want.`},mcp:{refusedBy:`host`,reason:`OonaCode's tools are switched per chat in the Tools menu under the message box.`},"list-agents":{aliases:[`peers`],refusedBy:`host`,reason:`This chat's subagents are on the agents badge beside the model picker; chats talking to each other are in View → Conversations.`},"reload-skills":{refusedBy:`host`,reason:`OonaCode reloads skills by itself when you import or remove one in Settings → Skills.`}}),Sh=`Needs a Claude account signed in to the engine — OonaCode runs the engine without one.`,Ch=`It reads or edits your own Claude Code install (~/.claude), which OonaCode never touches.`,wh=Object.freeze({clear:{availability:`not-in-oonacode`,reason:`It starts a new engine conversation that this chat would not follow — start a new chat (+) instead.`},fast:{availability:`not-in-oonacode`,reason:`The engine answers "Fast mode is not available in the Agent SDK".`},config:{availability:`not-in-oonacode`,reason:`Claude Code's terminal settings, written to a file OonaCode rebuilds at every engine start — OonaCode's own are in Settings.`},effort:{availability:`not-in-oonacode`,reason:`Use the effort picker under the message box — it is saved with the chat.`},rename:{availability:`not-in-oonacode`,reason:`Rename the chat from its tab or the sidebar — the engine's own title is not the chat's.`},color:{availability:`not-in-oonacode`,reason:`The terminal prompt bar's colour — it belongs to Claude Code's terminal.`},"reload-plugins":{availability:`not-in-oonacode`,reason:`OonaCode loads no plugins — import a plugin's skills in Settings → Skills instead.`},heapdump:{availability:`not-in-oonacode`,reason:`It writes the engine's memory dump to your Desktop — a Claude Code diagnostic.`},agents:{availability:`not-in-oonacode`,reason:`The engine removed this wizard — ask the chat to create a subagent in .claude/agents/.`},"__remote-workflow":{availability:`not-in-oonacode`,reason:`It runs only inside Anthropic's cloud sessions.`},"workflow-launch-exec":{availability:`not-in-oonacode`,reason:`It runs only inside Anthropic's cloud sessions.`},doctor:{availability:`not-in-oonacode`,reason:Ch},"update-config":{availability:`not-in-oonacode`,reason:Ch},"fewer-permission-prompts":{availability:`not-in-oonacode`,reason:Ch},"keybindings-help":{availability:`not-in-oonacode`,reason:Ch},loop:{availability:`not-in-oonacode`,reason:`It schedules through the engine's own cron, which OonaCode turns off — ask the chat to schedule a task; OonaCode's scheduler runs it.`},insights:{availability:`not-in-oonacode`,reason:`It analyses Claude Code's own session files; OonaCode keeps chats in its own database, so the report would be empty.`},"team-onboarding":{availability:`not-in-oonacode`,reason:`It reads usage from Claude Code's own session files, which OonaCode does not keep — there is nothing to read.`},"auto-mode-setup":{availability:`not-in-oonacode`,reason:`Auto mode is not one of OonaCode's postures (${j.map(e=>e.label).join(`, `)}).`},login:{availability:`needs-anthropic-account`,reason:Sh},logout:{availability:`needs-anthropic-account`,reason:Sh},upgrade:{availability:`needs-anthropic-account`,reason:Sh},"extra-usage":{availability:`needs-anthropic-account`,reason:Sh},"rate-limit-options":{availability:`needs-anthropic-account`,reason:Sh},"privacy-settings":{availability:`needs-anthropic-account`,reason:Sh},feedback:{availability:`needs-anthropic-account`,reason:Sh},bug:{availability:`needs-anthropic-account`,reason:Sh},"install-github-app":{availability:`needs-anthropic-account`,reason:Sh},"install-slack-app":{availability:`needs-anthropic-account`,reason:Sh},"remote-control":{availability:`needs-anthropic-account`,reason:Sh},"remote-env":{availability:`needs-anthropic-account`,reason:Sh},"web-setup":{availability:`needs-anthropic-account`,reason:Sh},ultrareview:{availability:`needs-anthropic-account`,reason:Sh},ultraplan:{availability:`needs-anthropic-account`,reason:Sh},passes:{availability:`needs-anthropic-account`,reason:Sh},teleport:{availability:`needs-anthropic-account`,reason:Sh},...Object.fromEntries(Object.entries(xh).map(([e,t])=>[e,{availability:`not-in-oonacode`,reason:t.reason,...t.refusedBy===`app`?{refusedBy:`app`}:{},...t.terminalReason?{terminalReason:t.terminalReason}:{}}]))});Object.freeze({});function mee(e){let t=`${yh}:`;return e.startsWith(t)&&e.length>t.length?e.slice(t.length):null}function hee(e){let t=/^\/([^\s/]*)$/.exec(e);return t?t[1]:null}function Th(e){let t=/^\/([A-Za-z0-9][\w:.-]*)(?:\s|$)/.exec(e.trimStart());return t?t[1]:null}function gee(e,t=`host`){let n=Th(e);if(n===null)return null;let r=wh[n]??wh[vee[n]??``];return!r||r.availability!==`not-in-oonacode`||r.refusedBy===`app`&&t!==`app`?null:{...r,command:n}}function _ee(e){return e.refusedBy===`app`?`/${e.command} is not used here. ${e.reason}`:`/${e.command} is not available in OonaCode. ${e.reason}`}var vee=Object.freeze({reset:`clear`,new:`clear`,settings:`config`,name:`rename`,checkup:`doctor`,proactive:`loop`,...Object.fromEntries(Object.entries(xh).flatMap(([e,t])=>(t.aliases??[]).map(t=>[t,e])))});function yee(e){let t=!1,n=e.map(e=>{if(e.availability!==`ok`||e.source!==`builtin`&&e.source!==`skill`)return e;let n=wh[e.name];if(!n)return e;t=!0;let{note:r,...i}=e;return{...i,availability:n.availability,reason:n.reason}});return t?n:e}function bee(e,t,n=60){let r=t.trim().toLowerCase(),i=e=>[e.name,...e.aliases??[]].map(e=>e.toLowerCase()),a=e=>r.length>0&&i(e).includes(r),o=[[],[],[],[]];for(let t of e){if(t.availability!==`ok`&&!a(t))continue;let e=i(t);r.length===0?o[1].push(t):a(t)?o[0].push(t):e.some(e=>e.startsWith(r))?o[1].push(t):e.some(e=>e.includes(r))?o[2].push(t):t.description.toLowerCase().includes(r)&&o[3].push(t)}return o.flat().slice(0,n)}function xee(e,t){if(!/^\/\S+\s/.test(e))return null;let n=Th(e);return n===null?null:t.find(e=>e.name===n)??t.find(e=>e.aliases?.includes(n))??null}function See(e){switch(e){case`skill`:return`skill`;case`user`:return`your skill`;case`project`:return`project`;case`plugin`:return`plugin`;case`mcp`:return`MCP`;case`other`:return`other`;default:return null}}var Cee=[`skills`,`commands`],wee=Object.freeze({skills:`Skills`,commands:`Commands`});function Tee(e){if(e.modelSkill!==void 0)return`skills`;switch(e.source){case`skill`:case`user`:case`project`:case`plugin`:return`skills`;default:return`commands`}}function Eee(e){let t={skills:[],commands:[]};for(let n of e)t[Tee(n)].push(n);return t}var Dee=/(?:^|[\s(])(?:e\.g|i\.e|etc|vs|cf|incl|approx|fig)$/i;function Oee(e,t=90){let n=(e.split(/\n\s*\n/)[0]??``).replace(/\s+/g,` `).trim(),r=n,i=/[.!?](?=\s|$)|[。!?]/g;for(let e=i.exec(n);e!==null;e=i.exec(n)){let t=n.slice(0,e.index);if(!(e[0]===`.`&&Dee.test(t))){r=(e[0]!==`.`&&e[0]!==`。`?n.slice(0,e.index+1):t).trim();break}}if(r.length<=t)return r;let a=r.slice(0,t-1),o=a.lastIndexOf(` `);return`${(r[t-1]===` `||o<=t*.66?a:a.slice(0,o)).replace(/[\s,;:—–-]+$/,``)}…`}function kee(e){return typeof e==`string`&&/^[A-Za-z0-9][\w.:-]{0,127}$/.test(e)}function Aee(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e)if(kee(n)&&!Object.hasOwn(bh,n)&&(t.add(n),t.size>=200))break;return[...t].sort((e,t)=>e.localeCompare(t))}function jee(e,t,n){let r=new Set(e??[]);return n?r.add(t):r.delete(t),[...r].sort((e,t)=>e.localeCompare(t))}function Eh(e,t){return(e??[]).includes(t)}function Mee(e,t){let n=new Set(t??[]);if(n.size===0)return 0;let r=408;for(let t of e)n.has(t.name)&&(r+=t.tokens);return r}function Nee(e,t){let n=[...new Set(t??[])];return{count:n.length,label:`Skills · ${n.length}`,title:n.length>0?`The model may use on its own in this chat: ${n.map(t=>e?.find(e=>e.name===t)?.label??t).join(`, `)}`:`The model uses no skill on its own in this chat — type /name to use one once`}}function Pee(e){let t=Aee(e??[]);return t.length>0?{modelSkills:t}:{}}var Fee=`Every skill is always in the / menu — type it to use it once. Switch one on to let the model reach for it by itself in this chat (it then costs its tokens on every message).`,Iee=`Switching a skill restarts this chat's agent: the skill list is part of the prompt, so its next message re-reads the conversation once.`,Lee=`The first skill switched on also brings back the engine's Skill tool (≈388 tokens per request).`;function Ree(e){switch(e){case`user`:return`Yours`;case`project`:return`Project`;case`plugin`:return`Plugin`;case`mcp`:return`MCP`;case`skill`:case`builtin`:return`Built in`;default:return`Other`}}function zee(e){switch(e){case`user`:return`One of your own skills — OonaCode's skills folder (Settings → Skills), on every chat of this PC.`;case`project`:return"This project's own — its `.claude/skills` (or `.claude/commands`) folder.";case`skill`:case`builtin`:return`Built into the coding engine OonaCode runs for every model.`;case`plugin`:return`From a plugin the engine loaded.`;case`mcp`:return`From an MCP server of this chat.`;default:return`Found by the engine in this chat’s configuration.`}}function Bee(e,t){let n=[];return e.description.trim()&&n.push(e.description.trim(),``),n.push(`**Where it comes from.** ${zee(e.source)}`,``),n.push(e.typeable?`**Once, by typing it.** Type \`/${e.label}\` (or pick it in the / menu) and the engine loads it for that message only — whether this switch is on or off, at no cost to any other message.`:`**It cannot be typed.** Its author made it for the model only, so the switch is the only way to use it.`,``),n.push(t?`**On in this chat.** The model sees its name and description on every message here and may load it by itself when it fits.`:`**Off in this chat.** The model is not told it exists here. Switch it on to let the model reach for it by itself.`,``),n.push(`**What it costs while on.** ≈${e.tokens.toLocaleString(`en-US`)} tokens on every request of this chat (and the engine's Skill tool, ≈388, for the first skill on). Switching restarts the chat's agent; its next message re-reads the conversation once.`),n.join(`
|
|
116
|
-
`)}var Vee=/^[A-Za-z0-9][\w.:@+\-/]*(?:\[[0-9a-z]+\])?$/;function Dh(e){return e.length>0&&e.length<=200&&Vee.test(e)&&!e.endsWith(`/`)&&!e.includes(`//`)}function Oh(e){let t=e.indexOf(`/`);return t<=0||t===e.length-1?null:{prefix:e.slice(0,t).toLowerCase(),model:e.slice(t+1)}}function Hee(e,t,n){let r={providerId:t.providerId,variantId:t.variantId??null},i=Oh(e);return!i||!n.includes(i.prefix)?{...r,model:e}:i.prefix===t.providerId?{...r,model:i.model}:t.providerId===`oonacode`?{...r,model:e}:{providerId:i.prefix,variantId:null,model:i.model}}function Uee(e,t){let n=t.variantId??null;if(t.providerId===`oonacode`)return{providerId:t.providerId,variantId:n,model:e};let r=Oh(e),i=r&&r.prefix===t.providerId.toLowerCase()?r.model:e;return{providerId:t.providerId,variantId:n,model:i}}function kh(e){return`${e} (custom)`}var Wee=5e5,Ah=e=>Ys(e).trim().toLowerCase(),jh=new Map;function Gee(e){e&&(jh=new Map(e.map(e=>[Ah(e.id),e])))}function Mh(e){return typeof e==`string`&&e!==``?jh.get(Ah(e))??null:null}function Kee(e){let t=Mh(e);return t?t.contextWindow:Nh(e)?Wee:null}var qee=[`low`,`medium`,`high`];function Nh(e){return typeof e==`string`&&Ys(e).toLowerCase().startsWith(`google-claude-`)}function Jee(e){let t=Mh(e);return t?.effortLevels&&t.effortLevels.length>0?t.effortLevels:Nh(e)?qee:null}function Yee(e,t){return e?ke(e):Jee(t)??[]}var Ph=`google-agy`;function Fh(e){return e===Ph}var Xee=[`build`,`auto`];function Ih(e){return Fh(e)?j.filter(e=>Xee.includes(e.id)):j}var Lh=`Google’s agy cannot ask for permission while OonaCode drives it, so this chat offers Build (agy may edit files; a command it wants to run is declined and reported) and Autonomous (agy may run everything).`,Zee=`Sign in on Google’s own page with your own Google account. Google then shows you a one-time code: paste it here. OonaCode never sees your password, and your sign-in stays on this PC.`;function Rh(e){return typeof e==`string`&&e.length>=8&&e.length<=512&&/^[A-Za-z0-9/_.~%+=-]+$/.test(e)}var zh={"x-client-id":`tbh:exec`,"user-agent":`muse-build/1.4.13 (non-interactive; linux-x86_64; build 39490bd065c800195489caec34473582f7650b54)`};/^muse-build\/(\S+)/.exec(zh[`user-agent`])[1],/build ([0-9a-f]{40})\)/.exec(zh[`user-agent`])[1];function Bh(e){try{let t=new URL(e),n=t.hostname.toLowerCase();return t.protocol===`https:`&&(n===`meta.com`||n.endsWith(`.meta.com`))}catch{return!1}}var Qee=`auto`,Vh=`Auto`;function Hh(e,t){return e===`oonacode`&&t===`auto`}function $ee(e){let t=e?.trim();return t?`${Vh} (${t})`:Vh}var Uh={complete:`/api/v1/account/vault/rekey-complete`,revoke:`/api/v1/account/vault/rekey-revoke`,deviceUnlock:`/api/v1/account/device-unlock`};function Wh(e){return e?.deviceUnlock??`off`}function Gh(e){if(!e?.loggedIn)return null;let t=e;if(t.vaultStatus!==`pending_rekey`)return null;let n=t.vaultRekeyPending??null;return{pending:n,canFinishHere:t.canFinishRekey===!0,trustedDevices:n?.trustedDevices.map(e=>e.label||e.name)??[],since:n?.since??null,from:ete(n)}}function ete(e){if(!e)return null;let t=e.requestedFrom.device?.trim()||null,n=e.requestedFrom.ip?.trim()||null;return t&&n?`${t} (${n})`:t??n}function Kh(e){if(!e)return`an unknown date`;let t=Date.parse(e);if(Number.isNaN(t))return`an unknown date`;try{return new Date(t).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}catch{return new Date(t).toISOString()}}function qh(e){let t=e.from?` from ${e.from}`:``;return`A password reset was started on ${Kh(e.since)}${t}. Your saved provider keys are still sealed under the old password.`}function Jh(e){return e.trustedDevices.length===0?`No device with "keep me unlocked" is left, so nothing here holds the key from before the reset.`:`Open OonaCode on ${Xh(e.trustedDevices)} to finish the reset — your saved keys are waiting there.`}var Yh=`Either way, your vault Recovery Key still works: sign in on the OonaCode website from any device and finish the reset there. Discarding is the last resort — it deletes your saved provider keys and that Recovery Key for good. Your chats stay on your PCs.`;function Xh(e){return e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)} or ${e[e.length-1]}`}function Zh(e){return e.canFinishHere?`A password reset is waiting: this PC can move your vault to the new password.`:e.trustedDevices.length>0?`A password reset is waiting — your saved keys stay locked until it is finished on ${Xh(e.trustedDevices)}.`:`A password reset is waiting and no PC holds the old key — finish it with your vault Recovery Key on the OonaCode website.`}var Qh=class extends Error{code;status;details;constructor(e,t,n,r){super(n),this.name=`HostApiError`,this.code=e,this.status=t,this.details=r}get isUnauthorized(){return this.status===401||this.code===`unauthorized`}get isEmailNotVerified(){return this.code===`email_not_verified`}};function $h(e){if(!e)return``;let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!=null&&r!==``&&t.set(n,String(r));let n=t.toString();return n?`?${n}`:``}function eg(e){return e.trim().replace(/\/+$/,``)}function tg(e,t){let n=eg(e.baseUrl),r=t??((e,t)=>fetch(e,t));async function i(t,i,a,o={}){let s={Authorization:`Bearer ${e.token}`,Accept:o.raw||o.bytes?`*/*`:`application/json`},c={method:t,headers:s,credentials:`omit`};o.signal&&(c.signal=o.signal),a!==void 0&&(s[`Content-Type`]=`application/json`,c.body=JSON.stringify(a));let l;try{l=await r(`${n}${i}`,c)}catch(e){throw new Qh(`network`,0,`Cannot reach the host at ${n}: ${String(e?.message??e)}`)}if(!l.ok){let e=null,t=``;try{t=await l.text(),e=t?JSON.parse(t):null}catch{e=null}let n=e?.error?.code??(l.status===401?`unauthorized`:`internal`),r=e?.error?.message??(t||`${l.status} ${l.statusText}`);throw new Qh(n,l.status,r,e?.error?.details)}if(o.bytes)return await l.arrayBuffer();if(o.raw)return await l.text();if(l.status===204)return;let u=await l.text();if(u)try{return JSON.parse(u)}catch{throw new Qh(`parse`,l.status,`Host returned malformed JSON for ${t} ${i}`)}}let a=Ge;return{health:()=>i(a.health,z.health),info:()=>i(a.info,z.info),listSessions:e=>i(a.listSessions,`${z.sessions}${$h(e)}`),createSession:e=>i(a.createSession,z.sessions,e),getSession:e=>i(a.getSession,z.session(e)),updateSession:(e,t)=>i(a.updateSession,z.session(e),t),deleteSession:e=>i(a.deleteSession,z.session(e)),exportSessionsArchive:async t=>{let i=await r(`${n}${z.sessionsExportArchive}`,{method:`POST`,credentials:`omit`,headers:{Authorization:`Bearer ${e.token}`,Accept:`application/zip`,"Content-Type":`application/json`},body:JSON.stringify({password:t})});if(!i.ok){let e=await i.text().catch(()=>``),t=null;try{t=e?JSON.parse(e):null}catch{t=null}throw new Qh(t?.error?.code??`internal`,i.status,t?.error?.message??e??`the export failed`)}return i.blob()},listEntries:(e,t)=>i(a.listEntries,`${z.sessionEntries(e)}${$h(t)}`),listMessages:e=>i(a.listMessages,z.sessionMessages(e)),prompt:(e,t)=>i(a.prompt,z.sessionPrompt(e),{...t,stream:!1}),interrupt:e=>i(a.interrupt,z.sessionInterrupt(e),{}),cancelQueued:(e,t)=>i(a.cancelQueued,z.sessionQueued(e,t)),sendQueuedNow:(e,t)=>i(a.sendQueuedNow,z.sessionQueuedNow(e,t),{}),sendQueuedNowAll:e=>i(a.sendQueuedNowAll,z.sessionQueuedNowAll(e),{}),forkSession:(e,t)=>i(a.fork,z.sessionFork(e),t??{}),removeEntries:(e,t)=>i(a.removeEntries,z.sessionRemove(e),t),undoModelChange:(e,t)=>i(a.undoModelChange,z.sessionModelUndo(e),{uuid:t}),exportSession:(e,t)=>i(a.export,`${z.sessionExport(e)}${$h(t)}`,void 0,{raw:!0}),listProjects:()=>i(a.listProjects,z.projects),listAiToolGrants:()=>i(a.listAiToolGrants,z.aiToolGrants),createAiToolGrant:e=>i(a.createAiToolGrant,z.aiToolGrants,e),revokeAiToolGrant:e=>i(a.revokeAiToolGrant,z.aiToolGrant(e)),listVaultProjects:()=>i(a.listVaultProjects,z.vaultProjects),createVaultProject:e=>i(a.createVaultProject,z.vaultProjects,e),updateVaultProject:(e,t)=>i(a.updateVaultProject,z.vaultProject(e),t),deleteVaultProject:e=>i(a.deleteVaultProject,z.vaultProject(e)),listStickyNotes:()=>i(a.listStickyNotes,z.vaultNotes),createStickyNote:e=>i(a.createStickyNote,z.vaultNotes,e),updateStickyNote:(e,t)=>i(a.updateStickyNote,z.vaultNote(e),t),deleteStickyNote:e=>i(a.deleteStickyNote,z.vaultNote(e)),listScheduledTasks:(e={})=>{let t=new URLSearchParams;e.sessionId&&t.set(`sessionId`,e.sessionId),e.projectId&&t.set(`projectId`,e.projectId);let n=t.toString();return i(a.listScheduledTasks,n?`${z.scheduledTasks}?${n}`:z.scheduledTasks)},createScheduledTask:e=>i(a.createScheduledTask,z.scheduledTasks,e),updateScheduledTask:(e,t)=>i(a.updateScheduledTask,z.scheduledTask(e),t),deleteScheduledTask:e=>i(a.deleteScheduledTask,z.scheduledTask(e)),listConversations:(e={})=>i(a.listConversations,`${z.conversations}${$h({sessionId:e.sessionId})}`),getConversation:e=>i(a.getConversation,z.conversation(encodeURIComponent(e))),conversationAction:(e,t,n)=>i(a.conversationAction,z.conversationAction(encodeURIComponent(e),t),n??{}),stopAllConversations:()=>i(a.stopAllConversations,z.conversationsStopAll,{}),cancelChatMessage:e=>i(a.cancelChatMessage,z.chatMessage(encodeURIComponent(e))),getChatAbout:e=>i(a.getChatAbout,z.sessionAbout(encodeURIComponent(e))),updateChatAbout:(e,t)=>i(a.updateChatAbout,z.sessionAbout(encodeURIComponent(e)),t),regenerateChatAbout:e=>i(a.regenerateChatAbout,z.sessionAboutRegenerate(encodeURIComponent(e)),{}),listChatAbouts:()=>i(a.listChatAbouts,z.chatAbouts),generateAllChatAbouts:()=>i(a.generateAllChatAbouts,z.chatAboutsGenerateAll,{}),stopGenerateAllChatAbouts:()=>i(a.stopGenerateAllChatAbouts,z.chatAboutsGenerateAllStop,{}),generateChatAbouts:e=>i(a.generateChatAbouts,z.chatAboutsGenerate,e),planChatAboutTranslations:e=>i(a.planChatAboutTranslations,z.chatAboutsTranslationPlan,e),translateChatAbout:(e,t)=>i(a.translateChatAbout,z.sessionAboutTranslation(encodeURIComponent(e)),t),getAgyStatus:e=>i(`GET`,`${z.agyStatus}${$h(e?.refresh?{refresh:1}:void 0)}`),listAgyRequests:e=>i(`GET`,z.agyRequests(encodeURIComponent(e))),getAgyRequestBody:(e,t)=>i(`GET`,z.agyRequestBody(encodeURIComponent(e),encodeURIComponent(t))),getProviderUsage:(e,t)=>i(`GET`,`${z.providerUsage(encodeURIComponent(e))}${t?.refresh?`?refresh=1`:``}`),agyInstall:()=>i(`POST`,z.agyInstall),cancelAgyInstall:()=>i(`DELETE`,z.agyInstall),agyLogin:()=>i(`POST`,z.agyLogin),cancelAgyLogin:()=>i(`DELETE`,z.agyLogin),museSetup:()=>i(`GET`,z.museSetup),museLoginStart:()=>i(`POST`,z.museLogin),museLoginCancel:()=>i(`DELETE`,z.museLogin),submitAgyLoginCode:e=>i(`POST`,z.agyLoginCode,{code:e}),listVoiceSummaries:e=>i(a.listVoiceSummaries,z.sessionVoiceSummaries(encodeURIComponent(e))),createVoiceSummary:(e,t)=>i(a.createVoiceSummary,z.sessionVoiceSummaries(encodeURIComponent(e)),t),deleteVoiceSummary:(e,t)=>i(a.deleteVoiceSummary,z.sessionVoiceSummary(encodeURIComponent(e),encodeURIComponent(t))),translateVoiceSummary:(e,t,n)=>i(a.translateVoiceSummary,z.sessionVoiceSummaryTranslations(encodeURIComponent(e),encodeURIComponent(t)),n),listNextPrompts:()=>i(`GET`,z.nextPrompts),getNextPrompt:e=>i(`GET`,z.sessionNextPrompt(encodeURIComponent(e))),suggestNextPrompt:(e,t)=>i(`POST`,z.sessionNextPrompt(encodeURIComponent(e)),t),reviewNextPrompts:e=>i(`POST`,z.nextPromptsReview,e),stopNextPromptReview:()=>i(`POST`,z.nextPromptsReviewStop),markNextPromptSent:(e,t)=>i(`POST`,z.sessionNextPromptSent(encodeURIComponent(e)),t),markSessionSeen:e=>i(`POST`,z.sessionSeen(encodeURIComponent(e))),getGithubLink:()=>i(a.getGithubLink,z.githubLink),searchEntries:e=>i(a.searchEntries,`${z.sessionSearch}${$h(e)}`),startGithubLink:()=>i(a.startGithubLink,z.githubLinkStart,{}),cancelGithubLink:()=>i(a.cancelGithubLink,z.githubLinkStart),unlinkGithub:()=>i(a.unlinkGithub,z.githubLink),scanClaudeSessions:()=>i(a.scanClaudeSessions,z.importClaude),importClaudeSessions:e=>i(a.importClaudeSessions,z.importClaude,e??{}),searchImportChats:(e,t)=>i(a.searchImportChats,`${z.importSearch}${$h(e)}`,void 0,t?{signal:t}:{}),sessionLink:e=>i(a.sessionLink,z.sessionLink(e)),syncSessionDown:e=>i(a.syncSessionDown,z.sessionSyncDown(e),{}),inspectProject:e=>i(a.inspectProject,`${z.projectInspect}${$h(e)}`),attachSessionProject:(e,t)=>i(a.attachSessionProject,z.sessionProject(e),t),listAgentTools:()=>i(`GET`,z.agentTools),mediaOptions:(e,t)=>i(`GET`,`${z.mediaOptions}${$h({model:e??void 0,provider:t??void 0})}`),listConnectors:()=>i(`GET`,z.connectors),signInConnector:(e,t)=>i(`POST`,z.connectorSignIn(encodeURIComponent(e)),t),updateConnector:(e,t)=>i(`PATCH`,z.connector(encodeURIComponent(e)),t),signOutConnector:e=>i(`DELETE`,z.connector(encodeURIComponent(e))),installConnectorSkills:e=>i(`POST`,z.connectorSkills(encodeURIComponent(e)),{}),listMcpServers:()=>i(`GET`,z.mcpServers),createMcpServer:e=>i(`POST`,z.mcpServers,e),updateMcpServer:(e,t)=>i(`PATCH`,z.mcpServer(encodeURIComponent(e)),t),deleteMcpServer:e=>i(`DELETE`,z.mcpServer(encodeURIComponent(e))),testMcpServer:e=>i(`POST`,z.mcpServerTest(encodeURIComponent(e))),testMcpConfig:e=>i(`POST`,z.mcpServerTestDraft,e),listSessionCommands:e=>i(a.listSessionCommands,z.sessionCommands(encodeURIComponent(e))),listCommands:e=>i(a.listCommands,`${z.commands}${$h(e)}`),listSessionChatSkills:e=>i(a.listSessionChatSkills,z.sessionModelSkills(encodeURIComponent(e))),listChatSkills:e=>i(a.listChatSkills,`${z.modelSkills}${$h(e)}`),listSkills:()=>i(a.listSkills,z.skills),deleteSkill:e=>i(a.deleteSkill,z.skill(e)),scanClaudeSkills:()=>i(a.scanClaudeSkills,z.importClaudeSkills),importClaudeSkills:e=>i(a.importClaudeSkills,z.importClaudeSkills,e),listProviders:()=>i(a.listProviders,z.providers),setActiveProvider:e=>i(a.setActiveProvider,z.providersActive,e),testProvider:e=>i(a.providerTest,z.providerTest(e),{}),probeCredential:(e,t)=>i(a.providerProbe,z.providerProbe(e),t),listModels:e=>i(a.listModels,`${z.models}${$h(e)}`),getSettings:()=>i(a.getSettings,z.settings),updateSettings:e=>i(a.updateSettings,z.settings,e),getAccount:()=>i(a.getAccount,z.account),login:e=>i(a.login,z.accountLogin,e),logout:()=>i(a.logout,z.accountLogout,{}),unlock:e=>i(a.unlock,z.accountUnlock,e),lock:()=>i(`POST`,z.accountLock,{reason:`user`}),plan:()=>i(`GET`,z.accountPlan),accountUsage:e=>i(`GET`,`${z.accountUsage}${$h({...e})}`),remoteUnlockHost:(e,t)=>i(`POST`,z.hostVaultUnlock(e),{password:t}),resendVerification:e=>i(a.resendVerification,z.accountResendVerification,e),startAccountLink:e=>i(a.linkStart,z.accountLinkStart,e??{}),accountLinkStatus:()=>i(a.linkStatus,z.accountLinkStatus),cancelAccountLink:()=>i(a.linkCancel,z.accountLinkCancel,{}),completeVaultRekey:e=>i(`POST`,Uh.complete,e),revokeVaultRekey:e=>i(`POST`,Uh.revoke,e),setDeviceUnlock:e=>i(`POST`,Uh.deviceUnlock,e),listCredentials:()=>i(a.listCredentials,z.credentials),addCredential:e=>i(a.addCredential,z.credentials,e),deleteCredential:e=>i(a.deleteCredential,z.credential(e)),testCredential:e=>i(a.credentialTest,z.credentialTest(e),{}),syncNow:()=>i(a.syncNow,z.syncNow,{}),claudeSubscriptionLogin:()=>i(a.claudeLogin,z.subscriptionClaudeLogin,{}),claudeSubscriptionStatus:()=>i(a.claudeStatus,z.subscriptionClaudeStatus),claudeLoginState:()=>i(a.claudeLoginState,z.subscriptionClaudeLoginState),claudeLoginCode:e=>i(a.claudeLoginCode,z.subscriptionClaudeLoginCode,e),claudeLoginCancel:()=>i(a.claudeLoginCancel,z.subscriptionClaudeLoginCancel,{}),oauthLoginStart:e=>i(a.oauthLogin,z.subscriptionOauthLogin(e),{}),oauthLoginState:e=>i(a.oauthLoginState,z.subscriptionOauthLoginState(e)),oauthLoginCancel:e=>i(a.oauthLoginCancel,z.subscriptionOauthLoginCancel(e),{}),doctor:()=>i(a.doctor,z.doctor),listHosts:()=>i(a.listHosts,z.hosts),listHostSessions:e=>i(a.listHostSessions,z.hostSessions(e)),deleteHostSession:(e,t)=>i(a.deleteHostSession,z.hostSession(e,t),{method:`DELETE`}),updateHost:(e,t)=>i(a.updateHost,z.host(e),t),listHostSessionEntries:(e,t,n)=>i(a.listHostSessionEntries,`${z.hostSessionEntries(e,t)}${$h(n)}`),updateHostSession:(e,t,n)=>i(`PATCH`,z.hostSession(e,t),n),forkHostSession:(e,t)=>i(`POST`,z.hostSessionFork(e,t),{}),listHostSessionFiles:(e,t,n)=>i(`GET`,`${z.hostSessionFiles(e,t)}${$h({path:n})}`),readHostSessionFile:(e,t,n)=>i(`GET`,`${z.hostSessionFile(e,t)}${$h({path:n})}`,void 0,{raw:!0}),readHostSessionFileBytes:(e,t,n)=>i(`GET`,`${z.hostSessionFile(e,t)}${$h({path:n})}`,void 0,{bytes:!0}),deleteHostSessionFile:(e,t,n)=>i(`DELETE`,`${z.hostSessionFile(e,t)}${$h({path:n})}`),inspectHostProject:(e,t)=>i(`GET`,`${z.hostProjectsInspect(e)}${$h({dir:t})}`),reportError:e=>i(a.errorReport,z.errorReport,e),sendBugReport:e=>i(a.bugReport,z.bugReport,e),listSessionFiles:(e,t)=>i(a.listSessionFiles,`${z.sessionFiles(e)}${$h({path:t})}`),readSessionFile:(e,t)=>i(a.readSessionFile,`${z.sessionFile(e)}${$h({path:t})}`,void 0,{raw:!0}),readSessionFileBytes:(e,t)=>i(a.readSessionFile,`${z.sessionFile(e)}${$h({path:t})}`,void 0,{bytes:!0}),deleteSessionFile:(e,t)=>i(a.deleteSessionFile,`${z.sessionFile(e)}${$h({path:t})}`),renameSessionFile:(e,t,n)=>i(a.renameSessionFile,`${z.sessionFile(e)}/rename`,{path:t,name:n}),searchSessionFiles:(e,t)=>i(a.searchSessionFiles,`${z.sessionFileSearch(e)}${$h({q:t.q,case:t.caseSensitive?`1`:void 0,word:t.wholeWord?`1`:void 0,max:t.max})}`),writeSessionFileText:(e,t,n)=>i(a.writeSessionFileText,`${z.sessionFile(e)}/text`,{path:t,text:n}),readLocalTextFile:(e,t)=>i(a.readLocalFile,`${z.sessionLocalFileText(e)}${$h({path:t})}`),listSavedPrompts:e=>i(a.listSavedPrompts,z.sessionSavedPrompts(e)),saveSavedPrompt:(e,t)=>i(a.saveSavedPrompt,z.sessionSavedPrompts(e),{text:t}),deleteSavedPrompt:(e,t)=>i(a.deleteSavedPrompt,z.sessionSavedPrompt(e,t)),grantLocalFile:async(e,t)=>{let r=await i(a.grantLocalFile,z.sessionLocalFileGrant(e),{path:t});return{...r,url:/^https?:/i.test(r.url)?r.url:`${n}${r.url}`}},listChatMedia:(e,t)=>i(a.listChatMedia,`${z.sessionMedia(e)}${$h(t?{...t}:void 0)}`),readChatMedia:(e,t)=>i(a.readChatMedia,z.sessionMediaContent(e,encodeURIComponent(t)),void 0,{bytes:!0}),grantChatMedia:async e=>{let t=await i(a.grantChatMedia,z.sessionMediaGrant(e));return{expiresAt:t.expiresAt,urlOf:r=>`${n}${z.sessionMediaContent(encodeURIComponent(e),encodeURIComponent(r))}?grant=${encodeURIComponent(t.grant)}`}},statLocalPaths:(e,t)=>i(a.statLocalPaths,z.sessionLocalFileStat(e),{paths:t}),saveTmpFile:e=>i(`POST`,z.saveTmpFile,e)}}function ng(e){return e instanceof Qh&&(e.status===404||e.status===501)}var rg=120;function tte(){return rg}function ig(e){let t=e.batchMs??120,n=e.hiddenBatchMs??1e3,r=e.isHidden??(()=>!1),i=e.now??(()=>Date.now()),a=e.setTimeout??((e,t)=>setTimeout(e,t)),o=e.clearTimeout??(e=>clearTimeout(e)),s=[],c=null,l=-1/0,u=!1,d=()=>{if(c!==null&&(o(c),c=null),s.length===0)return;let t=s;s=[],l=i(),e.deliver(t)};return{push(o){if(u)return;if(s.push(o),!e.isStreamFrame(o)){d();return}let f=r()?n:t;if(f<=0){d();return}if(c!==null)return;let p=i()-l;if(p>=f){d();return}c=a(()=>{c=null,d()},f-p)},flush:d,dispose(){u=!0,c!==null&&o(c),c=null,s=[]}}}function nte(e,t,n){if((t.providerId??``)!==e.providerId)return!1;if(Hh(e.providerId,e.model))return t.autoModel!==void 0;if(e.variantId!==void 0&&(t.variantId??null)!==(e.variantId??null)||!t.model)return!1;let r=Ys(t.model),i=Ys(e.model);if(r===i)return!0;let a=n.find(t=>t.definition.id===e.providerId)?.definition;return a!==void 0&&Gs(a,i)===r}function ag(e){return e instanceof Qh&&e.code===`email_not_verified`}function rte(e){if(!ag(e))return null;let t={error:{code:e.code,message:e.message,details:e.details}};return A(t)?t.error.details:null}function ite(e){let t=e.trim(),n=t.indexOf(`@`);return n<=0?`***`:`${t.slice(0,1)}***${t.slice(n)}`}function og(e,t){return e===void 0||!Number.isFinite(e)||e<=0?t:t+Math.ceil(e)*1e3}function ate(e,t){return Math.max(0,Math.ceil((e.resendAt-t)/1e3))}function ote(e,t){if(!ag(e))return null;let n=t.now??Date.now(),r=rte(e),i=t.email.trim();return{email:i,displayEmail:r?.email||ite(i),verification:r?.verification??`pending`,registered:t.registered===!0,resendAt:og(r?.resendAfterSec,n)}}function ste(e){let t=e.registered?`Account created. `:``;return e.verification===`unverified`?`${t}Confirm your email first — no link is outstanding for ${e.displayEmail}; send a new one.`:`${t}Confirm your email first — we sent a link to ${e.displayEmail}.`}var sg=`new-chat`,cg=`safeguard-fallback`,cte=`safeguard-no-fallback`,lte=3e4;function lg(e,t){return e.filter(e=>t-e.at<=lte)}function ug(e=null){return{sessionId:e,session:null,items:[],index:new Map,status:`idle`,activeTurnId:null,init:null,statusText:null,pendingPermissions:[],lastSeq:null,totals:{costUsd:0,inputTokens:0,cachedInputTokens:0,outputTokens:0,turns:0},turnCachedTokens:0,contextTokens:null,hydrated:!1,agentActivity:{},hasSubagentItems:!1,hasOptimisticUser:!1,earlyDeliveries:[],lastLocalPromptId:null,lastFrameAt:null,lastLiveUuid:null,engineSince:null,safeguardFallback:null,subpathParents:{},seen:new Set,streams:{},nextId:1}}function dg(e,t){let n=e.agentActivity[t.agentId],r={subpath:t.subpath,firstAt:n?Math.min(n.firstAt,t.at):t.at,at:n?Math.max(n.at,t.at):t.at,finished:t.finished,toolUses:(n?.toolUses??0)+t.toolUses};return{...e,agentActivity:{...e.agentActivity,[t.agentId]:r}}}function fg(e,t,n,r,i,a){let o=d_.exec(t)?.[2];if(!o)return e;let s=i&&Date.parse(i)||0;if(n!==`assistant`)return dg(e,{agentId:o,subpath:t,at:s,finished:e.agentActivity[o]?.finished??!1,toolUses:0});let c=(Array.isArray(r)?r:[]).filter(e=>e.type===`tool_use`),l=c.length===0;return typeof a==`string`&&(l=a===`end_turn`||a===`stop_sequence`),c.some(e=>e.name===`StructuredOutput`)&&(l=!0),dg(e,{agentId:o,subpath:t,at:s,finished:l,toolUses:c.length})}function pg(e,t){switch(t.type){case`frame`:return _g(e,t.frame,t.receivedAt);case`hydrate`:return i_(a_(e,t.messages,t.session??null),t.contextTokens);case`entries`:return s_(e,t.entries);case`prepend_entries`:return c_(e,t.entries);case`session`:return g_(e,t.session);case`local_prompt`:return v_(e,t);case`local_prompt_failed`:return b_(e,t.requestId);case`local_permission`:return r_(e,t.requestId,t.behavior,`local`);case`local_system`:{let n={kind:`system`,id:`sys:${e.nextId}`,uuid:null,parentToolUseId:null,turnId:null,timestamp:null,subtype:t.subtype,text:t.text};return D_({...e,nextId:e.nextId+1},n)}case`model_picked`:return mg(e,{type:`model_change`});case`settle_waiting`:return qg(e,t.requestId);case`reset`:return ug(e.sessionId)}}function mg(e,t){let n=cl(e.safeguardFallback,t);return n===e.safeguardFallback?e:{...e,safeguardFallback:n}}function hg(e){return/^Set model to\s/.test(e)}function gg(e,t,n){let r=n.uuid?`sys:${n.uuid}`:`sys:${e.nextId}`;if(e.index.get(r)!==void 0)return e;let i=e;if(t.retractedUuids.length>0){let e=new Set(t.retractedUuids),n=new Set(i.items.filter(t=>t.uuid!==null&&e.has(t.uuid)).map(e=>e.id));n.size>0&&(i=k_(i,n))}let a={kind:`system`,id:r,uuid:n.uuid,parentToolUseId:n.parentToolUseId,turnId:n.turnId,timestamp:n.timestamp,subtype:t.kind===`fallback`?cg:cte,text:t.text,refusal:t,...t.kind===`no_fallback`?{refusalBefore:i.safeguardFallback?.notice??null}:{}};if(i=D_(n.uuid?i:M_(i),a),n.parentToolUseId!==null)return i;let o=n.timestamp?Date.parse(n.timestamp):NaN;return mg(i,{type:`notice`,notice:t,at:Number.isFinite(o)?o:null,live:n.live})}function _g(e,t,n){let r=Sg(e,t,n);if(n===void 0||!yg(t,e,r))return r;let i=r.lastFrameAt;return i!==null&&n>=i&&n-i<1e3?r:{...r,lastFrameAt:n}}function vg(e){return e===`running`||e===`waiting_permission`}function yg(e,t,n){switch(e.type){case`agent`:return e.seq===null?e.message.type!==`system`||e.message.subtype!==`local_command`:!1;case`turn_started`:case`turn_finished`:case`prompt_delivered`:case`subagent_activity`:return!0;case`permission_request`:return n!==t;case`permission_resolved`:return!0;default:return!1}}function bg(e){if(e.lastFrameAt!==null||!e.hydrated||!vg(e.status))return e;let t=e.engineSince??0;for(let n=e.items.length-1;n>=0;n--){let r=e.items[n].timestamp,i=r?Date.parse(r):NaN;if(Number.isFinite(i)){i>t&&(t=i);break}}for(let n of Object.values(e.agentActivity))n.at>t&&(t=n.at);return t>0?{...e,lastFrameAt:t}:e}function xg(e,t,n){return t!==null||n===void 0||typeof e.timestamp==`string`?e:{...e,timestamp:new Date(n).toISOString()}}function Sg(e,t,n){switch(t.type){case`agent`:{if(t.seq!==null&&e.seen.has(`seq:${t.seq}`))return e;let r=Cg(e,xg(t.message,t.seq,n),{turnId:t.turnId,receivedAt:n,live:t.seq===null});return t.seq!==null&&(r=j_(r,`seq:${t.seq}`),(r.lastSeq===null||t.seq>r.lastSeq)&&(r={...r,lastSeq:t.seq})),r}case`turn_started`:{let n=`turnstart:${t.turnId}`;if(e.seen.has(n))return e;let r=j_(e,n);if(r={...r,activeTurnId:t.turnId,status:`running`,statusText:null,turnCachedTokens:0},t.requestId){let e=r.items.findIndex(e=>e.kind===`user`&&e.requestId===t.requestId);if(e>=0){let n={...r.items[e],turnId:t.turnId,waiting:!1};r=e<r.items.length-1?D_(k_(r,new Set([n.id])),n):O_(r,e,n)}}return r}case`turn_finished`:{let n=Qg(e,t.result,t.turnId,t.waitingRequestIds);return t.undelivered&&t.requestId?y_(n,t.requestId):n}case`prompt_delivered`:return Kg(e,t.text,t.deliveredAt,t.requestId);case`prompt_sent_now`:return Gg(e,t.requestId);case`prompt_cancelled`:{let n=e.items.filter(e=>e.kind===`user`&&!e.failed&&(e.requestId===t.requestId||(e.waiting||e.optimistic)&&e.deliveredAt===null&&e.text===t.text));return k_(e,new Set(n.map(e=>e.id)))}case`subagent_activity`:return dg(e,{agentId:t.agentId,subpath:t.subpath,at:Date.parse(t.at)||Date.now(),finished:t.finished,toolUses:t.toolUses});case`permission_request`:return n_(e,t.request,t.turnId,t.settled===!0);case`permission_resolved`:return r_(e,t.requestId,t.behavior,t.resolvedBy);case`session_state`:{let n=t.session;return g_((n.status===`idle`||n.status===`error`)&&e.pendingPermissions.length===0&&e.activeTurnId!==null?{...e,activeTurnId:null}:e,n)}case`error`:{if(t.code===`replay_truncated`||t.code===`replay_windowed`)return e;let r={kind:`error`,id:`err:${e.nextId}`,uuid:null,parentToolUseId:null,turnId:e.activeTurnId,timestamp:n===void 0?null:new Date(n).toISOString(),code:t.code,message:t.message,requestId:t.requestId??null};return D_({...e,nextId:e.nextId+1},r)}default:return e}}function Cg(e,t,n){let r=typeof t.uuid==`string`?t.uuid:null,i=t.type===`stream_event`||t.type===`tool_progress`,a=r&&!i?`uuid:${r}`:null;if(i&&r!==null&&r===e.lastLiveUuid)return e;if(a&&e.seen.has(a))return t.type===`assistant`?Og(e,t):e;let o=e;switch(t.type){case`system`:o=wg(e,t,n);break;case`stream_event`:o=Tg(e,t,n);break;case`assistant`:o=Dg(e,t,n);break;case`user`:o=Bg(e,t,n);break;case`result`:o=Xg(e,t,n);break;case`tool_progress`:o=e_(e,t);break;case`auth_status`:o=t_(e,t,n);break;default:return e}return a?o=j_(o,a):i&&r!==null&&(o={...o,lastLiveUuid:r}),o}function wg(e,t,n){switch(t.subtype){case`init`:{let r={model:I_(t.model),cwd:I_(t.cwd),tools:Array.isArray(t.tools)?t.tools.filter(e=>typeof e==`string`):[],permissionMode:I_(t.permissionMode),claudeCodeVersion:I_(t.claude_code_version),apiKeySource:I_(t.apiKeySource),sessionId:I_(t.session_id),mcpServers:Array.isArray(t.mcp_servers)?t.mcp_servers:[]};return{...e,init:r,engineSince:n.receivedAt??Date.now()}}case rl:case il:{let r=sl(t);return r?gg(e,r,{uuid:N_(t),parentToolUseId:P_(t),turnId:n.turnId??e.activeTurnId,timestamp:F_(t),live:n.live===!0}):e}case`compact_boundary`:{let r=t.compact_metadata??{},i={kind:`compact`,id:ute(e,`compact`,t),uuid:N_(t),parentToolUseId:P_(t),turnId:n.turnId,timestamp:F_(t),trigger:r.trigger===`manual`?`manual`:`auto`,preTokens:typeof r.pre_tokens==`number`?r.pre_tokens:0,postTokens:typeof r.post_tokens==`number`?r.post_tokens:null};return D_(M_(e),i)}case`status`:{let n=typeof t.status==`string`?t.status:null;return{...e,statusText:n}}case`task_notification`:{let r=Se({taskId:I_(t.task_id)||null,toolUseId:I_(t.tool_use_id)||null,status:I_(t.status)||null,summary:I_(t.summary)||null});if(C_(e,r))return e;let i=N_(t),a={kind:`user`,id:i?`u:${i}`:`i${e.nextId}`,uuid:i,parentToolUseId:P_(t),turnId:n.turnId,timestamp:F_(t),text:r,attachments:[],requestId:null,optimistic:!1,failed:!1,waiting:!1,deliveredAt:null,compactSummary:!1,taskNotification:!0,engineNote:!1};return e.index.get(a.id)===void 0?D_(i?e:M_(e),a):e}case`permission_denied`:{let n=I_(t.tool_use_id),r=I_(t.message);return A_(e,n,e=>{let t=e.name===`AskUserQuestion`&&r===`the user skipped the question`;return{...e,status:t?`skipped`:`denied`,result:e.result??{content:r||`Permission denied`,isError:!t,structured:null}}})}case`rewind_boundary`:{let n={kind:`system`,id:`sys:${e.nextId}`,uuid:N_(t),parentToolUseId:P_(t),turnId:e.activeTurnId,timestamp:F_(t),subtype:`rewind`,text:typeof t.content==`string`&&t.content.trim()?t.content.trim():`Rewound here — the conversation was taken back to this point and continued differently.`};return D_({...e,nextId:e.nextId+1},n)}default:{let n=typeof t.content==`string`?t.content.trim():``,r=n?Ig(n):null;if(!r||r.subtype===`caveat`)return e;let i=r.subtype===`local-command`?zg(n):null,a=r.subtype===`local-command`&&!i?sh(n):null,o=!i&&!a?fh(n):null,s={kind:`system`,id:`sys:${e.nextId}`,uuid:N_(t),parentToolUseId:P_(t),turnId:e.activeTurnId,timestamp:F_(t),subtype:i?`chat-notice`:a?sg:r.subtype,text:r.text,...i?{chatMarker:i}:{},...a?{newChat:a}:{},...o?{modelChange:o}:{}},c=D_({...e,nextId:e.nextId+1},s);return r.subtype===`local-command`&&hg(r.text)?mg(c,{type:`model_change`}):c}}}function Tg(e,t,n){let r=t.event;if(!r||typeof r!=`object`)return e;let i=P_(t),a=i??``,o=e.streams[a]??{messageId:null,model:null,blocks:{},unclaimed:[]};switch(r.type){case`message_start`:{let t=r.message,n={messageId:t?.id??null,model:t?.model??null,blocks:{},unclaimed:[]},i=e;for(let e of o.unclaimed)i=Eg(i,e);return{...i,streams:{...i.streams,[a]:n}}}case`content_block_start`:{let s=r.content_block,c=e,l;if(s.type===`text`)l={kind:`assistant`,id:`i${e.nextId}`,uuid:null,parentToolUseId:i,turnId:n.turnId,timestamp:F_(t),text:s.text??``,streaming:!0,model:o.model,messageId:o.messageId,error:null,aborted:!1},c=M_(c);else if(s.type===`thinking`||s.type===`redacted_thinking`){let r=Ag(s),a=n.receivedAt??null;l={kind:`thinking`,id:`i${e.nextId}`,uuid:null,parentToolUseId:i,turnId:n.turnId,timestamp:F_(t),text:s.type===`thinking`?s.thinking??``:``,streaming:!0,redacted:s.type===`redacted_thinking`,startedAt:r!==null&&a!==null?a-r:a,finishedAt:null,durationMs:r},c=M_(c)}else if(s.type===`tool_use`){let c=s;if(e.index.get(c.id)!==void 0){let t={...o.blocks,[r.index]:c.id};return{...e,streams:{...e.streams,[a]:{...o,blocks:t}}}}let u=c.input&&Object.keys(c.input).length>0;l={kind:`tool`,id:c.id,uuid:null,parentToolUseId:i,turnId:n.turnId,timestamp:F_(t),toolUseId:c.id,name:c.name,input:u?c.input:null,inputJson:u?JSON.stringify(c.input):``,status:`streaming`,result:null,startedAt:n.receivedAt??null,finishedAt:null,durationMs:null,elapsedSec:null,permissionRequestId:null,messageId:o.messageId}}else return e;c=D_(c,l);let u={...o.blocks,[r.index]:l.id},d=[...o.unclaimed,l.id];return{...c,streams:{...c.streams,[a]:{...o,blocks:u,unclaimed:d}}}}case`content_block_delta`:{let t=o.blocks[r.index];if(!t)return e;let n=e.index.get(t);if(n===void 0)return e;let i=e.items[n],a=r.delta;return a.type===`text_delta`&&i.kind===`assistant`?O_(e,n,{...i,text:i.text+a.text}):a.type===`thinking_delta`&&i.kind===`thinking`?O_(e,n,{...i,text:i.text+a.thinking}):a.type===`input_json_delta`&&i.kind===`tool`?O_(e,n,{...i,inputJson:i.inputJson+a.partial_json}):e}case`content_block_stop`:{let t=o.blocks[r.index];return t?Eg(e,t,n.receivedAt):e}case`message_delta`:case`message_stop`:case`ping`:return e;case`error`:{let a={kind:`error`,id:`err:${e.nextId}`,uuid:null,parentToolUseId:i,turnId:n.turnId,timestamp:F_(t),code:r.error?.type??`stream_error`,message:r.error?.message??`stream error`,requestId:null};return D_(M_(e),a)}default:return e}}function Eg(e,t,n){let r=e.index.get(t);if(r===void 0)return e;let i=e.items[r];if(i.kind===`thinking`){if(!i.streaming)return e;let t=n??null,a=i.startedAt!==null&&t!==null?Math.max(0,t-i.startedAt):null;return O_(e,r,{...i,streaming:!1,finishedAt:t,durationMs:i.durationMs!==null&&i.durationMs>0?i.durationMs:a??i.durationMs})}if(i.kind===`assistant`)return i.streaming?O_(e,r,{...i,streaming:!1}):e;if(i.kind===`tool`&&i.status===`streaming`){let t=i.input??z_(i.inputJson);return O_(e,r,{...i,input:t,status:`running`,startedAt:i.startedAt??n??null})}return e}function Dg(e,t,n){let r=t.local_command_source;if(typeof r==`string`){let i=Ig(r.trim());if(i&&(i.subtype===`local-command`||i.subtype===`local-command-error`)){let r={kind:`system`,id:`sys:${e.nextId}`,uuid:N_(t),parentToolUseId:P_(t),turnId:n.turnId??e.activeTurnId,timestamp:F_(t),subtype:i.subtype,text:i.text},a=D_({...e,nextId:e.nextId+1},r);return i.subtype===`local-command`&&hg(i.text)?mg(a,{type:`model_change`}):a}}let i=t.message??{},a=R_(i.content),o=P_(t),s=o??``,c=N_(t),l=F_(t),u=typeof t.error==`string`?t.error:null,d=t.aborted===!0,f=e;{let e=L_(i.usage?.cache_read_input_tokens)+L_(i.usage?.cache_creation_input_tokens),n=`usage:${i.id??``}`;if(e>0&&i.id&&!f.seen.has(n)&&(f={...j_(f,n),turnCachedTokens:f.turnCachedTokens+e}),o===null&&t.isSidechain!==!0){let t=L_(i.usage?.input_tokens)+e+L_(i.usage?.output_tokens);t>0&&t!==f.contextTokens&&(f={...f,contextTokens:t})}}let p=f.streams[s];for(let e of a){let t=p?kg(f,p,e):null;if(t){let r=f.index.get(t),a=f.items[r];f=O_(f,r,Ng(a,e,{uuid:c,timestamp:l,model:i.model??null,messageId:i.id??null,errorText:u,aborted:d,receivedAt:n.receivedAt})),p={...p,unclaimed:p.unclaimed.filter(e=>e!==t)},f={...f,streams:{...f.streams,[s]:p}};continue}let r=Pg(f,e,{uuid:c,timestamp:l,parentToolUseId:o,turnId:n.turnId,model:i.model??null,messageId:i.id??null,errorText:u,aborted:d,receivedAt:n.receivedAt});r&&(f=r)}if(a.length===0&&u){let e={kind:`error`,id:`err:${f.nextId}`,uuid:c,parentToolUseId:o,turnId:n.turnId,timestamp:l,code:`assistant_error`,message:u,requestId:null};f=D_(M_(f),e)}return f}function Og(e,t){let n=P_(t)??``,r=e.streams[n];if(!r||r.unclaimed.length===0)return e;let i=t.message??{},a=new Set,o=e,s=r;for(let e of R_(i.content)){let t=kg(o,s,e);t&&(a.add(t),s={...s,unclaimed:s.unclaimed.filter(e=>e!==t)},o={...o,streams:{...o.streams,[n]:s}})}return k_(e,a)}function kg(e,t,n){for(let r of t.unclaimed){let t=e.index.get(r);if(t===void 0)continue;let i=e.items[t];if(!i.uuid&&(n.type===`text`&&i.kind===`assistant`||(n.type===`thinking`||n.type===`redacted_thinking`)&&i.kind===`thinking`||n.type===`tool_use`&&i.kind===`tool`&&i.toolUseId===n.id))return r}return null}function Ag(e){let t=e?.duration_ms;return typeof t==`number`&&Number.isFinite(t)&&t>=0?t:null}function jg(e){if(!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function Mg(e,t,n=e.items.length){for(let r=n-1;r>=0;r--){let n=e.items[r];if(n.kind===`result`)break;if(n.parentToolUseId!==t){if(t!==null&&n.kind===`tool`&&n.toolUseId===t)return n.startedAt??jg(n.timestamp);continue}if(n.kind===`tool`||n.kind===`thinking`){let e=n.finishedAt??n.startedAt??jg(n.timestamp);if(e!==null)return e}else if(n.kind===`user`){let e=jg(n.deliveredAt)??jg(n.timestamp);if(e!==null)return e}else{let e=jg(n.timestamp);if(e!==null)return e}}return t===null?e.lastFrameAt:null}function Ng(e,t,n){if(e.kind===`assistant`&&t.type===`text`){let r=t.text??e.text;return{...e,uuid:n.uuid,timestamp:n.timestamp??e.timestamp,text:r.length>=e.text.length?r:e.text,streaming:!1,model:n.model??e.model,messageId:n.messageId??e.messageId,error:n.errorText,aborted:n.aborted}}if(e.kind===`thinking`){let r=t.type===`thinking`?t.thinking??e.text:e.text,i=Ag(t),a=e.streaming?n.receivedAt??e.finishedAt:e.finishedAt,o=e.startedAt!==null&&a!==null?Math.max(0,a-e.startedAt):null;return{...e,uuid:n.uuid,timestamp:n.timestamp??e.timestamp,text:r||e.text,streaming:!1,finishedAt:a,durationMs:i??(e.durationMs!==null&&e.durationMs>0?e.durationMs:null)??o??e.durationMs}}if(e.kind===`tool`&&t.type===`tool_use`){let r=t,i=r.input&&Object.keys(r.input).length>0?r.input:e.input??z_(e.inputJson);return{...e,uuid:n.uuid,timestamp:n.timestamp??e.timestamp,name:r.name??e.name,input:i,inputJson:e.inputJson||(i?JSON.stringify(i):``),status:e.status===`streaming`?`running`:e.status,messageId:n.messageId??e.messageId}}return e}function Pg(e,t,n){let r={uuid:n.uuid,parentToolUseId:n.parentToolUseId,turnId:n.turnId,timestamp:n.timestamp};if(t.type===`text`){let i={kind:`assistant`,id:`i${e.nextId}`,...r,text:t.text??``,streaming:!1,model:n.model,messageId:n.messageId,error:n.errorText,aborted:n.aborted};return D_(M_(e),i)}if(t.type===`thinking`||t.type===`redacted_thinking`){let i=Ag(t),a=n.receivedAt??jg(n.timestamp),o=Mg(e,n.parentToolUseId),s=o!==null&&a!==null&&a>=o?a-o:null,c=i??s,l=i!==null&&a!==null?a-i:o,u={kind:`thinking`,id:`i${e.nextId}`,...r,text:t.type===`thinking`?t.thinking??``:``,streaming:!1,redacted:t.type===`redacted_thinking`,startedAt:l,finishedAt:a,durationMs:c};return D_(M_(e),u)}if(t.type===`tool_use`){let i=t,a=e.index.get(i.id);if(a!==void 0){let r=e.items[a];return O_(e,a,Ng(r,t,n))}let o=i.input&&typeof i.input==`object`?i.input:null;return D_(e,{kind:`tool`,id:i.id,...r,toolUseId:i.id,name:i.name,input:o,inputJson:o?JSON.stringify(o):``,status:`running`,result:null,startedAt:n.receivedAt??jg(n.timestamp)??null,finishedAt:null,durationMs:null,elapsedSec:null,permissionRequestId:null,messageId:n.messageId})}return null}function Fg(e){return e.trim().replace(/\s+/g,` `)}function Ig(e){if(/^<local-command-caveat>/.test(e))return{subtype:`caveat`,text:``};let t=/^<local-command-(stdout|stderr)>([\s\S]*?)<\/local-command-\1>$/.exec(e);if(t){let e=t[2].replace(/\u001b\[[0-9;]*m/g,``).trim();return{subtype:t[1]===`stderr`?`local-command-error`:`local-command`,text:e}}let n=/<command-name>([^<]*)<\/command-name>/.exec(e);if(n&&/^<command-/.test(e)){let t=/<command-args>([^<]*)<\/command-args>/.exec(e)?.[1]?.trim()??``,r=n[1].trim(),i=mee(r.replace(/^\//,``));return{subtype:`command`,text:`${i===null?r:`/${i}`}${t?` `+t:``}`}}return null}function Lg(e){let t=e.charCodeAt(0);return t===9993||t===8617||t===8635||t===9888}function Rg(e){return Lg(e)?td(e):[]}function zg(e){if(!e.startsWith(`<local-command-stdout>`))return null;let t=ed(e);return t?.kind===`notice`?t:null}function Bg(e,t,n){let r=t.message??{},i=P_(t),a=N_(t),o=F_(t),s=t.isSynthetic===!0,c=e,l=[],u=[],d=!1;if(typeof r.content==`string`)l.push(r.content);else for(let e of R_(r.content))if(e.type===`text`)l.push(e.text??``);else if(e.type===`tool_result`){d=!0;let r=e;c=Jg(c,r.tool_use_id,{content:r.content??``,isError:r.is_error===!0,structured:t.tool_use_result??null},n.receivedAt??jg(o)??void 0)}else(e.type===`image`||e.type===`document`)&&u.push(e);let f=ge(l.join(`
|
|
116
|
+
`)}var Vee=/^[A-Za-z0-9][\w.:@+\-/]*(?:\[[0-9a-z]+\])?$/;function Dh(e){return e.length>0&&e.length<=200&&Vee.test(e)&&!e.endsWith(`/`)&&!e.includes(`//`)}function Oh(e){let t=e.indexOf(`/`);return t<=0||t===e.length-1?null:{prefix:e.slice(0,t).toLowerCase(),model:e.slice(t+1)}}function Hee(e,t,n){let r={providerId:t.providerId,variantId:t.variantId??null},i=Oh(e);return!i||!n.includes(i.prefix)?{...r,model:e}:i.prefix===t.providerId?{...r,model:i.model}:t.providerId===`oonacode`?{...r,model:e}:{providerId:i.prefix,variantId:null,model:i.model}}function Uee(e,t){let n=t.variantId??null;if(t.providerId===`oonacode`)return{providerId:t.providerId,variantId:n,model:e};let r=Oh(e),i=r&&r.prefix===t.providerId.toLowerCase()?r.model:e;return{providerId:t.providerId,variantId:n,model:i}}function kh(e){return`${e} (custom)`}var Wee=5e5,Ah=e=>Ys(e).trim().toLowerCase(),jh=new Map;function Gee(e){e&&(jh=new Map(e.map(e=>[Ah(e.id),e])))}function Mh(e){return typeof e==`string`&&e!==``?jh.get(Ah(e))??null:null}function Kee(e){let t=Mh(e);return t?t.contextWindow:Nh(e)?Wee:null}var qee=[`low`,`medium`,`high`];function Nh(e){return typeof e==`string`&&Ys(e).toLowerCase().startsWith(`google-claude-`)}function Jee(e){let t=Mh(e);return t?.effortLevels&&t.effortLevels.length>0?t.effortLevels:Nh(e)?qee:null}function Yee(e,t){return e?ke(e):Jee(t)??[]}var Ph=`google-agy`;function Fh(e){return e===Ph}var Xee=[`build`,`auto`];function Ih(e){return Fh(e)?j.filter(e=>Xee.includes(e.id)):j}var Lh=`Google’s agy cannot ask for permission while OonaCode drives it, so this chat offers Build (agy may edit files; a command it wants to run is declined and reported) and Autonomous (agy may run everything).`,Zee=`Sign in on Google’s own page with your own Google account. Google then shows you a one-time code: paste it here. OonaCode never sees your password, and your sign-in stays on this PC.`;function Rh(e){return typeof e==`string`&&e.length>=8&&e.length<=512&&/^[A-Za-z0-9/_.~%+=-]+$/.test(e)}var zh={"x-client-id":`tbh:exec`,"user-agent":`muse-build/1.4.13 (non-interactive; linux-x86_64; build 39490bd065c800195489caec34473582f7650b54)`};/^muse-build\/(\S+)/.exec(zh[`user-agent`])[1],/build ([0-9a-f]{40})\)/.exec(zh[`user-agent`])[1];function Bh(e){try{let t=new URL(e),n=t.hostname.toLowerCase();return t.protocol===`https:`&&(n===`meta.com`||n.endsWith(`.meta.com`))}catch{return!1}}var Qee=`auto`,Vh=`Auto`;function Hh(e,t){return e===`oonacode`&&t===`auto`}function $ee(e){let t=e?.trim();return t?`${Vh} (${t})`:Vh}var Uh={complete:`/api/v1/account/vault/rekey-complete`,revoke:`/api/v1/account/vault/rekey-revoke`,deviceUnlock:`/api/v1/account/device-unlock`};function Wh(e){return e?.deviceUnlock??`off`}function Gh(e){if(!e?.loggedIn)return null;let t=e;if(t.vaultStatus!==`pending_rekey`)return null;let n=t.vaultRekeyPending??null;return{pending:n,canFinishHere:t.canFinishRekey===!0,trustedDevices:n?.trustedDevices.map(e=>e.label||e.name)??[],since:n?.since??null,from:ete(n)}}function ete(e){if(!e)return null;let t=e.requestedFrom.device?.trim()||null,n=e.requestedFrom.ip?.trim()||null;return t&&n?`${t} (${n})`:t??n}function Kh(e){if(!e)return`an unknown date`;let t=Date.parse(e);if(Number.isNaN(t))return`an unknown date`;try{return new Date(t).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}catch{return new Date(t).toISOString()}}function qh(e){let t=e.from?` from ${e.from}`:``;return`A password reset was started on ${Kh(e.since)}${t}. Your saved provider keys are still sealed under the old password.`}function Jh(e){return e.trustedDevices.length===0?`No device with "keep me unlocked" is left, so nothing here holds the key from before the reset.`:`Open OonaCode on ${Xh(e.trustedDevices)} to finish the reset — your saved keys are waiting there.`}var Yh=`Either way, your vault Recovery Key still works: sign in on the OonaCode website from any device and finish the reset there. Discarding is the last resort — it deletes your saved provider keys and that Recovery Key for good. Your chats stay on your PCs.`;function Xh(e){return e.length<=1?e[0]??``:`${e.slice(0,-1).join(`, `)} or ${e[e.length-1]}`}function Zh(e){return e.canFinishHere?`A password reset is waiting: this PC can move your vault to the new password.`:e.trustedDevices.length>0?`A password reset is waiting — your saved keys stay locked until it is finished on ${Xh(e.trustedDevices)}.`:`A password reset is waiting and no PC holds the old key — finish it with your vault Recovery Key on the OonaCode website.`}var Qh=class extends Error{code;status;details;constructor(e,t,n,r){super(n),this.name=`HostApiError`,this.code=e,this.status=t,this.details=r}get isUnauthorized(){return this.status===401||this.code===`unauthorized`}get isEmailNotVerified(){return this.code===`email_not_verified`}};function $h(e){if(!e)return``;let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!=null&&r!==``&&t.set(n,String(r));let n=t.toString();return n?`?${n}`:``}function eg(e){return e.trim().replace(/\/+$/,``)}function tg(e,t){let n=eg(e.baseUrl),r=t??((e,t)=>fetch(e,t));async function i(t,i,a,o={}){let s={Authorization:`Bearer ${e.token}`,Accept:o.raw||o.bytes?`*/*`:`application/json`},c={method:t,headers:s,credentials:`omit`};o.signal&&(c.signal=o.signal),a!==void 0&&(s[`Content-Type`]=`application/json`,c.body=JSON.stringify(a));let l;try{l=await r(`${n}${i}`,c)}catch(e){throw new Qh(`network`,0,`Cannot reach the host at ${n}: ${String(e?.message??e)}`)}if(!l.ok){let e=null,t=``;try{t=await l.text(),e=t?JSON.parse(t):null}catch{e=null}let n=e?.error?.code??(l.status===401?`unauthorized`:`internal`),r=e?.error?.message??(t||`${l.status} ${l.statusText}`);throw new Qh(n,l.status,r,e?.error?.details)}if(o.bytes)return await l.arrayBuffer();if(o.raw)return await l.text();if(l.status===204)return;let u=await l.text();if(u)try{return JSON.parse(u)}catch{throw new Qh(`parse`,l.status,`Host returned malformed JSON for ${t} ${i}`)}}let a=Ge;return{health:()=>i(a.health,z.health),info:()=>i(a.info,z.info),listSessions:e=>i(a.listSessions,`${z.sessions}${$h(e)}`),createSession:e=>i(a.createSession,z.sessions,e),getSession:e=>i(a.getSession,z.session(e)),updateSession:(e,t)=>i(a.updateSession,z.session(e),t),deleteSession:e=>i(a.deleteSession,z.session(e)),exportSessionsArchive:async t=>{let i=await r(`${n}${z.sessionsExportArchive}`,{method:`POST`,credentials:`omit`,headers:{Authorization:`Bearer ${e.token}`,Accept:`application/zip`,"Content-Type":`application/json`},body:JSON.stringify({password:t})});if(!i.ok){let e=await i.text().catch(()=>``),t=null;try{t=e?JSON.parse(e):null}catch{t=null}throw new Qh(t?.error?.code??`internal`,i.status,t?.error?.message??e??`the export failed`)}return i.blob()},listEntries:(e,t)=>i(a.listEntries,`${z.sessionEntries(e)}${$h(t)}`),listMessages:e=>i(a.listMessages,z.sessionMessages(e)),prompt:(e,t)=>i(a.prompt,z.sessionPrompt(e),{...t,stream:!1}),interrupt:e=>i(a.interrupt,z.sessionInterrupt(e),{}),cancelQueued:(e,t)=>i(a.cancelQueued,z.sessionQueued(e,t)),sendQueuedNow:(e,t)=>i(a.sendQueuedNow,z.sessionQueuedNow(e,t),{}),sendQueuedNowAll:e=>i(a.sendQueuedNowAll,z.sessionQueuedNowAll(e),{}),forkSession:(e,t)=>i(a.fork,z.sessionFork(e),t??{}),removeEntries:(e,t)=>i(a.removeEntries,z.sessionRemove(e),t),undoModelChange:(e,t)=>i(a.undoModelChange,z.sessionModelUndo(e),{uuid:t}),exportSession:(e,t)=>i(a.export,`${z.sessionExport(e)}${$h(t)}`,void 0,{raw:!0}),listProjects:()=>i(a.listProjects,z.projects),listAiToolGrants:()=>i(a.listAiToolGrants,z.aiToolGrants),createAiToolGrant:e=>i(a.createAiToolGrant,z.aiToolGrants,e),revokeAiToolGrant:e=>i(a.revokeAiToolGrant,z.aiToolGrant(e)),listVaultProjects:()=>i(a.listVaultProjects,z.vaultProjects),createVaultProject:e=>i(a.createVaultProject,z.vaultProjects,e),updateVaultProject:(e,t)=>i(a.updateVaultProject,z.vaultProject(e),t),deleteVaultProject:e=>i(a.deleteVaultProject,z.vaultProject(e)),listStickyNotes:()=>i(a.listStickyNotes,z.vaultNotes),createStickyNote:e=>i(a.createStickyNote,z.vaultNotes,e),updateStickyNote:(e,t)=>i(a.updateStickyNote,z.vaultNote(e),t),deleteStickyNote:e=>i(a.deleteStickyNote,z.vaultNote(e)),listScheduledTasks:(e={})=>{let t=new URLSearchParams;e.sessionId&&t.set(`sessionId`,e.sessionId),e.projectId&&t.set(`projectId`,e.projectId);let n=t.toString();return i(a.listScheduledTasks,n?`${z.scheduledTasks}?${n}`:z.scheduledTasks)},createScheduledTask:e=>i(a.createScheduledTask,z.scheduledTasks,e),updateScheduledTask:(e,t)=>i(a.updateScheduledTask,z.scheduledTask(e),t),deleteScheduledTask:e=>i(a.deleteScheduledTask,z.scheduledTask(e)),listConversations:(e={})=>i(a.listConversations,`${z.conversations}${$h({sessionId:e.sessionId})}`),getConversation:e=>i(a.getConversation,z.conversation(encodeURIComponent(e))),conversationAction:(e,t,n)=>i(a.conversationAction,z.conversationAction(encodeURIComponent(e),t),n??{}),stopAllConversations:()=>i(a.stopAllConversations,z.conversationsStopAll,{}),cancelChatMessage:e=>i(a.cancelChatMessage,z.chatMessage(encodeURIComponent(e))),getChatAbout:e=>i(a.getChatAbout,z.sessionAbout(encodeURIComponent(e))),updateChatAbout:(e,t)=>i(a.updateChatAbout,z.sessionAbout(encodeURIComponent(e)),t),regenerateChatAbout:e=>i(a.regenerateChatAbout,z.sessionAboutRegenerate(encodeURIComponent(e)),{}),listChatAbouts:()=>i(a.listChatAbouts,z.chatAbouts),generateAllChatAbouts:()=>i(a.generateAllChatAbouts,z.chatAboutsGenerateAll,{}),stopGenerateAllChatAbouts:()=>i(a.stopGenerateAllChatAbouts,z.chatAboutsGenerateAllStop,{}),generateChatAbouts:e=>i(a.generateChatAbouts,z.chatAboutsGenerate,e),planChatAboutTranslations:e=>i(a.planChatAboutTranslations,z.chatAboutsTranslationPlan,e),translateChatAbout:(e,t)=>i(a.translateChatAbout,z.sessionAboutTranslation(encodeURIComponent(e)),t),getAgyStatus:e=>i(`GET`,`${z.agyStatus}${$h(e?.refresh?{refresh:1}:void 0)}`),listAgyRequests:e=>i(`GET`,z.agyRequests(encodeURIComponent(e))),getAgyRequestBody:(e,t)=>i(`GET`,z.agyRequestBody(encodeURIComponent(e),encodeURIComponent(t))),getProviderUsage:(e,t)=>i(`GET`,`${z.providerUsage(encodeURIComponent(e))}${t?.refresh?`?refresh=1`:``}`),agyInstall:()=>i(`POST`,z.agyInstall),cancelAgyInstall:()=>i(`DELETE`,z.agyInstall),agyLogin:()=>i(`POST`,z.agyLogin),cancelAgyLogin:()=>i(`DELETE`,z.agyLogin),museSetup:()=>i(`GET`,z.museSetup),museLoginStart:()=>i(`POST`,z.museLogin),museLoginCancel:()=>i(`DELETE`,z.museLogin),submitAgyLoginCode:e=>i(`POST`,z.agyLoginCode,{code:e}),listVoiceSummaries:e=>i(a.listVoiceSummaries,z.sessionVoiceSummaries(encodeURIComponent(e))),createVoiceSummary:(e,t)=>i(a.createVoiceSummary,z.sessionVoiceSummaries(encodeURIComponent(e)),t),deleteVoiceSummary:(e,t)=>i(a.deleteVoiceSummary,z.sessionVoiceSummary(encodeURIComponent(e),encodeURIComponent(t))),translateVoiceSummary:(e,t,n)=>i(a.translateVoiceSummary,z.sessionVoiceSummaryTranslations(encodeURIComponent(e),encodeURIComponent(t)),n),listNextPrompts:()=>i(`GET`,z.nextPrompts),getNextPrompt:e=>i(`GET`,z.sessionNextPrompt(encodeURIComponent(e))),suggestNextPrompt:(e,t)=>i(`POST`,z.sessionNextPrompt(encodeURIComponent(e)),t),reviewNextPrompts:e=>i(`POST`,z.nextPromptsReview,e),stopNextPromptReview:()=>i(`POST`,z.nextPromptsReviewStop),markNextPromptSent:(e,t)=>i(`POST`,z.sessionNextPromptSent(encodeURIComponent(e)),t),markSessionSeen:e=>i(`POST`,z.sessionSeen(encodeURIComponent(e))),getGithubLink:()=>i(a.getGithubLink,z.githubLink),searchEntries:e=>i(a.searchEntries,`${z.sessionSearch}${$h(e)}`),startGithubLink:()=>i(a.startGithubLink,z.githubLinkStart,{}),cancelGithubLink:()=>i(a.cancelGithubLink,z.githubLinkStart),unlinkGithub:()=>i(a.unlinkGithub,z.githubLink),scanClaudeSessions:()=>i(a.scanClaudeSessions,z.importClaude),importClaudeSessions:e=>i(a.importClaudeSessions,z.importClaude,e??{}),searchImportChats:(e,t)=>i(a.searchImportChats,`${z.importSearch}${$h(e)}`,void 0,t?{signal:t}:{}),sessionLink:e=>i(a.sessionLink,z.sessionLink(e)),syncSessionDown:e=>i(a.syncSessionDown,z.sessionSyncDown(e),{}),inspectProject:e=>i(a.inspectProject,`${z.projectInspect}${$h(e)}`),attachSessionProject:(e,t)=>i(a.attachSessionProject,z.sessionProject(e),t),listAgentTools:()=>i(`GET`,z.agentTools),mediaOptions:(e,t)=>i(`GET`,`${z.mediaOptions}${$h({model:e??void 0,provider:t??void 0})}`),listConnectors:()=>i(`GET`,z.connectors),signInConnector:(e,t)=>i(`POST`,z.connectorSignIn(encodeURIComponent(e)),t),updateConnector:(e,t)=>i(`PATCH`,z.connector(encodeURIComponent(e)),t),signOutConnector:e=>i(`DELETE`,z.connector(encodeURIComponent(e))),installConnectorSkills:e=>i(`POST`,z.connectorSkills(encodeURIComponent(e)),{}),listMcpServers:()=>i(`GET`,z.mcpServers),createMcpServer:e=>i(`POST`,z.mcpServers,e),updateMcpServer:(e,t)=>i(`PATCH`,z.mcpServer(encodeURIComponent(e)),t),deleteMcpServer:e=>i(`DELETE`,z.mcpServer(encodeURIComponent(e))),testMcpServer:e=>i(`POST`,z.mcpServerTest(encodeURIComponent(e))),testMcpConfig:e=>i(`POST`,z.mcpServerTestDraft,e),listSessionCommands:e=>i(a.listSessionCommands,z.sessionCommands(encodeURIComponent(e))),listCommands:e=>i(a.listCommands,`${z.commands}${$h(e)}`),listSessionChatSkills:e=>i(a.listSessionChatSkills,z.sessionModelSkills(encodeURIComponent(e))),listChatSkills:e=>i(a.listChatSkills,`${z.modelSkills}${$h(e)}`),listSkills:()=>i(a.listSkills,z.skills),deleteSkill:e=>i(a.deleteSkill,z.skill(e)),scanClaudeSkills:()=>i(a.scanClaudeSkills,z.importClaudeSkills),importClaudeSkills:e=>i(a.importClaudeSkills,z.importClaudeSkills,e),listProviders:()=>i(a.listProviders,z.providers),setActiveProvider:e=>i(a.setActiveProvider,z.providersActive,e),testProvider:e=>i(a.providerTest,z.providerTest(e),{}),probeCredential:(e,t)=>i(a.providerProbe,z.providerProbe(e),t),listModels:e=>i(a.listModels,`${z.models}${$h(e)}`),getSettings:()=>i(a.getSettings,z.settings),updateSettings:e=>i(a.updateSettings,z.settings,e),getAccount:()=>i(a.getAccount,z.account),login:e=>i(a.login,z.accountLogin,e),logout:()=>i(a.logout,z.accountLogout,{}),unlock:e=>i(a.unlock,z.accountUnlock,e),lock:()=>i(`POST`,z.accountLock,{reason:`user`}),plan:()=>i(`GET`,z.accountPlan),accountUsage:e=>i(`GET`,`${z.accountUsage}${$h({...e})}`),remoteUnlockHost:(e,t)=>i(`POST`,z.hostVaultUnlock(e),{password:t}),resendVerification:e=>i(a.resendVerification,z.accountResendVerification,e),startAccountLink:e=>i(a.linkStart,z.accountLinkStart,e??{}),accountLinkStatus:()=>i(a.linkStatus,z.accountLinkStatus),cancelAccountLink:()=>i(a.linkCancel,z.accountLinkCancel,{}),completeVaultRekey:e=>i(`POST`,Uh.complete,e),revokeVaultRekey:e=>i(`POST`,Uh.revoke,e),setDeviceUnlock:e=>i(`POST`,Uh.deviceUnlock,e),listCredentials:()=>i(a.listCredentials,z.credentials),addCredential:e=>i(a.addCredential,z.credentials,e),deleteCredential:e=>i(a.deleteCredential,z.credential(e)),testCredential:e=>i(a.credentialTest,z.credentialTest(e),{}),syncNow:()=>i(a.syncNow,z.syncNow,{}),claudeSubscriptionLogin:()=>i(a.claudeLogin,z.subscriptionClaudeLogin,{}),claudeSubscriptionStatus:()=>i(a.claudeStatus,z.subscriptionClaudeStatus),claudeLoginState:()=>i(a.claudeLoginState,z.subscriptionClaudeLoginState),claudeLoginCode:e=>i(a.claudeLoginCode,z.subscriptionClaudeLoginCode,e),claudeLoginCancel:()=>i(a.claudeLoginCancel,z.subscriptionClaudeLoginCancel,{}),oauthLoginStart:e=>i(a.oauthLogin,z.subscriptionOauthLogin(e),{}),oauthLoginState:e=>i(a.oauthLoginState,z.subscriptionOauthLoginState(e)),oauthLoginCancel:e=>i(a.oauthLoginCancel,z.subscriptionOauthLoginCancel(e),{}),doctor:()=>i(a.doctor,z.doctor),listHosts:()=>i(a.listHosts,z.hosts),listHostSessions:e=>i(a.listHostSessions,z.hostSessions(e)),deleteHostSession:(e,t)=>i(a.deleteHostSession,z.hostSession(e,t),{method:`DELETE`}),updateHost:(e,t)=>i(a.updateHost,z.host(e),t),listHostSessionEntries:(e,t,n)=>i(a.listHostSessionEntries,`${z.hostSessionEntries(e,t)}${$h(n)}`),updateHostSession:(e,t,n)=>i(`PATCH`,z.hostSession(e,t),n),forkHostSession:(e,t)=>i(`POST`,z.hostSessionFork(e,t),{}),listHostSessionFiles:(e,t,n)=>i(`GET`,`${z.hostSessionFiles(e,t)}${$h({path:n})}`),readHostSessionFile:(e,t,n)=>i(`GET`,`${z.hostSessionFile(e,t)}${$h({path:n})}`,void 0,{raw:!0}),readHostSessionFileBytes:(e,t,n)=>i(`GET`,`${z.hostSessionFile(e,t)}${$h({path:n})}`,void 0,{bytes:!0}),deleteHostSessionFile:(e,t,n)=>i(`DELETE`,`${z.hostSessionFile(e,t)}${$h({path:n})}`),inspectHostProject:(e,t)=>i(`GET`,`${z.hostProjectsInspect(e)}${$h({dir:t})}`),reportError:e=>i(a.errorReport,z.errorReport,e),sendBugReport:e=>i(a.bugReport,z.bugReport,e),listSessionFiles:(e,t)=>i(a.listSessionFiles,`${z.sessionFiles(e)}${$h({path:t})}`),readSessionFile:(e,t)=>i(a.readSessionFile,`${z.sessionFile(e)}${$h({path:t})}`,void 0,{raw:!0}),readSessionFileBytes:(e,t)=>i(a.readSessionFile,`${z.sessionFile(e)}${$h({path:t})}`,void 0,{bytes:!0}),deleteSessionFile:(e,t)=>i(a.deleteSessionFile,`${z.sessionFile(e)}${$h({path:t})}`),renameSessionFile:(e,t,n)=>i(a.renameSessionFile,`${z.sessionFile(e)}/rename`,{path:t,name:n}),searchSessionFiles:(e,t)=>i(a.searchSessionFiles,`${z.sessionFileSearch(e)}${$h({q:t.q,case:t.caseSensitive?`1`:void 0,word:t.wholeWord?`1`:void 0,max:t.max})}`),writeSessionFileText:(e,t,n)=>i(a.writeSessionFileText,`${z.sessionFile(e)}/text`,{path:t,text:n}),readLocalTextFile:(e,t)=>i(a.readLocalFile,`${z.sessionLocalFileText(e)}${$h({path:t})}`),listSavedPrompts:e=>i(a.listSavedPrompts,z.sessionSavedPrompts(e)),saveSavedPrompt:(e,t)=>i(a.saveSavedPrompt,z.sessionSavedPrompts(e),{text:t}),deleteSavedPrompt:(e,t)=>i(a.deleteSavedPrompt,z.sessionSavedPrompt(e,t)),openSessionBrowser:(e,t)=>i(`POST`,z.sessionBrowserOpen(e),t?{profile:t}:{}),grantLocalFile:async(e,t)=>{let r=await i(a.grantLocalFile,z.sessionLocalFileGrant(e),{path:t});return{...r,url:/^https?:/i.test(r.url)?r.url:`${n}${r.url}`}},listChatMedia:(e,t)=>i(a.listChatMedia,`${z.sessionMedia(e)}${$h(t?{...t}:void 0)}`),readChatMedia:(e,t)=>i(a.readChatMedia,z.sessionMediaContent(e,encodeURIComponent(t)),void 0,{bytes:!0}),grantChatMedia:async e=>{let t=await i(a.grantChatMedia,z.sessionMediaGrant(e));return{expiresAt:t.expiresAt,urlOf:r=>`${n}${z.sessionMediaContent(encodeURIComponent(e),encodeURIComponent(r))}?grant=${encodeURIComponent(t.grant)}`}},statLocalPaths:(e,t)=>i(a.statLocalPaths,z.sessionLocalFileStat(e),{paths:t}),saveTmpFile:e=>i(`POST`,z.saveTmpFile,e)}}function ng(e){return e instanceof Qh&&(e.status===404||e.status===501)}var rg=120;function tte(){return rg}function ig(e){let t=e.batchMs??120,n=e.hiddenBatchMs??1e3,r=e.isHidden??(()=>!1),i=e.now??(()=>Date.now()),a=e.setTimeout??((e,t)=>setTimeout(e,t)),o=e.clearTimeout??(e=>clearTimeout(e)),s=[],c=null,l=-1/0,u=!1,d=()=>{if(c!==null&&(o(c),c=null),s.length===0)return;let t=s;s=[],l=i(),e.deliver(t)};return{push(o){if(u)return;if(s.push(o),!e.isStreamFrame(o)){d();return}let f=r()?n:t;if(f<=0){d();return}if(c!==null)return;let p=i()-l;if(p>=f){d();return}c=a(()=>{c=null,d()},f-p)},flush:d,dispose(){u=!0,c!==null&&o(c),c=null,s=[]}}}function nte(e,t,n){if((t.providerId??``)!==e.providerId)return!1;if(Hh(e.providerId,e.model))return t.autoModel!==void 0;if(e.variantId!==void 0&&(t.variantId??null)!==(e.variantId??null)||!t.model)return!1;let r=Ys(t.model),i=Ys(e.model);if(r===i)return!0;let a=n.find(t=>t.definition.id===e.providerId)?.definition;return a!==void 0&&Gs(a,i)===r}function ag(e){return e instanceof Qh&&e.code===`email_not_verified`}function rte(e){if(!ag(e))return null;let t={error:{code:e.code,message:e.message,details:e.details}};return A(t)?t.error.details:null}function ite(e){let t=e.trim(),n=t.indexOf(`@`);return n<=0?`***`:`${t.slice(0,1)}***${t.slice(n)}`}function og(e,t){return e===void 0||!Number.isFinite(e)||e<=0?t:t+Math.ceil(e)*1e3}function ate(e,t){return Math.max(0,Math.ceil((e.resendAt-t)/1e3))}function ote(e,t){if(!ag(e))return null;let n=t.now??Date.now(),r=rte(e),i=t.email.trim();return{email:i,displayEmail:r?.email||ite(i),verification:r?.verification??`pending`,registered:t.registered===!0,resendAt:og(r?.resendAfterSec,n)}}function ste(e){let t=e.registered?`Account created. `:``;return e.verification===`unverified`?`${t}Confirm your email first — no link is outstanding for ${e.displayEmail}; send a new one.`:`${t}Confirm your email first — we sent a link to ${e.displayEmail}.`}var sg=`new-chat`,cg=`safeguard-fallback`,cte=`safeguard-no-fallback`,lte=3e4;function lg(e,t){return e.filter(e=>t-e.at<=lte)}function ug(e=null){return{sessionId:e,session:null,items:[],index:new Map,status:`idle`,activeTurnId:null,init:null,statusText:null,pendingPermissions:[],lastSeq:null,totals:{costUsd:0,inputTokens:0,cachedInputTokens:0,outputTokens:0,turns:0},turnCachedTokens:0,contextTokens:null,hydrated:!1,agentActivity:{},hasSubagentItems:!1,hasOptimisticUser:!1,earlyDeliveries:[],lastLocalPromptId:null,lastFrameAt:null,lastLiveUuid:null,engineSince:null,safeguardFallback:null,subpathParents:{},seen:new Set,streams:{},nextId:1}}function dg(e,t){let n=e.agentActivity[t.agentId],r={subpath:t.subpath,firstAt:n?Math.min(n.firstAt,t.at):t.at,at:n?Math.max(n.at,t.at):t.at,finished:t.finished,toolUses:(n?.toolUses??0)+t.toolUses};return{...e,agentActivity:{...e.agentActivity,[t.agentId]:r}}}function fg(e,t,n,r,i,a){let o=d_.exec(t)?.[2];if(!o)return e;let s=i&&Date.parse(i)||0;if(n!==`assistant`)return dg(e,{agentId:o,subpath:t,at:s,finished:e.agentActivity[o]?.finished??!1,toolUses:0});let c=(Array.isArray(r)?r:[]).filter(e=>e.type===`tool_use`),l=c.length===0;return typeof a==`string`&&(l=a===`end_turn`||a===`stop_sequence`),c.some(e=>e.name===`StructuredOutput`)&&(l=!0),dg(e,{agentId:o,subpath:t,at:s,finished:l,toolUses:c.length})}function pg(e,t){switch(t.type){case`frame`:return _g(e,t.frame,t.receivedAt);case`hydrate`:return i_(a_(e,t.messages,t.session??null),t.contextTokens);case`entries`:return s_(e,t.entries);case`prepend_entries`:return c_(e,t.entries);case`session`:return g_(e,t.session);case`local_prompt`:return v_(e,t);case`local_prompt_failed`:return b_(e,t.requestId);case`local_permission`:return r_(e,t.requestId,t.behavior,`local`);case`local_system`:{let n={kind:`system`,id:`sys:${e.nextId}`,uuid:null,parentToolUseId:null,turnId:null,timestamp:null,subtype:t.subtype,text:t.text};return D_({...e,nextId:e.nextId+1},n)}case`model_picked`:return mg(e,{type:`model_change`});case`settle_waiting`:return qg(e,t.requestId);case`reset`:return ug(e.sessionId)}}function mg(e,t){let n=cl(e.safeguardFallback,t);return n===e.safeguardFallback?e:{...e,safeguardFallback:n}}function hg(e){return/^Set model to\s/.test(e)}function gg(e,t,n){let r=n.uuid?`sys:${n.uuid}`:`sys:${e.nextId}`;if(e.index.get(r)!==void 0)return e;let i=e;if(t.retractedUuids.length>0){let e=new Set(t.retractedUuids),n=new Set(i.items.filter(t=>t.uuid!==null&&e.has(t.uuid)).map(e=>e.id));n.size>0&&(i=k_(i,n))}let a={kind:`system`,id:r,uuid:n.uuid,parentToolUseId:n.parentToolUseId,turnId:n.turnId,timestamp:n.timestamp,subtype:t.kind===`fallback`?cg:cte,text:t.text,refusal:t,...t.kind===`no_fallback`?{refusalBefore:i.safeguardFallback?.notice??null}:{}};if(i=D_(n.uuid?i:M_(i),a),n.parentToolUseId!==null)return i;let o=n.timestamp?Date.parse(n.timestamp):NaN;return mg(i,{type:`notice`,notice:t,at:Number.isFinite(o)?o:null,live:n.live})}function _g(e,t,n){let r=Sg(e,t,n);if(n===void 0||!yg(t,e,r))return r;let i=r.lastFrameAt;return i!==null&&n>=i&&n-i<1e3?r:{...r,lastFrameAt:n}}function vg(e){return e===`running`||e===`waiting_permission`}function yg(e,t,n){switch(e.type){case`agent`:return e.seq===null?e.message.type!==`system`||e.message.subtype!==`local_command`:!1;case`turn_started`:case`turn_finished`:case`prompt_delivered`:case`subagent_activity`:return!0;case`permission_request`:return n!==t;case`permission_resolved`:return!0;default:return!1}}function bg(e){if(e.lastFrameAt!==null||!e.hydrated||!vg(e.status))return e;let t=e.engineSince??0;for(let n=e.items.length-1;n>=0;n--){let r=e.items[n].timestamp,i=r?Date.parse(r):NaN;if(Number.isFinite(i)){i>t&&(t=i);break}}for(let n of Object.values(e.agentActivity))n.at>t&&(t=n.at);return t>0?{...e,lastFrameAt:t}:e}function xg(e,t,n){return t!==null||n===void 0||typeof e.timestamp==`string`?e:{...e,timestamp:new Date(n).toISOString()}}function Sg(e,t,n){switch(t.type){case`agent`:{if(t.seq!==null&&e.seen.has(`seq:${t.seq}`))return e;let r=Cg(e,xg(t.message,t.seq,n),{turnId:t.turnId,receivedAt:n,live:t.seq===null});return t.seq!==null&&(r=j_(r,`seq:${t.seq}`),(r.lastSeq===null||t.seq>r.lastSeq)&&(r={...r,lastSeq:t.seq})),r}case`turn_started`:{let n=`turnstart:${t.turnId}`;if(e.seen.has(n))return e;let r=j_(e,n);if(r={...r,activeTurnId:t.turnId,status:`running`,statusText:null,turnCachedTokens:0},t.requestId){let e=r.items.findIndex(e=>e.kind===`user`&&e.requestId===t.requestId);if(e>=0){let n={...r.items[e],turnId:t.turnId,waiting:!1};r=e<r.items.length-1?D_(k_(r,new Set([n.id])),n):O_(r,e,n)}}return r}case`turn_finished`:{let n=Qg(e,t.result,t.turnId,t.waitingRequestIds);return t.undelivered&&t.requestId?y_(n,t.requestId):n}case`prompt_delivered`:return Kg(e,t.text,t.deliveredAt,t.requestId);case`prompt_sent_now`:return Gg(e,t.requestId);case`prompt_cancelled`:{let n=e.items.filter(e=>e.kind===`user`&&!e.failed&&(e.requestId===t.requestId||(e.waiting||e.optimistic)&&e.deliveredAt===null&&e.text===t.text));return k_(e,new Set(n.map(e=>e.id)))}case`subagent_activity`:return dg(e,{agentId:t.agentId,subpath:t.subpath,at:Date.parse(t.at)||Date.now(),finished:t.finished,toolUses:t.toolUses});case`permission_request`:return n_(e,t.request,t.turnId,t.settled===!0);case`permission_resolved`:return r_(e,t.requestId,t.behavior,t.resolvedBy);case`session_state`:{let n=t.session;return g_((n.status===`idle`||n.status===`error`)&&e.pendingPermissions.length===0&&e.activeTurnId!==null?{...e,activeTurnId:null}:e,n)}case`error`:{if(t.code===`replay_truncated`||t.code===`replay_windowed`)return e;let r={kind:`error`,id:`err:${e.nextId}`,uuid:null,parentToolUseId:null,turnId:e.activeTurnId,timestamp:n===void 0?null:new Date(n).toISOString(),code:t.code,message:t.message,requestId:t.requestId??null};return D_({...e,nextId:e.nextId+1},r)}default:return e}}function Cg(e,t,n){let r=typeof t.uuid==`string`?t.uuid:null,i=t.type===`stream_event`||t.type===`tool_progress`,a=r&&!i?`uuid:${r}`:null;if(i&&r!==null&&r===e.lastLiveUuid)return e;if(a&&e.seen.has(a))return t.type===`assistant`?Og(e,t):e;let o=e;switch(t.type){case`system`:o=wg(e,t,n);break;case`stream_event`:o=Tg(e,t,n);break;case`assistant`:o=Dg(e,t,n);break;case`user`:o=Bg(e,t,n);break;case`result`:o=Xg(e,t,n);break;case`tool_progress`:o=e_(e,t);break;case`auth_status`:o=t_(e,t,n);break;default:return e}return a?o=j_(o,a):i&&r!==null&&(o={...o,lastLiveUuid:r}),o}function wg(e,t,n){switch(t.subtype){case`init`:{let r={model:I_(t.model),cwd:I_(t.cwd),tools:Array.isArray(t.tools)?t.tools.filter(e=>typeof e==`string`):[],permissionMode:I_(t.permissionMode),claudeCodeVersion:I_(t.claude_code_version),apiKeySource:I_(t.apiKeySource),sessionId:I_(t.session_id),mcpServers:Array.isArray(t.mcp_servers)?t.mcp_servers:[]};return{...e,init:r,engineSince:n.receivedAt??Date.now()}}case rl:case il:{let r=sl(t);return r?gg(e,r,{uuid:N_(t),parentToolUseId:P_(t),turnId:n.turnId??e.activeTurnId,timestamp:F_(t),live:n.live===!0}):e}case`compact_boundary`:{let r=t.compact_metadata??{},i={kind:`compact`,id:ute(e,`compact`,t),uuid:N_(t),parentToolUseId:P_(t),turnId:n.turnId,timestamp:F_(t),trigger:r.trigger===`manual`?`manual`:`auto`,preTokens:typeof r.pre_tokens==`number`?r.pre_tokens:0,postTokens:typeof r.post_tokens==`number`?r.post_tokens:null};return D_(M_(e),i)}case`status`:{let n=typeof t.status==`string`?t.status:null;return{...e,statusText:n}}case`task_notification`:{let r=Se({taskId:I_(t.task_id)||null,toolUseId:I_(t.tool_use_id)||null,status:I_(t.status)||null,summary:I_(t.summary)||null});if(C_(e,r))return e;let i=N_(t),a={kind:`user`,id:i?`u:${i}`:`i${e.nextId}`,uuid:i,parentToolUseId:P_(t),turnId:n.turnId,timestamp:F_(t),text:r,attachments:[],requestId:null,optimistic:!1,failed:!1,waiting:!1,deliveredAt:null,compactSummary:!1,taskNotification:!0,engineNote:!1};return e.index.get(a.id)===void 0?D_(i?e:M_(e),a):e}case`permission_denied`:{let n=I_(t.tool_use_id),r=I_(t.message);return A_(e,n,e=>{let t=e.name===`AskUserQuestion`&&r===`the user skipped the question`;return{...e,status:t?`skipped`:`denied`,result:e.result??{content:r||`Permission denied`,isError:!t,structured:null}}})}case`rewind_boundary`:{let n={kind:`system`,id:`sys:${e.nextId}`,uuid:N_(t),parentToolUseId:P_(t),turnId:e.activeTurnId,timestamp:F_(t),subtype:`rewind`,text:typeof t.content==`string`&&t.content.trim()?t.content.trim():`Rewound here — the conversation was taken back to this point and continued differently.`};return D_({...e,nextId:e.nextId+1},n)}default:{let n=typeof t.content==`string`?t.content.trim():``,r=n?Ig(n):null;if(!r||r.subtype===`caveat`)return e;let i=r.subtype===`local-command`?zg(n):null,a=r.subtype===`local-command`&&!i?sh(n):null,o=!i&&!a?fh(n):null,s={kind:`system`,id:`sys:${e.nextId}`,uuid:N_(t),parentToolUseId:P_(t),turnId:e.activeTurnId,timestamp:F_(t),subtype:i?`chat-notice`:a?sg:r.subtype,text:r.text,...i?{chatMarker:i}:{},...a?{newChat:a}:{},...o?{modelChange:o}:{}},c=D_({...e,nextId:e.nextId+1},s);return r.subtype===`local-command`&&hg(r.text)?mg(c,{type:`model_change`}):c}}}function Tg(e,t,n){let r=t.event;if(!r||typeof r!=`object`)return e;let i=P_(t),a=i??``,o=e.streams[a]??{messageId:null,model:null,blocks:{},unclaimed:[]};switch(r.type){case`message_start`:{let t=r.message,n={messageId:t?.id??null,model:t?.model??null,blocks:{},unclaimed:[]},i=e;for(let e of o.unclaimed)i=Eg(i,e);return{...i,streams:{...i.streams,[a]:n}}}case`content_block_start`:{let s=r.content_block,c=e,l;if(s.type===`text`)l={kind:`assistant`,id:`i${e.nextId}`,uuid:null,parentToolUseId:i,turnId:n.turnId,timestamp:F_(t),text:s.text??``,streaming:!0,model:o.model,messageId:o.messageId,error:null,aborted:!1},c=M_(c);else if(s.type===`thinking`||s.type===`redacted_thinking`){let r=Ag(s),a=n.receivedAt??null;l={kind:`thinking`,id:`i${e.nextId}`,uuid:null,parentToolUseId:i,turnId:n.turnId,timestamp:F_(t),text:s.type===`thinking`?s.thinking??``:``,streaming:!0,redacted:s.type===`redacted_thinking`,startedAt:r!==null&&a!==null?a-r:a,finishedAt:null,durationMs:r},c=M_(c)}else if(s.type===`tool_use`){let c=s;if(e.index.get(c.id)!==void 0){let t={...o.blocks,[r.index]:c.id};return{...e,streams:{...e.streams,[a]:{...o,blocks:t}}}}let u=c.input&&Object.keys(c.input).length>0;l={kind:`tool`,id:c.id,uuid:null,parentToolUseId:i,turnId:n.turnId,timestamp:F_(t),toolUseId:c.id,name:c.name,input:u?c.input:null,inputJson:u?JSON.stringify(c.input):``,status:`streaming`,result:null,startedAt:n.receivedAt??null,finishedAt:null,durationMs:null,elapsedSec:null,permissionRequestId:null,messageId:o.messageId}}else return e;c=D_(c,l);let u={...o.blocks,[r.index]:l.id},d=[...o.unclaimed,l.id];return{...c,streams:{...c.streams,[a]:{...o,blocks:u,unclaimed:d}}}}case`content_block_delta`:{let t=o.blocks[r.index];if(!t)return e;let n=e.index.get(t);if(n===void 0)return e;let i=e.items[n],a=r.delta;return a.type===`text_delta`&&i.kind===`assistant`?O_(e,n,{...i,text:i.text+a.text}):a.type===`thinking_delta`&&i.kind===`thinking`?O_(e,n,{...i,text:i.text+a.thinking}):a.type===`input_json_delta`&&i.kind===`tool`?O_(e,n,{...i,inputJson:i.inputJson+a.partial_json}):e}case`content_block_stop`:{let t=o.blocks[r.index];return t?Eg(e,t,n.receivedAt):e}case`message_delta`:case`message_stop`:case`ping`:return e;case`error`:{let a={kind:`error`,id:`err:${e.nextId}`,uuid:null,parentToolUseId:i,turnId:n.turnId,timestamp:F_(t),code:r.error?.type??`stream_error`,message:r.error?.message??`stream error`,requestId:null};return D_(M_(e),a)}default:return e}}function Eg(e,t,n){let r=e.index.get(t);if(r===void 0)return e;let i=e.items[r];if(i.kind===`thinking`){if(!i.streaming)return e;let t=n??null,a=i.startedAt!==null&&t!==null?Math.max(0,t-i.startedAt):null;return O_(e,r,{...i,streaming:!1,finishedAt:t,durationMs:i.durationMs!==null&&i.durationMs>0?i.durationMs:a??i.durationMs})}if(i.kind===`assistant`)return i.streaming?O_(e,r,{...i,streaming:!1}):e;if(i.kind===`tool`&&i.status===`streaming`){let t=i.input??z_(i.inputJson);return O_(e,r,{...i,input:t,status:`running`,startedAt:i.startedAt??n??null})}return e}function Dg(e,t,n){let r=t.local_command_source;if(typeof r==`string`){let i=Ig(r.trim());if(i&&(i.subtype===`local-command`||i.subtype===`local-command-error`)){let r={kind:`system`,id:`sys:${e.nextId}`,uuid:N_(t),parentToolUseId:P_(t),turnId:n.turnId??e.activeTurnId,timestamp:F_(t),subtype:i.subtype,text:i.text},a=D_({...e,nextId:e.nextId+1},r);return i.subtype===`local-command`&&hg(i.text)?mg(a,{type:`model_change`}):a}}let i=t.message??{},a=R_(i.content),o=P_(t),s=o??``,c=N_(t),l=F_(t),u=typeof t.error==`string`?t.error:null,d=t.aborted===!0,f=e;{let e=L_(i.usage?.cache_read_input_tokens)+L_(i.usage?.cache_creation_input_tokens),n=`usage:${i.id??``}`;if(e>0&&i.id&&!f.seen.has(n)&&(f={...j_(f,n),turnCachedTokens:f.turnCachedTokens+e}),o===null&&t.isSidechain!==!0){let t=L_(i.usage?.input_tokens)+e+L_(i.usage?.output_tokens);t>0&&t!==f.contextTokens&&(f={...f,contextTokens:t})}}let p=f.streams[s];for(let e of a){let t=p?kg(f,p,e):null;if(t){let r=f.index.get(t),a=f.items[r];f=O_(f,r,Ng(a,e,{uuid:c,timestamp:l,model:i.model??null,messageId:i.id??null,errorText:u,aborted:d,receivedAt:n.receivedAt})),p={...p,unclaimed:p.unclaimed.filter(e=>e!==t)},f={...f,streams:{...f.streams,[s]:p}};continue}let r=Pg(f,e,{uuid:c,timestamp:l,parentToolUseId:o,turnId:n.turnId,model:i.model??null,messageId:i.id??null,errorText:u,aborted:d,receivedAt:n.receivedAt});r&&(f=r)}if(a.length===0&&u){let e={kind:`error`,id:`err:${f.nextId}`,uuid:c,parentToolUseId:o,turnId:n.turnId,timestamp:l,code:`assistant_error`,message:u,requestId:null};f=D_(M_(f),e)}return f}function Og(e,t){let n=P_(t)??``,r=e.streams[n];if(!r||r.unclaimed.length===0)return e;let i=t.message??{},a=new Set,o=e,s=r;for(let e of R_(i.content)){let t=kg(o,s,e);t&&(a.add(t),s={...s,unclaimed:s.unclaimed.filter(e=>e!==t)},o={...o,streams:{...o.streams,[n]:s}})}return k_(e,a)}function kg(e,t,n){for(let r of t.unclaimed){let t=e.index.get(r);if(t===void 0)continue;let i=e.items[t];if(!i.uuid&&(n.type===`text`&&i.kind===`assistant`||(n.type===`thinking`||n.type===`redacted_thinking`)&&i.kind===`thinking`||n.type===`tool_use`&&i.kind===`tool`&&i.toolUseId===n.id))return r}return null}function Ag(e){let t=e?.duration_ms;return typeof t==`number`&&Number.isFinite(t)&&t>=0?t:null}function jg(e){if(!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function Mg(e,t,n=e.items.length){for(let r=n-1;r>=0;r--){let n=e.items[r];if(n.kind===`result`)break;if(n.parentToolUseId!==t){if(t!==null&&n.kind===`tool`&&n.toolUseId===t)return n.startedAt??jg(n.timestamp);continue}if(n.kind===`tool`||n.kind===`thinking`){let e=n.finishedAt??n.startedAt??jg(n.timestamp);if(e!==null)return e}else if(n.kind===`user`){let e=jg(n.deliveredAt)??jg(n.timestamp);if(e!==null)return e}else{let e=jg(n.timestamp);if(e!==null)return e}}return t===null?e.lastFrameAt:null}function Ng(e,t,n){if(e.kind===`assistant`&&t.type===`text`){let r=t.text??e.text;return{...e,uuid:n.uuid,timestamp:n.timestamp??e.timestamp,text:r.length>=e.text.length?r:e.text,streaming:!1,model:n.model??e.model,messageId:n.messageId??e.messageId,error:n.errorText,aborted:n.aborted}}if(e.kind===`thinking`){let r=t.type===`thinking`?t.thinking??e.text:e.text,i=Ag(t),a=e.streaming?n.receivedAt??e.finishedAt:e.finishedAt,o=e.startedAt!==null&&a!==null?Math.max(0,a-e.startedAt):null;return{...e,uuid:n.uuid,timestamp:n.timestamp??e.timestamp,text:r||e.text,streaming:!1,finishedAt:a,durationMs:i??(e.durationMs!==null&&e.durationMs>0?e.durationMs:null)??o??e.durationMs}}if(e.kind===`tool`&&t.type===`tool_use`){let r=t,i=r.input&&Object.keys(r.input).length>0?r.input:e.input??z_(e.inputJson);return{...e,uuid:n.uuid,timestamp:n.timestamp??e.timestamp,name:r.name??e.name,input:i,inputJson:e.inputJson||(i?JSON.stringify(i):``),status:e.status===`streaming`?`running`:e.status,messageId:n.messageId??e.messageId}}return e}function Pg(e,t,n){let r={uuid:n.uuid,parentToolUseId:n.parentToolUseId,turnId:n.turnId,timestamp:n.timestamp};if(t.type===`text`){let i={kind:`assistant`,id:`i${e.nextId}`,...r,text:t.text??``,streaming:!1,model:n.model,messageId:n.messageId,error:n.errorText,aborted:n.aborted};return D_(M_(e),i)}if(t.type===`thinking`||t.type===`redacted_thinking`){let i=Ag(t),a=n.receivedAt??jg(n.timestamp),o=Mg(e,n.parentToolUseId),s=o!==null&&a!==null&&a>=o?a-o:null,c=i??s,l=i!==null&&a!==null?a-i:o,u={kind:`thinking`,id:`i${e.nextId}`,...r,text:t.type===`thinking`?t.thinking??``:``,streaming:!1,redacted:t.type===`redacted_thinking`,startedAt:l,finishedAt:a,durationMs:c};return D_(M_(e),u)}if(t.type===`tool_use`){let i=t,a=e.index.get(i.id);if(a!==void 0){let r=e.items[a];return O_(e,a,Ng(r,t,n))}let o=i.input&&typeof i.input==`object`?i.input:null;return D_(e,{kind:`tool`,id:i.id,...r,toolUseId:i.id,name:i.name,input:o,inputJson:o?JSON.stringify(o):``,status:`running`,result:null,startedAt:n.receivedAt??jg(n.timestamp)??null,finishedAt:null,durationMs:null,elapsedSec:null,permissionRequestId:null,messageId:n.messageId})}return null}function Fg(e){return e.trim().replace(/\s+/g,` `)}function Ig(e){if(/^<local-command-caveat>/.test(e))return{subtype:`caveat`,text:``};let t=/^<local-command-(stdout|stderr)>([\s\S]*?)<\/local-command-\1>$/.exec(e);if(t){let e=t[2].replace(/\u001b\[[0-9;]*m/g,``).trim();return{subtype:t[1]===`stderr`?`local-command-error`:`local-command`,text:e}}let n=/<command-name>([^<]*)<\/command-name>/.exec(e);if(n&&/^<command-/.test(e)){let t=/<command-args>([^<]*)<\/command-args>/.exec(e)?.[1]?.trim()??``,r=n[1].trim(),i=mee(r.replace(/^\//,``));return{subtype:`command`,text:`${i===null?r:`/${i}`}${t?` `+t:``}`}}return null}function Lg(e){let t=e.charCodeAt(0);return t===9993||t===8617||t===8635||t===9888}function Rg(e){return Lg(e)?td(e):[]}function zg(e){if(!e.startsWith(`<local-command-stdout>`))return null;let t=ed(e);return t?.kind===`notice`?t:null}function Bg(e,t,n){let r=t.message??{},i=P_(t),a=N_(t),o=F_(t),s=t.isSynthetic===!0,c=e,l=[],u=[],d=!1;if(typeof r.content==`string`)l.push(r.content);else for(let e of R_(r.content))if(e.type===`text`)l.push(e.text??``);else if(e.type===`tool_result`){d=!0;let r=e;c=Jg(c,r.tool_use_id,{content:r.content??``,isError:r.is_error===!0,structured:t.tool_use_result??null},n.receivedAt??jg(o)??void 0)}else(e.type===`image`||e.type===`document`)&&u.push(e);let f=ge(l.join(`
|
|
117
117
|
`)).trim();if(be(f)&&C_(c,f))return c;let p=Ig(f);if(p?.subtype===`caveat`)return c;if(p){if(p.subtype===`command`&&i===null&&c.hasOptimisticUser){let e=Fg(p.text),t=c.items.find(t=>t.kind===`user`&&t.optimistic&&!t.failed&&Fg(t.text)===e);t&&(c=k_(c,new Set([t.id])))}let e=p.subtype===`local-command`?zg(f):null,t=p.subtype===`local-command`&&!e?sh(f):null,n=!e&&!t?fh(f):null,r={kind:`system`,id:`sys:${c.nextId}`,uuid:a,parentToolUseId:i,turnId:c.activeTurnId,timestamp:o,subtype:e?`chat-notice`:t?sg:p.subtype,text:p.text,...e?{chatMarker:e}:{},...t?{newChat:t}:{},...n?{modelChange:n}:{}},s=D_({...c,nextId:c.nextId+1},r);return p.subtype===`local-command`&&hg(p.text)?mg(s,{type:`model_change`}):s}if(f.length===0&&u.length===0||d&&f.length===0||s&&d)return c;let m=i===null?Rg(f):[],h=m[0]??null;if(i===null&&!s&&c.hasOptimisticUser&&h===null){let e=-1,t=!1;for(let n=0;n<c.items.length;n++){let r=c.items[n];if(!(r.kind!==`user`||!r.optimistic||r.failed)&&(t=!0,r.text===f)){e=n;break}}if(t||(c={...c,hasOptimisticUser:!1}),e>=0){let t=c.items[e],r={...t,uuid:a??t.uuid,timestamp:o??t.timestamp,optimistic:!1,turnId:t.turnId??n.turnId};return t.waiting&&e<c.items.length-1?D_(k_(c,new Set([t.id])),{...r,waiting:!1}):O_(c,e,r)}if(f.includes(`
|
|
118
118
|
`)){let e=Wg(c,f,a,o,n.turnId);if(e)return e}}let g=t.isMeta===!0||ue(f)||s&&f.length>0&&!ce(f),_=t.isCompactSummary===!0||L(f)||be(f),v=pc(f),y=!s&&!g&&!_&&v===null&&h===null&&i===null&&n.turnId!==null&&Vg(c,n.turnId),b=null;if(y&&c.earlyDeliveries.length>0){let e=lg(c.earlyDeliveries,Date.now());b=e.find(e=>e.text===f)??null,c={...c,earlyDeliveries:b?e.filter(e=>e!==b):e}}let x={kind:`user`,id:a?`u:${a}`:`i${c.nextId}`,uuid:a,parentToolUseId:i,turnId:n.turnId,timestamp:o,text:f,attachments:u,requestId:null,optimistic:!1,failed:!1,waiting:y&&b===null,deliveredAt:b?b.deliveredAt:null,compactSummary:t.isCompactSummary===!0||L(f),taskNotification:be(f),engineNote:!L(f)&&!be(f)&&g,...v?{scheduledTask:v.title}:{},...h?{chatMarker:h}:{},...m.length>1?{chatBatch:m}:{}};return c.index.get(x.id)===void 0?D_(a?c:M_(c),x):c}function Vg(e,t){if(e.status!==`running`)return!1;for(let n=e.items.length-1;n>=0;n--){let r=e.items[n];if(r.kind===`result`)return!1;if((t===null||r.turnId===null||r.turnId===t)&&(r.kind===`assistant`||r.kind===`thinking`||r.kind===`tool`))return!0}return!1}function Hg(e,t){let n=new Set(t??[]),r=e=>n.size>0&&(e.requestId!==void 0&&e.requestId!==null&&n.has(e.requestId)||(e.mergedRequestIds?.some(e=>n.has(e))??!1)),i=-1;for(let t=e.items.length-1;t>=0;t--){let n=e.items[t];if(n.kind===`user`&&n.waiting&&!r(n)){i=t;break}}if(i<0)return e;let a=e.items.map(e=>e.kind===`user`&&e.waiting&&!r(e)?{...e,waiting:!1}:e);return{...e,items:a}}function Ug(e,t){return e.length>0&&`\n${t}\n`.includes(`\n${e}\n`)}function Wg(e,t,n,r,i){let a=e.items.filter(e=>e.kind===`user`&&e.optimistic&&!e.failed&&e.parentToolUseId===null&&e.text!==t&&Ug(e.text,t));if(a.length<2)return null;let o=[...a].sort((e,n)=>t.indexOf(e.text)-t.indexOf(n.text));if(o.map(e=>e.text).join(`
|
|
119
119
|
`)!==t)return null;let s=o[0],c=o.map(e=>e.requestId).filter(e=>typeof e==`string`),l={...s,id:n?`u:${n}`:s.id,uuid:n??s.uuid,timestamp:r??s.timestamp,text:t,attachments:o.flatMap(e=>e.attachments),turnId:s.turnId??i,optimistic:!1,waiting:!1,...c.length>0?{mergedRequestIds:c}:{}};return D_(k_(e,new Set(o.map(e=>e.id))),l)}function Gg(e,t){let n=new Set,r=[];for(let i of e.items)i.kind!==`user`||i.failed||!i.waiting||(i.requestId===t||(i.mergedRequestIds?.includes(t)??!1))&&(n.add(i.id),r.push({...i,waiting:!1}));if(r.length===0)return e;let i=k_(e,n);for(let e of r)i=D_(i,e);return i}function Kg(e,t,n,r){let i=e=>r!==void 0&&(e.requestId===r||(e.mergedRequestIds?.includes(r)??!1)),a=e.items.some(e=>e.kind===`user`&&!e.failed&&i(e));for(let r=e.items.length-1;r>=0;r--){let o=e.items[r];if(o.kind!==`user`||o.failed||o.chatMarker!==void 0||(a?!i(o):o.text!==t))continue;if(!o.optimistic&&!o.waiting&&o.deliveredAt!==null)return e;let s={...o,optimistic:!1,waiting:!1,deliveredAt:n??o.deliveredAt??new Date().toISOString()};return o.waiting&&r<e.items.length-1?D_(k_(e,new Set([o.id])),s):O_(e,r,s)}if(t.trim()===``||be(t))return e;let o=Date.now(),s=lg(e.earlyDeliveries,o).filter(e=>e.text!==t);return s.push({text:t,deliveredAt:n??new Date(o).toISOString(),at:o}),{...e,earlyDeliveries:s.slice(-8)}}function qg(e,t){let n=new Date().toISOString(),r=new Set,i=[];for(let a of e.items)a.kind!==`user`||a.failed||!a.waiting||t!==void 0&&!(a.requestId===t||(a.mergedRequestIds?.includes(t)??!1))||(r.add(a.id),i.push({...a,optimistic:!1,waiting:!1,deliveredAt:a.deliveredAt??n}));if(i.length===0)return e;let a=k_(e,r);for(let e of i)a=D_(a,e);return a}function Jg(e,t,n,r){let i=e.index.get(t);if(i===void 0)return D_(e,{kind:`tool`,id:t,uuid:null,parentToolUseId:null,turnId:null,timestamp:null,toolUseId:t,name:`unknown`,input:null,inputJson:``,status:n.isError?`error`:`done`,result:n,startedAt:null,finishedAt:r??null,durationMs:null,elapsedSec:null,permissionRequestId:null,messageId:null});let a=e.items[i];if(a.result&&a.status!==`running`&&a.status!==`streaming`&&a.status!==`pending`)return e;let o=r??null,s=a.startedAt!==null&&o!==null?Math.max(0,o-a.startedAt):a.durationMs;return O_(e,i,{...a,input:a.input??z_(a.inputJson),result:Yg(a.name,n)?{...n,isError:!1}:n,status:Yg(a.name,n)?`skipped`:n.isError?`error`:`done`,finishedAt:o,durationMs:s})}function Yg(e,t){return!t.isError||e!==`AskUserQuestion`?!1:typeof t.content==`string`&&t.content.includes(`the user skipped the question`)}function Xg(e,t,n){let r=Hm(t.usage,t.modelUsage),i=Array.isArray(t.permission_denials)?t.permission_denials:[],a=n.turnId;return $g(e,{kind:`result`,id:a?`result:${a}`:N_(t)?`result:${N_(t)}`:`result:${e.nextId}`,uuid:N_(t),parentToolUseId:null,turnId:a,timestamp:F_(t),subtype:typeof t.subtype==`string`?t.subtype:`success`,isError:t.is_error===!0||typeof t.result==`string`&&/^API Error\b/i.test(t.result.trim()),costUsd:L_(t.total_cost_usd),durationMs:L_(t.duration_ms),durationApiMs:typeof t.duration_api_ms==`number`?t.duration_api_ms:null,numTurns:L_(t.num_turns),inputTokens:r.input,cachedInputTokens:r.cached||e.turnCachedTokens,outputTokens:r.output,text:typeof t.result==`string`?t.result:null,errors:Array.isArray(t.errors)?t.errors.map(String):[],stopReason:typeof t.stop_reason==`string`?t.stop_reason:null,structuredOutput:t.structured_output??null,...Zg(t.safeguards)?{safeguards:t.safeguards}:{}},new Set(i.map(e=>e.tool_use_id??``)),n.receivedAt)}function Zg(e){if(typeof e!=`object`||!e)return!1;let t=e;return(t.reason===`safeguards`||t.reason===`safety_filters`)&&(t.outcome===`retried`||t.outcome===`blocked`)}function Qg(e,t,n,r){e=Hg(e,r);let i=`result:${n}`,a=e.index.get(i),o={kind:`result`,id:i,uuid:a===void 0?null:e.items[a].uuid,parentToolUseId:null,turnId:n,timestamp:a===void 0?null:e.items[a].timestamp,subtype:t.subtype,isError:t.isError,costUsd:t.totalCostUsd,durationMs:t.durationMs,durationApiMs:a===void 0?null:e.items[a].durationApiMs,numTurns:t.numTurns,inputTokens:t.inputTokens,cachedInputTokens:t.cachedInputTokens??(a===void 0?void 0:e.items[a].cachedInputTokens)??e.turnCachedTokens,outputTokens:t.outputTokens,text:t.result,errors:t.errors??[],stopReason:t.stopReason,structuredOutput:t.structuredOutput??null,...t.safeguards?{safeguards:t.safeguards}:{}};return $g(e,o,new Set,void 0)}function $g(e,t,n,r){let i=e,a=i.index.get(t.id),o=a!==void 0;i=a===void 0?D_(M_(i),t):O_(i,a,t);let s=i.items.map(e=>{if((e.kind===`assistant`||e.kind===`thinking`)&&e.streaming)return{...e,streaming:!1};if(e.kind===`tool`&&e.result===null&&(e.status===`streaming`||e.status===`running`||e.status===`pending`)){let t=n.has(e.toolUseId)?`denied`:`cancelled`;return{...e,status:t,input:e.input??z_(e.inputJson),finishedAt:r??null}}return e}),c=o?i.totals:{costUsd:i.totals.costUsd+t.costUsd,inputTokens:i.totals.inputTokens+t.inputTokens,cachedInputTokens:i.totals.cachedInputTokens+(t.cachedInputTokens??0),outputTokens:i.totals.outputTokens+t.outputTokens,turns:i.totals.turns+1};return{...i,items:s,totals:c,status:t.isError?`error`:`idle`,activeTurnId:null,statusText:null,streams:{},pendingPermissions:[]}}function e_(e,t){let n=I_(t.tool_use_id),r=typeof t.elapsed_time_seconds==`number`?t.elapsed_time_seconds:null;return!n||r===null?e:A_(e,n,e=>e.result?e:{...e,elapsedSec:r})}function t_(e,t,n){let r=Array.isArray(t.output)?t.output.map(String).join(`
|
|
@@ -236,7 +236,7 @@ else:
|
|
|
236
236
|
`)&&(r.repositories=i);let a=z5(e);aye(t.chatDefaults,a)||(r.chatDefaults=a),e.memoryEnabled!==n.memoryEnabled&&(r.memoryEnabled=e.memoryEnabled),e.memory!==n.memory&&(r.memory=e.memory),e.tasksEnabled!==n.tasksEnabled&&(r.tasksEnabled=e.tasksEnabled);let o=Number(e.minInterval);return String(o)!==n.minInterval&&Number.isInteger(o)&&(r.minRoutineIntervalMinutes=o),r}function oye(e){let t=z5(e),n=R5(e.repositories),r=Number(e.minInterval);return{name:e.name.trim(),instructions:e.instructions,...e.goal.trim()?{goal:e.goal}:{},...n.length>0?{repositories:n}:{},...t?{chatDefaults:t}:{},...e.memoryEnabled?{memoryEnabled:!0}:{},...e.memory?{memory:e.memory}:{},...e.tasksEnabled?{}:{tasksEnabled:!1},...Number.isInteger(r)&&r!==15?{minRoutineIntervalMinutes:r}:{}}}function sye(e,t){if(t===null){let t=L5(null);return Object.keys(t).some(n=>e[n]!==t[n])}return Object.keys(V5(e,t)).length>0}function H5(e){let t=typeof window<`u`?window.oonacode:void 0;t?.openExternal?t.openExternal(e):window.open(e,`_blank`,`noopener,noreferrer`)}function cye({open:e,onClose:t}){let{state:n,actions:r}=W(),i=n.claudeLogin,a=n.ui.claudeLoginMode,[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(null),g=(0,v.useRef)(null),[_,y]=(0,v.useState)(0),[b,x]=(0,v.useState)(null),S=i?.phase===`starting`||i?.phase===`awaiting_browser`||i?.phase===`awaiting_code`,C=i!=null&&(S||b!==null&&i.id===b),w=C?i:null,T=C&&S,E=w?.phase??`idle`,D=T?w?.url??w?.fallbackUrl??null:null,O=E===`connected`,k=O||E===`failed`||E===`cancelled`,A=!a&&!S&&!m,j=k&&!A;(0,v.useEffect)(()=>{if(!e)return;s(``),h(null),p(!1),x(null),g.current=null,r.refreshClaudeLogin();let t=setInterval(()=>void r.refreshClaudeLogin(),2e3);return()=>clearInterval(t)},[e,r]),(0,v.useEffect)(()=>{if(!e||!a)return;let t=!1;return(async()=>{let e=await r.startClaudeLogin();t||!e||(e.login?x(e.login.id):h(e))})(),()=>{t=!0}},[e,a,_,r]),(0,v.useEffect)(()=>{!e||!D||!a||g.current===D||!T||(g.current=D,a===`open`?H5(D):navigator.clipboard?navigator.clipboard.writeText(D).then(()=>{d(!0),r.toast(`info`,`Sign-in link copied — paste it into the browser where you are signed in to Claude`),setTimeout(()=>d(!1),2500)}).catch(()=>r.toast(`error`,`Could not copy — use the Copy button below`)):r.toast(`error`,`Could not copy — select the link and copy it by hand`))},[e,D,a,T,r]),(0,v.useEffect)(()=>{w?.phase===`connected`&&r.refreshClaudeSubscription()},[w?.phase,r]);let M=m?.command?`${m.command.file} ${m.command.args.join(` `)}`:null,N=async()=>{if(D)try{await navigator.clipboard.writeText(D),d(!0),setTimeout(()=>d(!1),1500)}catch{r.toast(`error`,`Could not copy — select the link and copy it by hand`)}},ee=async()=>{if(o.trim()){l(!0);try{await r.submitClaudeLoginCode(o)&&s(``)}finally{l(!1)}}},te=A?(0,U.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-end gap-2`,children:[(0,U.jsx)(K,{onClick:t,"data-testid":`claude-login-close`,children:`Close`}),(0,U.jsxs)(K,{onClick:()=>r.openClaudeLogin(`copy`),"data-testid":`claude-login-copy-mode`,children:[(0,U.jsx)(G.Copy,{className:`w-4 h-4`}),` Copy link`]}),(0,U.jsxs)(K,{variant:`primary`,onClick:()=>r.openClaudeLogin(`open`),"data-testid":`claude-login-open-mode`,children:[(0,U.jsx)(G.LogIn,{className:`w-4 h-4`}),` Sign in with my subscription`]})]}):j||m?(0,U.jsxs)(`div`,{className:`flex w-full items-center justify-end gap-2`,children:[O?null:(0,U.jsx)(K,{onClick:()=>{g.current=null,h(null),x(null),a||r.openClaudeLogin(`open`),y(e=>e+1)},"data-testid":`claude-login-retry`,children:`Try again`}),(0,U.jsx)(K,{variant:`primary`,onClick:t,"data-testid":`claude-login-close`,children:`Close`})]}):(0,U.jsxs)(`div`,{className:`flex w-full items-center justify-end gap-2`,children:[(0,U.jsx)(K,{onClick:t,children:`Keep in background`}),(0,U.jsx)(K,{variant:`danger`,onClick:()=>void r.cancelClaudeLogin(),"data-testid":`claude-login-cancel`,children:`Cancel sign-in`})]});return(0,U.jsx)(GS,{open:e,title:`Connect your Claude subscription`,onClose:t,footer:te,children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Your Claude Pro/Max login runs the genuine Claude Code engine directly against api.anthropic.com — never through the gateway. The token it stores lasts a year and syncs to every PC you sign in to.`}),A?(0,U.jsxs)(`div`,{className:`space-y-2 text-sm`,"data-testid":`claude-login-choose`,children:[(0,U.jsxs)(`p`,{children:[(0,U.jsx)(`span`,{className:`font-medium`,children:`Sign in with my subscription`}),` opens the Claude sign-in page in this PC's browser.`]}),(0,U.jsxs)(`p`,{children:[(0,U.jsx)(`span`,{className:`font-medium`,children:`Copy link`}),` copies the same page's link for the browser where you are already signed in to Claude — any browser on this PC works.`]}),(0,U.jsx)(`p`,{className:`text-fg-faint`,children:`Either way this window connects by itself when you finish signing in.`})]}):null,A?null:(0,U.jsx)(`div`,{className:`rounded-md border border-border bg-surface-2 p-3 text-xs`,"data-testid":`claude-login-wait`,children:D?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`mb-1 text-fg-faint`,children:a===`copy`?`Sign-in link (copied):`:`Sign-in link (opened in your browser):`}),(0,U.jsx)(`div`,{className:`break-all font-mono select-all`,"data-testid":`claude-login-url`,children:D}),(0,U.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,U.jsxs)(K,{size:`sm`,onClick:()=>void N(),"data-testid":`claude-login-copy`,children:[(0,U.jsx)(G.Copy,{className:`w-3 h-3`}),` `,u?`Copied`:`Copy link`]}),(0,U.jsx)(K,{size:`sm`,onClick:()=>H5(D),children:`Open in browser`})]})]}):O?null:(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-fg-muted`,children:[(0,U.jsx)(G.Spinner,{className:`w-4 h-4 animate-spin`}),` Preparing your sign-in link…`]})}),(0,U.jsx)(`div`,{className:H(`text-sm`,O?`text-ok`:E===`failed`?`text-danger`:`text-fg-muted`),"data-testid":`claude-login-status`,children:A?null:O?`Connected — your Claude subscription is stored in the vault and runs from this PC.`:T&&D?w?.message??`Waiting for you to finish in the browser…`:w?.message??m?.instructions??`Starting the Claude sign-in…`}),T&&D?(0,U.jsx)(`div`,{className:`text-xs`,children:f?(0,U.jsx)(HS,{label:`The page showed a code instead? Paste it here`,children:(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(`input`,{className:q,value:o,onChange:e=>s(e.target.value),placeholder:`paste the code here`,autoComplete:`off`,spellCheck:!1,"data-testid":`claude-login-code`,onKeyDown:e=>{e.key===`Enter`&&ee()}}),(0,U.jsx)(K,{variant:`primary`,busy:c,disabled:!o.trim(),onClick:()=>void ee(),"data-testid":`claude-login-submit`,children:`Continue`})]})}):(0,U.jsx)(`button`,{type:`button`,className:`text-fg-faint underline hover:text-fg`,onClick:()=>p(!0),"data-testid":`claude-login-show-code`,children:`The page showed a code instead? Paste it here`})}):null,M?(0,U.jsxs)(`div`,{className:`rounded-md border border-border bg-surface-2 p-3 text-xs`,children:[(0,U.jsx)(`div`,{className:`mb-1 text-fg-faint`,children:`This host cannot open a terminal for the engine. Run this in a terminal on this PC, then add the printed token as a subscription credential:`}),(0,U.jsx)(pN,{code:M,language:n.info?.platform===`win32`?`powershell`:`bash`})]}):null]})})}function U5({compact:e=!1}){let{actions:t}=W(),[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(!1),u=(0,v.useRef)(null),d=(0,v.useCallback)(async()=>{let e=await t.githubLink(`get`);e&&r(e)},[t]);(0,v.useEffect)(()=>{d()},[d]);let f=n?.login.phase===`awaiting_approval`;(0,v.useEffect)(()=>{if(!f)return;let e=setInterval(()=>void d(),2e3);return()=>clearInterval(e)},[f,d]);let p=f?n?.login.verificationUriComplete??n?.login.verificationUri??null:null;if((0,v.useEffect)(()=>{let e=n?.login.id;!f||!p||!e||u.current===e||(u.current=e,H5(p))},[f,p,n?.login.id]),!n)return null;let m=async e=>{a(!0);try{let n=await t.githubLink(e);n&&r(n)}finally{a(!1),s(!1)}},h=e=>{navigator.clipboard?.writeText(e).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)}).catch(()=>t.toast(`error`,`Could not copy — select it and copy by hand`))},g=n.account,_=n.login.phase===`failed`||n.login.phase===`expired`;return(0,U.jsxs)(`div`,{className:`space-y-2 rounded-md border border-border bg-surface-2/40 p-3 text-sm`,"data-testid":`github-link`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(G.GitBranch,{className:`h-4 w-4 shrink-0`}),g?(0,U.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,"data-testid":`github-linked`,children:[`GitHub linked as `,(0,U.jsxs)(`b`,{children:[`@`,g.login]}),g.name?(0,U.jsxs)(`span`,{className:`text-fg-muted`,children:[` · `,g.name]}):null]}):(0,U.jsx)(`span`,{className:`min-w-0 flex-1`,children:`GitHub not linked`}),g?(0,U.jsx)(K,{size:`sm`,variant:o?`danger`:`ghost`,disabled:i,onClick:()=>o?void m(`unlink`):s(!0),"data-testid":`github-unlink`,children:o?`Unlink — sure?`:`Unlink`}):n.available&&!f?(0,U.jsx)(K,{size:`sm`,variant:`primary`,disabled:i,onClick:()=>void m(`start`),"data-testid":`github-link-start`,children:`Link GitHub`}):null]}),f?(0,U.jsxs)(`div`,{className:`space-y-2`,"data-testid":`github-link-pending`,children:[(0,U.jsxs)(`p`,{className:`text-fg-muted`,children:[`GitHub’s page opened in your browser. If it did not, open`,` `,(0,U.jsx)(`a`,{className:`underline`,href:p??`#`,onClick:e=>{e.preventDefault(),p&&H5(p)},children:p}),` `,`on any device and enter:`]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`code`,{className:`rounded border border-border px-2 py-1 font-mono text-base`,"data-testid":`github-user-code`,children:n.login.userCode}),(0,U.jsxs)(K,{size:`sm`,onClick:()=>n.login.userCode&&h(n.login.userCode),children:[(0,U.jsx)(G.Copy,{className:`h-3.5 w-3.5`}),` `,c?`Copied`:`Copy`]}),(0,U.jsx)(`span`,{className:`flex-1`}),(0,U.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>void m(`cancel`),children:`Cancel`})]}),(0,U.jsx)(`p`,{className:`text-xs text-fg-faint`,children:`Waiting for GitHub…`})]}):null,_?(0,U.jsxs)(`p`,{className:`text-xs text-danger`,"data-testid":`github-link-ended`,children:[n.login.message??`The link did not complete.`,` Press Link GitHub to try again.`]}):null,!e||!g?(0,U.jsx)(`p`,{className:`text-xs text-fg-faint`,children:g?`The agent’s git and gh use this account on every PC of yours, for github.com only. The token stays in your encrypted vault and never reaches the OonaCode server.`:n.available?`Public repositories need nothing. For private ones, link GitHub: the agent’s git and gh then sign in as you on every PC of yours. Without it, the agent uses whatever git sign-in this PC already has.`:n.unavailableReason??`Link GitHub is not available.`}):null]})}var W5=`__new__`;function G5({title:e,children:t}){return(0,U.jsxs)(`section`,{className:`space-y-2 border-t border-border pt-3 first:border-t-0 first:pt-0`,children:[(0,U.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-faint`,children:e}),t]})}function lye({open:e,startNew:t=!1,selectId:n=null,onClose:r}){let{state:i,actions:a}=W(),o=i.vaultProjects,s=i.info&&i.info.platform!==`win32`?`${i.info.homeDir??`/home/you`}/src/my-app`:`C:\\src\\my-app`,[c,l]=(0,v.useState)(W5),[u,d]=(0,v.useState)(L5(null)),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(!1),g=(e,t)=>d(n=>({...n,[e]:t}));(0,v.useEffect)(()=>{if(!e)return;a.refreshVaultProjects();let r=n&&o.some(e=>e.id===n)?n:null;l(t?W5:r??o[0]?.id??W5),h(!1)},[e]);let _=c===W5?null:o.find(e=>e.id===c)??null;(0,v.useEffect)(()=>{d(L5(_)),h(!1)},[_?.id,_?.updatedAt]);let y=(0,v.useMemo)(()=>i.providers.filter(e=>e.configured).flatMap(e=>e.definition.models.map(t=>({key:F5(e.definition.id,t.id),label:`${e.definition.displayName} — ${t.displayName||t.id}`,option:t}))),[i.providers]),b=y.find(e=>e.key===u.model)??null,x=u.model&&!b?I5(u.model):null,S=b?ke(b.option):[],C=sye(u,_),w=C?B5(u):null;async function T(){if(!B5(u)){p(!0);try{if(_===null){let e=await a.createVaultProject(oye(u));e&&l(e.id)}else await a.updateVaultProject(_.id,V5(u,_))}finally{p(!1)}}}async function E(){if(_){if(!m){h(!0);return}p(!0);try{await a.deleteVaultProject(_.id)&&l(W5)}finally{p(!1)}}}async function D(){let e=await window.oonacode?.pickDirectory?.({title:`The folder new chats in this project run in`,...u.cwd?{defaultPath:u.cwd}:{}});e&&g(`cwd`,e)}let k=e=>i.sessions.filter(t=>t.projectId===e).length,A=e=>e.sessionCount??k(e.id),j=_?A(_):0;return(0,U.jsx)(GS,{open:e,title:`Projects`,onClose:r,wide:!0,footer:(0,U.jsxs)(U.Fragment,{children:[_?j>0?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,"data-testid":`project-delete-reason`,children:O(j)}),(0,U.jsx)(K,{variant:`ghost`,disabled:!0,"data-testid":`project-delete`,children:`Delete project`})]}):(0,U.jsx)(K,{variant:m?`danger`:`ghost`,onClick:E,disabled:f,"data-testid":`project-delete`,children:m?`Delete ${_.name}?`:`Delete project`}):null,(0,U.jsx)(`span`,{className:`flex-1`}),w?(0,U.jsx)(`span`,{className:`text-xs text-danger`,"data-testid":`project-problem`,children:w}):null,(0,U.jsx)(K,{variant:`ghost`,onClick:r,children:`Close`}),(0,U.jsx)(K,{variant:`primary`,onClick:T,disabled:f||!C||w!==null,"data-testid":`project-save`,children:_===null?`Create project`:`Save`})]}),children:(0,U.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-[180px_1fr]`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5`,"data-testid":`projects-list`,children:[(0,U.jsxs)(`button`,{type:`button`,className:H(`flex items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm`,c===W5?`bg-accent-soft text-fg`:`hover:bg-surface-2 text-fg-muted`),onClick:()=>l(W5),"data-testid":`project-new`,children:[(0,U.jsx)(G.Plus,{className:`w-3.5 h-3.5`}),` New project`]}),o.map(e=>(0,U.jsxs)(`button`,{type:`button`,className:H(`flex items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm`,c===e.id?`bg-accent-soft text-fg`:`hover:bg-surface-2 text-fg`),onClick:()=>l(e.id),"data-testid":`project-item-${e.id}`,children:[(0,U.jsx)(G.Project,{className:`w-3.5 h-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,U.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:A(e)})]},e.id))]}),(0,U.jsxs)(`div`,{className:`max-h-[65vh] space-y-4 overflow-y-auto pr-1`,children:[(0,U.jsxs)(G5,{title:`Project`,children:[(0,U.jsx)(HS,{label:`Name`,children:(0,U.jsx)(`input`,{className:q,value:u.name,onChange:e=>g(`name`,e.target.value),placeholder:`My app`,maxLength:dc.name,"data-testid":`project-name`})}),(0,U.jsx)(HS,{label:`Goal (optional)`,hint:`What the project is for, in a line or two.`,children:(0,U.jsx)(`input`,{className:q,value:u.goal,onChange:e=>g(`goal`,e.target.value),placeholder:`A desktop app that…`,maxLength:dc.goal,"data-testid":`project-goal`})}),(0,U.jsx)(HS,{label:`Instructions for the agent (optional)`,children:(0,U.jsx)(`textarea`,{className:H(q,`h-40 font-mono text-xs`),value:u.instructions,onChange:e=>g(`instructions`,e.target.value),placeholder:`Standing rules for every chat in this project — e.g.
|
|
237
237
|
- push to the feature branch, never to main
|
|
238
238
|
- run the tests before saying a change is done
|
|
239
|
-
- use the browser on port 9170 for anything on the web`,maxLength:dc.instructions,"data-testid":`project-instructions`})})]}),(0,U.jsxs)(G5,{title:`Repositories`,children:[(0,U.jsx)(HS,{label:`One per line (optional)`,hint:`Every chat in the project is told about them.`,children:(0,U.jsx)(`textarea`,{className:H(q,`h-16 font-mono text-xs`),value:u.repositories,onChange:e=>g(`repositories`,e.target.value),placeholder:`https://github.com/you/app`,"data-testid":`project-repositories`})}),(0,U.jsx)(U5,{compact:!0})]}),(0,U.jsxs)(G5,{title:`New chats`,children:[(0,U.jsx)(HS,{label:`Model`,hint:`What a new chat in this project starts on.`,children:(0,U.jsxs)(`select`,{className:q,value:u.model,onChange:e=>{g(`model`,e.target.value),g(`effort`,``)},"data-testid":`project-model`,children:[(0,U.jsx)(`option`,{value:``,children:`Whatever a new chat would start on`}),x?(0,U.jsxs)(`option`,{value:u.model,children:[x.model,` (not on this PC)`]}):null,y.map(e=>(0,U.jsx)(`option`,{value:e.key,children:e.label},e.key))]})}),S.length>0?(0,U.jsx)(HS,{label:`Effort`,children:(0,U.jsxs)(`select`,{className:q,value:u.effort,onChange:e=>g(`effort`,e.target.value),"data-testid":`project-effort`,children:[(0,U.jsx)(`option`,{value:``,children:b&&Oe(b.option)?`Default (${Oe(b.option)})`:`Default`}),S.map(e=>(0,U.jsx)(`option`,{value:e,children:e},e))]})}):null,(0,U.jsx)(HS,{label:`Folder`,hint:`Where a new chat runs; left empty, each chat gets its own.`,children:(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(`input`,{className:H(q,`flex-1 font-mono text-xs`),value:u.cwd,onChange:e=>g(`cwd`,e.target.value),placeholder:s,"data-testid":`project-cwd`}),window.oonacode?.pickDirectory?(0,U.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>void D(),children:`Choose…`}):null]})})]}),(0,U.jsxs)(G5,{title:`Memory`,children:[(0,U.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:u.memoryEnabled,onChange:e=>g(`memoryEnabled`,e.target.checked),"data-testid":`project-memory-enabled`}),(0,U.jsx)(`span`,{children:`Keep a project memory — notes every chat of the project reads at its start, and the agent keeps up to date.`})]}),u.memoryEnabled?(0,U.jsx)(`textarea`,{className:H(q,`h-28 font-mono text-xs`),value:u.memory,onChange:e=>g(`memory`,e.target.value),placeholder:`Nothing noted yet.`,maxLength:dc.memory,"data-testid":`project-memory`}):null]}),(0,U.jsxs)(G5,{title:`Scheduled tasks`,children:[(0,U.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:u.tasksEnabled,onChange:e=>g(`tasksEnabled`,e.target.checked),"data-testid":`project-tasks-enabled`}),(0,U.jsx)(`span`,{children:`The agent may schedule work in this project's chats — once, or on a repeat — with OonaCode's scheduler on this PC.`})]}),u.tasksEnabled?(0,U.jsx)(HS,{label:`Shortest repeat, in minutes`,children:(0,U.jsx)(`input`,{className:H(q,`w-28`),inputMode:`numeric`,value:u.minInterval,onChange:e=>g(`minInterval`,e.target.value),"data-testid":`project-min-interval`})}):null,_?(0,U.jsx)(dP,{projectId:_.id,showChat:!0}):null]}),(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Saved settings reach the project's chats at their next message. Projects live in your vault: only your own devices can read them.`})]})]})})}function uye({open:e,onClose:t}){return(0,U.jsx)(GS,{open:e,title:`Export my chats`,onClose:t,children:(0,U.jsx)(dye,{onDone:t})})}function dye({onDone:e}){let{api:t,state:n}=W(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(0),p=n.sessionsTotal||n.sessions.length;(0,v.useEffect)(()=>{if(!a){f(0);return}let e=Date.now(),t=setInterval(()=>f(Math.floor((Date.now()-e)/1e3)),1e3);return()=>clearInterval(t)},[a]);let m=async()=>{if(!t.exportSessionsArchive){c(`this PC is running an older OonaCode that cannot export chats`);return}o(!0),c(null);try{let n=await t.exportSessionsArchive(r),a=URL.createObjectURL(n),o=document.createElement(`a`);o.href=a,o.download=`oonacode-chats-${new Date().toISOString().slice(0,10)}.zip`,o.click(),URL.revokeObjectURL(a),i(``),u(!1),e()}catch(e){c(e instanceof Error?e.message:`the export failed`)}finally{o(!1)}};return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(GS,{open:a,title:`Exporting your chats`,onClose:()=>void 0,children:(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsx)(G.Spinner,{className:`mt-0.5 w-5 h-5 shrink-0 text-accent`}),(0,U.jsxs)(`div`,{className:`min-w-0 text-sm`,children:[(0,U.jsxs)(`div`,{className:`font-medium`,children:[`Packing`,` `,p>0?`${p} chat${p===1?``:`s`}`:`your chats`,`…`]}),(0,U.jsxs)(`div`,{className:`mt-1 tabular text-fg-muted`,children:[Math.floor(d/60),`:`,String(d%60).padStart(2,`0`),` elapsed`]}),(0,U.jsx)(`p`,{className:`mt-2 text-xs text-fg-faint`,children:`Your PC writes the whole archive before the download starts, so nothing appears in your downloads until it is finished. A long history can take a minute or two — this is normal, and you do not need to press anything again.`})]})]})}),(0,U.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`One zip with a plain `,(0,U.jsx)(`code`,{children:`.txt`}),` of every conversation on this PC, plus an index. It is for reading and copying from — there is no way to load it back in.`]}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-warn`,children:`The zip is not encrypted: anyone who opens it can read every conversation in it.`}),l?(0,U.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`input`,{type:`password`,autoFocus:!0,className:q+` max-w-[16rem]`,placeholder:`Account password`,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&r&&m()},"data-testid":`export-chats-password`}),(0,U.jsx)(K,{onClick:()=>void m(),disabled:a||!r,children:a?`Exporting…`:`Export`}),(0,U.jsx)(K,{variant:`ghost`,onClick:()=>{u(!1),i(``),c(null)},children:`Cancel`})]}):(0,U.jsx)(K,{className:`mt-2`,onClick:()=>u(!0),"data-testid":`export-chats`,children:`Export chats…`}),s?(0,U.jsx)(`div`,{className:`mt-2 text-xs text-danger`,children:s}):null]})}function fye({open:e,onClose:t}){return(0,U.jsx)(GS,{open:e,title:`Connect an AI tool`,onClose:t,wide:!0,children:e?(0,U.jsx)(mye,{}):null})}var K5={hour:`One hour`,day:`One day`,"until-revoked":`Until I revoke it`};function pye(e){let t=e.chats,n=`${t} chat${t===1?``:`s`}`,r=e.outcome===`refused`?`refused (${e.call})`:e.call===`list_chats`?`listed ${n}`:e.call===`read_chat`?`read ${n}`:`searched ${n}`;return`${G_(e.at)} · ${r}`}function mye(){let{api:e,state:t}=W(),[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),m=!!(e.listAiToolGrants&&e.createAiToolGrant&&e.revokeAiToolGrant),h=(0,v.useCallback)(async()=>{if(e.listAiToolGrants)try{let t=await e.listAiToolGrants();r(t.grants),a(null)}catch(e){a(Y_(e))}},[e]);(0,v.useEffect)(()=>{h(),e.listVaultProjects().then(e=>s(e.projects)).catch(()=>s([]))},[e,h]);let g=(0,v.useCallback)(e=>o.find(t=>t.id===e)?.name??`one project`,[o]),_=e=>{if(e.kind===`all`)return`All chats on this PC`;if(e.kind===`chats`){let t=e.chatIds.length;return`${t} chosen chat${t===1?``:`s`}`}return`Project: ${g(e.projectId)}`},y=async t=>{if(e.revokeAiToolGrant){p(t);try{await e.revokeAiToolGrant(t),await h()}catch(e){a(Y_(e))}finally{p(null)}}};return m?(0,U.jsxs)(`div`,{className:`space-y-3 text-sm`,"data-testid":`connect-ai-tool-body`,children:[(0,U.jsxs)(`p`,{className:`text-fg-muted`,children:[`Let an AI tool on this PC — Claude Code in VS Code, or any MCP client — `,(0,U.jsx)(`b`,{children:`read`}),` your chats on `,t.connection.hostName?(0,U.jsx)(`b`,{children:t.connection.hostName}):`this PC`,`. It gets read-only access through OonaCode, only while OonaCode runs and is unlocked; it never gets your password, your vault or OonaCode's own key.`]}),(0,U.jsxs)(`ul`,{className:`list-disc space-y-1 rounded-md border border-warn/40 bg-warn/5 py-2 pl-6 pr-3 text-xs text-warn`,"data-testid":`connect-ai-tool-warning`,children:[(0,U.jsx)(`li`,{children:`Whatever the tool reads is sent to that tool's model provider.`}),(0,U.jsx)(`li`,{children:`Chats can hold secrets you pasted or a tool printed. Key-shaped strings are masked, but not everything secret looks like a key.`}),(0,U.jsx)(`li`,{children:`A chat's text can carry instructions aimed at the tool. OonaCode marks everything it hands over as untrusted data, and offers read tools only — nothing that writes, sends or deletes.`})]}),u?(0,U.jsx)(gye,{made:u,onDone:()=>d(null)}):c?(0,U.jsx)(_ye,{projects:o,onCancel:()=>l(!1),onCreated:e=>{l(!1),d(e),h()}}):(0,U.jsxs)(K,{onClick:()=>l(!0),"data-testid":`connect-ai-tool-new`,children:[(0,U.jsx)(G.Plug,{className:`w-3.5 h-3.5`}),`Connect a tool…`]}),i?(0,U.jsx)(`div`,{className:`text-xs text-danger`,children:i}):null,(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`mb-1 text-xs font-medium uppercase tracking-wide text-fg-faint`,children:`Connected tools`}),n===null?(0,U.jsx)(`div`,{className:`text-xs text-fg-faint`,children:`Loading…`}):n.length===0?(0,U.jsx)(`div`,{className:`text-xs text-fg-faint`,"data-testid":`connect-ai-tool-none`,children:`No AI tool is connected.`}):(0,U.jsx)(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:n.map(e=>(0,U.jsxs)(`li`,{className:`p-2`,"data-testid":`ai-tool-grant-${e.id}`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`font-medium`,children:e.toolName}),(0,U.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[_(e.scope),` · `,(0,U.jsx)(hye,{grant:e})]})]}),e.status===`active`?(0,U.jsx)(K,{size:`sm`,variant:`danger`,busy:f===e.id,onClick:()=>void y(e.id),"data-testid":`ai-tool-revoke-${e.id}`,children:`Revoke`}):null]}),e.reads.length>0?(0,U.jsx)(`ul`,{className:`mt-1 space-y-0.5 text-xs text-fg-faint`,"data-testid":`ai-tool-reads`,children:[...e.reads].reverse().slice(0,5).map((t,n)=>(0,U.jsxs)(`li`,{title:W_(t.at),children:[e.toolName,` `,pye(t).replace(` · `,` — `)]},`${t.at}-${n}`))}):e.status===`active`?(0,U.jsx)(`div`,{className:`mt-1 text-xs text-fg-faint`,children:`Nothing read yet.`}):null]},e.id))})]})]}):(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,"data-testid":`connect-ai-tool-unsupported`,children:`This PC is running an older OonaCode that cannot connect an AI tool. Update it first.`})}function hye({grant:e}){return e.status===`revoked`?(0,U.jsx)(`span`,{className:`text-fg-faint`,children:`revoked`}):e.status===`expired`?(0,U.jsx)(`span`,{className:`text-fg-faint`,children:`expired`}):(0,U.jsxs)(`span`,{className:`text-ok`,children:[`active`,e.expiresAt?` until ${W_(e.expiresAt)}`:` until revoked`]})}function gye({made:e,onDone:t}){let[n,r]=(0,v.useState)(!1);return(0,U.jsxs)(`div`,{className:`space-y-2 rounded-md border border-border bg-surface-2 p-2`,"data-testid":`connect-ai-tool-made`,children:[(0,U.jsx)(`div`,{className:`font-medium`,children:`Paste this into a terminal for Claude Code`}),(0,U.jsx)(`p`,{className:`text-xs text-warn`,children:`It is shown once: OonaCode keeps only a fingerprint of it. Treat it like a password — the tool keeps it in its own settings file, and Revoke below is what ends it.`}),(0,U.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,U.jsx)(`pre`,{className:`min-w-0 flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded bg-surface p-2 font-mono text-xs`,"data-testid":`connect-ai-tool-command`,children:e.command}),(0,U.jsxs)(K,{size:`sm`,onClick:()=>{dN(e.command).then(e=>{e&&r(!0)})},"data-testid":`connect-ai-tool-copy`,children:[(0,U.jsx)(G.Copy,{className:`w-3.5 h-3.5`}),n?`Copied`:`Copy`]})]}),(0,U.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer`,children:`Another MCP client`}),(0,U.jsxs)(`div`,{className:`mt-1 space-y-1`,children:[(0,U.jsxs)(`div`,{children:[`Streamable HTTP URL: `,(0,U.jsx)(`code`,{className:`break-all`,children:e.mcpUrl})]}),(0,U.jsxs)(`div`,{children:[`Header: `,(0,U.jsx)(`code`,{className:`break-all`,children:e.header})]})]})]}),(0,U.jsx)(K,{size:`sm`,variant:`primary`,onClick:t,"data-testid":`connect-ai-tool-done`,children:`Done`})]})}function _ye({projects:e,onCancel:t,onCreated:n}){let{api:r,state:i}=W(),[a,o]=(0,v.useState)(`Claude Code`),[s,c]=(0,v.useState)(`all`),[l,u]=(0,v.useState)([]),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(`hour`),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(null),w=(0,v.useMemo)(()=>{let e=d.trim().toLowerCase();return i.sessions.filter(t=>!e||J_(t).toLowerCase().includes(e)).slice(0,200)},[i.sessions,d]),T=s===`all`?{kind:`all`}:s===`chats`?l.length>0?{kind:`chats`,chatIds:l}:null:p?{kind:`project`,projectId:p}:null,E=!!(T&&a.trim()&&_&&!b),D=async()=>{if(!(!E||!T||!r.createAiToolGrant)){x(!0),C(null);try{let e=await r.createAiToolGrant({toolName:a.trim(),scope:T,lifetime:h,password:_});y(``),n(e)}catch(e){C(Y_(e))}finally{x(!1)}}},O=e=>u(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]);return(0,U.jsxs)(`div`,{className:`space-y-3 rounded-md border border-border p-2`,"data-testid":`connect-ai-tool-form`,children:[(0,U.jsxs)(`label`,{className:`block`,children:[(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Tool name`}),(0,U.jsx)(`input`,{className:q,value:a,maxLength:60,onChange:e=>o(e.target.value),"data-testid":`connect-ai-tool-name`})]}),(0,U.jsxs)(`fieldset`,{children:[(0,U.jsx)(`legend`,{className:`text-xs text-fg-muted`,children:`What it may read`}),(0,U.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-3`,children:[[`all`,`All chats`],[`chats`,`Chosen chats`],[`project`,`One project`]].map(([e,t])=>(0,U.jsxs)(`label`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsx)(`input`,{type:`radio`,name:`connect-ai-tool-scope`,checked:s===e,onChange:()=>c(e),"data-testid":`connect-ai-tool-scope-${e}`}),t]},e))}),s===`chats`?(0,U.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,U.jsx)(`input`,{className:q,placeholder:`Filter chats`,value:d,onChange:e=>f(e.target.value)}),(0,U.jsx)(`div`,{className:`max-h-48 overflow-y-auto rounded-md border border-border`,children:w.length===0?(0,U.jsx)(`div`,{className:`p-2 text-xs text-fg-faint`,children:`No chats.`}):w.map(e=>(0,U.jsxs)(`label`,{className:`flex items-center gap-2 px-2 py-1 text-xs hover:bg-surface-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:l.includes(e.id),onChange:()=>O(e.id),"data-testid":`connect-ai-tool-chat-${e.id}`}),(0,U.jsx)(`span`,{className:`truncate`,children:J_(e)})]},e.id))}),(0,U.jsxs)(`div`,{className:`text-xs text-fg-faint`,children:[l.length,` chosen`]})]}):null,s===`project`?(0,U.jsxs)(`select`,{className:H(US,`mt-2`),value:p,onChange:e=>m(e.target.value),"data-testid":`connect-ai-tool-project`,children:[(0,U.jsx)(`option`,{value:``,children:`Pick a project…`}),e.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.name},e.id))]}):null]}),(0,U.jsxs)(`label`,{className:`block`,children:[(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`For how long`}),(0,U.jsx)(`select`,{className:US,value:h,onChange:e=>g(e.target.value),"data-testid":`connect-ai-tool-lifetime`,children:Object.keys(K5).map(e=>(0,U.jsx)(`option`,{value:e,children:K5[e]},e))})]}),(0,U.jsxs)(`label`,{className:`block`,children:[(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Account password — to say it is you`}),(0,U.jsx)(`input`,{type:`password`,className:q+` max-w-[16rem]`,placeholder:`Account password`,value:_,onChange:e=>y(e.target.value),onKeyDown:e=>{e.key===`Enter`&&D()},"data-testid":`connect-ai-tool-password`})]}),S?(0,U.jsx)(`div`,{className:`text-xs text-danger`,"data-testid":`connect-ai-tool-error`,children:S}):null,(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(K,{variant:`primary`,onClick:()=>void D(),disabled:!E,busy:b,"data-testid":`connect-ai-tool-create`,children:`Connect`}),(0,U.jsx)(K,{variant:`ghost`,onClick:t,children:`Cancel`})]})]})}var q5=new Map,J5=0;function vye(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,`0`)}function Y5(e){return[e.summaryId,e.language,e.voiceKey,vye(e.text)].join(`|`)}function yye(e,t){let n=Y5(e),r=q5.get(n);return r&&(q5.delete(n),r.clips.length!==t&&(Z5(r),r=void 0)),r??={key:n,clips:Array(t).fill(void 0),bytes:0},q5.set(n,r),X5(n),r}function bye(e,t,n,r){let i=e.clips[t];i&&(Q5(i.url),e.bytes-=i.bytes);let a={url:xye(n),bytes:n.byteLength,...r};return e.clips[t]=a,e.bytes+=a.bytes,q5.delete(e.key),q5.set(e.key,e),X5(e.key),a}function X5(e){let t=0;for(let e of q5.values())t+=e.bytes;for(let[n,r]of q5){if(q5.size<=8&&t<=50331648)return;n!==e&&(q5.delete(n),t-=r.bytes,Z5(r))}}function Z5(e){for(let t of e.clips)t&&Q5(t.url)}function xye(e){return typeof URL<`u`&&typeof URL.createObjectURL==`function`?URL.createObjectURL(new Blob([e],{type:`audio/wav`})):(J5+=1,`clip:${J5}`)}function Q5(e){if(e.startsWith(`blob:`))try{URL.revokeObjectURL(e)}catch{}}var $5=()=>new Audio,e7=1e-6,Sye=class{#e;#t;#n;#r;#i;#a=new Set;#o;#s=[``,``];#c=0;#l;#u=`idle`;#d;#f=0;#p=0;#m=null;#h=null;#g=0;#_=!1;#v=!1;#y=!1;#b=!1;constructor(e){this.#e=e.tts,this.#t=e.voiceId,this.#n=e.language,this.#r=e.entry,this.#d=jp(e.rate??1),this.#i=e.errorText??(e=>e instanceof Error&&e.message?e.message:String(e));let t=e.timeline;e.entry.clips.forEach((e,n)=>{e&&(t=vp(t,n,e.seconds,e))}),this.#l=t,this.#o=[$5(),$5()];for(let e of this.#o)e.playbackRate=this.#d,e.preservesPitch=!0}get timeline(){return this.#l}snapshot(){let e=this.#l,t=this.#C(),n=-1;return e.words.length>0&&(n=this.#m??(this.#u===`ended`?e.words.length-1:Math.max(0,bp(e,t+e7)))),{status:this.#u,currentSec:t,durationSec:e.totalSec,durationExact:e.complete||this.#r.clips.every(Boolean),wordIndex:n,sentenceIndex:n>=0?e.words[n].sentence:yp(e,t),rate:this.#d,error:this.#h}}subscribe(e){return this.#a.add(e),()=>this.#a.delete(e)}#x(){for(let e of[...this.#a])e()}#S(e){this.#u=e,this.#x()}#C(){let e=this.#l;if(this.#u===`ended`)return e.totalSec;if(this.#m!==null)return xp(e,this.#m);let t=e.sentences[this.#f];if(!t)return 0;let n=this.#u===`playing`?this.#o[this.#c].currentTime||0:this.#p;return t.startSec+Math.max(0,Math.min(n,t.durationSec))}#w(){let e=this.#l.sentences.length;for(let t=0;t<e;t+=1){let n=(this.#f+t)%e;if(!this.#r.clips[n])return n}return-1}#T(){if(!this.#_||this.#v||this.#y||this.#b)return;let e=this.#w();if(e<0)return;let t=this.#l.sentences[e];this.#v=!0,(async()=>{try{let n=await this.#e.speak({voiceId:this.#t,text:sp(t.spoken,this.#n),speed:1}),r=n.sampleRate>0?n.samples.length/n.sampleRate:0,i=Ep(n.samples,n.sampleRate);if(bye(this.#r,e,Fv(n.samples,n.sampleRate),{seconds:r,...i}),this.#v=!1,this.#b)return;this.#l=vp(this.#l,e,r,i),this.#u===`buffering`&&e===this.#f?this.#D(this.#f):this.#u===`playing`&&e===this.#f+1&&this.#O(),this.#x(),this.#T()}catch(e){if(this.#v=!1,this.#b)return;this.#E(this.#i(e))}})()}#E(e){this.#y=!0,this.#g+=1,this.#u===`playing`&&(this.#p=this.#o[this.#c].currentTime||0);for(let e of this.#o)e.pause();this.#h=e,this.#S(`error`)}#D(e){let t=++this.#g;this.#f=e;let n=this.#r.clips[e];if(!n){for(let e of this.#o)e.pause();this.#u!==`buffering`&&this.#S(`buffering`),this.#T();return}if(this.#m!==null){let t=this.#l.sentences[e];this.#p=xp(this.#l,this.#m)-t.startSec,this.#m=null}let r=Math.max(0,Math.min(this.#p,Math.max(0,n.seconds-.01))),i=this.#c,a=this.#o[i];this.#o[+(i===0)].pause(),this.#s[i]!==n.url&&(a.src=n.url,this.#s[i]=n.url),a.currentTime=r,a.playbackRate=this.#d,a.preservesPitch=!0,a.onended=()=>{t===this.#g&&this.#k(e)},a.onerror=()=>{t===this.#g&&this.#E(`This window could not play the voice’s audio.`)},this.#p=r;let o=e=>{t!==this.#g||e instanceof Error&&e.name===`AbortError`||this.#E(`This window could not play the voice’s audio${e instanceof Error&&e.message?` (${e.message})`:``}.`)};try{a.play()?.catch?.(o)}catch(e){queueMicrotask(()=>o(e))}this.#O(),this.#u===`playing`?this.#x():this.#S(`playing`)}#O(){let e=this.#r.clips[this.#f+1],t=+(this.#c===0);!e||this.#s[t]===e.url||(this.#o[t].src=e.url,this.#s[t]=e.url)}#k(e){let t=this.#l.sentences.length;if(e+1>=t){this.#g+=1,this.#f=t-1,this.#p=this.#l.sentences[t-1]?.durationSec??0,this.#S(`ended`);return}this.#c=+(this.#c===0),this.#p=0,this.#D(e+1)}play(){if(!(this.#b||this.#u===`playing`||this.#u===`buffering`)){if(this.#l.sentences.length===0){this.#S(`ended`);return}this.#u===`ended`&&(this.#f=0,this.#p=0,this.#m=null),this.#u===`error`&&(this.#y=!1,this.#h=null),this.#_=!0,this.#D(this.#f),this.#T()}}pause(){if(this.#u===`playing`||this.#u===`buffering`){this.#u===`playing`&&(this.#p=this.#o[this.#c].currentTime||0),this.#g+=1;for(let e of this.#o)e.pause();this.#S(`paused`)}}toggle(){this.#u===`playing`||this.#u===`buffering`?this.pause():this.play()}#A(e,t,n){let r=this.#u===`playing`||this.#u===`buffering`;if(this.#g+=1,this.#u===`playing`&&this.#o[this.#c].pause(),this.#f=e,this.#p=t,this.#m=n,r){this.#D(e),this.#T();return}if(this.#m!==null&&this.#r.clips[e]){let t=this.#l.sentences[e];this.#p=xp(this.#l,this.#m)-t.startSec,this.#m=null}this.#S(this.#u===`idle`?`idle`:this.#u===`error`?`error`:`paused`)}seek(e){let t=this.#l;if(t.sentences.length===0)return;let n=Math.max(0,Math.min(t.totalSec,e)),r=yp(t,n),i=t.sentences[r];if(this.#r.clips[r]){this.#A(r,n-i.startSec,null);return}let a=bp(t,n+e7),o=a>=i.wordFrom&&a<i.wordTo?a:i.wordTo>i.wordFrom?i.wordFrom:null;this.#A(r,n-i.startSec,o)}seekWord(e){let t=this.#l;if(t.words.length===0)return;let n=t.words[Math.max(0,Math.min(e,t.words.length-1))],r=t.sentences[n.sentence];this.#r.clips[n.sentence]?this.#A(n.sentence,n.startSec-r.startSec,null):this.#A(n.sentence,0,n.index)}skip(e){this.seek(Cp(this.#l,this.#C(),e))}nextSentence(){let e=this.#l.sentences[this.#f+1];e&&this.#A(e.index,0,null)}prevSentence(){let e=this.#l,t=yp(e,wp(e,this.#C())+e7);this.#A(Math.max(0,t),0,null)}setRate(e){let t=jp(e);if(t!==this.#d){this.#d=t;for(let e of this.#o)e.playbackRate=t,e.preservesPitch=!0;this.#x()}}destroy(){if(!this.#b){this.#b=!0,this.#g+=1;for(let e of this.#o)e.onended=null,e.onerror=null,e.pause();this.#u=`idle`,this.#a.clear()}}};function Cye(e){let t=e.now??(()=>Date.now()),n=-1/0,r=0,i=null,a=new Set,o=(e,t)=>{let n=setTimeout(()=>{a.delete(n),e()},t);a.add(n)},s=(a,s)=>{let c=r,l=e.synth.getVoices().find(t=>t.voiceURI===e.voiceURI)??null,u=e.makeUtterance(a);l&&(u.voice=l),u.lang=l?.lang??e.bcp47,u.rate=s.rate;let d=!1,f=()=>!d&&c===r,p=()=>{d=!0,i===u&&(i=null)};u.onstart=()=>{f()&&s.onStart()},u.onboundary=e=>{f()&&(e.name===void 0||e.name===`word`)&&typeof e.charIndex==`number`&&s.onBoundary(e.charIndex)},u.onend=()=>{f()&&(p(),s.onEnd())},u.onerror=e=>{f()&&(p(),e.error!==`interrupted`&&e.error!==`canceled`&&s.onError(Error(`The system voice failed: ${e.error??`unknown error`}`)))},o(()=>{f()&&(p(),e.synth.cancel(),n=t(),s.onEnd())},Av(a,s.rate)),i=u,e.synth.speak(u)};return{queueAhead:!1,speak(e,i){let a=n+50-t();if(a>0){let t=r;o(()=>{t===r&&s(e,i)},a);return}s(e,i)},stop(){r+=1,i=null;for(let e of a)clearTimeout(e);a.clear();try{e.synth.cancel()}catch{}return n=t(),new Promise(e=>setTimeout(e,50))}}}var t7=e=>typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(()=>e(Date.now()),16),wye=e=>{typeof cancelAnimationFrame==`function`?cancelAnimationFrame(e):clearTimeout(e)};function Tye(e){let[,t]=(0,v.useReducer)(e=>e+1,0);return(0,v.useEffect)(()=>{if(!e)return;let n=0,r=!1,i=-2,a=0,o=s=>{let c=e.snapshot();if(c.status!==`playing`&&c.status!==`buffering`){r=!1,t();return}(c.wordIndex!==i||s-a>=250)&&(i=c.wordIndex,a=s,t()),n=t7(o)},s=()=>{t();let i=e.snapshot();!r&&(i.status===`playing`||i.status===`buffering`)&&(r=!0,n=t7(o))},c=e.subscribe(s);return s(),()=>{c(),r&&wye(n)}},[e]),e?e.snapshot():null}function Eye({summaries:e,loaded:t,selectedId:n,changed:r,notice:i,error:a,locked:o,onSelect:s,onDelete:c}){let l=kp(e);return(0,U.jsxs)(`section`,{"data-testid":`voice-summaries`,children:[(0,U.jsx)(`h3`,{className:`mb-1 text-xs font-semibold uppercase tracking-wide text-fg-faint`,children:`Summaries`}),a?(0,U.jsx)(`p`,{className:`text-xs text-danger`,children:a}):null,t&&l.length===0?(0,U.jsx)(`p`,{className:`text-fg-muted`,"data-testid":`voice-no-summaries`,children:Hp.noSummaries}):null,l.length>0&&r?(0,U.jsx)(`p`,{className:`mb-1 text-xs text-fg-muted`,"data-testid":`voice-changed`,children:Hp.changedSinceNewest}):null,(0,U.jsx)(`ul`,{className:`flex max-h-44 flex-col gap-1 overflow-y-auto`,children:l.map(e=>{let t=n===e.id,r=Mv(e.createdAt);return(0,U.jsxs)(`li`,{"data-testid":`voice-summary-row`,className:H(`flex items-start gap-2 rounded-md border px-2 py-1.5`,t?`border-accent bg-accent/10`:`border-border`),children:[(0,U.jsx)(`input`,{type:`radio`,name:`voice-summary`,className:`mt-1`,"aria-label":`Summary of ${r}`,checked:t,disabled:o,onChange:()=>s(e.id)}),(0,U.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 flex-col items-start text-left`,disabled:o,onClick:()=>s(e.id),children:[(0,U.jsxs)(`span`,{className:`font-medium`,children:[r,e.current?(0,U.jsx)(`span`,{className:`ml-2 rounded-full bg-accent/15 px-1.5 text-xs text-accent`,children:Hp.current}):null]}),(0,U.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[e.words,` words · about `,Bp(e.seconds),` ·`,` `,Rp(e).map(e=>e.toUpperCase()).join(` `),` `,`· `,e.cost.model??`the chat’s model`,` · `,Vp(e.cost)]})]}),(0,U.jsx)(K,{size:`sm`,onClick:()=>c(e.id),disabled:o,"aria-label":`Delete the summary of ${r}`,"data-testid":`voice-summary-delete`,children:(0,U.jsx)(G.Trash,{className:`h-3.5 w-3.5`})})]},e.id)})}),i?(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,"data-testid":`voice-notice`,children:i}):null]})}function Dye(e){switch(e?.status){case`buffering`:return`Getting the voice ready…`;case`paused`:return`Paused.`;case`ended`:return`Done.`;case`playing`:return`Playing.`;default:return``}}function n7({label:e,onClick:t,disabled:n,children:r,testId:i,primary:a}){return(0,U.jsx)(`button`,{type:`button`,"aria-label":e,title:e,onClick:t,disabled:n,"data-testid":i,className:H(`inline-flex items-center justify-center rounded-full disabled:opacity-40`,a?`h-9 w-9 bg-accent text-accent-fg hover:opacity-90`:`h-8 min-w-8 px-1.5 text-fg-muted hover:bg-surface-2 hover:text-fg`),children:r})}function Oye({player:e,snapshot:t,speed:n,onSpeed:r}){let i=t,a=!e||!i,o=i?.status===`playing`||i?.status===`buffering`,s=i?.currentSec??0,c=i?.durationSec??0,l=i&&!i.durationExact?`~`:``,u=`${Dp(s)} / ${l}${Dp(c)}`;return(0,U.jsxs)(`section`,{className:`flex flex-col gap-2 rounded-md border border-border bg-surface-2 px-3 py-2`,"data-testid":`voice-player`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`input`,{type:`range`,"aria-label":`Position`,"aria-valuetext":`${Dp(s)} of ${l}${Dp(c)}`,className:`min-w-0 flex-1`,min:0,max:Math.max(.1,c),step:.1,value:Math.min(s,Math.max(.1,c)),disabled:a,onChange:t=>e?.seek(Number(t.target.value)),"data-testid":`voice-position`}),(0,U.jsx)(`span`,{className:`shrink-0 tabular-nums text-xs text-fg-muted`,"data-testid":`voice-clock`,children:u})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,U.jsx)(n7,{label:`Previous sentence`,onClick:()=>e?.prevSentence(),disabled:a,testId:`voice-prev`,children:(0,U.jsx)(G.SkipBack,{className:`h-4 w-4`})}),(0,U.jsx)(n7,{label:`Back 10 seconds`,onClick:()=>e?.skip(-10),disabled:a,testId:`voice-back`,children:(0,U.jsxs)(`span`,{className:`text-xs font-medium`,children:[`−`,10,`s`]})}),(0,U.jsx)(n7,{label:o?`Pause`:`Play`,onClick:()=>e?.toggle(),disabled:a,testId:`voice-toggle`,primary:!0,children:o?(0,U.jsx)(G.Pause,{className:`h-4 w-4`}):(0,U.jsx)(G.Play,{className:`h-4 w-4`})}),(0,U.jsx)(n7,{label:`Forward 10 seconds`,onClick:()=>e?.skip(10),disabled:a,testId:`voice-forward`,children:(0,U.jsxs)(`span`,{className:`text-xs font-medium`,children:[`+`,10,`s`]})}),(0,U.jsx)(n7,{label:`Next sentence`,onClick:()=>e?.nextSentence(),disabled:a,testId:`voice-next`,children:(0,U.jsx)(G.SkipForward,{className:`h-4 w-4`})}),(0,U.jsxs)(`span`,{className:`ml-1 flex items-center gap-1 text-xs text-fg-muted`,"aria-live":`polite`,"data-testid":`voice-player-status`,children:[i?.status===`buffering`?(0,U.jsx)(G.Spinner,{className:`h-3.5 w-3.5`}):null,Dye(i)]}),(0,U.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-xs text-fg-muted`,children:[(0,U.jsxs)(`span`,{className:`tabular-nums`,children:[`Speed ×`,n.toFixed(2)]}),(0,U.jsx)(`input`,{type:`range`,"aria-label":`Speed`,min:Ap,max:2,step:.05,value:n,onChange:e=>r(Number(e.target.value))})]})]})]})}var kye=(0,v.memo)(function({index:e,text:t,current:n,onPick:r}){return(0,U.jsx)(`span`,{"data-word":e,"data-current":n?`true`:void 0,onClick:()=>r(e),className:H(`cursor-pointer rounded-sm hover:bg-accent/10`,n&&`bg-accent/20 text-fg`),children:t})});function Aye({text:e,timeline:t,wordIndex:n,onPickWord:r,dir:i,lang:a}){let o=(0,v.useRef)(null),s=(0,v.useRef)(0),c=(0,v.useRef)(0),l=(0,v.useRef)(r);l.current=r;let u=(0,v.useMemo)(()=>e=>l.current(e),[]),d=t&&t.text===e?t.words.length:-1,f=(0,v.useMemo)(()=>{if(!t||d<0)return null;let n=[],r=0;for(let i of t.words)n.push({gap:e.slice(r,i.start),word:{index:i.index,text:e.slice(i.start,i.end)}}),r=i.end;return n.push({gap:e.slice(r),word:null}),n},[d,e]);(0,v.useEffect)(()=>{if(n<0||!o.current||Date.now()-s.current<4e3)return;let e=o.current.querySelector(`[data-word="${n}"]`);e&&(c.current=Date.now(),e.scrollIntoView({block:`nearest`}))},[n]);let p=()=>{s.current=Date.now()},m=e;return f&&(m=f.map((e,t)=>(0,U.jsx)(jye,{gap:e.gap,word:e.word,current:e.word?.index===n,onPick:u},t))),(0,U.jsx)(`p`,{ref:o,className:`max-h-64 overflow-y-auto whitespace-pre-wrap rounded-md border border-border bg-surface-2 px-3 py-2 leading-relaxed`,"data-testid":`voice-summary-text`,dir:i,lang:a,onWheel:p,onTouchMove:p,onScroll:()=>{Date.now()-c.current>200&&p()},children:m})}var jye=(0,v.memo)(function({gap:e,word:t,current:n,onPick:r}){return(0,U.jsxs)(U.Fragment,{children:[e,t?(0,U.jsx)(kye,{index:t.index,text:t.text,current:n,onPick:r}):null]})});function r7(e){let[t,n]=(0,v.useState)([]);return(0,v.useEffect)(()=>{if(!e||typeof window>`u`||!window.speechSynthesis)return;let t=window.speechSynthesis,r=()=>n(t.getVoices());return r(),t.addEventListener?.(`voiceschanged`,r),()=>t.removeEventListener?.(`voiceschanged`,r)},[e]),t}function i7(e){let t=e instanceof Error?e.message:String(e);return/no route for|not_found|404/i.test(t)&&/voice/i.test(t)?`This PC’s OonaCode host does not know "Listen" yet — update OonaCode.`:t}function Mye(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`SELECT`||t===`TEXTAREA`||e.isContentEditable}function Nye({open:e,onClose:t}){let{state:n,api:r}=W(),i=n.voiceSummarySessionId,a=(0,v.useMemo)(()=>n.sessions.find(e=>e.id===i)??null,[n.sessions,i]),o=typeof window<`u`?window.oonacode?.tts:void 0,s=Ev(typeof window<`u`?window.oonacode?.platform:null,typeof navigator<`u`?navigator.userAgent:null),[c,l]=(0,v.useState)(()=>_v()),[u,d]=(0,v.useState)(null),f=r7(e),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(null),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)({kind:`idle`}),[S,C]=(0,v.useState)(null),w=(0,v.useRef)(null),[T,E]=(0,v.useState)(null),D=(0,v.useRef)(null),O=(0,v.useRef)(null),k=(0,v.useRef)(null),A=(0,v.useRef)(c.speed);A.current=c.speed;let j=Tye(T),M=bf(c.language)??bf(`en`),N=(0,v.useCallback)(e=>{l(t=>{let n={...t,...e};return vv(n),n})},[]),ee=(0,v.useMemo)(()=>p?.summaries??[],[p]),te=ee.find(e=>e.id===_)??ee[0]??null,P=(0,v.useCallback)(async()=>{if(!i||!r.listVoiceSummaries)return null;try{let e=await r.listVoiceSummaries(i),t={...e,summaries:kp(e.summaries)};return m(t),g(null),t}catch(e){return g(i7(e)),null}},[r,i]);(0,v.useEffect)(()=>{e&&(m(null),y(null),C(null),x({kind:`idle`}),P(),o?(d(null),o.listVoices().then(d,()=>d([]))):d([]))},[e,P,o]);let F=a?`${a.entryCount}:${a.mtime}`:null,ne=(0,v.useRef)(null),I=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(!e){ne.current=null;return}if(ne.current===null){ne.current=F;return}F!==ne.current&&(ne.current=F,!I.current&&(I.current=setTimeout(()=>{I.current=null,P()},800)))},[e,F,P]),(0,v.useEffect)(()=>()=>{I.current&&clearTimeout(I.current),I.current=null},[]);let re=(0,v.useCallback)(()=>{w.current?.abort(),w.current=null,k.current=null,D.current?.destroy(),D.current=null,O.current=null,E(null)},[]);(0,v.useEffect)(()=>{e||re()},[e,re]),(0,v.useEffect)(()=>()=>re(),[re]);let ie=(0,v.useMemo)(()=>wv(M,u??[],f),[M,u,f]),ae=Tv(ie,c.localVoice[M.code]),L=!!(o&&u&&!u.some(e=>e.engine===`espeak`)),oe=b.kind===`summarising`||b.kind===`translating`,se=!!(r.listVoiceSummaries&&r.createVoiceSummary),ce=typeof window<`u`&&!!window.speechSynthesis,le=te?zp(te,M.code):null,ue=ae?.key??null,de=ae?.kind??null,fe=te?.id??null,R=(0,v.useMemo)(()=>{if(!fe||le===null||!ue||!de)return null;let e=bv({key:ue,kind:de,label:``}),t,n;if(e&&o)t=`clip`,n=e;else if(de===`system`&&ce)t=`system`,n=ue.slice(7);else return null;let r={summaryId:fe,language:M.code,voiceKey:ue,text:le};return{key:Y5(r),...r,bcp47:M.bcp47,kind:t,voiceId:n}},[fe,le,ue,de,o,ce,M]);(0,v.useEffect)(()=>{if(!e||(R?.key??null)===(O.current?.key??null))return;let t=D.current,n=O.current,r=t?.snapshot()??null;if(t?.destroy(),D.current=null,O.current=R,!R){E(null);return}let i=gp(R.text,{language:R.language}),a;a=R.kind===`clip`&&o?new Sye({tts:o,voiceId:R.voiceId,language:R.language,timeline:i,entry:yye(R,i.sentences.length),rate:A.current,errorText:i7}):new Mp(Cye({synth:window.speechSynthesis,makeUtterance:e=>new SpeechSynthesisUtterance(e),voiceURI:R.voiceId,bcp47:R.bcp47}),i,{mode:Ov(s),rate:A.current});let c=!1;if(t&&n&&r){let e=r.status===`playing`||r.status===`buffering`;n.summaryId===R.summaryId&&n.language===R.language&&n.text===R.text?(r.wordIndex>=0&&r.status!==`ended`&&a.seekWord(r.wordIndex),c=e):n.summaryId===R.summaryId&&(c=e)}k.current===R.key&&(k.current=null,c=!0),D.current=a,E(a),c&&a.play()},[e,R,o,s]);let pe=async()=>{if(!i||!r.createVoiceSummary)return null;x({kind:`summarising`});let e=await r.createVoiceSummary(i,{words:c.words});return C(e.created?null:Hp.unchanged(Mv(e.summary.createdAt))),y(e.summary.id),await P(),e.summary},me=async()=>{if(!i)return;w.current?.abort();let e=new AbortController;w.current=e;let t=e.signal;k.current=null;try{let e=Lp(p,_)?await pe():te;if(t.aborted)return;if(!e)throw Error(`There is no summary to play.`);let n=zp(e,M.code);if(n===null){if(!r.translateVoiceSummary)throw Error(`This host cannot translate yet.`);x({kind:`translating`});let a=await r.translateVoiceSummary(i,e.id,{language:M.code});if(m(t=>Pye(t,e.id,a.translation)),t.aborted)return;n=a.translation.text,P()}if(!n.trim())throw Error(`There was nothing to read.`);if(!ae||ae.kind===`system`&&!ce)throw Error(ae?`This window has no system speech.`:Dv(M,!!o,s,L));x({kind:`idle`});let a=Y5({summaryId:e.id,language:M.code,voiceKey:ae.key,text:n});O.current?.key===a&&D.current?D.current.play():k.current=a}catch(e){if(t.aborted)return;x({kind:`error`,message:i7(e)})}finally{w.current===e&&(w.current=null)}},he=()=>{w.current?.abort(),w.current=null,k.current=null,oe&&x({kind:`idle`}),D.current?.pause()},ge=e=>{e!==te?.id&&(D.current?.pause(),C(null),y(e))},_e=async e=>{if(!(!i||!r.deleteVoiceSummary))try{await r.deleteVoiceSummary(i,e),_===e&&y(null),await P()}catch(e){x({kind:`error`,message:i7(e)})}},ve=e=>{let t=Tf(e);N({speed:t}),D.current?.setRate(t)};if((0,v.useEffect)(()=>{if(!e)return;let t=e=>{let t=D.current;if(!t||e.altKey||e.ctrlKey||e.metaKey||Mye(e.target))return;let n=e.target instanceof Element?e.target:null;if(!(n&&n!==document.body&&!n.closest(`[aria-label="Listen to this chat"]`))){if(e.key===` `||e.key===`Spacebar`){if(n?.closest(`button`))return;e.preventDefault(),t.toggle()}else if(e.key===`ArrowLeft`||e.key===`ArrowRight`){e.preventDefault();let n=e.key===`ArrowRight`;e.shiftKey?n?t.nextSentence():t.prevSentence():t.skip(n?10:-10)}}};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e]),!e)return null;let ye=a?Zu(a):`this chat`,be=te?Rp(te):[],xe=new Set(be),Se=le??te?.text??null,Ce=j?.status===`error`?j.error:null,we=j?.status===`playing`||j?.status===`buffering`,Te=T&&O.current?.text===Se?T.timeline:null;return(0,U.jsx)(GS,{open:e,title:`Listen to this chat`,onClose:t,wide:!0,footer:(0,U.jsxs)(U.Fragment,{children:[oe||we?(0,U.jsxs)(K,{onClick:he,"data-testid":`voice-stop`,children:[(0,U.jsx)(G.Stop,{className:`h-4 w-4`}),` Stop`]}):null,(0,U.jsxs)(K,{variant:`primary`,onClick:()=>void me(),disabled:oe||!se||!i,"data-testid":`voice-play`,children:[(0,U.jsx)(G.Play,{className:`h-4 w-4`}),` Play`]}),(0,U.jsx)(K,{onClick:t,children:`Close`})]}),children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-3 text-sm`,children:[se?null:(0,U.jsx)(`p`,{className:`text-danger`,children:`This version of the host cannot make voice summaries.`}),(0,U.jsx)(Eye,{summaries:ee,loaded:p!==null,selectedId:te?.id??null,changed:Lp(p,_),notice:S,error:h,locked:oe,onSelect:ge,onDelete:e=>void _e(e)}),(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`A spoken summary of `,(0,U.jsx)(`span`,{className:`font-medium text-fg`,children:ye}),` — its goal, what was done, where it stands and what is pending — written by the chat’s own model, in English. Other languages are translated once by `,xf.label,` on your OonaCode credits and kept with the summary.`]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,U.jsx)(HS,{label:`Language`,children:(0,U.jsx)(`select`,{"aria-label":`Language`,className:US,value:M.code,disabled:oe,onChange:e=>N({language:e.target.value}),children:yf.map(e=>{let t=e.name===e.native?e.name:`${e.name} — ${e.native}`;return(0,U.jsx)(`option`,{value:e.code,children:xe.has(e.code)?`${t} ✓`:t},e.code)})})}),o&&u===null?(0,U.jsx)(`p`,{className:`px-1 py-2 text-fg-muted`,"data-testid":`voice-loading`,children:`Looking for this PC’s voices…`}):ie.length>0?(0,U.jsx)(HS,{label:`Voice`,children:(0,U.jsx)(`select`,{"aria-label":`Voice`,className:US,value:ae?.key??``,disabled:oe,onChange:e=>N({localVoice:{...c.localVoice,[M.code]:e.target.value}}),children:ie.map(e=>(0,U.jsx)(`option`,{value:e.key,children:e.label},e.key))})}):(0,U.jsx)(`p`,{className:`rounded-md border border-border bg-surface-2 px-3 py-2 text-fg-muted`,"data-testid":`no-local-voice`,children:Dv(M,!!o,s,L)}),(0,U.jsx)(HS,{label:`Length of a new summary`,children:(0,U.jsxs)(`select`,{"aria-label":`Length of a new summary`,className:US,value:String(c.words),disabled:oe,onChange:e=>N({words:Number(e.target.value)}),children:[(0,U.jsx)(`option`,{value:`120`,children:`Short — about 120 words`}),(0,U.jsx)(`option`,{value:`200`,children:`Normal — about 200 words`}),(0,U.jsx)(`option`,{value:`300`,children:`Long — about 300 words`}),[120,200,300].includes(c.words)?null:(0,U.jsxs)(`option`,{value:String(c.words),children:[c.words,` words`]})]})})]}),(0,U.jsx)(Fye,{stage:b,playerError:Ce}),(0,U.jsx)(Oye,{player:T,snapshot:j,speed:c.speed,onSpeed:ve}),te&&Se!==null?(0,U.jsxs)(`section`,{children:[(0,U.jsxs)(`div`,{className:`mb-1 flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-faint`,children:Hp.heading(M,le!==null)}),be.length>1?(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1`,role:`group`,"aria-label":`Languages it has`,children:be.map(e=>{let t=bf(e);if(!t)return null;let n=e===M.code;return(0,U.jsx)(`button`,{type:`button`,"aria-pressed":n,title:t.name===t.native?t.name:`${t.name} — ${t.native}`,disabled:oe,onClick:()=>N({language:e}),"data-testid":`voice-lang-chip`,className:H(`rounded-full border px-2 py-0.5 text-xs`,n?`border-accent bg-accent/15 text-accent`:`border-border text-fg-muted hover:bg-surface-2`),children:e.toUpperCase()},e)})}):null]}),(0,U.jsx)(Aye,{text:Se,timeline:Te,wordIndex:j?.wordIndex??-1,onPickWord:e=>D.current?.seekWord(e),dir:le!==null&&M.rtl?`rtl`:`ltr`,lang:le===null?`en-US`:M.bcp47})]}):null]})})}function Pye(e,t,n){return e&&{...e,summaries:e.summaries.map(e=>e.id===t?{...e,translations:[...e.translations.filter(e=>e.language!==n.language),n]}:e)}}function Fye({stage:e,playerError:t}){let n=e.kind===`error`?e.message:t;if(n)return(0,U.jsx)(`p`,{className:`rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-danger`,role:`alert`,"data-testid":`voice-stage`,children:n});if(e.kind!==`summarising`&&e.kind!==`translating`)return null;let r=[{key:`summarising`,label:Hp.generating},{key:`translating`,label:Hp.translating}],i=r.findIndex(t=>t.key===e.kind);return(0,U.jsx)(`ol`,{className:`flex flex-wrap items-center gap-2 text-xs`,"data-testid":`voice-stage`,"aria-live":`polite`,children:r.map((e,t)=>(0,U.jsx)(`li`,{className:H(`rounded-full px-2 py-0.5`,t===i?`bg-accent/15 font-medium text-accent`:t<i?`text-fg-muted line-through`:`text-fg-faint`),children:e.label},e.key))})}function a7(e){return Rf(e).replace(/\n+/g,` `).trim()||e.trim()}function o7(e){let t=e instanceof Error?e.message:String(e);return/no route for|404/i.test(t)&&/about/i.test(t)?`This PC’s OonaCode host cannot read the abouts in other languages yet — update OonaCode. English plays.`:t}function Iye(e){return{sessionId:e.sessionId,title:e.title.trim()||`Untitled chat`,about:e.about}}function Lye(e){return e.filter(e=>!e.pending&&e.source!==`user`&&(!e.about||e.stale))}function Rye({open:e,picked:t}){let{api:n}=W(),r=(0,v.useRef)(n);r.current=n;let i=typeof window<`u`?window.oonacode?.tts:void 0,a=Ev(typeof window<`u`?window.oonacode?.platform:null,typeof navigator<`u`?navigator.userAgent:null),[o,s]=(0,v.useState)(()=>_v()),[c,l]=(0,v.useState)(null),u=r7(e),d=bf(o.language)??bf(`en`),f=(0,v.useMemo)(()=>wv(d,c??[],u),[d,c,u]),p=Tv(f,o.localVoice[d.code]),m=!!(i&&c&&!c.some(e=>e.engine===`espeak`)),[h,g]=(0,v.useState)(Yv),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(0),[S,C]=(0,v.useState)(!1),w=(0,v.useRef)({lang:d,voice:p,speed:o.speed,espeakMissing:m,platform:a,tts:i});w.current={lang:d,voice:p,speed:o.speed,espeakMissing:m,platform:a,tts:i};let T=(0,v.useCallback)(e=>{s(t=>{let n={...t,...e};return vv(n),n})},[]),E=(0,v.useMemo)(()=>{let e=Lv();return new ey({words:async e=>{let{lang:t}=w.current;if(!e.about)return{name:a7(e.title),body:[gf(t.code)]};if(t.code===`en`)return{name:a7(e.title),body:Uf(Rf(e.about))};let n=r.current.translateChatAbout;if(!n)throw Error(`This PC’s OonaCode host cannot read the abouts in other languages yet — update OonaCode. English plays.`);try{let r=await n(e.sessionId,{language:t.code});return r.created&&x(e=>e+1),{name:r.translation.name?a7(r.translation.name):null,body:Uf(r.translation.text)}}catch(e){throw Error(`could not translate it: ${o7(e)}`)}},speak:(t,{signal:n,onItem:r})=>{let i=w.current;return ty(t,{voice:i.voice,language:i.lang,speed:i.speed,tts:i.tts,player:e,synth:typeof window<`u`?window.speechSynthesis:void 0,makeUtterance:e=>new SpeechSynthesisUtterance(e),platform:i.platform,espeakMissing:i.espeakMissing,prepare:sp,signal:n,onItem:r})},silence:()=>{e.stop();try{typeof window<`u`&&window.speechSynthesis?.cancel()}catch{}},onState:g})},[]);(0,v.useEffect)(()=>{if(!e){E.reset();return}s(_v()),i?(l(null),i.listVoices().then(l,()=>l([]))):l([])},[e,i,E]),(0,v.useEffect)(()=>()=>E.dispose(),[E]),(0,v.useEffect)(()=>{E.resetWords()},[d.code,E]);let D=t.map(e=>`${e.sessionId}\u0000${e.title}\u0000${e.about??``}`).join(``);(0,v.useEffect)(()=>{C(!1)},[D,d.code]),(0,v.useEffect)(()=>{let r=n.planChatAboutTranslations;if(!e||d.code===`en`||t.length===0||!r){y(null);return}let i=!0;return r({language:d.code,sessionIds:t.map(e=>e.sessionId)}).then(e=>i&&y(e),()=>i&&y(null)),()=>{i=!1}},[e,d.code,D,b,n]);let O=h.status===`preparing`||h.status===`speaking`,k=d.code!==`en`&&_!==null&&_.language===d.code&&_.needed>lf.confirmAbove,A=(0,v.useCallback)(()=>{C(!1),E.start(t.map(Iye),0)},[E,t]),j=(0,v.useCallback)(()=>{if(t.length!==0){if(k&&!S){C(!0);return}A()}},[t.length,k,S,A]);return{prefs:o,update:T,lang:d,options:f,voice:p,espeakMissing:m,voicesLoading:!!i&&c===null,desktop:!!i,platform:a,state:h,busy:O,active:Xv(h),plan:_&&_.language===d.code?_:null,confirming:S,play:j,start:A,cancelConfirm:()=>C(!1),pause:()=>E.pause(),resume:()=>E.resume(),stop:()=>E.stop(),next:()=>E.next(),previous:()=>E.previous(),jumpTo:e=>E.jumpTo(e),pickedCount:t.length}}function zye({b:e,picked:t,enabled:n,generateAll:r,onGenerated:i}){let{api:a}=W(),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(null),u=Lye(t),d=u.filter(e=>!e.about).length,f=u.length-d,p=r?.running===!0,m=async()=>{if(a.generateChatAbouts){s(!0),l(null);try{i((await a.generateChatAbouts({sessionIds:u.map(e=>e.sessionId)})).generateAll)}catch(e){l(o7(e))}finally{s(!1)}}},h=e.busy;return(0,U.jsxs)(`section`,{className:`space-y-2 rounded-md border border-border px-3 py-2`,"data-testid":`briefing-panel`,"aria-label":`Listen to the picked chats`,children:[(0,U.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-faint`,children:`Listen to the picked chats`}),(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`Tick chats below, then Play: each chat’s name, then its about, one after another. Another language is translated once by `,xf.label,` on your OonaCode credits and kept, so playing it again costs nothing.`]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,U.jsx)(HS,{label:`Language`,children:(0,U.jsx)(`select`,{"aria-label":`Language`,className:US,value:e.lang.code,disabled:h,onChange:t=>e.update({language:t.target.value}),"data-testid":`briefing-language`,children:yf.map(e=>(0,U.jsx)(`option`,{value:e.code,children:e.name===e.native?e.name:`${e.name} — ${e.native}`},e.code))})}),e.voicesLoading?(0,U.jsx)(`p`,{className:`px-1 py-2 text-xs text-fg-muted`,"data-testid":`briefing-voices-loading`,children:`Looking for this PC’s voices…`}):e.options.length>0?(0,U.jsx)(HS,{label:`Voice`,children:(0,U.jsx)(`select`,{"aria-label":`Voice`,className:US,value:e.voice?.key??``,disabled:h,onChange:t=>e.update({localVoice:{...e.prefs.localVoice,[e.lang.code]:t.target.value}}),"data-testid":`briefing-voice`,children:e.options.map(e=>(0,U.jsx)(`option`,{value:e.key,children:e.label},e.key))})}):(0,U.jsx)(`p`,{className:`rounded-md border border-border bg-surface-2 px-2 py-1.5 text-xs text-fg-muted sm:col-span-2`,"data-testid":`briefing-no-voice`,children:Dv(e.lang,e.desktop,e.platform,e.espeakMissing)}),(0,U.jsx)(HS,{label:`Speed ×${e.prefs.speed.toFixed(2)}`,children:(0,U.jsx)(`input`,{"aria-label":`Speed`,type:`range`,min:Cf.speed.min,max:Cf.speed.max,step:.05,value:e.prefs.speed,disabled:h,onChange:t=>e.update({speed:Number(t.target.value)})})})]}),e.plan&&t.length>0?(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`briefing-cost`,children:[vf(e.plan,e.lang.name),e.plan.needed>0?` — paid once, then kept.`:``]}):null,e.confirming&&e.plan?(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-md border border-warn/50 bg-warn-soft px-2 py-1.5 text-xs text-fg`,role:`alert`,"data-testid":`briefing-confirm`,children:[(0,U.jsxs)(`p`,{className:`basis-full`,children:[`Before playing: `,vf(e.plan,e.lang.name),` — paid once from your OonaCode credits, then kept.`]}),(0,U.jsx)(K,{size:`sm`,variant:`primary`,onClick:e.start,"data-testid":`briefing-confirm-play`,children:`Translate and play`}),(0,U.jsx)(K,{size:`sm`,variant:`ghost`,onClick:e.cancelConfirm,children:`Cancel`})]}):null,u.length>0&&a.generateChatAbouts?(0,U.jsxs)(`div`,{className:`space-y-1.5 text-xs`,"data-testid":`briefing-need-about`,children:[(0,U.jsx)(`p`,{className:`text-fg-muted`,children:Jv(d,f)}),(0,U.jsxs)(K,{size:`sm`,onClick:()=>void m(),busy:o,disabled:!n||p||e.busy,title:n?void 0:`Chat abouts are off — turn them on above.`,"data-testid":`briefing-write-first`,children:[(0,U.jsx)(G.Refresh,{className:`h-3 w-3`}),` Write abouts for these first`]})]}):null,c?(0,U.jsx)(`p`,{className:`text-xs text-danger`,"data-testid":`briefing-write-error`,children:c}):null]})}function Bye({b:e}){let t=e.state,n=t.index>=0?` (${t.index+1} of ${t.total})`:``,r=null;return t.status===`preparing`?r=`Now: ${t.title??``}${n} — ${e.lang.code===`en`?`getting ready…`:`translating…`}`:t.status===`speaking`?r=`Now: ${t.title??``}${n}`:t.status===`paused`?r=`Paused: ${t.title??``}${n}`:t.status===`done`?r=`Finished — ${t.total} chat${t.total===1?``:`s`} read.`:t.status===`stopped`?r=`Stopped.`:t.status===`error`&&(r=t.error),(0,U.jsxs)(U.Fragment,{children:[r?(0,U.jsx)(`p`,{className:H(`mr-auto min-w-0 basis-full truncate text-xs sm:basis-auto sm:flex-1`,t.status===`error`?`text-danger`:`text-fg-muted`),title:r,"aria-live":`polite`,"data-testid":`briefing-now`,children:r}):null,e.active||t.status===`error`?(0,U.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-1`,children:[(0,U.jsx)(K,{size:`sm`,onClick:e.previous,disabled:t.status===`error`,"aria-label":`Previous chat`,title:`Previous chat`,"data-testid":`briefing-previous`,children:(0,U.jsx)(G.SkipBack,{className:`h-3.5 w-3.5`})}),t.status===`paused`||t.status===`error`?(0,U.jsxs)(K,{size:`sm`,variant:`primary`,onClick:e.resume,"data-testid":`briefing-resume`,children:[(0,U.jsx)(G.Play,{className:`h-3.5 w-3.5`}),` `,t.status===`error`?`Try again`:`Resume`]}):(0,U.jsxs)(K,{size:`sm`,onClick:e.pause,"data-testid":`briefing-pause`,children:[(0,U.jsx)(G.Pause,{className:`h-3.5 w-3.5`}),` Pause`]}),(0,U.jsxs)(K,{size:`sm`,onClick:e.stop,"data-testid":`briefing-stop`,children:[(0,U.jsx)(G.Stop,{className:`h-3.5 w-3.5`}),` Stop`]}),(0,U.jsx)(K,{size:`sm`,onClick:e.next,disabled:t.status===`error`,"aria-label":`Next chat`,title:`Next chat`,"data-testid":`briefing-next`,children:(0,U.jsx)(G.SkipForward,{className:`h-3.5 w-3.5`})})]}):(0,U.jsxs)(K,{variant:`primary`,onClick:e.play,disabled:e.pickedCount===0||e.voice===null||e.voicesLoading,title:e.pickedCount===0?`Tick the chats to hear first`:void 0,"data-testid":`briefing-play`,children:[(0,U.jsx)(G.Play,{className:`h-4 w-4`}),` Play `,e.pickedCount,` picked`]})]})}function Vye({open:e,onClose:t}){let{state:n,actions:r}=W(),i=n.chatAboutsChange,[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(!1),S=(0,v.useRef)(-1),[C,w]=(0,v.useState)(()=>Uv()),[T,E]=(0,v.useState)(()=>new Set),[D,O]=(0,v.useState)(()=>Date.now()),k=(0,v.useCallback)(async()=>{let e=await r.listChatAbouts();if(e===`unsupported`){c(!0);return}if(e===null){u(!0);return}c(!1),u(!1),o(e),f(e.generateAll)},[r]);(0,v.useEffect)(()=>{e&&(S.current=i.seq,O(Date.now()),k())},[e]);let A=e=>{w(t=>{let n={...t,...e};return Wv(n),n}),O(Date.now())};(0,v.useEffect)(()=>{!e||i.seq===S.current||(S.current=i.seq,i.generateAll!==void 0&&f(i.generateAll),k())},[e,i,k]);let j=n.settings?.chatAboutEnabled??a?.settings.enabled??Pd.enabled,M=async e=>{x(!0);try{await r.saveSettings({chatAboutEnabled:e})}finally{x(!1)}k()},N=async()=>{g(!0);try{let e=await r.generateAllChatAbouts();e&&f(e.generateAll)}finally{g(!1)}},ee=async()=>{y(!0);try{let e=await r.stopGenerateAllChatAbouts();e&&f(e.generateAll)}finally{y(!1)}},te=(0,v.useMemo)(()=>pf(C.range,D,{from:C.from,to:C.to}),[C,D]),P=(0,v.useMemo)(()=>{let e=(a?.chats??[]).filter(e=>mf(e.updatedAt,te)),t=e=>{let t=Date.parse(e.updatedAt);return Number.isFinite(t)?t:0};return[...e].sort((e,n)=>t(n)-t(e))},[a,te]),F=(0,v.useMemo)(()=>{let e=p.trim().toLowerCase();return e?P.filter(t=>t.title.toLowerCase().includes(e)||(t.about??``).toLowerCase().includes(e)):P},[P,p]),ne=(0,v.useMemo)(()=>F.map(e=>e.sessionId),[F]),I=ne.join(`,`);(0,v.useEffect)(()=>{E(e=>qv(e,ne))},[I]);let re=(0,v.useMemo)(()=>F.filter(e=>T.has(e.sessionId)),[F,T]),ie=Gv(ne,T),ae=(0,v.useRef)(null);(0,v.useEffect)(()=>{ae.current&&(ae.current.indeterminate=ie===`some`)});let L=Rye({open:e,picked:re}),oe=L.active||L.state.status===`error`,se=(0,v.useMemo)(()=>new Set(L.state.playlist),[L.state.playlist]),ce=oe?L.state.sessionId:null,le=e=>E(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),ue=uf.find(e=>e.id===C.range)?.label??``,de=(0,v.useCallback)(e=>n.sessions.find(t=>t.id===e)?.entryCount??null,[n.sessions]),fe=a?nf(a.totals):null,R=d?.running===!0;return(0,U.jsxs)(GS,{open:e,title:`What your chats are about`,onClose:t,wide:!0,footer:(0,U.jsxs)(U.Fragment,{children:[a!==null&&!s?(0,U.jsx)(Bye,{b:L}):null,(0,U.jsx)(K,{variant:`ghost`,onClick:t,children:`Close`})]}),children:[(0,U.jsxs)(`p`,{className:`mb-3 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,U.jsx)(`span`,{className:`min-w-0`,children:`A short note per chat on this PC saying what it works on, so your other chats can tell which one to ask.`}),(0,U.jsx)(BS,{label:`What your chats are about`,details:(0,U.jsx)(VS,{items:[...cf.what,...cf.when,...cf.who,...cf.yours,...cf.where]})})]}),s?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,"data-testid":`chat-abouts-unsupported`,children:`OonaCode on this PC is too old for chat abouts. Update it, then open this window again.`}):a===null?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,"data-testid":`chat-abouts-loading`,children:l?`Could not read the abouts from this PC right now. They show here as soon as it answers.`:`Loading…`}):(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsx)(`div`,{className:`rounded-md border border-border px-3`,children:(0,U.jsx)(KS,{label:`Write an about for every chat`,hint:j?`On: each chat’s housekeeper model writes its about in the background.`:`Off: nothing is written and nothing is spent. Regenerate and “Generate for all chats now” are unavailable.`,details:[cf.switch,...cf.who],checked:j,disabled:b,onChange:e=>void M(e),testId:`chat-abouts-switch`})}),fe?(0,U.jsxs)(`div`,{className:`text-xs text-fg-muted`,"data-testid":`chat-abouts-totals`,children:[(0,U.jsx)(`span`,{className:`font-medium text-fg`,children:`All about calls so far: `}),(0,U.jsx)(`span`,{"data-testid":`chat-abouts-totals-line`,children:fe.line}),fe.unpriced?(0,U.jsx)(`span`,{className:`block text-fg-faint`,"data-testid":`chat-abouts-totals-unpriced`,children:fe.unpriced}):null]}):null,(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsxs)(K,{size:`sm`,variant:`primary`,onClick:()=>void N(),busy:h,disabled:!j||R,title:j?cf.generateAll:cf.regenerateOff,"data-testid":`chat-abouts-generate-all`,children:[(0,U.jsx)(G.Refresh,{className:`h-3 w-3`}),` Generate for all chats now`]}),(0,U.jsx)(BS,{label:`Generate for all chats now`,details:cf.generateAll})]}),R?(0,U.jsxs)(K,{size:`sm`,variant:`danger`,onClick:()=>void ee(),busy:_,title:cf.stop,"data-testid":`chat-abouts-stop`,children:[(0,U.jsx)(G.Stop,{className:`h-3 w-3`}),` Stop`]}):null]}),d?(0,U.jsx)(Hye,{g:d}):null,(0,U.jsx)(zye,{b:L,picked:re,enabled:j,generateAll:d,onGenerated:f}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium text-fg`,children:[`Last active`,(0,U.jsx)(`select`,{"aria-label":`Last active`,className:H(US,`text-xs`),value:C.range,onChange:e=>A({range:e.target.value}),"data-testid":`chat-abouts-range`,children:uf.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),C.range===`custom`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium text-fg`,children:[`From`,(0,U.jsx)(`input`,{type:`date`,"aria-label":`From`,className:H(q,`text-xs`),value:C.from,onChange:e=>A({from:e.target.value}),"data-testid":`chat-abouts-from`})]}),(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium text-fg`,children:[`To`,(0,U.jsx)(`input`,{type:`date`,"aria-label":`To`,className:H(q,`text-xs`),value:C.to,onChange:e=>A({to:e.target.value}),"data-testid":`chat-abouts-to`})]})]}):null,(0,U.jsx)(`input`,{className:H(q,`min-w-[10rem] flex-1 basis-40 text-xs`),type:`search`,value:p,onChange:e=>m(e.target.value),placeholder:`Find a chat by its title or its about`,"aria-label":`Find a chat by its title or its about`,"data-testid":`chat-abouts-filter`})]}),F.length>0?(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-xs`,children:[(0,U.jsxs)(`label`,{className:`inline-flex items-center gap-2 font-medium text-fg`,children:[(0,U.jsx)(`input`,{ref:ae,type:`checkbox`,checked:ie===`all`,"aria-checked":ie===`some`?`mixed`:ie===`all`,onChange:()=>E(e=>Kv(ne,e)),"data-testid":`chat-abouts-select-all`}),`Select all`]}),(0,U.jsxs)(`span`,{className:`text-fg-muted`,"data-testid":`chat-abouts-count`,children:[F.length,` chat`,F.length===1?``:`s`,re.length>0?` · ${re.length} picked`:``]})]}):null,a.chats.length===0?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,"data-testid":`chat-abouts-empty`,children:`No chats on this PC yet.`}):F.length===0?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,"data-testid":`chat-abouts-no-match`,children:p.trim()?`No chat matches “${p.trim()}”${C.range===`all`?``:` in ${ue.toLowerCase()}`}.`:`No chat was active in ${C.range===`custom`?`that range`:ue.toLowerCase()}.`}):(0,U.jsx)(`ul`,{className:`space-y-2`,"data-testid":`chat-abouts-list`,children:F.map(e=>(0,U.jsx)(Uye,{row:e,enabled:j,entryCount:de(e.sessionId),checked:T.has(e.sessionId),onToggle:()=>le(e.sessionId),playing:ce===e.sessionId,onJump:oe&&se.has(e.sessionId)?()=>L.jumpTo(e.sessionId):null,onOpen:()=>{r.selectSession(e.sessionId)}},e.sessionId))})]})]})}function Hye({g:e}){let t=e.total>0?Math.round(Math.min(e.done,e.total)/e.total*100):100;return(0,U.jsxs)(`div`,{className:`space-y-1 text-xs`,"data-testid":`chat-abouts-progress`,children:[(0,U.jsx)(`div`,{className:`text-fg-muted`,"data-testid":`chat-abouts-progress-line`,children:af(e)}),(0,U.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-surface-3`,role:`progressbar`,"aria-label":`Generate for all chats now`,"aria-valuemin":0,"aria-valuemax":e.total,"aria-valuenow":e.done,children:(0,U.jsx)(`div`,{className:H(`h-full rounded-full`,e.running?`bg-accent`:`bg-fg-faint`),style:{width:`${t}%`}})}),!e.running&&e.stoppedReason?(0,U.jsxs)(`div`,{className:`text-warn`,"data-testid":`chat-abouts-stopped-reason`,children:[`Stopped: `,e.stoppedReason]}):null]})}function Uye({row:e,enabled:t,entryCount:n,checked:r,onToggle:i,playing:a,onJump:o,onOpen:s}){let c=e.title.trim()||`Untitled chat`,l=Zd(e),u=(0,v.useRef)(null);return(0,v.useEffect)(()=>{a&&u.current?.scrollIntoView?.({block:`nearest`})},[a]),(0,U.jsxs)(`li`,{ref:u,className:H(`rounded-md border px-3 py-2 text-xs`,a?`border-accent bg-accent/10`:`border-border`,o?`cursor-pointer hover:border-accent`:``),onClick:o??void 0,title:o&&!a?`Play from this chat`:void 0,"aria-current":a?`true`:void 0,"data-testid":`chat-about-row-${e.sessionId}`,"data-playing":a?`true`:void 0,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`shrink-0`,checked:r,onChange:i,onClick:e=>e.stopPropagation(),"aria-label":`Pick ${c}`,"data-testid":`chat-about-pick`}),a?(0,U.jsx)(G.Speaker,{className:`h-3.5 w-3.5 text-accent`,title:`Playing`}):null,(0,U.jsx)(`button`,{type:`button`,className:`min-w-0 max-w-full truncate text-left text-sm font-medium text-fg hover:text-accent hover:underline`,onClick:e=>{e.stopPropagation(),s()},title:`Open this chat`,"data-testid":`chat-about-open`,children:c}),e.source===`user`?(0,U.jsx)(`span`,{title:cf.yours[0],children:(0,U.jsx)(WS,{tone:`accent`,children:`yours`})}):null,e.stale&&e.about?(0,U.jsx)(`span`,{title:cf.stale,"data-testid":`chat-about-stale`,children:(0,U.jsx)(WS,{tone:`warn`,children:`stale`})}):null,e.pending?(0,U.jsx)(`span`,{"data-testid":`chat-about-pending`,children:(0,U.jsx)(WS,{tone:`accent`,children:`writing…`})}):null]}),e.about?(0,U.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words text-fg`,"data-testid":`chat-about-text`,children:e.about}):null,e.about&&e.stale?(0,U.jsx)(`p`,{className:`mt-0.5 text-warn`,"data-testid":`chat-about-stale-note`,children:`The chat has moved on since this about was written.`}):null,e.about?null:(0,U.jsxs)(`p`,{className:`mt-1 text-fg-muted`,"data-testid":`chat-about-missing`,children:[`No about yet. `,rf(e,{enabled:t,entryCount:n})]}),e.about&&e.lastError?(0,U.jsxs)(`p`,{className:`mt-0.5 text-danger`,"data-testid":`chat-about-error`,children:[`The last attempt failed: `,e.lastError]}):null,(0,U.jsxs)(`div`,{className:`mt-1 flex flex-wrap justify-between gap-x-3 gap-y-0.5 text-[11px] text-fg-faint`,children:[(0,U.jsxs)(`span`,{title:W_(e.updatedAt),"data-testid":`chat-about-active`,children:[`Active `,U_(e.updatedAt)]}),e.about&&e.aboutAt?(0,U.jsxs)(`span`,{title:W_(e.aboutAt),"data-testid":`chat-about-written`,children:[`Written `,U_(e.aboutAt),l?` by ${l}`:``]}):(0,U.jsx)(`span`,{}),(0,U.jsx)(`span`,{title:e.route?`Paid by ${Qd[e.route]}`:void 0,"data-testid":`chat-about-spend`,children:tf(e.spend,e.route)})]})]})}function Wye({open:e,onClose:t}){let{state:n,actions:r}=W(),i=n.nextPromptsChange,[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(()=>lb()),[h,g]=(0,v.useState)(()=>sb()),[_,y]=(0,v.useState)(()=>new Set),[b,x]=(0,v.useState)(()=>Date.now()),[S,C]=(0,v.useState)(!1),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)({}),[O,k]=(0,v.useState)(()=>new Set),[A,j]=(0,v.useState)({}),[M,N]=(0,v.useState)(()=>new Set),[ee,te]=(0,v.useState)({}),P=(0,v.useRef)(-1),F=(0,v.useCallback)(async()=>{let e=await r.listNextPrompts();if(e===`unsupported`){c(!0);return}if(e===null){u(!0);return}c(!1),u(!1),o(e),f(e.review)},[r]);(0,v.useEffect)(()=>{e&&(P.current=i.seq,x(Date.now()),F())},[e]),(0,v.useEffect)(()=>{!e||i.seq===P.current||(P.current=i.seq,i.review!==void 0&&f(i.review),F())},[e,i,F]);let ne=e=>{m(t=>{let n={...t,...e};return ub(n),n}),x(Date.now())},I=(0,v.useMemo)(()=>{let e=new Map;for(let t of a?.suggestions??[])e.set(t.sessionId,t);return e},[a]),re=(0,v.useMemo)(()=>pf(p.range,b,{from:p.from,to:p.to}),[p,b]),ie=(0,v.useMemo)(()=>{let e=e=>{let t=Date.parse(e.updatedAt);return Number.isFinite(t)?t:0};return n.sessions.filter(e=>!n.remote.tabs[e.id]&&mf(e.updatedAt,re)).sort((t,n)=>e(n)-e(t))},[n.sessions,n.remote.tabs,re]),ae=(0,v.useMemo)(()=>ie.map(e=>e.id),[ie]),L=ae.join(`,`);(0,v.useEffect)(()=>{y(e=>qv(e,ae))},[L]);let oe=(0,v.useMemo)(()=>ae.filter(e=>_.has(e)),[ae,_]),se=Gv(ae,_),ce=(0,v.useRef)(null);(0,v.useEffect)(()=>{ce.current&&(ce.current.indeterminate=se===`some`)});let le=e=>y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),ue=d?.running===!0,de=a?.model??Np.model,fe=uf.find(e=>e.id===p.range)?.label??``,R=async()=>{if(oe.length!==0){C(!0);try{let e=await r.reviewNextPrompts(oe,h);e&&f(e)}finally{C(!1)}}},pe=async()=>{T(!0);try{let e=await r.stopNextPromptReview();e&&f(e)}finally{T(!1)}},me=async e=>{k(t=>new Set(t).add(e)),j(({[e]:t,...n})=>n);try{let t=await r.suggestNextPrompt(e,{windowHours:h,force:!0});if(`error`in t){j(n=>({...n,[e]:t.error}));return}o(n=>n&&{...n,suggestions:[t.suggestion,...n.suggestions.filter(t=>t.sessionId!==e)]})}finally{k(t=>{let n=new Set(t);return n.delete(e),n})}},he=async(e,t,n)=>{let i=t.trim();if(i){N(t=>new Set(t).add(e));try{if(!await r.sendToChat(e,i))return;n&&r.markNextPromptSent(e,n.id,i),te(t=>({...t,[e]:new Date().toISOString()})),D(({[e]:t,...n})=>n)}finally{N(t=>{let n=new Set(t);return n.delete(e),n})}}};return(0,U.jsxs)(GS,{open:e,title:Ip.managerTitle,onClose:t,wide:!0,footer:(0,U.jsx)(K,{variant:`ghost`,onClick:t,children:`Close`}),children:[(0,U.jsx)(`p`,{className:`mb-3 text-xs text-fg-muted`,"data-testid":`manager-hint`,children:Ip.managerHint}),s?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,"data-testid":`manager-unsupported`,children:`OonaCode on this PC is too old for the project manager. Update it, then open this window again.`}):a===null?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,"data-testid":`manager-loading`,children:l?`Could not read the suggestions from this PC right now. They show here as soon as it answers.`:`Loading…`}):(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium text-fg`,children:[`Last active`,(0,U.jsx)(`select`,{"aria-label":`Last active`,className:H(US,`text-xs`),value:p.range,onChange:e=>ne({range:e.target.value}),"data-testid":`manager-range`,children:uf.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),p.range===`custom`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium text-fg`,children:[`From`,(0,U.jsx)(`input`,{type:`date`,"aria-label":`From`,className:H(q,`text-xs`),value:p.from,onChange:e=>ne({from:e.target.value}),"data-testid":`manager-from`})]}),(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium text-fg`,children:[`To`,(0,U.jsx)(`input`,{type:`date`,"aria-label":`To`,className:H(q,`text-xs`),value:p.to,onChange:e=>ne({to:e.target.value}),"data-testid":`manager-to`})]})]}):null,(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium text-fg`,children:[`Read the last`,(0,U.jsx)(`select`,{"aria-label":`Hours of each chat to read`,className:H(US,`text-xs`),value:h,onChange:e=>{let t=Number(e.target.value);g(t),cb(t)},"data-testid":`manager-window`,children:Pp.map(e=>(0,U.jsxs)(`option`,{value:e,children:[e,` hour`,e===1?``:`s`]},e))})]}),(0,U.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-1.5`,children:[(0,U.jsxs)(K,{size:`sm`,variant:`primary`,onClick:()=>void R(),busy:S,disabled:oe.length===0||ue,"data-testid":`manager-review`,children:[(0,U.jsx)(G.Lightbulb,{className:`h-3 w-3`}),` Review selected (`,oe.length,`)`]}),ue?(0,U.jsxs)(K,{size:`sm`,variant:`danger`,onClick:()=>void pe(),busy:w,"data-testid":`manager-stop`,children:[(0,U.jsx)(G.Stop,{className:`h-3 w-3`}),` Stop`]}):null]})]}),d?(0,U.jsxs)(`div`,{className:`space-y-1 text-xs`,"data-testid":`manager-progress`,children:[(0,U.jsx)(`div`,{className:`text-fg-muted`,"data-testid":`manager-progress-line`,children:db(d)}),(0,U.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-surface-3`,role:`progressbar`,"aria-label":`Review`,"aria-valuemin":0,"aria-valuemax":d.total,"aria-valuenow":d.done,children:(0,U.jsx)(`div`,{className:H(`h-full rounded-full`,d.running?`bg-accent`:`bg-fg-faint`),style:{width:`${d.total>0?Math.round(Math.min(d.done,d.total)/d.total*100):100}%`}})})]}):null,ie.length>0?(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-xs`,children:[(0,U.jsxs)(`label`,{className:`inline-flex items-center gap-2 font-medium text-fg`,children:[(0,U.jsx)(`input`,{ref:ce,type:`checkbox`,checked:se===`all`,"aria-checked":se===`some`?`mixed`:se===`all`,onChange:()=>y(e=>Kv(ae,e)),"data-testid":`manager-select-all`}),`Select all`]}),(0,U.jsxs)(`span`,{className:`text-fg-muted`,"data-testid":`manager-count`,children:[ie.length,` chat`,ie.length===1?``:`s`,oe.length>0?` · ${oe.length} picked`:``]})]}):null,ie.length===0?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,"data-testid":`manager-empty`,children:n.sessions.length===0?`No chats on this PC yet.`:`No chat was active in ${p.range===`custom`?`that range`:fe.toLowerCase()}.`}):(0,U.jsx)(`ul`,{className:`space-y-2`,"data-testid":`manager-list`,children:ie.map(e=>{let i=e.id,a=I.get(i)??null,o=n.transcripts[i]?.status??e.status,s=ee[i]&&(!a?.sentAt||ee[i]>a.sentAt)?ee[i]:a?.sentAt??null;return(0,U.jsx)(Gye,{session:e,status:o,suggestion:a,text:E[i]??a?.prompt??``,edited:E[i]!==void 0,checked:_.has(i),reviewing:O.has(i)||ue&&d.current.includes(i),error:A[i]??null,sending:M.has(i),sentAt:s,onToggle:()=>le(i),onEdit:e=>D(t=>({...t,[i]:e})),onSend:e=>void he(i,e,a),onSuggest:()=>void me(i),onOpen:()=>{r.selectSession(i),t()}},i)})}),(0,U.jsx)(`p`,{className:`text-[11px] text-fg-faint`,"data-testid":`manager-cost-note`,children:Ip.costNote(de)})]})]})}function Gye({session:e,status:t,suggestion:n,text:r,edited:i,checked:a,reviewing:o,error:s,sending:c,sentAt:l,onToggle:u,onEdit:d,onSend:f,onSuggest:p,onOpen:m}){let h=J_(e),g=hb(e,t),_=t===`running`||t===`waiting_permission`,v=n?.status===`failed`;return(0,U.jsxs)(`li`,{className:`rounded-md border border-border px-3 py-2 text-xs`,"data-testid":`manager-row-${e.id}`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`shrink-0`,checked:a,onChange:u,"aria-label":`Pick ${h}`,"data-testid":`manager-pick`}),(0,U.jsx)(mI,{status:t}),g?(0,U.jsx)(pI,{mark:g,testId:`manager-finished`}):null,(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-fg`,children:h}),(0,U.jsxs)(`span`,{className:`shrink-0 text-[11px] text-fg-faint`,title:W_(e.updatedAt),"data-testid":`manager-active`,children:[`Active `,U_(e.updatedAt)]})]}),o?(0,U.jsxs)(`p`,{className:`mt-1 flex items-center gap-1.5 text-fg-muted`,"data-testid":`manager-reading`,children:[(0,U.jsx)(G.Spinner,{className:`h-3 w-3`}),Ip.reviewing(n?.windowHours??Np.windowHours)]}):null,s?(0,U.jsx)(`p`,{className:`mt-1 text-danger`,"data-testid":`manager-error`,children:s}):null,n?v?(0,U.jsx)(`p`,{className:`mt-1 text-danger`,"data-testid":`manager-failed`,children:n.error??`The suggestion could not be written.`}):(0,U.jsxs)(`div`,{className:`mt-1 space-y-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start gap-1.5`,children:[(0,U.jsx)(`p`,{className:`min-w-0 flex-1 text-fg`,"data-testid":`manager-state`,children:n.state||`Where the chat stands is not said.`}),n.stale?(0,U.jsx)(`span`,{title:`The chat has moved on since this was written — Suggest for a fresh one.`,"data-testid":`manager-stale`,children:(0,U.jsx)(WS,{tone:`warn`,children:`stale`})}):null,i?(0,U.jsx)(`span`,{title:`Your edit is kept until you send it`,"data-testid":`manager-edited`,children:(0,U.jsx)(WS,{tone:`accent`,children:`edited`})}):null]}),n.why?(0,U.jsx)(`p`,{className:`text-fg-muted`,"data-testid":`manager-why`,children:n.why}):null,n.prompt===``&&!i?(0,U.jsx)(`p`,{className:`text-warn`,"data-testid":`manager-decide`,children:Ip.decideYourself}):null]}):!o&&!s?(0,U.jsx)(`p`,{className:`mt-1 text-fg-faint`,"data-testid":`manager-none`,children:`No suggestion yet — tick it and Review, or press Suggest.`}):null,n&&!v?(0,U.jsx)(`textarea`,{"aria-label":`Message for ${h}`,className:`mt-1.5 min-h-[4rem] w-full resize-y rounded-md border border-border bg-bg px-2 py-1.5 text-xs text-fg focus:border-accent focus:outline-none`,value:r,placeholder:`Write the message yourself, or press Suggest`,onChange:e=>d(e.target.value),"data-testid":`manager-text`}):null,(0,U.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-1.5`,children:[(0,U.jsxs)(K,{size:`sm`,variant:`primary`,disabled:!r.trim()||c,busy:c,onClick:()=>f(r),title:_?`The chat is working: this waits for the running turn`:void 0,"data-testid":`manager-send`,children:[(0,U.jsx)(G.Send,{className:`h-3 w-3`}),` `,_?`Send — queues behind the running turn`:`Send`]}),(0,U.jsxs)(K,{size:`sm`,variant:`secondary`,disabled:o,onClick:p,"data-testid":`manager-suggest`,children:[(0,U.jsx)(G.Lightbulb,{className:`h-3 w-3`}),` Suggest`]}),(0,U.jsx)(K,{size:`sm`,variant:`ghost`,onClick:m,"data-testid":`manager-open`,children:`Open chat`}),l?(0,U.jsxs)(`span`,{className:`text-ok`,"data-testid":`manager-sent`,children:[`Sent `,pb(l)]}):null,n?(0,U.jsxs)(`span`,{className:`ml-auto text-[11px] text-fg-faint`,"data-testid":`manager-cost`,children:[Vp(n.cost),` · `,U_(n.createdAt)]}):null]})]})}function Kye({open:e,onClose:t}){let{state:n,actions:r}=W(),i=n.assignProjectSessionId,a=i?n.sessions.find(e=>e.id===i)??null:null,o=i?n.drafts[i]??null:null,s=a?.projectId??o?.projectId??null,[c,l]=(0,v.useState)(s),[u,d]=(0,v.useState)(!1);(0,v.useEffect)(()=>{e&&l(s)},[e,s]);let f=a?.status===`running`||a?.status===`waiting_permission`,p=mte(a?J_(a):o?.title??`New chat`);async function m(){if(i){d(!0);try{await r.setSessionProject(i,c)&&t()}finally{d(!1)}}}return(0,U.jsxs)(GS,{open:e,title:`Move “${p}” to a project`,onClose:t,footer:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{variant:`ghost`,onClick:()=>{t(),r.openDialog(`projects`)},children:`Manage projects…`}),(0,U.jsx)(`span`,{className:`flex-1`}),(0,U.jsx)(K,{variant:`ghost`,onClick:t,children:`Cancel`}),(0,U.jsx)(K,{variant:`primary`,onClick:m,disabled:u||c===s,"data-testid":`assign-project-apply`,children:`Apply`})]}),children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5`,role:`radiogroup`,"aria-label":`Project`,children:[(0,U.jsx)(s7,{selected:c===null,onSelect:()=>l(null),label:`No project`,testId:`assign-project-none`}),n.vaultProjects.map(e=>(0,U.jsx)(s7,{selected:c===e.id,onSelect:()=>l(e.id),label:e.name,hint:e.instructions.trim()?`has instructions`:void 0,testId:`assign-project-${e.id}`},e.id)),n.vaultProjects.length===0?(0,U.jsxs)(`p`,{className:`px-2 py-2 text-xs text-fg-muted`,children:[`No projects yet — create one under `,(0,U.jsx)(`em`,{children:`Manage projects…`}),`.`]}):null]}),f?(0,U.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,"data-testid":`assign-project-busy`,children:`This chat is mid-turn — it moves now and the turn is left alone. The project's instructions reach the agent at your next message.`}):(0,U.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:`The project's instructions reach the agent on the chat's next start — nothing in the conversation is lost.`})]})}function s7({selected:e,onSelect:t,label:n,hint:r,testId:i}){return(0,U.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":e,onClick:t,className:H(`flex items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm`,e?`bg-accent-soft text-fg`:`hover:bg-surface-2 text-fg`),"data-testid":i,children:[(0,U.jsx)(`span`,{className:H(`inline-block h-3 w-3 rounded-full border`,e?`border-accent bg-accent`:`border-border`)}),(0,U.jsx)(G.Project,{className:`w-3.5 h-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n}),r?(0,U.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:r}):null]})}var qye=`Install Google’s agy`,c7=`Setting up Google’s agy for you — OonaCode downloads Google’s own release and checks its checksum (about 200 MB, nothing is bundled in OonaCode).`,Jye=`OonaCode downloads Google’s own agy release (about 200 MB) and checks its checksum before it uses it. Nothing from Google is bundled inside OonaCode.`,Yye=`Sign in with Google`,Xye=`This PC’s OonaCode is too old to run chats on Google’s agy — update it from the title bar.`,Zye=`Kept on this PC only, in memory: it is gone when OonaCode stops, and it is never synced or sent anywhere.`,Qye=new Set([`loadCodeAssist`,`fetchAdminControls`,`retrieveUserQuotaSummary`,`fetchUserInfo`,`fetchAvailableModels`,`listExperiments`,`writeTrajectoryAcls`,`recordTrajectoryAnalytics`]);function $ye(e){return e.kind===`tunnel`||e.method!==null&&Qye.has(e.method)}function ebe(e){let t=[],n=[];for(let r of e)($ye(r)?n:t).push(r);return{main:t,background:n}}function l7(e){if(e.kind===`tunnel`)return{title:e.host??`tunnel`,detail:null};let t=[e.model,e.requestType===`checkpoint`?`checkpoint`:null].filter(e=>!!e).join(` · `);return{title:e.method??`Code Assist call`,detail:t||null}}function u7(e){let{title:t,detail:n}=l7(e);return n?`${t} · ${n}`:t}function tbe(e){let t=e.denied||e.error!==null||e.status!==null&&e.status>=400?`danger`:`neutral`;return e.denied?{text:`denied`,tone:t}:e.status===null?e.error===null?{text:`pending`,tone:t}:{text:`error`,tone:t}:{text:String(e.status),tone:t}}var d7=e=>e.toLocaleString(`en-US`);function nbe(e){if(!e)return null;let t=e.cached>0?` (${d7(e.cached)} cached)`:``;return`in ${d7(e.input)}${t} · out ${d7(e.output)}`}function rbe(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}):``}function ibe(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function abe(e){switch(e){case`ready`:return{label:`Ready`,tone:`ok`};case`not_installed`:return{label:`agy is not installed`,tone:`warn`};case`not_signed_in`:return{label:`Not signed in to agy`,tone:`warn`};default:return{label:`agy did not answer`,tone:`danger`}}}function f7(e){return e.newerThanTested?`This agy is newer than the version OonaCode was tested with (${e.testedVersion}). It usually keeps working; if chats on it start failing, look for an OonaCode update.`:null}function p7(e){let t=e.update;return t?t.state===`waiting`||t.state===`failed`||t.heldBack?t.message:t.state===`updating`?t.message??`OonaCode is updating agy…`:null:null}function m7(e){let t=e.group.trim(),n=e.window.trim();return t&&n.toLowerCase().startsWith(`${t.toLowerCase()} `)&&(n=n.slice(t.length).trim()),t?n?`${t} · ${n}`:t:n}function obe(e){let t=e.remainingPercent,n=t!==null&&Number.isFinite(t),r=W_(e.resetsAt);return{remaining:n?`${Math.round(Math.min(100,Math.max(0,t)))}% left`:`unknown`,tone:mc(t),resets:r?`resets ${r}`:null}}var h7=1e3,sbe=2e3;function cbe(e){if(!e)return null;if(e.install.state===`working`)return h7;switch(e.login.phase){case`starting`:case`verifying`:return h7;case`awaiting_code`:return sbe;default:return null}}function lbe(e){if(!e)return!1;if(e.install.state===`working`)return!0;let t=e.login.phase;return t===`starting`||t===`awaiting_code`||t===`verifying`}function ube(e){switch(e){case`manifest`:return`Looking up Google’s latest release…`;case`download`:return`Downloading agy…`;case`verify`:return`Checking the download…`;case`place`:return`Finishing up…`;default:return`Starting the install…`}}function dbe(e){let{received:t,total:n}=e;return n===null||!Number.isFinite(n)||n<=0?null:Math.min(100,Math.max(0,Math.floor(t/n*100)))}function fbe(e){let{received:t,total:n}=e;return n!==null&&n>0?`${Ej(t)} of ${Ej(n)}`:t>0?Ej(t):null}function pbe(e){if(!e)return null;try{return new URL(e).protocol===`https:`?e:null}catch{return null}}function mbe(e,t){return t?e.split(t).join(`…`):e}function hbe(e,t){return e?`Status…`:t?t.state===`not_installed`?t.install.supported?`Install…`:`Status…`:t.state===`not_signed_in`?`Sign in…`:`Status…`:`Set up…`}var g7=15,gbe=2e4,_be=5e3,_7=null;function vbe(e){let[t,n]=(0,v.useState)(()=>Date.now());return(0,v.useEffect)(()=>{if(!e)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function ybe({install:e,busy:t,offer:n,onInstall:r,onCancel:i}){if(e.state===`working`){let n=dbe(e),r=fbe(e);return(0,U.jsxs)(`div`,{className:`space-y-1.5`,"data-testid":`agy-install`,"data-install-state":`working`,children:[(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`agy-install-statement`,children:c7}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-fg`,role:`status`,"data-testid":`agy-install-phase`,"data-phase":e.phase??void 0,children:[(0,U.jsx)(G.Spinner,{className:`h-3.5 w-3.5 shrink-0`}),(0,U.jsxs)(`span`,{className:`min-w-0`,children:[ube(e.phase),e.version?` (agy ${e.version})`:``]})]}),(0,U.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-surface-3`,role:`progressbar`,"aria-label":`Installing agy`,"aria-valuemin":0,"aria-valuemax":100,...n===null?{}:{"aria-valuenow":n},"data-indeterminate":n===null?`true`:void 0,"data-testid":`agy-install-bar`,children:(0,U.jsx)(`div`,{className:H(`h-full rounded-full bg-accent`,n===null?`w-1/3 animate-pulse`:void 0),style:n===null?void 0:{width:`${n}%`}})}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`text-[11px] text-fg-faint`,"data-testid":`agy-install-bytes`,children:r??``}),(0,U.jsx)(K,{size:`sm`,variant:`ghost`,disabled:t,onClick:i,"data-testid":`agy-install-cancel`,children:`Cancel`})]})]})}return e.supported?e.state===`idle`&&!n?(0,U.jsx)(`div`,{className:`space-y-2`,"data-testid":`agy-install`,"data-install-state":`starting`,children:(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`agy-install-statement`,children:c7})}):(0,U.jsxs)(`div`,{className:`space-y-2`,"data-testid":`agy-install`,"data-install-state":e.state,children:[e.state===`failed`?(0,U.jsx)(`div`,{className:`rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,"data-testid":`agy-install-failed`,children:e.error??`The install did not finish.`}):(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`agy-install-explanation`,children:Jye}),(0,U.jsxs)(K,{variant:`primary`,busy:t,disabled:t,onClick:r,"data-testid":e.state===`failed`?`agy-install-retry`:`agy-install-button`,children:[(0,U.jsx)(G.Download,{className:`h-4 w-4`}),` `,e.state===`failed`?`Try again`:qye]})]}):null}function bbe({login:e,busy:t,onStart:n,onRestart:r,onCancel:i,onSubmit:a}){let[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(!1),u=(0,v.useRef)(null);(0,v.useEffect)(()=>()=>{u.current&&clearTimeout(u.current)},[]),(0,v.useEffect)(()=>{e.phase!==`awaiting_code`&&s(``)},[e.phase]);let d=(0,v.useRef)(null),f=e.phase===`awaiting_code`,p=f?pbe(e.url):null,m=f&&e.expiresAt?Date.parse(e.expiresAt):NaN,h=Number.isFinite(m),g=vbe(f&&h),_=h?Math.max(0,Math.ceil((m-g)/1e3)):null,y=_===0;(0,v.useEffect)(()=>{y&&s(``)},[y]);let b=(0,v.useRef)(!1);(0,v.useEffect)(()=>{if(e.phase===`starting`&&(b.current=!0),!f||!p||!e.startedAt||_7===e.startedAt)return;let t=h?Date.now()-(m-6e4):1/0;if(!(!b.current&&t>_be)){_7=e.startedAt;try{H5(p)}catch{}}},[e.phase,p,e.startedAt]),(0,v.useEffect)(()=>{f&&SM(d.current)},[f]);let[x,S]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(e.phase!==`verifying`){S(!1);return}let t=setTimeout(()=>S(!0),gbe);return()=>clearTimeout(t)},[e.phase]);let C=o.trim(),w=Rh(C),T=()=>{!w||t||(s(``),a(C))},E=()=>{p&&dN(p).then(e=>{e&&(l(!0),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>l(!1),1500))})},D=(0,U.jsx)(K,{size:`sm`,variant:`ghost`,disabled:t,onClick:i,"data-testid":`agy-login-cancel`,children:`Cancel`});return(0,U.jsxs)(`div`,{ref:d,className:`space-y-2`,"data-testid":`agy-sign-in`,"data-login-phase":e.phase,children:[(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`agy-sign-in-explanation`,children:Zee}),e.phase===`starting`?(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`agy-login-starting`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-xs text-fg`,role:`status`,children:[(0,U.jsx)(G.Spinner,{className:`h-3.5 w-3.5 shrink-0`}),e.message??`Starting Google’s sign-in…`]}),(0,U.jsx)(`span`,{className:`flex-1`}),D]}):e.phase===`awaiting_code`?(0,U.jsxs)(`div`,{className:`space-y-2`,"data-testid":`agy-login-awaiting`,children:[y?(0,U.jsxs)(`div`,{className:`space-y-2`,"data-testid":`agy-login-expired`,children:[(0,U.jsx)(`div`,{className:`rounded-md border border-warn/40 bg-warn-soft px-3 py-2 text-xs text-warn`,role:`alert`,children:`Time ran out — Google’s agy only waits a minute. Press Sign in again.`}),(0,U.jsxs)(K,{variant:`primary`,busy:t,disabled:t,onClick:r,"data-testid":`agy-login-expired-restart`,children:[(0,U.jsx)(G.LogIn,{className:`h-4 w-4`}),` Sign in again`]})]}):(0,U.jsxs)(U.Fragment,{children:[e.message?(0,U.jsx)(`p`,{className:`text-xs text-fg`,children:e.message}):null,p?(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsxs)(`a`,{className:`inline-flex items-center gap-1 text-xs font-medium text-accent underline`,href:p,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>{e.preventDefault(),H5(p)},"data-testid":`agy-login-link`,children:[(0,U.jsx)(G.ExternalLink,{className:`h-3.5 w-3.5`}),` Open Google’s sign-in page`]}),(0,U.jsxs)(K,{size:`sm`,onClick:E,"data-testid":`agy-login-copy-link`,children:[(0,U.jsx)(G.Copy,{className:`h-3.5 w-3.5`}),` `,c?`Copied`:`Copy link`]})]}):null,(0,U.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs font-medium text-fg`,children:[(0,U.jsxs)(`span`,{className:`flex items-baseline justify-between gap-2`,children:[`Code from Google`,_===null?null:(0,U.jsxs)(`span`,{role:`timer`,className:H(`font-normal tabular-nums`,_<g7?`font-medium text-warn`:`text-fg-faint`),"data-tone":_<g7?`warn`:`neutral`,"data-testid":`agy-login-countdown`,children:[_,` s left to finish`]})]}),(0,U.jsx)(`input`,{className:`w-full rounded-md border border-border bg-surface px-2.5 py-1.5 font-mono text-xs text-fg placeholder:text-fg-faint focus:border-accent focus:outline-none`,type:`text`,value:o,placeholder:`Paste the code Google shows you`,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,"data-1p-ignore":`true`,"data-lpignore":`true`,"data-form-type":`other`,"data-autofocus":!0,onChange:e=>s(e.target.value),onPaste:e=>{let n=e.clipboardData?.getData(`text`).trim()??``;Rh(n)&&(e.preventDefault(),!t&&(s(``),a(n)))},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),T())},"data-testid":`agy-login-code`})]}),C&&!w?(0,U.jsx)(`p`,{className:`text-[11px] text-fg-faint`,"data-testid":`agy-login-code-hint`,children:`Paste the code exactly as Google shows it — one line, no spaces.`}):null,(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(K,{variant:`primary`,size:`sm`,disabled:!w||t,onClick:T,"data-testid":`agy-login-continue`,children:`Continue`}),D]})]}),y?(0,U.jsx)(`div`,{className:`flex items-center gap-2`,children:D}):null]}):e.phase===`verifying`?(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`agy-login-verifying`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-xs text-fg`,role:`status`,children:[(0,U.jsx)(G.Spinner,{className:`h-3.5 w-3.5 shrink-0`}),e.message??`Checking the code with Google…`]}),(0,U.jsx)(`span`,{className:`flex-1`}),D,x?(0,U.jsx)(`p`,{className:`w-full text-[11px] text-fg-faint`,"data-testid":`agy-login-verifying-slow`,children:`Still waiting for Google…`}):null]}):e.phase===`failed`?(0,U.jsxs)(`div`,{className:`space-y-2`,"data-testid":`agy-login-failed`,children:[(0,U.jsx)(`div`,{className:`rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:e.message??`The sign-in did not finish.`}),(0,U.jsxs)(K,{variant:`primary`,busy:t,disabled:t,onClick:n,"data-testid":`agy-sign-in-restart`,children:[(0,U.jsx)(G.LogIn,{className:`h-4 w-4`}),` Start again`]})]}):(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[e.phase===`done`&&e.message?(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.message}):null,(0,U.jsxs)(K,{variant:`primary`,busy:t,disabled:t,onClick:n,"data-testid":`agy-sign-in-button`,children:[(0,U.jsx)(G.LogIn,{className:`h-4 w-4`}),` `,Yye]})]})]})}var xbe={ok:`bg-ok`,warn:`bg-warn`,danger:`bg-danger`,neutral:`bg-surface-3`},Sbe={ok:`text-ok`,warn:`text-warn`,danger:`text-danger`,neutral:`text-fg-muted`};function v7({label:e,testid:t,children:n}){return(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 py-0.5 text-xs`,children:[(0,U.jsx)(`dt`,{className:`shrink-0 text-fg-faint`,children:e}),(0,U.jsx)(`dd`,{className:`min-w-0 text-right font-medium text-fg`,"data-testid":t,children:n})]})}function Cbe({definition:e}){let{api:t,socket:n}=W(),[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(0),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(null),h=(0,v.useRef)(!0),g=(0,v.useRef)(0),_=(0,v.useRef)(0);(0,v.useEffect)(()=>(h.current=!0,()=>{h.current=!1}),[]);let y=(0,v.useCallback)(async(e,n=!1)=>{let r=++g.current;if(!t.getAgyStatus){o(!0);return}_.current+=1,n||u(e=>e+1);try{let n=await t.getAgyStatus(e?{refresh:!0}:void 0);if(!h.current||r!==g.current)return;i(n),c(null),o(!1)}catch(e){if(!h.current||r!==g.current)return;ng(e)?o(!0):c(Y_(e))}finally{--_.current,!n&&h.current&&u(e=>e-1)}},[t]),b=(0,v.useCallback)(async(e,t,n=``)=>{g.current+=1,f(e),m(null);try{let e=await t();return h.current?(g.current+=1,i(e),c(null),o(!1),e):null}catch(e){return h.current&&(ng(e)?o(!0):(m(mbe(Y_(e),n)),y(!1,!0))),null}finally{h.current&&f(null)}},[y]);(0,v.useEffect)(()=>{y(!1)},[y]);let[x,S]=(0,v.useState)(!1),C=(0,v.useCallback)(async()=>{if(!t.agyInstall){o(!0);return}S(!0),await b(`install`,()=>t.agyInstall())},[t,b]),w=(0,v.useRef)(!1);(0,v.useEffect)(()=>{if(!(w.current||!r||!t.agyInstall)){if(r.install.state!==`idle`){w.current=!0;return}r.state!==`not_installed`||!r.install.supported||(w.current=!0,C())}},[r,t,C]);let T=cbe(r);(0,v.useEffect)(()=>{if(T===null)return;let e=setInterval(()=>{_.current===0&&y(!1,!0)},T);return()=>clearInterval(e)},[T,y]),(0,v.useEffect)(()=>n.on(`account_changed`,e=>{e.reason===`provider`&&y(!1,!0)}),[n,y]);let E=Bs(e);if(a)return(0,U.jsx)(`div`,{className:`rounded-md border border-warn/40 bg-warn-soft px-3 py-2 text-xs text-warn`,"data-testid":`agy-unsupported`,children:Xye});let D=r===null&&s===null,O=l>0,k=lbe(r),A=r?.install.state===`working`,j=(0,U.jsx)(K,{variant:`primary`,size:`sm`,busy:O||D,disabled:O||D||k,onClick:()=>void y(!0),"data-testid":`agy-check-again`,children:O||D?`Checking…`:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(G.Refresh,{className:`h-3.5 w-3.5`}),` Check again`]})}),M=r?A?{label:`Installing agy…`,tone:`accent`}:abe(r.state):null;return(0,U.jsxs)(`div`,{className:`space-y-3`,"data-testid":`agy-card`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,U.jsx)(WS,{tone:`ok`,children:E.badge}),(0,U.jsx)(WS,{children:e.kind})]}),(0,U.jsx)(`div`,{className:`rounded-md border border-ok/40 bg-ok-soft px-3 py-2 text-xs text-ok`,"data-testid":`agy-route`,children:E.detail}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[M?(0,U.jsx)(`span`,{"data-testid":`agy-state`,"data-state":r?.state,children:(0,U.jsx)(WS,{tone:M.tone,children:M.label})}):D?(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-fg-muted`,"data-testid":`agy-checking`,children:[(0,U.jsx)(G.Spinner,{className:`h-3.5 w-3.5`}),` Asking agy…`]}):null,(0,U.jsx)(`span`,{className:`flex-1`}),j]}),O&&r?(0,U.jsx)(`p`,{className:`text-[11px] text-fg-faint`,"data-testid":`agy-busy-note`,children:`Asking agy again — this takes a few seconds.`}):null,s?(0,U.jsxs)(`div`,{className:`rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,"data-testid":`agy-failed`,children:[`The host could not check agy: `,s]}):null,r?(0,U.jsxs)(U.Fragment,{children:[r.state!==`ready`&&r.message&&!k?(0,U.jsx)(`p`,{className:`text-xs text-fg`,"data-testid":`agy-message`,children:r.message}):null,r.state===`not_installed`?(0,U.jsx)(ybe,{install:r.install,busy:d===`install`||d===`cancel_install`,offer:!t.agyInstall||x&&d!==`install`,onInstall:()=>{w.current=!0,C()},onCancel:()=>{w.current=!0,S(!0),t.cancelAgyInstall&&b(`cancel_install`,()=>t.cancelAgyInstall())}}):null,r.state===`not_signed_in`?(0,U.jsx)(bbe,{login:r.login,busy:d===`login`||d===`cancel_login`||d===`code`,onStart:()=>{t.agyLogin?b(`login`,()=>t.agyLogin()):o(!0)},onRestart:()=>{(async()=>{t.cancelAgyLogin&&await b(`cancel_login`,()=>t.cancelAgyLogin()),t.agyLogin?await b(`login`,()=>t.agyLogin()):o(!0)})()},onCancel:()=>{t.cancelAgyLogin&&b(`cancel_login`,()=>t.cancelAgyLogin())},onSubmit:e=>{t.submitAgyLoginCode?b(`code`,()=>t.submitAgyLoginCode(e),e):o(!0)}}):null,p?(0,U.jsx)(`div`,{className:`rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,"data-testid":`agy-action-error`,children:p}):null,(0,U.jsxs)(`dl`,{className:`rounded-md border border-border px-3 py-1.5`,"data-testid":`agy-facts`,children:[(0,U.jsx)(v7,{label:`Installed`,testid:`agy-installed`,children:r.installed?`Yes`:`No`}),r.path?(0,U.jsx)(v7,{label:`Path`,testid:`agy-path`,children:(0,U.jsx)(`span`,{className:`break-all font-mono text-[11px]`,children:r.path})}):null,r.version?(0,U.jsx)(v7,{label:`Version`,testid:`agy-version`,children:r.version}):null,(0,U.jsx)(v7,{label:`Signed in`,testid:`agy-signed-in`,children:r.signedIn===null?r.installed?`Unknown`:`—`:r.signedIn?`Yes`:`No`}),(0,U.jsx)(v7,{label:`Checked`,testid:`agy-checked`,children:(0,U.jsx)(`span`,{title:W_(r.checkedAt),children:U_(r.checkedAt)})})]}),f7(r)?(0,U.jsxs)(`p`,{className:`flex items-start gap-1.5 rounded-md bg-surface-2 px-3 py-2 text-xs text-fg-muted`,"data-testid":`agy-newer-note`,children:[(0,U.jsx)(G.Info,{className:`mt-px h-3.5 w-3.5 shrink-0`}),f7(r)]}):null,p7(r)?(0,U.jsxs)(`p`,{className:`flex items-start gap-1.5 rounded-md bg-surface-2 px-3 py-2 text-xs text-fg-muted`,"data-testid":`agy-update-note`,children:[(0,U.jsx)(G.Info,{className:`mt-px h-3.5 w-3.5 shrink-0`}),p7(r)]}):null,r.models.length>0?(0,U.jsxs)(`div`,{"data-testid":`agy-models`,children:[(0,U.jsx)(`div`,{className:`mb-1 text-xs font-medium text-fg-muted`,children:`Models agy offers`}),(0,U.jsx)(`ul`,{className:`space-y-0.5`,children:r.models.map(e=>(0,U.jsxs)(`li`,{className:`flex items-baseline justify-between gap-3 text-xs`,"data-testid":`agy-model-${e.id}`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.displayName}),(0,U.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-fg-faint`,children:e.id})]},e.id))})]}):null,r.usage.length>0?(0,U.jsxs)(`div`,{"data-testid":`agy-usage`,children:[(0,U.jsx)(`div`,{className:`mb-1 text-xs font-medium text-fg-muted`,children:`Your plan’s usage`}),(0,U.jsx)(`ul`,{className:`space-y-2`,children:r.usage.map((e,t)=>{let n=obe(e),r=e.remainingPercent;return(0,U.jsxs)(`li`,{"data-testid":`agy-usage-row-${t}`,children:[(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-xs`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:m7(e)}),(0,U.jsx)(`span`,{className:H(`shrink-0 font-medium`,Sbe[n.tone]),"data-tone":n.tone,"data-testid":`agy-usage-remaining-${t}`,children:n.remaining})]}),(0,U.jsx)(`div`,{className:`mt-0.5 h-1.5 w-full overflow-hidden rounded-full bg-surface-3`,role:`progressbar`,"aria-label":`${m7(e)}: ${n.remaining}`,"aria-valuemin":0,"aria-valuemax":100,...r!==null&&Number.isFinite(r)?{"aria-valuenow":Math.round(r)}:{},children:(0,U.jsx)(`div`,{className:H(`h-full rounded-full`,xbe[n.tone]),style:{width:`${r!==null&&Number.isFinite(r)?Math.min(100,Math.max(0,r)):0}%`}})}),n.resets?(0,U.jsx)(`div`,{className:`text-[11px] text-fg-faint`,children:n.resets}):null]},`${e.group}-${e.window}-${t}`)})})]}):null]}):null]})}var wbe=1e3;function y7(e){return`${(e/1048576).toFixed(+(e<10485760))} MB`}var Tbe={download:`Downloading Muse from Meta…`,verify:`Checking the download against Meta’s checksum…`,place:`Setting Muse up…`};function Ebe({open:e,label:t,onClose:n}){let{api:r,actions:i}=W(),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(`checking`),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(!1),p=(0,v.useRef)(null),m=(0,v.useRef)(!1),h=(0,v.useCallback)(async()=>{if(!r.museSetup)return null;try{let e=await r.museSetup();return o(e),e}catch{return null}},[r]),g=(0,v.useCallback)(async()=>{if(!r.museLoginStart){c(`unavailable`);return}u(null),m.current=!1,p.current=null,c(`running`);try{o(await r.museLoginStart())}catch(e){u(e instanceof Error?e.message:String(e)),c(`stopped`)}},[r]);(0,v.useEffect)(()=>{if(!e)return;let t=!0;return c(`checking`),u(null),o(null),(async()=>{if(!r.museSetup||!r.museLoginStart){t&&c(`unavailable`);return}let e=await h();if(t){if(!e){c(`unavailable`);return}e.login.phase===`awaiting_approval`||e.install.state===`working`?c(`running`):e.installed?g():c(`confirm`)}})(),()=>{t=!1}},[e,r,h,g]),(0,v.useEffect)(()=>{if(!e||s!==`running`)return;let t=setInterval(()=>void h(),wbe);return()=>clearInterval(t)},[e,s,h]);let _=a?.login??null,y=a?.install??null,b=_?.phase===`awaiting_approval`,x=b&&(_?.verificationUriComplete??_?.verificationUri)?_?.verificationUriComplete??_?.verificationUri??null:null;(0,v.useEffect)(()=>{!e||!x||!_?.id||p.current===_.id||Bh(x)&&(p.current=_.id,H5(x))},[e,x,_?.id]),(0,v.useEffect)(()=>{e&&_?.phase===`connected`&&!m.current&&(m.current=!0,i.refreshCredentials())},[e,_?.phase,i]);let S=async()=>{try{r.museLoginCancel&&o(await r.museLoginCancel())}catch{}c(`stopped`)},C=e=>{if(!navigator.clipboard){i.toast(`error`,`Could not copy — select it and copy by hand`);return}navigator.clipboard.writeText(e).then(()=>{f(!0),setTimeout(()=>f(!1),2e3)}).catch(()=>i.toast(`error`,`Could not copy`))},w=_?.phase===`connected`,T=_?.phase===`failed`||_?.phase===`expired`||_?.phase===`cancelled`,E=y?.state===`failed`,D=y?.state===`working`,O=y?.total&&y.total>0?Math.min(100,Math.floor(y.received/y.total*100)):null,k;return k=s===`unavailable`?(0,U.jsx)(`p`,{"data-testid":`muse-unavailable`,children:`This version of OonaCode on this PC cannot sign in with Meta. Paste your Muse key in the Connect window instead.`}):s===`checking`||!a?(0,U.jsx)(`p`,{children:`Looking at this PC…`}):s===`confirm`?(0,U.jsxs)(`div`,{className:`space-y-2`,"data-testid":`muse-confirm`,children:[(0,U.jsxs)(`p`,{children:[`To sign you in, OonaCode will download Meta’s own `,(0,U.jsx)(`b`,{children:`Muse`}),` program once (about`,` `,420,` MB) into its own folder, checked against Meta’s published checksum. It runs only to sign you in.`]}),(0,U.jsx)(`p`,{className:`text-fg-muted`,children:`You then approve a short code on Meta’s page. Your key is stored in your vault; chats run from this PC straight to Meta, not through Muse. Nothing is downloaded until you press the button.`})]}):w?(0,U.jsx)(`p`,{"data-testid":`muse-connected`,children:`Signed in. Your Meta Muse key is stored in your vault and synced to your other machines; chats on it run from this PC straight to Meta.`}):D?(0,U.jsxs)(`div`,{className:`space-y-2`,"data-testid":`muse-install`,children:[(0,U.jsx)(`p`,{children:Tbe[y?.phase??`download`]??`Installing Muse…`}),(0,U.jsx)(`div`,{className:`h-2 w-full overflow-hidden rounded bg-surface-2`,children:(0,U.jsx)(`div`,{className:`h-2 bg-accent`,style:{width:`${O??5}%`},"data-testid":`muse-install-bar`})}),(0,U.jsx)(`p`,{className:`text-fg-muted text-xs`,children:y&&y.received>0?`${y7(y.received)}${y.total?` of ${y7(y.total)}`:``}`:`Starting the download…`})]}):E?(0,U.jsx)(`p`,{className:`text-danger`,"data-testid":`muse-install-failed`,children:y?.error??`Muse could not be installed.`}):b&&_?(0,U.jsxs)(`div`,{className:`space-y-3`,"data-testid":`muse-awaiting`,children:[(0,U.jsx)(`p`,{children:`A sign-in page from Meta opened in your browser. If it did not, open the link below on any device and make sure this code matches:`}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`code`,{className:`text-lg font-mono px-2 py-1 rounded border border-border`,"data-testid":`muse-user-code`,children:_.userCode}),(0,U.jsxs)(K,{onClick:()=>_.userCode&&C(_.userCode),children:[(0,U.jsx)(G.Copy,{className:`w-4 h-4`}),` `,d?`Copied`:`Copy code`]})]}),x&&Bh(x)?(0,U.jsxs)(`div`,{className:`flex items-center gap-2 break-all`,children:[(0,U.jsx)(`a`,{className:`underline`,href:x,onClick:e=>{e.preventDefault(),H5(x)},children:x}),(0,U.jsxs)(K,{onClick:()=>C(x),children:[(0,U.jsx)(G.Copy,{className:`w-4 h-4`}),` Copy link`]})]}):null,(0,U.jsxs)(`p`,{className:`text-fg-muted`,children:[`Waiting for your approval…`,_.expiresAt?` The code expires at ${new Date(_.expiresAt).toLocaleTimeString()}.`:``,` `,`The key is stored in your vault the moment Meta confirms it.`]})]}):T||s===`stopped`?(0,U.jsx)(`p`,{className:T&&_?.phase!==`cancelled`?`text-danger`:``,"data-testid":`muse-ended`,children:l??_?.message??`The sign-in did not complete.`}):(0,U.jsx)(`p`,{children:_?.message??`Getting Meta’s sign-in page ready…`}),(0,U.jsx)(GS,{open:e,title:t,onClose:()=>n(w),footer:(0,U.jsxs)(U.Fragment,{children:[s===`running`&&!w&&!T&&!E?(0,U.jsx)(K,{onClick:()=>void S(),"data-testid":`muse-cancel`,children:`Cancel`}):null,s===`confirm`?(0,U.jsx)(K,{variant:`primary`,onClick:()=>void g(),"data-testid":`muse-start`,children:`Download and sign in`}):null,(s===`stopped`||T||E)&&!w&&s!==`unavailable`?(0,U.jsx)(K,{onClick:()=>void g(),"data-testid":`muse-retry`,children:`Try again`}):null,(0,U.jsx)(K,{variant:`primary`,onClick:()=>n(w),children:w?`Done`:`Close`})]}),children:(0,U.jsx)(`div`,{className:`space-y-3 text-sm`,"data-testid":`muse-login-dialog`,children:k})})}function Dbe(e,t){let n=e.definition.displayName;return!t||t.id===`payg`||t.id===`api-key`?[`Sign in to the ${n} console.`,`Create an API key (or copy an existing one).`,`Paste it below — OonaCode encrypts it into your vault before it leaves this PC.`]:[`Open the ${n} console and pick the ${t.label} plan.`,t.notes??`Complete the provider’s subscription/token flow in the browser.`,`Copy the token it issues${t.keyFormat?` (looks like ${t.keyFormat})`:``} and paste it below.`]}function Obe(e,t){let n=e.find(e=>e.definition.id===t);if(!n)return[];let r=n.definition.clientGroup??n.definition.id,i=e.find(e=>e.definition.id===r);return i?[i,...e.filter(e=>e.definition.clientGroup===r)]:[n]}function kbe(e){let t=[];for(let n of e){let e=n.definition,r=Fs(e),i=e.credentialClass===`subscription`;if(r.length>1)for(let i of r)t.push({key:`${e.id}:${i.id}`,label:i.id===`token-plan`?`Subscription`:i.id===`payg`?`API`:i.label,provider:n,variantId:i.id,variant:i,isSubscription:!1,hasLoginFlow:!1,loginKind:null,keyFormat:i.keyFormat??e.keyFormat});else t.push({key:e.id,label:e.recordLabel??(i?`Subscription`:`API`),provider:n,variantId:r[0]?.id??null,variant:r[0]??null,isSubscription:i,hasLoginFlow:i&&e.route===`direct`,loginKind:i&&e.route===`direct`?e.museCliLogin?`muse`:e.subscriptionLogin?`oauth`:`claude`:null,keyFormat:r[0]?.keyFormat??e.keyFormat})}return t}function b7(e){let t=(e.provider.credentials??[]).filter(e=>e.class!==`none`);return(e.variantId?t.filter(t=>(t.variantId??`payg`)===e.variantId):t).slice(0,1)}function Abe({open:e,providerId:t,onClose:n}){let{state:r,actions:i}=W(),a=(0,v.useMemo)(()=>t?Obe(r.providers,t):[],[r.providers,t]),o=(0,v.useMemo)(()=>kbe(a),[a]),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(!1),S=o.find(e=>e.key===s)??o[0]??null;if((0,v.useEffect)(()=>{if(!e)return;let n=o.find(e=>e.provider.definition.id===t);c((n??o[0])?.key??``),u(``),m(``),y(null),x(!1)},[e,t,o]),(0,v.useEffect)(()=>{if(!e||!S)return;let t=S.provider.definition;f(t.userBaseUrl?S.variant?.baseUrl??t.baseUrl:``)},[e,S,S?.key]),!S)return null;let C=S.provider.definition,w=a[0]?.definition?.displayName??C.displayName;if(C.engine===`agy`)return(0,U.jsx)(GS,{open:e,title:w,onClose:n,footer:(0,U.jsx)(K,{onClick:n,children:`Close`}),children:(0,U.jsx)(Cbe,{definition:C})});if(b)return(0,U.jsx)(Ebe,{open:e,label:C.museCliLogin?.signInLabel??`Sign in with Meta`,onClose:e=>{x(!1),e&&n()}});let T=b7(S),E=a.some(e=>(e.credentials??[]).some(e=>e.class!==`none`)),D=C.credentialClass!==`none`,O=Bs(C,{credentialClass:S.isSubscription?`subscription`:C.credentialClass,...C.userBaseUrl&&d.trim()?{baseUrl:d.trim()}:{}}),k=!h&&(!D||l.trim().length>0),A=async()=>{g(!0),y(null);try{if(!D){await i.setActiveProvider(C.id),n();return}let e=await i.probeCredential(C.id,{secret:l.trim(),variantId:S.variantId,...C.userBaseUrl&&d.trim()?{baseUrl:d.trim()}:{}});if(!e.ok){y(e.error??`${w} rejected this key — check it and try again.`);return}let t={};S.variantId&&(t.variant=S.variantId),C.userBaseUrl&&d.trim()&&(t.baseUrl=d.trim()),await i.addCredential({class:S.isSubscription?`subscription`:`api_key`,providerId:C.id,secret:l.trim(),...p.trim()?{label:p.trim()}:{},...Object.keys(t).length>0?{meta:t}:{}})&&(u(``),n())}finally{g(!1)}};return(0,U.jsx)(GS,{open:e,title:`${E?`Manage`:`Connect`} ${w}`,onClose:n,footer:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{onClick:n,children:`Cancel`}),S.loginKind===`oauth`?(0,U.jsxs)(K,{onClick:()=>i.openOauthLogin(S.provider.definition.id),"data-testid":`connect-oauth-signin`,children:[(0,U.jsx)(G.LogIn,{className:`w-4 h-4`}),` `,S.provider.definition.subscriptionLogin?.signInLabel??`Sign in instead`]}):S.loginKind===`muse`?(0,U.jsxs)(K,{onClick:()=>x(!0),"data-testid":`connect-muse-signin`,children:[(0,U.jsx)(G.LogIn,{className:`w-4 h-4`}),` `,S.provider.definition.museCliLogin?.signInLabel??`Sign in with Meta`]}):S.loginKind===`claude`?(0,U.jsxs)(K,{onClick:()=>i.openClaudeLogin(null),"data-testid":`connect-claude-signin`,children:[(0,U.jsx)(G.LogIn,{className:`w-4 h-4`}),` Sign in instead`]}):null,(0,U.jsx)(K,{variant:`primary`,busy:h,disabled:!k,onClick:()=>void A(),children:h?`Checking…`:D?`Save key`:`Use this provider`})]}),children:(0,U.jsxs)(`div`,{className:`space-y-3`,children:[o.length>1?(0,U.jsx)(`div`,{className:`flex gap-1 border-b border-border`,role:`tablist`,children:o.map(e=>{let t=b7(e)[0];return(0,U.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.key===S.key,"data-testid":`record-tab-${e.key}`,onClick:()=>c(e.key),className:e.key===S.key?`rounded-t-md border border-b-0 border-border bg-surface-2 px-3 py-1.5 text-sm font-medium`:`px-3 py-1.5 text-sm text-fg-muted hover:text-fg`,children:[e.label,t?(0,U.jsx)(`span`,{className:`ml-1.5 font-mono text-[11px] text-ok`,children:t.masked}):null]},e.key)})}):null,T.length>0?(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:`Connected`}),T.map(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border px-2.5 py-1.5`,"data-testid":`stored-credential-${e.id}`,children:[(0,U.jsx)(WS,{tone:e.class===`subscription`?`accent`:`ok`,children:S.label}),(0,U.jsx)(`span`,{className:`font-mono text-xs`,children:e.masked}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] text-fg-faint`,children:e.label}),(0,U.jsx)(K,{size:`sm`,onClick:()=>void i.testCredential(e.id),children:`Test`}),(0,U.jsx)(K,{size:`sm`,variant:`danger`,onClick:()=>void i.deleteCredential(e.id),children:`Remove`})]},e.id))]}):null,(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,U.jsx)(WS,{tone:O.viaGateway?`accent`:`ok`,children:O.badge}),(0,U.jsx)(WS,{children:C.kind}),S.keyFormat?(0,U.jsxs)(`span`,{className:`text-fg-faint`,children:[`key format `,S.keyFormat]}):null]}),(0,U.jsxs)(`div`,{className:O.viaGateway?`rounded-md border border-border bg-surface-2 px-3 py-2 text-xs text-fg-muted`:`rounded-md border border-ok/40 bg-ok-soft px-3 py-2 text-xs text-ok`,"data-testid":`connect-route`,children:[O.detail,D&&!O.viaGateway?` The key is stored in your zero-knowledge vault.`:null]}),D?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`ol`,{className:`ml-4 list-decimal space-y-1 text-xs text-fg-muted`,children:S.loginKind===`muse`?[`Press “${S.provider.definition.museCliLogin?.signInLabel??`Sign in with Meta`}”: OonaCode fetches Meta’s own Muse once into its own folder, you approve a short code on Meta’s page, and the key is stored by itself.`,`Or paste a Muse subscription key, or a Meta Model API key, below.`,`Chats go from this PC straight to Meta; the key stays in your vault.`].map((e,t)=>(0,U.jsx)(`li`,{children:e},t)):S.loginKind===`oauth`?[`Press “${S.provider.definition.subscriptionLogin?.signInLabel??`Sign in`}”: a short code opens in your browser, you approve it, and the subscription is stored by itself — nothing to paste.`,`The token refreshes on its own; sign in again only if the provider says it expired.`,`Or paste an access token below, if you have one from elsewhere.`].map((e,t)=>(0,U.jsx)(`li`,{children:e},t)):S.hasLoginFlow?[`Press “Sign in instead” to get a token through the genuine engine — the fastest way.`,"Or run `claude setup-token` yourself and complete the sign-in in your browser.",`Paste the token it prints below (it looks like sk-ant-oat01-…).`].map((e,t)=>(0,U.jsx)(`li`,{children:e},t)):Dbe(S.provider,S.variant).map((e,t)=>(0,U.jsx)(`li`,{children:e},t))}),(0,U.jsx)(HS,{label:S.loginKind===`muse`?`Muse key`:S.isSubscription?`Subscription token`:`API key`,hint:`Tried against the provider before it is saved, then encrypted on this PC with your vault key.`,children:(0,U.jsx)(`input`,{className:q,type:`password`,autoComplete:`off`,spellCheck:!1,value:l,placeholder:S.keyFormat??`sk-…`,onChange:e=>{u(e.target.value),y(null)}})}),_?(0,U.jsx)(`div`,{className:`rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-xs text-danger`,"data-testid":`connect-probe-error`,children:_}):null,C.userBaseUrl?(0,U.jsx)(HS,{label:`Base URL`,hint:`Point this at your own server if it is not the default. Each record has its own endpoint.`,children:(0,U.jsx)(`input`,{className:q,value:d,spellCheck:!1,onChange:e=>f(e.target.value),placeholder:S.variant?.baseUrl??C.baseUrl})}):null,(0,U.jsx)(HS,{label:`Label (optional)`,children:(0,U.jsx)(`input`,{className:q,value:p,onChange:e=>m(e.target.value),placeholder:`${w} ${S.label.toLowerCase()} key`})})]}):(0,U.jsxs)(`div`,{className:`rounded-md bg-surface-2 px-3 py-2 text-xs text-fg-muted`,children:[C.displayName,` needs no credential.`]})]})})}function jbe({open:e,onClose:t}){let{state:n,actions:r}=W(),i=n.ui.oauthLoginProviderId,a=i?n.providers.find(e=>e.definition.id===i)??null:null,o=n.oauthLogin&&n.oauthLogin.providerId===i?n.oauthLogin:null,[s,c]=(0,v.useState)(0),[l,u]=(0,v.useState)(!1),d=(0,v.useRef)(null),f=a?.definition.displayName??i??`the provider`,p=a?.definition.subscriptionLogin?.signInLabel??`Sign in to ${f}`,m=o?.phase===`awaiting_approval`,h=m?o?.verificationUriComplete??o?.verificationUri??null:null;(0,v.useEffect)(()=>{if(!e||!i)return;d.current=null,r.startOauthLogin(i);let t=setInterval(()=>void r.refreshOauthLogin(i),2e3);return()=>clearInterval(t)},[e,i,s,r]),(0,v.useEffect)(()=>{!e||!h||!o?.id||d.current===o.id||(d.current=o.id,H5(h))},[e,h,o?.id]),(0,v.useEffect)(()=>{e&&o?.phase===`connected`&&r.refreshCredentials()},[e,o?.phase,r]);let g=e=>{if(!navigator.clipboard){r.toast(`error`,`Could not copy — select it and copy by hand`);return}navigator.clipboard.writeText(e).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)}).catch(()=>r.toast(`error`,`Could not copy`))},_=o?.phase===`connected`||o?.phase===`failed`||o?.phase===`expired`||o?.phase===`cancelled`;return(0,U.jsx)(GS,{open:e,title:p,onClose:t,footer:(0,U.jsxs)(U.Fragment,{children:[m?(0,U.jsx)(K,{onClick:()=>i&&void r.cancelOauthLogin(i),"data-testid":`oauth-login-cancel`,children:`Cancel sign-in`}):null,_&&o?.phase!==`connected`?(0,U.jsx)(K,{onClick:()=>c(e=>e+1),"data-testid":`oauth-login-retry`,children:`Try again`}):null,(0,U.jsx)(K,{variant:`primary`,onClick:t,children:o?.phase===`connected`?`Done`:`Close`})]}),children:(0,U.jsx)(`div`,{className:`space-y-3 text-sm`,"data-testid":`oauth-login-dialog`,children:m&&o?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{children:[`A sign-in page for `,f,` opened in your browser. If it did not, open the link below on any device and enter this code:`]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`code`,{className:`text-lg font-mono px-2 py-1 rounded border border-border`,"data-testid":`oauth-user-code`,children:o.userCode}),(0,U.jsxs)(K,{onClick:()=>o.userCode&&g(o.userCode),children:[(0,U.jsx)(G.Copy,{className:`w-4 h-4`}),` `,l?`Copied`:`Copy code`]})]}),h?(0,U.jsxs)(`div`,{className:`flex items-center gap-2 break-all`,children:[(0,U.jsx)(`a`,{className:`underline`,href:h,onClick:e=>{e.preventDefault(),H5(h)},children:h}),(0,U.jsxs)(K,{onClick:()=>g(h),children:[(0,U.jsx)(G.Copy,{className:`w-4 h-4`}),` Copy link`]})]}):null,(0,U.jsxs)(`p`,{className:`text-fg-muted`,children:[`Waiting for your approval… the code expires`,o.expiresAt?` at ${new Date(o.expiresAt).toLocaleTimeString()}`:` soon`,`. The subscription is stored in your vault the moment `,f,` confirms it.`]})]}):o?.phase===`connected`?(0,U.jsxs)(`p`,{"data-testid":`oauth-login-connected`,children:[`Signed in. Your `,f,` subscription is stored in your vault and synced to your other machines; chats on it run from this PC straight to the provider.`]}):_?(0,U.jsx)(`p`,{className:`text-danger`,"data-testid":`oauth-login-ended`,children:o?.message??`The sign-in did not complete.`}):(0,U.jsx)(`p`,{children:`Starting the sign-in…`})})})}function Mbe({open:e,onClose:t}){let{state:n,actions:r}=W(),i=(0,v.useMemo)(()=>gm(n.providers),[n.providers]),[a,o]=(0,v.useState)({}),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(!1);(0,v.useEffect)(()=>{e&&(o({...n.settings?.modelVisibility??{}}),c(``))},[e]);let d=(e,t)=>a[e]??t,f=(e,t,n)=>d(e,n).includes(t),p=(e,t,n)=>{o(r=>{let i=r[e]??n,a=i.includes(t)?i.filter(e=>e!==t):n.filter(e=>e===t||i.includes(e));return{...r,[e]:a}})},m=(e,t,n)=>{o(r=>({...r,[e]:t?[...n]:[]}))},h=async()=>{u(!0);try{let e={};for(let t of i){let n=t.definition.models.map(e=>e.id),r=a[t.definition.id];r&&r.length!==n.length&&(e[t.definition.id]=r)}await r.saveSettings({modelVisibility:e}),t()}finally{u(!1)}},g=s.trim().toLowerCase();return(0,U.jsx)(GS,{open:e,title:`Manage models`,onClose:t,wide:!0,footer:(0,U.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-2`,children:[(0,U.jsxs)(K,{onClick:()=>{t(),r.openSettings(`providers`)},"data-testid":`manage-models-add-provider`,children:[(0,U.jsx)(G.Plus,{className:`w-3.5 h-3.5`}),` Add provider`]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(K,{onClick:t,children:`Cancel`}),(0,U.jsx)(K,{variant:`primary`,busy:l,onClick:()=>void h(),"data-testid":`manage-models-save`,children:`Save`})]})]}),children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Choose which models the chat's picker offers. A provider with every model checked shows all of them — including ones it adds later.`}),(0,U.jsx)(`input`,{className:q,value:s,onChange:e=>c(e.target.value),placeholder:`Filter models…`,"data-testid":`manage-models-filter`}),i.length===0?(0,U.jsxs)(`div`,{className:`text-sm text-fg-faint`,children:[`No provider is connected yet — use `,(0,U.jsx)(`strong`,{children:`Add provider`}),` below to connect one.`]}):null,i.map(e=>{let t=e.definition.models.map(e=>e.id),n=e.definition.models.filter(e=>!g||e.id.toLowerCase().includes(g)||(e.displayName??``).toLowerCase().includes(g)),r=d(e.definition.id,t).length;return(0,U.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`manage-models-${e.definition.id}`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:e.definition.displayName}),(0,U.jsxs)(`span`,{className:`text-xs text-fg-faint`,children:[r===t.length?`all`:r,` of `,t.length,` shown`]}),(0,U.jsxs)(`span`,{className:`ml-auto flex gap-1`,children:[(0,U.jsx)(K,{size:`sm`,onClick:()=>m(e.definition.id,!0,t),children:`All`}),(0,U.jsx)(K,{size:`sm`,onClick:()=>m(e.definition.id,!1,t),children:`None`})]})]}),(0,U.jsxs)(`div`,{className:`grid gap-1 sm:grid-cols-2`,children:[n.map(n=>(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:f(e.definition.id,n.id,t),onChange:()=>p(e.definition.id,n.id,t),"data-testid":`manage-model-${n.id}`}),(0,U.jsxs)(`span`,{className:`truncate`,title:n.id,children:[n.displayName??n.id,n.displayName&&n.displayName!==n.id?(0,U.jsxs)(`span`,{className:`text-fg-faint`,children:[` · `,n.id]}):null]})]},n.id)),n.length===0?(0,U.jsxs)(`div`,{className:`text-xs text-fg-faint`,children:[(0,U.jsx)(G.Info,{className:`mr-1 inline w-3 h-3`}),` No model matches the filter.`]}):null]})]},e.definition.id)})]})})}var x7={mode:`names`,mine:!0,model:!0,tools:!1,subagents:!1,projectId:null,when:`any`,caseSensitive:!1,wholeWord:!1};function S7(e,t,n){let r=Pe(t,{caseSensitive:n.caseSensitive,wholeWord:n.wholeWord});if(!r)return[{text:e,hit:!1}];let i=[],a=0;for(let t of e.matchAll(r)){let n=t.index??0;t[0].length!==0&&(n>a&&i.push({text:e.slice(a,n),hit:!1}),i.push({text:t[0],hit:!0}),a=n+t[0].length)}return a<e.length&&i.push({text:e.slice(a),hit:!1}),i}function C7(e){return Object.keys(x7).some(t=>e[t]!==x7[t])}function w7(e,t=Date.now()){if(e===`any`)return null;if(e===`today`){let e=new Date(t);return e.setHours(0,0,0,0),e}return new Date(t-(e===`week`?7:30)*24*60*60*1e3)}function Nbe(e,t,n,r=Date.now()){if(n.projectId!==null&&e.projectId!==n.projectId)return!1;let i=w7(n.when,r);if(i&&e.mtime<i.getTime())return!1;if((n.caseSensitive||n.wholeWord)&&t.trim()!==``){let r=[e.title,e.firstPrompt,e.lastPrompt,e.projectDir],i={caseSensitive:n.caseSensitive,wholeWord:n.wholeWord};if(!r.some(e=>typeof e==`string`&&Fe(e,t,i)))return!1}return!0}function Pbe(e,t,n=Date.now()){let r=e.trim();if(r.length<2||!t.mine&&!t.model&&!t.tools)return null;let i=w7(t.when,n);return{q:r,limit:200,from:t.mine&&t.model?`both`:t.mine?`user`:t.model?`assistant`:`none`,tools:t.tools,subagents:t.subagents,...i?{since:i.toISOString()}:{},...t.projectId?{projectId:t.projectId}:{},caseSensitive:t.caseSensitive,wholeWord:t.wholeWord}}function T7({label:e,hint:t,checked:n,onChange:r,testId:i}){return(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 py-0.5 text-xs`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:n,onChange:e=>r(e.target.checked),"data-testid":i}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`span`,{className:`text-fg`,children:e}),t?(0,U.jsx)(`span`,{className:`block text-[11px] text-fg-faint`,children:t}):null]})]})}var E7=`w-full rounded-md border border-border bg-surface px-2 py-1 text-xs text-fg focus:outline-none`,Fbe={names:`Names & prompts`,conversations:`Whole chats`,namesHint:`A chat’s name, its first and last message, and its folder.`,conversationsHint:`Every message of every chat on this PC. Pick whose words to look in.`};function D7({options:e,onChange:t,projects:n,onClose:r,words:i=Fbe}){let a=(n,r)=>t({...e,[n]:r}),o=e.mode===`conversations`,s=o&&!e.mine&&!e.model&&!e.tools;return(0,U.jsxs)(`div`,{className:`absolute left-2 right-2 top-full z-30 mt-1 space-y-3 rounded-lg border border-border bg-surface p-3 shadow-xl`,onMouseDown:e=>{!(e.target instanceof HTMLSelectElement)&&!(e.target instanceof HTMLInputElement)&&e.preventDefault()},onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),r())},"data-testid":`search-options`,children:[(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide text-fg-faint`,children:`Search in`}),(0,U.jsx)(qS,{label:`Search in`,value:e.mode,options:[{value:`names`,label:i.names},{value:`conversations`,label:i.conversations}],onChange:e=>a(`mode`,e)}),(0,U.jsx)(`p`,{className:`text-[11px] text-fg-faint`,"data-testid":`search-mode-hint`,children:o?i.conversationsHint:i.namesHint})]}),o?(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(T7,{label:`My messages`,checked:e.mine,onChange:e=>a(`mine`,e),testId:`search-opt-mine`}),(0,U.jsx)(T7,{label:`Model replies`,checked:e.model,onChange:e=>a(`model`,e),testId:`search-opt-model`}),(0,U.jsx)(T7,{label:`Tool calls & output`,hint:`Commands, file paths and what the tools answered.`,checked:e.tools,onChange:e=>a(`tools`,e),testId:`search-opt-tools`}),(0,U.jsx)(T7,{label:`Subagents’ conversations`,checked:e.subagents,onChange:e=>a(`subagents`,e),testId:`search-opt-subagents`}),s?(0,U.jsx)(`p`,{className:`text-[11px] text-warn`,children:`Tick at least one to search.`}):null]}):null,(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[n?(0,U.jsxs)(`label`,{className:`space-y-1 text-[11px] text-fg-faint`,children:[(0,U.jsx)(`span`,{children:`Project`}),(0,U.jsxs)(`select`,{className:E7,value:e.projectId??``,onChange:e=>a(`projectId`,e.target.value||null),"data-testid":`search-opt-project`,children:[(0,U.jsx)(`option`,{value:``,children:`All projects`}),n.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}):null,(0,U.jsxs)(`label`,{className:`space-y-1 text-[11px] text-fg-faint`,children:[(0,U.jsx)(`span`,{children:`When`}),(0,U.jsxs)(`select`,{className:E7,value:e.when,onChange:e=>a(`when`,e.target.value),"data-testid":`search-opt-when`,children:[(0,U.jsx)(`option`,{value:`any`,children:`Any time`}),(0,U.jsx)(`option`,{value:`today`,children:`Today`}),(0,U.jsx)(`option`,{value:`week`,children:`Last 7 days`}),(0,U.jsx)(`option`,{value:`month`,children:`Last 30 days`})]})]})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-x-4`,children:[(0,U.jsx)(T7,{label:`Match case`,checked:e.caseSensitive,onChange:e=>a(`caseSensitive`,e),testId:`search-opt-case`}),(0,U.jsx)(T7,{label:`Whole words`,checked:e.wholeWord,onChange:e=>a(`wholeWord`,e),testId:`search-opt-word`})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between border-t border-border pt-2`,children:[(0,U.jsx)(`button`,{type:`button`,className:H(`text-xs`,C7(e)?`text-accent hover:underline`:`text-fg-faint`),disabled:!C7(e),onClick:()=>t(x7),"data-testid":`search-opt-reset`,children:`Reset`}),(0,U.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-2 px-2 py-1 text-xs text-fg hover:bg-surface-3`,onClick:r,"data-testid":`search-opt-done`,children:`Done`})]})]})}function Ibe(e){return e.kind===`tool`?e.tool??`Tool`:e.role===`assistant`?`Model`:`You`}function Lbe({query:e,options:t}){let{state:n,actions:r}=W(),i=(0,v.useMemo)(()=>Pbe(e,t),[e,t]),[a,o]=(0,v.useState)(null),s=i?JSON.stringify(i):``;(0,v.useEffect)(()=>{if(!i)return;let e=!0,t=setTimeout(()=>{r.searchTranscripts(i).then(t=>{e&&o({key:s,res:t})})},350);return()=>{e=!1,clearTimeout(t)}},[s,r]);let c=a&&a.key===s?a:null,l=(0,v.useMemo)(()=>{let e=new Map;for(let t of c?.res?.hits??[]){let r=n.sessions.find(e=>e.id===t.sessionId)?.title||t.title||`Untitled chat`,i=e.get(t.sessionId)??{title:r,hits:[]};i.hits.push(t),e.set(t.sessionId,i)}return[...e.entries()]},[c,n.sessions]);if(!i)return(0,U.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-fg-faint`,"data-testid":`transcript-search-idle`,children:e.trim().length<2?`Type at least two characters to search every chat.`:`Tick what to look in — your messages, the model’s replies or the tools’ side.`});if(!c)return(0,U.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-fg-faint`,"data-testid":`transcript-search-busy`,children:`Searching every chat…`});if(c.res===null)return(0,U.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-danger`,"data-testid":`transcript-search-failed`,children:`This PC could not search its chats. Try again, or update OonaCode.`});let u=c.res.hits.length;return(0,U.jsxs)(`div`,{className:`pb-2`,"data-testid":`transcript-search-results`,children:[(0,U.jsx)(`div`,{className:`px-3 py-1.5 text-[11px] text-fg-faint`,children:u===0?`No message on this PC says that.`:`${u}${c.res.truncated?`+`:``} ${u===1?`message`:`messages`} in ${l.length} ${l.length===1?`chat`:`chats`}`}),l.map(([n,i])=>(0,U.jsxs)(`div`,{className:`mb-1.5`,"data-testid":`transcript-search-chat-${n}`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-1.5 rounded px-2 py-1 text-left text-[13px] font-semibold text-fg hover:bg-surface-2`,onClick:()=>r.openChatWithSearch(n,e.trim()),children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:i.title}),(0,U.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-3 px-1.5 text-[10px] font-semibold text-fg-muted`,children:i.hits.length})]}),i.hits.map(i=>(0,U.jsxs)(`button`,{type:`button`,className:`block w-full rounded px-2 py-1 pl-4 text-left text-xs hover:bg-surface-2`,onClick:()=>r.openChatWithSearch(n,e.trim()),"data-testid":`transcript-search-hit`,children:[(0,U.jsxs)(`span`,{className:`mb-0.5 flex items-center gap-1.5 text-[10px] text-fg-faint`,children:[i.kind===`tool`?(0,U.jsx)(G.Tool,{className:`h-3 w-3`}):i.role===`assistant`?(0,U.jsx)(G.Bot,{className:`h-3 w-3`}):(0,U.jsx)(G.User,{className:`h-3 w-3`}),(0,U.jsx)(`span`,{className:`font-medium text-fg-muted`,children:Ibe(i)}),i.subpath?(0,U.jsx)(`span`,{children:`· subagent`}):null,i.timestamp?(0,U.jsx)(`span`,{className:`ml-auto`,children:U_(i.timestamp)}):null]}),(0,U.jsx)(`span`,{className:`line-clamp-3 text-fg-muted`,children:S7(i.snippet,e,t).map((e,t)=>e.hit?(0,U.jsx)(`mark`,{className:`rounded bg-warn-soft px-0.5 text-fg`,children:e.text},t):(0,U.jsx)(`span`,{children:e.text},t))})]},`${i.seq}`))]},n))]})}function O7(e){return`${e.agentId??`claude-code`}:${e.id}`}function k7(e){let t=Date.parse(e.lastEntryAt??e.updatedAt);return Number.isFinite(t)?t:0}function Rbe(e,t,n=Date.now()){let r=w7(t.when,n)?.getTime()??null,i=Pe(e,{caseSensitive:t.caseSensitive,wholeWord:t.wholeWord});return e=>r!==null&&k7(e)<r?!1:i===null||[e.title,e.firstPrompt,e.lastPrompt,e.cwd,e.projectName,e.id].some(e=>typeof e==`string`&&(i.lastIndex=0,i.test(e)))}function zbe(e,t,n=Date.now()){let r=e.trim();if(r.length<2||!t.mine&&!t.model&&!t.tools)return null;let i=w7(t.when,n);return{q:r,from:t.mine&&t.model?`both`:t.mine?`user`:t.model?`assistant`:`none`,tools:t.tools,subagents:t.subagents,...i?{since:i.toISOString()}:{},caseSensitive:t.caseSensitive,wholeWord:t.wholeWord}}function Bbe(e,t){let n=new Map;for(let t of e){let e=O7(t);n.set(e,e);for(let r of t.supersedes??[]){let i=O7({agentId:t.agentId,id:r});n.has(i)||n.set(i,e)}}let r=new Map;for(let e of t){let t=n.get(O7(e));if(!t)continue;let i=r.get(t);if(!i){r.set(t,{...e,snippets:e.snippets.slice(0,3)});continue}r.set(t,{...i,hits:i.hits+e.hits,...i.hitsCapped||e.hitsCapped?{hitsCapped:!0}:{},snippets:[...i.snippets,...e.snippets].slice(0,3)})}return r}var Vbe={new:`New`,imported:`Imported`,behind:`Imported · original moved on`,deleted:`You deleted it in OonaCode`,unavailable:`Cannot be imported yet`};function A7(e){return e.alreadyImported?e.upToDate===!1?`behind`:`imported`:e.deletedHere===!0?`deleted`:j7(e)?`unavailable`:`new`}function j7(e){return typeof e.unavailable==`string`&&e.unavailable.length>0}function M7(e){if(j7(e))return!1;let t=A7(e);return t===`new`||t===`behind`}function Hbe(e){return A7(e)===`new`}function Ube(e,t){return new Set(t?e.filter(Hbe).map(e=>e.id):[])}function Wbe(e){if(!e.some(e=>e.projectName))return e;let t=[],n=new Map;for(let r of e){let e=r.projectName??``,i=n.get(e);i||(i=[],n.set(e,i),t.push(e)),i.push(r)}return t.flatMap(e=>n.get(e)??[])}function Gbe(){return{new:0,imported:0,behind:0,deleted:0,unavailable:0}}function Kbe(e){let t=new Map;for(let n of e){let e=n.agentId??`claude-code`,r=t.get(e);r||(r={key:e,name:n.agentName??`Claude Code`,rows:[],counts:Gbe()},t.set(e,r)),r.rows.push(n),r.counts[A7(n)]+=1}for(let e of t.values())e.rows=Wbe([...e.rows].sort((e,t)=>k7(t)-k7(e)));return[...t.values()]}function N7(e,t){let n=0,r=0,i=0;for(let a of e){let e=t.has(a.id);e&&(n+=1),M7(a)&&(r+=1,e&&(i+=1))}return n===0?`none`:r>0&&i===r?`all`:`some`}function qbe(e,t){let n=new Set(t),r=e.filter(M7);if(N7(e,t)===`all`||r.length===0)for(let t of e)n.delete(t.id);else for(let e of r)n.add(e.id);return n}function Jbe(e,t){let n=0;if(t)for(let r of e)t.has(r)||(n+=1);return{total:e.size,notShown:n}}var Ybe={names:`Names & folders`,conversations:`Whole conversations`,namesHint:`A chat’s name, its first and last message, and the folder it ran in.`,conversationsHint:`Every message of every chat listed here, read from the other apps’ own files. Pick whose words to look in.`},P7=`Ticks the chats with something to bring in — new ones, and imported ones whose original moved on. An imported chat that is up to date, or one you deleted in OonaCode, is ticked on its own row.`;function Xbe(e){return e.partial===`time`?`Stopped after ${Math.round(e.elapsedMs/1e3)} s — these are the chats found until then. A longer phrase narrows it.`:e.partial===`chats`?`Stopped at ${e.chats.length} chats — a longer phrase narrows it.`:null}function F7(e){return e?e.replace(/[\\/]+$/,``).split(/[\\/]/).length<=2?e:`…${e.slice(-40)}`:`no folder recorded`}function Zbe(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}function Qbe(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}):``}var I7=(e,t,n)=>`${e} ${e===1?t:n}`;function $be({open:e,onClose:t,autoOffer:n=!1}){let{state:r,actions:i}=W(),a=r.importProgress,[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(new Set),[g,_]=(0,v.useState)(new Set),[y,b]=(0,v.useState)(null),x=(0,v.useMemo)(()=>f??[],[f]),S=(0,v.useMemo)(()=>Kbe(x),[x]),C=(0,v.useMemo)(()=>{let e={new:0,imported:0,behind:0,deleted:0,unavailable:0};for(let t of S)for(let n of Object.keys(e))e[n]+=t.counts[n];return e},[S]),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(x7),[O,k]=(0,v.useState)(!1),A=(0,v.useRef)(null),j=w.trim()!==``,M=E.mode===`conversations`,[N,ee]=(0,v.useState)(new Set);(0,v.useEffect)(()=>ee(new Set),[w,E]);let te=(0,v.useMemo)(()=>M?zbe(w,E):null,[M,w,E]),P=te?JSON.stringify(te):``,[F,ne]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(!e||!te)return;let t=new AbortController,n=!0,r=setTimeout(()=>{i.searchImportChats(te,t.signal).then(e=>{n&&ne({key:P,res:e})})},350);return()=>{n=!1,clearTimeout(r),t.abort()}},[e,P,i]);let I=F&&F.key===P?F:null,re=(0,v.useMemo)(()=>I?.res?Bbe(x,I.res.chats):null,[I,x]),ie=(0,v.useMemo)(()=>j?M?re?x.filter(e=>re.has(O7(e))):[]:x.filter(Rbe(w,E)):null,[j,M,x,w,E,re]),ae=(0,v.useMemo)(()=>ie?new Set(ie):null,[ie]),L=(0,v.useMemo)(()=>ie?new Set(ie.map(e=>e.id)):null,[ie]),oe=ie??x,se=(0,v.useMemo)(()=>j?{query:w,options:E,litNames:!M}:null,[j,w,E,M]),ce=(0,v.useMemo)(()=>x.filter(e=>e.alreadyImported&&m.has(e.id)),[x,m]),le=(0,v.useMemo)(()=>Jbe(m,L),[m,L]),ue=S.length===1?S[0].name:`coding-agent`;(0,v.useEffect)(()=>{if(!e)return;d(null),b(null),_(new Set),h(new Set),T(``),ne(null),k(!1),s(!0);let t=n;i.scanClaudeSessions().then(e=>{p(e.sessions),h(Ube(e.sessions,t))}).catch(e=>d(e instanceof Error?e.message:String(e))).finally(()=>s(!1))},[e]);let de=(0,v.useCallback)(e=>h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[]),fe=r.prefs.claudeImportOffered,R=(0,v.useCallback)(()=>{fe||i.savePrefs({claudeImportOffered:!0}),t()},[fe,i,t]),pe=async()=>{l(!0),d(null);try{let e=await i.importClaudeSessions([...m],ce.length>0);b({imported:e.imported.length,replaced:e.replaced?.length??0,entries:e.imported.reduce((e,t)=>e+t.entries,0)+(e.replaced??[]).reduce((e,t)=>e+t.entries,0),failed:e.failed.length,filed:e.filed?.length??0,projectsMade:(e.projects??[]).filter(e=>e.created).map(e=>e.name),warnings:e.warnings??[]}),r.prefs.claudeImportOffered||i.savePrefs({claudeImportOffered:!0}),await i.refreshSessions()}catch(e){d(e instanceof Error?e.message:String(e))}finally{l(!1)}},me=C.imported+C.behind;return(0,U.jsx)(GS,{open:e,title:`Import your ${ue} chats`,onClose:R,wide:!0,footer:(0,U.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-2`,children:[(0,U.jsxs)(`span`,{className:`min-w-0 text-[11px] text-fg-faint`,children:[!y&&le.notShown>0?(0,U.jsxs)(`span`,{className:`block text-fg-muted`,"data-testid":`import-claude-ticked-hidden`,children:[le.total,` ticked · `,le.notShown,` not shown by the search`]}):null,ce.length>0?(0,U.jsxs)(`span`,{className:`block text-warn`,children:[ce.length,` already-imported `,ce.length===1?`chat`:`chats`,` `,`will be REPLACED — the OonaCode copy is rebuilt from the original, and anything added here is lost.`]}):(0,U.jsx)(`span`,{className:`block`,children:`Your other apps stay exactly as they are — this copies, it never moves or deletes.`})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,U.jsx)(K,{onClick:R,"data-testid":`import-claude-close`,children:y?`Done`:`Not now`}),y?null:(0,U.jsxs)(K,{variant:`primary`,busy:c,disabled:le.total===0,onClick:()=>void pe(),"data-testid":`import-claude-run`,children:[`Import `,I7(le.total,`chat`,`chats`)]})]})]}),children:(0,U.jsxs)(`div`,{className:`space-y-3`,"data-testid":`import-claude-body`,children:[o?(0,U.jsx)(`div`,{className:`text-sm text-fg-muted`,children:`Looking for chats on this PC…`}):null,a&&!y?(0,U.jsxs)(`div`,{className:`space-y-2`,"data-testid":`import-claude-progress`,children:[(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-sm`,children:[(0,U.jsxs)(`span`,{children:[`Importing `,(0,U.jsx)(`strong`,{children:a.done}),` of `,(0,U.jsx)(`strong`,{children:a.total}),`…`]}),(0,U.jsxs)(`span`,{className:`text-[11px] text-fg-faint`,children:[Math.round(a.done/Math.max(a.total,1)*100),`%`]})]}),(0,U.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded bg-surface-2`,children:(0,U.jsx)(`div`,{className:`h-full bg-accent transition-[width] duration-200`,style:{width:`${Math.round(a.done/Math.max(a.total,1)*100)}%`}})}),a.current?(0,U.jsxs)(`div`,{className:`truncate text-[11px] text-fg-faint`,title:a.current,children:[`reading: `,a.current]}):null,(0,U.jsxs)(`div`,{className:`flex gap-3 text-[11px] text-fg-faint`,children:[(0,U.jsxs)(`span`,{children:[a.imported,` imported`]}),a.skipped>0?(0,U.jsxs)(`span`,{children:[a.skipped,` already in`]}):null,a.failed>0?(0,U.jsxs)(`span`,{className:`text-warn`,children:[a.failed,` could not be read`]}):null]}),(0,U.jsx)(`p`,{className:`text-[11px] text-fg-faint`,children:`A big chat takes a moment — the largest here are over 100 MB. Your Claude Code is only being read.`})]}):null,u?(0,U.jsx)(`div`,{className:`rounded border border-danger/40 bg-danger/10 p-2 text-sm text-danger`,children:u}):null,y?(0,U.jsxs)(`div`,{className:`text-sm`,"data-testid":`import-claude-done`,children:[(0,U.jsxs)(`p`,{children:[`Imported `,(0,U.jsx)(`strong`,{children:y.imported}),` `,y.imported===1?`chat`:`chats`,y.replaced>0?(0,U.jsxs)(U.Fragment,{children:[` and rebuilt `,(0,U.jsx)(`strong`,{children:y.replaced}),` that `,y.replaced===1?`was`:`were`,` already here`]}):null,` `,`(`,y.entries.toLocaleString(),` entries). They are in your sessions list now, and you can carry on typing in them.`]}),y.projectsMade.length>0?(0,U.jsxs)(`p`,{className:`mt-1`,"data-testid":`import-claude-projects-made`,children:[y.projectsMade.length===1?`Created the project `:`Created the projects `,y.projectsMade.map((e,t)=>(0,U.jsxs)(`span`,{children:[t>0?`, `:``,(0,U.jsx)(`strong`,{children:e})]},e)),` `,`and filed `,y.projectsMade.length===1?`its`:`their`,` chats under`,` `,y.projectsMade.length===1?`it`:`them`,`.`]}):null,y.filed>0?(0,U.jsxs)(`p`,{className:`mt-1 text-fg-muted`,"data-testid":`import-claude-filed`,children:[y.filed,` `,y.filed===1?`chat that was`:`chats that were`,` already here`,` `,y.filed===1?`is`:`are`,` now filed under`,` `,y.filed===1?`its`:`their`,` project.`]}):null,y.failed>0?(0,U.jsxs)(`p`,{className:`mt-1 text-warn`,children:[y.failed,` could not be read and were left alone.`]}):null,y.warnings.map(e=>(0,U.jsx)(`p`,{className:`mt-1 text-warn`,children:e},e))]}):null,!o&&!y&&!a&&f!==null&&f.length>0?(0,U.jsxs)(`div`,{className:`space-y-0.5 text-sm`,"data-testid":`import-claude-tally`,children:[(0,U.jsxs)(`p`,{children:[(0,U.jsx)(`strong`,{children:f.length}),` `,f.length===1?`chat`:`chats`,` on this PC`,S.length>0?` — `:``,S.map((e,t)=>(0,U.jsxs)(`span`,{children:[t>0?`, `:``,(0,U.jsx)(`strong`,{children:e.rows.length}),` `,e.name]},e.key))]}),(0,U.jsxs)(`p`,{className:`text-fg-muted`,children:[(0,U.jsx)(`strong`,{className:`text-fg`,children:C.new}),` new`,me>0?` · ${me} already imported`:``,C.behind>0?` (${C.behind} behind their original)`:``,C.deleted>0?` · ${C.deleted} you deleted in OonaCode`:``]})]}):null,!o&&!y&&!a&&f!==null&&C.new===0&&!j?(0,U.jsx)(`div`,{className:`text-sm text-fg-muted`,"data-testid":`import-claude-empty`,children:f.length===0?`No chats from a coding agent were found on this PC.`:`Nothing new to import. Every chat is listed below — tick one to import it again.`}):null,!y&&!a&&x.length>0?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Every chat the coding agents on this PC have, newest first. Importing copies them into OonaCode so you can read them here — and continue them, in the folder each one ran in.`,n&&C.new>0?` The new ones are ticked.`:` Tick the ones you want.`]}),(0,U.jsxs)(`div`,{className:`relative`,"data-testid":`import-search`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsxs)(`div`,{className:`relative flex-1`,children:[(0,U.jsx)(G.Search,{className:`pointer-events-none absolute left-2 top-2 w-3.5 h-3.5 text-fg-faint`}),(0,U.jsx)(`input`,{ref:A,"aria-label":`Search the chats to import`,className:H(q,`pl-7`),placeholder:M?`Search inside every conversation`:`Search by name, message or folder`,value:w,onChange:e=>T(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(w!==``||O)&&(e.preventDefault(),e.stopPropagation(),O?k(!1):T(``))},"data-testid":`import-search-input`})]}),(0,U.jsxs)(zS,{label:O?`Hide search options`:`Search options`,className:H(`relative`,O&&`text-accent`),"aria-pressed":O,onMouseDown:e=>e.preventDefault(),onClick:()=>k(e=>!e),"data-testid":`import-search-options-toggle`,children:[(0,U.jsx)(G.Sliders,{}),C7(E)?(0,U.jsx)(`span`,{className:`absolute right-0.5 top-0.5 h-1.5 w-1.5 rounded-full bg-accent`,"data-testid":`import-search-options-dot`}):null]}),j?(0,U.jsx)(zS,{label:`Clear search`,onMouseDown:e=>e.preventDefault(),onClick:()=>{T(``),A.current?.focus()},"data-testid":`import-search-clear`,children:(0,U.jsx)(G.X,{})}):null]}),O?(0,U.jsx)(D7,{options:E,onChange:D,words:Ybe,onClose:()=>{k(!1),A.current?.focus()}}):null]}),j?(0,U.jsx)(sxe,{query:w,conversations:M,request:te!==null,answer:I,matches:ie?.length??0,messages:[...re?.values()??[]].reduce((e,t)=>e+t.hits,0),capped:[...re?.values()??[]].some(e=>e.hitsCapped)}):null,(0,U.jsx)(`div`,{className:`max-h-96 space-y-3 overflow-y-auto`,"data-testid":`import-claude-list`,children:S.map(e=>{let t=ae?e.rows.filter(e=>ae.has(e)):e.rows;if(t.length===0)return null;let n=ae?!N.has(e.key):!g.has(e.key),r=ae?ee:_;return(0,U.jsxs)(`div`,{className:`rounded border border-border`,"data-testid":`import-group-${e.key}`,children:[(0,U.jsx)(nxe,{section:e,rows:t,searching:ae!==null,open:n,chosen:m,onFold:()=>r(t=>exe(t,e.key)),onTicks:h}),n?t.map(e=>(0,U.jsx)(ixe,{row:e,checked:m.has(e.id),onToggle:de,phrase:se,hit:re?.get(O7(e))},O7(e))):null]},e.key)})}),(0,U.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-fg-faint`,children:[(0,U.jsx)(`button`,{type:`button`,className:`underline`,title:P7,onClick:()=>h(e=>{let t=new Set(e);for(let e of oe)M7(e)&&t.add(e.id);return t}),"data-testid":`import-claude-select-all`,children:ie===null?`Select all`:`Select all matches`}),(0,U.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>h(e=>{if(ie===null)return new Set;let t=new Set(e);for(let e of oe)t.delete(e.id);return t}),"data-testid":`import-claude-select-none`,children:ie===null?`Select none`:`Unselect matches`})]})]}):null]})})}function exe(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function txe({state:e,disabled:t,onToggle:n,label:r,title:i,testId:a}){let o=(0,v.useRef)(null);return(0,v.useEffect)(()=>{o.current&&(o.current.indeterminate=e===`some`)}),(0,U.jsx)(`input`,{ref:o,type:`checkbox`,className:`shrink-0`,checked:e===`all`,disabled:t,onChange:n,"aria-label":r,title:i,"data-state":e,"data-testid":a})}function nxe({section:e,rows:t,searching:n,open:r,chosen:i,onFold:a,onTicks:o}){let s=N7(t,i),c=t.filter(M7).length,l=e.rows.filter(e=>i.has(e.id)).length,u=e.counts,d=u.imported+u.behind===e.rows.length,f=n?`the ${e.name} matches`:`${e.name}`,p=s===`all`?`Untick every chat in ${f}`:c===0&&s===`none`?`Nothing new here — tick a chat on its own row to import it again.`:c===0?`Untick every chat in ${f}`:P7;return(0,U.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-2 border-b border-border bg-surface-2 px-2 py-1.5`,children:[(0,U.jsx)(txe,{state:s,disabled:c===0&&s===`none`,onToggle:()=>o(e=>qbe(t,e)),label:s===`all`?`Untick every chat in ${f}`:`Tick the chats in ${f}`,title:p,testId:`import-group-check-${e.key}`}),(0,U.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left text-xs font-medium`,onClick:a,"aria-expanded":r,title:r?`Fold ${e.name}`:`Open ${e.name}`,"data-testid":`import-group-header-${e.key}`,children:[(0,U.jsx)(G.Chevron,{open:r,className:`w-3 h-3 shrink-0`}),e.name,(0,U.jsxs)(`span`,{className:`truncate font-normal text-fg-faint`,children:[I7(e.rows.length,`chat`,`chats`),n?` · ${I7(t.length,`match`,`matches`)}`:``,u.new>0?` · ${u.new} new`:d?` · all imported`:``,u.behind>0?` · ${u.behind} behind`:``,u.deleted>0?` · ${u.deleted} you deleted`:``,l>0?` · ${l} ticked`:``]})]})]})}function rxe({row:e,status:t}){let n=Vbe[t],r={"data-testid":`import-status-${e.id}`,"data-status":t};switch(t){case`new`:return(0,U.jsx)(`span`,{className:`font-medium text-accent`,...r,children:n});case`imported`:case`behind`:return(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-fg-muted`,title:t===`behind`?`The original has newer messages than the OonaCode copy — importing again brings them in (and replaces the copy).`:`Already in OonaCode. Ticking it rebuilds the OonaCode copy from the original, which replaces it.`,...r,children:[(0,U.jsx)(G.Check,{className:`w-3 h-3 text-ok`}),n,t===`behind`?(0,U.jsxs)(`span`,{className:`ml-0.5 inline-flex shrink-0 items-center gap-0.5 rounded bg-warn-soft px-1 text-[10px] font-medium leading-4 text-warn`,"data-testid":`import-behind-${e.id}`,"aria-label":`behind its original`,children:[(0,U.jsx)(G.ArrowDown,{className:`w-2.5 h-2.5`}),`behind`]}):null]});case`deleted`:return(0,U.jsx)(`span`,{className:`text-fg-faint`,title:`You imported this chat and deleted it in OonaCode; its original is still on this PC. Tick it to bring it back.`,...r,children:n});case`unavailable`:return(0,U.jsx)(`span`,{className:`text-warn`,...r,children:n})}}var ixe=(0,v.memo)(function({row:e,checked:t,onToggle:n,phrase:r,hit:i}){let a=j7(e),o=e=>r?.litNames?S7(e,r.query,r.options).map((e,t)=>e.hit?(0,U.jsx)(`mark`,{className:`rounded bg-warn-soft px-0.5 text-fg`,children:e.text},t):(0,U.jsx)(`span`,{children:e.text},t)):e;return(0,U.jsxs)(`label`,{className:`flex items-start gap-2 border-b border-border p-2 last:border-b-0 ${a?`cursor-default opacity-60`:`cursor-pointer hover:bg-surface-2`}`,"data-testid":`import-row-${e.id}`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:t,disabled:a,onChange:()=>n(e.id),"aria-label":e.title??e.firstPrompt??e.id}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-sm`,children:e.title||e.firstPrompt?o(e.title||e.firstPrompt||``):(0,U.jsx)(`span`,{className:`text-fg-faint`,children:`(no prompt)`})}),(0,U.jsxs)(`span`,{className:`mt-0.5 block truncate text-[11px] text-fg-faint`,children:[e.projectName?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,U.jsx)(G.Project,{className:`w-3 h-3`}),o(e.projectName)]}):(0,U.jsxs)(U.Fragment,{children:[e.cwd?(0,U.jsx)(`span`,{title:e.cwd,children:o(F7(e.cwd))}):F7(e.cwd),e.cwd&&!e.cwdExists?` · folder is gone`:``]}),` `,`· `,e.entryCount,` entries`,e.bytes>0?` · ${Zbe(e.bytes)}`:``,e.model?` · ${e.model}`:``]}),e.unavailable||e.note?(0,U.jsx)(`span`,{className:`mt-0.5 block text-[11px] ${e.unavailable?`text-warn`:`text-fg-faint`}`,"data-testid":`import-row-note-${e.id}`,children:e.unavailable??e.note}):null,i&&r?(0,U.jsx)(oxe,{hit:i,query:r.query,options:r.options,testId:`import-row-hits-${e.id}`}):null]}),e.supersedes&&e.supersedes.length>0?(0,U.jsx)(`span`,{className:`mt-0.5 shrink-0 rounded bg-surface-2 px-1 text-[11px] text-fg-faint`,title:`Rewound — replaces ${e.supersedes.length} earlier ${e.supersedes.length===1?`branch`:`branches`} of this chat`,children:`rewound`}):null,(0,U.jsxs)(`span`,{className:`mt-0.5 flex shrink-0 flex-col items-end gap-0.5 text-right text-[11px]`,children:[(0,U.jsx)(`span`,{className:`whitespace-nowrap text-fg-faint`,children:Qbe(e.lastEntryAt??e.updatedAt)}),(0,U.jsx)(`span`,{className:`whitespace-nowrap`,children:(0,U.jsx)(rxe,{row:e,status:A7(e)})})]})]})});function axe(e){let t=e.kind===`tool`?e.tool??`Tool`:e.role===`assistant`?`Model`:`You`;return e.subagent?`${t} (subagent)`:t}function oxe({hit:e,query:t,options:n,testId:r}){return(0,U.jsxs)(`span`,{className:`mt-1 block space-y-0.5`,"data-testid":r,children:[(0,U.jsxs)(`span`,{className:`block text-[11px] font-medium text-fg-muted`,children:[e.hits,e.hitsCapped?`+`:``,` `,e.hits===1&&!e.hitsCapped?`message says`:`messages say`,` it`]}),e.snippets.map((e,r)=>(0,U.jsxs)(`span`,{className:`block line-clamp-2 text-[11px] text-fg-muted`,"data-testid":`import-row-snippet`,children:[(0,U.jsxs)(`span`,{className:`font-medium text-fg-faint`,children:[axe(e),`:`]}),` `,S7(e.snippet,t,n).map((e,t)=>e.hit?(0,U.jsx)(`mark`,{className:`rounded bg-warn-soft px-0.5 text-fg`,children:e.text},t):(0,U.jsx)(`span`,{children:e.text},t))]},r))]})}function sxe({query:e,conversations:t,request:n,answer:r,matches:i,messages:a,capped:o}){let s=(e,t,n=`text-fg-muted`)=>(0,U.jsx)(`p`,{className:`text-[11px] ${n}`,"data-testid":t,children:e});if(!t)return i===0?s(`No chat’s name, message or folder says “${e.trim()}”. Whole conversations, in the search options, looks inside them.`,`import-search-none`):s(`${i} ${i===1?`chat matches`:`chats match`}`,`import-search-count`);if(!n)return s(e.trim().length<2?`Type at least two characters to search inside the conversations.`:`Tick what to look in — your messages, the model’s replies or the tools’ side.`,`import-search-idle`);if(!r)return s(`Searching every conversation on this PC…`,`import-search-busy`);if(r.res===null)return s(`This PC could not search its conversations. Try again, or update OonaCode.`,`import-search-failed`,`text-danger`);let c=r.res,l=Xbe(c),u=c.sources.filter(e=>e.note).map(e=>`${e.agentName}: ${e.note}`);return(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[i===0?s(c.partial===`aborted`?`The search was stopped.`:`No conversation on this PC says that.`,`import-search-none`):s(`${i} ${i===1?`chat says`:`chats say`} it · ${a}${o?`+`:``} ${a===1&&!o?`message`:`messages`}`,`import-search-count`),l?s(l,`import-search-partial`,`text-warn`):null,u.map(e=>(0,U.jsx)(`p`,{className:`text-[11px] text-fg-faint`,"data-testid":`import-search-source-note`,children:e},e))]})}function cxe({id:e,title:t,icon:n,count:r,collapsed:i,onToggle:a,onRemove:o,removeLabel:s,grow:c,drag:l,children:u}){return(0,U.jsxs)(`section`,{"aria-label":t,"data-testid":`section-${e}`,style:{flexGrow:c,flexShrink:1,flexBasis:i?`auto`:0},className:H(`relative flex min-h-0 flex-col border-b border-border last:border-b-0`,l?.hint===`before`&&`shadow-[inset_0_2px_0_0_var(--color-accent)]`,l?.hint===`after`&&`shadow-[inset_0_-2px_0_0_var(--color-accent)]`),onDragOver:l?.onDragOver,onDrop:l?.onDrop,children:[(0,U.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 px-3`,draggable:l?!0:void 0,onDragStart:l?.onDragStart,onDragEnd:l?.onDragEnd,children:[(0,U.jsxs)(`button`,{type:`button`,"aria-expanded":!i,"aria-controls":`section-body-${e}`,"data-testid":`section-header-${e}`,onClick:a,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,title:i?`Open ${t}`:`Fold ${t}`,children:[(0,U.jsx)(G.Chevron,{open:!i,className:`w-3 h-3 text-fg-faint`}),n?(0,U.jsx)(n,{className:`w-3.5 h-3.5 text-fg-faint`}):null,(0,U.jsxs)(`span`,{className:`truncate text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:[t,typeof r==`number`?` · ${r}`:``]})]}),o?(0,U.jsx)(zS,{label:s??`Hide ${t}`,className:`p-1`,onClick:o,children:(0,U.jsx)(G.X,{className:`w-3.5 h-3.5`})}):null]}),(0,U.jsx)(`div`,{id:`section-body-${e}`,"data-testid":`section-body-${e}`,hidden:i,className:H(`min-h-0 flex-1 flex-col`,i?`hidden`:`flex`),children:u})]})}function L7({items:e,onPick:t,testId:n,label:r,multi:i=!1,className:a,footer:o}){let s=(0,v.useRef)(null);return(0,U.jsxs)(`div`,{ref:s,role:`tablist`,"aria-orientation":`vertical`,"aria-label":r,"data-testid":n,onKeyDown:e=>{if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=Array.from(s.current?.querySelectorAll(`button[role="tab"]`)??[]);if(t.length===0)return;let n=t.indexOf(document.activeElement),r=e.key===`Home`?0:e.key===`End`?t.length-1:n<0?0:(n+(e.key===`ArrowDown`?1:-1)+t.length)%t.length;e.preventDefault(),t[r]?.focus()},className:H(`flex w-12 shrink-0 flex-col items-center gap-1 border-border bg-surface py-2`,a),children:[e.map(n=>(0,U.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n.active,"aria-label":n.label,title:n.label,"data-testid":`activity-${n.id}`,tabIndex:n.active||!i&&e.every(e=>!e.active)?0:-1,onClick:()=>t(n.id),className:H(`relative flex h-10 w-10 items-center justify-center rounded-md`,n.active?`bg-surface-2 text-fg shadow-[inset_2px_0_0_0_var(--color-accent)]`:`text-fg-muted hover:bg-surface-2 hover:text-fg`),children:[(0,U.jsx)(n.icon,{className:`w-5 h-5`}),typeof n.count==`number`&&n.count>0?(0,U.jsx)(`span`,{className:`absolute bottom-1 right-1 min-w-3.5 rounded-full bg-accent px-1 text-[9px] leading-[14px] text-white`,children:n.count>99?`99+`:n.count}):null]},n.id)),o?(0,U.jsx)(`div`,{className:`mt-auto flex flex-col items-center gap-1`,children:o}):null]})}var R7=[{kind:`photo`,label:`Photos`,empty:`No pictures in this chat yet.`},{kind:`video`,label:`Videos`,empty:`No videos in this chat yet.`},{kind:`audio`,label:`Audio`,empty:`No sound files in this chat yet.`},{kind:`file`,label:`Files`,empty:`No files in this chat yet.`},{kind:`link`,label:`Links`,empty:`No links in this chat yet.`}];function lxe(e){let t=[];for(let n of e){let e=n.at?new Date(n.at):null,r=e!==null&&!Number.isNaN(e.getTime()),i=r?`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}`:`unknown`,a=t[t.length-1];(!a||a.key!==i)&&(a={key:i,label:r?e.toLocaleDateString(void 0,{month:`long`,year:`numeric`}):`Undated`,items:[]},t.push(a)),a.items.push(n)}return t}function z7(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleString(void 0,{day:`numeric`,month:`short`,year:`numeric`,hour:`2-digit`,minute:`2-digit`})}function uxe(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleDateString(void 0,{day:`numeric`,month:`short`,year:`numeric`})}function B7(e){let t=[];e.size!==null&&e.size>=0&&t.push(Ej(e.size));let n=z7(e.at);return n&&t.push(n),t.join(` · `)}function V7(e){return e.source===`removed`?!1:e.source!==`path`||e.exists!==!1}function H7(e){return e.source===`removed`?e.removedAfterDays?`Removed after ${e.removedAfterDays} day${e.removedAfterDays===1?``:`s`}`:`Removed to save space`:e.source===`path`&&e.exists===!1?`Moved or deleted`:null}function dxe(e,t){let n=new Set(e.map(e=>e.id));return[...e,...t.filter(e=>!n.has(e.id))]}function fxe(e){try{let t=new URL(e),n=`${t.pathname===`/`?``:t.pathname}${t.search}${t.hash}`;return{host:t.host,rest:n}}catch{return{host:e,rest:``}}}function pxe(e,t){if(!t||!e)return null;let n=`u:${t}`;for(let r of e)if(r.id===n||r.uuid===t)return r.id;return null}function mxe(e){let t=new Uint8Array(e),n=``,r=32768;for(let e=0;e<t.length;e+=r)n+=String.fromCharCode(...t.subarray(e,e+r));return btoa(n)}var hxe=[{value:`all`,label:`All`,title:`Everything in this chat`},{value:`user`,label:`Mine`,title:`What you sent`},{value:`assistant`,label:`Replies`,title:`What the model’s replies contain`}];function U7(e){let t=e.getBoundingClientRect();return{x:t.left+24,y:t.bottom}}function W7(e,t){return{onContextMenu:n=>{n.preventDefault();let r=n.currentTarget;t(e,n.clientX===0&&n.clientY===0?U7(r):{x:n.clientX,y:n.clientY},r)},onKeyDown:n=>{(n.key===`ContextMenu`||n.shiftKey&&n.key===`F10`)&&(n.preventDefault(),t(e,U7(n.currentTarget),n.currentTarget))}}}var gxe=60,_xe=800,G7={items:[],nextBefore:null,missingHidden:0,loaded:!1,loading:!1,error:null};function K7(){return{photo:G7,video:G7,audio:G7,file:G7,link:G7}}function vxe({sessionId:e,onTotal:t}){let{state:n,actions:r,api:i}=W(),a=n.remote.tabs[e]!==void 0,o=n.drafts[e]!==void 0,s=n.transcripts[e]??null,c=(0,v.useCallback)(()=>r.setMediaPanel(!1),[r]),[l,u]=(0,v.useState)(`photo`),[d,f]=(0,v.useState)(`all`),p=(0,v.useRef)(d);p.current=d;let[m,h]=(0,v.useState)(!1),g=(0,v.useRef)(m);g.current=m;let[_,y]=(0,v.useState)(K7),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(!1),[w,T]=(0,v.useState)(null),E=(0,v.useRef)(_);E.current=_;let D=(0,v.useRef)(!0);(0,v.useEffect)(()=>(D.current=!0,()=>{D.current=!1}),[]);let O=!a&&!o&&typeof i.listChatMedia==`function`,k=(0,v.useCallback)(async()=>{if(i.grantChatMedia)try{let t=await i.grantChatMedia(e);D.current&&T(()=>t.urlOf)}catch{}},[i,e]);(0,v.useEffect)(()=>{O&&k()},[O,k]);let A=(0,v.useCallback)(async(t,n)=>{if(!i.listChatMedia)return;let r=E.current[t];if(r.loading||n===`more`&&!r.nextBefore)return;y(e=>({...e,[t]:{...e[t],loading:!0,error:null}}));let a=p.current,o=g.current,s;try{s=await i.listChatMedia(e,{kind:t,...a===`all`?{}:{from:a},missing:o?`show`:`hide`,limit:gxe,...n===`more`&&r.nextBefore?{before:r.nextBefore}:{}})}catch(e){if(!D.current||p.current!==a||g.current!==o)return;ng(e)&&e.code!==`session_not_found`&&C(!0),y(n=>({...n,[t]:{...n[t],loading:!1,loaded:!0,error:e instanceof Error?e.message:`The media list could not be read.`}}));return}!D.current||p.current!==a||g.current!==o||(x(s.counts),y(e=>({...e,[t]:{items:n===`more`?dxe(e[t].items,s.items):s.items,nextBefore:s.nextBefore,missingHidden:s.missingHidden??0,loaded:!0,loading:!1,error:null}})))},[i,e]);(0,v.useEffect)(()=>{O&&(E.current[l].loaded||A(l,`first`))},[O,l,A,d,m]);let j=(0,v.useMemo)(()=>s?s.items.filter(e=>e.kind===`user`||d!==`user`&&e.kind===`assistant`&&!e.streaming).length:0,[s,d]),M=(0,v.useRef)(j);(0,v.useEffect)(()=>{if(!O||j===M.current)return;let e=setTimeout(()=>{M.current=j,y(e=>{let t=K7();return t[l]={...e[l],loaded:!0},t}),A(l,`first`)},_xe);return()=>clearTimeout(e)},[O,j,l,A]);let N=n.connection.status===`open`,ee=(0,v.useRef)(!1),te=(0,v.useRef)(!1);(0,v.useEffect)(()=>{if(!N){ee.current&&(te.current=!0);return}ee.current=!0,te.current&&(te.current=!1,O&&(C(!1),x(null),E.current=K7(),y(K7()),k(),A(l,`first`)))},[N,O,k,A,l]);let P=(0,v.useCallback)(()=>{C(!1),x(null),E.current=K7(),y(K7()),k(),A(l,`first`)},[k,A,l]),F=r.toast,ne=(0,v.useCallback)(e=>{p.current!==e&&(p.current=e,E.current=K7(),y(K7()),x(null),f(e))},[]),I=(0,v.useCallback)(e=>{g.current!==e&&(g.current=e,E.current=K7(),y(K7()),x(null),h(e))},[]),[re,ie]=(0,v.useState)(null),ae=(0,v.useCallback)((e,t,n)=>ie({item:e,at:t,el:n}),[]),L=(0,v.useCallback)(()=>ie(null),[]),oe=(0,v.useCallback)(t=>{let n=pxe(s?.items,t.entryUuid);if(!n){F(`info`,`That message is not loaded in this window yet — scroll up in the chat.`);return}r.jumpToItem(e,n),typeof window<`u`&&typeof window.matchMedia==`function`&&!window.matchMedia(`(min-width: 1024px)`).matches&&c()},[r,c,F,e,s?.items]),se=(0,v.useCallback)(async t=>{if(!i.readChatMedia)return null;try{return mxe(await i.readChatMedia(e,t.id))}catch(e){return F(`error`,`${t.name} could not be read: ${e instanceof Error?e.message:`unknown error`}`),null}},[i,F,e]),ce=(0,v.useCallback)(async e=>{if(e.source===`path`&&e.path){await DF(e.path,F);return}let t=await se(e);t!==null&&await kF({name:e.name,mediaType:e.mediaType.split(`;`)[0]??e.mediaType,base64:t},F)},[F,se]),le=typeof window<`u`?window.oonacode:void 0,ue=le?.showItemInFolder?e=>{e.path&&le.showItemInFolder?.(e.path).then(e=>{!e.ok&&e.message&&F(`error`,e.message)},()=>F(`error`,`The folder could not be opened.`))}:null,[de,fe]=(0,v.useState)(null),R=(0,v.useMemo)(()=>_.photo.items.filter(V7),[_.photo.items]),pe=(0,v.useCallback)(async(e,t=R)=>{let n=t[e];if(!n)return;let r=await se(n);r===null||!D.current||fe({index:e,picture:{id:n.id,name:n.name,mediaType:n.mediaType,base64:r}})},[se,R]),me=(0,v.useCallback)(()=>fe(null),[]),he=de?{index:de.index,total:R.length,onPrev:de.index>0?()=>void pe(de.index-1):null,onNext:de.index<R.length-1?()=>void pe(de.index+1):null}:void 0,[ge,_e]=(0,v.useState)(null),ve=(0,v.useCallback)((e,t)=>{navigator.clipboard.writeText(e).then(()=>F(`success`,`${t} copied.`),()=>F(`error`,`${t} could not be copied.`))},[F]),ye=(0,v.useMemo)(()=>{let e=re?.item;if(!e)return[];let t=[],n=H7(e)!==null;if(e.kind===`link`&&e.url){let n=e.url;t.push({key:`open`,label:`Open in browser`,icon:(0,U.jsx)(G.ExternalLink,{className:`w-3.5 h-3.5`}),onSelect:()=>H5(n)})}else if(e.kind===`photo`){let r=R.findIndex(t=>t.id===e.id);t.push({key:`open`,label:`View`,icon:(0,U.jsx)(G.Image,{className:`w-3.5 h-3.5`}),disabled:n||r<0,onSelect:()=>void pe(r)})}else e.kind===`video`?t.push({key:`open`,label:`Play`,icon:(0,U.jsx)(G.Play,{className:`w-3.5 h-3.5`}),disabled:n,onSelect:()=>_e(e)}):t.push({key:`open`,label:e.kind===`audio`?`Open externally`:`Open`,icon:(0,U.jsx)(G.ExternalLink,{className:`w-3.5 h-3.5`}),disabled:n,onSelect:()=>void ce(e)});if(t.push({key:`show-in-chat`,label:`Show in chat`,icon:(0,U.jsx)(G.Chats,{className:`w-3.5 h-3.5`}),hint:e.from===`assistant`?`reply`:`your message`,onSelect:()=>oe(e),testId:`media-menu-show-in-chat`}),ue&&e.source===`path`&&e.exists!==!1&&t.push({key:`folder`,label:`Show in folder`,icon:(0,U.jsx)(G.Folder,{className:`w-3.5 h-3.5`}),onSelect:()=>ue(e)}),e.kind===`link`&&e.url){let n=e.url;t.push({key:`copy`,label:`Copy link`,icon:(0,U.jsx)(G.Copy,{className:`w-3.5 h-3.5`}),separated:!0,onSelect:()=>ve(n,`The link`)})}else if(e.path){let n=e.path;t.push({key:`copy`,label:`Copy path`,icon:(0,U.jsx)(G.Copy,{className:`w-3.5 h-3.5`}),separated:!0,onSelect:()=>ve(n,`The path`)})}return t},[re,R,pe,ce,oe,ue,ve]),be=b?Object.values(b).reduce((e,t)=>e+t,0):null;(0,v.useEffect)(()=>{t?.(be)},[t,be]);let xe=_[l],Se=b??mh();return(0,U.jsxs)(U.Fragment,{children:[a?(0,U.jsx)(q7,{children:`This chat runs on another PC. Its pictures and files are on that PC — open the media explorer there.`}):o?(0,U.jsx)(q7,{children:`Nothing has been sent in this chat yet.`}):!O||S?(0,U.jsxs)(q7,{children:[`This PC's OonaCode does not list a chat's media yet — update it.`,` `,O?(0,U.jsx)(`button`,{type:`button`,className:`underline`,onClick:P,"data-testid":`media-retry-unsupported`,children:`Try again`}):null]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{role:`group`,"aria-label":`Whose media`,className:`flex shrink-0 gap-0.5 border-b border-border px-1.5 py-1`,"data-testid":`media-from`,children:hxe.map(e=>(0,U.jsx)(`button`,{type:`button`,"aria-pressed":d===e.value,title:e.title,onClick:()=>ne(e.value),"data-testid":`media-from-${e.value}`,className:H(`flex-1 rounded-md px-2 py-1 text-xs`,d===e.value?`bg-accent-soft font-semibold text-accent`:`text-fg-muted hover:bg-surface-2 hover:text-fg`),children:e.label},e.value))}),(0,U.jsx)(`div`,{role:`tablist`,"aria-label":`Kinds of media`,className:`flex shrink-0 gap-0.5 overflow-x-auto border-b border-border px-1.5 py-1`,onKeyDown:e=>{if(e.key!==`ArrowRight`&&e.key!==`ArrowLeft`)return;let t=R7[(R7.findIndex(e=>e.kind===l)+(e.key===`ArrowRight`?1:-1)+R7.length)%R7.length];u(t.kind),e.preventDefault(),requestAnimationFrame(()=>document.getElementById(`media-tab-${t.kind}`)?.focus())},children:R7.map(e=>(0,U.jsxs)(`button`,{id:`media-tab-${e.kind}`,type:`button`,role:`tab`,"aria-selected":l===e.kind,"aria-controls":`media-tabpanel`,tabIndex:l===e.kind?0:-1,onClick:()=>u(e.kind),"data-testid":`media-tab-${e.kind}`,className:H(`flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-xs`,l===e.kind?`bg-surface-2 font-semibold text-fg`:`text-fg-muted hover:bg-surface-2 hover:text-fg`),children:[e.label,(0,U.jsx)(`span`,{className:`rounded-full bg-surface-3 px-1.5 text-[10px] tabular-nums text-fg-muted`,"data-testid":`media-count-${e.kind}`,children:Se[e.kind]})]},e.kind))}),(0,U.jsxs)(`div`,{id:`media-tabpanel`,role:`tabpanel`,"aria-labelledby":`media-tab-${l}`,className:`min-h-0 flex-1 overflow-y-auto px-2 py-2`,"data-testid":`media-tabpanel`,children:[xe.error&&xe.items.length===0?(0,U.jsxs)(`div`,{className:`p-2 text-xs text-danger`,role:`alert`,children:[xe.error,` `,(0,U.jsx)(`button`,{type:`button`,className:`underline`,onClick:P,"data-testid":`media-retry`,children:`Try again`})]}):xe.loaded&&xe.items.length===0?(0,U.jsx)(`div`,{className:`p-4 text-center text-xs text-fg-faint`,"data-testid":`media-empty`,children:R7.find(e=>e.kind===l)?.empty}):l===`photo`||l===`video`?(0,U.jsx)(bxe,{items:xe.items,urlOf:w,onOpen:e=>{if(e.kind===`photo`){let t=R.findIndex(t=>t.id===e.id);t>=0&&pe(t)}else _e(e)},onShowInChat:oe,onBroken:k,onMenu:ae}):(0,U.jsx)(`ul`,{className:`flex flex-col gap-1`,"data-testid":`media-list`,children:xe.items.map(e=>(0,U.jsx)(Cxe,{item:e,urlOf:w,onOpen:()=>e.kind===`link`&&e.url?H5(e.url):void ce(e),onShowInFolder:ue&&e.source===`path`&&e.exists!==!1?()=>ue(e):null,onShowInChat:()=>oe(e),onMenu:ae,onBroken:k,showOwner:d===`all`},e.id))}),!m&&xe.loaded&&xe.missingHidden>0?(0,U.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-fg-muted`,"data-testid":`media-missing-hidden`,children:[(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[xe.missingHidden,` file`,xe.missingHidden===1?``:`s`,` the replies named `,xe.missingHidden===1?`is`:`are`,` not on this PC any more — left out.`]}),(0,U.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>I(!0),"data-testid":`media-show-missing`,children:`Show`})]}):null,m&&xe.items.some(e=>e.exists===!1)?(0,U.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-fg-muted`,"data-testid":`media-missing-shown`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Showing files that are not on this PC any more.`}),(0,U.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>I(!1),"data-testid":`media-hide-missing`,children:`Hide them`})]}):null,xe.loading?(0,U.jsxs)(`div`,{className:`flex justify-center p-3 text-fg-faint`,"aria-live":`polite`,children:[(0,U.jsx)(G.Spinner,{className:`w-4 h-4 animate-spin`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Loading…`})]}):xe.nextBefore?(0,U.jsx)(yxe,{onLoad:()=>void A(l,`more`)}):null]})]}),(0,U.jsx)(HC,{open:re!==null,at:re?.at??{x:0,y:0},anchorEl:re?.el??null,label:`Media actions`,testId:`media-context-menu`,onClose:L,items:ye}),(0,U.jsx)(IF,{picture:de?.picture??null,onClose:me,notify:F,...he?{nav:he}:{}}),(0,U.jsx)(wxe,{item:ge,src:ge&&w?w(ge.id):null,onClose:()=>_e(null),onOpen:ge?()=>void ce(ge):null})]})}function q7({children:e}){return(0,U.jsx)(`div`,{className:`p-4 text-xs text-fg-faint`,"data-testid":`media-note`,children:e})}function yxe({onLoad:e}){let t=(0,v.useRef)(null),n=(0,v.useRef)(e);return n.current=e,(0,v.useEffect)(()=>{let e=t.current;if(!e||typeof IntersectionObserver>`u`)return;let r=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&n.current()});return r.observe(e),()=>r.disconnect()},[]),(0,U.jsx)(`div`,{ref:t,className:`flex justify-center p-2`,children:(0,U.jsx)(K,{size:`sm`,variant:`ghost`,onClick:e,"data-testid":`media-load-more`,children:`Load more`})})}function bxe({items:e,urlOf:t,onOpen:n,onShowInChat:r,onBroken:i,onMenu:a}){let o=(0,v.useMemo)(()=>lxe(e),[e]);return(0,U.jsx)(`div`,{className:`flex flex-col gap-3`,"data-testid":`media-grid`,children:o.map(e=>(0,U.jsxs)(`section`,{"aria-label":e.label,children:[(0,U.jsx)(`h3`,{className:`mb-1 px-0.5 text-[11px] font-semibold text-fg-faint`,children:e.label}),(0,U.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:e.items.map(e=>(0,U.jsx)(xxe,{item:e,src:t&&V7(e)?t(e.id):null,onOpen:()=>n(e),onShowInChat:()=>r(e),onBroken:i,onMenu:a},e.id))})]},e.key))})}function xxe({item:e,src:t,onOpen:n,onShowInChat:r,onBroken:i,onMenu:a}){let o=H7(e),[s,c]=(0,v.useState)(!1),l=(0,v.useRef)(!1),u=`${e.name}${e.at?` — ${z7(e.at)}`:``}`,d=uxe(e.at);return(0,U.jsxs)(`div`,{className:`group relative aspect-square overflow-hidden rounded-md border border-border bg-surface-2`,"data-testid":`media-tile`,"data-media-id":e.id,"data-from":e.from,...W7(e,a),children:[o?(0,U.jsxs)(`div`,{className:`flex h-full w-full flex-col items-center justify-center gap-0.5 overflow-hidden p-1 text-center text-[10px] leading-tight text-fg-faint`,title:`${u} — ${o.toLowerCase()}${e.path?` (${e.path})`:``}`,"data-testid":`media-tile-unavailable`,children:[e.kind===`video`?(0,U.jsx)(G.Film,{className:`w-4 h-4 shrink-0`}):(0,U.jsx)(G.Image,{className:`w-4 h-4 shrink-0`}),(0,U.jsx)(`span`,{className:`text-warn`,"data-testid":`media-tile-reason`,children:o}),(0,U.jsx)(`span`,{className:`line-clamp-2 break-all font-medium text-fg-muted`,"data-testid":`media-tile-name`,children:e.name}),d?(0,U.jsx)(`span`,{"data-testid":`media-tile-date`,children:d}):null]}):(0,U.jsxs)(`button`,{type:`button`,onClick:n,title:u,"aria-label":`${e.kind===`video`?`Play`:`View`} ${u}`,className:`block h-full w-full focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"data-testid":`media-tile-open`,children:[t&&!s?e.kind===`video`?(0,U.jsx)(`video`,{src:`${t}#t=0.1`,preload:`metadata`,muted:!0,className:`pointer-events-none h-full w-full object-cover`,onError:()=>c(!0)}):(0,U.jsx)(`img`,{src:t,alt:e.name,loading:`lazy`,draggable:!1,className:`h-full w-full object-cover`,onError:()=>{if(!l.current){l.current=!0,i();return}c(!0)}}):(0,U.jsx)(`span`,{className:`flex h-full w-full items-center justify-center text-fg-faint`,children:e.kind===`video`?(0,U.jsx)(G.Film,{className:`w-5 h-5`}):(0,U.jsx)(G.Image,{className:`w-5 h-5`})}),e.kind===`video`?(0,U.jsx)(`span`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:(0,U.jsx)(`span`,{className:`rounded-full bg-black/55 p-2 text-white`,children:(0,U.jsx)(G.Play,{className:`w-4 h-4`})})}):null]}),(0,U.jsx)(`button`,{type:`button`,onClick:r,title:`Show in chat`,"aria-label":`Show ${e.name} in chat`,className:`absolute bottom-1 right-1 rounded bg-black/55 p-1 text-white opacity-0 transition-opacity focus:opacity-100 group-hover:opacity-100`,"data-testid":`media-show-in-chat`,children:(0,U.jsx)(G.Chats,{className:`w-3 h-3`})})]})}function Sxe(e){return e.kind===`link`?(0,U.jsx)(G.Link,{className:`w-4 h-4`}):e.kind===`audio`?(0,U.jsx)(G.Music,{className:`w-4 h-4`}):e.kind===`video`?(0,U.jsx)(G.Film,{className:`w-4 h-4`}):e.kind===`photo`?(0,U.jsx)(G.Image,{className:`w-4 h-4`}):(0,U.jsx)(G.File,{className:`w-4 h-4`})}function Cxe({item:e,urlOf:t,onOpen:n,onShowInFolder:r,onShowInChat:i,onMenu:a,onBroken:o,showOwner:s}){let[c,l]=(0,v.useState)(!1),u=H7(e),d=e.kind===`link`,f=d&&e.url?fxe(e.url):null,p=d?z7(e.at):B7(e),m=e.kind===`audio`&&!u&&t!==null;return(0,U.jsxs)(`li`,{className:`rounded-md border border-transparent px-1.5 py-1.5 hover:border-border hover:bg-surface-2`,"data-testid":`media-row`,"data-media-id":e.id,"data-from":e.from,...W7(e,a),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m?(0,U.jsx)(zS,{label:c?`Hide the player for ${e.name}`:`Play ${e.name}`,className:`shrink-0 rounded-full bg-accent-soft p-1.5 text-accent`,onClick:()=>l(e=>!e),"aria-pressed":c,"data-testid":`media-play`,children:c?(0,U.jsx)(G.Pause,{className:`w-3.5 h-3.5`}):(0,U.jsx)(G.Play,{className:`w-3.5 h-3.5`})}):e.kind===`file`?(0,U.jsx)(XM,{name:e.name,className:`shrink-0`}):(0,U.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-3 p-1.5 text-fg-muted`,"aria-hidden":!0,children:Sxe(e)}),(0,U.jsxs)(`button`,{type:`button`,onClick:u?void 0:n,disabled:u!==null,title:u?`${e.name} — ${u.toLowerCase()}${e.path?` (${e.path})`:``}`:d?`Open ${e.url??``} in the browser`:e.path?`Open ${e.path}`:`Open ${e.name}`,className:`min-w-0 flex-1 text-left disabled:cursor-default`,"data-testid":`media-row-open`,children:[f?(0,U.jsxs)(`span`,{className:`block truncate text-xs`,children:[(0,U.jsx)(`span`,{className:`font-medium text-accent`,children:f.host}),(0,U.jsx)(`span`,{className:`text-fg-muted`,children:f.rest})]}):(0,U.jsx)(`span`,{className:`block truncate text-xs font-medium text-fg`,children:e.name}),(0,U.jsxs)(`span`,{className:`block truncate text-[11px] text-fg-faint`,children:[u?(0,U.jsx)(`span`,{className:`text-warn`,"data-testid":`media-unavailable`,children:u}):null,u&&p?` · `:``,s?(0,U.jsx)(`span`,{"data-testid":`media-owner`,children:e.from===`assistant`?`Reply`:`You`}):null,s&&p?` · `:``,p]})]}),r?(0,U.jsx)(zS,{label:`Show in folder`,className:`shrink-0 p-1`,onClick:r,children:(0,U.jsx)(G.Folder,{className:`w-3.5 h-3.5`})}):null,(0,U.jsx)(zS,{label:`Show in chat`,className:`shrink-0 p-1`,onClick:i,"data-testid":`media-show-in-chat`,children:(0,U.jsx)(G.Chats,{className:`w-3.5 h-3.5`})})]}),c&&m&&t?(0,U.jsx)(`audio`,{controls:!0,autoPlay:!0,preload:`none`,src:t(e.id),onError:o,className:`mt-1.5 h-8 w-full`,"data-testid":`media-audio`}):null]})}function wxe({item:e,src:t,onClose:n,onOpen:r}){return(0,U.jsx)(GS,{open:e!==null,title:e?.name||`Video`,onClose:n,full:!0,children:e?(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2`,"data-testid":`video-viewer`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-fg-faint`,children:B7(e)}),r?(0,U.jsx)(K,{size:`sm`,onClick:r,children:`Open externally`}):null]}),t?(0,U.jsx)(`video`,{src:t,controls:!0,autoPlay:!0,className:`min-h-0 w-full flex-1 rounded-md bg-black`,"data-testid":`video-viewer-player`}):(0,U.jsx)(`p`,{className:`text-xs text-fg-faint`,children:`This video cannot be played here.`})]}):null})}var Txe={model:null,previousModel:null,costUsd:0,inputTokens:0,outputTokens:0,turns:0,durationMs:0,contextTokens:null,contextWindow:null,contextUsed:null,costSource:`engine`,credits:null,resetAtIndex:null,didReset:!1,countedResults:0};function Exe(e,t){let n=t?Ys(t):null,r=null,i=null;for(let t=0;t<e.length;t++){let a=e[t];if(!a||a.kind!==`assistant`||!ae(a.model))continue;let o=Ys(a.model);n!==null&&o!==n&&(r=t,i=n),n=o}return{index:r,from:i,to:n}}function Dxe(e){let{items:t,session:n=null,initModel:r=null,boundary:i=null,models:a}=e,o=e.contextTokens!=null&&e.contextTokens>0?e.contextTokens:null;if(t.length===0&&!n)return Txe;let s=Exe(t,r),c=i&&i.index>=0?Math.min(i.index,t.length):null,l=null,u=null;s.index!==null&&(c===null||s.index>=c)?(l=s.index,u=s.from):c!==null&&(l=c,u=i?.from??s.from);let d=l??0,f=0,p=0,m=0,h=0,g=0,_=0;for(let e=d;e<t.length;e++){let n=t[e];!n||n.kind!==`result`||(_+=1,f+=n.costUsd,p+=n.inputTokens,m+=n.outputTokens,h+=n.numTurns,g+=n.durationMs)}_===0&&l===null&&n&&(f=n.totalCostUsd,p=n.inputTokens,m=n.outputTokens);let v=`engine`,y=null;n&&n.providerId===`oonacode`&&(f=n.totalCostUsd,y=n.poolCredits??null,v=`gateway`);let b=r?Ys(r):null,x=i&&c!==null&&l===c?i.to:s.to??n?.model??b??null,S=[x,n?.model??null,b].filter(e=>typeof e==`string`&&e.length>0),C=(a?S.map(e=>a.find(t=>t.id===e)).find(e=>e?.contextWindow!=null):void 0)?.contextWindow??S.map(e=>Kee(e)).find(e=>e!==null)??null;return{model:x,previousModel:u,costUsd:f,inputTokens:p,outputTokens:m,turns:h,durationMs:g,contextTokens:o,contextWindow:C,contextUsed:C&&C>0&&o!==null?Math.min(1,o/C):null,resetAtIndex:l,didReset:l!==null,countedResults:_,costSource:v,credits:y}}var Oxe=[...cf.what,...cf.when,...cf.who,...cf.yours,...cf.where];function kxe({sessionId:e,entryCount:t}){let{state:n,actions:r}=W(),i=n.chatAboutsChange,a=Rd(n.settings??{}),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(!1),[y,b]=(0,v.useState)(null),[x,S]=(0,v.useState)(null),C=(0,v.useRef)(i.seq),w=(0,v.useRef)(!0);(0,v.useEffect)(()=>(w.current=!0,()=>{w.current=!1}),[]);let T=(0,v.useCallback)(async()=>{let t=await r.getChatAbout(e);if(w.current){if(t===`unsupported`){l(!0);return}t!==null&&(l(!1),s(t))}},[r,e]);if((0,v.useEffect)(()=>{T()},[T]),(0,v.useEffect)(()=>{i.seq!==C.current&&(C.current=i.seq,Xd(i,e)&&T())},[i,e,T]),c||o===null)return null;let E=()=>{p(o.about??``),d(!0),S(null),b(null)},D=async()=>{if(of(f))return;let t=f.trim()===``;h(!0);try{let n=await r.updateChatAbout(e,t?null:f);if(!w.current||!n)return;s(n),d(!1),S(t?a.enabled?`Cleared. The housekeeper writes a new about at the chat’s next change.`:`Cleared. None is written while chat abouts are off.`:null)}finally{w.current&&h(!1)}},O=async()=>{_(!0),b(null),S(null);try{let t=await r.regenerateChatAbout(e);if(!w.current)return;t.about&&s(t.about),t.ok||b(t.error??`The about could not be written.`)}finally{w.current&&_(!1)}},k=sf(f,a.maxWords),A=of(f),j=Zd(o);return(0,U.jsxs)(`div`,{className:`mb-2`,"data-testid":`session-about`,children:[(0,U.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wide text-fg-faint`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:(0,U.jsx)(G.Skill,{className:`w-3.5 h-3.5`})}),`About`,(0,U.jsx)(BS,{label:`About`,details:(0,U.jsx)(VS,{items:Oxe})}),o.stale&&o.about?(0,U.jsx)(`span`,{title:cf.stale,"data-testid":`session-about-stale`,children:(0,U.jsx)(WS,{tone:`warn`,children:`stale`})}):null]}),u?(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(`textarea`,{className:H(q,`min-h-[7rem] resize-y text-xs`),value:f,onChange:e=>p(e.target.value),"aria-label":`This chat’s about`,placeholder:`What this chat works on, for your other chats to read`,autoFocus:!0,"data-testid":`session-about-input`}),(0,U.jsxs)(`div`,{className:H(`text-[11px]`,k.overChars?`text-danger`:k.overWords?`text-warn`:`text-fg-faint`),"data-testid":`session-about-count`,children:[k.words,` / `,a.maxWords,` words · `,k.chars.toLocaleString(`en-US`),` /`,` `,Id.userChars.toLocaleString(`en-US`),` characters`]}),A?(0,U.jsx)(`div`,{className:`text-[11px] text-danger`,"data-testid":`session-about-problem`,children:A}):k.overWords?(0,U.jsxs)(`div`,{className:`text-[11px] text-warn`,children:[`Longer than the `,a.maxWords,` words the housekeeper writes; your other chats read all of it.`]}):null,(0,U.jsx)(`div`,{className:`text-[11px] text-fg-faint`,children:`Saved empty, it is cleared, and the housekeeper writes one again at the chat’s next change.`}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(K,{size:`sm`,variant:`primary`,onClick:()=>void D(),busy:m,disabled:A!==null,"data-testid":`session-about-save`,children:`Save`}),(0,U.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>d(!1),disabled:m,"data-testid":`session-about-cancel`,children:`Cancel`})]})]}):(0,U.jsxs)(U.Fragment,{children:[o.about?(0,U.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-xs text-fg`,"data-testid":`session-about-text`,children:o.about}):(0,U.jsxs)(`p`,{className:`text-[11px] text-fg-muted`,"data-testid":`session-about-missing`,children:[`No about yet. `,rf(o,{enabled:a.enabled,entryCount:t})]}),o.about&&o.aboutAt?(0,U.jsxs)(`div`,{className:`mt-0.5 text-[11px] text-fg-faint`,title:W_(o.aboutAt),"data-testid":`session-about-written`,children:[`Written `,U_(o.aboutAt),j?` by ${j}`:``]}):null,o.about&&o.pending?(0,U.jsx)(`div`,{className:`text-[11px] text-accent`,children:`Being written again now…`}):null,o.about&&o.lastError?(0,U.jsxs)(`div`,{className:`text-[11px] text-danger`,"data-testid":`session-about-last-error`,children:[`The last attempt failed: `,o.lastError]}):null,(0,U.jsxs)(`div`,{className:`mt-0.5 text-[11px] text-fg-faint`,title:o.route?`Paid by ${Qd[o.route]}`:void 0,"data-testid":`session-about-spend`,children:[`Cost so far: `,tf(o.spend,o.route)]}),x?(0,U.jsx)(`div`,{className:`mt-0.5 text-[11px] text-fg-muted`,"data-testid":`session-about-note`,children:x}):null,y?(0,U.jsx)(`div`,{className:`mt-0.5 text-[11px] text-danger`,role:`alert`,"data-testid":`session-about-regen-error`,children:y}):null,(0,U.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1.5`,children:[(0,U.jsxs)(K,{size:`sm`,variant:`ghost`,onClick:E,disabled:g,title:cf.edit,"data-testid":`session-about-edit`,children:[(0,U.jsx)(G.Edit,{className:`h-3 w-3`}),` Edit`]}),(0,U.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>void O(),disabled:!a.enabled||g,title:a.enabled?cf.regenerate:cf.regenerateOff,"data-testid":`session-about-regenerate`,children:g?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(G.Spinner,{className:`h-3 w-3`}),` Writing…`]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(G.Refresh,{className:`h-3 w-3`}),` Regenerate`]})})]}),a.enabled?null:(0,U.jsx)(`div`,{className:`mt-0.5 text-[11px] text-fg-faint`,"data-testid":`session-about-off`,children:`Regenerate is unavailable: chat abouts are off.`})]})]})}function Axe({view:e}){let t=(0,v.useMemo)(()=>ibe(e.request??``),[e.request]);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:e.truncated?`Cut at the size the host keeps.`:`As agy sent it.`}),(0,U.jsx)(fN,{text:t})]}),(0,U.jsx)(`pre`,{className:`mt-0.5 max-h-64 overflow-auto whitespace-pre-wrap break-all rounded-md border border-border bg-code-bg p-2 font-mono text-[11px] leading-snug text-fg`,"data-testid":`agy-request-json`,children:t})]})}function jxe({sessionId:e,running:t}){let{api:n}=W(),[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(!0),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)({}),h=(0,v.useRef)(!0);(0,v.useEffect)(()=>(h.current=!0,()=>{h.current=!1}),[]);let g=(0,v.useCallback)(async()=>{if(!n.listAgyRequests){o(!0);return}c(!0);try{let t=await n.listAgyRequests(e);if(!h.current)return;o(!1),i(t.requests)}catch(e){if(!h.current)return;ng(e)&&o(!0)}finally{h.current&&c(!1)}},[n,e]);(0,v.useEffect)(()=>{g()},[g]);let _=(0,v.useRef)(t);(0,v.useEffect)(()=>{_.current&&!t&&g(),_.current=t},[t,g]);let{main:y,background:b}=(0,v.useMemo)(()=>ebe(r??[]),[r]),x=async t=>{if(p[t.id]){m(e=>{let{[t.id]:n,...r}=e;return r});return}m(e=>({...e,[t.id]:{phase:`loading`}}));let r=e=>{h.current&&m(n=>n[t.id]?{...n,[t.id]:e}:n)};if(!n.getAgyRequestBody)return r({phase:`gone`});try{let i=await n.getAgyRequestBody(e,t.id);r(i.request===null?{phase:`gone`}:{phase:`ready`,view:i})}catch(e){r(ng(e)?{phase:`gone`}:{phase:`failed`,message:Y_(e)})}};if(a||r===null)return null;let S=e=>{let{title:t,detail:n}=l7(e),r=tbe(e),i=nbe(e.usage),a=p[e.id],o=[n,e.ms===null?`running…`:V_(e.ms),i].filter(e=>!!e),s=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`flex items-baseline gap-1.5`,children:[(0,U.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-fg-faint`,title:W_(e.at),children:rbe(e.at)}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium text-fg`,children:t}),(0,U.jsx)(`span`,{className:H(`shrink-0 text-[11px] font-medium`,r.tone===`danger`?`text-danger`:`text-fg-muted`),"data-tone":r.tone,"data-testid":`agy-request-status-${e.id}`,children:r.text})]}),(0,U.jsx)(`span`,{className:`block break-words text-[11px] text-fg-faint`,children:o.join(` · `)}),e.error?(0,U.jsx)(`span`,{className:`block break-words text-[11px] text-danger`,children:e.error}):null]});return(0,U.jsxs)(`li`,{className:`rounded-md border border-border px-2 py-1`,"data-testid":`agy-request-${e.id}`,"data-kind":e.kind,children:[e.hasBody?(0,U.jsx)(`button`,{type:`button`,className:`block w-full text-left`,"aria-expanded":a!==void 0,title:`${u7(e)} — show the request`,onClick:()=>void x(e),"data-testid":`agy-request-open-${e.id}`,children:s}):(0,U.jsx)(`div`,{title:u7(e),children:s}),a?(0,U.jsx)(`div`,{className:`mt-1`,"data-testid":`agy-request-body-${e.id}`,children:a.phase===`loading`?(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-fg-muted`,children:[(0,U.jsx)(G.Spinner,{className:`h-3 w-3`}),` Loading the request…`]}):a.phase===`gone`?(0,U.jsx)(`div`,{className:`text-[11px] text-fg-muted`,"data-testid":`agy-request-body-gone`,children:`This request’s body is no longer kept on this PC.`}):a.phase===`failed`?(0,U.jsxs)(`div`,{className:`text-[11px] text-danger`,role:`alert`,children:[`Could not read it: `,a.message]}):(0,U.jsx)(Axe,{view:a.view})}):null]},e.id)};return(0,U.jsxs)(`div`,{className:`mb-2`,"data-testid":`agy-requests`,children:[(0,U.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left text-[11px] font-semibold uppercase tracking-wide text-fg-faint hover:text-fg-muted`,"aria-expanded":l,onClick:()=>u(e=>!e),"data-testid":`agy-requests-toggle`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:(0,U.jsx)(G.Chevron,{className:`h-3 w-3`,open:l})}),`Google agy requests`,(0,U.jsx)(`span`,{className:`font-mono normal-case tracking-normal`,"data-testid":`agy-requests-count`,children:r.length})]}),(0,U.jsx)(zS,{label:`Refresh agy requests`,className:`p-1`,disabled:s,onClick:()=>void g(),"data-testid":`agy-requests-refresh`,children:s?(0,U.jsx)(G.Spinner,{className:`h-3 w-3`}):(0,U.jsx)(G.Refresh,{className:`h-3 w-3`})})]}),(0,U.jsx)(`p`,{className:`mb-1 text-[11px] leading-snug text-fg-faint`,"data-testid":`agy-requests-privacy`,children:Zye}),l?(0,U.jsxs)(U.Fragment,{children:[y.length===0?(0,U.jsx)(`p`,{className:`text-[11px] text-fg-muted`,"data-testid":`agy-requests-empty`,children:`No model calls yet — they appear here as agy talks to Google.`}):(0,U.jsx)(`ul`,{className:`max-h-72 space-y-1 overflow-y-auto`,"data-testid":`agy-requests-main`,children:y.map(S)}),b.length>0?(0,U.jsxs)(`div`,{className:`mt-1.5`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 text-[11px] text-accent hover:underline`,"aria-expanded":d,onClick:()=>f(e=>!e),"data-testid":`agy-background-toggle`,children:[(0,U.jsx)(G.Chevron,{className:`h-3 w-3`,open:d}),`background calls (`,b.length,`)`]}),d?(0,U.jsx)(`ul`,{className:`mt-1 max-h-72 space-y-1 overflow-y-auto opacity-70`,"data-testid":`agy-requests-background`,children:b.map(S)}):null]}):null]}):null]})}function J7({label:e,icon:t,children:n}){return(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,U.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-faint`,children:[t?(0,U.jsx)(`span`,{className:`shrink-0 text-fg-faint`,"aria-hidden":`true`,children:t}):null,e]}),(0,U.jsx)(`span`,{className:`min-w-0 truncate text-right text-xs font-medium text-fg`,children:n})]})}function Y7({label:e,icon:t}){return(0,U.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wide text-fg-faint`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:t}),e]})}var X7={provider:(0,U.jsx)(G.Plug,{className:`w-3.5 h-3.5`}),route:(0,U.jsx)(G.Globe,{className:`w-3.5 h-3.5`}),model:(0,U.jsx)(G.Bot,{className:`w-3.5 h-3.5`}),permission:(0,U.jsx)(G.Shield,{className:`w-3.5 h-3.5`}),context:(0,U.jsx)(G.Brain,{className:`w-3.5 h-3.5`}),window:(0,U.jsx)(G.Panel,{className:`w-3.5 h-3.5`}),compactions:(0,U.jsx)(G.CollapseAll,{className:`w-3.5 h-3.5`}),usage:(0,U.jsx)(G.Coins,{className:`w-3.5 h-3.5`}),tokensIn:(0,U.jsx)(G.Download,{className:`w-3.5 h-3.5`}),tokensOut:(0,U.jsx)(G.Upload,{className:`w-3.5 h-3.5`}),duration:(0,U.jsx)(G.Clock,{className:`w-3.5 h-3.5`}),turns:(0,U.jsx)(G.Send,{className:`w-3.5 h-3.5`}),session:(0,U.jsx)(G.Info,{className:`w-3.5 h-3.5`}),tasks:(0,U.jsx)(G.Bell,{className:`w-3.5 h-3.5`}),status:(0,U.jsx)(G.Monitor,{className:`w-3.5 h-3.5`}),updated:(0,U.jsx)(G.Refresh,{className:`w-3.5 h-3.5`}),entries:(0,U.jsx)(G.Menu,{className:`w-3.5 h-3.5`}),project:(0,U.jsx)(G.Project,{className:`w-3.5 h-3.5`}),folder:(0,U.jsx)(G.Folder,{className:`w-3.5 h-3.5`})};function Mxe({used:e}){let t=Math.round(e*100);return(0,U.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-surface-3`,role:`progressbar`,"aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,"aria-label":`Context used`,children:(0,U.jsx)(`div`,{className:H(`h-full rounded-full`,t>=90?`bg-danger`:t>=70?`bg-warn`:`bg-accent`),style:{width:`${t}%`}})})}function Nxe(){let{state:e,actions:t}=W(),n=ES(),r=n?e.remote.tabs[n.id]!==void 0:!1,i=n?e.drafts[n.id]!==void 0:!1,a=TS(),o=e.currentSessionId,s=n?.projectId?e.vaultProjects.find(e=>e.id===n.projectId):void 0,c=s?.instructions.trim()??``,l=n?.providerId??e.activeProviderId,u=e.providers.find(e=>e.definition.id===l),d=u?.definition.models,f=(0,v.useMemo)(()=>{let e=u?.definition;return e?Bs(e,{credentialClass:(u.credentials.find(e=>e.variantId===n?.variantId)??u.credentials[0])?.class??null}):null},[u,n?.variantId]),p=(0,v.useMemo)(()=>Dxe({items:a?.items??[],session:n,initModel:a?.init?.model??null,boundary:o?e.modelBoundaries[o]??null:null,models:d,contextTokens:a?.contextTokens??null}),[a?.items,a?.init?.model,a?.contextTokens,n,o,e.modelBoundaries,d]),m=(0,v.useMemo)(()=>(a?.items??[]).filter(e=>e.kind===`user`&&e.compactSummary).length,[a?.items]),h=n?Fh(n.providerId)&&!r&&!i:!1,g=a?.status===`running`||a?.status===`waiting_permission`;return(0,U.jsx)(U.Fragment,{children:n?(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 py-2`,children:[p.didReset?(0,U.jsxs)(`div`,{className:`mb-2 rounded-md bg-accent-soft px-2 py-1.5 text-[11px] text-accent`,"data-testid":`stats-reset`,children:[`Statistics restarted at the model change`,p.previousModel?` (was ${p.previousModel})`:``,`.`]}):null,!r&&!i?(0,U.jsx)(kxe,{sessionId:n.id,entryCount:n.entryCount??null},n.id):null,(0,U.jsxs)(`div`,{className:`mb-2`,children:[(0,U.jsx)(Y7,{label:`Model`,icon:X7.model}),(0,U.jsx)(J7,{label:`Provider`,icon:X7.provider,children:u?.definition.displayName??l??`—`}),(0,U.jsx)(J7,{label:`Route`,icon:X7.route,children:f?(0,U.jsx)(WS,{tone:f.viaGateway?`accent`:`ok`,children:f.badge}):`—`}),f?(0,U.jsx)(`div`,{className:`pb-1 text-[11px] leading-snug text-fg-faint`,children:f.detail}):null,(0,U.jsx)(J7,{label:`Model`,icon:X7.model,children:p.model??n.model??`—`}),(0,U.jsxs)(J7,{label:`Permission mode`,icon:X7.permission,children:[(0,U.jsx)(WS,{children:te(ne(n))}),` `,(0,U.jsx)(WS,{children:n.permissionMode})]})]}),(0,U.jsxs)(`div`,{className:`mb-2`,children:[(0,U.jsx)(Y7,{label:`Context`,icon:X7.context}),p.contextUsed!==null&&p.contextTokens!==null?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Mxe,{used:p.contextUsed}),(0,U.jsxs)(`div`,{className:`mt-1 text-[11px] text-fg-muted`,"data-testid":`context-used`,children:[H_(p.contextTokens),` / `,H_(p.contextWindow??0),` `,`tokens (`,Math.round(p.contextUsed*100),`%)`]})]}):(0,U.jsx)(`div`,{className:`text-[11px] text-fg-muted`,"data-testid":`context-used`,children:p.contextTokens===null?`Measured at the next reply`:`${H_(p.contextTokens)} tokens (window unknown)`}),(0,U.jsx)(J7,{label:`Context window`,icon:X7.window,children:(0,U.jsx)(`span`,{"data-testid":`context-window`,children:p.contextWindow?`${H_(p.contextWindow)} tokens`:`unknown`})}),(0,U.jsx)(J7,{label:`Compactions`,icon:X7.compactions,children:(0,U.jsx)(`span`,{"data-testid":`compaction-count`,children:m})})]}),(0,U.jsxs)(`div`,{className:`mb-2`,children:[(0,U.jsx)(Y7,{label:`Usage`,icon:X7.usage}),(0,U.jsx)(J7,{label:`Tokens in`,icon:X7.tokensIn,children:H_(p.inputTokens)}),(0,U.jsx)(J7,{label:`Tokens out`,icon:X7.tokensOut,children:H_(p.outputTokens)}),p.credits===null?null:(0,U.jsx)(J7,{label:`Credits used`,icon:X7.usage,children:p.credits.toLocaleString(`en-US`,{maximumFractionDigits:2})}),(0,U.jsx)(J7,{label:`Duration`,icon:X7.duration,children:p.countedResults>0&&V_(p.durationMs)||`—`}),(0,U.jsx)(J7,{label:`Turns`,icon:X7.turns,children:p.countedResults>0?p.turns:`—`})]}),(0,U.jsxs)(`div`,{className:`mb-2`,children:[(0,U.jsx)(Y7,{label:`Session`,icon:X7.session}),(0,U.jsx)(J7,{label:`Status`,icon:X7.status,children:(0,U.jsx)(WS,{tone:a?.status===`error`?`danger`:a?.status===`running`?`accent`:a?.status===`waiting_permission`?`warn`:`neutral`,children:a?.status??n.status})}),(0,U.jsx)(J7,{label:`Updated`,icon:X7.updated,children:U_(n.updatedAt)}),(0,U.jsx)(J7,{label:`Entries`,icon:X7.entries,children:n.entryCount}),(0,U.jsx)(J7,{label:`Project`,icon:X7.project,children:(0,U.jsx)(`span`,{"data-testid":`session-project`,children:s?s.name:`—`})}),c?(0,U.jsx)(`div`,{className:`whitespace-pre-wrap break-words pb-1 text-[11px] leading-snug text-fg-faint`,"data-testid":`session-project-instructions`,children:c.length>300?`${c.slice(0,300)}\u2026`:c}):null,r?null:(0,U.jsx)(`button`,{type:`button`,className:`text-[11px] text-accent hover:underline`,onClick:()=>t.openAssignProject(n.id),"data-testid":`session-change-project`,children:s?`Move to another project…`:`Move to a project…`}),(0,U.jsx)(J7,{label:`Folder`,icon:X7.folder,children:n.projectDir?`project`:`own workspace`}),(0,U.jsx)(`div`,{className:`mt-1 break-all font-mono text-[10px] text-fg-faint`,"data-testid":`session-folder`,children:n.cwd}),r?null:(0,U.jsx)(`button`,{type:`button`,className:`mt-1 text-[11px] text-accent hover:underline`,onClick:()=>t.openDialog(`project`),"data-testid":`session-change-folder`,children:`Change folder…`})]}),h?(0,U.jsx)(jxe,{sessionId:n.id,running:g},n.id):null,r?null:(0,U.jsxs)(`div`,{className:`space-y-1.5`,"data-testid":`session-scheduled-tasks`,children:[(0,U.jsx)(Y7,{label:`Scheduled tasks`,icon:X7.tasks}),(0,U.jsx)(dP,{sessionId:n.id})]}),a?.init?(0,U.jsxs)(`div`,{className:`text-[11px] text-fg-faint`,children:[`engine `,a.init.claudeCodeVersion,` · `,a.init.tools.length,` tools`]}):null]}):(0,U.jsx)(`div`,{className:`p-4 text-xs text-fg-faint`,children:`Open a chat to see its statistics.`})})}var Z7=[{id:`media`,title:`Media`,hideLabel:`Hide media`,icon:G.Gallery,available:({sessionId:e})=>e!==null,render:({sessionId:e,reportCount:t})=>e?(0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-testid":`media-panel`,"aria-label":`Media in this chat`,children:(0,U.jsx)(vxe,{sessionId:e,onTotal:t},e)}):null},{id:`sessionInfo`,title:`Session info`,hideLabel:`Hide session info`,icon:G.Info,render:({sessionId:e})=>(0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-testid":`session-panel`,"aria-label":`Session info`,children:(0,U.jsx)(Nxe,{},e??`none`)})}];function Q7(e){return Z7.find(t=>t.id===e)}var $7={rightPanelWidth:320};function Pxe(e,t){let{state:n,actions:r}=W(),i=n.prefs[e],[a,o]=(0,v.useState)(null),s=a??i,c=(0,U.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the ${t}`,title:`Drag to resize · double-click for the default width`,className:`absolute inset-y-0 -left-1 z-10 hidden w-2 cursor-col-resize hover:bg-accent/30 lg:block`,onPointerDown:t=>{t.preventDefault();let n=t.clientX,a=s,c=a,l=t=>{c=zl(a+(n-t.clientX),$7[e]),o(c)},u=()=>{window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),document.body.style.cursor=``,document.body.style.userSelect=``,o(null),c!==i&&r.savePrefs({[e]:c})};document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u)},onDoubleClick:()=>void r.savePrefs({[e]:$7[e]}),"data-testid":`right-panel-resize`});return{style:{width:`min(${s}px, 85vw)`},handle:c}}function Fxe(){let{state:e,actions:t}=W(),{rightPanelSections:n,rightPanelCollapsed:r}=e.prefs,i=e.currentSessionId,a=Pxe(`rightPanelWidth`,`right panel`),[o,s]=(0,v.useState)({}),c=(0,v.useMemo)(()=>{let e={};for(let t of Z7)e[t.id]=e=>s(n=>n[t.id]===e?n:{...n,[t.id]:e});return e},[]),l=(0,v.useCallback)(e=>Q7(e)?.available?.({sessionId:i})??!0,[i]),u=Hb(n,l),d=Ub(u,r),f=(e,n)=>void t.savePrefs(Wb(e,n)),p=Z7.map(e=>{let t=n.includes(e.id);return{id:e.id,label:t?e.hideLabel:`Show ${e.title.toLowerCase()}`,icon:e.icon,active:t,count:o[e.id]??null}});return(0,U.jsxs)(U.Fragment,{children:[u.length>0?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`absolute inset-0 z-20 bg-black/30 lg:hidden`,onClick:()=>f([],[]),"aria-hidden":!0}),(0,U.jsx)(`div`,{className:`absolute inset-y-0 right-0 z-30 flex max-w-[85vw] lg:static lg:z-auto lg:max-w-none`,children:(0,U.jsxs)(`aside`,{className:`relative flex shrink-0 flex-col border-l border-border bg-surface`,style:a.style,"aria-label":`Side panels`,"data-testid":`right-dock`,"data-font-scope":`sidebar`,children:[a.handle,u.map(e=>{let t=Q7(e);return t?(0,U.jsx)(cxe,{id:e,title:t.title,icon:t.icon,count:o[e]??null,collapsed:r.includes(e),onToggle:()=>f(n,Vb(r,e)),onRemove:()=>f(Bb(n,e),r),removeLabel:t.hideLabel,grow:d[e]??1,children:t.render({sessionId:i,reportCount:c[e]})},e):null})]})})]}):null,(0,U.jsx)(`div`,{className:`hidden border-l border-border lg:flex`,children:(0,U.jsx)(L7,{items:p,multi:!0,testId:`activity-bar-right`,label:`Side panels`,onPick:e=>{l(e)&&f(Bb(n,e),r)}})})]})}function Ixe(e){let t=e=>e.type===`dir`?0:1;return[...e].sort((e,n)=>t(e)-t(n)||e.name.localeCompare(n.name))}function Lxe(e){let t=[];return e.target.type===`file`&&t.push({key:`open`,label:`Open`,icon:(0,U.jsx)(G.File,{className:`w-3.5 h-3.5`}),onSelect:e.onOpen,testId:`files-menu-open`}),t.push({key:`copy-path`,label:`Copy path`,icon:(0,U.jsx)(G.Copy,{className:`w-3.5 h-3.5`}),disabled:!e.canCopyPath,onSelect:e.onCopyPath,testId:`files-menu-copy-path`},{key:`copy-relative-path`,label:`Copy relative path`,icon:(0,U.jsx)(G.Copy,{className:`w-3.5 h-3.5`}),onSelect:e.onCopyRelativePath,testId:`files-menu-copy-relative-path`}),!e.remote&&e.canReveal&&t.push({key:`show-in-explorer`,label:`Show in Explorer`,icon:(0,U.jsx)(G.Folder,{className:`w-3.5 h-3.5`}),onSelect:e.onReveal,testId:`files-menu-show-in-explorer`}),!e.remote&&e.canRename&&t.push({key:`rename`,label:`Rename…`,icon:(0,U.jsx)(G.Edit,{className:`w-3.5 h-3.5`}),onSelect:e.onRename,testId:`files-menu-rename`}),!e.remote&&e.canDelete&&t.push({key:`delete`,label:`Delete…`,icon:(0,U.jsx)(G.Trash,{className:`w-3.5 h-3.5`}),danger:!0,separated:!0,onSelect:e.onDelete,testId:`files-menu-delete`}),t}function Rxe(e,t){return t instanceof Qh&&t.status===404&&/^no route for /.test(t.message)?`This host is too old to delete files — update it from the title bar.`:`Could not delete ${tj(e.path)}: ${t instanceof Error?t.message:String(t)}`}function e9(){let{state:e,dispatch:t,actions:n,api:r}=W(),i=ES(),a=TS(),o=i?.id??null,s=(o?e.remote.tabs[o]:void 0)?.hostId??(o?e.remote.sessionOwners[o]:void 0)??null,c=s!==null,l=c&&typeof r.listHostSessionFiles==`function`,u=a?.status===`running`||a?.status===`waiting_permission`,d=o?e.files[o]?.active??null:null,f=c?e.remote.hosts.find(e=>e.hostId===s)?.platform??null:e.info?.platform??null,p=i?.cwd??``,m=e=>{n.openFile(e),Jb(n.setSidebar)},[h,g]=(0,v.useState)({}),[_,y]=(0,v.useState)(()=>new Set),[b,x]=(0,v.useState)(!1),S=(0,v.useRef)(h);S.current=h;let C=(0,v.useRef)(_);C.current=_;let w=(0,v.useRef)(o);w.current=o;let T=(0,v.useRef)(e.files);T.current=e.files;let[E,D]=(0,v.useState)(null),O=(0,v.useCallback)(()=>D(null),[]),k=(0,v.useCallback)((e,t,n)=>D({target:e,at:t,el:n}),[]),[A,j]=(0,v.useState)(null),[M,N]=(0,v.useState)(!1),ee=(0,v.useCallback)(()=>j(null),[]),[te,P]=(0,v.useState)(null),[F,ne]=(0,v.useState)(!1),I=(0,v.useCallback)(()=>P(null),[]),[re,ie]=(0,v.useState)(``),ae=Xb(re)!==``,L=(0,v.useMemo)(()=>ae?Qb(h,re):null,[ae,h,re]),oe=(0,v.useCallback)(async e=>{if(!o||(c?!r.listHostSessionFiles||!s:!r.listSessionFiles))return;let t=o;g(t=>({...t,[e]:{...t[e]??{entries:null},loading:!0,error:null}}));try{let n=c&&s&&r.listHostSessionFiles?await r.listHostSessionFiles(s,t,e):await r.listSessionFiles(t,e);if(w.current!==t)return;x(!1),g(t=>({...t,[e]:{entries:Ixe(n.entries),loading:!1,error:null}}))}catch(n){if(w.current!==t)return;ng(n)&&x(!0);let r=n instanceof Error?n.message:String(n);g(t=>({...t,[e]:{entries:t[e]?.entries??null,loading:!1,error:r}}))}},[r,o,c,s]);(0,v.useEffect)(()=>{g({}),y(new Set),x(!1),D(null),j(null),o&&(!c||l)&&oe(``)},[o,c,l,oe]);let se=(0,v.useRef)(u);(0,v.useEffect)(()=>{if(se.current&&!u&&o&&(!c||l))for(let e of Object.keys(S.current))(e===``||C.current.has(e))&&oe(e);se.current=u},[u,o,c,l,oe]);let ce=e=>{y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):(n.add(e),S.current[e]?.entries||oe(e)),n})},le=()=>{if(o){oe(``);for(let e of _)oe(e)}},ue=(e,t)=>{dN(e).then(e=>n.toast(e?`success`:`error`,e?t:`Could not copy to the clipboard`))},de=e=>{let t=window.oonacode;if(!p||!t?.showItemInFolder){n.toast(`error`,`Show in Explorer is available in the desktop app on this PC.`);return}t.showItemInFolder(sj(p,e.path,f)).then(e=>{e.ok||n.toast(`error`,e.message||`Could not show it in Explorer.`)})},fe=(e,t,n)=>n===e?t:n.startsWith(`${e}/`)?`${t}${n.slice(e.length)}`:null,R=async e=>{let i=te,a=o;if(!(!i||!a||!r.renameSessionFile||c)){ne(!0);try{let o=await r.renameSessionFile(a,i.path,e);Fve(a,i.path,o.path);for(let e of T.current[a]?.open??[]){let n=fe(i.path,o.path,e);n&&(t({type:`file_close`,sessionId:a,path:e}),(i.type===`file`||e!==i.path)&&t({type:`file_open`,sessionId:a,path:n}))}w.current===a&&(y(e=>{let t=new Set;for(let n of e)t.add(fe(i.path,o.path,n)??n);return t}),g(e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[fe(i.path,o.path,e)??e,t]))),oe(rj(o.path))),n.toast(`success`,`Renamed to ${tj(o.path)}`),P(null)}catch(e){n.toast(`error`,`Could not rename ${tj(i.path)}: ${e instanceof Error?e.message:String(e)}`)}finally{ne(!1)}}},pe=async()=>{let e=A,i=o;if(!(!e||!i)&&!(c?!r.deleteHostSessionFile||!s:!r.deleteSessionFile)){N(!0);try{c&&s&&r.deleteHostSessionFile?await r.deleteHostSessionFile(s,i,e.path):await r.deleteSessionFile(i,e.path);for(let n of T.current[i]?.open??[])ij(n,e.path)&&t({type:`file_close`,sessionId:i,path:n});w.current===i&&(y(t=>new Set([...t].filter(t=>!ij(t,e.path)))),g(t=>Object.fromEntries(Object.entries(t).filter(([t])=>!ij(t,e.path)))),oe(rj(e.path))),n.toast(`success`,`Deleted ${tj(e.path)}`)}catch(t){n.toast(`error`,Rxe(e,t)),w.current===i&&oe(rj(e.path))}finally{N(!1),j(null)}}},me=E?Lxe({target:E.target,remote:c,canDelete:typeof r.deleteSessionFile==`function`,canCopyPath:p!==``,canReveal:!c&&p!==``&&typeof window.oonacode?.showItemInFolder==`function`,canRename:!c&&typeof r.renameSessionFile==`function`,onOpen:()=>m(E.target.path),onCopyPath:()=>ue(sj(p,E.target.path,f),`Path copied`),onCopyRelativePath:()=>ue(oj(E.target.path,aj(p,f)),`Relative path copied`),onReveal:()=>de(E.target),onRename:()=>P(E.target),onDelete:()=>j(E.target)}):[],he=i?.cwd?tj(i.cwd)||i.cwd:`Files`,ge=h[``],_e=E?.target.path??null,ve=(0,v.useMemo)(()=>o?c&&!l?(0,U.jsx)(t9,{children:`This chat runs on another PC; its files can be browsed there.`}):b?(0,U.jsx)(t9,{children:`This host is too old to list files — update it from the title bar.`}):ge?.error&&!ge.entries?(0,U.jsx)(t9,{tone:`danger`,children:ge.error}):ge?.entries?ge.entries.length===0?(0,U.jsx)(t9,{children:`The folder is empty.`}):L&&L.visible.size===0?(0,U.jsx)(t9,{children:`Nothing listed matches. The filter looks at the folders already opened — Search (Ctrl+K) looks through the whole folder, file contents too.`}):(0,U.jsx)(`ul`,{role:`tree`,"aria-label":`Workspace files`,className:`py-1`,children:(0,U.jsx)(i9,{rel:``,depth:0,tree:h,expanded:_,activeFile:d,menuPath:_e,narrowed:L,onToggle:ce,onOpen:m,onMenu:k})}):(0,U.jsx)(t9,{children:`Listing…`}):(0,U.jsx)(t9,{children:`Open a chat to browse the folder it works in.`}),[o,c,b,ge,h,_,d,_e,L,n]);return(0,U.jsxs)(`section`,{className:`flex h-full min-h-0 w-full flex-col bg-surface`,"aria-label":`Files`,"data-testid":`file-explorer`,"data-font-scope":`sidebar`,children:[(0,U.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-border px-3`,children:[(0,U.jsx)(G.Folder,{className:`w-3.5 h-3.5 text-fg-faint`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-semibold uppercase tracking-wide text-fg-muted`,title:i?.cwd??void 0,children:he}),(0,U.jsx)(zS,{label:`Refresh files`,className:`p-1`,onClick:le,disabled:!o||c&&!l,"data-testid":`file-explorer-refresh`,children:(0,U.jsx)(G.Refresh,{className:`w-3.5 h-3.5`})})]}),(0,U.jsxs)(`div`,{className:`relative shrink-0 border-b border-border p-2`,children:[(0,U.jsx)(G.Filter,{className:`pointer-events-none absolute left-4 top-4 w-3.5 h-3.5 text-fg-faint`}),(0,U.jsx)(`input`,{"aria-label":`Filter files by name`,className:H(q,`pl-7`,re!==``&&`pr-7`),placeholder:`Filter files`,value:re,onChange:e=>ie(e.target.value),onKeyDown:e=>{e.key===`Escape`&&re!==``&&(e.preventDefault(),e.stopPropagation(),ie(``))},"data-testid":`files-filter`}),re===``?null:(0,U.jsx)(zS,{label:`Clear the filter`,className:`absolute right-2.5 top-2.5 p-1`,onClick:()=>ie(``),"data-testid":`files-filter-clear`,children:(0,U.jsx)(G.X,{className:`w-3.5 h-3.5`})})]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:ve}),(0,U.jsx)(HC,{open:E!==null,at:E?.at??{x:0,y:0},anchorEl:E?.el??null,label:`File actions`,testId:`files-context-menu`,onClose:O,items:me}),(0,U.jsx)(zxe,{target:te,busy:F,onConfirm:e=>void R(e),onClose:I}),(0,U.jsx)(Bxe,{target:A,absolute:A?p?sj(p,A.path,f):A.path:``,platform:f,busy:M,onConfirm:()=>void pe(),onClose:ee})]})}function zxe({target:e,busy:t,onConfirm:n,onClose:r}){let[i,a]=(0,v.useState)(``);(0,v.useEffect)(()=>{a(e?tj(e.path):``)},[e]);let o=e?.type===`dir`;return(0,U.jsx)(GS,{open:e!==null,title:o?`Rename this folder`:`Rename this file`,onClose:r,footer:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{onClick:r,disabled:t,"data-testid":`files-rename-cancel`,children:`Cancel`}),(0,U.jsx)(K,{variant:`primary`,busy:t,disabled:!i.trim()||i.trim()===(e?tj(e.path):``),onClick:()=>n(i.trim()),"data-testid":`files-rename-confirm`,children:`Rename`})]}),children:(0,U.jsxs)(`label`,{className:`block text-sm`,children:[(0,U.jsx)(`span`,{className:`mb-1 block text-fg-muted`,children:`New name`}),(0,U.jsx)(`input`,{value:i,autoFocus:!0,disabled:t,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i.trim()&&n(i.trim())},className:`w-full rounded-md border border-border bg-surface px-2 py-1.5`,"data-testid":`files-rename-input`})]})})}function Bxe({target:e,absolute:t,platform:n,busy:r,onConfirm:i,onClose:a}){let o=e?.type===`dir`;return(0,U.jsx)(GS,{open:e!==null,title:o?`Delete this folder?`:`Delete this file?`,onClose:a,footer:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{onClick:a,disabled:r,"data-testid":`files-delete-cancel`,children:`Cancel`}),(0,U.jsx)(K,{variant:`danger`,busy:r,onClick:i,"data-testid":`files-delete-confirm`,children:`Delete permanently`})]}),children:(0,U.jsxs)(`div`,{className:`space-y-2 text-sm text-fg-muted`,"data-testid":`files-delete-dialog`,children:[(0,U.jsx)(`p`,{className:`break-all rounded bg-surface-2 px-2 py-1 font-mono text-xs text-fg`,children:t}),(0,U.jsxs)(`p`,{children:[o?`This folder and everything inside it will be deleted from the disk permanently.`:`This file will be deleted from the disk permanently.`,` `,`It does not go to the `,n===`win32`?`Recycle Bin`:`Trash`,`, and it cannot be undone.`]})]})})}function t9({children:e,tone:t}){return(0,U.jsx)(`div`,{className:H(`p-4 text-xs`,t===`danger`?`text-danger`:`text-fg-faint`),children:e})}function n9(e){let t=e.getBoundingClientRect();return{x:t.left+24,y:t.bottom}}function r9(e,t){return{onContextMenu:n=>{n.preventDefault();let r=n.currentTarget;t(e,n.clientX===0&&n.clientY===0?n9(r):{x:n.clientX,y:n.clientY},r)},onKeyDown:n=>{(n.key===`ContextMenu`||n.shiftKey&&n.key===`F10`)&&(n.preventDefault(),t(e,n9(n.currentTarget),n.currentTarget))}}}function i9({rel:e,depth:t,tree:n,expanded:r,activeFile:i,menuPath:a,narrowed:o,onToggle:s,onOpen:c,onMenu:l}){let u=n[e];return u?u.error&&!u.entries?(0,U.jsx)(`li`,{className:`px-2 py-1 text-[11px] text-danger`,style:{paddingLeft:`${.5+t*.75}rem`},children:u.error}):u.entries?(0,U.jsx)(U.Fragment,{children:u.entries.map(u=>{let d=nj(e,u.name);if(o&&!o.visible.has(d))return null;let f=a===d;if(u.type===`dir`){let e=r.has(d)||!!o?.open.has(d);return(0,U.jsxs)(`li`,{role:`treeitem`,"aria-expanded":e,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>s(d),...r9({path:d,type:`dir`},l),"data-testid":`explorer-dir-${d}`,className:H(`flex w-full items-center gap-1 py-0.5 pr-2 text-left text-xs text-fg hover:bg-surface-2`,f&&`bg-surface-2`),style:{paddingLeft:`${.5+t*.75}rem`},children:[(0,U.jsx)(G.ChevronRight,{className:H(`w-3 h-3 shrink-0 text-fg-faint transition-transform`,e&&`rotate-90`)}),(0,U.jsx)(G.Folder,{className:`w-3.5 h-3.5 shrink-0 text-fg-faint`}),(0,U.jsx)(`span`,{className:`truncate`,children:u.name})]}),e?(0,U.jsx)(`ul`,{role:`group`,children:(0,U.jsx)(i9,{rel:d,depth:t+1,tree:n,expanded:r,activeFile:i,menuPath:a,narrowed:o,onToggle:s,onOpen:c,onMenu:l})}):null]},d)}let p=i===d;return(0,U.jsx)(`li`,{role:`treeitem`,"aria-selected":p,children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>c(d),...r9({path:d,type:u.type},l),disabled:u.type!==`file`,"data-testid":`explorer-file-${d}`,title:`${d} · ${Ej(u.size)}`,className:H(`flex w-full items-center gap-1 py-0.5 pr-2 text-left text-xs hover:bg-surface-2 disabled:opacity-50`,p?`bg-accent-soft text-accent`:f?`bg-surface-2 text-fg`:`text-fg`),style:{paddingLeft:`${.5+t*.75+.9}rem`},children:[(0,U.jsx)(G.File,{className:`w-3.5 h-3.5 shrink-0 text-fg-faint`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:u.name}),(0,U.jsx)(`span`,{className:`shrink-0 text-[10px] text-fg-faint`,children:Ej(u.size)})]})},d)})}):(0,U.jsx)(`li`,{className:`px-2 py-1 text-[11px] text-fg-faint`,style:{paddingLeft:`${.5+t*.75}rem`},children:`Listing…`}):null}function a9({text:e,query:t,options:n}){return(0,U.jsx)(U.Fragment,{children:S7(e,t,n).map((e,t)=>e.hit?(0,U.jsx)(`mark`,{className:`rounded bg-warn-soft px-0.5 text-fg`,children:e.text},t):(0,U.jsx)(`span`,{children:e.text},t))})}function Vxe({active:e,focusAsk:t=0}){let{state:n}=W(),[r,i]=(0,v.useState)(`chats`),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(x7),[l,u]=(0,v.useState)(!1),d=(0,v.useRef)(null),f=(0,v.useRef)(0),p=(0,v.useRef)(!1);(0,v.useEffect)(()=>{t!==f.current&&(f.current=t,p.current=!0),e&&p.current&&(p.current=!1,d.current?.focus())},[e,t]);let m=r===`chats`,h=m&&s.mode===`conversations`,g=()=>{o(``),u(!1),d.current?.focus()},_=e=>c(t=>({...t,[e]:!t[e]}));return(0,U.jsxs)(`section`,{className:`flex h-full min-h-0 w-full flex-col bg-surface`,"aria-label":`Search`,"data-testid":`search-section`,children:[(0,U.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-border px-3`,children:[(0,U.jsx)(G.Search,{className:`w-3.5 h-3.5 text-fg-faint`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:`Search`})]}),(0,U.jsxs)(`div`,{className:`shrink-0 space-y-2 border-b border-border p-2`,children:[(0,U.jsx)(`div`,{className:`flex rounded-md border border-border bg-surface-2 p-0.5`,role:`radiogroup`,"aria-label":`Search in`,children:[[`chats`,`Chats`],[`files`,`Files & contents`]].map(([e,t])=>(0,U.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":r===e,onClick:()=>{i(e),u(!1),d.current?.focus()},className:H(`flex-1 rounded px-2 py-1 text-xs font-medium transition-colors`,r===e?`bg-surface text-fg shadow-sm`:`text-fg-muted hover:text-fg`),"data-testid":`search-scope-${e}`,children:t},e))}),(0,U.jsxs)(`div`,{className:`relative flex items-center gap-1`,"data-testid":`sidebar-search`,children:[(0,U.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,U.jsx)(G.Search,{className:`pointer-events-none absolute left-2 top-2 w-3.5 h-3.5 text-fg-faint`}),(0,U.jsx)(`input`,{ref:d,"aria-label":m?`Search sessions`:`Search files`,className:H(q,`pl-7`),placeholder:m?h?`Search every chat`:`Search chats`:`File names and contents`,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(a!==``||l)&&(e.preventDefault(),e.stopPropagation(),l?u(!1):o(``))},"data-testid":`search-input`})]}),m?(0,U.jsxs)(zS,{label:l?`Hide search options`:`Search options`,className:H(`relative`,l&&`text-accent`),"aria-pressed":l,onMouseDown:e=>e.preventDefault(),onClick:()=>u(e=>!e),"data-testid":`search-options-toggle`,children:[(0,U.jsx)(G.Sliders,{}),C7(s)?(0,U.jsx)(`span`,{className:`absolute right-0.5 top-0.5 h-1.5 w-1.5 rounded-full bg-accent`,"data-testid":`search-options-dot`}):null]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(zS,{label:`Match case`,className:H(`px-1 text-[11px] font-semibold`,s.caseSensitive&&`text-accent`),"aria-pressed":s.caseSensitive,onClick:()=>_(`caseSensitive`),"data-testid":`file-search-case`,children:`Aa`}),(0,U.jsx)(zS,{label:`Whole words`,className:H(`px-1 text-[11px] font-semibold underline`,s.wholeWord&&`text-accent`),"aria-pressed":s.wholeWord,onClick:()=>_(`wholeWord`),"data-testid":`file-search-word`,children:`ab`})]}),a!==``||l?(0,U.jsx)(zS,{label:`Clear search`,onMouseDown:e=>e.preventDefault(),onClick:g,"data-testid":`close-search`,children:(0,U.jsx)(G.X,{})}):null,m&&l?(0,U.jsx)(D7,{options:s,onChange:c,projects:n.vaultProjects,onClose:()=>{u(!1),d.current?.focus()}}):null]})]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-1 pb-2`,children:m?h?a.trim()===``?(0,U.jsx)(o9,{testId:`search-idle`,children:`Type to search every message of every chat on this PC.`}):(0,U.jsx)(Lbe,{query:a,options:s}):(0,U.jsx)(Hxe,{query:a,options:s}):(0,U.jsx)(Uxe,{query:a,options:s})})]})}function o9({children:e,testId:t,tone:n}){return(0,U.jsx)(`div`,{className:H(`px-3 py-4 text-center text-xs`,n===`danger`?`text-danger`:`text-fg-faint`),"data-testid":t,children:e})}function Hxe({query:e,options:t}){let{state:n,actions:r}=W(),i=bI(),a=TI(),o=e.trim(),[s,c]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(!o)return;let e=!0,t=setTimeout(()=>{r.searchSessionNames(o).then(t=>{e&&c({term:o,sessions:t})})},200);return()=>{e=!1,clearTimeout(t)}},[o,r]);let l=s&&s.term===o?s:null,u=(0,v.useMemo)(()=>{if(!l?.sessions)return[];let e=Date.now();return l.sessions.filter(n=>Nbe(n,o,t,e))},[l,o,t]),d=(0,v.useMemo)(()=>new Map(n.vaultProjects.map(e=>[e.id,e.name])),[n.vaultProjects]);return o?l?l.sessions===null?(0,U.jsx)(o9,{testId:`search-failed`,tone:`danger`,children:`This PC could not search its chats. Try again.`}):(0,U.jsxs)(`div`,{"data-testid":`search-results`,children:[(0,U.jsx)(`div`,{className:`px-3 py-1.5 text-[11px] text-fg-faint`,children:u.length===0?`No chat matches.`:`${u.length} ${u.length===1?`chat`:`chats`}`}),u.map(e=>(0,U.jsx)(vI,{session:e,active:e.id===n.currentSessionId&&n.page===null,link:n.sessionLinks[e.id]??null,menuOpen:i.menuFor===e.id,projectName:e.projectId?d.get(e.projectId)??null:null,testIdPrefix:`search-session`,onOpen:e=>{r.selectSession(e),Jb(r.setSidebar)},onMenu:i.openMenu,clock:a},e.id)),i.element]}):(0,U.jsx)(o9,{testId:`search-busy`,children:`Searching…`}):(0,U.jsx)(o9,{testId:`search-idle`,children:`Type to find a chat by its name, its first or last message, or its folder. The sliders search inside every message.`})}function Uxe({query:e,options:t}){let{state:n,actions:r,api:i}=W(),a=ES(),o=a?.id??null,s=o!==null&&!!(n.remote.tabs[o]??n.remote.sessionOwners[o]),c=e.trim(),l=t.caseSensitive,u=t.wholeWord,d=`${o??``}\n${c}\n${+!!l}${+!!u}`,f=o!==null&&!s&&typeof i.searchSessionFiles==`function`,p=f&&c.length>=2,[m,h]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(!p||!o||!i.searchSessionFiles)return;let e=!0,t=i.searchSessionFiles,n=setTimeout(()=>{t(o,{q:c,caseSensitive:l,wholeWord:u}).then(t=>{e&&h({key:d,res:t,error:null})},t=>{if(!e)return;let n=ng(t)?`This host is too old to search files — update it from the title bar.`:`Could not search the files: ${t instanceof Error?t.message:String(t)}`;h({key:d,res:null,error:n})})},300);return()=>{e=!1,clearTimeout(n)}},[d,p,i]);let g=a?.cwd?tj(a.cwd)||a.cwd:null;if(!o)return(0,U.jsx)(o9,{testId:`file-search-idle`,children:`Open a chat to search the folder it works in.`});if(s)return(0,U.jsx)(o9,{testId:`file-search-idle`,children:`This chat runs on another PC; its files can be searched there.`});if(!f)return(0,U.jsx)(o9,{testId:`file-search-idle`,children:`This window cannot search files.`});if(c.length<2)return(0,U.jsxs)(o9,{testId:`file-search-idle`,children:[`Searches the file names and the text in the folder of the open chat`,g?(0,U.jsxs)(U.Fragment,{children:[` — `,(0,U.jsx)(`span`,{className:`font-medium text-fg-muted`,title:a?.cwd,children:g})]}):null,`. Type at least two characters.`]});let _=m&&m.key===d?m:null;if(!_)return(0,U.jsx)(o9,{testId:`file-search-busy`,children:`Searching the files…`});if(!_.res)return(0,U.jsx)(o9,{testId:`file-search-failed`,tone:`danger`,children:_.error});let{results:y,truncated:b}=_.res,x=y.reduce((e,t)=>e+t.hits.length,0),S=e=>{r.openFile(e),Jb(r.setSidebar)};return(0,U.jsxs)(`div`,{"data-testid":`file-search-results`,children:[(0,U.jsxs)(`div`,{className:`px-3 py-1.5 text-[11px] text-fg-faint`,"data-testid":`file-search-summary`,children:[y.length===0?`Nothing in ${g??`this folder`} matches.`:`${y.length}${b?`+`:``} ${y.length===1?`file`:`files`}${x>0?`, ${x} ${x===1?`line`:`lines`}`:``} in ${g??`this folder`}`,b?` — the search stopped early; narrow the phrase to see the rest.`:``]}),y.map(e=>{let n=tj(e.path)||e.path,r=e.path.length>n.length?e.path.slice(0,e.path.length-n.length-1):``;return(0,U.jsxs)(`div`,{className:`mb-1`,"data-testid":`file-search-result-${e.path}`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-1.5 rounded px-2 py-1 text-left text-xs hover:bg-surface-2`,title:e.path,onClick:()=>S(e.path),"data-testid":`file-search-file`,children:[(0,U.jsx)(G.File,{className:`w-3.5 h-3.5 shrink-0 text-fg-faint`}),(0,U.jsx)(`span`,{className:`shrink-0 font-medium text-fg`,children:e.nameMatch?(0,U.jsx)(a9,{text:n,query:c,options:t}):n}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] text-fg-faint`,children:r}),e.hits.length>0?(0,U.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-3 px-1.5 text-[10px] font-semibold text-fg-muted`,children:[e.hits.length,e.moreHits?`+`:``]}):null]}),e.hits.map(n=>(0,U.jsxs)(`button`,{type:`button`,className:`flex w-full gap-2 rounded px-2 py-0.5 pl-7 text-left font-mono text-[11px] hover:bg-surface-2`,onClick:()=>S(e.path),"data-testid":`file-search-hit`,children:[(0,U.jsx)(`span`,{className:`shrink-0 text-fg-faint`,children:n.line}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-fg-muted`,children:(0,U.jsx)(a9,{text:n.text,query:c,options:t})})]},n.line))]},e.path)})]})}function s9(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function Wxe(e,t,n){let r=s9(n),i=e.filter(e=>!t.has(e.id)).sort((e,t)=>t.mtime-e.mtime),a=[],o=[];for(let e of i)(e.mtime>=r?a:o).push(e);return{today:a,older:o}}function c9(e,t){let n=t.trim().toLowerCase();return n===``||e.toLowerCase().includes(n)}var Gxe=3e4,l9=`flex w-full items-center gap-1 rounded px-2 py-1 text-left text-[11px] font-semibold uppercase tracking-wide text-fg-faint hover:bg-surface-2`,u9=`flex items-center gap-1 px-2 pb-0.5 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-faint`,Kxe=`flex w-full items-center gap-1.5 rounded border-l-2 border-project/70 bg-surface-2/40 px-2 py-1.5 text-left text-[13px] font-semibold tracking-normal text-fg hover:bg-surface-2`,d9=`flex min-w-0 items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-fg hover:bg-surface-2`;function qxe({onOpenSearch:e}={}){let{state:t,actions:n}=W(),r=t.ui.sidebarPinnedOverride??t.prefs.sidebarPinned,[i,a]=(0,v.useState)({}),[o,s]=(0,v.useState)(!1),c=bI(),[l,u]=(0,v.useState)(null),d=(0,v.useCallback)(()=>u(null),[]),f=$xe(),p=TI(),m=s9(p),h=t.prefs.sidebarView,g=t.prefs.pinned,_=e=>a(t=>({...t,[e]:t[e]!==!0})),y=e=>i[e]===!0,b=t.prefs.collapsedProjects,x=e=>b.includes(e),S=e=>{let t=x(e)?b.filter(t=>t!==e):[...b,e];n.savePrefs({collapsedProjects:t})},C=(0,v.useCallback)(e=>{let r=t.remote.tabs[e]?.hostId??t.remote.sessionOwners[e]??null;r?n.openRemoteSession(r,e):n.selectSession(e),window.innerWidth<768&&n.setSidebar(!1)},[n,t.remote.tabs,t.remote.sessionOwners]),w=(0,v.useCallback)(e=>{n.openPage({kind:`project`,projectId:e}),window.innerWidth<768&&n.setSidebar(!1)},[n]),[T,E]=(0,v.useState)(``),D=Xb(T)!==``,O=(0,v.useMemo)(()=>new Map(t.vaultProjects.map(e=>[e.id,e.name])),[t.vaultProjects]),k=(0,v.useCallback)(e=>Zb(e,T,e.projectId?O.get(e.projectId):null),[T,O]),A=(0,v.useMemo)(()=>{let e=t.sessions.filter(e=>!t.remote.tabs[e.id]);return D?e.filter(k):e},[t.sessions,t.remote.tabs,D,k]),j=(0,v.useMemo)(()=>{let e=new Map(A.map(e=>[e.id,e]));for(let n of Object.values(t.remote.sessions))for(let t of n??[])e.has(t.id)||e.set(t.id,t);let n=[];for(let r of g)if(r.kind===`chat`){let i=e.get(r.id)??t.pinnedRows[r.id];i&&(!D||k(i))&&n.push({kind:`chat`,session:i})}else{let e=t.vaultProjects.find(e=>e.id===r.id);if(!e||!c9(e.name,T))continue;let i=t.sessions.filter(t=>t.projectId===e.id);n.push({kind:`project`,project:e,sessions:i})}return n},[g,A,D,T,k,t.pinnedRows,t.remote.sessions,t.vaultProjects,t.sessions]),M=(0,v.useMemo)(()=>new Set(g.filter(e=>e.kind===`chat`).map(e=>e.id)),[g]),N=(0,v.useMemo)(()=>h===`recent`?Wxe(A,M,m):null,[h,A,M,m]),ee=(0,v.useMemo)(()=>{if(h!==`projects`)return[];let e=new Map;for(let n of t.vaultProjects)e.set(n.id,{name:n.name,sessions:[]});let n=[];for(let t of A){let r=t.projectId?e.get(t.projectId):void 0;r?r.sessions.push(t):n.push(t)}let r=[...e.entries()].map(([e,t])=>({key:e,name:t.name,projectId:e,sessions:t.sessions.slice().sort((e,t)=>t.mtime-e.mtime)}));return r.sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`})),(n.length>0||r.length===0)&&r.push({key:`none`,name:`No project`,projectId:null,sessions:n.slice().sort((e,t)=>t.mtime-e.mtime)}),D?r.filter(e=>e.sessions.length>0||e.projectId!==null&&c9(e.name,T)):r},[h,t.vaultProjects,A,D,T]),te=e=>{n.savePrefs({collapsedProjects:e?ee.map(e=>e.key):[]})},P=(0,v.useMemo)(()=>t.remote.hosts.filter(e=>!e.isSelf),[t.remote.hosts]),F=()=>{let e=y(`remote`);_(`remote`),e&&n.refreshHosts()},ne=!y(`remote`),I=(0,v.useRef)(!1);I.current=t.remote.loading;let re=(0,v.useRef)(i);re.current=i;let ie=(0,v.useRef)(P);ie.current=P,(0,v.useEffect)(()=>{if(!ne)return;let e=()=>{if(!(document.visibilityState===`hidden`||I.current)){n.refreshHosts();for(let e of ie.current)e.online&&re.current[`host:${e.hostId}`]===!1&&n.refreshHostSessions(e.hostId)}},t=setInterval(e,Gxe);return window.addEventListener(`focus`,e),()=>{clearInterval(t),window.removeEventListener(`focus`,e)}},[ne,n]);let ae=A.length,L=e=>{e!==h&&n.savePrefs({sidebarView:e})},oe=t.page,se={onOpen:C,onMenu:c.openMenu,clock:p},ce=!t.sessionsLoading&&ae===0&&!t.sessionsError?(0,U.jsx)(`div`,{className:`px-3 py-3 text-center text-xs text-fg-faint`,"data-testid":`sessions-empty`,children:D?`No chats match the filter.`:`No sessions yet — press + to start one.`}):null;return(0,U.jsxs)(`nav`,{className:`flex h-full w-full flex-col bg-surface`,"aria-label":`Sessions`,children:[(0,U.jsxs)(`div`,{className:`relative flex flex-wrap items-center justify-end gap-x-2 gap-y-1 border-b border-border p-2`,children:[(0,U.jsxs)(`div`,{className:`relative min-w-[8rem] flex-1`,children:[(0,U.jsx)(G.Filter,{className:`pointer-events-none absolute left-2 top-2 w-3.5 h-3.5 text-fg-faint`}),(0,U.jsx)(`input`,{"aria-label":`Filter chats by name`,className:H(q,`pl-7`,T!==``&&`pr-7`),placeholder:`Filter chats`,value:T,onChange:e=>E(e.target.value),onKeyDown:e=>{e.key===`Escape`&&T!==``&&(e.preventDefault(),e.stopPropagation(),E(``))},"data-testid":`sessions-filter`}),T===``?null:(0,U.jsx)(zS,{label:`Clear the filter`,className:`absolute right-0.5 top-0.5 p-1`,onClick:()=>E(``),"data-testid":`sessions-filter-clear`,children:(0,U.jsx)(G.X,{className:`w-3.5 h-3.5`})})]}),(0,U.jsx)(zS,{label:`Search chats and files (Ctrl+K)`,onClick:()=>{n.showLeftSection(`search`),e?.()},"data-testid":`open-search`,children:(0,U.jsx)(G.Search,{})}),(0,U.jsx)(zS,{label:`Refresh sessions`,onClick:()=>{n.refreshSessions(),n.refreshHosts()},children:(0,U.jsx)(G.Refresh,{className:t.sessionsLoading?`spin`:``})}),t.account?.loggedIn?(0,U.jsx)(zS,{label:`Import chats from your other coding agents`,onClick:()=>n.openDialog(`import-claude`),"data-testid":`open-import-claude`,children:(0,U.jsx)(G.Download,{})}):null,t.account?.loggedIn?(0,U.jsx)(zS,{label:`Export my chats`,onClick:()=>n.openDialog(`export-chats`),"data-testid":`open-export-chats`,children:(0,U.jsx)(G.Upload,{})}):null,t.account?.loggedIn&&!(t.currentSessionId&&t.remote.tabs[t.currentSessionId])?(0,U.jsx)(zS,{label:`Connect an AI tool — let it read your chats on this PC`,onClick:()=>n.openDialog(`connect-ai-tool`),"data-testid":`open-connect-ai-tool`,children:(0,U.jsx)(G.Plug,{})}):null,h===`projects`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(zS,{label:`Collapse all projects`,onClick:()=>te(!0),"data-testid":`projects-collapse-all`,children:(0,U.jsx)(G.CollapseAll,{})}),(0,U.jsx)(zS,{label:`Expand all projects`,onClick:()=>te(!1),"data-testid":`projects-expand-all`,children:(0,U.jsx)(G.ExpandAll,{})})]}):null,(0,U.jsx)(zS,{label:`Conversations — what your chats send each other`,onClick:()=>n.openConversations(),"data-testid":`open-conversations`,children:(0,U.jsx)(G.Chats,{})}),(0,U.jsx)(zS,{label:`What your chats are about — each chat’s about and what it cost`,onClick:()=>n.openChatAbouts(),"data-testid":`open-chat-abouts`,children:(0,U.jsx)(G.Info,{})}),(0,U.jsx)(zS,{label:`Project manager — review chats and suggest what to send each next`,onClick:()=>n.openProjectManager(),"data-testid":`open-project-manager`,children:(0,U.jsx)(G.Clipboard,{})}),(0,U.jsx)(zS,{label:r?`Hide the session list — it slides in when the pointer reaches the left edge`:`Pin the session list beside the chat`,className:H(`hidden md:inline-flex`,r?`text-accent`:`text-fg-muted`),"aria-pressed":r,onClick:()=>n.toggleSidebarPinned(),"data-testid":`sidebar-pin`,children:(0,U.jsx)(G.Pin,{})})]}),(0,U.jsx)(Jxe,{clock:p}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-1 pb-2`,children:(0,U.jsxs)(U.Fragment,{children:[j.length>0?(0,U.jsxs)(`div`,{className:`mb-1`,"data-testid":`section-pinned`,children:[(0,U.jsx)(`div`,{className:u9,children:(0,U.jsx)(`span`,{children:`Pinned`})}),j.map(e=>e.kind===`chat`?(0,U.jsx)(vI,{session:e.session,active:e.session.id===t.currentSessionId&&oe===null,link:t.sessionLinks[e.session.id]??null,menuOpen:c.menuFor===e.session.id,kindIcon:!0,testIdPrefix:`pinned-session`,...se},`chat:${e.session.id}`):(0,U.jsx)(Xxe,{project:e.project,sessions:e.sessions,active:oe?.kind===`project`&&oe.projectId===e.project.id,onOpen:w,onMenu:(t,n)=>u({target:{projectId:e.project.id,foldKey:null},at:t,el:n})},`project:${e.project.id}`))]}):null,(0,U.jsxs)(`div`,{className:`mb-1`,"data-testid":`sessions-local`,children:[t.sessionsError?(0,U.jsx)(`div`,{className:`px-2 py-2 text-xs text-danger`,children:t.sessionsError}):null,N?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{"data-testid":`section-today`,children:[(0,U.jsxs)(`div`,{className:u9,children:[(0,U.jsx)(`span`,{children:`Today`}),(0,U.jsx)(`span`,{className:`font-normal normal-case`,children:N.today.length||``}),(0,U.jsx)(`span`,{className:`flex-1`}),(0,U.jsx)(f9,{view:h,onChange:L})]}),ce??(N.today.length===0?(0,U.jsx)(`div`,{className:`px-3 py-1 text-xs text-fg-faint`,"data-testid":`today-empty`,children:D?`Nothing from today matches.`:`Nothing yet today.`}):N.today.map(e=>(0,U.jsx)(vI,{session:e,active:e.id===t.currentSessionId&&oe===null,link:t.sessionLinks[e.id]??null,menuOpen:c.menuFor===e.id,projectName:e.projectId?O.get(e.projectId)??null:null,...se},e.id)))]}),N.older.length>0?(0,U.jsxs)(`div`,{"data-testid":`section-older`,children:[(0,U.jsxs)(`div`,{className:u9,children:[(0,U.jsx)(`span`,{children:`Older`}),(0,U.jsx)(`span`,{className:`font-normal normal-case`,children:N.older.length})]}),N.older.map(e=>(0,U.jsx)(vI,{session:e,active:e.id===t.currentSessionId&&oe===null,link:t.sessionLinks[e.id]??null,menuOpen:c.menuFor===e.id,projectName:e.projectId?O.get(e.projectId)??null:null,...se},e.id))]}):null]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:u9,"data-testid":`section-by-project`,children:[(0,U.jsx)(`span`,{children:`By project`}),(0,U.jsx)(`span`,{className:`flex-1`}),(0,U.jsx)(f9,{view:h,onChange:L})]}),ce,ee.map(e=>{let r=`local:${e.key}`;return(0,U.jsxs)(`div`,{className:`mb-1 pl-2`,"data-testid":`project-group-${e.key}`,children:[(0,U.jsxs)(`div`,{className:`group relative flex items-center`,children:[(0,U.jsx)(eSe,{group:e,collapsed:x(e.key),onToggle:()=>S(e.key),onMenu:(t,n)=>u({target:{projectId:e.projectId,foldKey:e.key},at:t,el:n}),menuOpen:l?.target.foldKey===e.key}),e.projectId?(0,U.jsxs)(`div`,{className:`absolute right-1 hidden items-center rounded bg-surface/90 group-hover:flex group-focus-within:flex`,children:[(0,U.jsx)(zS,{label:`Settings of ${e.name}`,className:`p-1`,"data-testid":`project-settings-${e.key}`,onClick:t=>{t.stopPropagation(),n.openProjectSettings(e.projectId)},children:(0,U.jsx)(G.Settings,{className:`w-3.5 h-3.5`})}),(0,U.jsx)(zS,{label:`New chat in ${e.name}`,className:`p-1`,"data-testid":`project-new-chat-${e.key}`,onClick:t=>{t.stopPropagation(),n.newTab({projectId:e.projectId})},children:(0,U.jsx)(G.Plus,{className:`w-3.5 h-3.5`})})]}):null]}),x(e.key)?null:e.sessions.map(e=>(0,U.jsx)(vI,{session:e,active:e.id===t.currentSessionId&&oe===null,link:t.sessionLinks[e.id]??null,menuOpen:c.menuFor===e.id,...se},e.id))]},r)})]})]}),(0,U.jsxs)(`div`,{className:`mb-1`,"data-testid":`sessions-remote`,children:[(0,U.jsxs)(`button`,{type:`button`,className:l9,onClick:F,"aria-expanded":!y(`remote`),children:[(0,U.jsx)(G.Chevron,{open:!y(`remote`),className:`w-3 h-3`}),(0,U.jsx)(G.Globe,{className:`w-3 h-3`}),(0,U.jsx)(`span`,{className:`truncate`,children:`Remote`}),(0,U.jsx)(`span`,{className:`ml-auto font-normal`,children:P.length})]}),y(`remote`)?null:(0,U.jsxs)(U.Fragment,{children:[!t.remote.supported||t.remote.reason===`logged_out`?(0,U.jsx)(`div`,{className:`px-3 py-3 text-xs text-fg-faint`,children:`Sign in to see the sessions of your other devices.`}):P.length===0?(0,U.jsx)(`div`,{className:`px-3 py-3 text-xs text-fg-faint`,children:t.remote.loading?`Looking for your other devices…`:`No other devices yet.`}):null,P.map(e=>(0,U.jsx)(Zxe,{host:e,filter:D?k:null,collapsed:y(`host:${e.hostId}`)||i[`host:${e.hostId}`]===void 0,onToggle:()=>{let t=`host:${e.hostId}`,r=i[t]===void 0||i[t]===!0;a(e=>({...e,[t]:!r})),r&&n.refreshHostSessions(e.hostId)}},e.hostId))]})]})]})}),(0,U.jsx)(`div`,{className:`shrink-0 border-t border-border px-3 py-2 text-[11px] text-fg-faint`,children:(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsxs)(`button`,{type:`button`,"data-testid":`app-version`,title:`What's new in this version`,className:`truncate hover:text-fg hover:underline`,onClick:()=>n.openDialog(`whats-new`),children:[`OonaCode Desktop v`,f]}),(0,U.jsx)(zS,{label:`Lock this device — vault and sessions`,className:`p-1`,"data-testid":`lock-device`,onClick:()=>s(!0),children:(0,U.jsx)(G.Lock,{className:`h-3.5 w-3.5`})})]})}),(0,U.jsx)(HC,{open:l!==null,at:l?.at??{x:0,y:0},anchorEl:l?.el??null,label:`Project actions`,testId:`project-context-menu`,onClose:d,items:l?xI({projectId:l.target.projectId,pinned:l.target.projectId!==null&&Xl(g,`project`,l.target.projectId),fold:l.target.foldKey===null?null:{collapsed:x(l.target.foldKey),onToggle:()=>S(l.target.foldKey)},actions:n}):[]}),c.element,(0,U.jsx)(YS,{open:o,title:`Lock this device?`,confirmLabel:`Lock`,message:`Every chat closes and nothing on this PC can be read or run until you unlock — here with your password, or remotely from another device.`,onConfirm:()=>void n.lockDevice(),onClose:()=>s(!1)})]})}function Jxe({clock:e}){let{state:t,actions:n}=W(),[r,i]=(0,v.useState)(null),a=(0,v.useCallback)(()=>i(null),[]),o=t.page,s=()=>{window.innerWidth<768&&n.setSidebar(!1)};return(0,U.jsxs)(`div`,{className:`shrink-0 border-b border-border px-1 py-1`,"data-testid":`sidebar-nav`,children:[(0,U.jsxs)(`div`,{className:`flex items-center rounded-md hover:bg-surface-2`,children:[(0,U.jsxs)(`button`,{type:`button`,className:H(d9,`flex-1 hover:bg-transparent`),title:`New chat (Ctrl+T)`,onClick:()=>{n.newTab(),s()},"data-testid":`sidebar-new`,children:[(0,U.jsx)(G.Edit,{className:`w-4 h-4 shrink-0 text-fg-muted`}),(0,U.jsx)(`span`,{children:`New`})]}),(0,U.jsx)(zS,{label:`Start a new chat or a new project`,className:`mr-1 p-1`,"aria-haspopup":`menu`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();i({at:{x:t.left,y:t.bottom+2},el:e.currentTarget})},"data-testid":`sidebar-new-menu`,children:(0,U.jsx)(G.Chevron,{open:!0,className:`w-3.5 h-3.5`})})]}),(0,U.jsxs)(`button`,{type:`button`,className:H(d9,`w-full`,o?.kind===`projects`||o?.kind===`project`?`bg-surface-2 font-medium`:``),"aria-current":o?.kind===`projects`?`page`:void 0,onClick:()=>{n.openPage({kind:`projects`}),s()},"data-testid":`open-projects`,children:[(0,U.jsx)(G.Project,{className:`w-4 h-4 shrink-0 text-fg-muted`}),(0,U.jsx)(`span`,{children:`Projects`})]}),(0,U.jsx)(Yxe,{clock:e,active:o?.kind===`scheduled`,onOpen:()=>{n.openPage({kind:`scheduled`}),s()}}),(0,U.jsx)(HC,{open:r!==null,at:r?.at??{x:0,y:0},anchorEl:r?.el??null,label:`New`,testId:`sidebar-new-context-menu`,onClose:a,items:[{key:`chat`,label:`New chat`,hint:`Ctrl+T`,icon:(0,U.jsx)(G.Chats,{className:`w-3.5 h-3.5`}),onSelect:()=>{n.newTab(),s()},testId:`sidebar-new-chat`},{key:`project`,label:`New project…`,icon:(0,U.jsx)(G.Project,{className:`w-3.5 h-3.5`}),onSelect:()=>n.openNewProject(),testId:`sidebar-new-project`}]})]})}function Yxe({clock:e,active:t,onOpen:n}){let{tasks:r}=wI(),i=(0,v.useMemo)(()=>r?Cse(r,e):null,[r,e]);return(0,U.jsxs)(`button`,{type:`button`,className:H(d9,`w-full`,t?`bg-surface-2 font-medium`:``),"aria-current":t?`page`:void 0,onClick:n,title:i?.text??`Every scheduled task on this PC`,"data-testid":`open-scheduled`,children:[(0,U.jsx)(G.Clock,{className:`w-4 h-4 shrink-0 text-fg-muted`}),(0,U.jsx)(`span`,{className:`flex-1`,children:`Scheduled`}),i?(0,U.jsx)(`span`,{className:H(`mr-1 inline-block h-2 w-2 shrink-0 rounded-full`,i.tone===`stuck`?`bg-warn`:`bg-accent`),"aria-label":i.text,"data-testid":`scheduled-dot`,"data-tone":i.tone}):null]})}function f9({view:e,onChange:t}){let[n,r]=(0,v.useState)(null),i=(0,v.useCallback)(()=>r(null),[]),a=e=>e?(0,U.jsx)(G.Check,{className:`w-3.5 h-3.5 text-accent`}):(0,U.jsx)(`span`,{className:`w-3.5`});return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(zS,{label:`How the list is laid out`,className:`p-0.5 normal-case`,"aria-haspopup":`menu`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();r({at:{x:t.left,y:t.bottom+2},el:e.currentTarget})},"data-testid":`sidebar-view-options`,children:(0,U.jsx)(G.Sliders,{className:`w-3.5 h-3.5`})}),(0,U.jsx)(HC,{open:n!==null,at:n?.at??{x:0,y:0},anchorEl:n?.el??null,label:`How the list is laid out`,testId:`sidebar-view-menu`,onClose:i,items:[{key:`recent`,label:`Recent — Today, then Older`,icon:a(e===`recent`),onSelect:()=>t(`recent`),testId:`sidebar-view-recent`},{key:`projects`,label:`By project`,icon:a(e===`projects`),onSelect:()=>t(`projects`),testId:`sidebar-view-projects`}]})]})}function Xxe({project:e,sessions:t,active:n,onOpen:r,onMenu:i}){let a=(0,v.useRef)(null),o=e.sessionCount??t.length;return(0,U.jsxs)(`div`,{ref:a,className:H(`group relative flex items-center rounded-md`,n?`bg-accent-soft`:`hover:bg-surface-2`),onContextMenu:e=>{e.preventDefault(),i({x:e.clientX,y:e.clientY},a.current)},children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-2 py-1.5 pl-2 pr-8 text-left`,"aria-current":n?`page`:void 0,title:`Open ${e.name}`,onClick:()=>r(e.id),"data-testid":`pinned-project-${e.id}`,children:[(0,U.jsx)(G.Project,{className:`w-3.5 h-3.5 shrink-0 text-project`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg`,children:e.name}),(0,U.jsx)(hI,{sessions:t,testId:`pinned-project-busy-${e.id}`}),(0,U.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-3 px-1.5 py-px text-[10px] font-semibold text-fg-muted`,children:o})]}),(0,U.jsx)(zS,{label:`Project actions`,className:`pointer-events-none absolute right-1 bg-surface/90 p-1 opacity-0 group-focus-within:pointer-events-auto group-focus-within:opacity-100 group-hover:pointer-events-auto group-hover:opacity-100`,"data-testid":`pinned-project-menu-${e.id}`,onClick:e=>{e.stopPropagation();let t=e.currentTarget.getBoundingClientRect();i({x:t.left,y:t.bottom+2},a.current)},children:(0,U.jsx)(G.More,{className:`w-3.5 h-3.5`})})]})}function Zxe({host:e,collapsed:t,onToggle:n,filter:r=null}){let{state:i,actions:a}=W(),o=e.label||e.hostName,s=i.remote.sessions[e.hostId],c=(0,v.useMemo)(()=>{let t=s??[],n=new Set(t.map(e=>e.id)),r=[];for(let[t,a]of Object.entries(i.remote.tabs)){if(a.hostId!==e.hostId||n.has(t))continue;let o=i.transcripts[t]?.session??i.sessions.find(e=>e.id===t)??null;if(o){r.push(o),n.add(t);continue}let s=i.drafts[t];if(s){let e=new Date(s.createdAt).toISOString();r.push({id:s.id,projectKey:`draft`,cwd:s.projectDir??``,projectDir:s.projectDir??null,projectId:s.projectId??null,title:s.title??`New chat`,firstPrompt:null,lastPrompt:null,providerId:s.providerId??null,variantId:s.variantId??null,model:s.model??null,permissionMode:s.permissionMode??`default`,posture:s.posture??`build`,...s.effort?{effort:s.effort}:{},status:`idle`,createdAt:e,updatedAt:e,mtime:s.createdAt,entryCount:0,totalCostUsd:0,inputTokens:0,outputTokens:0,poolCredits:0,hasSubagents:!1,forkedFrom:null,engineSince:null,finishedUnseen:null}),n.add(t)}}if(s!==void 0||r.length!==0)return r.length>0?[...r,...t]:s},[s,i.remote.tabs,i.transcripts,i.sessions,i.drafts,e.hostId]),l=r&&c?c.filter(r):c,u=i.remote.unreachable[e.hostId],d=u?Em(u.reason,o,u.detail):null,[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(null),[y,b]=(0,v.useState)(null),x=(0,v.useCallback)(()=>b(null),[]),S=e.remoteAccessOff===!0;return(0,v.useEffect)(()=>{if(t||S||!e.online||!u)return;let n=setTimeout(()=>{a.refreshHostSessions(e.hostId)},3e3);return()=>clearTimeout(n)},[t,S,e.online,u,e.hostId,a]),(0,U.jsxs)(`div`,{className:`mb-1 pl-2`,"data-testid":`remote-host-${e.hostId}`,children:[(0,U.jsxs)(`div`,{className:`group relative flex items-center`,children:[(0,U.jsxs)(`button`,{type:`button`,className:l9,onClick:n,"aria-expanded":!t,title:e.online?`${o} — online`:`${o} — offline: its chats can be read while it is online`,children:[(0,U.jsx)(G.Chevron,{open:!t,className:`w-3 h-3`}),(0,U.jsx)(`span`,{className:H(`inline-block h-2 w-2 shrink-0 rounded-full`,e.online?`bg-ok`:`bg-fg-faint`),"aria-label":e.online?`online`:`offline`}),(0,U.jsx)(`span`,{className:`truncate normal-case`,children:o}),S?(0,U.jsx)(`span`,{className:`shrink-0 rounded-full bg-warn-soft px-1.5 text-[10px] font-normal normal-case text-warn`,"data-testid":`remote-off-${e.hostId}`,children:`remote access off`}):null,(0,U.jsx)(`span`,{className:`ml-auto font-normal`,children:!S&&l?l.length:``})]}),(0,U.jsxs)(`div`,{className:`absolute right-1 hidden items-center rounded bg-surface/90 group-hover:flex group-focus-within:flex`,children:[(0,U.jsx)(zS,{label:S?Tm(o):e.online?`New chat on ${o}`:`${o} is offline — a new chat has to start on a PC that is awake`,className:`p-1`,disabled:!e.online||S,"data-testid":`remote-new-chat-${e.hostId}`,onClick:()=>void a.newRemoteTab(e.hostId),children:(0,U.jsx)(G.Plus,{className:`w-3 h-3`})}),(0,U.jsx)(zS,{label:`Unlock this device`,className:`p-1`,disabled:S,"data-testid":`remote-unlock-${e.hostId}`,onClick:()=>p(`unlock`),children:(0,U.jsx)(G.Lock,{className:`w-3 h-3`})}),(0,U.jsx)(zS,{label:`Rename device`,className:`p-1`,onClick:()=>p(`rename`),children:(0,U.jsx)(G.Edit,{className:`w-3 h-3`})})]}),(0,U.jsx)(ZS,{open:f===`unlock`,title:`Unlock "${o}" remotely`,label:`Your account password — it never leaves this PC: the keys are sealed to that device and the server cannot read them.`,password:!0,submitLabel:`Unlock`,onSubmit:t=>void a.remoteUnlockHost(e.hostId,t),onClose:()=>p(null)}),(0,U.jsx)(ZS,{open:f===`rename`,title:`Rename device`,label:`Device name`,initialValue:o,onSubmit:t=>{t!==o&&a.renameHost(e.hostId,t)},onClose:()=>p(null)})]}),!t&&S?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-warn`,"data-testid":`remote-off-note-${e.hostId}`,children:Tm(o)}):t?null:l===void 0?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-faint`,children:`Loading…`}):l.length===0&&d?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-warn`,"data-testid":`remote-unreachable-${e.hostId}`,children:d}):l.length===0?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-faint`,children:r&&c&&c.length>0?`No chats here match the filter.`:`No sessions on this device.`}):l.map(t=>(0,U.jsx)(Qxe,{host:e,session:t,active:t.id===i.currentSessionId&&i.page===null,menuOpen:y?.session.id===t.id,onMenu:(e,t,n)=>b({session:e,at:t,el:n}),onRename:()=>h(t),onConfirmDelete:()=>_(t)},t.id)),(0,U.jsx)(HC,{open:y!==null,at:y?.at??{x:0,y:0},anchorEl:y?.el??null,label:`Chat actions`,testId:`remote-session-context-menu`,onClose:x,items:y?yI({session:y.session,link:null,pinned:Xl(i.prefs.pinned,`chat`,y.session.id),actions:{...a,selectSession:t=>{t?a.openRemoteSession(e.hostId,t):a.selectSession(null)}},onSync:()=>void 0,onRename:()=>h(y.session),onDelete:()=>_(y.session)}):[]}),(0,U.jsx)(ZS,{open:m!==null,title:`Rename chat`,label:`Chat title (leave empty to reset)`,initialValue:m?m.title??J_(m):``,onSubmit:t=>{m&&(i.drafts[m.id]?a.renameTab(m.id,t):a.renameRemoteSession(e.hostId,m.id,t))},onClose:()=>h(null)}),(0,U.jsx)(YS,{open:g!==null,title:`Delete this chat?`,message:`It is deleted on ${e.hostName} — the only place it is kept — so it is gone from every device. Files, folders and code on that PC are not touched — only the chat is deleted.`,onConfirm:()=>{g&&(i.drafts[g.id]?a.closeTab(g.id):a.deleteRemoteSession(e.hostId,g.id))},onClose:()=>_(null)})]})}function Qxe({host:e,session:t,active:n,menuOpen:r=!1,onMenu:i,onRename:a,onConfirmDelete:o}){let{actions:s}=W(),c=J_(t),l=(0,v.useRef)(null),u=(0,v.useRef)(null),[d,f]=(0,v.useState)(null),p=(0,v.useCallback)(()=>{u.current!==null&&(clearTimeout(u.current),u.current=null),f(null)},[]),m=(0,v.useRef)(r);return m.current=r,(0,v.useEffect)(()=>{r&&p()},[r,p]),(0,v.useEffect)(()=>{if(d===null)return;let e=e=>{VC(e.target,l.current)&&p()};return window.addEventListener(`scroll`,e,!0),()=>window.removeEventListener(`scroll`,e,!0)},[d,p]),(0,v.useEffect)(()=>()=>{u.current!==null&&clearTimeout(u.current)},[]),(0,U.jsxs)(`div`,{ref:l,className:H(`group relative flex items-center rounded-md`,n?`bg-accent-soft`:`hover:bg-surface-2`),onMouseEnter:()=>{u.current!==null&&clearTimeout(u.current),!m.current&&(u.current=setTimeout(()=>{u.current=null,l.current&&!m.current&&f(l.current.getBoundingClientRect())},450))},onMouseLeave:p,onClick:p,onContextMenu:e=>{e.preventDefault(),p(),i(t,{x:e.clientX,y:e.clientY},l.current)},children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{s.openRemoteSession(e.hostId,t.id),window.innerWidth<768&&s.setSidebar(!1)},className:`flex min-w-0 flex-1 items-center gap-2 px-2 py-1.5 text-left`,"aria-current":n?`true`:void 0,"data-testid":`remote-session-${t.id}`,title:e.online?void 0:`Read-only until that PC is online`,children:[(0,U.jsx)(mI,{status:t.status}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:H(`truncate text-sm`,n?`font-medium`:``),children:c}),(0,U.jsxs)(`div`,{className:`truncate text-[11px] text-fg-faint`,children:[U_(t.updatedAt),t.model?` · ${t.model}`:``,e.online?``:` · read-only`]})]})]}),(0,U.jsxs)(`div`,{className:`mr-1 hidden items-center gap-0.5 rounded bg-surface/90 group-hover:flex group-focus-within:flex`,children:[(0,U.jsx)(zS,{label:e.online?`Rename this chat`:`That PC is asleep — a chat can only be renamed while the PC that holds it is online`,className:`p-1 disabled:opacity-40`,disabled:!e.online,"data-testid":`remote-session-rename-${t.id}`,onClick:()=>{a()},children:(0,U.jsx)(G.Edit,{className:`w-3.5 h-3.5`})}),(0,U.jsx)(zS,{label:e.online?`Delete this chat`:`That PC is asleep — a chat can only be deleted while the PC that holds it is online`,className:`p-1 hover:text-danger disabled:opacity-40`,disabled:!e.online,"data-testid":`remote-session-delete-${t.id}`,onClick:()=>{o()},children:(0,U.jsx)(G.Trash,{className:`w-3.5 h-3.5`})}),(0,U.jsx)(zS,{label:`Chat actions`,className:`p-1`,"data-testid":`remote-session-menu-${t.id}`,onClick:e=>{e.stopPropagation(),p();let n=e.currentTarget.getBoundingClientRect();i(t,{x:n.left,y:n.bottom+2},l.current)},children:(0,U.jsx)(G.More,{className:`w-3.5 h-3.5`})})]}),d===null?null:(0,U.jsx)(_I,{session:t,anchor:d})]})}function $xe(){let{state:e}=W(),t=typeof window<`u`?window.oonacode:void 0;return zx(t?.appVersion??e.bundleAppVersion??e.connection.appVersion??e.info?.appVersion??`0.0.0`,Rx({bridge:t,info:e.info}))}function eSe({group:e,collapsed:t,onToggle:n,onMenu:r,menuOpen:i=!1}){let a=(0,v.useRef)(null),o=(0,v.useRef)(null),[s,c]=(0,v.useState)(null),l=(0,v.useCallback)(()=>{o.current!==null&&(clearTimeout(o.current),o.current=null),c(null)},[]),u=(0,v.useRef)(i);return u.current=i,(0,v.useEffect)(()=>{i&&l()},[i,l]),(0,v.useEffect)(()=>{if(s===null)return;let e=e=>{VC(e.target,a.current)&&l()};return window.addEventListener(`scroll`,e,!0),()=>window.removeEventListener(`scroll`,e,!0)},[s,l]),(0,v.useEffect)(()=>()=>{o.current!==null&&clearTimeout(o.current)},[]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`button`,{ref:a,type:`button`,className:Kxe,onClick:()=>{l(),n()},onMouseEnter:()=>{o.current!==null&&clearTimeout(o.current),!u.current&&(o.current=setTimeout(()=>{o.current=null,a.current&&!u.current&&c(a.current.getBoundingClientRect())},450))},onMouseLeave:l,onContextMenu:e=>{e.preventDefault(),l(),r({x:e.clientX,y:e.clientY},a.current)},"aria-expanded":!t,"data-testid":`project-header-${e.key}`,children:[(0,U.jsx)(G.Chevron,{open:!t,className:`w-3 h-3 shrink-0`}),(0,U.jsx)(G.Project,{className:`w-3.5 h-3.5 shrink-0 text-project`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.name}),(0,U.jsx)(hI,{sessions:e.sessions,testId:`project-busy-${e.key}`}),(0,U.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full bg-surface-3 px-1.5 py-px text-[10px] font-semibold normal-case tracking-normal text-fg-muted`,"data-testid":`project-count-${e.key}`,children:e.sessions.length})]}),s===null?null:(0,U.jsx)(tSe,{group:e,anchor:s})]})}function tSe({group:e,anchor:t}){let{state:n}=W(),r=e.projectId?n.vaultProjects.find(t=>t.id===e.projectId):void 0,i=e.sessions.filter(e=>e.status===`running`||e.status===`waiting_permission`).length,a=e.sessions.reduce((e,t)=>e===null||t.updatedAt>e?t.updatedAt:e,null),o=[...new Set(e.sessions.map(e=>e.projectDir??e.cwd).filter(e=>typeof e==`string`&&e.length>0))],s=r?.instructions?.trim()??``,c=Math.max(8,Math.min(t.right+8,window.innerWidth-304-8)),l=Math.max(8,Math.min(t.top,window.innerHeight-320));return(0,NS.createPortal)((0,U.jsxs)(`div`,{role:`tooltip`,"data-testid":`project-details-${e.key}`,className:`fixed z-50 max-h-[20rem] w-[19rem] overflow-y-auto rounded-lg border border-border bg-surface p-3 text-xs shadow-lg`,style:{left:c,top:l},children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5`,children:[(0,U.jsx)(G.Project,{className:`w-3.5 h-3.5 shrink-0 text-project`}),(0,U.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.name})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(gI,{label:`Chats`,value:String(e.sessions.length)}),(0,U.jsx)(gI,{label:`Working now`,value:i>0?String(i):null}),(0,U.jsx)(gI,{label:`Last activity`,value:a?U_(a):null}),(0,U.jsx)(gI,{label:o.length>1?`Folders`:`Folder`,value:o.length>1?`${o.length} folders`:o[0]??null})]}),e.projectId?(0,U.jsxs)(`div`,{className:`mt-2 border-t border-border pt-2`,children:[(0,U.jsx)(`div`,{className:`mb-1 text-fg-faint`,children:`Standing instructions`}),s?(0,U.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-fg`,"data-testid":`project-instructions-${e.key}`,children:s.length>400?`${s.slice(0,400)}…`:s}):(0,U.jsx)(`div`,{className:`text-fg-faint`,children:`None — chats here start with nothing extra.`})]}):(0,U.jsx)(`div`,{className:`mt-2 border-t border-border pt-2 text-fg-faint`,children:`Chats filed under no project.`})]}),document.body)}var p9=`(min-width: 768px)`;function m9(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(p9).matches}function nSe(){let[e,t]=(0,v.useState)(m9);return(0,v.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(p9),n=()=>t(e.matches);return n(),e.addEventListener?.(`change`,n),()=>e.removeEventListener?.(`change`,n)},[]),e}function rSe(e){try{return!!e?.matches(`:hover`)}catch{return!1}}function iSe(e){if(typeof document>`u`)return!1;if(document.querySelector(`[role="menu"], [role="dialog"]`))return!0;let t=document.activeElement;return!!(e&&t&&e.contains(t)&&t.tagName===`INPUT`)}function aSe({hidden:e,collapsed:t=!1,peekAsk:n=0,children:r}){let{state:i,actions:a}=W(),o=i.ui.sidebarPinnedOverride??i.prefs.sidebarPinned,s=i.ui.sidebarOpen,[c,l]=(0,v.useState)(null),u=c??i.prefs.sidebarWidth,[d,f]=(0,v.useState)(!1),p=nSe(),m=(0,v.useRef)(null),h=(0,v.useRef)(null),g=(0,v.useCallback)(()=>{h.current!==null&&(clearTimeout(h.current),h.current=null)},[]),_=(0,v.useCallback)(()=>{g(),h.current=setTimeout(function e(){if(iSe(m.current)){h.current=setTimeout(e,350);return}h.current=null,!rSe(m.current)&&f(!1)},350)},[g]);(0,v.useEffect)(()=>g,[g]),(0,v.useEffect)(()=>{f(!1),g()},[o,g]);let y=(0,v.useRef)(n);(0,v.useEffect)(()=>{n!==y.current&&(y.current=n,!(e||o||!m9())&&(f(!0),_()))},[n,e,o,_]),(0,v.useEffect)(()=>{if(e)return;let t=e=>{if(!(!(e.ctrlKey||e.metaKey)||e.shiftKey||e.altKey)&&(e.key===`k`||e.key===`K`)){if(m9()){if(o)return;f(!0),_()}else s||a.setSidebar(!0)}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,o,s,_,a]);let b=e=>{e.preventDefault();let t=e.clientX,n=u,r=n,o=e=>{r=Rl(n+(e.clientX-t)),l(r)},s=()=>{window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),document.body.style.cursor=``,document.body.style.userSelect=``,l(null),r!==i.prefs.sidebarWidth&&a.savePrefs({sidebarWidth:r})};document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s)},x=o||d;return(0,U.jsxs)(U.Fragment,{children:[!o&&!d&&!e&&!t?(0,U.jsx)(`div`,{className:`absolute inset-y-0 left-0 z-40 hidden w-2 md:block`,onMouseEnter:()=>{f(!0),_()},"aria-hidden":!0,"data-testid":`sidebar-hover-edge`}):null,(0,U.jsxs)(`aside`,{ref:m,"data-chrome":`sidebar`,"data-font-scope":`sidebar`,hidden:e,inert:!e&&(p?!x||t:!s),"data-testid":`sidebar-frame`,"data-state":t?`collapsed`:o?`docked`:d?`peek`:`hidden`,style:{"--sidebar-w":`${u}px`},onMouseEnter:o?void 0:g,onMouseLeave:o?void 0:_,className:H(`absolute inset-y-0 left-0 z-30 w-72 max-w-[85vw] border-r border-border bg-surface transition-transform md:w-[var(--sidebar-w)] md:max-w-[70vw]`,s?`translate-x-0`:`-translate-x-full`,o?`md:relative md:z-auto md:translate-x-0`:H(`md:z-40 md:shadow-2xl`,x?`md:translate-x-0`:`md:-translate-x-full`),t&&`md:hidden`),children:[r,(0,U.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the session list`,title:`Drag to resize · double-click for the default width`,className:`absolute inset-y-0 -right-1 z-10 hidden w-2 cursor-col-resize hover:bg-accent/30 md:block`,onPointerDown:b,onDoubleClick:()=>void a.savePrefs({sidebarWidth:288}),"data-testid":`sidebar-resize`})]})]})}var h9=[{id:`sessions`,title:`Sessions`,label:`Sessions`,icon:G.Chats},{id:`search`,title:`Search`,label:`Search chats and files (Ctrl+K)`,icon:G.Search},{id:`files`,title:`Files`,label:`Files of this chat`,icon:G.Folder}];function oSe({hidden:e=!1}){let{state:t,actions:n}=W(),r=t.prefs.leftPanelSection,i=t.prefs.leftPanelOpen,a=t.ui.sidebarPinnedOverride??t.prefs.sidebarPinned,[o,s]=(0,v.useState)(0),[c,l]=(0,v.useState)(0),[u,d]=(0,v.useState)(()=>new Set([r]));(0,v.useEffect)(()=>{d(e=>e.has(r)?e:new Set([...e,r]))},[r]),(0,v.useEffect)(()=>{if(e)return;let t=e=>{!(e.ctrlKey||e.metaKey)||e.shiftKey||e.altKey||(e.key===`k`||e.key===`K`)&&window.oonacode?.host!==`vscode`&&(e.preventDefault(),n.showLeftSection(`search`),l(e=>e+1))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,n]);let f=e=>{let t=Yb({section:r,open:i},e,a);(t.section!==r||t.open!==i)&&n.savePrefs(Kb(t.section,t.open)),a||s(e=>e+1),t.open&&e===`search`&&l(e=>e+1)},p=h9.map(e=>({id:e.id,label:e.label,icon:e.icon,active:i&&e.id===r})),m=e=>e===`sessions`?(0,U.jsx)(qxe,{onOpenSearch:()=>l(e=>e+1)}):e===`search`?(0,U.jsx)(Vxe,{active:r===`search`,focusAsk:c}):(0,U.jsx)(e9,{});return(0,U.jsxs)(U.Fragment,{children:[e?null:(0,U.jsx)(`div`,{className:`hidden border-r border-border md:flex`,children:(0,U.jsx)(L7,{items:p,testId:`activity-bar-left`,label:`Side bar`,onPick:f})}),(0,U.jsx)(`div`,{className:`contents md:relative md:flex md:shrink-0`,children:(0,U.jsx)(aSe,{hidden:e,collapsed:!i,peekAsk:o,children:(0,U.jsxs)(`div`,{className:`flex h-full w-full flex-col`,"data-testid":`left-dock`,"data-section":r,children:[(0,U.jsx)(sSe,{section:r,onPick:e=>{n.showLeftSection(e),e===`search`&&l(e=>e+1)}}),wl.filter(e=>u.has(e)||e===r).map(e=>(0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,hidden:e!==r,"data-testid":`left-section-${e}`,children:m(e)},e))]})})})]})}function sSe({section:e,onPick:t}){return(0,U.jsx)(`div`,{className:`flex shrink-0 gap-1 border-b border-border p-1 md:hidden`,role:`tablist`,"aria-label":`Side bar`,children:h9.map(n=>(0,U.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n.id===e,onClick:()=>t(n.id),className:H(`flex flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1 text-xs`,n.id===e?`bg-surface-2 font-medium text-fg`:`text-fg-muted hover:bg-surface-2 hover:text-fg`),"data-testid":`left-tab-${n.id}`,children:[(0,U.jsx)(n.icon,{className:`w-3.5 h-3.5`}),n.title]},n.id))})}var g9={autosaveFiles:{hint:`Save a file as soon as you change it. Off by default.`,details:[`Applies to text files opened in this window’s file viewer.`,`While off, a changed file shows * on its tab and Ctrl+S saves it.`,`A file opened from another PC stays read-only.`]},autoAccept:{hint:`Allow every tool the agent wants to use, without asking you. Off by default.`,details:[`Answered by this PC itself, so it covers EVERY chat running here — started in this app, the oona terminal, your phone, Telegram, the website or another PC.`,`The agent’s questions to you (its multiple-choice cards) still wait for your answer.`,`A chat set to Ask first in the composer still asks you before each tool — that is what Ask first means.`,`Subagents never ask: their tool requests are always allowed.`,`Takes effect at the next tool request, even in a chat that is already working.`,`What a chat may attempt at all is still its own Build / Plan / Ask first / Autonomous choice in the composer; this only answers the prompts it would have shown you.`]},reasoning:{hint:`Show the model’s thinking between its messages.`,details:[`Display only — the model thinks the same either way.`,`Hidden thinking is also left out of chat search (Ctrl+F).`,`For the windows this PC serves (this app, the local web UI). The phone has its own switch.`]},colourScheme:{hint:`System follows your desktop’s light or dark setting: the operating system’s app mode (Windows: Settings → Personalisation → Colours → “Choose your default app mode”).`,details:[`Also colours this window’s title bar and menu.`,`Your own colours per element are under Theme.`]},notifications:{hint:`Desktop notifications from this app while its window is not in front.`,details:[`Nothing pops up while you are looking at the window.`,`Your phone’s push notifications are separate: the phone buzzes only while no window on this PC is open.`]},notifyFinished:{hint:`When a chat’s turn ends — finished, or failed.`,details:[`Named after the chat; clicking the notification opens it.`]},notifyWaiting:{hint:`When a chat waits for you: a permission, or one of the agent’s questions.`,details:[`With auto-accept on, only the agent’s questions still wait for you, so only they notify.`]},notifyError:{hint:`When a chat stops on an error.`,details:[`The error itself is also written into the chat.`]},transcriptWindow:{hint:`How many messages and tool cards of a chat stay drawn; older ones leave the top like a stack and come back when you scroll up.`,details:[`Only what is DRAWN: the whole chat is still kept, and still searched.`,`Smaller is faster on long agentic chats; larger keeps more on screen.`]},defaultCwd:{hint:`The folder a new chat runs in when it is not given one. Empty: each chat gets its own private folder.`,details:[`A folder here becomes each new chat’s project: its CLAUDE.md, .claude settings, hooks and skills load. Your home folder and drive roots never load as a project.`,`Empty is the safe default: the agent then works only inside that chat’s own folder under OonaCode’s data directory.`,`Used by chats started in this app. A project’s own folder (Projects → New chats) wins over it; the oona terminal always uses the folder you run it in.`]},remoteAccess:{hint:`Let your phone, Telegram, the website and your other PCs reach this PC.`,details:[`This PC keeps one outbound, end-to-end encrypted channel to your OonaCode server; every other device reaches it through that channel alone.`,`It is also how they read this PC’s chats: the chats are kept only here, never on our server, so they can be read while this PC is on and reachable.`,`Off: they still see this PC online, marked “remote access off”, and cannot list or open its chats, send prompts, unlock it remotely or delete its chats. This PC also cannot open chats on your other PCs.`,`Takes effect immediately.`]},telegram:{hint:`Let the OonaCode Telegram bot list, read, continue and delete this PC’s chats. Off by default.`,details:[`The bot reaches this PC through OonaCode’s server, and what you send and receive in Telegram passes through that server unencrypted — Telegram can read it too. Everything else stays end-to-end encrypted.`,`Off: this PC refuses every Telegram request, even from your own Telegram account, and a chat open in Telegram is closed at once. The bot says how to turn it back on.`,`Only this PC can turn it on — not the website, the phone or the bot.`,`Needs Remote access on as well, and Telegram connected to your account in the bot (/connect).`]},imageRetention:{hint:`Pictures in this PC’s chat history older than this are replaced with a short note. 0 keeps them forever. Default: a year.`,details:[`Replaced: the pictures stored in this PC’s chats — screenshots and other pictures a tool returned, and pictures you pasted into a message — once they are older than this.`,`Each becomes a one-line note saying a picture was there, why and when it went, e.g. “[Picture removed after 365 days to save space — picture from a tool (PNG), 412 KB]”.`,`Not affected: the words of every chat, and the files on your disk. The chat continues normally — the model no longer needs pictures that old.`,`Runs by itself: a few minutes after this PC’s OonaCode starts, then once a day, in small steps that never hold up a chat. A chat that is working, or was in the last hour, is done at the next run.`,`The database file stops growing from pictures; it does not shrink. The space is reused for new chats.`,`Only this PC holds its chats, so this is every copy there is.`]},chatAbout:{hint:`A short note per chat saying what it works on, which your other chats read through “Talk to other chats”. On by default.`,details:[`Written in the background by each chat’s housekeeper — the cheap helper model of the chat’s own provider — after a turn ends, only when the chat changed since, and at most once per interval below.`,`The same switch covers Regenerate (in a chat’s session info) and “Generate for all chats now” (View → What chats are about…). Off stops all three, so nothing is spent on abouts.`,`Paid by the chat’s own route: an OonaCode pool chat spends credits, your own API key is billed by your provider, and your own subscription’s plan covers it.`,`An about is part of its chat and stays on this PC: it is never uploaded to our server, and your other devices read it from this PC, like the chat.`]},providerUsagePing:{hint:`When you look at a provider’s usage card and its last figure is old, check it with one tiny request. On by default.`,details:[`Applies to providers you use with your OWN key or subscription — your Claude plan, an own DeepSeek, OpenAI, xAI, MiMo or Alibaba key, a ChatGPT plan, Meta’s Muse key. Google’s agy and SuperGrok have a usage report of their own, and the OonaCode pool shows credits instead: they are never checked.`,`Only when you look: opening the model picker’s card, or resting the pointer on the picker’s box while one of those models is active. Never in the background, and never while the last figure is younger than the time below.`,`The check is one “reply PONG” request of a few tokens, sent from this PC straight to the provider with your own plan or key — so it spends a few tokens of THEM, and nothing about it goes through our servers. Your Claude plan is asked through the genuine Claude engine, as a chat message is.`,`Only the rate-limit figures in the answer are kept (on this PC, with the time they were seen); the answer itself is thrown away. Off: the card shows the last figures it saw, or nothing, and never asks.`]},providerUsageStale:{hint:`How old the last usage figure may be before a look at the card checks again.`,details:[`0 never checks on a look (the card shows what it last saw). A card opened sooner than this after the last figure does not ask the provider anything.`,`A check that failed is not repeated for ten minutes, and “Check now” on the card makes at most one a minute.`]},chatAboutInterval:{hint:`At most one background about per chat in this many minutes.`,details:[`Only the background job waits for it: Regenerate and “Generate for all chats now” write at once.`,`A background about is written only after a turn ends and only when the chat changed, so a chat nobody uses costs nothing, whatever this says.`,`Shorter keeps abouts fresher and makes more calls.`]},chatAboutMaxWords:{hint:`The longest about the housekeeper may write.`,details:[`A longer answer is cut at this many words.`,`Applies to every about the housekeeper writes: in the background, by Regenerate and by “Generate for all chats now”. An about you write yourself may be longer (up to 2,000 characters).`,`A longer about costs a few more output tokens, and a chat that lists your chats reads every one of them.`]},chatAboutInputChars:{hint:`How much of a chat the housekeeper reads to write its about.`,details:[`Taken from the chat’s title, project and folder, its previous about, your first message, the newest summary of the earlier conversation, your latest messages and the agent’s last answer — each with a share, so no part crowds out the others.`,`Applies to the background job, Regenerate and “Generate for all chats now”.`,`Most of what a call costs: roughly a quarter as many tokens as characters. More gives a better-informed about and costs more.`]},safeguardFallback:{hint:`When a model refuses a message on content or safety grounds, run that one message once more on another model. On by default.`,details:[`Decided by this PC itself, for EVERY chat running here — started in this app, the oona terminal, your phone, Telegram, the website or another PC.`,`Only that message is sent to the other model; the chat stays on the model you picked. The refusal and the retry are both written into the chat, and the turn line says what happened.`,`Switch automatically: the best other model your chat’s route can serve — a Claude chat tries other Claude models first. Always switch to: the model you choose, every time. Never: the refusal is shown and nothing is retried.`,`OonaCode pool: the model that answers is charged at its own price. Your own key or subscription never switches to another provider — only to another model of the same one.`,`A fallback you set for one model (below) beats this choice, and a chat’s own --fallback-model (terminal, agent API) beats both.`,`Limit: Claude Code’s own engine still moves Opus 5, Opus 5.5 and Fable chats to Opus 4.8 by itself when their safeguards refuse — it cannot be switched off.`,`One retry only: if the second model refuses too, the chat says so and stops.`]},safeguardPerModel:{hint:`Pick the fallback for one model. It beats the choice above for that model only; “Never fall back” stops a model from being retried.`,details:[`Applies when the refused model is the one you name here, in any chat on this PC, however it was started.`,`A model you use through your own key or subscription can only fall back to a model of the same provider; an OonaCode pool model can fall back to any pool model.`,`Up to 64 models. A chat’s own --fallback-model still beats this table.`,`Charged by the model that answers: pool credits at its price, or your own key or plan.`]},keepUnlocked:{hint:`Leave your vault unlocked when you close or quit the app.`,details:[`Off (default): closing the window — to the tray too — or quitting stops the chats that are running and locks this PC until you unlock it. Your phone and other devices cannot use it meanwhile.`,`On: chats keep running and your other devices keep working after the window is closed. Choose it on a PC only you use.`]},server:{hint:`Your account’s OonaCode server.`,details:[`Where your account lives: sign-in, OonaCode-pool models and credits, your encrypted vault, remote access, and app updates.`,`Your own API keys and subscriptions never go through it — this PC calls those providers directly.`,`Set by signing in. (Developers point a build at another server with OONACODE_GATEWAY_URL.)`]},diagnostics:{hint:`While you are signed in, this PC sends OonaCode its warnings and errors, and a short report of any turn that fails.`,details:[`A report names the error, the model and the provider — never the content of your chats.`,`It is how bugs you never reported get fixed. There is no usage tracking.`]},allowDebugging:{hint:`Let a debugger attach to this app’s windows, to see and control them while fixing a bug. Off by default. Takes effect when OonaCode restarts.`,details:[`For finding bugs together: DevTools (chrome://inspect), Playwright or another Chrome DevTools Protocol client attaches to every window of this app — reads what it shows, clicks, types and runs code in it.`,`The risk: while it is on, ANY program on this PC can do the same — read your chats on screen and act as you in OonaCode, with no prompt. Turn it on only while you need it.`,`Only on this PC: the port is opened on 127.0.0.1, never on the network, and web pages in your browser cannot connect to it.`,`Desktop app only, this PC only: the local web UI in a browser, the phone, Telegram and your other PCs are not affected.`,`Read when the app starts, so a change applies at the next start (Restart now). The host service and your chats keep running through the restart.`,`While it is on, every window shows a red “Debugging on” badge and says so in its title.`]},debugPort:{hint:`The port on 127.0.0.1 a debugger connects to.`,details:[`Connect with http://127.0.0.1:<port> — e.g. chrome://inspect → Configure… → localhost:<port>, or Playwright’s connectOverCDP.`,`A port another program already uses is refused when you save.`,`With “Also debug the main process”, the next port is taken too.`]},debugMainProcess:{hint:`Also open Node’s inspector for the app’s main process, on the next port.`,details:[`For bugs in the desktop shell itself (windows, menus, updates, the tray), not in a window’s page.`,`Gives full control of the main process — it can run any program as you. Off unless you choose it.`,`Applies only while “Allow debugging” is on, at the next start.`]}};function cSe(e){if(!Lc(e))return`Off in this run: no debugging port is open.`;let t=[];return e.port!==null&&t.push(e.listening?`On in this run: windows on 127.0.0.1:${e.port}${e.fromCommandLine?` (from the command line)`:``}.`:`Port ${e.port} could not be opened — another program may be using it.`),e.inspectPort!==null&&t.push(e.inspectProblem?`Main-process inspector: ${e.inspectProblem}`:`Main process on 127.0.0.1:${e.inspectPort}.`),t.join(` `)}function lSe(e){return Rc(e.saved,e.running)}function uSe(e){return`Debugging is on: ${zc(e)}. While it is on, any program on this PC can read and control OonaCode. Click to change it in Settings → Developer.`}function dSe({providerId:e,configured:t}){let{api:n,state:r,actions:i}=W(),[a,o]=(0,v.useState)(null);return(0,v.useEffect)(()=>{if(t||!n.getAgyStatus)return;let e=!0;return n.getAgyStatus().then(t=>{e&&o({state:t.state,install:t.install})},()=>{e&&o(null)}),()=>{e=!1}},[n,t,r.providers]),(0,U.jsx)(K,{size:`sm`,variant:t?`secondary`:`primary`,onClick:()=>i.openProviderConnect(e),"data-testid":`agy-provider-button`,children:hbe(t,a)})}function _9(e,t){return t.get(e.providerId)??e.providerId}function fSe(e,t,n){let r=mm(t);if(!r)return[];let i=e.find(e=>e.models.some(e=>e.value===t)),a=gl(r.modelId);return(vl(r.providerId)?e.filter(e=>vl(e.providerId)):e.filter(e=>!vl(e.providerId)&&_9(e,n)===(i?_9(i,n):r.providerId))).map(e=>({...e,models:e.models.filter(e=>gl(e.modelId)!==a)})).filter(e=>e.models.length>0)}function v9({groups:e}){return(0,U.jsx)(U.Fragment,{children:e.map(e=>(0,U.jsx)(`optgroup`,{label:e.label,children:e.models.map(e=>(0,U.jsx)(`option`,{value:e.value,children:e.label},e.value))},`${e.providerId}:${e.variantId??``}`))})}var pSe=[{mode:`auto`,label:`Switch to another model automatically`,hint:`The best other model this chat can use. A Claude chat tries other Claude models first.`},{mode:`model`,label:`Always switch to:`,hint:`The model you choose, every time a model refuses.`},{mode:`off`,label:`Never — show the refusal`,hint:`Nothing is retried; the chat shows the refusal and where to change this.`}];function mSe(){let{state:e,actions:t}=W(),n=_l(e.prefs.safeguardFallback),r=(0,v.useMemo)(()=>ym(e.providers),[e.providers]),i=(0,v.useMemo)(()=>new Map(e.providers.map(e=>[e.definition.id,e.definition.clientGroup??e.definition.id])),[e.providers]),a=(0,v.useMemo)(()=>r.flatMap(e=>e.models.map(e=>({id:e.modelId,displayName:e.label}))),[r]),o=e=>bl(e,a),[s,c]=(0,v.useState)(!1),l=s?`model`:n.mode,u=e=>void t.savePrefs({safeguardFallback:_l(e)}),d=e=>{if(e===`model`){c(!0);return}c(!1),u({...n,mode:e,model:null})},f=(e=>e?r.flatMap(e=>e.models).find(t=>gl(t.modelId)===gl(e)):void 0)(n.model),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(``),_=(0,v.useMemo)(()=>p?fSe(r,p,i):[],[r,p,i]),y=Object.entries(n.perModel),b=y.length>=64,x=p!==``&&h!==``&&(h===`none`||_.some(e=>e.models.some(e=>e.value===h))),S=()=>{let e=mm(p);if(!e||!x)return;let t=h===`none`?pl:mm(h)?.modelId??``;if(!t)return;let r=gl(e.modelId);b&&n.perModel[r]===void 0||(u({...n,perModel:{...n.perModel,[r]:t}}),m(``),g(``))},C=e=>{let t={...n.perModel};delete t[e],u({...n,perModel:t})};return(0,U.jsxs)(`div`,{className:`space-y-4`,"data-testid":`settings-safeguards`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-sm font-medium text-fg`,children:[(0,U.jsx)(G.Shield,{className:`w-3.5 h-3.5`}),` When a model refuses a message`,(0,U.jsx)(BS,{label:`When a model refuses a message`,details:(0,U.jsx)(VS,{items:g9.safeguardFallback.details})})]}),(0,U.jsx)(`p`,{className:`text-xs text-fg-faint`,children:g9.safeguardFallback.hint}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-faint`,children:`On the OonaCode pool, the model that answers is charged at its own price. Your own key or subscription never switches to another provider.`}),(0,U.jsx)(`div`,{role:`radiogroup`,"aria-label":`When a model refuses a message`,className:`mt-2 space-y-1`,children:pSe.map(e=>(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md px-1 py-1.5 hover:bg-surface-2`,children:[(0,U.jsx)(`input`,{type:`radio`,name:`safeguard-mode`,className:`mt-1`,checked:l===e.mode,onChange:()=>d(e.mode),"data-testid":`safeguard-mode-${e.mode}`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.label}),(0,U.jsx)(`span`,{className:`block text-xs text-fg-faint`,children:e.hint}),e.mode===`model`?(0,U.jsxs)(`select`,{className:H(q,`mt-1.5 max-w-sm`),"aria-label":`Always switch to`,value:f?.value??``,disabled:l!==`model`,onChange:e=>{let t=mm(e.target.value);t&&(c(!1),u({...n,mode:`model`,model:t.modelId}))},"data-testid":`safeguard-model-select`,children:[(0,U.jsx)(`option`,{value:``,children:n.model&&!f?`${o(n.model)} (not listed)`:`Choose a model…`}),(0,U.jsx)(v9,{groups:r})]}):null]})]},e.mode))}),(0,U.jsx)(`p`,{className:`mt-2 rounded-md bg-surface-2 px-2.5 py-1.5 text-xs text-fg-muted`,children:`Claude Code’s own engine still moves Opus 5, Opus 5.5 and Fable chats to Opus 4.8 by itself when their safeguards refuse — that cannot be switched off.`})]}),(0,U.jsxs)(`div`,{className:`border-t border-border pt-3`,"data-testid":`safeguard-per-model`,children:[(0,U.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-sm font-medium text-fg`,children:[`Fallback per model`,(0,U.jsx)(BS,{label:`Fallback per model`,details:(0,U.jsx)(VS,{items:g9.safeguardPerModel.details})})]}),(0,U.jsx)(`p`,{className:`text-xs text-fg-faint`,children:g9.safeguardPerModel.hint}),y.length>0?(0,U.jsxs)(`table`,{className:`mt-2 w-full text-xs`,"data-testid":`safeguard-table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{className:`text-left text-fg-faint`,children:[(0,U.jsx)(`th`,{className:`py-1 pr-2 font-medium`,children:`Refused model`}),(0,U.jsx)(`th`,{className:`py-1 pr-2 font-medium`,children:`Fallback`}),(0,U.jsx)(`th`,{className:`w-8`})]})}),(0,U.jsx)(`tbody`,{children:y.map(([e,t])=>(0,U.jsxs)(`tr`,{className:`border-t border-border`,"data-testid":`safeguard-row-${e}`,children:[(0,U.jsx)(`td`,{className:`py-1.5 pr-2 text-fg`,children:o(e)}),(0,U.jsx)(`td`,{className:`py-1.5 pr-2 text-fg-muted`,children:t===`none`?`Never`:o(t)}),(0,U.jsx)(`td`,{className:`py-1.5 text-right`,children:(0,U.jsx)(zS,{label:`Remove the fallback for ${o(e)}`,className:`p-0.5`,onClick:()=>C(e),"data-testid":`safeguard-remove-${e}`,children:(0,U.jsx)(G.Trash,{className:`w-3 h-3`})})})]},e))})]}):(0,U.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,"data-testid":`safeguard-table-empty`,children:`No per-model fallbacks — every model follows the choice above.`}),(0,U.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-end gap-2`,children:[(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs text-fg-muted`,children:[`When this model refuses`,(0,U.jsxs)(`select`,{className:H(q,`max-w-56`),value:p,onChange:e=>{m(e.target.value),g(``)},"data-testid":`safeguard-add-refused`,children:[(0,U.jsx)(`option`,{value:``,children:`Choose a model…`}),(0,U.jsx)(v9,{groups:r})]})]}),(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs text-fg-muted`,children:[`Use`,(0,U.jsxs)(`select`,{className:H(q,`max-w-56`),value:h,disabled:p===``,onChange:e=>g(e.target.value),"data-testid":`safeguard-add-fallback`,children:[(0,U.jsx)(`option`,{value:``,children:`Choose a fallback…`}),(0,U.jsx)(`option`,{value:pl,children:`Never fall back`}),(0,U.jsx)(v9,{groups:_})]})]}),(0,U.jsxs)(K,{size:`sm`,variant:`primary`,disabled:!x||b&&n.perModel[gl(mm(p)?.modelId??``)]===void 0,onClick:S,"data-testid":`safeguard-add`,children:[(0,U.jsx)(G.Plus,{className:`w-3 h-3`}),` Add`]})]}),b?(0,U.jsxs)(`p`,{className:`mt-1 text-xs text-warn`,children:[`The table is full (`,64,` models). Remove one to add another.`]}):null,r.length===0?(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-faint`,children:`No models are listed on this PC yet — connect a provider first.`}):null]})]})}function hSe(){let{actions:e}=W(),[t,n]=(0,v.useState)(void 0),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(null),s=(0,v.useCallback)(async()=>{n(await e.listSkills())},[e]);return(0,v.useEffect)(()=>{s()},[s]),t===`unsupported`?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`This PC’s OonaCode is older than skills — update it to manage them here.`}):r?(0,U.jsx)(gSe,{onDone:()=>{i(!1),iI(),FN(),s()}}):(0,U.jsxs)(`div`,{className:`space-y-3`,"data-testid":`skills-section`,children:[(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`Skills every chat on this PC gets — type `,(0,U.jsx)(`span`,{className:`font-mono`,children:`/`}),` in the message box to use one for that message. They work with every model. A change applies from a chat’s next start (a new chat, or one idle for ten minutes).`]}),(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`skills-per-chat-note`,children:[`The model is not shown them on its own: each chat chooses which skills the model may use by itself, in the `,(0,U.jsx)(`span`,{className:`font-medium`,children:`Skills`}),` menu under its message box — only those cost tokens on every message of that chat.`]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(K,{size:`sm`,onClick:()=>i(!0),"data-testid":`skills-import-open`,children:[(0,U.jsx)(G.Download,{className:`h-3.5 w-3.5`}),` Import from Claude Code…`]}),t?(0,U.jsx)(`span`,{className:`truncate text-[11px] text-fg-faint`,title:t.dir,children:t.dir}):null]}),t===void 0?(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Loading…`}):t===null?(0,U.jsx)(`p`,{className:`text-xs text-danger`,children:`The host could not list the skills right now.`}):t.skills.length===0?(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`skills-empty`,children:[`No skills of your own yet. Import them from Claude Code, or put a folder with a`,` `,(0,U.jsx)(`span`,{className:`font-mono`,children:`SKILL.md`}),` in the folder above.`]}):(0,U.jsx)(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:t.skills.map(t=>(0,U.jsxs)(`li`,{className:`flex items-start gap-3 px-3 py-2 text-sm`,"data-testid":`skill-row`,"data-name":t.name,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,U.jsxs)(`span`,{className:`font-mono font-medium`,children:[`/`,t.name]}),t.argumentHint?(0,U.jsx)(`span`,{className:`font-mono text-xs text-fg-faint`,children:t.argumentHint}):null,t.broken?(0,U.jsx)(WS,{tone:`warn`,children:`no SKILL.md`}):null]}),t.description?(0,U.jsx)(`div`,{className:`line-clamp-2 text-xs text-fg-muted`,title:t.description,children:t.description}):null,(0,U.jsxs)(`div`,{className:`text-[11px] text-fg-faint`,children:[Ej(t.bytes),` · `,t.files,` file`,t.files===1?``:`s`,t.importedFrom?(0,U.jsxs)(U.Fragment,{children:[` `,`· imported `,t.importedAt?U_(t.importedAt):``,` from`,` `,(0,U.jsx)(`span`,{title:t.importedFrom,children:t.importedFrom})]}):null]})]}),(0,U.jsxs)(K,{size:`sm`,variant:`ghost`,busy:a===t.name,"aria-label":`Remove ${t.name}`,onClick:async()=>{o(t.name);let n=await e.removeSkill(t.name);o(null),n&&(iI(),FN(),await s())},"data-testid":`skill-remove`,children:[(0,U.jsx)(G.Trash,{className:`h-3.5 w-3.5`}),` Remove`]})]},t.name))})]})}function gSe({onDone:e}){let{actions:t}=W(),[n,r]=(0,v.useState)(void 0),[i,a]=(0,v.useState)(()=>new Set),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(null);(0,v.useEffect)(()=>{let e=!0;return t.scanClaudeSkills().then(t=>{e&&r(t)}),()=>{e=!1}},[t]);let f=(0,v.useMemo)(()=>{let e=new Map;for(let t of n?.skills??[]){let n=t.origin===`plugin`?`Plugin: ${t.plugin??`?`}`:`Your skills`;e.set(n,[...e.get(n)??[],t])}return[...e.entries()]},[n]),p=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,U.jsxs)(`div`,{className:`space-y-3`,"data-testid":`skills-import`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(K,{size:`sm`,variant:`ghost`,onClick:e,children:`← Back`}),(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:`Import skills from Claude Code`})]}),(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`Tick the skills to copy into OonaCode. Your Claude Code install is only read — nothing in it is changed.`,n?.roots.length?(0,U.jsxs)(U.Fragment,{children:[` `,`Read from `,(0,U.jsx)(`span`,{className:`font-mono`,children:n.roots.join(`, `)}),`.`]}):null]}),n===void 0?(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Looking…`}):n===null?(0,U.jsx)(`p`,{className:`text-xs text-danger`,children:`The host could not read Claude Code’s skills.`}):n.skills.length===0?(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`skills-import-empty`,children:`No skills found in Claude Code on this PC.`}):f.map(([e,t])=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wide text-fg-faint`,children:e}),(0,U.jsx)(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:t.map(e=>{let t=!!e.unavailable||e.alreadyInOonaCode&&!o;return(0,U.jsx)(`li`,{className:`px-3 py-1.5 text-sm`,children:(0,U.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:i.has(e.key)&&!t,disabled:t,onChange:()=>p(e.key),"data-testid":`skills-import-pick`,"data-name":e.name}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`span`,{className:`font-mono font-medium`,children:[`/`,e.name]}),` `,e.alreadyInOonaCode?(0,U.jsx)(WS,{children:`already in OonaCode`}):null,` `,e.unavailable?(0,U.jsx)(WS,{tone:`warn`,children:e.unavailable}):null,e.description?(0,U.jsx)(`span`,{className:`line-clamp-2 block text-xs text-fg-muted`,children:e.description}):null,e.note?(0,U.jsx)(`span`,{className:`block text-[11px] text-warn`,children:e.note}):null,(0,U.jsxs)(`span`,{className:`block text-[11px] text-fg-faint`,children:[Ej(e.bytes),` · `,e.path]})]})]})},e.key)})})]},e)),n&&n.skills.some(e=>e.alreadyInOonaCode)?(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked)}),`Replace the ones already in OonaCode`]}):null,u?(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,role:`status`,"data-testid":`skills-import-outcome`,children:u}):null,(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsxs)(K,{variant:`primary`,size:`sm`,busy:c,disabled:i.size===0,"data-testid":`skills-import-go`,onClick:async()=>{l(!0);let n=await t.importClaudeSkills([...i],o);if(l(!1),!n)return;let r=n.skipped.map(e=>`${e.name||e.key}: ${e.reason}`);d(`Imported ${n.imported.length}`+(r.length>0?` · skipped ${r.join(`; `)}`:``)),n.skipped.length===0&&e()},children:[`Import `,i.size>0?i.size:``]}),(0,U.jsx)(K,{size:`sm`,onClick:e,children:`Cancel`})]})]})}function _Se({open:e,onClose:t,editingServer:n}){let{actions:r}=W(),[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(`all`),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(`stdio`),[x,S]=(0,v.useState)(`npx`),[C,w]=(0,v.useState)(``),[T,E]=(0,v.useState)(``),[D,O]=(0,v.useState)(``),[k,A]=(0,v.useState)(``),[j,M]=(0,v.useState)(!1),[N,ee]=(0,v.useState)({}),[te,P]=(0,v.useState)(!1),[F,ne]=(0,v.useState)(null),[I,re]=(0,v.useState)(!1),[ie,ae]=(0,v.useState)(null),[L,oe]=(0,v.useState)(null);n&&n.id!==L&&(oe(n.id),d(!0),l(null),p(n.id),h(n.name),_(n.description??``),b(n.transport),S(n.command??`npx`),w((n.args??[]).join(` `)),E(Object.entries(n.env??{}).map(([e,t])=>`${e}=${t}`).join(`
|
|
239
|
+
- use the browser on port 9170 for anything on the web`,maxLength:dc.instructions,"data-testid":`project-instructions`})})]}),(0,U.jsxs)(G5,{title:`Repositories`,children:[(0,U.jsx)(HS,{label:`One per line (optional)`,hint:`Every chat in the project is told about them.`,children:(0,U.jsx)(`textarea`,{className:H(q,`h-16 font-mono text-xs`),value:u.repositories,onChange:e=>g(`repositories`,e.target.value),placeholder:`https://github.com/you/app`,"data-testid":`project-repositories`})}),(0,U.jsx)(U5,{compact:!0})]}),(0,U.jsxs)(G5,{title:`New chats`,children:[(0,U.jsx)(HS,{label:`Model`,hint:`What a new chat in this project starts on.`,children:(0,U.jsxs)(`select`,{className:q,value:u.model,onChange:e=>{g(`model`,e.target.value),g(`effort`,``)},"data-testid":`project-model`,children:[(0,U.jsx)(`option`,{value:``,children:`Whatever a new chat would start on`}),x?(0,U.jsxs)(`option`,{value:u.model,children:[x.model,` (not on this PC)`]}):null,y.map(e=>(0,U.jsx)(`option`,{value:e.key,children:e.label},e.key))]})}),S.length>0?(0,U.jsx)(HS,{label:`Effort`,children:(0,U.jsxs)(`select`,{className:q,value:u.effort,onChange:e=>g(`effort`,e.target.value),"data-testid":`project-effort`,children:[(0,U.jsx)(`option`,{value:``,children:b&&Oe(b.option)?`Default (${Oe(b.option)})`:`Default`}),S.map(e=>(0,U.jsx)(`option`,{value:e,children:e},e))]})}):null,(0,U.jsx)(HS,{label:`Folder`,hint:`Where a new chat runs; left empty, each chat gets its own.`,children:(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(`input`,{className:H(q,`flex-1 font-mono text-xs`),value:u.cwd,onChange:e=>g(`cwd`,e.target.value),placeholder:s,"data-testid":`project-cwd`}),window.oonacode?.pickDirectory?(0,U.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>void D(),children:`Choose…`}):null]})})]}),(0,U.jsxs)(G5,{title:`Memory`,children:[(0,U.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:u.memoryEnabled,onChange:e=>g(`memoryEnabled`,e.target.checked),"data-testid":`project-memory-enabled`}),(0,U.jsx)(`span`,{children:`Keep a project memory — notes every chat of the project reads at its start, and the agent keeps up to date.`})]}),u.memoryEnabled?(0,U.jsx)(`textarea`,{className:H(q,`h-28 font-mono text-xs`),value:u.memory,onChange:e=>g(`memory`,e.target.value),placeholder:`Nothing noted yet.`,maxLength:dc.memory,"data-testid":`project-memory`}):null]}),(0,U.jsxs)(G5,{title:`Scheduled tasks`,children:[(0,U.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:u.tasksEnabled,onChange:e=>g(`tasksEnabled`,e.target.checked),"data-testid":`project-tasks-enabled`}),(0,U.jsx)(`span`,{children:`The agent may schedule work in this project's chats — once, or on a repeat — with OonaCode's scheduler on this PC.`})]}),u.tasksEnabled?(0,U.jsx)(HS,{label:`Shortest repeat, in minutes`,children:(0,U.jsx)(`input`,{className:H(q,`w-28`),inputMode:`numeric`,value:u.minInterval,onChange:e=>g(`minInterval`,e.target.value),"data-testid":`project-min-interval`})}):null,_?(0,U.jsx)(dP,{projectId:_.id,showChat:!0}):null]}),(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Saved settings reach the project's chats at their next message. Projects live in your vault: only your own devices can read them.`})]})]})})}function uye({open:e,onClose:t}){return(0,U.jsx)(GS,{open:e,title:`Export my chats`,onClose:t,children:(0,U.jsx)(dye,{onDone:t})})}function dye({onDone:e}){let{api:t,state:n}=W(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(0),p=n.sessionsTotal||n.sessions.length;(0,v.useEffect)(()=>{if(!a){f(0);return}let e=Date.now(),t=setInterval(()=>f(Math.floor((Date.now()-e)/1e3)),1e3);return()=>clearInterval(t)},[a]);let m=async()=>{if(!t.exportSessionsArchive){c(`this PC is running an older OonaCode that cannot export chats`);return}o(!0),c(null);try{let n=await t.exportSessionsArchive(r),a=URL.createObjectURL(n),o=document.createElement(`a`);o.href=a,o.download=`oonacode-chats-${new Date().toISOString().slice(0,10)}.zip`,o.click(),URL.revokeObjectURL(a),i(``),u(!1),e()}catch(e){c(e instanceof Error?e.message:`the export failed`)}finally{o(!1)}};return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(GS,{open:a,title:`Exporting your chats`,onClose:()=>void 0,children:(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsx)(G.Spinner,{className:`mt-0.5 w-5 h-5 shrink-0 text-accent`}),(0,U.jsxs)(`div`,{className:`min-w-0 text-sm`,children:[(0,U.jsxs)(`div`,{className:`font-medium`,children:[`Packing`,` `,p>0?`${p} chat${p===1?``:`s`}`:`your chats`,`…`]}),(0,U.jsxs)(`div`,{className:`mt-1 tabular text-fg-muted`,children:[Math.floor(d/60),`:`,String(d%60).padStart(2,`0`),` elapsed`]}),(0,U.jsx)(`p`,{className:`mt-2 text-xs text-fg-faint`,children:`Your PC writes the whole archive before the download starts, so nothing appears in your downloads until it is finished. A long history can take a minute or two — this is normal, and you do not need to press anything again.`})]})]})}),(0,U.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`One zip with a plain `,(0,U.jsx)(`code`,{children:`.txt`}),` of every conversation on this PC, plus an index. It is for reading and copying from — there is no way to load it back in.`]}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-warn`,children:`The zip is not encrypted: anyone who opens it can read every conversation in it.`}),l?(0,U.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`input`,{type:`password`,autoFocus:!0,className:q+` max-w-[16rem]`,placeholder:`Account password`,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&r&&m()},"data-testid":`export-chats-password`}),(0,U.jsx)(K,{onClick:()=>void m(),disabled:a||!r,children:a?`Exporting…`:`Export`}),(0,U.jsx)(K,{variant:`ghost`,onClick:()=>{u(!1),i(``),c(null)},children:`Cancel`})]}):(0,U.jsx)(K,{className:`mt-2`,onClick:()=>u(!0),"data-testid":`export-chats`,children:`Export chats…`}),s?(0,U.jsx)(`div`,{className:`mt-2 text-xs text-danger`,children:s}):null]})}function fye({open:e,onClose:t}){return(0,U.jsx)(GS,{open:e,title:`Connect an AI tool`,onClose:t,wide:!0,children:e?(0,U.jsx)(mye,{}):null})}var K5={hour:`One hour`,day:`One day`,"until-revoked":`Until I revoke it`};function pye(e){let t=e.chats,n=`${t} chat${t===1?``:`s`}`,r=e.outcome===`refused`?`refused (${e.call})`:e.call===`list_chats`?`listed ${n}`:e.call===`read_chat`?`read ${n}`:`searched ${n}`;return`${G_(e.at)} · ${r}`}function mye(){let{api:e,state:t}=W(),[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),m=!!(e.listAiToolGrants&&e.createAiToolGrant&&e.revokeAiToolGrant),h=(0,v.useCallback)(async()=>{if(e.listAiToolGrants)try{let t=await e.listAiToolGrants();r(t.grants),a(null)}catch(e){a(Y_(e))}},[e]);(0,v.useEffect)(()=>{h(),e.listVaultProjects().then(e=>s(e.projects)).catch(()=>s([]))},[e,h]);let g=(0,v.useCallback)(e=>o.find(t=>t.id===e)?.name??`one project`,[o]),_=e=>{if(e.kind===`all`)return`All chats on this PC`;if(e.kind===`chats`){let t=e.chatIds.length;return`${t} chosen chat${t===1?``:`s`}`}return`Project: ${g(e.projectId)}`},y=async t=>{if(e.revokeAiToolGrant){p(t);try{await e.revokeAiToolGrant(t),await h()}catch(e){a(Y_(e))}finally{p(null)}}};return m?(0,U.jsxs)(`div`,{className:`space-y-3 text-sm`,"data-testid":`connect-ai-tool-body`,children:[(0,U.jsxs)(`p`,{className:`text-fg-muted`,children:[`Let an AI tool on this PC — Claude Code in VS Code, or any MCP client — `,(0,U.jsx)(`b`,{children:`read`}),` your chats on `,t.connection.hostName?(0,U.jsx)(`b`,{children:t.connection.hostName}):`this PC`,`. It gets read-only access through OonaCode, only while OonaCode runs and is unlocked; it never gets your password, your vault or OonaCode's own key.`]}),(0,U.jsxs)(`ul`,{className:`list-disc space-y-1 rounded-md border border-warn/40 bg-warn/5 py-2 pl-6 pr-3 text-xs text-warn`,"data-testid":`connect-ai-tool-warning`,children:[(0,U.jsx)(`li`,{children:`Whatever the tool reads is sent to that tool's model provider.`}),(0,U.jsx)(`li`,{children:`Chats can hold secrets you pasted or a tool printed. Key-shaped strings are masked, but not everything secret looks like a key.`}),(0,U.jsx)(`li`,{children:`A chat's text can carry instructions aimed at the tool. OonaCode marks everything it hands over as untrusted data, and offers read tools only — nothing that writes, sends or deletes.`})]}),u?(0,U.jsx)(gye,{made:u,onDone:()=>d(null)}):c?(0,U.jsx)(_ye,{projects:o,onCancel:()=>l(!1),onCreated:e=>{l(!1),d(e),h()}}):(0,U.jsxs)(K,{onClick:()=>l(!0),"data-testid":`connect-ai-tool-new`,children:[(0,U.jsx)(G.Plug,{className:`w-3.5 h-3.5`}),`Connect a tool…`]}),i?(0,U.jsx)(`div`,{className:`text-xs text-danger`,children:i}):null,(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`mb-1 text-xs font-medium uppercase tracking-wide text-fg-faint`,children:`Connected tools`}),n===null?(0,U.jsx)(`div`,{className:`text-xs text-fg-faint`,children:`Loading…`}):n.length===0?(0,U.jsx)(`div`,{className:`text-xs text-fg-faint`,"data-testid":`connect-ai-tool-none`,children:`No AI tool is connected.`}):(0,U.jsx)(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:n.map(e=>(0,U.jsxs)(`li`,{className:`p-2`,"data-testid":`ai-tool-grant-${e.id}`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`font-medium`,children:e.toolName}),(0,U.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[_(e.scope),` · `,(0,U.jsx)(hye,{grant:e})]})]}),e.status===`active`?(0,U.jsx)(K,{size:`sm`,variant:`danger`,busy:f===e.id,onClick:()=>void y(e.id),"data-testid":`ai-tool-revoke-${e.id}`,children:`Revoke`}):null]}),e.reads.length>0?(0,U.jsx)(`ul`,{className:`mt-1 space-y-0.5 text-xs text-fg-faint`,"data-testid":`ai-tool-reads`,children:[...e.reads].reverse().slice(0,5).map((t,n)=>(0,U.jsxs)(`li`,{title:W_(t.at),children:[e.toolName,` `,pye(t).replace(` · `,` — `)]},`${t.at}-${n}`))}):e.status===`active`?(0,U.jsx)(`div`,{className:`mt-1 text-xs text-fg-faint`,children:`Nothing read yet.`}):null]},e.id))})]})]}):(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,"data-testid":`connect-ai-tool-unsupported`,children:`This PC is running an older OonaCode that cannot connect an AI tool. Update it first.`})}function hye({grant:e}){return e.status===`revoked`?(0,U.jsx)(`span`,{className:`text-fg-faint`,children:`revoked`}):e.status===`expired`?(0,U.jsx)(`span`,{className:`text-fg-faint`,children:`expired`}):(0,U.jsxs)(`span`,{className:`text-ok`,children:[`active`,e.expiresAt?` until ${W_(e.expiresAt)}`:` until revoked`]})}function gye({made:e,onDone:t}){let[n,r]=(0,v.useState)(!1);return(0,U.jsxs)(`div`,{className:`space-y-2 rounded-md border border-border bg-surface-2 p-2`,"data-testid":`connect-ai-tool-made`,children:[(0,U.jsx)(`div`,{className:`font-medium`,children:`Paste this into a terminal for Claude Code`}),(0,U.jsx)(`p`,{className:`text-xs text-warn`,children:`It is shown once: OonaCode keeps only a fingerprint of it. Treat it like a password — the tool keeps it in its own settings file, and Revoke below is what ends it.`}),(0,U.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,U.jsx)(`pre`,{className:`min-w-0 flex-1 overflow-x-auto whitespace-pre-wrap break-all rounded bg-surface p-2 font-mono text-xs`,"data-testid":`connect-ai-tool-command`,children:e.command}),(0,U.jsxs)(K,{size:`sm`,onClick:()=>{dN(e.command).then(e=>{e&&r(!0)})},"data-testid":`connect-ai-tool-copy`,children:[(0,U.jsx)(G.Copy,{className:`w-3.5 h-3.5`}),n?`Copied`:`Copy`]})]}),(0,U.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer`,children:`Another MCP client`}),(0,U.jsxs)(`div`,{className:`mt-1 space-y-1`,children:[(0,U.jsxs)(`div`,{children:[`Streamable HTTP URL: `,(0,U.jsx)(`code`,{className:`break-all`,children:e.mcpUrl})]}),(0,U.jsxs)(`div`,{children:[`Header: `,(0,U.jsx)(`code`,{className:`break-all`,children:e.header})]})]})]}),(0,U.jsx)(K,{size:`sm`,variant:`primary`,onClick:t,"data-testid":`connect-ai-tool-done`,children:`Done`})]})}function _ye({projects:e,onCancel:t,onCreated:n}){let{api:r,state:i}=W(),[a,o]=(0,v.useState)(`Claude Code`),[s,c]=(0,v.useState)(`all`),[l,u]=(0,v.useState)([]),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(`hour`),[_,y]=(0,v.useState)(``),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(null),w=(0,v.useMemo)(()=>{let e=d.trim().toLowerCase();return i.sessions.filter(t=>!e||J_(t).toLowerCase().includes(e)).slice(0,200)},[i.sessions,d]),T=s===`all`?{kind:`all`}:s===`chats`?l.length>0?{kind:`chats`,chatIds:l}:null:p?{kind:`project`,projectId:p}:null,E=!!(T&&a.trim()&&_&&!b),D=async()=>{if(!(!E||!T||!r.createAiToolGrant)){x(!0),C(null);try{let e=await r.createAiToolGrant({toolName:a.trim(),scope:T,lifetime:h,password:_});y(``),n(e)}catch(e){C(Y_(e))}finally{x(!1)}}},O=e=>u(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]);return(0,U.jsxs)(`div`,{className:`space-y-3 rounded-md border border-border p-2`,"data-testid":`connect-ai-tool-form`,children:[(0,U.jsxs)(`label`,{className:`block`,children:[(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Tool name`}),(0,U.jsx)(`input`,{className:q,value:a,maxLength:60,onChange:e=>o(e.target.value),"data-testid":`connect-ai-tool-name`})]}),(0,U.jsxs)(`fieldset`,{children:[(0,U.jsx)(`legend`,{className:`text-xs text-fg-muted`,children:`What it may read`}),(0,U.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-3`,children:[[`all`,`All chats`],[`chats`,`Chosen chats`],[`project`,`One project`]].map(([e,t])=>(0,U.jsxs)(`label`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsx)(`input`,{type:`radio`,name:`connect-ai-tool-scope`,checked:s===e,onChange:()=>c(e),"data-testid":`connect-ai-tool-scope-${e}`}),t]},e))}),s===`chats`?(0,U.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[(0,U.jsx)(`input`,{className:q,placeholder:`Filter chats`,value:d,onChange:e=>f(e.target.value)}),(0,U.jsx)(`div`,{className:`max-h-48 overflow-y-auto rounded-md border border-border`,children:w.length===0?(0,U.jsx)(`div`,{className:`p-2 text-xs text-fg-faint`,children:`No chats.`}):w.map(e=>(0,U.jsxs)(`label`,{className:`flex items-center gap-2 px-2 py-1 text-xs hover:bg-surface-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:l.includes(e.id),onChange:()=>O(e.id),"data-testid":`connect-ai-tool-chat-${e.id}`}),(0,U.jsx)(`span`,{className:`truncate`,children:J_(e)})]},e.id))}),(0,U.jsxs)(`div`,{className:`text-xs text-fg-faint`,children:[l.length,` chosen`]})]}):null,s===`project`?(0,U.jsxs)(`select`,{className:H(US,`mt-2`),value:p,onChange:e=>m(e.target.value),"data-testid":`connect-ai-tool-project`,children:[(0,U.jsx)(`option`,{value:``,children:`Pick a project…`}),e.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.name},e.id))]}):null]}),(0,U.jsxs)(`label`,{className:`block`,children:[(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`For how long`}),(0,U.jsx)(`select`,{className:US,value:h,onChange:e=>g(e.target.value),"data-testid":`connect-ai-tool-lifetime`,children:Object.keys(K5).map(e=>(0,U.jsx)(`option`,{value:e,children:K5[e]},e))})]}),(0,U.jsxs)(`label`,{className:`block`,children:[(0,U.jsx)(`span`,{className:`text-xs text-fg-muted`,children:`Account password — to say it is you`}),(0,U.jsx)(`input`,{type:`password`,className:q+` max-w-[16rem]`,placeholder:`Account password`,value:_,onChange:e=>y(e.target.value),onKeyDown:e=>{e.key===`Enter`&&D()},"data-testid":`connect-ai-tool-password`})]}),S?(0,U.jsx)(`div`,{className:`text-xs text-danger`,"data-testid":`connect-ai-tool-error`,children:S}):null,(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(K,{variant:`primary`,onClick:()=>void D(),disabled:!E,busy:b,"data-testid":`connect-ai-tool-create`,children:`Connect`}),(0,U.jsx)(K,{variant:`ghost`,onClick:t,children:`Cancel`})]})]})}var q5=new Map,J5=0;function vye(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,`0`)}function Y5(e){return[e.summaryId,e.language,e.voiceKey,vye(e.text)].join(`|`)}function yye(e,t){let n=Y5(e),r=q5.get(n);return r&&(q5.delete(n),r.clips.length!==t&&(Z5(r),r=void 0)),r??={key:n,clips:Array(t).fill(void 0),bytes:0},q5.set(n,r),X5(n),r}function bye(e,t,n,r){let i=e.clips[t];i&&(Q5(i.url),e.bytes-=i.bytes);let a={url:xye(n),bytes:n.byteLength,...r};return e.clips[t]=a,e.bytes+=a.bytes,q5.delete(e.key),q5.set(e.key,e),X5(e.key),a}function X5(e){let t=0;for(let e of q5.values())t+=e.bytes;for(let[n,r]of q5){if(q5.size<=8&&t<=50331648)return;n!==e&&(q5.delete(n),t-=r.bytes,Z5(r))}}function Z5(e){for(let t of e.clips)t&&Q5(t.url)}function xye(e){return typeof URL<`u`&&typeof URL.createObjectURL==`function`?URL.createObjectURL(new Blob([e],{type:`audio/wav`})):(J5+=1,`clip:${J5}`)}function Q5(e){if(e.startsWith(`blob:`))try{URL.revokeObjectURL(e)}catch{}}var $5=()=>new Audio,e7=1e-6,Sye=class{#e;#t;#n;#r;#i;#a=new Set;#o;#s=[``,``];#c=0;#l;#u=`idle`;#d;#f=0;#p=0;#m=null;#h=null;#g=0;#_=!1;#v=!1;#y=!1;#b=!1;constructor(e){this.#e=e.tts,this.#t=e.voiceId,this.#n=e.language,this.#r=e.entry,this.#d=jp(e.rate??1),this.#i=e.errorText??(e=>e instanceof Error&&e.message?e.message:String(e));let t=e.timeline;e.entry.clips.forEach((e,n)=>{e&&(t=vp(t,n,e.seconds,e))}),this.#l=t,this.#o=[$5(),$5()];for(let e of this.#o)e.playbackRate=this.#d,e.preservesPitch=!0}get timeline(){return this.#l}snapshot(){let e=this.#l,t=this.#C(),n=-1;return e.words.length>0&&(n=this.#m??(this.#u===`ended`?e.words.length-1:Math.max(0,bp(e,t+e7)))),{status:this.#u,currentSec:t,durationSec:e.totalSec,durationExact:e.complete||this.#r.clips.every(Boolean),wordIndex:n,sentenceIndex:n>=0?e.words[n].sentence:yp(e,t),rate:this.#d,error:this.#h}}subscribe(e){return this.#a.add(e),()=>this.#a.delete(e)}#x(){for(let e of[...this.#a])e()}#S(e){this.#u=e,this.#x()}#C(){let e=this.#l;if(this.#u===`ended`)return e.totalSec;if(this.#m!==null)return xp(e,this.#m);let t=e.sentences[this.#f];if(!t)return 0;let n=this.#u===`playing`?this.#o[this.#c].currentTime||0:this.#p;return t.startSec+Math.max(0,Math.min(n,t.durationSec))}#w(){let e=this.#l.sentences.length;for(let t=0;t<e;t+=1){let n=(this.#f+t)%e;if(!this.#r.clips[n])return n}return-1}#T(){if(!this.#_||this.#v||this.#y||this.#b)return;let e=this.#w();if(e<0)return;let t=this.#l.sentences[e];this.#v=!0,(async()=>{try{let n=await this.#e.speak({voiceId:this.#t,text:sp(t.spoken,this.#n),speed:1}),r=n.sampleRate>0?n.samples.length/n.sampleRate:0,i=Ep(n.samples,n.sampleRate);if(bye(this.#r,e,Fv(n.samples,n.sampleRate),{seconds:r,...i}),this.#v=!1,this.#b)return;this.#l=vp(this.#l,e,r,i),this.#u===`buffering`&&e===this.#f?this.#D(this.#f):this.#u===`playing`&&e===this.#f+1&&this.#O(),this.#x(),this.#T()}catch(e){if(this.#v=!1,this.#b)return;this.#E(this.#i(e))}})()}#E(e){this.#y=!0,this.#g+=1,this.#u===`playing`&&(this.#p=this.#o[this.#c].currentTime||0);for(let e of this.#o)e.pause();this.#h=e,this.#S(`error`)}#D(e){let t=++this.#g;this.#f=e;let n=this.#r.clips[e];if(!n){for(let e of this.#o)e.pause();this.#u!==`buffering`&&this.#S(`buffering`),this.#T();return}if(this.#m!==null){let t=this.#l.sentences[e];this.#p=xp(this.#l,this.#m)-t.startSec,this.#m=null}let r=Math.max(0,Math.min(this.#p,Math.max(0,n.seconds-.01))),i=this.#c,a=this.#o[i];this.#o[+(i===0)].pause(),this.#s[i]!==n.url&&(a.src=n.url,this.#s[i]=n.url),a.currentTime=r,a.playbackRate=this.#d,a.preservesPitch=!0,a.onended=()=>{t===this.#g&&this.#k(e)},a.onerror=()=>{t===this.#g&&this.#E(`This window could not play the voice’s audio.`)},this.#p=r;let o=e=>{t!==this.#g||e instanceof Error&&e.name===`AbortError`||this.#E(`This window could not play the voice’s audio${e instanceof Error&&e.message?` (${e.message})`:``}.`)};try{a.play()?.catch?.(o)}catch(e){queueMicrotask(()=>o(e))}this.#O(),this.#u===`playing`?this.#x():this.#S(`playing`)}#O(){let e=this.#r.clips[this.#f+1],t=+(this.#c===0);!e||this.#s[t]===e.url||(this.#o[t].src=e.url,this.#s[t]=e.url)}#k(e){let t=this.#l.sentences.length;if(e+1>=t){this.#g+=1,this.#f=t-1,this.#p=this.#l.sentences[t-1]?.durationSec??0,this.#S(`ended`);return}this.#c=+(this.#c===0),this.#p=0,this.#D(e+1)}play(){if(!(this.#b||this.#u===`playing`||this.#u===`buffering`)){if(this.#l.sentences.length===0){this.#S(`ended`);return}this.#u===`ended`&&(this.#f=0,this.#p=0,this.#m=null),this.#u===`error`&&(this.#y=!1,this.#h=null),this.#_=!0,this.#D(this.#f),this.#T()}}pause(){if(this.#u===`playing`||this.#u===`buffering`){this.#u===`playing`&&(this.#p=this.#o[this.#c].currentTime||0),this.#g+=1;for(let e of this.#o)e.pause();this.#S(`paused`)}}toggle(){this.#u===`playing`||this.#u===`buffering`?this.pause():this.play()}#A(e,t,n){let r=this.#u===`playing`||this.#u===`buffering`;if(this.#g+=1,this.#u===`playing`&&this.#o[this.#c].pause(),this.#f=e,this.#p=t,this.#m=n,r){this.#D(e),this.#T();return}if(this.#m!==null&&this.#r.clips[e]){let t=this.#l.sentences[e];this.#p=xp(this.#l,this.#m)-t.startSec,this.#m=null}this.#S(this.#u===`idle`?`idle`:this.#u===`error`?`error`:`paused`)}seek(e){let t=this.#l;if(t.sentences.length===0)return;let n=Math.max(0,Math.min(t.totalSec,e)),r=yp(t,n),i=t.sentences[r];if(this.#r.clips[r]){this.#A(r,n-i.startSec,null);return}let a=bp(t,n+e7),o=a>=i.wordFrom&&a<i.wordTo?a:i.wordTo>i.wordFrom?i.wordFrom:null;this.#A(r,n-i.startSec,o)}seekWord(e){let t=this.#l;if(t.words.length===0)return;let n=t.words[Math.max(0,Math.min(e,t.words.length-1))],r=t.sentences[n.sentence];this.#r.clips[n.sentence]?this.#A(n.sentence,n.startSec-r.startSec,null):this.#A(n.sentence,0,n.index)}skip(e){this.seek(Cp(this.#l,this.#C(),e))}nextSentence(){let e=this.#l.sentences[this.#f+1];e&&this.#A(e.index,0,null)}prevSentence(){let e=this.#l,t=yp(e,wp(e,this.#C())+e7);this.#A(Math.max(0,t),0,null)}setRate(e){let t=jp(e);if(t!==this.#d){this.#d=t;for(let e of this.#o)e.playbackRate=t,e.preservesPitch=!0;this.#x()}}destroy(){if(!this.#b){this.#b=!0,this.#g+=1;for(let e of this.#o)e.onended=null,e.onerror=null,e.pause();this.#u=`idle`,this.#a.clear()}}};function Cye(e){let t=e.now??(()=>Date.now()),n=-1/0,r=0,i=null,a=new Set,o=(e,t)=>{let n=setTimeout(()=>{a.delete(n),e()},t);a.add(n)},s=(a,s)=>{let c=r,l=e.synth.getVoices().find(t=>t.voiceURI===e.voiceURI)??null,u=e.makeUtterance(a);l&&(u.voice=l),u.lang=l?.lang??e.bcp47,u.rate=s.rate;let d=!1,f=()=>!d&&c===r,p=()=>{d=!0,i===u&&(i=null)};u.onstart=()=>{f()&&s.onStart()},u.onboundary=e=>{f()&&(e.name===void 0||e.name===`word`)&&typeof e.charIndex==`number`&&s.onBoundary(e.charIndex)},u.onend=()=>{f()&&(p(),s.onEnd())},u.onerror=e=>{f()&&(p(),e.error!==`interrupted`&&e.error!==`canceled`&&s.onError(Error(`The system voice failed: ${e.error??`unknown error`}`)))},o(()=>{f()&&(p(),e.synth.cancel(),n=t(),s.onEnd())},Av(a,s.rate)),i=u,e.synth.speak(u)};return{queueAhead:!1,speak(e,i){let a=n+50-t();if(a>0){let t=r;o(()=>{t===r&&s(e,i)},a);return}s(e,i)},stop(){r+=1,i=null;for(let e of a)clearTimeout(e);a.clear();try{e.synth.cancel()}catch{}return n=t(),new Promise(e=>setTimeout(e,50))}}}var t7=e=>typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(()=>e(Date.now()),16),wye=e=>{typeof cancelAnimationFrame==`function`?cancelAnimationFrame(e):clearTimeout(e)};function Tye(e){let[,t]=(0,v.useReducer)(e=>e+1,0);return(0,v.useEffect)(()=>{if(!e)return;let n=0,r=!1,i=-2,a=0,o=s=>{let c=e.snapshot();if(c.status!==`playing`&&c.status!==`buffering`){r=!1,t();return}(c.wordIndex!==i||s-a>=250)&&(i=c.wordIndex,a=s,t()),n=t7(o)},s=()=>{t();let i=e.snapshot();!r&&(i.status===`playing`||i.status===`buffering`)&&(r=!0,n=t7(o))},c=e.subscribe(s);return s(),()=>{c(),r&&wye(n)}},[e]),e?e.snapshot():null}function Eye({summaries:e,loaded:t,selectedId:n,changed:r,notice:i,error:a,locked:o,onSelect:s,onDelete:c}){let l=kp(e);return(0,U.jsxs)(`section`,{"data-testid":`voice-summaries`,children:[(0,U.jsx)(`h3`,{className:`mb-1 text-xs font-semibold uppercase tracking-wide text-fg-faint`,children:`Summaries`}),a?(0,U.jsx)(`p`,{className:`text-xs text-danger`,children:a}):null,t&&l.length===0?(0,U.jsx)(`p`,{className:`text-fg-muted`,"data-testid":`voice-no-summaries`,children:Hp.noSummaries}):null,l.length>0&&r?(0,U.jsx)(`p`,{className:`mb-1 text-xs text-fg-muted`,"data-testid":`voice-changed`,children:Hp.changedSinceNewest}):null,(0,U.jsx)(`ul`,{className:`flex max-h-44 flex-col gap-1 overflow-y-auto`,children:l.map(e=>{let t=n===e.id,r=Mv(e.createdAt);return(0,U.jsxs)(`li`,{"data-testid":`voice-summary-row`,className:H(`flex items-start gap-2 rounded-md border px-2 py-1.5`,t?`border-accent bg-accent/10`:`border-border`),children:[(0,U.jsx)(`input`,{type:`radio`,name:`voice-summary`,className:`mt-1`,"aria-label":`Summary of ${r}`,checked:t,disabled:o,onChange:()=>s(e.id)}),(0,U.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 flex-col items-start text-left`,disabled:o,onClick:()=>s(e.id),children:[(0,U.jsxs)(`span`,{className:`font-medium`,children:[r,e.current?(0,U.jsx)(`span`,{className:`ml-2 rounded-full bg-accent/15 px-1.5 text-xs text-accent`,children:Hp.current}):null]}),(0,U.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[e.words,` words · about `,Bp(e.seconds),` ·`,` `,Rp(e).map(e=>e.toUpperCase()).join(` `),` `,`· `,e.cost.model??`the chat’s model`,` · `,Vp(e.cost)]})]}),(0,U.jsx)(K,{size:`sm`,onClick:()=>c(e.id),disabled:o,"aria-label":`Delete the summary of ${r}`,"data-testid":`voice-summary-delete`,children:(0,U.jsx)(G.Trash,{className:`h-3.5 w-3.5`})})]},e.id)})}),i?(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,"data-testid":`voice-notice`,children:i}):null]})}function Dye(e){switch(e?.status){case`buffering`:return`Getting the voice ready…`;case`paused`:return`Paused.`;case`ended`:return`Done.`;case`playing`:return`Playing.`;default:return``}}function n7({label:e,onClick:t,disabled:n,children:r,testId:i,primary:a}){return(0,U.jsx)(`button`,{type:`button`,"aria-label":e,title:e,onClick:t,disabled:n,"data-testid":i,className:H(`inline-flex items-center justify-center rounded-full disabled:opacity-40`,a?`h-9 w-9 bg-accent text-accent-fg hover:opacity-90`:`h-8 min-w-8 px-1.5 text-fg-muted hover:bg-surface-2 hover:text-fg`),children:r})}function Oye({player:e,snapshot:t,speed:n,onSpeed:r}){let i=t,a=!e||!i,o=i?.status===`playing`||i?.status===`buffering`,s=i?.currentSec??0,c=i?.durationSec??0,l=i&&!i.durationExact?`~`:``,u=`${Dp(s)} / ${l}${Dp(c)}`;return(0,U.jsxs)(`section`,{className:`flex flex-col gap-2 rounded-md border border-border bg-surface-2 px-3 py-2`,"data-testid":`voice-player`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`input`,{type:`range`,"aria-label":`Position`,"aria-valuetext":`${Dp(s)} of ${l}${Dp(c)}`,className:`min-w-0 flex-1`,min:0,max:Math.max(.1,c),step:.1,value:Math.min(s,Math.max(.1,c)),disabled:a,onChange:t=>e?.seek(Number(t.target.value)),"data-testid":`voice-position`}),(0,U.jsx)(`span`,{className:`shrink-0 tabular-nums text-xs text-fg-muted`,"data-testid":`voice-clock`,children:u})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,U.jsx)(n7,{label:`Previous sentence`,onClick:()=>e?.prevSentence(),disabled:a,testId:`voice-prev`,children:(0,U.jsx)(G.SkipBack,{className:`h-4 w-4`})}),(0,U.jsx)(n7,{label:`Back 10 seconds`,onClick:()=>e?.skip(-10),disabled:a,testId:`voice-back`,children:(0,U.jsxs)(`span`,{className:`text-xs font-medium`,children:[`−`,10,`s`]})}),(0,U.jsx)(n7,{label:o?`Pause`:`Play`,onClick:()=>e?.toggle(),disabled:a,testId:`voice-toggle`,primary:!0,children:o?(0,U.jsx)(G.Pause,{className:`h-4 w-4`}):(0,U.jsx)(G.Play,{className:`h-4 w-4`})}),(0,U.jsx)(n7,{label:`Forward 10 seconds`,onClick:()=>e?.skip(10),disabled:a,testId:`voice-forward`,children:(0,U.jsxs)(`span`,{className:`text-xs font-medium`,children:[`+`,10,`s`]})}),(0,U.jsx)(n7,{label:`Next sentence`,onClick:()=>e?.nextSentence(),disabled:a,testId:`voice-next`,children:(0,U.jsx)(G.SkipForward,{className:`h-4 w-4`})}),(0,U.jsxs)(`span`,{className:`ml-1 flex items-center gap-1 text-xs text-fg-muted`,"aria-live":`polite`,"data-testid":`voice-player-status`,children:[i?.status===`buffering`?(0,U.jsx)(G.Spinner,{className:`h-3.5 w-3.5`}):null,Dye(i)]}),(0,U.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-xs text-fg-muted`,children:[(0,U.jsxs)(`span`,{className:`tabular-nums`,children:[`Speed ×`,n.toFixed(2)]}),(0,U.jsx)(`input`,{type:`range`,"aria-label":`Speed`,min:Ap,max:2,step:.05,value:n,onChange:e=>r(Number(e.target.value))})]})]})]})}var kye=(0,v.memo)(function({index:e,text:t,current:n,onPick:r}){return(0,U.jsx)(`span`,{"data-word":e,"data-current":n?`true`:void 0,onClick:()=>r(e),className:H(`cursor-pointer rounded-sm hover:bg-accent/10`,n&&`bg-accent/20 text-fg`),children:t})});function Aye({text:e,timeline:t,wordIndex:n,onPickWord:r,dir:i,lang:a}){let o=(0,v.useRef)(null),s=(0,v.useRef)(0),c=(0,v.useRef)(0),l=(0,v.useRef)(r);l.current=r;let u=(0,v.useMemo)(()=>e=>l.current(e),[]),d=t&&t.text===e?t.words.length:-1,f=(0,v.useMemo)(()=>{if(!t||d<0)return null;let n=[],r=0;for(let i of t.words)n.push({gap:e.slice(r,i.start),word:{index:i.index,text:e.slice(i.start,i.end)}}),r=i.end;return n.push({gap:e.slice(r),word:null}),n},[d,e]);(0,v.useEffect)(()=>{if(n<0||!o.current||Date.now()-s.current<4e3)return;let e=o.current.querySelector(`[data-word="${n}"]`);e&&(c.current=Date.now(),e.scrollIntoView({block:`nearest`}))},[n]);let p=()=>{s.current=Date.now()},m=e;return f&&(m=f.map((e,t)=>(0,U.jsx)(jye,{gap:e.gap,word:e.word,current:e.word?.index===n,onPick:u},t))),(0,U.jsx)(`p`,{ref:o,className:`max-h-64 overflow-y-auto whitespace-pre-wrap rounded-md border border-border bg-surface-2 px-3 py-2 leading-relaxed`,"data-testid":`voice-summary-text`,dir:i,lang:a,onWheel:p,onTouchMove:p,onScroll:()=>{Date.now()-c.current>200&&p()},children:m})}var jye=(0,v.memo)(function({gap:e,word:t,current:n,onPick:r}){return(0,U.jsxs)(U.Fragment,{children:[e,t?(0,U.jsx)(kye,{index:t.index,text:t.text,current:n,onPick:r}):null]})});function r7(e){let[t,n]=(0,v.useState)([]);return(0,v.useEffect)(()=>{if(!e||typeof window>`u`||!window.speechSynthesis)return;let t=window.speechSynthesis,r=()=>n(t.getVoices());return r(),t.addEventListener?.(`voiceschanged`,r),()=>t.removeEventListener?.(`voiceschanged`,r)},[e]),t}function i7(e){let t=e instanceof Error?e.message:String(e);return/no route for|not_found|404/i.test(t)&&/voice/i.test(t)?`This PC’s OonaCode host does not know "Listen" yet — update OonaCode.`:t}function Mye(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`SELECT`||t===`TEXTAREA`||e.isContentEditable}function Nye({open:e,onClose:t}){let{state:n,api:r}=W(),i=n.voiceSummarySessionId,a=(0,v.useMemo)(()=>n.sessions.find(e=>e.id===i)??null,[n.sessions,i]),o=typeof window<`u`?window.oonacode?.tts:void 0,s=Ev(typeof window<`u`?window.oonacode?.platform:null,typeof navigator<`u`?navigator.userAgent:null),[c,l]=(0,v.useState)(()=>_v()),[u,d]=(0,v.useState)(null),f=r7(e),[p,m]=(0,v.useState)(null),[h,g]=(0,v.useState)(null),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)({kind:`idle`}),[S,C]=(0,v.useState)(null),w=(0,v.useRef)(null),[T,E]=(0,v.useState)(null),D=(0,v.useRef)(null),O=(0,v.useRef)(null),k=(0,v.useRef)(null),A=(0,v.useRef)(c.speed);A.current=c.speed;let j=Tye(T),M=bf(c.language)??bf(`en`),N=(0,v.useCallback)(e=>{l(t=>{let n={...t,...e};return vv(n),n})},[]),ee=(0,v.useMemo)(()=>p?.summaries??[],[p]),te=ee.find(e=>e.id===_)??ee[0]??null,P=(0,v.useCallback)(async()=>{if(!i||!r.listVoiceSummaries)return null;try{let e=await r.listVoiceSummaries(i),t={...e,summaries:kp(e.summaries)};return m(t),g(null),t}catch(e){return g(i7(e)),null}},[r,i]);(0,v.useEffect)(()=>{e&&(m(null),y(null),C(null),x({kind:`idle`}),P(),o?(d(null),o.listVoices().then(d,()=>d([]))):d([]))},[e,P,o]);let F=a?`${a.entryCount}:${a.mtime}`:null,ne=(0,v.useRef)(null),I=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(!e){ne.current=null;return}if(ne.current===null){ne.current=F;return}F!==ne.current&&(ne.current=F,!I.current&&(I.current=setTimeout(()=>{I.current=null,P()},800)))},[e,F,P]),(0,v.useEffect)(()=>()=>{I.current&&clearTimeout(I.current),I.current=null},[]);let re=(0,v.useCallback)(()=>{w.current?.abort(),w.current=null,k.current=null,D.current?.destroy(),D.current=null,O.current=null,E(null)},[]);(0,v.useEffect)(()=>{e||re()},[e,re]),(0,v.useEffect)(()=>()=>re(),[re]);let ie=(0,v.useMemo)(()=>wv(M,u??[],f),[M,u,f]),ae=Tv(ie,c.localVoice[M.code]),L=!!(o&&u&&!u.some(e=>e.engine===`espeak`)),oe=b.kind===`summarising`||b.kind===`translating`,se=!!(r.listVoiceSummaries&&r.createVoiceSummary),ce=typeof window<`u`&&!!window.speechSynthesis,le=te?zp(te,M.code):null,ue=ae?.key??null,de=ae?.kind??null,fe=te?.id??null,R=(0,v.useMemo)(()=>{if(!fe||le===null||!ue||!de)return null;let e=bv({key:ue,kind:de,label:``}),t,n;if(e&&o)t=`clip`,n=e;else if(de===`system`&&ce)t=`system`,n=ue.slice(7);else return null;let r={summaryId:fe,language:M.code,voiceKey:ue,text:le};return{key:Y5(r),...r,bcp47:M.bcp47,kind:t,voiceId:n}},[fe,le,ue,de,o,ce,M]);(0,v.useEffect)(()=>{if(!e||(R?.key??null)===(O.current?.key??null))return;let t=D.current,n=O.current,r=t?.snapshot()??null;if(t?.destroy(),D.current=null,O.current=R,!R){E(null);return}let i=gp(R.text,{language:R.language}),a;a=R.kind===`clip`&&o?new Sye({tts:o,voiceId:R.voiceId,language:R.language,timeline:i,entry:yye(R,i.sentences.length),rate:A.current,errorText:i7}):new Mp(Cye({synth:window.speechSynthesis,makeUtterance:e=>new SpeechSynthesisUtterance(e),voiceURI:R.voiceId,bcp47:R.bcp47}),i,{mode:Ov(s),rate:A.current});let c=!1;if(t&&n&&r){let e=r.status===`playing`||r.status===`buffering`;n.summaryId===R.summaryId&&n.language===R.language&&n.text===R.text?(r.wordIndex>=0&&r.status!==`ended`&&a.seekWord(r.wordIndex),c=e):n.summaryId===R.summaryId&&(c=e)}k.current===R.key&&(k.current=null,c=!0),D.current=a,E(a),c&&a.play()},[e,R,o,s]);let pe=async()=>{if(!i||!r.createVoiceSummary)return null;x({kind:`summarising`});let e=await r.createVoiceSummary(i,{words:c.words});return C(e.created?null:Hp.unchanged(Mv(e.summary.createdAt))),y(e.summary.id),await P(),e.summary},me=async()=>{if(!i)return;w.current?.abort();let e=new AbortController;w.current=e;let t=e.signal;k.current=null;try{let e=Lp(p,_)?await pe():te;if(t.aborted)return;if(!e)throw Error(`There is no summary to play.`);let n=zp(e,M.code);if(n===null){if(!r.translateVoiceSummary)throw Error(`This host cannot translate yet.`);x({kind:`translating`});let a=await r.translateVoiceSummary(i,e.id,{language:M.code});if(m(t=>Pye(t,e.id,a.translation)),t.aborted)return;n=a.translation.text,P()}if(!n.trim())throw Error(`There was nothing to read.`);if(!ae||ae.kind===`system`&&!ce)throw Error(ae?`This window has no system speech.`:Dv(M,!!o,s,L));x({kind:`idle`});let a=Y5({summaryId:e.id,language:M.code,voiceKey:ae.key,text:n});O.current?.key===a&&D.current?D.current.play():k.current=a}catch(e){if(t.aborted)return;x({kind:`error`,message:i7(e)})}finally{w.current===e&&(w.current=null)}},he=()=>{w.current?.abort(),w.current=null,k.current=null,oe&&x({kind:`idle`}),D.current?.pause()},ge=e=>{e!==te?.id&&(D.current?.pause(),C(null),y(e))},_e=async e=>{if(!(!i||!r.deleteVoiceSummary))try{await r.deleteVoiceSummary(i,e),_===e&&y(null),await P()}catch(e){x({kind:`error`,message:i7(e)})}},ve=e=>{let t=Tf(e);N({speed:t}),D.current?.setRate(t)};if((0,v.useEffect)(()=>{if(!e)return;let t=e=>{let t=D.current;if(!t||e.altKey||e.ctrlKey||e.metaKey||Mye(e.target))return;let n=e.target instanceof Element?e.target:null;if(!(n&&n!==document.body&&!n.closest(`[aria-label="Listen to this chat"]`))){if(e.key===` `||e.key===`Spacebar`){if(n?.closest(`button`))return;e.preventDefault(),t.toggle()}else if(e.key===`ArrowLeft`||e.key===`ArrowRight`){e.preventDefault();let n=e.key===`ArrowRight`;e.shiftKey?n?t.nextSentence():t.prevSentence():t.skip(n?10:-10)}}};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e]),!e)return null;let ye=a?Zu(a):`this chat`,be=te?Rp(te):[],xe=new Set(be),Se=le??te?.text??null,Ce=j?.status===`error`?j.error:null,we=j?.status===`playing`||j?.status===`buffering`,Te=T&&O.current?.text===Se?T.timeline:null;return(0,U.jsx)(GS,{open:e,title:`Listen to this chat`,onClose:t,wide:!0,footer:(0,U.jsxs)(U.Fragment,{children:[oe||we?(0,U.jsxs)(K,{onClick:he,"data-testid":`voice-stop`,children:[(0,U.jsx)(G.Stop,{className:`h-4 w-4`}),` Stop`]}):null,(0,U.jsxs)(K,{variant:`primary`,onClick:()=>void me(),disabled:oe||!se||!i,"data-testid":`voice-play`,children:[(0,U.jsx)(G.Play,{className:`h-4 w-4`}),` Play`]}),(0,U.jsx)(K,{onClick:t,children:`Close`})]}),children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-3 text-sm`,children:[se?null:(0,U.jsx)(`p`,{className:`text-danger`,children:`This version of the host cannot make voice summaries.`}),(0,U.jsx)(Eye,{summaries:ee,loaded:p!==null,selectedId:te?.id??null,changed:Lp(p,_),notice:S,error:h,locked:oe,onSelect:ge,onDelete:e=>void _e(e)}),(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`A spoken summary of `,(0,U.jsx)(`span`,{className:`font-medium text-fg`,children:ye}),` — its goal, what was done, where it stands and what is pending — written by the chat’s own model, in English. Other languages are translated once by `,xf.label,` on your OonaCode credits and kept with the summary.`]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,U.jsx)(HS,{label:`Language`,children:(0,U.jsx)(`select`,{"aria-label":`Language`,className:US,value:M.code,disabled:oe,onChange:e=>N({language:e.target.value}),children:yf.map(e=>{let t=e.name===e.native?e.name:`${e.name} — ${e.native}`;return(0,U.jsx)(`option`,{value:e.code,children:xe.has(e.code)?`${t} ✓`:t},e.code)})})}),o&&u===null?(0,U.jsx)(`p`,{className:`px-1 py-2 text-fg-muted`,"data-testid":`voice-loading`,children:`Looking for this PC’s voices…`}):ie.length>0?(0,U.jsx)(HS,{label:`Voice`,children:(0,U.jsx)(`select`,{"aria-label":`Voice`,className:US,value:ae?.key??``,disabled:oe,onChange:e=>N({localVoice:{...c.localVoice,[M.code]:e.target.value}}),children:ie.map(e=>(0,U.jsx)(`option`,{value:e.key,children:e.label},e.key))})}):(0,U.jsx)(`p`,{className:`rounded-md border border-border bg-surface-2 px-3 py-2 text-fg-muted`,"data-testid":`no-local-voice`,children:Dv(M,!!o,s,L)}),(0,U.jsx)(HS,{label:`Length of a new summary`,children:(0,U.jsxs)(`select`,{"aria-label":`Length of a new summary`,className:US,value:String(c.words),disabled:oe,onChange:e=>N({words:Number(e.target.value)}),children:[(0,U.jsx)(`option`,{value:`120`,children:`Short — about 120 words`}),(0,U.jsx)(`option`,{value:`200`,children:`Normal — about 200 words`}),(0,U.jsx)(`option`,{value:`300`,children:`Long — about 300 words`}),[120,200,300].includes(c.words)?null:(0,U.jsxs)(`option`,{value:String(c.words),children:[c.words,` words`]})]})})]}),(0,U.jsx)(Fye,{stage:b,playerError:Ce}),(0,U.jsx)(Oye,{player:T,snapshot:j,speed:c.speed,onSpeed:ve}),te&&Se!==null?(0,U.jsxs)(`section`,{children:[(0,U.jsxs)(`div`,{className:`mb-1 flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-faint`,children:Hp.heading(M,le!==null)}),be.length>1?(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1`,role:`group`,"aria-label":`Languages it has`,children:be.map(e=>{let t=bf(e);if(!t)return null;let n=e===M.code;return(0,U.jsx)(`button`,{type:`button`,"aria-pressed":n,title:t.name===t.native?t.name:`${t.name} — ${t.native}`,disabled:oe,onClick:()=>N({language:e}),"data-testid":`voice-lang-chip`,className:H(`rounded-full border px-2 py-0.5 text-xs`,n?`border-accent bg-accent/15 text-accent`:`border-border text-fg-muted hover:bg-surface-2`),children:e.toUpperCase()},e)})}):null]}),(0,U.jsx)(Aye,{text:Se,timeline:Te,wordIndex:j?.wordIndex??-1,onPickWord:e=>D.current?.seekWord(e),dir:le!==null&&M.rtl?`rtl`:`ltr`,lang:le===null?`en-US`:M.bcp47})]}):null]})})}function Pye(e,t,n){return e&&{...e,summaries:e.summaries.map(e=>e.id===t?{...e,translations:[...e.translations.filter(e=>e.language!==n.language),n]}:e)}}function Fye({stage:e,playerError:t}){let n=e.kind===`error`?e.message:t;if(n)return(0,U.jsx)(`p`,{className:`rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-danger`,role:`alert`,"data-testid":`voice-stage`,children:n});if(e.kind!==`summarising`&&e.kind!==`translating`)return null;let r=[{key:`summarising`,label:Hp.generating},{key:`translating`,label:Hp.translating}],i=r.findIndex(t=>t.key===e.kind);return(0,U.jsx)(`ol`,{className:`flex flex-wrap items-center gap-2 text-xs`,"data-testid":`voice-stage`,"aria-live":`polite`,children:r.map((e,t)=>(0,U.jsx)(`li`,{className:H(`rounded-full px-2 py-0.5`,t===i?`bg-accent/15 font-medium text-accent`:t<i?`text-fg-muted line-through`:`text-fg-faint`),children:e.label},e.key))})}function a7(e){return Rf(e).replace(/\n+/g,` `).trim()||e.trim()}function o7(e){let t=e instanceof Error?e.message:String(e);return/no route for|404/i.test(t)&&/about/i.test(t)?`This PC’s OonaCode host cannot read the abouts in other languages yet — update OonaCode. English plays.`:t}function Iye(e){return{sessionId:e.sessionId,title:e.title.trim()||`Untitled chat`,about:e.about}}function Lye(e){return e.filter(e=>!e.pending&&e.source!==`user`&&(!e.about||e.stale))}function Rye({open:e,picked:t}){let{api:n}=W(),r=(0,v.useRef)(n);r.current=n;let i=typeof window<`u`?window.oonacode?.tts:void 0,a=Ev(typeof window<`u`?window.oonacode?.platform:null,typeof navigator<`u`?navigator.userAgent:null),[o,s]=(0,v.useState)(()=>_v()),[c,l]=(0,v.useState)(null),u=r7(e),d=bf(o.language)??bf(`en`),f=(0,v.useMemo)(()=>wv(d,c??[],u),[d,c,u]),p=Tv(f,o.localVoice[d.code]),m=!!(i&&c&&!c.some(e=>e.engine===`espeak`)),[h,g]=(0,v.useState)(Yv),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(0),[S,C]=(0,v.useState)(!1),w=(0,v.useRef)({lang:d,voice:p,speed:o.speed,espeakMissing:m,platform:a,tts:i});w.current={lang:d,voice:p,speed:o.speed,espeakMissing:m,platform:a,tts:i};let T=(0,v.useCallback)(e=>{s(t=>{let n={...t,...e};return vv(n),n})},[]),E=(0,v.useMemo)(()=>{let e=Lv();return new ey({words:async e=>{let{lang:t}=w.current;if(!e.about)return{name:a7(e.title),body:[gf(t.code)]};if(t.code===`en`)return{name:a7(e.title),body:Uf(Rf(e.about))};let n=r.current.translateChatAbout;if(!n)throw Error(`This PC’s OonaCode host cannot read the abouts in other languages yet — update OonaCode. English plays.`);try{let r=await n(e.sessionId,{language:t.code});return r.created&&x(e=>e+1),{name:r.translation.name?a7(r.translation.name):null,body:Uf(r.translation.text)}}catch(e){throw Error(`could not translate it: ${o7(e)}`)}},speak:(t,{signal:n,onItem:r})=>{let i=w.current;return ty(t,{voice:i.voice,language:i.lang,speed:i.speed,tts:i.tts,player:e,synth:typeof window<`u`?window.speechSynthesis:void 0,makeUtterance:e=>new SpeechSynthesisUtterance(e),platform:i.platform,espeakMissing:i.espeakMissing,prepare:sp,signal:n,onItem:r})},silence:()=>{e.stop();try{typeof window<`u`&&window.speechSynthesis?.cancel()}catch{}},onState:g})},[]);(0,v.useEffect)(()=>{if(!e){E.reset();return}s(_v()),i?(l(null),i.listVoices().then(l,()=>l([]))):l([])},[e,i,E]),(0,v.useEffect)(()=>()=>E.dispose(),[E]),(0,v.useEffect)(()=>{E.resetWords()},[d.code,E]);let D=t.map(e=>`${e.sessionId}\u0000${e.title}\u0000${e.about??``}`).join(``);(0,v.useEffect)(()=>{C(!1)},[D,d.code]),(0,v.useEffect)(()=>{let r=n.planChatAboutTranslations;if(!e||d.code===`en`||t.length===0||!r){y(null);return}let i=!0;return r({language:d.code,sessionIds:t.map(e=>e.sessionId)}).then(e=>i&&y(e),()=>i&&y(null)),()=>{i=!1}},[e,d.code,D,b,n]);let O=h.status===`preparing`||h.status===`speaking`,k=d.code!==`en`&&_!==null&&_.language===d.code&&_.needed>lf.confirmAbove,A=(0,v.useCallback)(()=>{C(!1),E.start(t.map(Iye),0)},[E,t]),j=(0,v.useCallback)(()=>{if(t.length!==0){if(k&&!S){C(!0);return}A()}},[t.length,k,S,A]);return{prefs:o,update:T,lang:d,options:f,voice:p,espeakMissing:m,voicesLoading:!!i&&c===null,desktop:!!i,platform:a,state:h,busy:O,active:Xv(h),plan:_&&_.language===d.code?_:null,confirming:S,play:j,start:A,cancelConfirm:()=>C(!1),pause:()=>E.pause(),resume:()=>E.resume(),stop:()=>E.stop(),next:()=>E.next(),previous:()=>E.previous(),jumpTo:e=>E.jumpTo(e),pickedCount:t.length}}function zye({b:e,picked:t,enabled:n,generateAll:r,onGenerated:i}){let{api:a}=W(),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(null),u=Lye(t),d=u.filter(e=>!e.about).length,f=u.length-d,p=r?.running===!0,m=async()=>{if(a.generateChatAbouts){s(!0),l(null);try{i((await a.generateChatAbouts({sessionIds:u.map(e=>e.sessionId)})).generateAll)}catch(e){l(o7(e))}finally{s(!1)}}},h=e.busy;return(0,U.jsxs)(`section`,{className:`space-y-2 rounded-md border border-border px-3 py-2`,"data-testid":`briefing-panel`,"aria-label":`Listen to the picked chats`,children:[(0,U.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-faint`,children:`Listen to the picked chats`}),(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`Tick chats below, then Play: each chat’s name, then its about, one after another. Another language is translated once by `,xf.label,` on your OonaCode credits and kept, so playing it again costs nothing.`]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,U.jsx)(HS,{label:`Language`,children:(0,U.jsx)(`select`,{"aria-label":`Language`,className:US,value:e.lang.code,disabled:h,onChange:t=>e.update({language:t.target.value}),"data-testid":`briefing-language`,children:yf.map(e=>(0,U.jsx)(`option`,{value:e.code,children:e.name===e.native?e.name:`${e.name} — ${e.native}`},e.code))})}),e.voicesLoading?(0,U.jsx)(`p`,{className:`px-1 py-2 text-xs text-fg-muted`,"data-testid":`briefing-voices-loading`,children:`Looking for this PC’s voices…`}):e.options.length>0?(0,U.jsx)(HS,{label:`Voice`,children:(0,U.jsx)(`select`,{"aria-label":`Voice`,className:US,value:e.voice?.key??``,disabled:h,onChange:t=>e.update({localVoice:{...e.prefs.localVoice,[e.lang.code]:t.target.value}}),"data-testid":`briefing-voice`,children:e.options.map(e=>(0,U.jsx)(`option`,{value:e.key,children:e.label},e.key))})}):(0,U.jsx)(`p`,{className:`rounded-md border border-border bg-surface-2 px-2 py-1.5 text-xs text-fg-muted sm:col-span-2`,"data-testid":`briefing-no-voice`,children:Dv(e.lang,e.desktop,e.platform,e.espeakMissing)}),(0,U.jsx)(HS,{label:`Speed ×${e.prefs.speed.toFixed(2)}`,children:(0,U.jsx)(`input`,{"aria-label":`Speed`,type:`range`,min:Cf.speed.min,max:Cf.speed.max,step:.05,value:e.prefs.speed,disabled:h,onChange:t=>e.update({speed:Number(t.target.value)})})})]}),e.plan&&t.length>0?(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`briefing-cost`,children:[vf(e.plan,e.lang.name),e.plan.needed>0?` — paid once, then kept.`:``]}):null,e.confirming&&e.plan?(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-md border border-warn/50 bg-warn-soft px-2 py-1.5 text-xs text-fg`,role:`alert`,"data-testid":`briefing-confirm`,children:[(0,U.jsxs)(`p`,{className:`basis-full`,children:[`Before playing: `,vf(e.plan,e.lang.name),` — paid once from your OonaCode credits, then kept.`]}),(0,U.jsx)(K,{size:`sm`,variant:`primary`,onClick:e.start,"data-testid":`briefing-confirm-play`,children:`Translate and play`}),(0,U.jsx)(K,{size:`sm`,variant:`ghost`,onClick:e.cancelConfirm,children:`Cancel`})]}):null,u.length>0&&a.generateChatAbouts?(0,U.jsxs)(`div`,{className:`space-y-1.5 text-xs`,"data-testid":`briefing-need-about`,children:[(0,U.jsx)(`p`,{className:`text-fg-muted`,children:Jv(d,f)}),(0,U.jsxs)(K,{size:`sm`,onClick:()=>void m(),busy:o,disabled:!n||p||e.busy,title:n?void 0:`Chat abouts are off — turn them on above.`,"data-testid":`briefing-write-first`,children:[(0,U.jsx)(G.Refresh,{className:`h-3 w-3`}),` Write abouts for these first`]})]}):null,c?(0,U.jsx)(`p`,{className:`text-xs text-danger`,"data-testid":`briefing-write-error`,children:c}):null]})}function Bye({b:e}){let t=e.state,n=t.index>=0?` (${t.index+1} of ${t.total})`:``,r=null;return t.status===`preparing`?r=`Now: ${t.title??``}${n} — ${e.lang.code===`en`?`getting ready…`:`translating…`}`:t.status===`speaking`?r=`Now: ${t.title??``}${n}`:t.status===`paused`?r=`Paused: ${t.title??``}${n}`:t.status===`done`?r=`Finished — ${t.total} chat${t.total===1?``:`s`} read.`:t.status===`stopped`?r=`Stopped.`:t.status===`error`&&(r=t.error),(0,U.jsxs)(U.Fragment,{children:[r?(0,U.jsx)(`p`,{className:H(`mr-auto min-w-0 basis-full truncate text-xs sm:basis-auto sm:flex-1`,t.status===`error`?`text-danger`:`text-fg-muted`),title:r,"aria-live":`polite`,"data-testid":`briefing-now`,children:r}):null,e.active||t.status===`error`?(0,U.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-1`,children:[(0,U.jsx)(K,{size:`sm`,onClick:e.previous,disabled:t.status===`error`,"aria-label":`Previous chat`,title:`Previous chat`,"data-testid":`briefing-previous`,children:(0,U.jsx)(G.SkipBack,{className:`h-3.5 w-3.5`})}),t.status===`paused`||t.status===`error`?(0,U.jsxs)(K,{size:`sm`,variant:`primary`,onClick:e.resume,"data-testid":`briefing-resume`,children:[(0,U.jsx)(G.Play,{className:`h-3.5 w-3.5`}),` `,t.status===`error`?`Try again`:`Resume`]}):(0,U.jsxs)(K,{size:`sm`,onClick:e.pause,"data-testid":`briefing-pause`,children:[(0,U.jsx)(G.Pause,{className:`h-3.5 w-3.5`}),` Pause`]}),(0,U.jsxs)(K,{size:`sm`,onClick:e.stop,"data-testid":`briefing-stop`,children:[(0,U.jsx)(G.Stop,{className:`h-3.5 w-3.5`}),` Stop`]}),(0,U.jsx)(K,{size:`sm`,onClick:e.next,disabled:t.status===`error`,"aria-label":`Next chat`,title:`Next chat`,"data-testid":`briefing-next`,children:(0,U.jsx)(G.SkipForward,{className:`h-3.5 w-3.5`})})]}):(0,U.jsxs)(K,{variant:`primary`,onClick:e.play,disabled:e.pickedCount===0||e.voice===null||e.voicesLoading,title:e.pickedCount===0?`Tick the chats to hear first`:void 0,"data-testid":`briefing-play`,children:[(0,U.jsx)(G.Play,{className:`h-4 w-4`}),` Play `,e.pickedCount,` picked`]})]})}function Vye({open:e,onClose:t}){let{state:n,actions:r}=W(),i=n.chatAboutsChange,[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(!1),S=(0,v.useRef)(-1),[C,w]=(0,v.useState)(()=>Uv()),[T,E]=(0,v.useState)(()=>new Set),[D,O]=(0,v.useState)(()=>Date.now()),k=(0,v.useCallback)(async()=>{let e=await r.listChatAbouts();if(e===`unsupported`){c(!0);return}if(e===null){u(!0);return}c(!1),u(!1),o(e),f(e.generateAll)},[r]);(0,v.useEffect)(()=>{e&&(S.current=i.seq,O(Date.now()),k())},[e]);let A=e=>{w(t=>{let n={...t,...e};return Wv(n),n}),O(Date.now())};(0,v.useEffect)(()=>{!e||i.seq===S.current||(S.current=i.seq,i.generateAll!==void 0&&f(i.generateAll),k())},[e,i,k]);let j=n.settings?.chatAboutEnabled??a?.settings.enabled??Pd.enabled,M=async e=>{x(!0);try{await r.saveSettings({chatAboutEnabled:e})}finally{x(!1)}k()},N=async()=>{g(!0);try{let e=await r.generateAllChatAbouts();e&&f(e.generateAll)}finally{g(!1)}},ee=async()=>{y(!0);try{let e=await r.stopGenerateAllChatAbouts();e&&f(e.generateAll)}finally{y(!1)}},te=(0,v.useMemo)(()=>pf(C.range,D,{from:C.from,to:C.to}),[C,D]),P=(0,v.useMemo)(()=>{let e=(a?.chats??[]).filter(e=>mf(e.updatedAt,te)),t=e=>{let t=Date.parse(e.updatedAt);return Number.isFinite(t)?t:0};return[...e].sort((e,n)=>t(n)-t(e))},[a,te]),F=(0,v.useMemo)(()=>{let e=p.trim().toLowerCase();return e?P.filter(t=>t.title.toLowerCase().includes(e)||(t.about??``).toLowerCase().includes(e)):P},[P,p]),ne=(0,v.useMemo)(()=>F.map(e=>e.sessionId),[F]),I=ne.join(`,`);(0,v.useEffect)(()=>{E(e=>qv(e,ne))},[I]);let re=(0,v.useMemo)(()=>F.filter(e=>T.has(e.sessionId)),[F,T]),ie=Gv(ne,T),ae=(0,v.useRef)(null);(0,v.useEffect)(()=>{ae.current&&(ae.current.indeterminate=ie===`some`)});let L=Rye({open:e,picked:re}),oe=L.active||L.state.status===`error`,se=(0,v.useMemo)(()=>new Set(L.state.playlist),[L.state.playlist]),ce=oe?L.state.sessionId:null,le=e=>E(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),ue=uf.find(e=>e.id===C.range)?.label??``,de=(0,v.useCallback)(e=>n.sessions.find(t=>t.id===e)?.entryCount??null,[n.sessions]),fe=a?nf(a.totals):null,R=d?.running===!0;return(0,U.jsxs)(GS,{open:e,title:`What your chats are about`,onClose:t,wide:!0,footer:(0,U.jsxs)(U.Fragment,{children:[a!==null&&!s?(0,U.jsx)(Bye,{b:L}):null,(0,U.jsx)(K,{variant:`ghost`,onClick:t,children:`Close`})]}),children:[(0,U.jsxs)(`p`,{className:`mb-3 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,U.jsx)(`span`,{className:`min-w-0`,children:`A short note per chat on this PC saying what it works on, so your other chats can tell which one to ask.`}),(0,U.jsx)(BS,{label:`What your chats are about`,details:(0,U.jsx)(VS,{items:[...cf.what,...cf.when,...cf.who,...cf.yours,...cf.where]})})]}),s?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,"data-testid":`chat-abouts-unsupported`,children:`OonaCode on this PC is too old for chat abouts. Update it, then open this window again.`}):a===null?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,"data-testid":`chat-abouts-loading`,children:l?`Could not read the abouts from this PC right now. They show here as soon as it answers.`:`Loading…`}):(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsx)(`div`,{className:`rounded-md border border-border px-3`,children:(0,U.jsx)(KS,{label:`Write an about for every chat`,hint:j?`On: each chat’s housekeeper model writes its about in the background.`:`Off: nothing is written and nothing is spent. Regenerate and “Generate for all chats now” are unavailable.`,details:[cf.switch,...cf.who],checked:j,disabled:b,onChange:e=>void M(e),testId:`chat-abouts-switch`})}),fe?(0,U.jsxs)(`div`,{className:`text-xs text-fg-muted`,"data-testid":`chat-abouts-totals`,children:[(0,U.jsx)(`span`,{className:`font-medium text-fg`,children:`All about calls so far: `}),(0,U.jsx)(`span`,{"data-testid":`chat-abouts-totals-line`,children:fe.line}),fe.unpriced?(0,U.jsx)(`span`,{className:`block text-fg-faint`,"data-testid":`chat-abouts-totals-unpriced`,children:fe.unpriced}):null]}):null,(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsxs)(K,{size:`sm`,variant:`primary`,onClick:()=>void N(),busy:h,disabled:!j||R,title:j?cf.generateAll:cf.regenerateOff,"data-testid":`chat-abouts-generate-all`,children:[(0,U.jsx)(G.Refresh,{className:`h-3 w-3`}),` Generate for all chats now`]}),(0,U.jsx)(BS,{label:`Generate for all chats now`,details:cf.generateAll})]}),R?(0,U.jsxs)(K,{size:`sm`,variant:`danger`,onClick:()=>void ee(),busy:_,title:cf.stop,"data-testid":`chat-abouts-stop`,children:[(0,U.jsx)(G.Stop,{className:`h-3 w-3`}),` Stop`]}):null]}),d?(0,U.jsx)(Hye,{g:d}):null,(0,U.jsx)(zye,{b:L,picked:re,enabled:j,generateAll:d,onGenerated:f}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium text-fg`,children:[`Last active`,(0,U.jsx)(`select`,{"aria-label":`Last active`,className:H(US,`text-xs`),value:C.range,onChange:e=>A({range:e.target.value}),"data-testid":`chat-abouts-range`,children:uf.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),C.range===`custom`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium text-fg`,children:[`From`,(0,U.jsx)(`input`,{type:`date`,"aria-label":`From`,className:H(q,`text-xs`),value:C.from,onChange:e=>A({from:e.target.value}),"data-testid":`chat-abouts-from`})]}),(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium text-fg`,children:[`To`,(0,U.jsx)(`input`,{type:`date`,"aria-label":`To`,className:H(q,`text-xs`),value:C.to,onChange:e=>A({to:e.target.value}),"data-testid":`chat-abouts-to`})]})]}):null,(0,U.jsx)(`input`,{className:H(q,`min-w-[10rem] flex-1 basis-40 text-xs`),type:`search`,value:p,onChange:e=>m(e.target.value),placeholder:`Find a chat by its title or its about`,"aria-label":`Find a chat by its title or its about`,"data-testid":`chat-abouts-filter`})]}),F.length>0?(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-xs`,children:[(0,U.jsxs)(`label`,{className:`inline-flex items-center gap-2 font-medium text-fg`,children:[(0,U.jsx)(`input`,{ref:ae,type:`checkbox`,checked:ie===`all`,"aria-checked":ie===`some`?`mixed`:ie===`all`,onChange:()=>E(e=>Kv(ne,e)),"data-testid":`chat-abouts-select-all`}),`Select all`]}),(0,U.jsxs)(`span`,{className:`text-fg-muted`,"data-testid":`chat-abouts-count`,children:[F.length,` chat`,F.length===1?``:`s`,re.length>0?` · ${re.length} picked`:``]})]}):null,a.chats.length===0?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,"data-testid":`chat-abouts-empty`,children:`No chats on this PC yet.`}):F.length===0?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,"data-testid":`chat-abouts-no-match`,children:p.trim()?`No chat matches “${p.trim()}”${C.range===`all`?``:` in ${ue.toLowerCase()}`}.`:`No chat was active in ${C.range===`custom`?`that range`:ue.toLowerCase()}.`}):(0,U.jsx)(`ul`,{className:`space-y-2`,"data-testid":`chat-abouts-list`,children:F.map(e=>(0,U.jsx)(Uye,{row:e,enabled:j,entryCount:de(e.sessionId),checked:T.has(e.sessionId),onToggle:()=>le(e.sessionId),playing:ce===e.sessionId,onJump:oe&&se.has(e.sessionId)?()=>L.jumpTo(e.sessionId):null,onOpen:()=>{r.selectSession(e.sessionId)}},e.sessionId))})]})]})}function Hye({g:e}){let t=e.total>0?Math.round(Math.min(e.done,e.total)/e.total*100):100;return(0,U.jsxs)(`div`,{className:`space-y-1 text-xs`,"data-testid":`chat-abouts-progress`,children:[(0,U.jsx)(`div`,{className:`text-fg-muted`,"data-testid":`chat-abouts-progress-line`,children:af(e)}),(0,U.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-surface-3`,role:`progressbar`,"aria-label":`Generate for all chats now`,"aria-valuemin":0,"aria-valuemax":e.total,"aria-valuenow":e.done,children:(0,U.jsx)(`div`,{className:H(`h-full rounded-full`,e.running?`bg-accent`:`bg-fg-faint`),style:{width:`${t}%`}})}),!e.running&&e.stoppedReason?(0,U.jsxs)(`div`,{className:`text-warn`,"data-testid":`chat-abouts-stopped-reason`,children:[`Stopped: `,e.stoppedReason]}):null]})}function Uye({row:e,enabled:t,entryCount:n,checked:r,onToggle:i,playing:a,onJump:o,onOpen:s}){let c=e.title.trim()||`Untitled chat`,l=Zd(e),u=(0,v.useRef)(null);return(0,v.useEffect)(()=>{a&&u.current?.scrollIntoView?.({block:`nearest`})},[a]),(0,U.jsxs)(`li`,{ref:u,className:H(`rounded-md border px-3 py-2 text-xs`,a?`border-accent bg-accent/10`:`border-border`,o?`cursor-pointer hover:border-accent`:``),onClick:o??void 0,title:o&&!a?`Play from this chat`:void 0,"aria-current":a?`true`:void 0,"data-testid":`chat-about-row-${e.sessionId}`,"data-playing":a?`true`:void 0,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`shrink-0`,checked:r,onChange:i,onClick:e=>e.stopPropagation(),"aria-label":`Pick ${c}`,"data-testid":`chat-about-pick`}),a?(0,U.jsx)(G.Speaker,{className:`h-3.5 w-3.5 text-accent`,title:`Playing`}):null,(0,U.jsx)(`button`,{type:`button`,className:`min-w-0 max-w-full truncate text-left text-sm font-medium text-fg hover:text-accent hover:underline`,onClick:e=>{e.stopPropagation(),s()},title:`Open this chat`,"data-testid":`chat-about-open`,children:c}),e.source===`user`?(0,U.jsx)(`span`,{title:cf.yours[0],children:(0,U.jsx)(WS,{tone:`accent`,children:`yours`})}):null,e.stale&&e.about?(0,U.jsx)(`span`,{title:cf.stale,"data-testid":`chat-about-stale`,children:(0,U.jsx)(WS,{tone:`warn`,children:`stale`})}):null,e.pending?(0,U.jsx)(`span`,{"data-testid":`chat-about-pending`,children:(0,U.jsx)(WS,{tone:`accent`,children:`writing…`})}):null]}),e.about?(0,U.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words text-fg`,"data-testid":`chat-about-text`,children:e.about}):null,e.about&&e.stale?(0,U.jsx)(`p`,{className:`mt-0.5 text-warn`,"data-testid":`chat-about-stale-note`,children:`The chat has moved on since this about was written.`}):null,e.about?null:(0,U.jsxs)(`p`,{className:`mt-1 text-fg-muted`,"data-testid":`chat-about-missing`,children:[`No about yet. `,rf(e,{enabled:t,entryCount:n})]}),e.about&&e.lastError?(0,U.jsxs)(`p`,{className:`mt-0.5 text-danger`,"data-testid":`chat-about-error`,children:[`The last attempt failed: `,e.lastError]}):null,(0,U.jsxs)(`div`,{className:`mt-1 flex flex-wrap justify-between gap-x-3 gap-y-0.5 text-[11px] text-fg-faint`,children:[(0,U.jsxs)(`span`,{title:W_(e.updatedAt),"data-testid":`chat-about-active`,children:[`Active `,U_(e.updatedAt)]}),e.about&&e.aboutAt?(0,U.jsxs)(`span`,{title:W_(e.aboutAt),"data-testid":`chat-about-written`,children:[`Written `,U_(e.aboutAt),l?` by ${l}`:``]}):(0,U.jsx)(`span`,{}),(0,U.jsx)(`span`,{title:e.route?`Paid by ${Qd[e.route]}`:void 0,"data-testid":`chat-about-spend`,children:tf(e.spend,e.route)})]})]})}function Wye({open:e,onClose:t}){let{state:n,actions:r}=W(),i=n.nextPromptsChange,[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(()=>lb()),[h,g]=(0,v.useState)(()=>sb()),[_,y]=(0,v.useState)(()=>new Set),[b,x]=(0,v.useState)(()=>Date.now()),[S,C]=(0,v.useState)(!1),[w,T]=(0,v.useState)(!1),[E,D]=(0,v.useState)({}),[O,k]=(0,v.useState)(()=>new Set),[A,j]=(0,v.useState)({}),[M,N]=(0,v.useState)(()=>new Set),[ee,te]=(0,v.useState)({}),P=(0,v.useRef)(-1),F=(0,v.useCallback)(async()=>{let e=await r.listNextPrompts();if(e===`unsupported`){c(!0);return}if(e===null){u(!0);return}c(!1),u(!1),o(e),f(e.review)},[r]);(0,v.useEffect)(()=>{e&&(P.current=i.seq,x(Date.now()),F())},[e]),(0,v.useEffect)(()=>{!e||i.seq===P.current||(P.current=i.seq,i.review!==void 0&&f(i.review),F())},[e,i,F]);let ne=e=>{m(t=>{let n={...t,...e};return ub(n),n}),x(Date.now())},I=(0,v.useMemo)(()=>{let e=new Map;for(let t of a?.suggestions??[])e.set(t.sessionId,t);return e},[a]),re=(0,v.useMemo)(()=>pf(p.range,b,{from:p.from,to:p.to}),[p,b]),ie=(0,v.useMemo)(()=>{let e=e=>{let t=Date.parse(e.updatedAt);return Number.isFinite(t)?t:0};return n.sessions.filter(e=>!n.remote.tabs[e.id]&&mf(e.updatedAt,re)).sort((t,n)=>e(n)-e(t))},[n.sessions,n.remote.tabs,re]),ae=(0,v.useMemo)(()=>ie.map(e=>e.id),[ie]),L=ae.join(`,`);(0,v.useEffect)(()=>{y(e=>qv(e,ae))},[L]);let oe=(0,v.useMemo)(()=>ae.filter(e=>_.has(e)),[ae,_]),se=Gv(ae,_),ce=(0,v.useRef)(null);(0,v.useEffect)(()=>{ce.current&&(ce.current.indeterminate=se===`some`)});let le=e=>y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),ue=d?.running===!0,de=a?.model??Np.model,fe=uf.find(e=>e.id===p.range)?.label??``,R=async()=>{if(oe.length!==0){C(!0);try{let e=await r.reviewNextPrompts(oe,h);e&&f(e)}finally{C(!1)}}},pe=async()=>{T(!0);try{let e=await r.stopNextPromptReview();e&&f(e)}finally{T(!1)}},me=async e=>{k(t=>new Set(t).add(e)),j(({[e]:t,...n})=>n);try{let t=await r.suggestNextPrompt(e,{windowHours:h,force:!0});if(`error`in t){j(n=>({...n,[e]:t.error}));return}o(n=>n&&{...n,suggestions:[t.suggestion,...n.suggestions.filter(t=>t.sessionId!==e)]})}finally{k(t=>{let n=new Set(t);return n.delete(e),n})}},he=async(e,t,n)=>{let i=t.trim();if(i){N(t=>new Set(t).add(e));try{if(!await r.sendToChat(e,i))return;n&&r.markNextPromptSent(e,n.id,i),te(t=>({...t,[e]:new Date().toISOString()})),D(({[e]:t,...n})=>n)}finally{N(t=>{let n=new Set(t);return n.delete(e),n})}}};return(0,U.jsxs)(GS,{open:e,title:Ip.managerTitle,onClose:t,wide:!0,footer:(0,U.jsx)(K,{variant:`ghost`,onClick:t,children:`Close`}),children:[(0,U.jsx)(`p`,{className:`mb-3 text-xs text-fg-muted`,"data-testid":`manager-hint`,children:Ip.managerHint}),s?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,"data-testid":`manager-unsupported`,children:`OonaCode on this PC is too old for the project manager. Update it, then open this window again.`}):a===null?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,"data-testid":`manager-loading`,children:l?`Could not read the suggestions from this PC right now. They show here as soon as it answers.`:`Loading…`}):(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium text-fg`,children:[`Last active`,(0,U.jsx)(`select`,{"aria-label":`Last active`,className:H(US,`text-xs`),value:p.range,onChange:e=>ne({range:e.target.value}),"data-testid":`manager-range`,children:uf.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),p.range===`custom`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium text-fg`,children:[`From`,(0,U.jsx)(`input`,{type:`date`,"aria-label":`From`,className:H(q,`text-xs`),value:p.from,onChange:e=>ne({from:e.target.value}),"data-testid":`manager-from`})]}),(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium text-fg`,children:[`To`,(0,U.jsx)(`input`,{type:`date`,"aria-label":`To`,className:H(q,`text-xs`),value:p.to,onChange:e=>ne({to:e.target.value}),"data-testid":`manager-to`})]})]}):null,(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs font-medium text-fg`,children:[`Read the last`,(0,U.jsx)(`select`,{"aria-label":`Hours of each chat to read`,className:H(US,`text-xs`),value:h,onChange:e=>{let t=Number(e.target.value);g(t),cb(t)},"data-testid":`manager-window`,children:Pp.map(e=>(0,U.jsxs)(`option`,{value:e,children:[e,` hour`,e===1?``:`s`]},e))})]}),(0,U.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-1.5`,children:[(0,U.jsxs)(K,{size:`sm`,variant:`primary`,onClick:()=>void R(),busy:S,disabled:oe.length===0||ue,"data-testid":`manager-review`,children:[(0,U.jsx)(G.Lightbulb,{className:`h-3 w-3`}),` Review selected (`,oe.length,`)`]}),ue?(0,U.jsxs)(K,{size:`sm`,variant:`danger`,onClick:()=>void pe(),busy:w,"data-testid":`manager-stop`,children:[(0,U.jsx)(G.Stop,{className:`h-3 w-3`}),` Stop`]}):null]})]}),d?(0,U.jsxs)(`div`,{className:`space-y-1 text-xs`,"data-testid":`manager-progress`,children:[(0,U.jsx)(`div`,{className:`text-fg-muted`,"data-testid":`manager-progress-line`,children:db(d)}),(0,U.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-surface-3`,role:`progressbar`,"aria-label":`Review`,"aria-valuemin":0,"aria-valuemax":d.total,"aria-valuenow":d.done,children:(0,U.jsx)(`div`,{className:H(`h-full rounded-full`,d.running?`bg-accent`:`bg-fg-faint`),style:{width:`${d.total>0?Math.round(Math.min(d.done,d.total)/d.total*100):100}%`}})})]}):null,ie.length>0?(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-xs`,children:[(0,U.jsxs)(`label`,{className:`inline-flex items-center gap-2 font-medium text-fg`,children:[(0,U.jsx)(`input`,{ref:ce,type:`checkbox`,checked:se===`all`,"aria-checked":se===`some`?`mixed`:se===`all`,onChange:()=>y(e=>Kv(ae,e)),"data-testid":`manager-select-all`}),`Select all`]}),(0,U.jsxs)(`span`,{className:`text-fg-muted`,"data-testid":`manager-count`,children:[ie.length,` chat`,ie.length===1?``:`s`,oe.length>0?` · ${oe.length} picked`:``]})]}):null,ie.length===0?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,"data-testid":`manager-empty`,children:n.sessions.length===0?`No chats on this PC yet.`:`No chat was active in ${p.range===`custom`?`that range`:fe.toLowerCase()}.`}):(0,U.jsx)(`ul`,{className:`space-y-2`,"data-testid":`manager-list`,children:ie.map(e=>{let i=e.id,a=I.get(i)??null,o=n.transcripts[i]?.status??e.status,s=ee[i]&&(!a?.sentAt||ee[i]>a.sentAt)?ee[i]:a?.sentAt??null;return(0,U.jsx)(Gye,{session:e,status:o,suggestion:a,text:E[i]??a?.prompt??``,edited:E[i]!==void 0,checked:_.has(i),reviewing:O.has(i)||ue&&d.current.includes(i),error:A[i]??null,sending:M.has(i),sentAt:s,onToggle:()=>le(i),onEdit:e=>D(t=>({...t,[i]:e})),onSend:e=>void he(i,e,a),onSuggest:()=>void me(i),onOpen:()=>{r.selectSession(i),t()}},i)})}),(0,U.jsx)(`p`,{className:`text-[11px] text-fg-faint`,"data-testid":`manager-cost-note`,children:Ip.costNote(de)})]})]})}function Gye({session:e,status:t,suggestion:n,text:r,edited:i,checked:a,reviewing:o,error:s,sending:c,sentAt:l,onToggle:u,onEdit:d,onSend:f,onSuggest:p,onOpen:m}){let h=J_(e),g=hb(e,t),_=t===`running`||t===`waiting_permission`,v=n?.status===`failed`;return(0,U.jsxs)(`li`,{className:`rounded-md border border-border px-3 py-2 text-xs`,"data-testid":`manager-row-${e.id}`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`shrink-0`,checked:a,onChange:u,"aria-label":`Pick ${h}`,"data-testid":`manager-pick`}),(0,U.jsx)(mI,{status:t}),g?(0,U.jsx)(pI,{mark:g,testId:`manager-finished`}):null,(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-fg`,children:h}),(0,U.jsxs)(`span`,{className:`shrink-0 text-[11px] text-fg-faint`,title:W_(e.updatedAt),"data-testid":`manager-active`,children:[`Active `,U_(e.updatedAt)]})]}),o?(0,U.jsxs)(`p`,{className:`mt-1 flex items-center gap-1.5 text-fg-muted`,"data-testid":`manager-reading`,children:[(0,U.jsx)(G.Spinner,{className:`h-3 w-3`}),Ip.reviewing(n?.windowHours??Np.windowHours)]}):null,s?(0,U.jsx)(`p`,{className:`mt-1 text-danger`,"data-testid":`manager-error`,children:s}):null,n?v?(0,U.jsx)(`p`,{className:`mt-1 text-danger`,"data-testid":`manager-failed`,children:n.error??`The suggestion could not be written.`}):(0,U.jsxs)(`div`,{className:`mt-1 space-y-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start gap-1.5`,children:[(0,U.jsx)(`p`,{className:`min-w-0 flex-1 text-fg`,"data-testid":`manager-state`,children:n.state||`Where the chat stands is not said.`}),n.stale?(0,U.jsx)(`span`,{title:`The chat has moved on since this was written — Suggest for a fresh one.`,"data-testid":`manager-stale`,children:(0,U.jsx)(WS,{tone:`warn`,children:`stale`})}):null,i?(0,U.jsx)(`span`,{title:`Your edit is kept until you send it`,"data-testid":`manager-edited`,children:(0,U.jsx)(WS,{tone:`accent`,children:`edited`})}):null]}),n.why?(0,U.jsx)(`p`,{className:`text-fg-muted`,"data-testid":`manager-why`,children:n.why}):null,n.prompt===``&&!i?(0,U.jsx)(`p`,{className:`text-warn`,"data-testid":`manager-decide`,children:Ip.decideYourself}):null]}):!o&&!s?(0,U.jsx)(`p`,{className:`mt-1 text-fg-faint`,"data-testid":`manager-none`,children:`No suggestion yet — tick it and Review, or press Suggest.`}):null,n&&!v?(0,U.jsx)(`textarea`,{"aria-label":`Message for ${h}`,className:`mt-1.5 min-h-[4rem] w-full resize-y rounded-md border border-border bg-bg px-2 py-1.5 text-xs text-fg focus:border-accent focus:outline-none`,value:r,placeholder:`Write the message yourself, or press Suggest`,onChange:e=>d(e.target.value),"data-testid":`manager-text`}):null,(0,U.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-1.5`,children:[(0,U.jsxs)(K,{size:`sm`,variant:`primary`,disabled:!r.trim()||c,busy:c,onClick:()=>f(r),title:_?`The chat is working: this waits for the running turn`:void 0,"data-testid":`manager-send`,children:[(0,U.jsx)(G.Send,{className:`h-3 w-3`}),` `,_?`Send — queues behind the running turn`:`Send`]}),(0,U.jsxs)(K,{size:`sm`,variant:`secondary`,disabled:o,onClick:p,"data-testid":`manager-suggest`,children:[(0,U.jsx)(G.Lightbulb,{className:`h-3 w-3`}),` Suggest`]}),(0,U.jsx)(K,{size:`sm`,variant:`ghost`,onClick:m,"data-testid":`manager-open`,children:`Open chat`}),l?(0,U.jsxs)(`span`,{className:`text-ok`,"data-testid":`manager-sent`,children:[`Sent `,pb(l)]}):null,n?(0,U.jsxs)(`span`,{className:`ml-auto text-[11px] text-fg-faint`,"data-testid":`manager-cost`,children:[Vp(n.cost),` · `,U_(n.createdAt)]}):null]})]})}function Kye({open:e,onClose:t}){let{state:n,actions:r}=W(),i=n.assignProjectSessionId,a=i?n.sessions.find(e=>e.id===i)??null:null,o=i?n.drafts[i]??null:null,s=a?.projectId??o?.projectId??null,[c,l]=(0,v.useState)(s),[u,d]=(0,v.useState)(!1);(0,v.useEffect)(()=>{e&&l(s)},[e,s]);let f=a?.status===`running`||a?.status===`waiting_permission`,p=mte(a?J_(a):o?.title??`New chat`);async function m(){if(i){d(!0);try{await r.setSessionProject(i,c)&&t()}finally{d(!1)}}}return(0,U.jsxs)(GS,{open:e,title:`Move “${p}” to a project`,onClose:t,footer:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{variant:`ghost`,onClick:()=>{t(),r.openDialog(`projects`)},children:`Manage projects…`}),(0,U.jsx)(`span`,{className:`flex-1`}),(0,U.jsx)(K,{variant:`ghost`,onClick:t,children:`Cancel`}),(0,U.jsx)(K,{variant:`primary`,onClick:m,disabled:u||c===s,"data-testid":`assign-project-apply`,children:`Apply`})]}),children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5`,role:`radiogroup`,"aria-label":`Project`,children:[(0,U.jsx)(s7,{selected:c===null,onSelect:()=>l(null),label:`No project`,testId:`assign-project-none`}),n.vaultProjects.map(e=>(0,U.jsx)(s7,{selected:c===e.id,onSelect:()=>l(e.id),label:e.name,hint:e.instructions.trim()?`has instructions`:void 0,testId:`assign-project-${e.id}`},e.id)),n.vaultProjects.length===0?(0,U.jsxs)(`p`,{className:`px-2 py-2 text-xs text-fg-muted`,children:[`No projects yet — create one under `,(0,U.jsx)(`em`,{children:`Manage projects…`}),`.`]}):null]}),f?(0,U.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,"data-testid":`assign-project-busy`,children:`This chat is mid-turn — it moves now and the turn is left alone. The project's instructions reach the agent at your next message.`}):(0,U.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:`The project's instructions reach the agent on the chat's next start — nothing in the conversation is lost.`})]})}function s7({selected:e,onSelect:t,label:n,hint:r,testId:i}){return(0,U.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":e,onClick:t,className:H(`flex items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm`,e?`bg-accent-soft text-fg`:`hover:bg-surface-2 text-fg`),"data-testid":i,children:[(0,U.jsx)(`span`,{className:H(`inline-block h-3 w-3 rounded-full border`,e?`border-accent bg-accent`:`border-border`)}),(0,U.jsx)(G.Project,{className:`w-3.5 h-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n}),r?(0,U.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:r}):null]})}var qye=`Install Google’s agy`,c7=`Setting up Google’s agy for you — OonaCode downloads Google’s own release and checks its checksum (about 200 MB, nothing is bundled in OonaCode).`,Jye=`OonaCode downloads Google’s own agy release (about 200 MB) and checks its checksum before it uses it. Nothing from Google is bundled inside OonaCode.`,Yye=`Sign in with Google`,Xye=`This PC’s OonaCode is too old to run chats on Google’s agy — update it from the title bar.`,Zye=`Kept on this PC only, in memory: it is gone when OonaCode stops, and it is never synced or sent anywhere.`,Qye=new Set([`loadCodeAssist`,`fetchAdminControls`,`retrieveUserQuotaSummary`,`fetchUserInfo`,`fetchAvailableModels`,`listExperiments`,`writeTrajectoryAcls`,`recordTrajectoryAnalytics`]);function $ye(e){return e.kind===`tunnel`||e.method!==null&&Qye.has(e.method)}function ebe(e){let t=[],n=[];for(let r of e)($ye(r)?n:t).push(r);return{main:t,background:n}}function l7(e){if(e.kind===`tunnel`)return{title:e.host??`tunnel`,detail:null};let t=[e.model,e.requestType===`checkpoint`?`checkpoint`:null].filter(e=>!!e).join(` · `);return{title:e.method??`Code Assist call`,detail:t||null}}function u7(e){let{title:t,detail:n}=l7(e);return n?`${t} · ${n}`:t}function tbe(e){let t=e.denied||e.error!==null||e.status!==null&&e.status>=400?`danger`:`neutral`;return e.denied?{text:`denied`,tone:t}:e.status===null?e.error===null?{text:`pending`,tone:t}:{text:`error`,tone:t}:{text:String(e.status),tone:t}}var d7=e=>e.toLocaleString(`en-US`);function nbe(e){if(!e)return null;let t=e.cached>0?` (${d7(e.cached)} cached)`:``;return`in ${d7(e.input)}${t} · out ${d7(e.output)}`}function rbe(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}):``}function ibe(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function abe(e){switch(e){case`ready`:return{label:`Ready`,tone:`ok`};case`not_installed`:return{label:`agy is not installed`,tone:`warn`};case`not_signed_in`:return{label:`Not signed in to agy`,tone:`warn`};default:return{label:`agy did not answer`,tone:`danger`}}}function f7(e){return e.newerThanTested?`This agy is newer than the version OonaCode was tested with (${e.testedVersion}). It usually keeps working; if chats on it start failing, look for an OonaCode update.`:null}function p7(e){let t=e.update;return t?t.state===`waiting`||t.state===`failed`||t.heldBack?t.message:t.state===`updating`?t.message??`OonaCode is updating agy…`:null:null}function m7(e){let t=e.group.trim(),n=e.window.trim();return t&&n.toLowerCase().startsWith(`${t.toLowerCase()} `)&&(n=n.slice(t.length).trim()),t?n?`${t} · ${n}`:t:n}function obe(e){let t=e.remainingPercent,n=t!==null&&Number.isFinite(t),r=W_(e.resetsAt);return{remaining:n?`${Math.round(Math.min(100,Math.max(0,t)))}% left`:`unknown`,tone:mc(t),resets:r?`resets ${r}`:null}}var h7=1e3,sbe=2e3;function cbe(e){if(!e)return null;if(e.install.state===`working`)return h7;switch(e.login.phase){case`starting`:case`verifying`:return h7;case`awaiting_code`:return sbe;default:return null}}function lbe(e){if(!e)return!1;if(e.install.state===`working`)return!0;let t=e.login.phase;return t===`starting`||t===`awaiting_code`||t===`verifying`}function ube(e){switch(e){case`manifest`:return`Looking up Google’s latest release…`;case`download`:return`Downloading agy…`;case`verify`:return`Checking the download…`;case`place`:return`Finishing up…`;default:return`Starting the install…`}}function dbe(e){let{received:t,total:n}=e;return n===null||!Number.isFinite(n)||n<=0?null:Math.min(100,Math.max(0,Math.floor(t/n*100)))}function fbe(e){let{received:t,total:n}=e;return n!==null&&n>0?`${Ej(t)} of ${Ej(n)}`:t>0?Ej(t):null}function pbe(e){if(!e)return null;try{return new URL(e).protocol===`https:`?e:null}catch{return null}}function mbe(e,t){return t?e.split(t).join(`…`):e}function hbe(e,t){return e?`Status…`:t?t.state===`not_installed`?t.install.supported?`Install…`:`Status…`:t.state===`not_signed_in`?`Sign in…`:`Status…`:`Set up…`}var g7=15,gbe=2e4,_be=5e3,_7=null;function vbe(e){let[t,n]=(0,v.useState)(()=>Date.now());return(0,v.useEffect)(()=>{if(!e)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function ybe({install:e,busy:t,offer:n,onInstall:r,onCancel:i}){if(e.state===`working`){let n=dbe(e),r=fbe(e);return(0,U.jsxs)(`div`,{className:`space-y-1.5`,"data-testid":`agy-install`,"data-install-state":`working`,children:[(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`agy-install-statement`,children:c7}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-fg`,role:`status`,"data-testid":`agy-install-phase`,"data-phase":e.phase??void 0,children:[(0,U.jsx)(G.Spinner,{className:`h-3.5 w-3.5 shrink-0`}),(0,U.jsxs)(`span`,{className:`min-w-0`,children:[ube(e.phase),e.version?` (agy ${e.version})`:``]})]}),(0,U.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-surface-3`,role:`progressbar`,"aria-label":`Installing agy`,"aria-valuemin":0,"aria-valuemax":100,...n===null?{}:{"aria-valuenow":n},"data-indeterminate":n===null?`true`:void 0,"data-testid":`agy-install-bar`,children:(0,U.jsx)(`div`,{className:H(`h-full rounded-full bg-accent`,n===null?`w-1/3 animate-pulse`:void 0),style:n===null?void 0:{width:`${n}%`}})}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`text-[11px] text-fg-faint`,"data-testid":`agy-install-bytes`,children:r??``}),(0,U.jsx)(K,{size:`sm`,variant:`ghost`,disabled:t,onClick:i,"data-testid":`agy-install-cancel`,children:`Cancel`})]})]})}return e.supported?e.state===`idle`&&!n?(0,U.jsx)(`div`,{className:`space-y-2`,"data-testid":`agy-install`,"data-install-state":`starting`,children:(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`agy-install-statement`,children:c7})}):(0,U.jsxs)(`div`,{className:`space-y-2`,"data-testid":`agy-install`,"data-install-state":e.state,children:[e.state===`failed`?(0,U.jsx)(`div`,{className:`rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,"data-testid":`agy-install-failed`,children:e.error??`The install did not finish.`}):(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`agy-install-explanation`,children:Jye}),(0,U.jsxs)(K,{variant:`primary`,busy:t,disabled:t,onClick:r,"data-testid":e.state===`failed`?`agy-install-retry`:`agy-install-button`,children:[(0,U.jsx)(G.Download,{className:`h-4 w-4`}),` `,e.state===`failed`?`Try again`:qye]})]}):null}function bbe({login:e,busy:t,onStart:n,onRestart:r,onCancel:i,onSubmit:a}){let[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(!1),u=(0,v.useRef)(null);(0,v.useEffect)(()=>()=>{u.current&&clearTimeout(u.current)},[]),(0,v.useEffect)(()=>{e.phase!==`awaiting_code`&&s(``)},[e.phase]);let d=(0,v.useRef)(null),f=e.phase===`awaiting_code`,p=f?pbe(e.url):null,m=f&&e.expiresAt?Date.parse(e.expiresAt):NaN,h=Number.isFinite(m),g=vbe(f&&h),_=h?Math.max(0,Math.ceil((m-g)/1e3)):null,y=_===0;(0,v.useEffect)(()=>{y&&s(``)},[y]);let b=(0,v.useRef)(!1);(0,v.useEffect)(()=>{if(e.phase===`starting`&&(b.current=!0),!f||!p||!e.startedAt||_7===e.startedAt)return;let t=h?Date.now()-(m-6e4):1/0;if(!(!b.current&&t>_be)){_7=e.startedAt;try{H5(p)}catch{}}},[e.phase,p,e.startedAt]),(0,v.useEffect)(()=>{f&&SM(d.current)},[f]);let[x,S]=(0,v.useState)(!1);(0,v.useEffect)(()=>{if(e.phase!==`verifying`){S(!1);return}let t=setTimeout(()=>S(!0),gbe);return()=>clearTimeout(t)},[e.phase]);let C=o.trim(),w=Rh(C),T=()=>{!w||t||(s(``),a(C))},E=()=>{p&&dN(p).then(e=>{e&&(l(!0),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>l(!1),1500))})},D=(0,U.jsx)(K,{size:`sm`,variant:`ghost`,disabled:t,onClick:i,"data-testid":`agy-login-cancel`,children:`Cancel`});return(0,U.jsxs)(`div`,{ref:d,className:`space-y-2`,"data-testid":`agy-sign-in`,"data-login-phase":e.phase,children:[(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`agy-sign-in-explanation`,children:Zee}),e.phase===`starting`?(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`agy-login-starting`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-xs text-fg`,role:`status`,children:[(0,U.jsx)(G.Spinner,{className:`h-3.5 w-3.5 shrink-0`}),e.message??`Starting Google’s sign-in…`]}),(0,U.jsx)(`span`,{className:`flex-1`}),D]}):e.phase===`awaiting_code`?(0,U.jsxs)(`div`,{className:`space-y-2`,"data-testid":`agy-login-awaiting`,children:[y?(0,U.jsxs)(`div`,{className:`space-y-2`,"data-testid":`agy-login-expired`,children:[(0,U.jsx)(`div`,{className:`rounded-md border border-warn/40 bg-warn-soft px-3 py-2 text-xs text-warn`,role:`alert`,children:`Time ran out — Google’s agy only waits a minute. Press Sign in again.`}),(0,U.jsxs)(K,{variant:`primary`,busy:t,disabled:t,onClick:r,"data-testid":`agy-login-expired-restart`,children:[(0,U.jsx)(G.LogIn,{className:`h-4 w-4`}),` Sign in again`]})]}):(0,U.jsxs)(U.Fragment,{children:[e.message?(0,U.jsx)(`p`,{className:`text-xs text-fg`,children:e.message}):null,p?(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsxs)(`a`,{className:`inline-flex items-center gap-1 text-xs font-medium text-accent underline`,href:p,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>{e.preventDefault(),H5(p)},"data-testid":`agy-login-link`,children:[(0,U.jsx)(G.ExternalLink,{className:`h-3.5 w-3.5`}),` Open Google’s sign-in page`]}),(0,U.jsxs)(K,{size:`sm`,onClick:E,"data-testid":`agy-login-copy-link`,children:[(0,U.jsx)(G.Copy,{className:`h-3.5 w-3.5`}),` `,c?`Copied`:`Copy link`]})]}):null,(0,U.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs font-medium text-fg`,children:[(0,U.jsxs)(`span`,{className:`flex items-baseline justify-between gap-2`,children:[`Code from Google`,_===null?null:(0,U.jsxs)(`span`,{role:`timer`,className:H(`font-normal tabular-nums`,_<g7?`font-medium text-warn`:`text-fg-faint`),"data-tone":_<g7?`warn`:`neutral`,"data-testid":`agy-login-countdown`,children:[_,` s left to finish`]})]}),(0,U.jsx)(`input`,{className:`w-full rounded-md border border-border bg-surface px-2.5 py-1.5 font-mono text-xs text-fg placeholder:text-fg-faint focus:border-accent focus:outline-none`,type:`text`,value:o,placeholder:`Paste the code Google shows you`,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,"data-1p-ignore":`true`,"data-lpignore":`true`,"data-form-type":`other`,"data-autofocus":!0,onChange:e=>s(e.target.value),onPaste:e=>{let n=e.clipboardData?.getData(`text`).trim()??``;Rh(n)&&(e.preventDefault(),!t&&(s(``),a(n)))},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),T())},"data-testid":`agy-login-code`})]}),C&&!w?(0,U.jsx)(`p`,{className:`text-[11px] text-fg-faint`,"data-testid":`agy-login-code-hint`,children:`Paste the code exactly as Google shows it — one line, no spaces.`}):null,(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(K,{variant:`primary`,size:`sm`,disabled:!w||t,onClick:T,"data-testid":`agy-login-continue`,children:`Continue`}),D]})]}),y?(0,U.jsx)(`div`,{className:`flex items-center gap-2`,children:D}):null]}):e.phase===`verifying`?(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`agy-login-verifying`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-xs text-fg`,role:`status`,children:[(0,U.jsx)(G.Spinner,{className:`h-3.5 w-3.5 shrink-0`}),e.message??`Checking the code with Google…`]}),(0,U.jsx)(`span`,{className:`flex-1`}),D,x?(0,U.jsx)(`p`,{className:`w-full text-[11px] text-fg-faint`,"data-testid":`agy-login-verifying-slow`,children:`Still waiting for Google…`}):null]}):e.phase===`failed`?(0,U.jsxs)(`div`,{className:`space-y-2`,"data-testid":`agy-login-failed`,children:[(0,U.jsx)(`div`,{className:`rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:e.message??`The sign-in did not finish.`}),(0,U.jsxs)(K,{variant:`primary`,busy:t,disabled:t,onClick:n,"data-testid":`agy-sign-in-restart`,children:[(0,U.jsx)(G.LogIn,{className:`h-4 w-4`}),` Start again`]})]}):(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[e.phase===`done`&&e.message?(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.message}):null,(0,U.jsxs)(K,{variant:`primary`,busy:t,disabled:t,onClick:n,"data-testid":`agy-sign-in-button`,children:[(0,U.jsx)(G.LogIn,{className:`h-4 w-4`}),` `,Yye]})]})]})}var xbe={ok:`bg-ok`,warn:`bg-warn`,danger:`bg-danger`,neutral:`bg-surface-3`},Sbe={ok:`text-ok`,warn:`text-warn`,danger:`text-danger`,neutral:`text-fg-muted`};function v7({label:e,testid:t,children:n}){return(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 py-0.5 text-xs`,children:[(0,U.jsx)(`dt`,{className:`shrink-0 text-fg-faint`,children:e}),(0,U.jsx)(`dd`,{className:`min-w-0 text-right font-medium text-fg`,"data-testid":t,children:n})]})}function Cbe({definition:e}){let{api:t,socket:n}=W(),[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(0),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(null),h=(0,v.useRef)(!0),g=(0,v.useRef)(0),_=(0,v.useRef)(0);(0,v.useEffect)(()=>(h.current=!0,()=>{h.current=!1}),[]);let y=(0,v.useCallback)(async(e,n=!1)=>{let r=++g.current;if(!t.getAgyStatus){o(!0);return}_.current+=1,n||u(e=>e+1);try{let n=await t.getAgyStatus(e?{refresh:!0}:void 0);if(!h.current||r!==g.current)return;i(n),c(null),o(!1)}catch(e){if(!h.current||r!==g.current)return;ng(e)?o(!0):c(Y_(e))}finally{--_.current,!n&&h.current&&u(e=>e-1)}},[t]),b=(0,v.useCallback)(async(e,t,n=``)=>{g.current+=1,f(e),m(null);try{let e=await t();return h.current?(g.current+=1,i(e),c(null),o(!1),e):null}catch(e){return h.current&&(ng(e)?o(!0):(m(mbe(Y_(e),n)),y(!1,!0))),null}finally{h.current&&f(null)}},[y]);(0,v.useEffect)(()=>{y(!1)},[y]);let[x,S]=(0,v.useState)(!1),C=(0,v.useCallback)(async()=>{if(!t.agyInstall){o(!0);return}S(!0),await b(`install`,()=>t.agyInstall())},[t,b]),w=(0,v.useRef)(!1);(0,v.useEffect)(()=>{if(!(w.current||!r||!t.agyInstall)){if(r.install.state!==`idle`){w.current=!0;return}r.state!==`not_installed`||!r.install.supported||(w.current=!0,C())}},[r,t,C]);let T=cbe(r);(0,v.useEffect)(()=>{if(T===null)return;let e=setInterval(()=>{_.current===0&&y(!1,!0)},T);return()=>clearInterval(e)},[T,y]),(0,v.useEffect)(()=>n.on(`account_changed`,e=>{e.reason===`provider`&&y(!1,!0)}),[n,y]);let E=Bs(e);if(a)return(0,U.jsx)(`div`,{className:`rounded-md border border-warn/40 bg-warn-soft px-3 py-2 text-xs text-warn`,"data-testid":`agy-unsupported`,children:Xye});let D=r===null&&s===null,O=l>0,k=lbe(r),A=r?.install.state===`working`,j=(0,U.jsx)(K,{variant:`primary`,size:`sm`,busy:O||D,disabled:O||D||k,onClick:()=>void y(!0),"data-testid":`agy-check-again`,children:O||D?`Checking…`:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(G.Refresh,{className:`h-3.5 w-3.5`}),` Check again`]})}),M=r?A?{label:`Installing agy…`,tone:`accent`}:abe(r.state):null;return(0,U.jsxs)(`div`,{className:`space-y-3`,"data-testid":`agy-card`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,U.jsx)(WS,{tone:`ok`,children:E.badge}),(0,U.jsx)(WS,{children:e.kind})]}),(0,U.jsx)(`div`,{className:`rounded-md border border-ok/40 bg-ok-soft px-3 py-2 text-xs text-ok`,"data-testid":`agy-route`,children:E.detail}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[M?(0,U.jsx)(`span`,{"data-testid":`agy-state`,"data-state":r?.state,children:(0,U.jsx)(WS,{tone:M.tone,children:M.label})}):D?(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-fg-muted`,"data-testid":`agy-checking`,children:[(0,U.jsx)(G.Spinner,{className:`h-3.5 w-3.5`}),` Asking agy…`]}):null,(0,U.jsx)(`span`,{className:`flex-1`}),j]}),O&&r?(0,U.jsx)(`p`,{className:`text-[11px] text-fg-faint`,"data-testid":`agy-busy-note`,children:`Asking agy again — this takes a few seconds.`}):null,s?(0,U.jsxs)(`div`,{className:`rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,"data-testid":`agy-failed`,children:[`The host could not check agy: `,s]}):null,r?(0,U.jsxs)(U.Fragment,{children:[r.state!==`ready`&&r.message&&!k?(0,U.jsx)(`p`,{className:`text-xs text-fg`,"data-testid":`agy-message`,children:r.message}):null,r.state===`not_installed`?(0,U.jsx)(ybe,{install:r.install,busy:d===`install`||d===`cancel_install`,offer:!t.agyInstall||x&&d!==`install`,onInstall:()=>{w.current=!0,C()},onCancel:()=>{w.current=!0,S(!0),t.cancelAgyInstall&&b(`cancel_install`,()=>t.cancelAgyInstall())}}):null,r.state===`not_signed_in`?(0,U.jsx)(bbe,{login:r.login,busy:d===`login`||d===`cancel_login`||d===`code`,onStart:()=>{t.agyLogin?b(`login`,()=>t.agyLogin()):o(!0)},onRestart:()=>{(async()=>{t.cancelAgyLogin&&await b(`cancel_login`,()=>t.cancelAgyLogin()),t.agyLogin?await b(`login`,()=>t.agyLogin()):o(!0)})()},onCancel:()=>{t.cancelAgyLogin&&b(`cancel_login`,()=>t.cancelAgyLogin())},onSubmit:e=>{t.submitAgyLoginCode?b(`code`,()=>t.submitAgyLoginCode(e),e):o(!0)}}):null,p?(0,U.jsx)(`div`,{className:`rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,"data-testid":`agy-action-error`,children:p}):null,(0,U.jsxs)(`dl`,{className:`rounded-md border border-border px-3 py-1.5`,"data-testid":`agy-facts`,children:[(0,U.jsx)(v7,{label:`Installed`,testid:`agy-installed`,children:r.installed?`Yes`:`No`}),r.path?(0,U.jsx)(v7,{label:`Path`,testid:`agy-path`,children:(0,U.jsx)(`span`,{className:`break-all font-mono text-[11px]`,children:r.path})}):null,r.version?(0,U.jsx)(v7,{label:`Version`,testid:`agy-version`,children:r.version}):null,(0,U.jsx)(v7,{label:`Signed in`,testid:`agy-signed-in`,children:r.signedIn===null?r.installed?`Unknown`:`—`:r.signedIn?`Yes`:`No`}),(0,U.jsx)(v7,{label:`Checked`,testid:`agy-checked`,children:(0,U.jsx)(`span`,{title:W_(r.checkedAt),children:U_(r.checkedAt)})})]}),f7(r)?(0,U.jsxs)(`p`,{className:`flex items-start gap-1.5 rounded-md bg-surface-2 px-3 py-2 text-xs text-fg-muted`,"data-testid":`agy-newer-note`,children:[(0,U.jsx)(G.Info,{className:`mt-px h-3.5 w-3.5 shrink-0`}),f7(r)]}):null,p7(r)?(0,U.jsxs)(`p`,{className:`flex items-start gap-1.5 rounded-md bg-surface-2 px-3 py-2 text-xs text-fg-muted`,"data-testid":`agy-update-note`,children:[(0,U.jsx)(G.Info,{className:`mt-px h-3.5 w-3.5 shrink-0`}),p7(r)]}):null,r.models.length>0?(0,U.jsxs)(`div`,{"data-testid":`agy-models`,children:[(0,U.jsx)(`div`,{className:`mb-1 text-xs font-medium text-fg-muted`,children:`Models agy offers`}),(0,U.jsx)(`ul`,{className:`space-y-0.5`,children:r.models.map(e=>(0,U.jsxs)(`li`,{className:`flex items-baseline justify-between gap-3 text-xs`,"data-testid":`agy-model-${e.id}`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.displayName}),(0,U.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-fg-faint`,children:e.id})]},e.id))})]}):null,r.usage.length>0?(0,U.jsxs)(`div`,{"data-testid":`agy-usage`,children:[(0,U.jsx)(`div`,{className:`mb-1 text-xs font-medium text-fg-muted`,children:`Your plan’s usage`}),(0,U.jsx)(`ul`,{className:`space-y-2`,children:r.usage.map((e,t)=>{let n=obe(e),r=e.remainingPercent;return(0,U.jsxs)(`li`,{"data-testid":`agy-usage-row-${t}`,children:[(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-xs`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:m7(e)}),(0,U.jsx)(`span`,{className:H(`shrink-0 font-medium`,Sbe[n.tone]),"data-tone":n.tone,"data-testid":`agy-usage-remaining-${t}`,children:n.remaining})]}),(0,U.jsx)(`div`,{className:`mt-0.5 h-1.5 w-full overflow-hidden rounded-full bg-surface-3`,role:`progressbar`,"aria-label":`${m7(e)}: ${n.remaining}`,"aria-valuemin":0,"aria-valuemax":100,...r!==null&&Number.isFinite(r)?{"aria-valuenow":Math.round(r)}:{},children:(0,U.jsx)(`div`,{className:H(`h-full rounded-full`,xbe[n.tone]),style:{width:`${r!==null&&Number.isFinite(r)?Math.min(100,Math.max(0,r)):0}%`}})}),n.resets?(0,U.jsx)(`div`,{className:`text-[11px] text-fg-faint`,children:n.resets}):null]},`${e.group}-${e.window}-${t}`)})})]}):null]}):null]})}var wbe=1e3;function y7(e){return`${(e/1048576).toFixed(+(e<10485760))} MB`}var Tbe={download:`Downloading Muse from Meta…`,verify:`Checking the download against Meta’s checksum…`,place:`Setting Muse up…`};function Ebe({open:e,label:t,onClose:n}){let{api:r,actions:i}=W(),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(`checking`),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(!1),p=(0,v.useRef)(null),m=(0,v.useRef)(!1),h=(0,v.useCallback)(async()=>{if(!r.museSetup)return null;try{let e=await r.museSetup();return o(e),e}catch{return null}},[r]),g=(0,v.useCallback)(async()=>{if(!r.museLoginStart){c(`unavailable`);return}u(null),m.current=!1,p.current=null,c(`running`);try{o(await r.museLoginStart())}catch(e){u(e instanceof Error?e.message:String(e)),c(`stopped`)}},[r]);(0,v.useEffect)(()=>{if(!e)return;let t=!0;return c(`checking`),u(null),o(null),(async()=>{if(!r.museSetup||!r.museLoginStart){t&&c(`unavailable`);return}let e=await h();if(t){if(!e){c(`unavailable`);return}e.login.phase===`awaiting_approval`||e.install.state===`working`?c(`running`):e.installed?g():c(`confirm`)}})(),()=>{t=!1}},[e,r,h,g]),(0,v.useEffect)(()=>{if(!e||s!==`running`)return;let t=setInterval(()=>void h(),wbe);return()=>clearInterval(t)},[e,s,h]);let _=a?.login??null,y=a?.install??null,b=_?.phase===`awaiting_approval`,x=b&&(_?.verificationUriComplete??_?.verificationUri)?_?.verificationUriComplete??_?.verificationUri??null:null;(0,v.useEffect)(()=>{!e||!x||!_?.id||p.current===_.id||Bh(x)&&(p.current=_.id,H5(x))},[e,x,_?.id]),(0,v.useEffect)(()=>{e&&_?.phase===`connected`&&!m.current&&(m.current=!0,i.refreshCredentials())},[e,_?.phase,i]);let S=async()=>{try{r.museLoginCancel&&o(await r.museLoginCancel())}catch{}c(`stopped`)},C=e=>{if(!navigator.clipboard){i.toast(`error`,`Could not copy — select it and copy by hand`);return}navigator.clipboard.writeText(e).then(()=>{f(!0),setTimeout(()=>f(!1),2e3)}).catch(()=>i.toast(`error`,`Could not copy`))},w=_?.phase===`connected`,T=_?.phase===`failed`||_?.phase===`expired`||_?.phase===`cancelled`,E=y?.state===`failed`,D=y?.state===`working`,O=y?.total&&y.total>0?Math.min(100,Math.floor(y.received/y.total*100)):null,k;return k=s===`unavailable`?(0,U.jsx)(`p`,{"data-testid":`muse-unavailable`,children:`This version of OonaCode on this PC cannot sign in with Meta. Paste your Muse key in the Connect window instead.`}):s===`checking`||!a?(0,U.jsx)(`p`,{children:`Looking at this PC…`}):s===`confirm`?(0,U.jsxs)(`div`,{className:`space-y-2`,"data-testid":`muse-confirm`,children:[(0,U.jsxs)(`p`,{children:[`To sign you in, OonaCode will download Meta’s own `,(0,U.jsx)(`b`,{children:`Muse`}),` program once (about`,` `,420,` MB) into its own folder, checked against Meta’s published checksum. It runs only to sign you in.`]}),(0,U.jsx)(`p`,{className:`text-fg-muted`,children:`You then approve a short code on Meta’s page. Your key is stored in your vault; chats run from this PC straight to Meta, not through Muse. Nothing is downloaded until you press the button.`})]}):w?(0,U.jsx)(`p`,{"data-testid":`muse-connected`,children:`Signed in. Your Meta Muse key is stored in your vault and synced to your other machines; chats on it run from this PC straight to Meta.`}):D?(0,U.jsxs)(`div`,{className:`space-y-2`,"data-testid":`muse-install`,children:[(0,U.jsx)(`p`,{children:Tbe[y?.phase??`download`]??`Installing Muse…`}),(0,U.jsx)(`div`,{className:`h-2 w-full overflow-hidden rounded bg-surface-2`,children:(0,U.jsx)(`div`,{className:`h-2 bg-accent`,style:{width:`${O??5}%`},"data-testid":`muse-install-bar`})}),(0,U.jsx)(`p`,{className:`text-fg-muted text-xs`,children:y&&y.received>0?`${y7(y.received)}${y.total?` of ${y7(y.total)}`:``}`:`Starting the download…`})]}):E?(0,U.jsx)(`p`,{className:`text-danger`,"data-testid":`muse-install-failed`,children:y?.error??`Muse could not be installed.`}):b&&_?(0,U.jsxs)(`div`,{className:`space-y-3`,"data-testid":`muse-awaiting`,children:[(0,U.jsx)(`p`,{children:`A sign-in page from Meta opened in your browser. If it did not, open the link below on any device and make sure this code matches:`}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`code`,{className:`text-lg font-mono px-2 py-1 rounded border border-border`,"data-testid":`muse-user-code`,children:_.userCode}),(0,U.jsxs)(K,{onClick:()=>_.userCode&&C(_.userCode),children:[(0,U.jsx)(G.Copy,{className:`w-4 h-4`}),` `,d?`Copied`:`Copy code`]})]}),x&&Bh(x)?(0,U.jsxs)(`div`,{className:`flex items-center gap-2 break-all`,children:[(0,U.jsx)(`a`,{className:`underline`,href:x,onClick:e=>{e.preventDefault(),H5(x)},children:x}),(0,U.jsxs)(K,{onClick:()=>C(x),children:[(0,U.jsx)(G.Copy,{className:`w-4 h-4`}),` Copy link`]})]}):null,(0,U.jsxs)(`p`,{className:`text-fg-muted`,children:[`Waiting for your approval…`,_.expiresAt?` The code expires at ${new Date(_.expiresAt).toLocaleTimeString()}.`:``,` `,`The key is stored in your vault the moment Meta confirms it.`]})]}):T||s===`stopped`?(0,U.jsx)(`p`,{className:T&&_?.phase!==`cancelled`?`text-danger`:``,"data-testid":`muse-ended`,children:l??_?.message??`The sign-in did not complete.`}):(0,U.jsx)(`p`,{children:_?.message??`Getting Meta’s sign-in page ready…`}),(0,U.jsx)(GS,{open:e,title:t,onClose:()=>n(w),footer:(0,U.jsxs)(U.Fragment,{children:[s===`running`&&!w&&!T&&!E?(0,U.jsx)(K,{onClick:()=>void S(),"data-testid":`muse-cancel`,children:`Cancel`}):null,s===`confirm`?(0,U.jsx)(K,{variant:`primary`,onClick:()=>void g(),"data-testid":`muse-start`,children:`Download and sign in`}):null,(s===`stopped`||T||E)&&!w&&s!==`unavailable`?(0,U.jsx)(K,{onClick:()=>void g(),"data-testid":`muse-retry`,children:`Try again`}):null,(0,U.jsx)(K,{variant:`primary`,onClick:()=>n(w),children:w?`Done`:`Close`})]}),children:(0,U.jsx)(`div`,{className:`space-y-3 text-sm`,"data-testid":`muse-login-dialog`,children:k})})}function Dbe(e,t){let n=e.definition.displayName;return!t||t.id===`payg`||t.id===`api-key`?[`Sign in to the ${n} console.`,`Create an API key (or copy an existing one).`,`Paste it below — OonaCode encrypts it into your vault before it leaves this PC.`]:[`Open the ${n} console and pick the ${t.label} plan.`,t.notes??`Complete the provider’s subscription/token flow in the browser.`,`Copy the token it issues${t.keyFormat?` (looks like ${t.keyFormat})`:``} and paste it below.`]}function Obe(e,t){let n=e.find(e=>e.definition.id===t);if(!n)return[];let r=n.definition.clientGroup??n.definition.id,i=e.find(e=>e.definition.id===r);return i?[i,...e.filter(e=>e.definition.clientGroup===r)]:[n]}function kbe(e){let t=[];for(let n of e){let e=n.definition,r=Fs(e),i=e.credentialClass===`subscription`;if(r.length>1)for(let i of r)t.push({key:`${e.id}:${i.id}`,label:i.id===`token-plan`?`Subscription`:i.id===`payg`?`API`:i.label,provider:n,variantId:i.id,variant:i,isSubscription:!1,hasLoginFlow:!1,loginKind:null,keyFormat:i.keyFormat??e.keyFormat});else t.push({key:e.id,label:e.recordLabel??(i?`Subscription`:`API`),provider:n,variantId:r[0]?.id??null,variant:r[0]??null,isSubscription:i,hasLoginFlow:i&&e.route===`direct`,loginKind:i&&e.route===`direct`?e.museCliLogin?`muse`:e.subscriptionLogin?`oauth`:`claude`:null,keyFormat:r[0]?.keyFormat??e.keyFormat})}return t}function b7(e){let t=(e.provider.credentials??[]).filter(e=>e.class!==`none`);return(e.variantId?t.filter(t=>(t.variantId??`payg`)===e.variantId):t).slice(0,1)}function Abe({open:e,providerId:t,onClose:n}){let{state:r,actions:i}=W(),a=(0,v.useMemo)(()=>t?Obe(r.providers,t):[],[r.providers,t]),o=(0,v.useMemo)(()=>kbe(a),[a]),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(!1),S=o.find(e=>e.key===s)??o[0]??null;if((0,v.useEffect)(()=>{if(!e)return;let n=o.find(e=>e.provider.definition.id===t);c((n??o[0])?.key??``),u(``),m(``),y(null),x(!1)},[e,t,o]),(0,v.useEffect)(()=>{if(!e||!S)return;let t=S.provider.definition;f(t.userBaseUrl?S.variant?.baseUrl??t.baseUrl:``)},[e,S,S?.key]),!S)return null;let C=S.provider.definition,w=a[0]?.definition?.displayName??C.displayName;if(C.engine===`agy`)return(0,U.jsx)(GS,{open:e,title:w,onClose:n,footer:(0,U.jsx)(K,{onClick:n,children:`Close`}),children:(0,U.jsx)(Cbe,{definition:C})});if(b)return(0,U.jsx)(Ebe,{open:e,label:C.museCliLogin?.signInLabel??`Sign in with Meta`,onClose:e=>{x(!1),e&&n()}});let T=b7(S),E=a.some(e=>(e.credentials??[]).some(e=>e.class!==`none`)),D=C.credentialClass!==`none`,O=Bs(C,{credentialClass:S.isSubscription?`subscription`:C.credentialClass,...C.userBaseUrl&&d.trim()?{baseUrl:d.trim()}:{}}),k=!h&&(!D||l.trim().length>0),A=async()=>{g(!0),y(null);try{if(!D){await i.setActiveProvider(C.id),n();return}let e=await i.probeCredential(C.id,{secret:l.trim(),variantId:S.variantId,...C.userBaseUrl&&d.trim()?{baseUrl:d.trim()}:{}});if(!e.ok){y(e.error??`${w} rejected this key — check it and try again.`);return}let t={};S.variantId&&(t.variant=S.variantId),C.userBaseUrl&&d.trim()&&(t.baseUrl=d.trim()),await i.addCredential({class:S.isSubscription?`subscription`:`api_key`,providerId:C.id,secret:l.trim(),...p.trim()?{label:p.trim()}:{},...Object.keys(t).length>0?{meta:t}:{}})&&(u(``),n())}finally{g(!1)}};return(0,U.jsx)(GS,{open:e,title:`${E?`Manage`:`Connect`} ${w}`,onClose:n,footer:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{onClick:n,children:`Cancel`}),S.loginKind===`oauth`?(0,U.jsxs)(K,{onClick:()=>i.openOauthLogin(S.provider.definition.id),"data-testid":`connect-oauth-signin`,children:[(0,U.jsx)(G.LogIn,{className:`w-4 h-4`}),` `,S.provider.definition.subscriptionLogin?.signInLabel??`Sign in instead`]}):S.loginKind===`muse`?(0,U.jsxs)(K,{onClick:()=>x(!0),"data-testid":`connect-muse-signin`,children:[(0,U.jsx)(G.LogIn,{className:`w-4 h-4`}),` `,S.provider.definition.museCliLogin?.signInLabel??`Sign in with Meta`]}):S.loginKind===`claude`?(0,U.jsxs)(K,{onClick:()=>i.openClaudeLogin(null),"data-testid":`connect-claude-signin`,children:[(0,U.jsx)(G.LogIn,{className:`w-4 h-4`}),` Sign in instead`]}):null,(0,U.jsx)(K,{variant:`primary`,busy:h,disabled:!k,onClick:()=>void A(),children:h?`Checking…`:D?`Save key`:`Use this provider`})]}),children:(0,U.jsxs)(`div`,{className:`space-y-3`,children:[o.length>1?(0,U.jsx)(`div`,{className:`flex gap-1 border-b border-border`,role:`tablist`,children:o.map(e=>{let t=b7(e)[0];return(0,U.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.key===S.key,"data-testid":`record-tab-${e.key}`,onClick:()=>c(e.key),className:e.key===S.key?`rounded-t-md border border-b-0 border-border bg-surface-2 px-3 py-1.5 text-sm font-medium`:`px-3 py-1.5 text-sm text-fg-muted hover:text-fg`,children:[e.label,t?(0,U.jsx)(`span`,{className:`ml-1.5 font-mono text-[11px] text-ok`,children:t.masked}):null]},e.key)})}):null,T.length>0?(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:`Connected`}),T.map(e=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border px-2.5 py-1.5`,"data-testid":`stored-credential-${e.id}`,children:[(0,U.jsx)(WS,{tone:e.class===`subscription`?`accent`:`ok`,children:S.label}),(0,U.jsx)(`span`,{className:`font-mono text-xs`,children:e.masked}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] text-fg-faint`,children:e.label}),(0,U.jsx)(K,{size:`sm`,onClick:()=>void i.testCredential(e.id),children:`Test`}),(0,U.jsx)(K,{size:`sm`,variant:`danger`,onClick:()=>void i.deleteCredential(e.id),children:`Remove`})]},e.id))]}):null,(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,U.jsx)(WS,{tone:O.viaGateway?`accent`:`ok`,children:O.badge}),(0,U.jsx)(WS,{children:C.kind}),S.keyFormat?(0,U.jsxs)(`span`,{className:`text-fg-faint`,children:[`key format `,S.keyFormat]}):null]}),(0,U.jsxs)(`div`,{className:O.viaGateway?`rounded-md border border-border bg-surface-2 px-3 py-2 text-xs text-fg-muted`:`rounded-md border border-ok/40 bg-ok-soft px-3 py-2 text-xs text-ok`,"data-testid":`connect-route`,children:[O.detail,D&&!O.viaGateway?` The key is stored in your zero-knowledge vault.`:null]}),D?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`ol`,{className:`ml-4 list-decimal space-y-1 text-xs text-fg-muted`,children:S.loginKind===`muse`?[`Press “${S.provider.definition.museCliLogin?.signInLabel??`Sign in with Meta`}”: OonaCode fetches Meta’s own Muse once into its own folder, you approve a short code on Meta’s page, and the key is stored by itself.`,`Or paste a Muse subscription key, or a Meta Model API key, below.`,`Chats go from this PC straight to Meta; the key stays in your vault.`].map((e,t)=>(0,U.jsx)(`li`,{children:e},t)):S.loginKind===`oauth`?[`Press “${S.provider.definition.subscriptionLogin?.signInLabel??`Sign in`}”: a short code opens in your browser, you approve it, and the subscription is stored by itself — nothing to paste.`,`The token refreshes on its own; sign in again only if the provider says it expired.`,`Or paste an access token below, if you have one from elsewhere.`].map((e,t)=>(0,U.jsx)(`li`,{children:e},t)):S.hasLoginFlow?[`Press “Sign in instead” to get a token through the genuine engine — the fastest way.`,"Or run `claude setup-token` yourself and complete the sign-in in your browser.",`Paste the token it prints below (it looks like sk-ant-oat01-…).`].map((e,t)=>(0,U.jsx)(`li`,{children:e},t)):Dbe(S.provider,S.variant).map((e,t)=>(0,U.jsx)(`li`,{children:e},t))}),(0,U.jsx)(HS,{label:S.loginKind===`muse`?`Muse key`:S.isSubscription?`Subscription token`:`API key`,hint:`Tried against the provider before it is saved, then encrypted on this PC with your vault key.`,children:(0,U.jsx)(`input`,{className:q,type:`password`,autoComplete:`off`,spellCheck:!1,value:l,placeholder:S.keyFormat??`sk-…`,onChange:e=>{u(e.target.value),y(null)}})}),_?(0,U.jsx)(`div`,{className:`rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-xs text-danger`,"data-testid":`connect-probe-error`,children:_}):null,C.userBaseUrl?(0,U.jsx)(HS,{label:`Base URL`,hint:`Point this at your own server if it is not the default. Each record has its own endpoint.`,children:(0,U.jsx)(`input`,{className:q,value:d,spellCheck:!1,onChange:e=>f(e.target.value),placeholder:S.variant?.baseUrl??C.baseUrl})}):null,(0,U.jsx)(HS,{label:`Label (optional)`,children:(0,U.jsx)(`input`,{className:q,value:p,onChange:e=>m(e.target.value),placeholder:`${w} ${S.label.toLowerCase()} key`})})]}):(0,U.jsxs)(`div`,{className:`rounded-md bg-surface-2 px-3 py-2 text-xs text-fg-muted`,children:[C.displayName,` needs no credential.`]})]})})}function jbe({open:e,onClose:t}){let{state:n,actions:r}=W(),i=n.ui.oauthLoginProviderId,a=i?n.providers.find(e=>e.definition.id===i)??null:null,o=n.oauthLogin&&n.oauthLogin.providerId===i?n.oauthLogin:null,[s,c]=(0,v.useState)(0),[l,u]=(0,v.useState)(!1),d=(0,v.useRef)(null),f=a?.definition.displayName??i??`the provider`,p=a?.definition.subscriptionLogin?.signInLabel??`Sign in to ${f}`,m=o?.phase===`awaiting_approval`,h=m?o?.verificationUriComplete??o?.verificationUri??null:null;(0,v.useEffect)(()=>{if(!e||!i)return;d.current=null,r.startOauthLogin(i);let t=setInterval(()=>void r.refreshOauthLogin(i),2e3);return()=>clearInterval(t)},[e,i,s,r]),(0,v.useEffect)(()=>{!e||!h||!o?.id||d.current===o.id||(d.current=o.id,H5(h))},[e,h,o?.id]),(0,v.useEffect)(()=>{e&&o?.phase===`connected`&&r.refreshCredentials()},[e,o?.phase,r]);let g=e=>{if(!navigator.clipboard){r.toast(`error`,`Could not copy — select it and copy by hand`);return}navigator.clipboard.writeText(e).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)}).catch(()=>r.toast(`error`,`Could not copy`))},_=o?.phase===`connected`||o?.phase===`failed`||o?.phase===`expired`||o?.phase===`cancelled`;return(0,U.jsx)(GS,{open:e,title:p,onClose:t,footer:(0,U.jsxs)(U.Fragment,{children:[m?(0,U.jsx)(K,{onClick:()=>i&&void r.cancelOauthLogin(i),"data-testid":`oauth-login-cancel`,children:`Cancel sign-in`}):null,_&&o?.phase!==`connected`?(0,U.jsx)(K,{onClick:()=>c(e=>e+1),"data-testid":`oauth-login-retry`,children:`Try again`}):null,(0,U.jsx)(K,{variant:`primary`,onClick:t,children:o?.phase===`connected`?`Done`:`Close`})]}),children:(0,U.jsx)(`div`,{className:`space-y-3 text-sm`,"data-testid":`oauth-login-dialog`,children:m&&o?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{children:[`A sign-in page for `,f,` opened in your browser. If it did not, open the link below on any device and enter this code:`]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`code`,{className:`text-lg font-mono px-2 py-1 rounded border border-border`,"data-testid":`oauth-user-code`,children:o.userCode}),(0,U.jsxs)(K,{onClick:()=>o.userCode&&g(o.userCode),children:[(0,U.jsx)(G.Copy,{className:`w-4 h-4`}),` `,l?`Copied`:`Copy code`]})]}),h?(0,U.jsxs)(`div`,{className:`flex items-center gap-2 break-all`,children:[(0,U.jsx)(`a`,{className:`underline`,href:h,onClick:e=>{e.preventDefault(),H5(h)},children:h}),(0,U.jsxs)(K,{onClick:()=>g(h),children:[(0,U.jsx)(G.Copy,{className:`w-4 h-4`}),` Copy link`]})]}):null,(0,U.jsxs)(`p`,{className:`text-fg-muted`,children:[`Waiting for your approval… the code expires`,o.expiresAt?` at ${new Date(o.expiresAt).toLocaleTimeString()}`:` soon`,`. The subscription is stored in your vault the moment `,f,` confirms it.`]})]}):o?.phase===`connected`?(0,U.jsxs)(`p`,{"data-testid":`oauth-login-connected`,children:[`Signed in. Your `,f,` subscription is stored in your vault and synced to your other machines; chats on it run from this PC straight to the provider.`]}):_?(0,U.jsx)(`p`,{className:`text-danger`,"data-testid":`oauth-login-ended`,children:o?.message??`The sign-in did not complete.`}):(0,U.jsx)(`p`,{children:`Starting the sign-in…`})})})}function Mbe({open:e,onClose:t}){let{state:n,actions:r}=W(),i=(0,v.useMemo)(()=>gm(n.providers),[n.providers]),[a,o]=(0,v.useState)({}),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(!1);(0,v.useEffect)(()=>{e&&(o({...n.settings?.modelVisibility??{}}),c(``))},[e]);let d=(e,t)=>a[e]??t,f=(e,t,n)=>d(e,n).includes(t),p=(e,t,n)=>{o(r=>{let i=r[e]??n,a=i.includes(t)?i.filter(e=>e!==t):n.filter(e=>e===t||i.includes(e));return{...r,[e]:a}})},m=(e,t,n)=>{o(r=>({...r,[e]:t?[...n]:[]}))},h=async()=>{u(!0);try{let e={};for(let t of i){let n=t.definition.models.map(e=>e.id),r=a[t.definition.id];r&&r.length!==n.length&&(e[t.definition.id]=r)}await r.saveSettings({modelVisibility:e}),t()}finally{u(!1)}},g=s.trim().toLowerCase();return(0,U.jsx)(GS,{open:e,title:`Manage models`,onClose:t,wide:!0,footer:(0,U.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-2`,children:[(0,U.jsxs)(K,{onClick:()=>{t(),r.openSettings(`providers`)},"data-testid":`manage-models-add-provider`,children:[(0,U.jsx)(G.Plus,{className:`w-3.5 h-3.5`}),` Add provider`]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(K,{onClick:t,children:`Cancel`}),(0,U.jsx)(K,{variant:`primary`,busy:l,onClick:()=>void h(),"data-testid":`manage-models-save`,children:`Save`})]})]}),children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`Choose which models the chat's picker offers. A provider with every model checked shows all of them — including ones it adds later.`}),(0,U.jsx)(`input`,{className:q,value:s,onChange:e=>c(e.target.value),placeholder:`Filter models…`,"data-testid":`manage-models-filter`}),i.length===0?(0,U.jsxs)(`div`,{className:`text-sm text-fg-faint`,children:[`No provider is connected yet — use `,(0,U.jsx)(`strong`,{children:`Add provider`}),` below to connect one.`]}):null,i.map(e=>{let t=e.definition.models.map(e=>e.id),n=e.definition.models.filter(e=>!g||e.id.toLowerCase().includes(g)||(e.displayName??``).toLowerCase().includes(g)),r=d(e.definition.id,t).length;return(0,U.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`manage-models-${e.definition.id}`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:e.definition.displayName}),(0,U.jsxs)(`span`,{className:`text-xs text-fg-faint`,children:[r===t.length?`all`:r,` of `,t.length,` shown`]}),(0,U.jsxs)(`span`,{className:`ml-auto flex gap-1`,children:[(0,U.jsx)(K,{size:`sm`,onClick:()=>m(e.definition.id,!0,t),children:`All`}),(0,U.jsx)(K,{size:`sm`,onClick:()=>m(e.definition.id,!1,t),children:`None`})]})]}),(0,U.jsxs)(`div`,{className:`grid gap-1 sm:grid-cols-2`,children:[n.map(n=>(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:f(e.definition.id,n.id,t),onChange:()=>p(e.definition.id,n.id,t),"data-testid":`manage-model-${n.id}`}),(0,U.jsxs)(`span`,{className:`truncate`,title:n.id,children:[n.displayName??n.id,n.displayName&&n.displayName!==n.id?(0,U.jsxs)(`span`,{className:`text-fg-faint`,children:[` · `,n.id]}):null]})]},n.id)),n.length===0?(0,U.jsxs)(`div`,{className:`text-xs text-fg-faint`,children:[(0,U.jsx)(G.Info,{className:`mr-1 inline w-3 h-3`}),` No model matches the filter.`]}):null]})]},e.definition.id)})]})})}var x7={mode:`names`,mine:!0,model:!0,tools:!1,subagents:!1,projectId:null,when:`any`,caseSensitive:!1,wholeWord:!1};function S7(e,t,n){let r=Pe(t,{caseSensitive:n.caseSensitive,wholeWord:n.wholeWord});if(!r)return[{text:e,hit:!1}];let i=[],a=0;for(let t of e.matchAll(r)){let n=t.index??0;t[0].length!==0&&(n>a&&i.push({text:e.slice(a,n),hit:!1}),i.push({text:t[0],hit:!0}),a=n+t[0].length)}return a<e.length&&i.push({text:e.slice(a),hit:!1}),i}function C7(e){return Object.keys(x7).some(t=>e[t]!==x7[t])}function w7(e,t=Date.now()){if(e===`any`)return null;if(e===`today`){let e=new Date(t);return e.setHours(0,0,0,0),e}return new Date(t-(e===`week`?7:30)*24*60*60*1e3)}function Nbe(e,t,n,r=Date.now()){if(n.projectId!==null&&e.projectId!==n.projectId)return!1;let i=w7(n.when,r);if(i&&e.mtime<i.getTime())return!1;if((n.caseSensitive||n.wholeWord)&&t.trim()!==``){let r=[e.title,e.firstPrompt,e.lastPrompt,e.projectDir],i={caseSensitive:n.caseSensitive,wholeWord:n.wholeWord};if(!r.some(e=>typeof e==`string`&&Fe(e,t,i)))return!1}return!0}function Pbe(e,t,n=Date.now()){let r=e.trim();if(r.length<2||!t.mine&&!t.model&&!t.tools)return null;let i=w7(t.when,n);return{q:r,limit:200,from:t.mine&&t.model?`both`:t.mine?`user`:t.model?`assistant`:`none`,tools:t.tools,subagents:t.subagents,...i?{since:i.toISOString()}:{},...t.projectId?{projectId:t.projectId}:{},caseSensitive:t.caseSensitive,wholeWord:t.wholeWord}}function T7({label:e,hint:t,checked:n,onChange:r,testId:i}){return(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 py-0.5 text-xs`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:n,onChange:e=>r(e.target.checked),"data-testid":i}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`span`,{className:`text-fg`,children:e}),t?(0,U.jsx)(`span`,{className:`block text-[11px] text-fg-faint`,children:t}):null]})]})}var E7=`w-full rounded-md border border-border bg-surface px-2 py-1 text-xs text-fg focus:outline-none`,Fbe={names:`Names & prompts`,conversations:`Whole chats`,namesHint:`A chat’s name, its first and last message, and its folder.`,conversationsHint:`Every message of every chat on this PC. Pick whose words to look in.`};function D7({options:e,onChange:t,projects:n,onClose:r,words:i=Fbe}){let a=(n,r)=>t({...e,[n]:r}),o=e.mode===`conversations`,s=o&&!e.mine&&!e.model&&!e.tools;return(0,U.jsxs)(`div`,{className:`absolute left-2 right-2 top-full z-30 mt-1 space-y-3 rounded-lg border border-border bg-surface p-3 shadow-xl`,onMouseDown:e=>{!(e.target instanceof HTMLSelectElement)&&!(e.target instanceof HTMLInputElement)&&e.preventDefault()},onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),r())},"data-testid":`search-options`,children:[(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide text-fg-faint`,children:`Search in`}),(0,U.jsx)(qS,{label:`Search in`,value:e.mode,options:[{value:`names`,label:i.names},{value:`conversations`,label:i.conversations}],onChange:e=>a(`mode`,e)}),(0,U.jsx)(`p`,{className:`text-[11px] text-fg-faint`,"data-testid":`search-mode-hint`,children:o?i.conversationsHint:i.namesHint})]}),o?(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,U.jsx)(T7,{label:`My messages`,checked:e.mine,onChange:e=>a(`mine`,e),testId:`search-opt-mine`}),(0,U.jsx)(T7,{label:`Model replies`,checked:e.model,onChange:e=>a(`model`,e),testId:`search-opt-model`}),(0,U.jsx)(T7,{label:`Tool calls & output`,hint:`Commands, file paths and what the tools answered.`,checked:e.tools,onChange:e=>a(`tools`,e),testId:`search-opt-tools`}),(0,U.jsx)(T7,{label:`Subagents’ conversations`,checked:e.subagents,onChange:e=>a(`subagents`,e),testId:`search-opt-subagents`}),s?(0,U.jsx)(`p`,{className:`text-[11px] text-warn`,children:`Tick at least one to search.`}):null]}):null,(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[n?(0,U.jsxs)(`label`,{className:`space-y-1 text-[11px] text-fg-faint`,children:[(0,U.jsx)(`span`,{children:`Project`}),(0,U.jsxs)(`select`,{className:E7,value:e.projectId??``,onChange:e=>a(`projectId`,e.target.value||null),"data-testid":`search-opt-project`,children:[(0,U.jsx)(`option`,{value:``,children:`All projects`}),n.map(e=>(0,U.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}):null,(0,U.jsxs)(`label`,{className:`space-y-1 text-[11px] text-fg-faint`,children:[(0,U.jsx)(`span`,{children:`When`}),(0,U.jsxs)(`select`,{className:E7,value:e.when,onChange:e=>a(`when`,e.target.value),"data-testid":`search-opt-when`,children:[(0,U.jsx)(`option`,{value:`any`,children:`Any time`}),(0,U.jsx)(`option`,{value:`today`,children:`Today`}),(0,U.jsx)(`option`,{value:`week`,children:`Last 7 days`}),(0,U.jsx)(`option`,{value:`month`,children:`Last 30 days`})]})]})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-x-4`,children:[(0,U.jsx)(T7,{label:`Match case`,checked:e.caseSensitive,onChange:e=>a(`caseSensitive`,e),testId:`search-opt-case`}),(0,U.jsx)(T7,{label:`Whole words`,checked:e.wholeWord,onChange:e=>a(`wholeWord`,e),testId:`search-opt-word`})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between border-t border-border pt-2`,children:[(0,U.jsx)(`button`,{type:`button`,className:H(`text-xs`,C7(e)?`text-accent hover:underline`:`text-fg-faint`),disabled:!C7(e),onClick:()=>t(x7),"data-testid":`search-opt-reset`,children:`Reset`}),(0,U.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-2 px-2 py-1 text-xs text-fg hover:bg-surface-3`,onClick:r,"data-testid":`search-opt-done`,children:`Done`})]})]})}function Ibe(e){return e.kind===`tool`?e.tool??`Tool`:e.role===`assistant`?`Model`:`You`}function Lbe({query:e,options:t}){let{state:n,actions:r}=W(),i=(0,v.useMemo)(()=>Pbe(e,t),[e,t]),[a,o]=(0,v.useState)(null),s=i?JSON.stringify(i):``;(0,v.useEffect)(()=>{if(!i)return;let e=!0,t=setTimeout(()=>{r.searchTranscripts(i).then(t=>{e&&o({key:s,res:t})})},350);return()=>{e=!1,clearTimeout(t)}},[s,r]);let c=a&&a.key===s?a:null,l=(0,v.useMemo)(()=>{let e=new Map;for(let t of c?.res?.hits??[]){let r=n.sessions.find(e=>e.id===t.sessionId)?.title||t.title||`Untitled chat`,i=e.get(t.sessionId)??{title:r,hits:[]};i.hits.push(t),e.set(t.sessionId,i)}return[...e.entries()]},[c,n.sessions]);if(!i)return(0,U.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-fg-faint`,"data-testid":`transcript-search-idle`,children:e.trim().length<2?`Type at least two characters to search every chat.`:`Tick what to look in — your messages, the model’s replies or the tools’ side.`});if(!c)return(0,U.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-fg-faint`,"data-testid":`transcript-search-busy`,children:`Searching every chat…`});if(c.res===null)return(0,U.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-danger`,"data-testid":`transcript-search-failed`,children:`This PC could not search its chats. Try again, or update OonaCode.`});let u=c.res.hits.length;return(0,U.jsxs)(`div`,{className:`pb-2`,"data-testid":`transcript-search-results`,children:[(0,U.jsx)(`div`,{className:`px-3 py-1.5 text-[11px] text-fg-faint`,children:u===0?`No message on this PC says that.`:`${u}${c.res.truncated?`+`:``} ${u===1?`message`:`messages`} in ${l.length} ${l.length===1?`chat`:`chats`}`}),l.map(([n,i])=>(0,U.jsxs)(`div`,{className:`mb-1.5`,"data-testid":`transcript-search-chat-${n}`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-1.5 rounded px-2 py-1 text-left text-[13px] font-semibold text-fg hover:bg-surface-2`,onClick:()=>r.openChatWithSearch(n,e.trim()),children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:i.title}),(0,U.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-3 px-1.5 text-[10px] font-semibold text-fg-muted`,children:i.hits.length})]}),i.hits.map(i=>(0,U.jsxs)(`button`,{type:`button`,className:`block w-full rounded px-2 py-1 pl-4 text-left text-xs hover:bg-surface-2`,onClick:()=>r.openChatWithSearch(n,e.trim()),"data-testid":`transcript-search-hit`,children:[(0,U.jsxs)(`span`,{className:`mb-0.5 flex items-center gap-1.5 text-[10px] text-fg-faint`,children:[i.kind===`tool`?(0,U.jsx)(G.Tool,{className:`h-3 w-3`}):i.role===`assistant`?(0,U.jsx)(G.Bot,{className:`h-3 w-3`}):(0,U.jsx)(G.User,{className:`h-3 w-3`}),(0,U.jsx)(`span`,{className:`font-medium text-fg-muted`,children:Ibe(i)}),i.subpath?(0,U.jsx)(`span`,{children:`· subagent`}):null,i.timestamp?(0,U.jsx)(`span`,{className:`ml-auto`,children:U_(i.timestamp)}):null]}),(0,U.jsx)(`span`,{className:`line-clamp-3 text-fg-muted`,children:S7(i.snippet,e,t).map((e,t)=>e.hit?(0,U.jsx)(`mark`,{className:`rounded bg-warn-soft px-0.5 text-fg`,children:e.text},t):(0,U.jsx)(`span`,{children:e.text},t))})]},`${i.seq}`))]},n))]})}function O7(e){return`${e.agentId??`claude-code`}:${e.id}`}function k7(e){let t=Date.parse(e.lastEntryAt??e.updatedAt);return Number.isFinite(t)?t:0}function Rbe(e,t,n=Date.now()){let r=w7(t.when,n)?.getTime()??null,i=Pe(e,{caseSensitive:t.caseSensitive,wholeWord:t.wholeWord});return e=>r!==null&&k7(e)<r?!1:i===null||[e.title,e.firstPrompt,e.lastPrompt,e.cwd,e.projectName,e.id].some(e=>typeof e==`string`&&(i.lastIndex=0,i.test(e)))}function zbe(e,t,n=Date.now()){let r=e.trim();if(r.length<2||!t.mine&&!t.model&&!t.tools)return null;let i=w7(t.when,n);return{q:r,from:t.mine&&t.model?`both`:t.mine?`user`:t.model?`assistant`:`none`,tools:t.tools,subagents:t.subagents,...i?{since:i.toISOString()}:{},caseSensitive:t.caseSensitive,wholeWord:t.wholeWord}}function Bbe(e,t){let n=new Map;for(let t of e){let e=O7(t);n.set(e,e);for(let r of t.supersedes??[]){let i=O7({agentId:t.agentId,id:r});n.has(i)||n.set(i,e)}}let r=new Map;for(let e of t){let t=n.get(O7(e));if(!t)continue;let i=r.get(t);if(!i){r.set(t,{...e,snippets:e.snippets.slice(0,3)});continue}r.set(t,{...i,hits:i.hits+e.hits,...i.hitsCapped||e.hitsCapped?{hitsCapped:!0}:{},snippets:[...i.snippets,...e.snippets].slice(0,3)})}return r}var Vbe={new:`New`,imported:`Imported`,behind:`Imported · original moved on`,deleted:`You deleted it in OonaCode`,unavailable:`Cannot be imported yet`};function A7(e){return e.alreadyImported?e.upToDate===!1?`behind`:`imported`:e.deletedHere===!0?`deleted`:j7(e)?`unavailable`:`new`}function j7(e){return typeof e.unavailable==`string`&&e.unavailable.length>0}function M7(e){if(j7(e))return!1;let t=A7(e);return t===`new`||t===`behind`}function Hbe(e){return A7(e)===`new`}function Ube(e,t){return new Set(t?e.filter(Hbe).map(e=>e.id):[])}function Wbe(e){if(!e.some(e=>e.projectName))return e;let t=[],n=new Map;for(let r of e){let e=r.projectName??``,i=n.get(e);i||(i=[],n.set(e,i),t.push(e)),i.push(r)}return t.flatMap(e=>n.get(e)??[])}function Gbe(){return{new:0,imported:0,behind:0,deleted:0,unavailable:0}}function Kbe(e){let t=new Map;for(let n of e){let e=n.agentId??`claude-code`,r=t.get(e);r||(r={key:e,name:n.agentName??`Claude Code`,rows:[],counts:Gbe()},t.set(e,r)),r.rows.push(n),r.counts[A7(n)]+=1}for(let e of t.values())e.rows=Wbe([...e.rows].sort((e,t)=>k7(t)-k7(e)));return[...t.values()]}function N7(e,t){let n=0,r=0,i=0;for(let a of e){let e=t.has(a.id);e&&(n+=1),M7(a)&&(r+=1,e&&(i+=1))}return n===0?`none`:r>0&&i===r?`all`:`some`}function qbe(e,t){let n=new Set(t),r=e.filter(M7);if(N7(e,t)===`all`||r.length===0)for(let t of e)n.delete(t.id);else for(let e of r)n.add(e.id);return n}function Jbe(e,t){let n=0;if(t)for(let r of e)t.has(r)||(n+=1);return{total:e.size,notShown:n}}var Ybe={names:`Names & folders`,conversations:`Whole conversations`,namesHint:`A chat’s name, its first and last message, and the folder it ran in.`,conversationsHint:`Every message of every chat listed here, read from the other apps’ own files. Pick whose words to look in.`},P7=`Ticks the chats with something to bring in — new ones, and imported ones whose original moved on. An imported chat that is up to date, or one you deleted in OonaCode, is ticked on its own row.`;function Xbe(e){return e.partial===`time`?`Stopped after ${Math.round(e.elapsedMs/1e3)} s — these are the chats found until then. A longer phrase narrows it.`:e.partial===`chats`?`Stopped at ${e.chats.length} chats — a longer phrase narrows it.`:null}function F7(e){return e?e.replace(/[\\/]+$/,``).split(/[\\/]/).length<=2?e:`…${e.slice(-40)}`:`no folder recorded`}function Zbe(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}function Qbe(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}):``}var I7=(e,t,n)=>`${e} ${e===1?t:n}`;function $be({open:e,onClose:t,autoOffer:n=!1}){let{state:r,actions:i}=W(),a=r.importProgress,[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(new Set),[g,_]=(0,v.useState)(new Set),[y,b]=(0,v.useState)(null),x=(0,v.useMemo)(()=>f??[],[f]),S=(0,v.useMemo)(()=>Kbe(x),[x]),C=(0,v.useMemo)(()=>{let e={new:0,imported:0,behind:0,deleted:0,unavailable:0};for(let t of S)for(let n of Object.keys(e))e[n]+=t.counts[n];return e},[S]),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(x7),[O,k]=(0,v.useState)(!1),A=(0,v.useRef)(null),j=w.trim()!==``,M=E.mode===`conversations`,[N,ee]=(0,v.useState)(new Set);(0,v.useEffect)(()=>ee(new Set),[w,E]);let te=(0,v.useMemo)(()=>M?zbe(w,E):null,[M,w,E]),P=te?JSON.stringify(te):``,[F,ne]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(!e||!te)return;let t=new AbortController,n=!0,r=setTimeout(()=>{i.searchImportChats(te,t.signal).then(e=>{n&&ne({key:P,res:e})})},350);return()=>{n=!1,clearTimeout(r),t.abort()}},[e,P,i]);let I=F&&F.key===P?F:null,re=(0,v.useMemo)(()=>I?.res?Bbe(x,I.res.chats):null,[I,x]),ie=(0,v.useMemo)(()=>j?M?re?x.filter(e=>re.has(O7(e))):[]:x.filter(Rbe(w,E)):null,[j,M,x,w,E,re]),ae=(0,v.useMemo)(()=>ie?new Set(ie):null,[ie]),L=(0,v.useMemo)(()=>ie?new Set(ie.map(e=>e.id)):null,[ie]),oe=ie??x,se=(0,v.useMemo)(()=>j?{query:w,options:E,litNames:!M}:null,[j,w,E,M]),ce=(0,v.useMemo)(()=>x.filter(e=>e.alreadyImported&&m.has(e.id)),[x,m]),le=(0,v.useMemo)(()=>Jbe(m,L),[m,L]),ue=S.length===1?S[0].name:`coding-agent`;(0,v.useEffect)(()=>{if(!e)return;d(null),b(null),_(new Set),h(new Set),T(``),ne(null),k(!1),s(!0);let t=n;i.scanClaudeSessions().then(e=>{p(e.sessions),h(Ube(e.sessions,t))}).catch(e=>d(e instanceof Error?e.message:String(e))).finally(()=>s(!1))},[e]);let de=(0,v.useCallback)(e=>h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[]),fe=r.prefs.claudeImportOffered,R=(0,v.useCallback)(()=>{fe||i.savePrefs({claudeImportOffered:!0}),t()},[fe,i,t]),pe=async()=>{l(!0),d(null);try{let e=await i.importClaudeSessions([...m],ce.length>0);b({imported:e.imported.length,replaced:e.replaced?.length??0,entries:e.imported.reduce((e,t)=>e+t.entries,0)+(e.replaced??[]).reduce((e,t)=>e+t.entries,0),failed:e.failed.length,filed:e.filed?.length??0,projectsMade:(e.projects??[]).filter(e=>e.created).map(e=>e.name),warnings:e.warnings??[]}),r.prefs.claudeImportOffered||i.savePrefs({claudeImportOffered:!0}),await i.refreshSessions()}catch(e){d(e instanceof Error?e.message:String(e))}finally{l(!1)}},me=C.imported+C.behind;return(0,U.jsx)(GS,{open:e,title:`Import your ${ue} chats`,onClose:R,wide:!0,footer:(0,U.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-2`,children:[(0,U.jsxs)(`span`,{className:`min-w-0 text-[11px] text-fg-faint`,children:[!y&&le.notShown>0?(0,U.jsxs)(`span`,{className:`block text-fg-muted`,"data-testid":`import-claude-ticked-hidden`,children:[le.total,` ticked · `,le.notShown,` not shown by the search`]}):null,ce.length>0?(0,U.jsxs)(`span`,{className:`block text-warn`,children:[ce.length,` already-imported `,ce.length===1?`chat`:`chats`,` `,`will be REPLACED — the OonaCode copy is rebuilt from the original, and anything added here is lost.`]}):(0,U.jsx)(`span`,{className:`block`,children:`Your other apps stay exactly as they are — this copies, it never moves or deletes.`})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,U.jsx)(K,{onClick:R,"data-testid":`import-claude-close`,children:y?`Done`:`Not now`}),y?null:(0,U.jsxs)(K,{variant:`primary`,busy:c,disabled:le.total===0,onClick:()=>void pe(),"data-testid":`import-claude-run`,children:[`Import `,I7(le.total,`chat`,`chats`)]})]})]}),children:(0,U.jsxs)(`div`,{className:`space-y-3`,"data-testid":`import-claude-body`,children:[o?(0,U.jsx)(`div`,{className:`text-sm text-fg-muted`,children:`Looking for chats on this PC…`}):null,a&&!y?(0,U.jsxs)(`div`,{className:`space-y-2`,"data-testid":`import-claude-progress`,children:[(0,U.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-sm`,children:[(0,U.jsxs)(`span`,{children:[`Importing `,(0,U.jsx)(`strong`,{children:a.done}),` of `,(0,U.jsx)(`strong`,{children:a.total}),`…`]}),(0,U.jsxs)(`span`,{className:`text-[11px] text-fg-faint`,children:[Math.round(a.done/Math.max(a.total,1)*100),`%`]})]}),(0,U.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded bg-surface-2`,children:(0,U.jsx)(`div`,{className:`h-full bg-accent transition-[width] duration-200`,style:{width:`${Math.round(a.done/Math.max(a.total,1)*100)}%`}})}),a.current?(0,U.jsxs)(`div`,{className:`truncate text-[11px] text-fg-faint`,title:a.current,children:[`reading: `,a.current]}):null,(0,U.jsxs)(`div`,{className:`flex gap-3 text-[11px] text-fg-faint`,children:[(0,U.jsxs)(`span`,{children:[a.imported,` imported`]}),a.skipped>0?(0,U.jsxs)(`span`,{children:[a.skipped,` already in`]}):null,a.failed>0?(0,U.jsxs)(`span`,{className:`text-warn`,children:[a.failed,` could not be read`]}):null]}),(0,U.jsx)(`p`,{className:`text-[11px] text-fg-faint`,children:`A big chat takes a moment — the largest here are over 100 MB. Your Claude Code is only being read.`})]}):null,u?(0,U.jsx)(`div`,{className:`rounded border border-danger/40 bg-danger/10 p-2 text-sm text-danger`,children:u}):null,y?(0,U.jsxs)(`div`,{className:`text-sm`,"data-testid":`import-claude-done`,children:[(0,U.jsxs)(`p`,{children:[`Imported `,(0,U.jsx)(`strong`,{children:y.imported}),` `,y.imported===1?`chat`:`chats`,y.replaced>0?(0,U.jsxs)(U.Fragment,{children:[` and rebuilt `,(0,U.jsx)(`strong`,{children:y.replaced}),` that `,y.replaced===1?`was`:`were`,` already here`]}):null,` `,`(`,y.entries.toLocaleString(),` entries). They are in your sessions list now, and you can carry on typing in them.`]}),y.projectsMade.length>0?(0,U.jsxs)(`p`,{className:`mt-1`,"data-testid":`import-claude-projects-made`,children:[y.projectsMade.length===1?`Created the project `:`Created the projects `,y.projectsMade.map((e,t)=>(0,U.jsxs)(`span`,{children:[t>0?`, `:``,(0,U.jsx)(`strong`,{children:e})]},e)),` `,`and filed `,y.projectsMade.length===1?`its`:`their`,` chats under`,` `,y.projectsMade.length===1?`it`:`them`,`.`]}):null,y.filed>0?(0,U.jsxs)(`p`,{className:`mt-1 text-fg-muted`,"data-testid":`import-claude-filed`,children:[y.filed,` `,y.filed===1?`chat that was`:`chats that were`,` already here`,` `,y.filed===1?`is`:`are`,` now filed under`,` `,y.filed===1?`its`:`their`,` project.`]}):null,y.failed>0?(0,U.jsxs)(`p`,{className:`mt-1 text-warn`,children:[y.failed,` could not be read and were left alone.`]}):null,y.warnings.map(e=>(0,U.jsx)(`p`,{className:`mt-1 text-warn`,children:e},e))]}):null,!o&&!y&&!a&&f!==null&&f.length>0?(0,U.jsxs)(`div`,{className:`space-y-0.5 text-sm`,"data-testid":`import-claude-tally`,children:[(0,U.jsxs)(`p`,{children:[(0,U.jsx)(`strong`,{children:f.length}),` `,f.length===1?`chat`:`chats`,` on this PC`,S.length>0?` — `:``,S.map((e,t)=>(0,U.jsxs)(`span`,{children:[t>0?`, `:``,(0,U.jsx)(`strong`,{children:e.rows.length}),` `,e.name]},e.key))]}),(0,U.jsxs)(`p`,{className:`text-fg-muted`,children:[(0,U.jsx)(`strong`,{className:`text-fg`,children:C.new}),` new`,me>0?` · ${me} already imported`:``,C.behind>0?` (${C.behind} behind their original)`:``,C.deleted>0?` · ${C.deleted} you deleted in OonaCode`:``]})]}):null,!o&&!y&&!a&&f!==null&&C.new===0&&!j?(0,U.jsx)(`div`,{className:`text-sm text-fg-muted`,"data-testid":`import-claude-empty`,children:f.length===0?`No chats from a coding agent were found on this PC.`:`Nothing new to import. Every chat is listed below — tick one to import it again.`}):null,!y&&!a&&x.length>0?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Every chat the coding agents on this PC have, newest first. Importing copies them into OonaCode so you can read them here — and continue them, in the folder each one ran in.`,n&&C.new>0?` The new ones are ticked.`:` Tick the ones you want.`]}),(0,U.jsxs)(`div`,{className:`relative`,"data-testid":`import-search`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsxs)(`div`,{className:`relative flex-1`,children:[(0,U.jsx)(G.Search,{className:`pointer-events-none absolute left-2 top-2 w-3.5 h-3.5 text-fg-faint`}),(0,U.jsx)(`input`,{ref:A,"aria-label":`Search the chats to import`,className:H(q,`pl-7`),placeholder:M?`Search inside every conversation`:`Search by name, message or folder`,value:w,onChange:e=>T(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(w!==``||O)&&(e.preventDefault(),e.stopPropagation(),O?k(!1):T(``))},"data-testid":`import-search-input`})]}),(0,U.jsxs)(zS,{label:O?`Hide search options`:`Search options`,className:H(`relative`,O&&`text-accent`),"aria-pressed":O,onMouseDown:e=>e.preventDefault(),onClick:()=>k(e=>!e),"data-testid":`import-search-options-toggle`,children:[(0,U.jsx)(G.Sliders,{}),C7(E)?(0,U.jsx)(`span`,{className:`absolute right-0.5 top-0.5 h-1.5 w-1.5 rounded-full bg-accent`,"data-testid":`import-search-options-dot`}):null]}),j?(0,U.jsx)(zS,{label:`Clear search`,onMouseDown:e=>e.preventDefault(),onClick:()=>{T(``),A.current?.focus()},"data-testid":`import-search-clear`,children:(0,U.jsx)(G.X,{})}):null]}),O?(0,U.jsx)(D7,{options:E,onChange:D,words:Ybe,onClose:()=>{k(!1),A.current?.focus()}}):null]}),j?(0,U.jsx)(sxe,{query:w,conversations:M,request:te!==null,answer:I,matches:ie?.length??0,messages:[...re?.values()??[]].reduce((e,t)=>e+t.hits,0),capped:[...re?.values()??[]].some(e=>e.hitsCapped)}):null,(0,U.jsx)(`div`,{className:`max-h-96 space-y-3 overflow-y-auto`,"data-testid":`import-claude-list`,children:S.map(e=>{let t=ae?e.rows.filter(e=>ae.has(e)):e.rows;if(t.length===0)return null;let n=ae?!N.has(e.key):!g.has(e.key),r=ae?ee:_;return(0,U.jsxs)(`div`,{className:`rounded border border-border`,"data-testid":`import-group-${e.key}`,children:[(0,U.jsx)(nxe,{section:e,rows:t,searching:ae!==null,open:n,chosen:m,onFold:()=>r(t=>exe(t,e.key)),onTicks:h}),n?t.map(e=>(0,U.jsx)(ixe,{row:e,checked:m.has(e.id),onToggle:de,phrase:se,hit:re?.get(O7(e))},O7(e))):null]},e.key)})}),(0,U.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-fg-faint`,children:[(0,U.jsx)(`button`,{type:`button`,className:`underline`,title:P7,onClick:()=>h(e=>{let t=new Set(e);for(let e of oe)M7(e)&&t.add(e.id);return t}),"data-testid":`import-claude-select-all`,children:ie===null?`Select all`:`Select all matches`}),(0,U.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>h(e=>{if(ie===null)return new Set;let t=new Set(e);for(let e of oe)t.delete(e.id);return t}),"data-testid":`import-claude-select-none`,children:ie===null?`Select none`:`Unselect matches`})]})]}):null]})})}function exe(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function txe({state:e,disabled:t,onToggle:n,label:r,title:i,testId:a}){let o=(0,v.useRef)(null);return(0,v.useEffect)(()=>{o.current&&(o.current.indeterminate=e===`some`)}),(0,U.jsx)(`input`,{ref:o,type:`checkbox`,className:`shrink-0`,checked:e===`all`,disabled:t,onChange:n,"aria-label":r,title:i,"data-state":e,"data-testid":a})}function nxe({section:e,rows:t,searching:n,open:r,chosen:i,onFold:a,onTicks:o}){let s=N7(t,i),c=t.filter(M7).length,l=e.rows.filter(e=>i.has(e.id)).length,u=e.counts,d=u.imported+u.behind===e.rows.length,f=n?`the ${e.name} matches`:`${e.name}`,p=s===`all`?`Untick every chat in ${f}`:c===0&&s===`none`?`Nothing new here — tick a chat on its own row to import it again.`:c===0?`Untick every chat in ${f}`:P7;return(0,U.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-2 border-b border-border bg-surface-2 px-2 py-1.5`,children:[(0,U.jsx)(txe,{state:s,disabled:c===0&&s===`none`,onToggle:()=>o(e=>qbe(t,e)),label:s===`all`?`Untick every chat in ${f}`:`Tick the chats in ${f}`,title:p,testId:`import-group-check-${e.key}`}),(0,U.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left text-xs font-medium`,onClick:a,"aria-expanded":r,title:r?`Fold ${e.name}`:`Open ${e.name}`,"data-testid":`import-group-header-${e.key}`,children:[(0,U.jsx)(G.Chevron,{open:r,className:`w-3 h-3 shrink-0`}),e.name,(0,U.jsxs)(`span`,{className:`truncate font-normal text-fg-faint`,children:[I7(e.rows.length,`chat`,`chats`),n?` · ${I7(t.length,`match`,`matches`)}`:``,u.new>0?` · ${u.new} new`:d?` · all imported`:``,u.behind>0?` · ${u.behind} behind`:``,u.deleted>0?` · ${u.deleted} you deleted`:``,l>0?` · ${l} ticked`:``]})]})]})}function rxe({row:e,status:t}){let n=Vbe[t],r={"data-testid":`import-status-${e.id}`,"data-status":t};switch(t){case`new`:return(0,U.jsx)(`span`,{className:`font-medium text-accent`,...r,children:n});case`imported`:case`behind`:return(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-fg-muted`,title:t===`behind`?`The original has newer messages than the OonaCode copy — importing again brings them in (and replaces the copy).`:`Already in OonaCode. Ticking it rebuilds the OonaCode copy from the original, which replaces it.`,...r,children:[(0,U.jsx)(G.Check,{className:`w-3 h-3 text-ok`}),n,t===`behind`?(0,U.jsxs)(`span`,{className:`ml-0.5 inline-flex shrink-0 items-center gap-0.5 rounded bg-warn-soft px-1 text-[10px] font-medium leading-4 text-warn`,"data-testid":`import-behind-${e.id}`,"aria-label":`behind its original`,children:[(0,U.jsx)(G.ArrowDown,{className:`w-2.5 h-2.5`}),`behind`]}):null]});case`deleted`:return(0,U.jsx)(`span`,{className:`text-fg-faint`,title:`You imported this chat and deleted it in OonaCode; its original is still on this PC. Tick it to bring it back.`,...r,children:n});case`unavailable`:return(0,U.jsx)(`span`,{className:`text-warn`,...r,children:n})}}var ixe=(0,v.memo)(function({row:e,checked:t,onToggle:n,phrase:r,hit:i}){let a=j7(e),o=e=>r?.litNames?S7(e,r.query,r.options).map((e,t)=>e.hit?(0,U.jsx)(`mark`,{className:`rounded bg-warn-soft px-0.5 text-fg`,children:e.text},t):(0,U.jsx)(`span`,{children:e.text},t)):e;return(0,U.jsxs)(`label`,{className:`flex items-start gap-2 border-b border-border p-2 last:border-b-0 ${a?`cursor-default opacity-60`:`cursor-pointer hover:bg-surface-2`}`,"data-testid":`import-row-${e.id}`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:t,disabled:a,onChange:()=>n(e.id),"aria-label":e.title??e.firstPrompt??e.id}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-sm`,children:e.title||e.firstPrompt?o(e.title||e.firstPrompt||``):(0,U.jsx)(`span`,{className:`text-fg-faint`,children:`(no prompt)`})}),(0,U.jsxs)(`span`,{className:`mt-0.5 block truncate text-[11px] text-fg-faint`,children:[e.projectName?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,U.jsx)(G.Project,{className:`w-3 h-3`}),o(e.projectName)]}):(0,U.jsxs)(U.Fragment,{children:[e.cwd?(0,U.jsx)(`span`,{title:e.cwd,children:o(F7(e.cwd))}):F7(e.cwd),e.cwd&&!e.cwdExists?` · folder is gone`:``]}),` `,`· `,e.entryCount,` entries`,e.bytes>0?` · ${Zbe(e.bytes)}`:``,e.model?` · ${e.model}`:``]}),e.unavailable||e.note?(0,U.jsx)(`span`,{className:`mt-0.5 block text-[11px] ${e.unavailable?`text-warn`:`text-fg-faint`}`,"data-testid":`import-row-note-${e.id}`,children:e.unavailable??e.note}):null,i&&r?(0,U.jsx)(oxe,{hit:i,query:r.query,options:r.options,testId:`import-row-hits-${e.id}`}):null]}),e.supersedes&&e.supersedes.length>0?(0,U.jsx)(`span`,{className:`mt-0.5 shrink-0 rounded bg-surface-2 px-1 text-[11px] text-fg-faint`,title:`Rewound — replaces ${e.supersedes.length} earlier ${e.supersedes.length===1?`branch`:`branches`} of this chat`,children:`rewound`}):null,(0,U.jsxs)(`span`,{className:`mt-0.5 flex shrink-0 flex-col items-end gap-0.5 text-right text-[11px]`,children:[(0,U.jsx)(`span`,{className:`whitespace-nowrap text-fg-faint`,children:Qbe(e.lastEntryAt??e.updatedAt)}),(0,U.jsx)(`span`,{className:`whitespace-nowrap`,children:(0,U.jsx)(rxe,{row:e,status:A7(e)})})]})]})});function axe(e){let t=e.kind===`tool`?e.tool??`Tool`:e.role===`assistant`?`Model`:`You`;return e.subagent?`${t} (subagent)`:t}function oxe({hit:e,query:t,options:n,testId:r}){return(0,U.jsxs)(`span`,{className:`mt-1 block space-y-0.5`,"data-testid":r,children:[(0,U.jsxs)(`span`,{className:`block text-[11px] font-medium text-fg-muted`,children:[e.hits,e.hitsCapped?`+`:``,` `,e.hits===1&&!e.hitsCapped?`message says`:`messages say`,` it`]}),e.snippets.map((e,r)=>(0,U.jsxs)(`span`,{className:`block line-clamp-2 text-[11px] text-fg-muted`,"data-testid":`import-row-snippet`,children:[(0,U.jsxs)(`span`,{className:`font-medium text-fg-faint`,children:[axe(e),`:`]}),` `,S7(e.snippet,t,n).map((e,t)=>e.hit?(0,U.jsx)(`mark`,{className:`rounded bg-warn-soft px-0.5 text-fg`,children:e.text},t):(0,U.jsx)(`span`,{children:e.text},t))]},r))]})}function sxe({query:e,conversations:t,request:n,answer:r,matches:i,messages:a,capped:o}){let s=(e,t,n=`text-fg-muted`)=>(0,U.jsx)(`p`,{className:`text-[11px] ${n}`,"data-testid":t,children:e});if(!t)return i===0?s(`No chat’s name, message or folder says “${e.trim()}”. Whole conversations, in the search options, looks inside them.`,`import-search-none`):s(`${i} ${i===1?`chat matches`:`chats match`}`,`import-search-count`);if(!n)return s(e.trim().length<2?`Type at least two characters to search inside the conversations.`:`Tick what to look in — your messages, the model’s replies or the tools’ side.`,`import-search-idle`);if(!r)return s(`Searching every conversation on this PC…`,`import-search-busy`);if(r.res===null)return s(`This PC could not search its conversations. Try again, or update OonaCode.`,`import-search-failed`,`text-danger`);let c=r.res,l=Xbe(c),u=c.sources.filter(e=>e.note).map(e=>`${e.agentName}: ${e.note}`);return(0,U.jsxs)(`div`,{className:`space-y-0.5`,children:[i===0?s(c.partial===`aborted`?`The search was stopped.`:`No conversation on this PC says that.`,`import-search-none`):s(`${i} ${i===1?`chat says`:`chats say`} it · ${a}${o?`+`:``} ${a===1&&!o?`message`:`messages`}`,`import-search-count`),l?s(l,`import-search-partial`,`text-warn`):null,u.map(e=>(0,U.jsx)(`p`,{className:`text-[11px] text-fg-faint`,"data-testid":`import-search-source-note`,children:e},e))]})}function cxe({id:e,title:t,icon:n,count:r,collapsed:i,onToggle:a,onRemove:o,removeLabel:s,grow:c,drag:l,children:u}){return(0,U.jsxs)(`section`,{"aria-label":t,"data-testid":`section-${e}`,style:{flexGrow:c,flexShrink:1,flexBasis:i?`auto`:0},className:H(`relative flex min-h-0 flex-col border-b border-border last:border-b-0`,l?.hint===`before`&&`shadow-[inset_0_2px_0_0_var(--color-accent)]`,l?.hint===`after`&&`shadow-[inset_0_-2px_0_0_var(--color-accent)]`),onDragOver:l?.onDragOver,onDrop:l?.onDrop,children:[(0,U.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 px-3`,draggable:l?!0:void 0,onDragStart:l?.onDragStart,onDragEnd:l?.onDragEnd,children:[(0,U.jsxs)(`button`,{type:`button`,"aria-expanded":!i,"aria-controls":`section-body-${e}`,"data-testid":`section-header-${e}`,onClick:a,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,title:i?`Open ${t}`:`Fold ${t}`,children:[(0,U.jsx)(G.Chevron,{open:!i,className:`w-3 h-3 text-fg-faint`}),n?(0,U.jsx)(n,{className:`w-3.5 h-3.5 text-fg-faint`}):null,(0,U.jsxs)(`span`,{className:`truncate text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:[t,typeof r==`number`?` · ${r}`:``]})]}),o?(0,U.jsx)(zS,{label:s??`Hide ${t}`,className:`p-1`,onClick:o,children:(0,U.jsx)(G.X,{className:`w-3.5 h-3.5`})}):null]}),(0,U.jsx)(`div`,{id:`section-body-${e}`,"data-testid":`section-body-${e}`,hidden:i,className:H(`min-h-0 flex-1 flex-col`,i?`hidden`:`flex`),children:u})]})}function L7({items:e,onPick:t,testId:n,label:r,multi:i=!1,className:a,footer:o}){let s=(0,v.useRef)(null);return(0,U.jsxs)(`div`,{ref:s,role:`tablist`,"aria-orientation":`vertical`,"aria-label":r,"data-testid":n,onKeyDown:e=>{if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=Array.from(s.current?.querySelectorAll(`button[role="tab"]`)??[]);if(t.length===0)return;let n=t.indexOf(document.activeElement),r=e.key===`Home`?0:e.key===`End`?t.length-1:n<0?0:(n+(e.key===`ArrowDown`?1:-1)+t.length)%t.length;e.preventDefault(),t[r]?.focus()},className:H(`flex w-12 shrink-0 flex-col items-center gap-1 border-border bg-surface py-2`,a),children:[e.map(n=>(0,U.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n.active,"aria-label":n.label,title:n.label,"data-testid":`activity-${n.id}`,tabIndex:n.active||!i&&e.every(e=>!e.active)?0:-1,onClick:()=>t(n.id),className:H(`relative flex h-10 w-10 items-center justify-center rounded-md`,n.active?`bg-surface-2 text-fg shadow-[inset_2px_0_0_0_var(--color-accent)]`:`text-fg-muted hover:bg-surface-2 hover:text-fg`),children:[(0,U.jsx)(n.icon,{className:`w-5 h-5`}),typeof n.count==`number`&&n.count>0?(0,U.jsx)(`span`,{className:`absolute bottom-1 right-1 min-w-3.5 rounded-full bg-accent px-1 text-[9px] leading-[14px] text-white`,children:n.count>99?`99+`:n.count}):null]},n.id)),o?(0,U.jsx)(`div`,{className:`mt-auto flex flex-col items-center gap-1`,children:o}):null]})}var R7=[{kind:`photo`,label:`Photos`,empty:`No pictures in this chat yet.`},{kind:`video`,label:`Videos`,empty:`No videos in this chat yet.`},{kind:`audio`,label:`Audio`,empty:`No sound files in this chat yet.`},{kind:`file`,label:`Files`,empty:`No files in this chat yet.`},{kind:`link`,label:`Links`,empty:`No links in this chat yet.`}];function lxe(e){let t=[];for(let n of e){let e=n.at?new Date(n.at):null,r=e!==null&&!Number.isNaN(e.getTime()),i=r?`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}`:`unknown`,a=t[t.length-1];(!a||a.key!==i)&&(a={key:i,label:r?e.toLocaleDateString(void 0,{month:`long`,year:`numeric`}):`Undated`,items:[]},t.push(a)),a.items.push(n)}return t}function z7(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleString(void 0,{day:`numeric`,month:`short`,year:`numeric`,hour:`2-digit`,minute:`2-digit`})}function uxe(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleDateString(void 0,{day:`numeric`,month:`short`,year:`numeric`})}function B7(e){let t=[];e.size!==null&&e.size>=0&&t.push(Ej(e.size));let n=z7(e.at);return n&&t.push(n),t.join(` · `)}function V7(e){return e.source===`removed`?!1:e.source!==`path`||e.exists!==!1}function H7(e){return e.source===`removed`?e.removedAfterDays?`Removed after ${e.removedAfterDays} day${e.removedAfterDays===1?``:`s`}`:`Removed to save space`:e.source===`path`&&e.exists===!1?`Moved or deleted`:null}function dxe(e,t){let n=new Set(e.map(e=>e.id));return[...e,...t.filter(e=>!n.has(e.id))]}function fxe(e){try{let t=new URL(e),n=`${t.pathname===`/`?``:t.pathname}${t.search}${t.hash}`;return{host:t.host,rest:n}}catch{return{host:e,rest:``}}}function pxe(e,t){if(!t||!e)return null;let n=`u:${t}`;for(let r of e)if(r.id===n||r.uuid===t)return r.id;return null}function mxe(e){let t=new Uint8Array(e),n=``,r=32768;for(let e=0;e<t.length;e+=r)n+=String.fromCharCode(...t.subarray(e,e+r));return btoa(n)}var hxe=[{value:`all`,label:`All`,title:`Everything in this chat`},{value:`user`,label:`Mine`,title:`What you sent`},{value:`assistant`,label:`Replies`,title:`What the model’s replies contain`}];function U7(e){let t=e.getBoundingClientRect();return{x:t.left+24,y:t.bottom}}function W7(e,t){return{onContextMenu:n=>{n.preventDefault();let r=n.currentTarget;t(e,n.clientX===0&&n.clientY===0?U7(r):{x:n.clientX,y:n.clientY},r)},onKeyDown:n=>{(n.key===`ContextMenu`||n.shiftKey&&n.key===`F10`)&&(n.preventDefault(),t(e,U7(n.currentTarget),n.currentTarget))}}}var gxe=60,_xe=800,G7={items:[],nextBefore:null,missingHidden:0,loaded:!1,loading:!1,error:null};function K7(){return{photo:G7,video:G7,audio:G7,file:G7,link:G7}}function vxe({sessionId:e,onTotal:t}){let{state:n,actions:r,api:i}=W(),a=n.remote.tabs[e]!==void 0,o=n.drafts[e]!==void 0,s=n.transcripts[e]??null,c=(0,v.useCallback)(()=>r.setMediaPanel(!1),[r]),[l,u]=(0,v.useState)(`photo`),[d,f]=(0,v.useState)(`all`),p=(0,v.useRef)(d);p.current=d;let[m,h]=(0,v.useState)(!1),g=(0,v.useRef)(m);g.current=m;let[_,y]=(0,v.useState)(K7),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(!1),[w,T]=(0,v.useState)(null),E=(0,v.useRef)(_);E.current=_;let D=(0,v.useRef)(!0);(0,v.useEffect)(()=>(D.current=!0,()=>{D.current=!1}),[]);let O=!a&&!o&&typeof i.listChatMedia==`function`,k=(0,v.useCallback)(async()=>{if(i.grantChatMedia)try{let t=await i.grantChatMedia(e);D.current&&T(()=>t.urlOf)}catch{}},[i,e]);(0,v.useEffect)(()=>{O&&k()},[O,k]);let A=(0,v.useCallback)(async(t,n)=>{if(!i.listChatMedia)return;let r=E.current[t];if(r.loading||n===`more`&&!r.nextBefore)return;y(e=>({...e,[t]:{...e[t],loading:!0,error:null}}));let a=p.current,o=g.current,s;try{s=await i.listChatMedia(e,{kind:t,...a===`all`?{}:{from:a},missing:o?`show`:`hide`,limit:gxe,...n===`more`&&r.nextBefore?{before:r.nextBefore}:{}})}catch(e){if(!D.current||p.current!==a||g.current!==o)return;ng(e)&&e.code!==`session_not_found`&&C(!0),y(n=>({...n,[t]:{...n[t],loading:!1,loaded:!0,error:e instanceof Error?e.message:`The media list could not be read.`}}));return}!D.current||p.current!==a||g.current!==o||(x(s.counts),y(e=>({...e,[t]:{items:n===`more`?dxe(e[t].items,s.items):s.items,nextBefore:s.nextBefore,missingHidden:s.missingHidden??0,loaded:!0,loading:!1,error:null}})))},[i,e]);(0,v.useEffect)(()=>{O&&(E.current[l].loaded||A(l,`first`))},[O,l,A,d,m]);let j=(0,v.useMemo)(()=>s?s.items.filter(e=>e.kind===`user`||d!==`user`&&e.kind===`assistant`&&!e.streaming).length:0,[s,d]),M=(0,v.useRef)(j);(0,v.useEffect)(()=>{if(!O||j===M.current)return;let e=setTimeout(()=>{M.current=j,y(e=>{let t=K7();return t[l]={...e[l],loaded:!0},t}),A(l,`first`)},_xe);return()=>clearTimeout(e)},[O,j,l,A]);let N=n.connection.status===`open`,ee=(0,v.useRef)(!1),te=(0,v.useRef)(!1);(0,v.useEffect)(()=>{if(!N){ee.current&&(te.current=!0);return}ee.current=!0,te.current&&(te.current=!1,O&&(C(!1),x(null),E.current=K7(),y(K7()),k(),A(l,`first`)))},[N,O,k,A,l]);let P=(0,v.useCallback)(()=>{C(!1),x(null),E.current=K7(),y(K7()),k(),A(l,`first`)},[k,A,l]),F=r.toast,ne=(0,v.useCallback)(e=>{p.current!==e&&(p.current=e,E.current=K7(),y(K7()),x(null),f(e))},[]),I=(0,v.useCallback)(e=>{g.current!==e&&(g.current=e,E.current=K7(),y(K7()),x(null),h(e))},[]),[re,ie]=(0,v.useState)(null),ae=(0,v.useCallback)((e,t,n)=>ie({item:e,at:t,el:n}),[]),L=(0,v.useCallback)(()=>ie(null),[]),oe=(0,v.useCallback)(t=>{let n=pxe(s?.items,t.entryUuid);if(!n){F(`info`,`That message is not loaded in this window yet — scroll up in the chat.`);return}r.jumpToItem(e,n),typeof window<`u`&&typeof window.matchMedia==`function`&&!window.matchMedia(`(min-width: 1024px)`).matches&&c()},[r,c,F,e,s?.items]),se=(0,v.useCallback)(async t=>{if(!i.readChatMedia)return null;try{return mxe(await i.readChatMedia(e,t.id))}catch(e){return F(`error`,`${t.name} could not be read: ${e instanceof Error?e.message:`unknown error`}`),null}},[i,F,e]),ce=(0,v.useCallback)(async e=>{if(e.source===`path`&&e.path){await DF(e.path,F);return}let t=await se(e);t!==null&&await kF({name:e.name,mediaType:e.mediaType.split(`;`)[0]??e.mediaType,base64:t},F)},[F,se]),le=typeof window<`u`?window.oonacode:void 0,ue=le?.showItemInFolder?e=>{e.path&&le.showItemInFolder?.(e.path).then(e=>{!e.ok&&e.message&&F(`error`,e.message)},()=>F(`error`,`The folder could not be opened.`))}:null,[de,fe]=(0,v.useState)(null),R=(0,v.useMemo)(()=>_.photo.items.filter(V7),[_.photo.items]),pe=(0,v.useCallback)(async(e,t=R)=>{let n=t[e];if(!n)return;let r=await se(n);r===null||!D.current||fe({index:e,picture:{id:n.id,name:n.name,mediaType:n.mediaType,base64:r}})},[se,R]),me=(0,v.useCallback)(()=>fe(null),[]),he=de?{index:de.index,total:R.length,onPrev:de.index>0?()=>void pe(de.index-1):null,onNext:de.index<R.length-1?()=>void pe(de.index+1):null}:void 0,[ge,_e]=(0,v.useState)(null),ve=(0,v.useCallback)((e,t)=>{navigator.clipboard.writeText(e).then(()=>F(`success`,`${t} copied.`),()=>F(`error`,`${t} could not be copied.`))},[F]),ye=(0,v.useMemo)(()=>{let e=re?.item;if(!e)return[];let t=[],n=H7(e)!==null;if(e.kind===`link`&&e.url){let n=e.url;t.push({key:`open`,label:`Open in browser`,icon:(0,U.jsx)(G.ExternalLink,{className:`w-3.5 h-3.5`}),onSelect:()=>H5(n)})}else if(e.kind===`photo`){let r=R.findIndex(t=>t.id===e.id);t.push({key:`open`,label:`View`,icon:(0,U.jsx)(G.Image,{className:`w-3.5 h-3.5`}),disabled:n||r<0,onSelect:()=>void pe(r)})}else e.kind===`video`?t.push({key:`open`,label:`Play`,icon:(0,U.jsx)(G.Play,{className:`w-3.5 h-3.5`}),disabled:n,onSelect:()=>_e(e)}):t.push({key:`open`,label:e.kind===`audio`?`Open externally`:`Open`,icon:(0,U.jsx)(G.ExternalLink,{className:`w-3.5 h-3.5`}),disabled:n,onSelect:()=>void ce(e)});if(t.push({key:`show-in-chat`,label:`Show in chat`,icon:(0,U.jsx)(G.Chats,{className:`w-3.5 h-3.5`}),hint:e.from===`assistant`?`reply`:`your message`,onSelect:()=>oe(e),testId:`media-menu-show-in-chat`}),ue&&e.source===`path`&&e.exists!==!1&&t.push({key:`folder`,label:`Show in folder`,icon:(0,U.jsx)(G.Folder,{className:`w-3.5 h-3.5`}),onSelect:()=>ue(e)}),e.kind===`link`&&e.url){let n=e.url;t.push({key:`copy`,label:`Copy link`,icon:(0,U.jsx)(G.Copy,{className:`w-3.5 h-3.5`}),separated:!0,onSelect:()=>ve(n,`The link`)})}else if(e.path){let n=e.path;t.push({key:`copy`,label:`Copy path`,icon:(0,U.jsx)(G.Copy,{className:`w-3.5 h-3.5`}),separated:!0,onSelect:()=>ve(n,`The path`)})}return t},[re,R,pe,ce,oe,ue,ve]),be=b?Object.values(b).reduce((e,t)=>e+t,0):null;(0,v.useEffect)(()=>{t?.(be)},[t,be]);let xe=_[l],Se=b??mh();return(0,U.jsxs)(U.Fragment,{children:[a?(0,U.jsx)(q7,{children:`This chat runs on another PC. Its pictures and files are on that PC — open the media explorer there.`}):o?(0,U.jsx)(q7,{children:`Nothing has been sent in this chat yet.`}):!O||S?(0,U.jsxs)(q7,{children:[`This PC's OonaCode does not list a chat's media yet — update it.`,` `,O?(0,U.jsx)(`button`,{type:`button`,className:`underline`,onClick:P,"data-testid":`media-retry-unsupported`,children:`Try again`}):null]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{role:`group`,"aria-label":`Whose media`,className:`flex shrink-0 gap-0.5 border-b border-border px-1.5 py-1`,"data-testid":`media-from`,children:hxe.map(e=>(0,U.jsx)(`button`,{type:`button`,"aria-pressed":d===e.value,title:e.title,onClick:()=>ne(e.value),"data-testid":`media-from-${e.value}`,className:H(`flex-1 rounded-md px-2 py-1 text-xs`,d===e.value?`bg-accent-soft font-semibold text-accent`:`text-fg-muted hover:bg-surface-2 hover:text-fg`),children:e.label},e.value))}),(0,U.jsx)(`div`,{role:`tablist`,"aria-label":`Kinds of media`,className:`flex shrink-0 gap-0.5 overflow-x-auto border-b border-border px-1.5 py-1`,onKeyDown:e=>{if(e.key!==`ArrowRight`&&e.key!==`ArrowLeft`)return;let t=R7[(R7.findIndex(e=>e.kind===l)+(e.key===`ArrowRight`?1:-1)+R7.length)%R7.length];u(t.kind),e.preventDefault(),requestAnimationFrame(()=>document.getElementById(`media-tab-${t.kind}`)?.focus())},children:R7.map(e=>(0,U.jsxs)(`button`,{id:`media-tab-${e.kind}`,type:`button`,role:`tab`,"aria-selected":l===e.kind,"aria-controls":`media-tabpanel`,tabIndex:l===e.kind?0:-1,onClick:()=>u(e.kind),"data-testid":`media-tab-${e.kind}`,className:H(`flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-xs`,l===e.kind?`bg-surface-2 font-semibold text-fg`:`text-fg-muted hover:bg-surface-2 hover:text-fg`),children:[e.label,(0,U.jsx)(`span`,{className:`rounded-full bg-surface-3 px-1.5 text-[10px] tabular-nums text-fg-muted`,"data-testid":`media-count-${e.kind}`,children:Se[e.kind]})]},e.kind))}),(0,U.jsxs)(`div`,{id:`media-tabpanel`,role:`tabpanel`,"aria-labelledby":`media-tab-${l}`,className:`min-h-0 flex-1 overflow-y-auto px-2 py-2`,"data-testid":`media-tabpanel`,children:[xe.error&&xe.items.length===0?(0,U.jsxs)(`div`,{className:`p-2 text-xs text-danger`,role:`alert`,children:[xe.error,` `,(0,U.jsx)(`button`,{type:`button`,className:`underline`,onClick:P,"data-testid":`media-retry`,children:`Try again`})]}):xe.loaded&&xe.items.length===0?(0,U.jsx)(`div`,{className:`p-4 text-center text-xs text-fg-faint`,"data-testid":`media-empty`,children:R7.find(e=>e.kind===l)?.empty}):l===`photo`||l===`video`?(0,U.jsx)(bxe,{items:xe.items,urlOf:w,onOpen:e=>{if(e.kind===`photo`){let t=R.findIndex(t=>t.id===e.id);t>=0&&pe(t)}else _e(e)},onShowInChat:oe,onBroken:k,onMenu:ae}):(0,U.jsx)(`ul`,{className:`flex flex-col gap-1`,"data-testid":`media-list`,children:xe.items.map(e=>(0,U.jsx)(Cxe,{item:e,urlOf:w,onOpen:()=>e.kind===`link`&&e.url?H5(e.url):void ce(e),onShowInFolder:ue&&e.source===`path`&&e.exists!==!1?()=>ue(e):null,onShowInChat:()=>oe(e),onMenu:ae,onBroken:k,showOwner:d===`all`},e.id))}),!m&&xe.loaded&&xe.missingHidden>0?(0,U.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-fg-muted`,"data-testid":`media-missing-hidden`,children:[(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[xe.missingHidden,` file`,xe.missingHidden===1?``:`s`,` the replies named `,xe.missingHidden===1?`is`:`are`,` not on this PC any more — left out.`]}),(0,U.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>I(!0),"data-testid":`media-show-missing`,children:`Show`})]}):null,m&&xe.items.some(e=>e.exists===!1)?(0,U.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 rounded-md bg-surface-2 px-2 py-1.5 text-[11px] text-fg-muted`,"data-testid":`media-missing-shown`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1`,children:`Showing files that are not on this PC any more.`}),(0,U.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>I(!1),"data-testid":`media-hide-missing`,children:`Hide them`})]}):null,xe.loading?(0,U.jsxs)(`div`,{className:`flex justify-center p-3 text-fg-faint`,"aria-live":`polite`,children:[(0,U.jsx)(G.Spinner,{className:`w-4 h-4 animate-spin`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Loading…`})]}):xe.nextBefore?(0,U.jsx)(yxe,{onLoad:()=>void A(l,`more`)}):null]})]}),(0,U.jsx)(HC,{open:re!==null,at:re?.at??{x:0,y:0},anchorEl:re?.el??null,label:`Media actions`,testId:`media-context-menu`,onClose:L,items:ye}),(0,U.jsx)(IF,{picture:de?.picture??null,onClose:me,notify:F,...he?{nav:he}:{}}),(0,U.jsx)(wxe,{item:ge,src:ge&&w?w(ge.id):null,onClose:()=>_e(null),onOpen:ge?()=>void ce(ge):null})]})}function q7({children:e}){return(0,U.jsx)(`div`,{className:`p-4 text-xs text-fg-faint`,"data-testid":`media-note`,children:e})}function yxe({onLoad:e}){let t=(0,v.useRef)(null),n=(0,v.useRef)(e);return n.current=e,(0,v.useEffect)(()=>{let e=t.current;if(!e||typeof IntersectionObserver>`u`)return;let r=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&n.current()});return r.observe(e),()=>r.disconnect()},[]),(0,U.jsx)(`div`,{ref:t,className:`flex justify-center p-2`,children:(0,U.jsx)(K,{size:`sm`,variant:`ghost`,onClick:e,"data-testid":`media-load-more`,children:`Load more`})})}function bxe({items:e,urlOf:t,onOpen:n,onShowInChat:r,onBroken:i,onMenu:a}){let o=(0,v.useMemo)(()=>lxe(e),[e]);return(0,U.jsx)(`div`,{className:`flex flex-col gap-3`,"data-testid":`media-grid`,children:o.map(e=>(0,U.jsxs)(`section`,{"aria-label":e.label,children:[(0,U.jsx)(`h3`,{className:`mb-1 px-0.5 text-[11px] font-semibold text-fg-faint`,children:e.label}),(0,U.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:e.items.map(e=>(0,U.jsx)(xxe,{item:e,src:t&&V7(e)?t(e.id):null,onOpen:()=>n(e),onShowInChat:()=>r(e),onBroken:i,onMenu:a},e.id))})]},e.key))})}function xxe({item:e,src:t,onOpen:n,onShowInChat:r,onBroken:i,onMenu:a}){let o=H7(e),[s,c]=(0,v.useState)(!1),l=(0,v.useRef)(!1),u=`${e.name}${e.at?` — ${z7(e.at)}`:``}`,d=uxe(e.at);return(0,U.jsxs)(`div`,{className:`group relative aspect-square overflow-hidden rounded-md border border-border bg-surface-2`,"data-testid":`media-tile`,"data-media-id":e.id,"data-from":e.from,...W7(e,a),children:[o?(0,U.jsxs)(`div`,{className:`flex h-full w-full flex-col items-center justify-center gap-0.5 overflow-hidden p-1 text-center text-[10px] leading-tight text-fg-faint`,title:`${u} — ${o.toLowerCase()}${e.path?` (${e.path})`:``}`,"data-testid":`media-tile-unavailable`,children:[e.kind===`video`?(0,U.jsx)(G.Film,{className:`w-4 h-4 shrink-0`}):(0,U.jsx)(G.Image,{className:`w-4 h-4 shrink-0`}),(0,U.jsx)(`span`,{className:`text-warn`,"data-testid":`media-tile-reason`,children:o}),(0,U.jsx)(`span`,{className:`line-clamp-2 break-all font-medium text-fg-muted`,"data-testid":`media-tile-name`,children:e.name}),d?(0,U.jsx)(`span`,{"data-testid":`media-tile-date`,children:d}):null]}):(0,U.jsxs)(`button`,{type:`button`,onClick:n,title:u,"aria-label":`${e.kind===`video`?`Play`:`View`} ${u}`,className:`block h-full w-full focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"data-testid":`media-tile-open`,children:[t&&!s?e.kind===`video`?(0,U.jsx)(`video`,{src:`${t}#t=0.1`,preload:`metadata`,muted:!0,className:`pointer-events-none h-full w-full object-cover`,onError:()=>c(!0)}):(0,U.jsx)(`img`,{src:t,alt:e.name,loading:`lazy`,draggable:!1,className:`h-full w-full object-cover`,onError:()=>{if(!l.current){l.current=!0,i();return}c(!0)}}):(0,U.jsx)(`span`,{className:`flex h-full w-full items-center justify-center text-fg-faint`,children:e.kind===`video`?(0,U.jsx)(G.Film,{className:`w-5 h-5`}):(0,U.jsx)(G.Image,{className:`w-5 h-5`})}),e.kind===`video`?(0,U.jsx)(`span`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:(0,U.jsx)(`span`,{className:`rounded-full bg-black/55 p-2 text-white`,children:(0,U.jsx)(G.Play,{className:`w-4 h-4`})})}):null]}),(0,U.jsx)(`button`,{type:`button`,onClick:r,title:`Show in chat`,"aria-label":`Show ${e.name} in chat`,className:`absolute bottom-1 right-1 rounded bg-black/55 p-1 text-white opacity-0 transition-opacity focus:opacity-100 group-hover:opacity-100`,"data-testid":`media-show-in-chat`,children:(0,U.jsx)(G.Chats,{className:`w-3 h-3`})})]})}function Sxe(e){return e.kind===`link`?(0,U.jsx)(G.Link,{className:`w-4 h-4`}):e.kind===`audio`?(0,U.jsx)(G.Music,{className:`w-4 h-4`}):e.kind===`video`?(0,U.jsx)(G.Film,{className:`w-4 h-4`}):e.kind===`photo`?(0,U.jsx)(G.Image,{className:`w-4 h-4`}):(0,U.jsx)(G.File,{className:`w-4 h-4`})}function Cxe({item:e,urlOf:t,onOpen:n,onShowInFolder:r,onShowInChat:i,onMenu:a,onBroken:o,showOwner:s}){let[c,l]=(0,v.useState)(!1),u=H7(e),d=e.kind===`link`,f=d&&e.url?fxe(e.url):null,p=d?z7(e.at):B7(e),m=e.kind===`audio`&&!u&&t!==null;return(0,U.jsxs)(`li`,{className:`rounded-md border border-transparent px-1.5 py-1.5 hover:border-border hover:bg-surface-2`,"data-testid":`media-row`,"data-media-id":e.id,"data-from":e.from,...W7(e,a),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m?(0,U.jsx)(zS,{label:c?`Hide the player for ${e.name}`:`Play ${e.name}`,className:`shrink-0 rounded-full bg-accent-soft p-1.5 text-accent`,onClick:()=>l(e=>!e),"aria-pressed":c,"data-testid":`media-play`,children:c?(0,U.jsx)(G.Pause,{className:`w-3.5 h-3.5`}):(0,U.jsx)(G.Play,{className:`w-3.5 h-3.5`})}):e.kind===`file`?(0,U.jsx)(XM,{name:e.name,className:`shrink-0`}):(0,U.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-3 p-1.5 text-fg-muted`,"aria-hidden":!0,children:Sxe(e)}),(0,U.jsxs)(`button`,{type:`button`,onClick:u?void 0:n,disabled:u!==null,title:u?`${e.name} — ${u.toLowerCase()}${e.path?` (${e.path})`:``}`:d?`Open ${e.url??``} in the browser`:e.path?`Open ${e.path}`:`Open ${e.name}`,className:`min-w-0 flex-1 text-left disabled:cursor-default`,"data-testid":`media-row-open`,children:[f?(0,U.jsxs)(`span`,{className:`block truncate text-xs`,children:[(0,U.jsx)(`span`,{className:`font-medium text-accent`,children:f.host}),(0,U.jsx)(`span`,{className:`text-fg-muted`,children:f.rest})]}):(0,U.jsx)(`span`,{className:`block truncate text-xs font-medium text-fg`,children:e.name}),(0,U.jsxs)(`span`,{className:`block truncate text-[11px] text-fg-faint`,children:[u?(0,U.jsx)(`span`,{className:`text-warn`,"data-testid":`media-unavailable`,children:u}):null,u&&p?` · `:``,s?(0,U.jsx)(`span`,{"data-testid":`media-owner`,children:e.from===`assistant`?`Reply`:`You`}):null,s&&p?` · `:``,p]})]}),r?(0,U.jsx)(zS,{label:`Show in folder`,className:`shrink-0 p-1`,onClick:r,children:(0,U.jsx)(G.Folder,{className:`w-3.5 h-3.5`})}):null,(0,U.jsx)(zS,{label:`Show in chat`,className:`shrink-0 p-1`,onClick:i,"data-testid":`media-show-in-chat`,children:(0,U.jsx)(G.Chats,{className:`w-3.5 h-3.5`})})]}),c&&m&&t?(0,U.jsx)(`audio`,{controls:!0,autoPlay:!0,preload:`none`,src:t(e.id),onError:o,className:`mt-1.5 h-8 w-full`,"data-testid":`media-audio`}):null]})}function wxe({item:e,src:t,onClose:n,onOpen:r}){return(0,U.jsx)(GS,{open:e!==null,title:e?.name||`Video`,onClose:n,full:!0,children:e?(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2`,"data-testid":`video-viewer`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-fg-faint`,children:B7(e)}),r?(0,U.jsx)(K,{size:`sm`,onClick:r,children:`Open externally`}):null]}),t?(0,U.jsx)(`video`,{src:t,controls:!0,autoPlay:!0,className:`min-h-0 w-full flex-1 rounded-md bg-black`,"data-testid":`video-viewer-player`}):(0,U.jsx)(`p`,{className:`text-xs text-fg-faint`,children:`This video cannot be played here.`})]}):null})}var Txe={model:null,previousModel:null,costUsd:0,inputTokens:0,outputTokens:0,turns:0,durationMs:0,contextTokens:null,contextWindow:null,contextUsed:null,costSource:`engine`,credits:null,resetAtIndex:null,didReset:!1,countedResults:0};function Exe(e,t){let n=t?Ys(t):null,r=null,i=null;for(let t=0;t<e.length;t++){let a=e[t];if(!a||a.kind!==`assistant`||!ae(a.model))continue;let o=Ys(a.model);n!==null&&o!==n&&(r=t,i=n),n=o}return{index:r,from:i,to:n}}function Dxe(e){let{items:t,session:n=null,initModel:r=null,boundary:i=null,models:a}=e,o=e.contextTokens!=null&&e.contextTokens>0?e.contextTokens:null;if(t.length===0&&!n)return Txe;let s=Exe(t,r),c=i&&i.index>=0?Math.min(i.index,t.length):null,l=null,u=null;s.index!==null&&(c===null||s.index>=c)?(l=s.index,u=s.from):c!==null&&(l=c,u=i?.from??s.from);let d=l??0,f=0,p=0,m=0,h=0,g=0,_=0;for(let e=d;e<t.length;e++){let n=t[e];!n||n.kind!==`result`||(_+=1,f+=n.costUsd,p+=n.inputTokens,m+=n.outputTokens,h+=n.numTurns,g+=n.durationMs)}_===0&&l===null&&n&&(f=n.totalCostUsd,p=n.inputTokens,m=n.outputTokens);let v=`engine`,y=null;n&&n.providerId===`oonacode`&&(f=n.totalCostUsd,y=n.poolCredits??null,v=`gateway`);let b=r?Ys(r):null,x=i&&c!==null&&l===c?i.to:s.to??n?.model??b??null,S=[x,n?.model??null,b].filter(e=>typeof e==`string`&&e.length>0),C=(a?S.map(e=>a.find(t=>t.id===e)).find(e=>e?.contextWindow!=null):void 0)?.contextWindow??S.map(e=>Kee(e)).find(e=>e!==null)??null;return{model:x,previousModel:u,costUsd:f,inputTokens:p,outputTokens:m,turns:h,durationMs:g,contextTokens:o,contextWindow:C,contextUsed:C&&C>0&&o!==null?Math.min(1,o/C):null,resetAtIndex:l,didReset:l!==null,countedResults:_,costSource:v,credits:y}}var Oxe=[...cf.what,...cf.when,...cf.who,...cf.yours,...cf.where];function kxe({sessionId:e,entryCount:t}){let{state:n,actions:r}=W(),i=n.chatAboutsChange,a=Rd(n.settings??{}),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(!1),[y,b]=(0,v.useState)(null),[x,S]=(0,v.useState)(null),C=(0,v.useRef)(i.seq),w=(0,v.useRef)(!0);(0,v.useEffect)(()=>(w.current=!0,()=>{w.current=!1}),[]);let T=(0,v.useCallback)(async()=>{let t=await r.getChatAbout(e);if(w.current){if(t===`unsupported`){l(!0);return}t!==null&&(l(!1),s(t))}},[r,e]);if((0,v.useEffect)(()=>{T()},[T]),(0,v.useEffect)(()=>{i.seq!==C.current&&(C.current=i.seq,Xd(i,e)&&T())},[i,e,T]),c||o===null)return null;let E=()=>{p(o.about??``),d(!0),S(null),b(null)},D=async()=>{if(of(f))return;let t=f.trim()===``;h(!0);try{let n=await r.updateChatAbout(e,t?null:f);if(!w.current||!n)return;s(n),d(!1),S(t?a.enabled?`Cleared. The housekeeper writes a new about at the chat’s next change.`:`Cleared. None is written while chat abouts are off.`:null)}finally{w.current&&h(!1)}},O=async()=>{_(!0),b(null),S(null);try{let t=await r.regenerateChatAbout(e);if(!w.current)return;t.about&&s(t.about),t.ok||b(t.error??`The about could not be written.`)}finally{w.current&&_(!1)}},k=sf(f,a.maxWords),A=of(f),j=Zd(o);return(0,U.jsxs)(`div`,{className:`mb-2`,"data-testid":`session-about`,children:[(0,U.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wide text-fg-faint`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:(0,U.jsx)(G.Skill,{className:`w-3.5 h-3.5`})}),`About`,(0,U.jsx)(BS,{label:`About`,details:(0,U.jsx)(VS,{items:Oxe})}),o.stale&&o.about?(0,U.jsx)(`span`,{title:cf.stale,"data-testid":`session-about-stale`,children:(0,U.jsx)(WS,{tone:`warn`,children:`stale`})}):null]}),u?(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(`textarea`,{className:H(q,`min-h-[7rem] resize-y text-xs`),value:f,onChange:e=>p(e.target.value),"aria-label":`This chat’s about`,placeholder:`What this chat works on, for your other chats to read`,autoFocus:!0,"data-testid":`session-about-input`}),(0,U.jsxs)(`div`,{className:H(`text-[11px]`,k.overChars?`text-danger`:k.overWords?`text-warn`:`text-fg-faint`),"data-testid":`session-about-count`,children:[k.words,` / `,a.maxWords,` words · `,k.chars.toLocaleString(`en-US`),` /`,` `,Id.userChars.toLocaleString(`en-US`),` characters`]}),A?(0,U.jsx)(`div`,{className:`text-[11px] text-danger`,"data-testid":`session-about-problem`,children:A}):k.overWords?(0,U.jsxs)(`div`,{className:`text-[11px] text-warn`,children:[`Longer than the `,a.maxWords,` words the housekeeper writes; your other chats read all of it.`]}):null,(0,U.jsx)(`div`,{className:`text-[11px] text-fg-faint`,children:`Saved empty, it is cleared, and the housekeeper writes one again at the chat’s next change.`}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(K,{size:`sm`,variant:`primary`,onClick:()=>void D(),busy:m,disabled:A!==null,"data-testid":`session-about-save`,children:`Save`}),(0,U.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>d(!1),disabled:m,"data-testid":`session-about-cancel`,children:`Cancel`})]})]}):(0,U.jsxs)(U.Fragment,{children:[o.about?(0,U.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-xs text-fg`,"data-testid":`session-about-text`,children:o.about}):(0,U.jsxs)(`p`,{className:`text-[11px] text-fg-muted`,"data-testid":`session-about-missing`,children:[`No about yet. `,rf(o,{enabled:a.enabled,entryCount:t})]}),o.about&&o.aboutAt?(0,U.jsxs)(`div`,{className:`mt-0.5 text-[11px] text-fg-faint`,title:W_(o.aboutAt),"data-testid":`session-about-written`,children:[`Written `,U_(o.aboutAt),j?` by ${j}`:``]}):null,o.about&&o.pending?(0,U.jsx)(`div`,{className:`text-[11px] text-accent`,children:`Being written again now…`}):null,o.about&&o.lastError?(0,U.jsxs)(`div`,{className:`text-[11px] text-danger`,"data-testid":`session-about-last-error`,children:[`The last attempt failed: `,o.lastError]}):null,(0,U.jsxs)(`div`,{className:`mt-0.5 text-[11px] text-fg-faint`,title:o.route?`Paid by ${Qd[o.route]}`:void 0,"data-testid":`session-about-spend`,children:[`Cost so far: `,tf(o.spend,o.route)]}),x?(0,U.jsx)(`div`,{className:`mt-0.5 text-[11px] text-fg-muted`,"data-testid":`session-about-note`,children:x}):null,y?(0,U.jsx)(`div`,{className:`mt-0.5 text-[11px] text-danger`,role:`alert`,"data-testid":`session-about-regen-error`,children:y}):null,(0,U.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1.5`,children:[(0,U.jsxs)(K,{size:`sm`,variant:`ghost`,onClick:E,disabled:g,title:cf.edit,"data-testid":`session-about-edit`,children:[(0,U.jsx)(G.Edit,{className:`h-3 w-3`}),` Edit`]}),(0,U.jsx)(K,{size:`sm`,variant:`ghost`,onClick:()=>void O(),disabled:!a.enabled||g,title:a.enabled?cf.regenerate:cf.regenerateOff,"data-testid":`session-about-regenerate`,children:g?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(G.Spinner,{className:`h-3 w-3`}),` Writing…`]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(G.Refresh,{className:`h-3 w-3`}),` Regenerate`]})})]}),a.enabled?null:(0,U.jsx)(`div`,{className:`mt-0.5 text-[11px] text-fg-faint`,"data-testid":`session-about-off`,children:`Regenerate is unavailable: chat abouts are off.`})]})]})}function Axe({view:e}){let t=(0,v.useMemo)(()=>ibe(e.request??``),[e.request]);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:e.truncated?`Cut at the size the host keeps.`:`As agy sent it.`}),(0,U.jsx)(fN,{text:t})]}),(0,U.jsx)(`pre`,{className:`mt-0.5 max-h-64 overflow-auto whitespace-pre-wrap break-all rounded-md border border-border bg-code-bg p-2 font-mono text-[11px] leading-snug text-fg`,"data-testid":`agy-request-json`,children:t})]})}function jxe({sessionId:e,running:t}){let{api:n}=W(),[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(!0),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)({}),h=(0,v.useRef)(!0);(0,v.useEffect)(()=>(h.current=!0,()=>{h.current=!1}),[]);let g=(0,v.useCallback)(async()=>{if(!n.listAgyRequests){o(!0);return}c(!0);try{let t=await n.listAgyRequests(e);if(!h.current)return;o(!1),i(t.requests)}catch(e){if(!h.current)return;ng(e)&&o(!0)}finally{h.current&&c(!1)}},[n,e]);(0,v.useEffect)(()=>{g()},[g]);let _=(0,v.useRef)(t);(0,v.useEffect)(()=>{_.current&&!t&&g(),_.current=t},[t,g]);let{main:y,background:b}=(0,v.useMemo)(()=>ebe(r??[]),[r]),x=async t=>{if(p[t.id]){m(e=>{let{[t.id]:n,...r}=e;return r});return}m(e=>({...e,[t.id]:{phase:`loading`}}));let r=e=>{h.current&&m(n=>n[t.id]?{...n,[t.id]:e}:n)};if(!n.getAgyRequestBody)return r({phase:`gone`});try{let i=await n.getAgyRequestBody(e,t.id);r(i.request===null?{phase:`gone`}:{phase:`ready`,view:i})}catch(e){r(ng(e)?{phase:`gone`}:{phase:`failed`,message:Y_(e)})}};if(a||r===null)return null;let S=e=>{let{title:t,detail:n}=l7(e),r=tbe(e),i=nbe(e.usage),a=p[e.id],o=[n,e.ms===null?`running…`:V_(e.ms),i].filter(e=>!!e),s=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`flex items-baseline gap-1.5`,children:[(0,U.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-fg-faint`,title:W_(e.at),children:rbe(e.at)}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium text-fg`,children:t}),(0,U.jsx)(`span`,{className:H(`shrink-0 text-[11px] font-medium`,r.tone===`danger`?`text-danger`:`text-fg-muted`),"data-tone":r.tone,"data-testid":`agy-request-status-${e.id}`,children:r.text})]}),(0,U.jsx)(`span`,{className:`block break-words text-[11px] text-fg-faint`,children:o.join(` · `)}),e.error?(0,U.jsx)(`span`,{className:`block break-words text-[11px] text-danger`,children:e.error}):null]});return(0,U.jsxs)(`li`,{className:`rounded-md border border-border px-2 py-1`,"data-testid":`agy-request-${e.id}`,"data-kind":e.kind,children:[e.hasBody?(0,U.jsx)(`button`,{type:`button`,className:`block w-full text-left`,"aria-expanded":a!==void 0,title:`${u7(e)} — show the request`,onClick:()=>void x(e),"data-testid":`agy-request-open-${e.id}`,children:s}):(0,U.jsx)(`div`,{title:u7(e),children:s}),a?(0,U.jsx)(`div`,{className:`mt-1`,"data-testid":`agy-request-body-${e.id}`,children:a.phase===`loading`?(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-fg-muted`,children:[(0,U.jsx)(G.Spinner,{className:`h-3 w-3`}),` Loading the request…`]}):a.phase===`gone`?(0,U.jsx)(`div`,{className:`text-[11px] text-fg-muted`,"data-testid":`agy-request-body-gone`,children:`This request’s body is no longer kept on this PC.`}):a.phase===`failed`?(0,U.jsxs)(`div`,{className:`text-[11px] text-danger`,role:`alert`,children:[`Could not read it: `,a.message]}):(0,U.jsx)(Axe,{view:a.view})}):null]},e.id)};return(0,U.jsxs)(`div`,{className:`mb-2`,"data-testid":`agy-requests`,children:[(0,U.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left text-[11px] font-semibold uppercase tracking-wide text-fg-faint hover:text-fg-muted`,"aria-expanded":l,onClick:()=>u(e=>!e),"data-testid":`agy-requests-toggle`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:(0,U.jsx)(G.Chevron,{className:`h-3 w-3`,open:l})}),`Google agy requests`,(0,U.jsx)(`span`,{className:`font-mono normal-case tracking-normal`,"data-testid":`agy-requests-count`,children:r.length})]}),(0,U.jsx)(zS,{label:`Refresh agy requests`,className:`p-1`,disabled:s,onClick:()=>void g(),"data-testid":`agy-requests-refresh`,children:s?(0,U.jsx)(G.Spinner,{className:`h-3 w-3`}):(0,U.jsx)(G.Refresh,{className:`h-3 w-3`})})]}),(0,U.jsx)(`p`,{className:`mb-1 text-[11px] leading-snug text-fg-faint`,"data-testid":`agy-requests-privacy`,children:Zye}),l?(0,U.jsxs)(U.Fragment,{children:[y.length===0?(0,U.jsx)(`p`,{className:`text-[11px] text-fg-muted`,"data-testid":`agy-requests-empty`,children:`No model calls yet — they appear here as agy talks to Google.`}):(0,U.jsx)(`ul`,{className:`max-h-72 space-y-1 overflow-y-auto`,"data-testid":`agy-requests-main`,children:y.map(S)}),b.length>0?(0,U.jsxs)(`div`,{className:`mt-1.5`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 text-[11px] text-accent hover:underline`,"aria-expanded":d,onClick:()=>f(e=>!e),"data-testid":`agy-background-toggle`,children:[(0,U.jsx)(G.Chevron,{className:`h-3 w-3`,open:d}),`background calls (`,b.length,`)`]}),d?(0,U.jsx)(`ul`,{className:`mt-1 max-h-72 space-y-1 overflow-y-auto opacity-70`,"data-testid":`agy-requests-background`,children:b.map(S)}):null]}):null]}):null]})}function J7({label:e,icon:t,children:n}){return(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,U.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-xs text-fg-faint`,children:[t?(0,U.jsx)(`span`,{className:`shrink-0 text-fg-faint`,"aria-hidden":`true`,children:t}):null,e]}),(0,U.jsx)(`span`,{className:`min-w-0 truncate text-right text-xs font-medium text-fg`,children:n})]})}function Y7({label:e,icon:t}){return(0,U.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wide text-fg-faint`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:t}),e]})}var X7={provider:(0,U.jsx)(G.Plug,{className:`w-3.5 h-3.5`}),route:(0,U.jsx)(G.Globe,{className:`w-3.5 h-3.5`}),model:(0,U.jsx)(G.Bot,{className:`w-3.5 h-3.5`}),permission:(0,U.jsx)(G.Shield,{className:`w-3.5 h-3.5`}),context:(0,U.jsx)(G.Brain,{className:`w-3.5 h-3.5`}),window:(0,U.jsx)(G.Panel,{className:`w-3.5 h-3.5`}),compactions:(0,U.jsx)(G.CollapseAll,{className:`w-3.5 h-3.5`}),usage:(0,U.jsx)(G.Coins,{className:`w-3.5 h-3.5`}),tokensIn:(0,U.jsx)(G.Download,{className:`w-3.5 h-3.5`}),tokensOut:(0,U.jsx)(G.Upload,{className:`w-3.5 h-3.5`}),duration:(0,U.jsx)(G.Clock,{className:`w-3.5 h-3.5`}),turns:(0,U.jsx)(G.Send,{className:`w-3.5 h-3.5`}),session:(0,U.jsx)(G.Info,{className:`w-3.5 h-3.5`}),tasks:(0,U.jsx)(G.Bell,{className:`w-3.5 h-3.5`}),status:(0,U.jsx)(G.Monitor,{className:`w-3.5 h-3.5`}),updated:(0,U.jsx)(G.Refresh,{className:`w-3.5 h-3.5`}),entries:(0,U.jsx)(G.Menu,{className:`w-3.5 h-3.5`}),project:(0,U.jsx)(G.Project,{className:`w-3.5 h-3.5`}),folder:(0,U.jsx)(G.Folder,{className:`w-3.5 h-3.5`})};function Mxe({used:e}){let t=Math.round(e*100);return(0,U.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-surface-3`,role:`progressbar`,"aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,"aria-label":`Context used`,children:(0,U.jsx)(`div`,{className:H(`h-full rounded-full`,t>=90?`bg-danger`:t>=70?`bg-warn`:`bg-accent`),style:{width:`${t}%`}})})}function Nxe(){let{state:e,actions:t,api:n}=W(),r=ES(),[i,a]=(0,v.useState)(null),o=r?e.remote.tabs[r.id]!==void 0:!1,s=r?e.drafts[r.id]!==void 0:!1,c=TS(),l=e.currentSessionId,u=r?.projectId?e.vaultProjects.find(e=>e.id===r.projectId):void 0,d=u?.instructions.trim()??``,f=r?.providerId??e.activeProviderId,p=e.providers.find(e=>e.definition.id===f),m=p?.definition.models,h=(0,v.useMemo)(()=>{let e=p?.definition;return e?Bs(e,{credentialClass:(p.credentials.find(e=>e.variantId===r?.variantId)??p.credentials[0])?.class??null}):null},[p,r?.variantId]),g=(0,v.useMemo)(()=>Dxe({items:c?.items??[],session:r,initModel:c?.init?.model??null,boundary:l?e.modelBoundaries[l]??null:null,models:m,contextTokens:c?.contextTokens??null}),[c?.items,c?.init?.model,c?.contextTokens,r,l,e.modelBoundaries,m]),_=(0,v.useMemo)(()=>(c?.items??[]).filter(e=>e.kind===`user`&&e.compactSummary).length,[c?.items]),y=r?Fh(r.providerId)&&!o&&!s:!1,b=c?.status===`running`||c?.status===`waiting_permission`,x=(0,v.useMemo)(()=>{if(!r)return[];let e=new Set,t=[],n=n=>{let r=n.trim();!r||e.has(r)||(e.add(r),t.push(r))};for(let e of r.browserProfiles??[])n(e);for(let e of c?.items??[])if(e.kind===`tool`&&e.name===`mcp__oonacode__browser`){let t=e.input?.action;t!==`help`&&t!==`close`&&t!==`reset`&&n(r.id.replace(/[^a-zA-Z0-9-]/g,`_`).slice(0,64)||`_`)}return t},[r,c?.items]),S=(0,v.useCallback)(async e=>{if(!r||!n.openSessionBrowser){t.toast(`error`,`This PC’s OonaCode cannot open browser profiles yet — update it.`);return}a(e);try{let i=await n.openSessionBrowser(r.id,e);t.toast(`success`,i.alreadyOpen?`Brought Oonak Browser (${i.profile}) to the front`:`Opened Oonak Browser with user-data-dir ${i.profile}`)}catch(e){t.toast(`error`,e instanceof Error&&e.message?e.message:`Could not open Oonak Browser for this profile.`)}finally{a(null)}},[r,n,t]);return(0,U.jsx)(U.Fragment,{children:r?(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 py-2`,children:[g.didReset?(0,U.jsxs)(`div`,{className:`mb-2 rounded-md bg-accent-soft px-2 py-1.5 text-[11px] text-accent`,"data-testid":`stats-reset`,children:[`Statistics restarted at the model change`,g.previousModel?` (was ${g.previousModel})`:``,`.`]}):null,!o&&!s?(0,U.jsx)(kxe,{sessionId:r.id,entryCount:r.entryCount??null},r.id):null,(0,U.jsxs)(`div`,{className:`mb-2`,children:[(0,U.jsx)(Y7,{label:`Model`,icon:X7.model}),(0,U.jsx)(J7,{label:`Provider`,icon:X7.provider,children:p?.definition.displayName??f??`—`}),(0,U.jsx)(J7,{label:`Route`,icon:X7.route,children:h?(0,U.jsx)(WS,{tone:h.viaGateway?`accent`:`ok`,children:h.badge}):`—`}),h?(0,U.jsx)(`div`,{className:`pb-1 text-[11px] leading-snug text-fg-faint`,children:h.detail}):null,(0,U.jsx)(J7,{label:`Model`,icon:X7.model,children:g.model??r.model??`—`}),(0,U.jsxs)(J7,{label:`Permission mode`,icon:X7.permission,children:[(0,U.jsx)(WS,{children:te(ne(r))}),` `,(0,U.jsx)(WS,{children:r.permissionMode})]})]}),(0,U.jsxs)(`div`,{className:`mb-2`,children:[(0,U.jsx)(Y7,{label:`Context`,icon:X7.context}),g.contextUsed!==null&&g.contextTokens!==null?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Mxe,{used:g.contextUsed}),(0,U.jsxs)(`div`,{className:`mt-1 text-[11px] text-fg-muted`,"data-testid":`context-used`,children:[H_(g.contextTokens),` / `,H_(g.contextWindow??0),` `,`tokens (`,Math.round(g.contextUsed*100),`%)`]})]}):(0,U.jsx)(`div`,{className:`text-[11px] text-fg-muted`,"data-testid":`context-used`,children:g.contextTokens===null?`Measured at the next reply`:`${H_(g.contextTokens)} tokens (window unknown)`}),(0,U.jsx)(J7,{label:`Context window`,icon:X7.window,children:(0,U.jsx)(`span`,{"data-testid":`context-window`,children:g.contextWindow?`${H_(g.contextWindow)} tokens`:`unknown`})}),(0,U.jsx)(J7,{label:`Compactions`,icon:X7.compactions,children:(0,U.jsx)(`span`,{"data-testid":`compaction-count`,children:_})})]}),(0,U.jsxs)(`div`,{className:`mb-2`,children:[(0,U.jsx)(Y7,{label:`Usage`,icon:X7.usage}),(0,U.jsx)(J7,{label:`Tokens in`,icon:X7.tokensIn,children:H_(g.inputTokens)}),(0,U.jsx)(J7,{label:`Tokens out`,icon:X7.tokensOut,children:H_(g.outputTokens)}),g.credits===null?null:(0,U.jsx)(J7,{label:`Credits used`,icon:X7.usage,children:g.credits.toLocaleString(`en-US`,{maximumFractionDigits:2})}),(0,U.jsx)(J7,{label:`Duration`,icon:X7.duration,children:g.countedResults>0&&V_(g.durationMs)||`—`}),(0,U.jsx)(J7,{label:`Turns`,icon:X7.turns,children:g.countedResults>0?g.turns:`—`})]}),(0,U.jsxs)(`div`,{className:`mb-2`,children:[(0,U.jsx)(Y7,{label:`Session`,icon:X7.session}),(0,U.jsx)(J7,{label:`Status`,icon:X7.status,children:(0,U.jsx)(WS,{tone:c?.status===`error`?`danger`:c?.status===`running`?`accent`:c?.status===`waiting_permission`?`warn`:`neutral`,children:c?.status??r.status})}),(0,U.jsx)(J7,{label:`Updated`,icon:X7.updated,children:U_(r.updatedAt)}),(0,U.jsx)(J7,{label:`Entries`,icon:X7.entries,children:r.entryCount}),(0,U.jsx)(J7,{label:`Project`,icon:X7.project,children:(0,U.jsx)(`span`,{"data-testid":`session-project`,children:u?u.name:`—`})}),d?(0,U.jsx)(`div`,{className:`whitespace-pre-wrap break-words pb-1 text-[11px] leading-snug text-fg-faint`,"data-testid":`session-project-instructions`,children:d.length>300?`${d.slice(0,300)}\u2026`:d}):null,o?null:(0,U.jsx)(`button`,{type:`button`,className:`text-[11px] text-accent hover:underline`,onClick:()=>t.openAssignProject(r.id),"data-testid":`session-change-project`,children:u?`Move to another project…`:`Move to a project…`}),(0,U.jsx)(J7,{label:`Folder`,icon:X7.folder,children:r.projectDir?`project`:`own workspace`}),(0,U.jsx)(`div`,{className:`mt-1 break-all font-mono text-[10px] text-fg-faint`,"data-testid":`session-folder`,children:r.cwd}),o?null:(0,U.jsx)(`button`,{type:`button`,className:`mt-1 text-[11px] text-accent hover:underline`,onClick:()=>t.openDialog(`project`),"data-testid":`session-change-folder`,children:`Change folder…`})]}),x.length>0?(0,U.jsxs)(`div`,{className:`mb-2 space-y-1.5`,"data-testid":`session-browser-profiles`,children:[(0,U.jsx)(Y7,{label:`Oonak Browser`,icon:X7.route}),(0,U.jsxs)(`div`,{className:`text-[11px] leading-snug text-fg-faint`,children:[`Browser user-data-dir `,x.length===1?`profile`:`profiles`,` used in this session:`]}),(0,U.jsx)(`div`,{className:`flex flex-col gap-1`,children:x.map(e=>(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-md border border-border bg-surface-2 px-2 py-1.5`,"data-testid":`session-browser-profile`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 break-all font-mono text-[11px] text-fg`,title:`user-data-dir: ${e}`,children:e}),!o&&!s?(0,U.jsx)(`button`,{type:`button`,disabled:i!==null,onClick:()=>void S(e),className:`shrink-0 rounded bg-accent px-2 py-0.5 text-[11px] font-medium text-accent-fg hover:opacity-90 disabled:opacity-50`,"data-testid":`session-browser-open`,children:i===e?`Opening…`:`Restore browser`}):null]},e))})]}):null,y?(0,U.jsx)(jxe,{sessionId:r.id,running:b},r.id):null,o?null:(0,U.jsxs)(`div`,{className:`space-y-1.5`,"data-testid":`session-scheduled-tasks`,children:[(0,U.jsx)(Y7,{label:`Scheduled tasks`,icon:X7.tasks}),(0,U.jsx)(dP,{sessionId:r.id})]}),c?.init?(0,U.jsxs)(`div`,{className:`text-[11px] text-fg-faint`,children:[`engine `,c.init.claudeCodeVersion,` · `,c.init.tools.length,` tools`]}):null]}):(0,U.jsx)(`div`,{className:`p-4 text-xs text-fg-faint`,children:`Open a chat to see its statistics.`})})}var Z7=[{id:`media`,title:`Media`,hideLabel:`Hide media`,icon:G.Gallery,available:({sessionId:e})=>e!==null,render:({sessionId:e,reportCount:t})=>e?(0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-testid":`media-panel`,"aria-label":`Media in this chat`,children:(0,U.jsx)(vxe,{sessionId:e,onTotal:t},e)}):null},{id:`sessionInfo`,title:`Session info`,hideLabel:`Hide session info`,icon:G.Info,render:({sessionId:e})=>(0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-testid":`session-panel`,"aria-label":`Session info`,children:(0,U.jsx)(Nxe,{},e??`none`)})}];function Q7(e){return Z7.find(t=>t.id===e)}var $7={rightPanelWidth:320};function Pxe(e,t){let{state:n,actions:r}=W(),i=n.prefs[e],[a,o]=(0,v.useState)(null),s=a??i,c=(0,U.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the ${t}`,title:`Drag to resize · double-click for the default width`,className:`absolute inset-y-0 -left-1 z-10 hidden w-2 cursor-col-resize hover:bg-accent/30 lg:block`,onPointerDown:t=>{t.preventDefault();let n=t.clientX,a=s,c=a,l=t=>{c=zl(a+(n-t.clientX),$7[e]),o(c)},u=()=>{window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),document.body.style.cursor=``,document.body.style.userSelect=``,o(null),c!==i&&r.savePrefs({[e]:c})};document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u)},onDoubleClick:()=>void r.savePrefs({[e]:$7[e]}),"data-testid":`right-panel-resize`});return{style:{width:`min(${s}px, 85vw)`},handle:c}}function Fxe(){let{state:e,actions:t}=W(),{rightPanelSections:n,rightPanelCollapsed:r}=e.prefs,i=e.currentSessionId,a=Pxe(`rightPanelWidth`,`right panel`),[o,s]=(0,v.useState)({}),c=(0,v.useMemo)(()=>{let e={};for(let t of Z7)e[t.id]=e=>s(n=>n[t.id]===e?n:{...n,[t.id]:e});return e},[]),l=(0,v.useCallback)(e=>Q7(e)?.available?.({sessionId:i})??!0,[i]),u=Hb(n,l),d=Ub(u,r),f=(e,n)=>void t.savePrefs(Wb(e,n)),p=Z7.map(e=>{let t=n.includes(e.id);return{id:e.id,label:t?e.hideLabel:`Show ${e.title.toLowerCase()}`,icon:e.icon,active:t,count:o[e.id]??null}});return(0,U.jsxs)(U.Fragment,{children:[u.length>0?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`absolute inset-0 z-20 bg-black/30 lg:hidden`,onClick:()=>f([],[]),"aria-hidden":!0}),(0,U.jsx)(`div`,{className:`absolute inset-y-0 right-0 z-30 flex max-w-[85vw] lg:static lg:z-auto lg:max-w-none`,children:(0,U.jsxs)(`aside`,{className:`relative flex shrink-0 flex-col border-l border-border bg-surface`,style:a.style,"aria-label":`Side panels`,"data-testid":`right-dock`,"data-font-scope":`sidebar`,children:[a.handle,u.map(e=>{let t=Q7(e);return t?(0,U.jsx)(cxe,{id:e,title:t.title,icon:t.icon,count:o[e]??null,collapsed:r.includes(e),onToggle:()=>f(n,Vb(r,e)),onRemove:()=>f(Bb(n,e),r),removeLabel:t.hideLabel,grow:d[e]??1,children:t.render({sessionId:i,reportCount:c[e]})},e):null})]})})]}):null,(0,U.jsx)(`div`,{className:`hidden border-l border-border lg:flex`,children:(0,U.jsx)(L7,{items:p,multi:!0,testId:`activity-bar-right`,label:`Side panels`,onPick:e=>{l(e)&&f(Bb(n,e),r)}})})]})}function Ixe(e){let t=e=>e.type===`dir`?0:1;return[...e].sort((e,n)=>t(e)-t(n)||e.name.localeCompare(n.name))}function Lxe(e){let t=[];return e.target.type===`file`&&t.push({key:`open`,label:`Open`,icon:(0,U.jsx)(G.File,{className:`w-3.5 h-3.5`}),onSelect:e.onOpen,testId:`files-menu-open`}),t.push({key:`copy-path`,label:`Copy path`,icon:(0,U.jsx)(G.Copy,{className:`w-3.5 h-3.5`}),disabled:!e.canCopyPath,onSelect:e.onCopyPath,testId:`files-menu-copy-path`},{key:`copy-relative-path`,label:`Copy relative path`,icon:(0,U.jsx)(G.Copy,{className:`w-3.5 h-3.5`}),onSelect:e.onCopyRelativePath,testId:`files-menu-copy-relative-path`}),!e.remote&&e.canReveal&&t.push({key:`show-in-explorer`,label:`Show in Explorer`,icon:(0,U.jsx)(G.Folder,{className:`w-3.5 h-3.5`}),onSelect:e.onReveal,testId:`files-menu-show-in-explorer`}),!e.remote&&e.canRename&&t.push({key:`rename`,label:`Rename…`,icon:(0,U.jsx)(G.Edit,{className:`w-3.5 h-3.5`}),onSelect:e.onRename,testId:`files-menu-rename`}),!e.remote&&e.canDelete&&t.push({key:`delete`,label:`Delete…`,icon:(0,U.jsx)(G.Trash,{className:`w-3.5 h-3.5`}),danger:!0,separated:!0,onSelect:e.onDelete,testId:`files-menu-delete`}),t}function Rxe(e,t){return t instanceof Qh&&t.status===404&&/^no route for /.test(t.message)?`This host is too old to delete files — update it from the title bar.`:`Could not delete ${tj(e.path)}: ${t instanceof Error?t.message:String(t)}`}function e9(){let{state:e,dispatch:t,actions:n,api:r}=W(),i=ES(),a=TS(),o=i?.id??null,s=(o?e.remote.tabs[o]:void 0)?.hostId??(o?e.remote.sessionOwners[o]:void 0)??null,c=s!==null,l=c&&typeof r.listHostSessionFiles==`function`,u=a?.status===`running`||a?.status===`waiting_permission`,d=o?e.files[o]?.active??null:null,f=c?e.remote.hosts.find(e=>e.hostId===s)?.platform??null:e.info?.platform??null,p=i?.cwd??``,m=e=>{n.openFile(e),Jb(n.setSidebar)},[h,g]=(0,v.useState)({}),[_,y]=(0,v.useState)(()=>new Set),[b,x]=(0,v.useState)(!1),S=(0,v.useRef)(h);S.current=h;let C=(0,v.useRef)(_);C.current=_;let w=(0,v.useRef)(o);w.current=o;let T=(0,v.useRef)(e.files);T.current=e.files;let[E,D]=(0,v.useState)(null),O=(0,v.useCallback)(()=>D(null),[]),k=(0,v.useCallback)((e,t,n)=>D({target:e,at:t,el:n}),[]),[A,j]=(0,v.useState)(null),[M,N]=(0,v.useState)(!1),ee=(0,v.useCallback)(()=>j(null),[]),[te,P]=(0,v.useState)(null),[F,ne]=(0,v.useState)(!1),I=(0,v.useCallback)(()=>P(null),[]),[re,ie]=(0,v.useState)(``),ae=Xb(re)!==``,L=(0,v.useMemo)(()=>ae?Qb(h,re):null,[ae,h,re]),oe=(0,v.useCallback)(async e=>{if(!o||(c?!r.listHostSessionFiles||!s:!r.listSessionFiles))return;let t=o;g(t=>({...t,[e]:{...t[e]??{entries:null},loading:!0,error:null}}));try{let n=c&&s&&r.listHostSessionFiles?await r.listHostSessionFiles(s,t,e):await r.listSessionFiles(t,e);if(w.current!==t)return;x(!1),g(t=>({...t,[e]:{entries:Ixe(n.entries),loading:!1,error:null}}))}catch(n){if(w.current!==t)return;ng(n)&&x(!0);let r=n instanceof Error?n.message:String(n);g(t=>({...t,[e]:{entries:t[e]?.entries??null,loading:!1,error:r}}))}},[r,o,c,s]);(0,v.useEffect)(()=>{g({}),y(new Set),x(!1),D(null),j(null),o&&(!c||l)&&oe(``)},[o,c,l,oe]);let se=(0,v.useRef)(u);(0,v.useEffect)(()=>{if(se.current&&!u&&o&&(!c||l))for(let e of Object.keys(S.current))(e===``||C.current.has(e))&&oe(e);se.current=u},[u,o,c,l,oe]);let ce=e=>{y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):(n.add(e),S.current[e]?.entries||oe(e)),n})},le=()=>{if(o){oe(``);for(let e of _)oe(e)}},ue=(e,t)=>{dN(e).then(e=>n.toast(e?`success`:`error`,e?t:`Could not copy to the clipboard`))},de=e=>{let t=window.oonacode;if(!p||!t?.showItemInFolder){n.toast(`error`,`Show in Explorer is available in the desktop app on this PC.`);return}t.showItemInFolder(sj(p,e.path,f)).then(e=>{e.ok||n.toast(`error`,e.message||`Could not show it in Explorer.`)})},fe=(e,t,n)=>n===e?t:n.startsWith(`${e}/`)?`${t}${n.slice(e.length)}`:null,R=async e=>{let i=te,a=o;if(!(!i||!a||!r.renameSessionFile||c)){ne(!0);try{let o=await r.renameSessionFile(a,i.path,e);Fve(a,i.path,o.path);for(let e of T.current[a]?.open??[]){let n=fe(i.path,o.path,e);n&&(t({type:`file_close`,sessionId:a,path:e}),(i.type===`file`||e!==i.path)&&t({type:`file_open`,sessionId:a,path:n}))}w.current===a&&(y(e=>{let t=new Set;for(let n of e)t.add(fe(i.path,o.path,n)??n);return t}),g(e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[fe(i.path,o.path,e)??e,t]))),oe(rj(o.path))),n.toast(`success`,`Renamed to ${tj(o.path)}`),P(null)}catch(e){n.toast(`error`,`Could not rename ${tj(i.path)}: ${e instanceof Error?e.message:String(e)}`)}finally{ne(!1)}}},pe=async()=>{let e=A,i=o;if(!(!e||!i)&&!(c?!r.deleteHostSessionFile||!s:!r.deleteSessionFile)){N(!0);try{c&&s&&r.deleteHostSessionFile?await r.deleteHostSessionFile(s,i,e.path):await r.deleteSessionFile(i,e.path);for(let n of T.current[i]?.open??[])ij(n,e.path)&&t({type:`file_close`,sessionId:i,path:n});w.current===i&&(y(t=>new Set([...t].filter(t=>!ij(t,e.path)))),g(t=>Object.fromEntries(Object.entries(t).filter(([t])=>!ij(t,e.path)))),oe(rj(e.path))),n.toast(`success`,`Deleted ${tj(e.path)}`)}catch(t){n.toast(`error`,Rxe(e,t)),w.current===i&&oe(rj(e.path))}finally{N(!1),j(null)}}},me=E?Lxe({target:E.target,remote:c,canDelete:typeof r.deleteSessionFile==`function`,canCopyPath:p!==``,canReveal:!c&&p!==``&&typeof window.oonacode?.showItemInFolder==`function`,canRename:!c&&typeof r.renameSessionFile==`function`,onOpen:()=>m(E.target.path),onCopyPath:()=>ue(sj(p,E.target.path,f),`Path copied`),onCopyRelativePath:()=>ue(oj(E.target.path,aj(p,f)),`Relative path copied`),onReveal:()=>de(E.target),onRename:()=>P(E.target),onDelete:()=>j(E.target)}):[],he=i?.cwd?tj(i.cwd)||i.cwd:`Files`,ge=h[``],_e=E?.target.path??null,ve=(0,v.useMemo)(()=>o?c&&!l?(0,U.jsx)(t9,{children:`This chat runs on another PC; its files can be browsed there.`}):b?(0,U.jsx)(t9,{children:`This host is too old to list files — update it from the title bar.`}):ge?.error&&!ge.entries?(0,U.jsx)(t9,{tone:`danger`,children:ge.error}):ge?.entries?ge.entries.length===0?(0,U.jsx)(t9,{children:`The folder is empty.`}):L&&L.visible.size===0?(0,U.jsx)(t9,{children:`Nothing listed matches. The filter looks at the folders already opened — Search (Ctrl+K) looks through the whole folder, file contents too.`}):(0,U.jsx)(`ul`,{role:`tree`,"aria-label":`Workspace files`,className:`py-1`,children:(0,U.jsx)(i9,{rel:``,depth:0,tree:h,expanded:_,activeFile:d,menuPath:_e,narrowed:L,onToggle:ce,onOpen:m,onMenu:k})}):(0,U.jsx)(t9,{children:`Listing…`}):(0,U.jsx)(t9,{children:`Open a chat to browse the folder it works in.`}),[o,c,b,ge,h,_,d,_e,L,n]);return(0,U.jsxs)(`section`,{className:`flex h-full min-h-0 w-full flex-col bg-surface`,"aria-label":`Files`,"data-testid":`file-explorer`,"data-font-scope":`sidebar`,children:[(0,U.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-border px-3`,children:[(0,U.jsx)(G.Folder,{className:`w-3.5 h-3.5 text-fg-faint`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-semibold uppercase tracking-wide text-fg-muted`,title:i?.cwd??void 0,children:he}),(0,U.jsx)(zS,{label:`Refresh files`,className:`p-1`,onClick:le,disabled:!o||c&&!l,"data-testid":`file-explorer-refresh`,children:(0,U.jsx)(G.Refresh,{className:`w-3.5 h-3.5`})})]}),(0,U.jsxs)(`div`,{className:`relative shrink-0 border-b border-border p-2`,children:[(0,U.jsx)(G.Filter,{className:`pointer-events-none absolute left-4 top-4 w-3.5 h-3.5 text-fg-faint`}),(0,U.jsx)(`input`,{"aria-label":`Filter files by name`,className:H(q,`pl-7`,re!==``&&`pr-7`),placeholder:`Filter files`,value:re,onChange:e=>ie(e.target.value),onKeyDown:e=>{e.key===`Escape`&&re!==``&&(e.preventDefault(),e.stopPropagation(),ie(``))},"data-testid":`files-filter`}),re===``?null:(0,U.jsx)(zS,{label:`Clear the filter`,className:`absolute right-2.5 top-2.5 p-1`,onClick:()=>ie(``),"data-testid":`files-filter-clear`,children:(0,U.jsx)(G.X,{className:`w-3.5 h-3.5`})})]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:ve}),(0,U.jsx)(HC,{open:E!==null,at:E?.at??{x:0,y:0},anchorEl:E?.el??null,label:`File actions`,testId:`files-context-menu`,onClose:O,items:me}),(0,U.jsx)(zxe,{target:te,busy:F,onConfirm:e=>void R(e),onClose:I}),(0,U.jsx)(Bxe,{target:A,absolute:A?p?sj(p,A.path,f):A.path:``,platform:f,busy:M,onConfirm:()=>void pe(),onClose:ee})]})}function zxe({target:e,busy:t,onConfirm:n,onClose:r}){let[i,a]=(0,v.useState)(``);(0,v.useEffect)(()=>{a(e?tj(e.path):``)},[e]);let o=e?.type===`dir`;return(0,U.jsx)(GS,{open:e!==null,title:o?`Rename this folder`:`Rename this file`,onClose:r,footer:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{onClick:r,disabled:t,"data-testid":`files-rename-cancel`,children:`Cancel`}),(0,U.jsx)(K,{variant:`primary`,busy:t,disabled:!i.trim()||i.trim()===(e?tj(e.path):``),onClick:()=>n(i.trim()),"data-testid":`files-rename-confirm`,children:`Rename`})]}),children:(0,U.jsxs)(`label`,{className:`block text-sm`,children:[(0,U.jsx)(`span`,{className:`mb-1 block text-fg-muted`,children:`New name`}),(0,U.jsx)(`input`,{value:i,autoFocus:!0,disabled:t,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i.trim()&&n(i.trim())},className:`w-full rounded-md border border-border bg-surface px-2 py-1.5`,"data-testid":`files-rename-input`})]})})}function Bxe({target:e,absolute:t,platform:n,busy:r,onConfirm:i,onClose:a}){let o=e?.type===`dir`;return(0,U.jsx)(GS,{open:e!==null,title:o?`Delete this folder?`:`Delete this file?`,onClose:a,footer:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(K,{onClick:a,disabled:r,"data-testid":`files-delete-cancel`,children:`Cancel`}),(0,U.jsx)(K,{variant:`danger`,busy:r,onClick:i,"data-testid":`files-delete-confirm`,children:`Delete permanently`})]}),children:(0,U.jsxs)(`div`,{className:`space-y-2 text-sm text-fg-muted`,"data-testid":`files-delete-dialog`,children:[(0,U.jsx)(`p`,{className:`break-all rounded bg-surface-2 px-2 py-1 font-mono text-xs text-fg`,children:t}),(0,U.jsxs)(`p`,{children:[o?`This folder and everything inside it will be deleted from the disk permanently.`:`This file will be deleted from the disk permanently.`,` `,`It does not go to the `,n===`win32`?`Recycle Bin`:`Trash`,`, and it cannot be undone.`]})]})})}function t9({children:e,tone:t}){return(0,U.jsx)(`div`,{className:H(`p-4 text-xs`,t===`danger`?`text-danger`:`text-fg-faint`),children:e})}function n9(e){let t=e.getBoundingClientRect();return{x:t.left+24,y:t.bottom}}function r9(e,t){return{onContextMenu:n=>{n.preventDefault();let r=n.currentTarget;t(e,n.clientX===0&&n.clientY===0?n9(r):{x:n.clientX,y:n.clientY},r)},onKeyDown:n=>{(n.key===`ContextMenu`||n.shiftKey&&n.key===`F10`)&&(n.preventDefault(),t(e,n9(n.currentTarget),n.currentTarget))}}}function i9({rel:e,depth:t,tree:n,expanded:r,activeFile:i,menuPath:a,narrowed:o,onToggle:s,onOpen:c,onMenu:l}){let u=n[e];return u?u.error&&!u.entries?(0,U.jsx)(`li`,{className:`px-2 py-1 text-[11px] text-danger`,style:{paddingLeft:`${.5+t*.75}rem`},children:u.error}):u.entries?(0,U.jsx)(U.Fragment,{children:u.entries.map(u=>{let d=nj(e,u.name);if(o&&!o.visible.has(d))return null;let f=a===d;if(u.type===`dir`){let e=r.has(d)||!!o?.open.has(d);return(0,U.jsxs)(`li`,{role:`treeitem`,"aria-expanded":e,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>s(d),...r9({path:d,type:`dir`},l),"data-testid":`explorer-dir-${d}`,className:H(`flex w-full items-center gap-1 py-0.5 pr-2 text-left text-xs text-fg hover:bg-surface-2`,f&&`bg-surface-2`),style:{paddingLeft:`${.5+t*.75}rem`},children:[(0,U.jsx)(G.ChevronRight,{className:H(`w-3 h-3 shrink-0 text-fg-faint transition-transform`,e&&`rotate-90`)}),(0,U.jsx)(G.Folder,{className:`w-3.5 h-3.5 shrink-0 text-fg-faint`}),(0,U.jsx)(`span`,{className:`truncate`,children:u.name})]}),e?(0,U.jsx)(`ul`,{role:`group`,children:(0,U.jsx)(i9,{rel:d,depth:t+1,tree:n,expanded:r,activeFile:i,menuPath:a,narrowed:o,onToggle:s,onOpen:c,onMenu:l})}):null]},d)}let p=i===d;return(0,U.jsx)(`li`,{role:`treeitem`,"aria-selected":p,children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>c(d),...r9({path:d,type:u.type},l),disabled:u.type!==`file`,"data-testid":`explorer-file-${d}`,title:`${d} · ${Ej(u.size)}`,className:H(`flex w-full items-center gap-1 py-0.5 pr-2 text-left text-xs hover:bg-surface-2 disabled:opacity-50`,p?`bg-accent-soft text-accent`:f?`bg-surface-2 text-fg`:`text-fg`),style:{paddingLeft:`${.5+t*.75+.9}rem`},children:[(0,U.jsx)(G.File,{className:`w-3.5 h-3.5 shrink-0 text-fg-faint`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:u.name}),(0,U.jsx)(`span`,{className:`shrink-0 text-[10px] text-fg-faint`,children:Ej(u.size)})]})},d)})}):(0,U.jsx)(`li`,{className:`px-2 py-1 text-[11px] text-fg-faint`,style:{paddingLeft:`${.5+t*.75}rem`},children:`Listing…`}):null}function a9({text:e,query:t,options:n}){return(0,U.jsx)(U.Fragment,{children:S7(e,t,n).map((e,t)=>e.hit?(0,U.jsx)(`mark`,{className:`rounded bg-warn-soft px-0.5 text-fg`,children:e.text},t):(0,U.jsx)(`span`,{children:e.text},t))})}function Vxe({active:e,focusAsk:t=0}){let{state:n}=W(),[r,i]=(0,v.useState)(`chats`),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(x7),[l,u]=(0,v.useState)(!1),d=(0,v.useRef)(null),f=(0,v.useRef)(0),p=(0,v.useRef)(!1);(0,v.useEffect)(()=>{t!==f.current&&(f.current=t,p.current=!0),e&&p.current&&(p.current=!1,d.current?.focus())},[e,t]);let m=r===`chats`,h=m&&s.mode===`conversations`,g=()=>{o(``),u(!1),d.current?.focus()},_=e=>c(t=>({...t,[e]:!t[e]}));return(0,U.jsxs)(`section`,{className:`flex h-full min-h-0 w-full flex-col bg-surface`,"aria-label":`Search`,"data-testid":`search-section`,children:[(0,U.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-b border-border px-3`,children:[(0,U.jsx)(G.Search,{className:`w-3.5 h-3.5 text-fg-faint`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:`Search`})]}),(0,U.jsxs)(`div`,{className:`shrink-0 space-y-2 border-b border-border p-2`,children:[(0,U.jsx)(`div`,{className:`flex rounded-md border border-border bg-surface-2 p-0.5`,role:`radiogroup`,"aria-label":`Search in`,children:[[`chats`,`Chats`],[`files`,`Files & contents`]].map(([e,t])=>(0,U.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":r===e,onClick:()=>{i(e),u(!1),d.current?.focus()},className:H(`flex-1 rounded px-2 py-1 text-xs font-medium transition-colors`,r===e?`bg-surface text-fg shadow-sm`:`text-fg-muted hover:text-fg`),"data-testid":`search-scope-${e}`,children:t},e))}),(0,U.jsxs)(`div`,{className:`relative flex items-center gap-1`,"data-testid":`sidebar-search`,children:[(0,U.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,U.jsx)(G.Search,{className:`pointer-events-none absolute left-2 top-2 w-3.5 h-3.5 text-fg-faint`}),(0,U.jsx)(`input`,{ref:d,"aria-label":m?`Search sessions`:`Search files`,className:H(q,`pl-7`),placeholder:m?h?`Search every chat`:`Search chats`:`File names and contents`,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(a!==``||l)&&(e.preventDefault(),e.stopPropagation(),l?u(!1):o(``))},"data-testid":`search-input`})]}),m?(0,U.jsxs)(zS,{label:l?`Hide search options`:`Search options`,className:H(`relative`,l&&`text-accent`),"aria-pressed":l,onMouseDown:e=>e.preventDefault(),onClick:()=>u(e=>!e),"data-testid":`search-options-toggle`,children:[(0,U.jsx)(G.Sliders,{}),C7(s)?(0,U.jsx)(`span`,{className:`absolute right-0.5 top-0.5 h-1.5 w-1.5 rounded-full bg-accent`,"data-testid":`search-options-dot`}):null]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(zS,{label:`Match case`,className:H(`px-1 text-[11px] font-semibold`,s.caseSensitive&&`text-accent`),"aria-pressed":s.caseSensitive,onClick:()=>_(`caseSensitive`),"data-testid":`file-search-case`,children:`Aa`}),(0,U.jsx)(zS,{label:`Whole words`,className:H(`px-1 text-[11px] font-semibold underline`,s.wholeWord&&`text-accent`),"aria-pressed":s.wholeWord,onClick:()=>_(`wholeWord`),"data-testid":`file-search-word`,children:`ab`})]}),a!==``||l?(0,U.jsx)(zS,{label:`Clear search`,onMouseDown:e=>e.preventDefault(),onClick:g,"data-testid":`close-search`,children:(0,U.jsx)(G.X,{})}):null,m&&l?(0,U.jsx)(D7,{options:s,onChange:c,projects:n.vaultProjects,onClose:()=>{u(!1),d.current?.focus()}}):null]})]}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-1 pb-2`,children:m?h?a.trim()===``?(0,U.jsx)(o9,{testId:`search-idle`,children:`Type to search every message of every chat on this PC.`}):(0,U.jsx)(Lbe,{query:a,options:s}):(0,U.jsx)(Hxe,{query:a,options:s}):(0,U.jsx)(Uxe,{query:a,options:s})})]})}function o9({children:e,testId:t,tone:n}){return(0,U.jsx)(`div`,{className:H(`px-3 py-4 text-center text-xs`,n===`danger`?`text-danger`:`text-fg-faint`),"data-testid":t,children:e})}function Hxe({query:e,options:t}){let{state:n,actions:r}=W(),i=bI(),a=TI(),o=e.trim(),[s,c]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(!o)return;let e=!0,t=setTimeout(()=>{r.searchSessionNames(o).then(t=>{e&&c({term:o,sessions:t})})},200);return()=>{e=!1,clearTimeout(t)}},[o,r]);let l=s&&s.term===o?s:null,u=(0,v.useMemo)(()=>{if(!l?.sessions)return[];let e=Date.now();return l.sessions.filter(n=>Nbe(n,o,t,e))},[l,o,t]),d=(0,v.useMemo)(()=>new Map(n.vaultProjects.map(e=>[e.id,e.name])),[n.vaultProjects]);return o?l?l.sessions===null?(0,U.jsx)(o9,{testId:`search-failed`,tone:`danger`,children:`This PC could not search its chats. Try again.`}):(0,U.jsxs)(`div`,{"data-testid":`search-results`,children:[(0,U.jsx)(`div`,{className:`px-3 py-1.5 text-[11px] text-fg-faint`,children:u.length===0?`No chat matches.`:`${u.length} ${u.length===1?`chat`:`chats`}`}),u.map(e=>(0,U.jsx)(vI,{session:e,active:e.id===n.currentSessionId&&n.page===null,link:n.sessionLinks[e.id]??null,menuOpen:i.menuFor===e.id,projectName:e.projectId?d.get(e.projectId)??null:null,testIdPrefix:`search-session`,onOpen:e=>{r.selectSession(e),Jb(r.setSidebar)},onMenu:i.openMenu,clock:a},e.id)),i.element]}):(0,U.jsx)(o9,{testId:`search-busy`,children:`Searching…`}):(0,U.jsx)(o9,{testId:`search-idle`,children:`Type to find a chat by its name, its first or last message, or its folder. The sliders search inside every message.`})}function Uxe({query:e,options:t}){let{state:n,actions:r,api:i}=W(),a=ES(),o=a?.id??null,s=o!==null&&!!(n.remote.tabs[o]??n.remote.sessionOwners[o]),c=e.trim(),l=t.caseSensitive,u=t.wholeWord,d=`${o??``}\n${c}\n${+!!l}${+!!u}`,f=o!==null&&!s&&typeof i.searchSessionFiles==`function`,p=f&&c.length>=2,[m,h]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(!p||!o||!i.searchSessionFiles)return;let e=!0,t=i.searchSessionFiles,n=setTimeout(()=>{t(o,{q:c,caseSensitive:l,wholeWord:u}).then(t=>{e&&h({key:d,res:t,error:null})},t=>{if(!e)return;let n=ng(t)?`This host is too old to search files — update it from the title bar.`:`Could not search the files: ${t instanceof Error?t.message:String(t)}`;h({key:d,res:null,error:n})})},300);return()=>{e=!1,clearTimeout(n)}},[d,p,i]);let g=a?.cwd?tj(a.cwd)||a.cwd:null;if(!o)return(0,U.jsx)(o9,{testId:`file-search-idle`,children:`Open a chat to search the folder it works in.`});if(s)return(0,U.jsx)(o9,{testId:`file-search-idle`,children:`This chat runs on another PC; its files can be searched there.`});if(!f)return(0,U.jsx)(o9,{testId:`file-search-idle`,children:`This window cannot search files.`});if(c.length<2)return(0,U.jsxs)(o9,{testId:`file-search-idle`,children:[`Searches the file names and the text in the folder of the open chat`,g?(0,U.jsxs)(U.Fragment,{children:[` — `,(0,U.jsx)(`span`,{className:`font-medium text-fg-muted`,title:a?.cwd,children:g})]}):null,`. Type at least two characters.`]});let _=m&&m.key===d?m:null;if(!_)return(0,U.jsx)(o9,{testId:`file-search-busy`,children:`Searching the files…`});if(!_.res)return(0,U.jsx)(o9,{testId:`file-search-failed`,tone:`danger`,children:_.error});let{results:y,truncated:b}=_.res,x=y.reduce((e,t)=>e+t.hits.length,0),S=e=>{r.openFile(e),Jb(r.setSidebar)};return(0,U.jsxs)(`div`,{"data-testid":`file-search-results`,children:[(0,U.jsxs)(`div`,{className:`px-3 py-1.5 text-[11px] text-fg-faint`,"data-testid":`file-search-summary`,children:[y.length===0?`Nothing in ${g??`this folder`} matches.`:`${y.length}${b?`+`:``} ${y.length===1?`file`:`files`}${x>0?`, ${x} ${x===1?`line`:`lines`}`:``} in ${g??`this folder`}`,b?` — the search stopped early; narrow the phrase to see the rest.`:``]}),y.map(e=>{let n=tj(e.path)||e.path,r=e.path.length>n.length?e.path.slice(0,e.path.length-n.length-1):``;return(0,U.jsxs)(`div`,{className:`mb-1`,"data-testid":`file-search-result-${e.path}`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-1.5 rounded px-2 py-1 text-left text-xs hover:bg-surface-2`,title:e.path,onClick:()=>S(e.path),"data-testid":`file-search-file`,children:[(0,U.jsx)(G.File,{className:`w-3.5 h-3.5 shrink-0 text-fg-faint`}),(0,U.jsx)(`span`,{className:`shrink-0 font-medium text-fg`,children:e.nameMatch?(0,U.jsx)(a9,{text:n,query:c,options:t}):n}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] text-fg-faint`,children:r}),e.hits.length>0?(0,U.jsxs)(`span`,{className:`shrink-0 rounded-full bg-surface-3 px-1.5 text-[10px] font-semibold text-fg-muted`,children:[e.hits.length,e.moreHits?`+`:``]}):null]}),e.hits.map(n=>(0,U.jsxs)(`button`,{type:`button`,className:`flex w-full gap-2 rounded px-2 py-0.5 pl-7 text-left font-mono text-[11px] hover:bg-surface-2`,onClick:()=>S(e.path),"data-testid":`file-search-hit`,children:[(0,U.jsx)(`span`,{className:`shrink-0 text-fg-faint`,children:n.line}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-fg-muted`,children:(0,U.jsx)(a9,{text:n.text,query:c,options:t})})]},n.line))]},e.path)})]})}function s9(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function Wxe(e,t,n){let r=s9(n),i=e.filter(e=>!t.has(e.id)).sort((e,t)=>t.mtime-e.mtime),a=[],o=[];for(let e of i)(e.mtime>=r?a:o).push(e);return{today:a,older:o}}function c9(e,t){let n=t.trim().toLowerCase();return n===``||e.toLowerCase().includes(n)}var Gxe=3e4,l9=`flex w-full items-center gap-1 rounded px-2 py-1 text-left text-[11px] font-semibold uppercase tracking-wide text-fg-faint hover:bg-surface-2`,u9=`flex items-center gap-1 px-2 pb-0.5 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-faint`,Kxe=`flex w-full items-center gap-1.5 rounded border-l-2 border-project/70 bg-surface-2/40 px-2 py-1.5 text-left text-[13px] font-semibold tracking-normal text-fg hover:bg-surface-2`,d9=`flex min-w-0 items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-fg hover:bg-surface-2`;function qxe({onOpenSearch:e}={}){let{state:t,actions:n}=W(),r=t.ui.sidebarPinnedOverride??t.prefs.sidebarPinned,[i,a]=(0,v.useState)({}),[o,s]=(0,v.useState)(!1),c=bI(),[l,u]=(0,v.useState)(null),d=(0,v.useCallback)(()=>u(null),[]),f=$xe(),p=TI(),m=s9(p),h=t.prefs.sidebarView,g=t.prefs.pinned,_=e=>a(t=>({...t,[e]:t[e]!==!0})),y=e=>i[e]===!0,b=t.prefs.collapsedProjects,x=e=>b.includes(e),S=e=>{let t=x(e)?b.filter(t=>t!==e):[...b,e];n.savePrefs({collapsedProjects:t})},C=(0,v.useCallback)(e=>{let r=t.remote.tabs[e]?.hostId??t.remote.sessionOwners[e]??null;r?n.openRemoteSession(r,e):n.selectSession(e),window.innerWidth<768&&n.setSidebar(!1)},[n,t.remote.tabs,t.remote.sessionOwners]),w=(0,v.useCallback)(e=>{n.openPage({kind:`project`,projectId:e}),window.innerWidth<768&&n.setSidebar(!1)},[n]),[T,E]=(0,v.useState)(``),D=Xb(T)!==``,O=(0,v.useMemo)(()=>new Map(t.vaultProjects.map(e=>[e.id,e.name])),[t.vaultProjects]),k=(0,v.useCallback)(e=>Zb(e,T,e.projectId?O.get(e.projectId):null),[T,O]),A=(0,v.useMemo)(()=>{let e=t.sessions.filter(e=>!t.remote.tabs[e.id]);return D?e.filter(k):e},[t.sessions,t.remote.tabs,D,k]),j=(0,v.useMemo)(()=>{let e=new Map(A.map(e=>[e.id,e]));for(let n of Object.values(t.remote.sessions))for(let t of n??[])e.has(t.id)||e.set(t.id,t);let n=[];for(let r of g)if(r.kind===`chat`){let i=e.get(r.id)??t.pinnedRows[r.id];i&&(!D||k(i))&&n.push({kind:`chat`,session:i})}else{let e=t.vaultProjects.find(e=>e.id===r.id);if(!e||!c9(e.name,T))continue;let i=t.sessions.filter(t=>t.projectId===e.id);n.push({kind:`project`,project:e,sessions:i})}return n},[g,A,D,T,k,t.pinnedRows,t.remote.sessions,t.vaultProjects,t.sessions]),M=(0,v.useMemo)(()=>new Set(g.filter(e=>e.kind===`chat`).map(e=>e.id)),[g]),N=(0,v.useMemo)(()=>h===`recent`?Wxe(A,M,m):null,[h,A,M,m]),ee=(0,v.useMemo)(()=>{if(h!==`projects`)return[];let e=new Map;for(let n of t.vaultProjects)e.set(n.id,{name:n.name,sessions:[]});let n=[];for(let t of A){let r=t.projectId?e.get(t.projectId):void 0;r?r.sessions.push(t):n.push(t)}let r=[...e.entries()].map(([e,t])=>({key:e,name:t.name,projectId:e,sessions:t.sessions.slice().sort((e,t)=>t.mtime-e.mtime)}));return r.sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`})),(n.length>0||r.length===0)&&r.push({key:`none`,name:`No project`,projectId:null,sessions:n.slice().sort((e,t)=>t.mtime-e.mtime)}),D?r.filter(e=>e.sessions.length>0||e.projectId!==null&&c9(e.name,T)):r},[h,t.vaultProjects,A,D,T]),te=e=>{n.savePrefs({collapsedProjects:e?ee.map(e=>e.key):[]})},P=(0,v.useMemo)(()=>t.remote.hosts.filter(e=>!e.isSelf),[t.remote.hosts]),F=()=>{let e=y(`remote`);_(`remote`),e&&n.refreshHosts()},ne=!y(`remote`),I=(0,v.useRef)(!1);I.current=t.remote.loading;let re=(0,v.useRef)(i);re.current=i;let ie=(0,v.useRef)(P);ie.current=P,(0,v.useEffect)(()=>{if(!ne)return;let e=()=>{if(!(document.visibilityState===`hidden`||I.current)){n.refreshHosts();for(let e of ie.current)e.online&&re.current[`host:${e.hostId}`]===!1&&n.refreshHostSessions(e.hostId)}},t=setInterval(e,Gxe);return window.addEventListener(`focus`,e),()=>{clearInterval(t),window.removeEventListener(`focus`,e)}},[ne,n]);let ae=A.length,L=e=>{e!==h&&n.savePrefs({sidebarView:e})},oe=t.page,se={onOpen:C,onMenu:c.openMenu,clock:p},ce=!t.sessionsLoading&&ae===0&&!t.sessionsError?(0,U.jsx)(`div`,{className:`px-3 py-3 text-center text-xs text-fg-faint`,"data-testid":`sessions-empty`,children:D?`No chats match the filter.`:`No sessions yet — press + to start one.`}):null;return(0,U.jsxs)(`nav`,{className:`flex h-full w-full flex-col bg-surface`,"aria-label":`Sessions`,children:[(0,U.jsxs)(`div`,{className:`relative flex flex-wrap items-center justify-end gap-x-2 gap-y-1 border-b border-border p-2`,children:[(0,U.jsxs)(`div`,{className:`relative min-w-[8rem] flex-1`,children:[(0,U.jsx)(G.Filter,{className:`pointer-events-none absolute left-2 top-2 w-3.5 h-3.5 text-fg-faint`}),(0,U.jsx)(`input`,{"aria-label":`Filter chats by name`,className:H(q,`pl-7`,T!==``&&`pr-7`),placeholder:`Filter chats`,value:T,onChange:e=>E(e.target.value),onKeyDown:e=>{e.key===`Escape`&&T!==``&&(e.preventDefault(),e.stopPropagation(),E(``))},"data-testid":`sessions-filter`}),T===``?null:(0,U.jsx)(zS,{label:`Clear the filter`,className:`absolute right-0.5 top-0.5 p-1`,onClick:()=>E(``),"data-testid":`sessions-filter-clear`,children:(0,U.jsx)(G.X,{className:`w-3.5 h-3.5`})})]}),(0,U.jsx)(zS,{label:`Search chats and files (Ctrl+K)`,onClick:()=>{n.showLeftSection(`search`),e?.()},"data-testid":`open-search`,children:(0,U.jsx)(G.Search,{})}),(0,U.jsx)(zS,{label:`Refresh sessions`,onClick:()=>{n.refreshSessions(),n.refreshHosts()},children:(0,U.jsx)(G.Refresh,{className:t.sessionsLoading?`spin`:``})}),t.account?.loggedIn?(0,U.jsx)(zS,{label:`Import chats from your other coding agents`,onClick:()=>n.openDialog(`import-claude`),"data-testid":`open-import-claude`,children:(0,U.jsx)(G.Download,{})}):null,t.account?.loggedIn?(0,U.jsx)(zS,{label:`Export my chats`,onClick:()=>n.openDialog(`export-chats`),"data-testid":`open-export-chats`,children:(0,U.jsx)(G.Upload,{})}):null,t.account?.loggedIn&&!(t.currentSessionId&&t.remote.tabs[t.currentSessionId])?(0,U.jsx)(zS,{label:`Connect an AI tool — let it read your chats on this PC`,onClick:()=>n.openDialog(`connect-ai-tool`),"data-testid":`open-connect-ai-tool`,children:(0,U.jsx)(G.Plug,{})}):null,h===`projects`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(zS,{label:`Collapse all projects`,onClick:()=>te(!0),"data-testid":`projects-collapse-all`,children:(0,U.jsx)(G.CollapseAll,{})}),(0,U.jsx)(zS,{label:`Expand all projects`,onClick:()=>te(!1),"data-testid":`projects-expand-all`,children:(0,U.jsx)(G.ExpandAll,{})})]}):null,(0,U.jsx)(zS,{label:`Conversations — what your chats send each other`,onClick:()=>n.openConversations(),"data-testid":`open-conversations`,children:(0,U.jsx)(G.Chats,{})}),(0,U.jsx)(zS,{label:`What your chats are about — each chat’s about and what it cost`,onClick:()=>n.openChatAbouts(),"data-testid":`open-chat-abouts`,children:(0,U.jsx)(G.Info,{})}),(0,U.jsx)(zS,{label:`Project manager — review chats and suggest what to send each next`,onClick:()=>n.openProjectManager(),"data-testid":`open-project-manager`,children:(0,U.jsx)(G.Clipboard,{})}),(0,U.jsx)(zS,{label:r?`Hide the session list — it slides in when the pointer reaches the left edge`:`Pin the session list beside the chat`,className:H(`hidden md:inline-flex`,r?`text-accent`:`text-fg-muted`),"aria-pressed":r,onClick:()=>n.toggleSidebarPinned(),"data-testid":`sidebar-pin`,children:(0,U.jsx)(G.Pin,{})})]}),(0,U.jsx)(Jxe,{clock:p}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-1 pb-2`,children:(0,U.jsxs)(U.Fragment,{children:[j.length>0?(0,U.jsxs)(`div`,{className:`mb-1`,"data-testid":`section-pinned`,children:[(0,U.jsx)(`div`,{className:u9,children:(0,U.jsx)(`span`,{children:`Pinned`})}),j.map(e=>e.kind===`chat`?(0,U.jsx)(vI,{session:e.session,active:e.session.id===t.currentSessionId&&oe===null,link:t.sessionLinks[e.session.id]??null,menuOpen:c.menuFor===e.session.id,kindIcon:!0,testIdPrefix:`pinned-session`,...se},`chat:${e.session.id}`):(0,U.jsx)(Xxe,{project:e.project,sessions:e.sessions,active:oe?.kind===`project`&&oe.projectId===e.project.id,onOpen:w,onMenu:(t,n)=>u({target:{projectId:e.project.id,foldKey:null},at:t,el:n})},`project:${e.project.id}`))]}):null,(0,U.jsxs)(`div`,{className:`mb-1`,"data-testid":`sessions-local`,children:[t.sessionsError?(0,U.jsx)(`div`,{className:`px-2 py-2 text-xs text-danger`,children:t.sessionsError}):null,N?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{"data-testid":`section-today`,children:[(0,U.jsxs)(`div`,{className:u9,children:[(0,U.jsx)(`span`,{children:`Today`}),(0,U.jsx)(`span`,{className:`font-normal normal-case`,children:N.today.length||``}),(0,U.jsx)(`span`,{className:`flex-1`}),(0,U.jsx)(f9,{view:h,onChange:L})]}),ce??(N.today.length===0?(0,U.jsx)(`div`,{className:`px-3 py-1 text-xs text-fg-faint`,"data-testid":`today-empty`,children:D?`Nothing from today matches.`:`Nothing yet today.`}):N.today.map(e=>(0,U.jsx)(vI,{session:e,active:e.id===t.currentSessionId&&oe===null,link:t.sessionLinks[e.id]??null,menuOpen:c.menuFor===e.id,projectName:e.projectId?O.get(e.projectId)??null:null,...se},e.id)))]}),N.older.length>0?(0,U.jsxs)(`div`,{"data-testid":`section-older`,children:[(0,U.jsxs)(`div`,{className:u9,children:[(0,U.jsx)(`span`,{children:`Older`}),(0,U.jsx)(`span`,{className:`font-normal normal-case`,children:N.older.length})]}),N.older.map(e=>(0,U.jsx)(vI,{session:e,active:e.id===t.currentSessionId&&oe===null,link:t.sessionLinks[e.id]??null,menuOpen:c.menuFor===e.id,projectName:e.projectId?O.get(e.projectId)??null:null,...se},e.id))]}):null]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:u9,"data-testid":`section-by-project`,children:[(0,U.jsx)(`span`,{children:`By project`}),(0,U.jsx)(`span`,{className:`flex-1`}),(0,U.jsx)(f9,{view:h,onChange:L})]}),ce,ee.map(e=>{let r=`local:${e.key}`;return(0,U.jsxs)(`div`,{className:`mb-1 pl-2`,"data-testid":`project-group-${e.key}`,children:[(0,U.jsxs)(`div`,{className:`group relative flex items-center`,children:[(0,U.jsx)(eSe,{group:e,collapsed:x(e.key),onToggle:()=>S(e.key),onMenu:(t,n)=>u({target:{projectId:e.projectId,foldKey:e.key},at:t,el:n}),menuOpen:l?.target.foldKey===e.key}),e.projectId?(0,U.jsxs)(`div`,{className:`absolute right-1 hidden items-center rounded bg-surface/90 group-hover:flex group-focus-within:flex`,children:[(0,U.jsx)(zS,{label:`Settings of ${e.name}`,className:`p-1`,"data-testid":`project-settings-${e.key}`,onClick:t=>{t.stopPropagation(),n.openProjectSettings(e.projectId)},children:(0,U.jsx)(G.Settings,{className:`w-3.5 h-3.5`})}),(0,U.jsx)(zS,{label:`New chat in ${e.name}`,className:`p-1`,"data-testid":`project-new-chat-${e.key}`,onClick:t=>{t.stopPropagation(),n.newTab({projectId:e.projectId})},children:(0,U.jsx)(G.Plus,{className:`w-3.5 h-3.5`})})]}):null]}),x(e.key)?null:e.sessions.map(e=>(0,U.jsx)(vI,{session:e,active:e.id===t.currentSessionId&&oe===null,link:t.sessionLinks[e.id]??null,menuOpen:c.menuFor===e.id,...se},e.id))]},r)})]})]}),(0,U.jsxs)(`div`,{className:`mb-1`,"data-testid":`sessions-remote`,children:[(0,U.jsxs)(`button`,{type:`button`,className:l9,onClick:F,"aria-expanded":!y(`remote`),children:[(0,U.jsx)(G.Chevron,{open:!y(`remote`),className:`w-3 h-3`}),(0,U.jsx)(G.Globe,{className:`w-3 h-3`}),(0,U.jsx)(`span`,{className:`truncate`,children:`Remote`}),(0,U.jsx)(`span`,{className:`ml-auto font-normal`,children:P.length})]}),y(`remote`)?null:(0,U.jsxs)(U.Fragment,{children:[!t.remote.supported||t.remote.reason===`logged_out`?(0,U.jsx)(`div`,{className:`px-3 py-3 text-xs text-fg-faint`,children:`Sign in to see the sessions of your other devices.`}):P.length===0?(0,U.jsx)(`div`,{className:`px-3 py-3 text-xs text-fg-faint`,children:t.remote.loading?`Looking for your other devices…`:`No other devices yet.`}):null,P.map(e=>(0,U.jsx)(Zxe,{host:e,filter:D?k:null,collapsed:y(`host:${e.hostId}`)||i[`host:${e.hostId}`]===void 0,onToggle:()=>{let t=`host:${e.hostId}`,r=i[t]===void 0||i[t]===!0;a(e=>({...e,[t]:!r})),r&&n.refreshHostSessions(e.hostId)}},e.hostId))]})]})]})}),(0,U.jsx)(`div`,{className:`shrink-0 border-t border-border px-3 py-2 text-[11px] text-fg-faint`,children:(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsxs)(`button`,{type:`button`,"data-testid":`app-version`,title:`What's new in this version`,className:`truncate hover:text-fg hover:underline`,onClick:()=>n.openDialog(`whats-new`),children:[`OonaCode Desktop v`,f]}),(0,U.jsx)(zS,{label:`Lock this device — vault and sessions`,className:`p-1`,"data-testid":`lock-device`,onClick:()=>s(!0),children:(0,U.jsx)(G.Lock,{className:`h-3.5 w-3.5`})})]})}),(0,U.jsx)(HC,{open:l!==null,at:l?.at??{x:0,y:0},anchorEl:l?.el??null,label:`Project actions`,testId:`project-context-menu`,onClose:d,items:l?xI({projectId:l.target.projectId,pinned:l.target.projectId!==null&&Xl(g,`project`,l.target.projectId),fold:l.target.foldKey===null?null:{collapsed:x(l.target.foldKey),onToggle:()=>S(l.target.foldKey)},actions:n}):[]}),c.element,(0,U.jsx)(YS,{open:o,title:`Lock this device?`,confirmLabel:`Lock`,message:`Every chat closes and nothing on this PC can be read or run until you unlock — here with your password, or remotely from another device.`,onConfirm:()=>void n.lockDevice(),onClose:()=>s(!1)})]})}function Jxe({clock:e}){let{state:t,actions:n}=W(),[r,i]=(0,v.useState)(null),a=(0,v.useCallback)(()=>i(null),[]),o=t.page,s=()=>{window.innerWidth<768&&n.setSidebar(!1)};return(0,U.jsxs)(`div`,{className:`shrink-0 border-b border-border px-1 py-1`,"data-testid":`sidebar-nav`,children:[(0,U.jsxs)(`div`,{className:`flex items-center rounded-md hover:bg-surface-2`,children:[(0,U.jsxs)(`button`,{type:`button`,className:H(d9,`flex-1 hover:bg-transparent`),title:`New chat (Ctrl+T)`,onClick:()=>{n.newTab(),s()},"data-testid":`sidebar-new`,children:[(0,U.jsx)(G.Edit,{className:`w-4 h-4 shrink-0 text-fg-muted`}),(0,U.jsx)(`span`,{children:`New`})]}),(0,U.jsx)(zS,{label:`Start a new chat or a new project`,className:`mr-1 p-1`,"aria-haspopup":`menu`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();i({at:{x:t.left,y:t.bottom+2},el:e.currentTarget})},"data-testid":`sidebar-new-menu`,children:(0,U.jsx)(G.Chevron,{open:!0,className:`w-3.5 h-3.5`})})]}),(0,U.jsxs)(`button`,{type:`button`,className:H(d9,`w-full`,o?.kind===`projects`||o?.kind===`project`?`bg-surface-2 font-medium`:``),"aria-current":o?.kind===`projects`?`page`:void 0,onClick:()=>{n.openPage({kind:`projects`}),s()},"data-testid":`open-projects`,children:[(0,U.jsx)(G.Project,{className:`w-4 h-4 shrink-0 text-fg-muted`}),(0,U.jsx)(`span`,{children:`Projects`})]}),(0,U.jsx)(Yxe,{clock:e,active:o?.kind===`scheduled`,onOpen:()=>{n.openPage({kind:`scheduled`}),s()}}),(0,U.jsx)(HC,{open:r!==null,at:r?.at??{x:0,y:0},anchorEl:r?.el??null,label:`New`,testId:`sidebar-new-context-menu`,onClose:a,items:[{key:`chat`,label:`New chat`,hint:`Ctrl+T`,icon:(0,U.jsx)(G.Chats,{className:`w-3.5 h-3.5`}),onSelect:()=>{n.newTab(),s()},testId:`sidebar-new-chat`},{key:`project`,label:`New project…`,icon:(0,U.jsx)(G.Project,{className:`w-3.5 h-3.5`}),onSelect:()=>n.openNewProject(),testId:`sidebar-new-project`}]})]})}function Yxe({clock:e,active:t,onOpen:n}){let{tasks:r}=wI(),i=(0,v.useMemo)(()=>r?Cse(r,e):null,[r,e]);return(0,U.jsxs)(`button`,{type:`button`,className:H(d9,`w-full`,t?`bg-surface-2 font-medium`:``),"aria-current":t?`page`:void 0,onClick:n,title:i?.text??`Every scheduled task on this PC`,"data-testid":`open-scheduled`,children:[(0,U.jsx)(G.Clock,{className:`w-4 h-4 shrink-0 text-fg-muted`}),(0,U.jsx)(`span`,{className:`flex-1`,children:`Scheduled`}),i?(0,U.jsx)(`span`,{className:H(`mr-1 inline-block h-2 w-2 shrink-0 rounded-full`,i.tone===`stuck`?`bg-warn`:`bg-accent`),"aria-label":i.text,"data-testid":`scheduled-dot`,"data-tone":i.tone}):null]})}function f9({view:e,onChange:t}){let[n,r]=(0,v.useState)(null),i=(0,v.useCallback)(()=>r(null),[]),a=e=>e?(0,U.jsx)(G.Check,{className:`w-3.5 h-3.5 text-accent`}):(0,U.jsx)(`span`,{className:`w-3.5`});return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(zS,{label:`How the list is laid out`,className:`p-0.5 normal-case`,"aria-haspopup":`menu`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();r({at:{x:t.left,y:t.bottom+2},el:e.currentTarget})},"data-testid":`sidebar-view-options`,children:(0,U.jsx)(G.Sliders,{className:`w-3.5 h-3.5`})}),(0,U.jsx)(HC,{open:n!==null,at:n?.at??{x:0,y:0},anchorEl:n?.el??null,label:`How the list is laid out`,testId:`sidebar-view-menu`,onClose:i,items:[{key:`recent`,label:`Recent — Today, then Older`,icon:a(e===`recent`),onSelect:()=>t(`recent`),testId:`sidebar-view-recent`},{key:`projects`,label:`By project`,icon:a(e===`projects`),onSelect:()=>t(`projects`),testId:`sidebar-view-projects`}]})]})}function Xxe({project:e,sessions:t,active:n,onOpen:r,onMenu:i}){let a=(0,v.useRef)(null),o=e.sessionCount??t.length;return(0,U.jsxs)(`div`,{ref:a,className:H(`group relative flex items-center rounded-md`,n?`bg-accent-soft`:`hover:bg-surface-2`),onContextMenu:e=>{e.preventDefault(),i({x:e.clientX,y:e.clientY},a.current)},children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-2 py-1.5 pl-2 pr-8 text-left`,"aria-current":n?`page`:void 0,title:`Open ${e.name}`,onClick:()=>r(e.id),"data-testid":`pinned-project-${e.id}`,children:[(0,U.jsx)(G.Project,{className:`w-3.5 h-3.5 shrink-0 text-project`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg`,children:e.name}),(0,U.jsx)(hI,{sessions:t,testId:`pinned-project-busy-${e.id}`}),(0,U.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-3 px-1.5 py-px text-[10px] font-semibold text-fg-muted`,children:o})]}),(0,U.jsx)(zS,{label:`Project actions`,className:`pointer-events-none absolute right-1 bg-surface/90 p-1 opacity-0 group-focus-within:pointer-events-auto group-focus-within:opacity-100 group-hover:pointer-events-auto group-hover:opacity-100`,"data-testid":`pinned-project-menu-${e.id}`,onClick:e=>{e.stopPropagation();let t=e.currentTarget.getBoundingClientRect();i({x:t.left,y:t.bottom+2},a.current)},children:(0,U.jsx)(G.More,{className:`w-3.5 h-3.5`})})]})}function Zxe({host:e,collapsed:t,onToggle:n,filter:r=null}){let{state:i,actions:a}=W(),o=e.label||e.hostName,s=i.remote.sessions[e.hostId],c=(0,v.useMemo)(()=>{let t=s??[],n=new Set(t.map(e=>e.id)),r=[];for(let[t,a]of Object.entries(i.remote.tabs)){if(a.hostId!==e.hostId||n.has(t))continue;let o=i.transcripts[t]?.session??i.sessions.find(e=>e.id===t)??null;if(o){r.push(o),n.add(t);continue}let s=i.drafts[t];if(s){let e=new Date(s.createdAt).toISOString();r.push({id:s.id,projectKey:`draft`,cwd:s.projectDir??``,projectDir:s.projectDir??null,projectId:s.projectId??null,title:s.title??`New chat`,firstPrompt:null,lastPrompt:null,providerId:s.providerId??null,variantId:s.variantId??null,model:s.model??null,permissionMode:s.permissionMode??`default`,posture:s.posture??`build`,...s.effort?{effort:s.effort}:{},status:`idle`,createdAt:e,updatedAt:e,mtime:s.createdAt,entryCount:0,totalCostUsd:0,inputTokens:0,outputTokens:0,poolCredits:0,hasSubagents:!1,forkedFrom:null,engineSince:null,finishedUnseen:null}),n.add(t)}}if(s!==void 0||r.length!==0)return r.length>0?[...r,...t]:s},[s,i.remote.tabs,i.transcripts,i.sessions,i.drafts,e.hostId]),l=r&&c?c.filter(r):c,u=i.remote.unreachable[e.hostId],d=u?Em(u.reason,o,u.detail):null,[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(null),[y,b]=(0,v.useState)(null),x=(0,v.useCallback)(()=>b(null),[]),S=e.remoteAccessOff===!0;return(0,v.useEffect)(()=>{if(t||S||!e.online||!u)return;let n=setTimeout(()=>{a.refreshHostSessions(e.hostId)},3e3);return()=>clearTimeout(n)},[t,S,e.online,u,e.hostId,a]),(0,U.jsxs)(`div`,{className:`mb-1 pl-2`,"data-testid":`remote-host-${e.hostId}`,children:[(0,U.jsxs)(`div`,{className:`group relative flex items-center`,children:[(0,U.jsxs)(`button`,{type:`button`,className:l9,onClick:n,"aria-expanded":!t,title:e.online?`${o} — online`:`${o} — offline: its chats can be read while it is online`,children:[(0,U.jsx)(G.Chevron,{open:!t,className:`w-3 h-3`}),(0,U.jsx)(`span`,{className:H(`inline-block h-2 w-2 shrink-0 rounded-full`,e.online?`bg-ok`:`bg-fg-faint`),"aria-label":e.online?`online`:`offline`}),(0,U.jsx)(`span`,{className:`truncate normal-case`,children:o}),S?(0,U.jsx)(`span`,{className:`shrink-0 rounded-full bg-warn-soft px-1.5 text-[10px] font-normal normal-case text-warn`,"data-testid":`remote-off-${e.hostId}`,children:`remote access off`}):null,(0,U.jsx)(`span`,{className:`ml-auto font-normal`,children:!S&&l?l.length:``})]}),(0,U.jsxs)(`div`,{className:`absolute right-1 hidden items-center rounded bg-surface/90 group-hover:flex group-focus-within:flex`,children:[(0,U.jsx)(zS,{label:S?Tm(o):e.online?`New chat on ${o}`:`${o} is offline — a new chat has to start on a PC that is awake`,className:`p-1`,disabled:!e.online||S,"data-testid":`remote-new-chat-${e.hostId}`,onClick:()=>void a.newRemoteTab(e.hostId),children:(0,U.jsx)(G.Plus,{className:`w-3 h-3`})}),(0,U.jsx)(zS,{label:`Unlock this device`,className:`p-1`,disabled:S,"data-testid":`remote-unlock-${e.hostId}`,onClick:()=>p(`unlock`),children:(0,U.jsx)(G.Lock,{className:`w-3 h-3`})}),(0,U.jsx)(zS,{label:`Rename device`,className:`p-1`,onClick:()=>p(`rename`),children:(0,U.jsx)(G.Edit,{className:`w-3 h-3`})})]}),(0,U.jsx)(ZS,{open:f===`unlock`,title:`Unlock "${o}" remotely`,label:`Your account password — it never leaves this PC: the keys are sealed to that device and the server cannot read them.`,password:!0,submitLabel:`Unlock`,onSubmit:t=>void a.remoteUnlockHost(e.hostId,t),onClose:()=>p(null)}),(0,U.jsx)(ZS,{open:f===`rename`,title:`Rename device`,label:`Device name`,initialValue:o,onSubmit:t=>{t!==o&&a.renameHost(e.hostId,t)},onClose:()=>p(null)})]}),!t&&S?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-warn`,"data-testid":`remote-off-note-${e.hostId}`,children:Tm(o)}):t?null:l===void 0?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-faint`,children:`Loading…`}):l.length===0&&d?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-warn`,"data-testid":`remote-unreachable-${e.hostId}`,children:d}):l.length===0?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-faint`,children:r&&c&&c.length>0?`No chats here match the filter.`:`No sessions on this device.`}):l.map(t=>(0,U.jsx)(Qxe,{host:e,session:t,active:t.id===i.currentSessionId&&i.page===null,menuOpen:y?.session.id===t.id,onMenu:(e,t,n)=>b({session:e,at:t,el:n}),onRename:()=>h(t),onConfirmDelete:()=>_(t)},t.id)),(0,U.jsx)(HC,{open:y!==null,at:y?.at??{x:0,y:0},anchorEl:y?.el??null,label:`Chat actions`,testId:`remote-session-context-menu`,onClose:x,items:y?yI({session:y.session,link:null,pinned:Xl(i.prefs.pinned,`chat`,y.session.id),actions:{...a,selectSession:t=>{t?a.openRemoteSession(e.hostId,t):a.selectSession(null)}},onSync:()=>void 0,onRename:()=>h(y.session),onDelete:()=>_(y.session)}):[]}),(0,U.jsx)(ZS,{open:m!==null,title:`Rename chat`,label:`Chat title (leave empty to reset)`,initialValue:m?m.title??J_(m):``,onSubmit:t=>{m&&(i.drafts[m.id]?a.renameTab(m.id,t):a.renameRemoteSession(e.hostId,m.id,t))},onClose:()=>h(null)}),(0,U.jsx)(YS,{open:g!==null,title:`Delete this chat?`,message:`It is deleted on ${e.hostName} — the only place it is kept — so it is gone from every device. Files, folders and code on that PC are not touched — only the chat is deleted.`,onConfirm:()=>{g&&(i.drafts[g.id]?a.closeTab(g.id):a.deleteRemoteSession(e.hostId,g.id))},onClose:()=>_(null)})]})}function Qxe({host:e,session:t,active:n,menuOpen:r=!1,onMenu:i,onRename:a,onConfirmDelete:o}){let{actions:s}=W(),c=J_(t),l=(0,v.useRef)(null),u=(0,v.useRef)(null),[d,f]=(0,v.useState)(null),p=(0,v.useCallback)(()=>{u.current!==null&&(clearTimeout(u.current),u.current=null),f(null)},[]),m=(0,v.useRef)(r);return m.current=r,(0,v.useEffect)(()=>{r&&p()},[r,p]),(0,v.useEffect)(()=>{if(d===null)return;let e=e=>{VC(e.target,l.current)&&p()};return window.addEventListener(`scroll`,e,!0),()=>window.removeEventListener(`scroll`,e,!0)},[d,p]),(0,v.useEffect)(()=>()=>{u.current!==null&&clearTimeout(u.current)},[]),(0,U.jsxs)(`div`,{ref:l,className:H(`group relative flex items-center rounded-md`,n?`bg-accent-soft`:`hover:bg-surface-2`),onMouseEnter:()=>{u.current!==null&&clearTimeout(u.current),!m.current&&(u.current=setTimeout(()=>{u.current=null,l.current&&!m.current&&f(l.current.getBoundingClientRect())},450))},onMouseLeave:p,onClick:p,onContextMenu:e=>{e.preventDefault(),p(),i(t,{x:e.clientX,y:e.clientY},l.current)},children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{s.openRemoteSession(e.hostId,t.id),window.innerWidth<768&&s.setSidebar(!1)},className:`flex min-w-0 flex-1 items-center gap-2 px-2 py-1.5 text-left`,"aria-current":n?`true`:void 0,"data-testid":`remote-session-${t.id}`,title:e.online?void 0:`Read-only until that PC is online`,children:[(0,U.jsx)(mI,{status:t.status}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:H(`truncate text-sm`,n?`font-medium`:``),children:c}),(0,U.jsxs)(`div`,{className:`truncate text-[11px] text-fg-faint`,children:[U_(t.updatedAt),t.model?` · ${t.model}`:``,e.online?``:` · read-only`]})]})]}),(0,U.jsxs)(`div`,{className:`mr-1 hidden items-center gap-0.5 rounded bg-surface/90 group-hover:flex group-focus-within:flex`,children:[(0,U.jsx)(zS,{label:e.online?`Rename this chat`:`That PC is asleep — a chat can only be renamed while the PC that holds it is online`,className:`p-1 disabled:opacity-40`,disabled:!e.online,"data-testid":`remote-session-rename-${t.id}`,onClick:()=>{a()},children:(0,U.jsx)(G.Edit,{className:`w-3.5 h-3.5`})}),(0,U.jsx)(zS,{label:e.online?`Delete this chat`:`That PC is asleep — a chat can only be deleted while the PC that holds it is online`,className:`p-1 hover:text-danger disabled:opacity-40`,disabled:!e.online,"data-testid":`remote-session-delete-${t.id}`,onClick:()=>{o()},children:(0,U.jsx)(G.Trash,{className:`w-3.5 h-3.5`})}),(0,U.jsx)(zS,{label:`Chat actions`,className:`p-1`,"data-testid":`remote-session-menu-${t.id}`,onClick:e=>{e.stopPropagation(),p();let n=e.currentTarget.getBoundingClientRect();i(t,{x:n.left,y:n.bottom+2},l.current)},children:(0,U.jsx)(G.More,{className:`w-3.5 h-3.5`})})]}),d===null?null:(0,U.jsx)(_I,{session:t,anchor:d})]})}function $xe(){let{state:e}=W(),t=typeof window<`u`?window.oonacode:void 0;return zx(t?.appVersion??e.bundleAppVersion??e.connection.appVersion??e.info?.appVersion??`0.0.0`,Rx({bridge:t,info:e.info}))}function eSe({group:e,collapsed:t,onToggle:n,onMenu:r,menuOpen:i=!1}){let a=(0,v.useRef)(null),o=(0,v.useRef)(null),[s,c]=(0,v.useState)(null),l=(0,v.useCallback)(()=>{o.current!==null&&(clearTimeout(o.current),o.current=null),c(null)},[]),u=(0,v.useRef)(i);return u.current=i,(0,v.useEffect)(()=>{i&&l()},[i,l]),(0,v.useEffect)(()=>{if(s===null)return;let e=e=>{VC(e.target,a.current)&&l()};return window.addEventListener(`scroll`,e,!0),()=>window.removeEventListener(`scroll`,e,!0)},[s,l]),(0,v.useEffect)(()=>()=>{o.current!==null&&clearTimeout(o.current)},[]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`button`,{ref:a,type:`button`,className:Kxe,onClick:()=>{l(),n()},onMouseEnter:()=>{o.current!==null&&clearTimeout(o.current),!u.current&&(o.current=setTimeout(()=>{o.current=null,a.current&&!u.current&&c(a.current.getBoundingClientRect())},450))},onMouseLeave:l,onContextMenu:e=>{e.preventDefault(),l(),r({x:e.clientX,y:e.clientY},a.current)},"aria-expanded":!t,"data-testid":`project-header-${e.key}`,children:[(0,U.jsx)(G.Chevron,{open:!t,className:`w-3 h-3 shrink-0`}),(0,U.jsx)(G.Project,{className:`w-3.5 h-3.5 shrink-0 text-project`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.name}),(0,U.jsx)(hI,{sessions:e.sessions,testId:`project-busy-${e.key}`}),(0,U.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full bg-surface-3 px-1.5 py-px text-[10px] font-semibold normal-case tracking-normal text-fg-muted`,"data-testid":`project-count-${e.key}`,children:e.sessions.length})]}),s===null?null:(0,U.jsx)(tSe,{group:e,anchor:s})]})}function tSe({group:e,anchor:t}){let{state:n}=W(),r=e.projectId?n.vaultProjects.find(t=>t.id===e.projectId):void 0,i=e.sessions.filter(e=>e.status===`running`||e.status===`waiting_permission`).length,a=e.sessions.reduce((e,t)=>e===null||t.updatedAt>e?t.updatedAt:e,null),o=[...new Set(e.sessions.map(e=>e.projectDir??e.cwd).filter(e=>typeof e==`string`&&e.length>0))],s=r?.instructions?.trim()??``,c=Math.max(8,Math.min(t.right+8,window.innerWidth-304-8)),l=Math.max(8,Math.min(t.top,window.innerHeight-320));return(0,NS.createPortal)((0,U.jsxs)(`div`,{role:`tooltip`,"data-testid":`project-details-${e.key}`,className:`fixed z-50 max-h-[20rem] w-[19rem] overflow-y-auto rounded-lg border border-border bg-surface p-3 text-xs shadow-lg`,style:{left:c,top:l},children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5`,children:[(0,U.jsx)(G.Project,{className:`w-3.5 h-3.5 shrink-0 text-project`}),(0,U.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.name})]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(gI,{label:`Chats`,value:String(e.sessions.length)}),(0,U.jsx)(gI,{label:`Working now`,value:i>0?String(i):null}),(0,U.jsx)(gI,{label:`Last activity`,value:a?U_(a):null}),(0,U.jsx)(gI,{label:o.length>1?`Folders`:`Folder`,value:o.length>1?`${o.length} folders`:o[0]??null})]}),e.projectId?(0,U.jsxs)(`div`,{className:`mt-2 border-t border-border pt-2`,children:[(0,U.jsx)(`div`,{className:`mb-1 text-fg-faint`,children:`Standing instructions`}),s?(0,U.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-fg`,"data-testid":`project-instructions-${e.key}`,children:s.length>400?`${s.slice(0,400)}…`:s}):(0,U.jsx)(`div`,{className:`text-fg-faint`,children:`None — chats here start with nothing extra.`})]}):(0,U.jsx)(`div`,{className:`mt-2 border-t border-border pt-2 text-fg-faint`,children:`Chats filed under no project.`})]}),document.body)}var p9=`(min-width: 768px)`;function m9(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(p9).matches}function nSe(){let[e,t]=(0,v.useState)(m9);return(0,v.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(p9),n=()=>t(e.matches);return n(),e.addEventListener?.(`change`,n),()=>e.removeEventListener?.(`change`,n)},[]),e}function rSe(e){try{return!!e?.matches(`:hover`)}catch{return!1}}function iSe(e){if(typeof document>`u`)return!1;if(document.querySelector(`[role="menu"], [role="dialog"]`))return!0;let t=document.activeElement;return!!(e&&t&&e.contains(t)&&t.tagName===`INPUT`)}function aSe({hidden:e,collapsed:t=!1,peekAsk:n=0,children:r}){let{state:i,actions:a}=W(),o=i.ui.sidebarPinnedOverride??i.prefs.sidebarPinned,s=i.ui.sidebarOpen,[c,l]=(0,v.useState)(null),u=c??i.prefs.sidebarWidth,[d,f]=(0,v.useState)(!1),p=nSe(),m=(0,v.useRef)(null),h=(0,v.useRef)(null),g=(0,v.useCallback)(()=>{h.current!==null&&(clearTimeout(h.current),h.current=null)},[]),_=(0,v.useCallback)(()=>{g(),h.current=setTimeout(function e(){if(iSe(m.current)){h.current=setTimeout(e,350);return}h.current=null,!rSe(m.current)&&f(!1)},350)},[g]);(0,v.useEffect)(()=>g,[g]),(0,v.useEffect)(()=>{f(!1),g()},[o,g]);let y=(0,v.useRef)(n);(0,v.useEffect)(()=>{n!==y.current&&(y.current=n,!(e||o||!m9())&&(f(!0),_()))},[n,e,o,_]),(0,v.useEffect)(()=>{if(e)return;let t=e=>{if(!(!(e.ctrlKey||e.metaKey)||e.shiftKey||e.altKey)&&(e.key===`k`||e.key===`K`)){if(m9()){if(o)return;f(!0),_()}else s||a.setSidebar(!0)}};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,o,s,_,a]);let b=e=>{e.preventDefault();let t=e.clientX,n=u,r=n,o=e=>{r=Rl(n+(e.clientX-t)),l(r)},s=()=>{window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),document.body.style.cursor=``,document.body.style.userSelect=``,l(null),r!==i.prefs.sidebarWidth&&a.savePrefs({sidebarWidth:r})};document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s)},x=o||d;return(0,U.jsxs)(U.Fragment,{children:[!o&&!d&&!e&&!t?(0,U.jsx)(`div`,{className:`absolute inset-y-0 left-0 z-40 hidden w-2 md:block`,onMouseEnter:()=>{f(!0),_()},"aria-hidden":!0,"data-testid":`sidebar-hover-edge`}):null,(0,U.jsxs)(`aside`,{ref:m,"data-chrome":`sidebar`,"data-font-scope":`sidebar`,hidden:e,inert:!e&&(p?!x||t:!s),"data-testid":`sidebar-frame`,"data-state":t?`collapsed`:o?`docked`:d?`peek`:`hidden`,style:{"--sidebar-w":`${u}px`},onMouseEnter:o?void 0:g,onMouseLeave:o?void 0:_,className:H(`absolute inset-y-0 left-0 z-30 w-72 max-w-[85vw] border-r border-border bg-surface transition-transform md:w-[var(--sidebar-w)] md:max-w-[70vw]`,s?`translate-x-0`:`-translate-x-full`,o?`md:relative md:z-auto md:translate-x-0`:H(`md:z-40 md:shadow-2xl`,x?`md:translate-x-0`:`md:-translate-x-full`),t&&`md:hidden`),children:[r,(0,U.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the session list`,title:`Drag to resize · double-click for the default width`,className:`absolute inset-y-0 -right-1 z-10 hidden w-2 cursor-col-resize hover:bg-accent/30 md:block`,onPointerDown:b,onDoubleClick:()=>void a.savePrefs({sidebarWidth:288}),"data-testid":`sidebar-resize`})]})]})}var h9=[{id:`sessions`,title:`Sessions`,label:`Sessions`,icon:G.Chats},{id:`search`,title:`Search`,label:`Search chats and files (Ctrl+K)`,icon:G.Search},{id:`files`,title:`Files`,label:`Files of this chat`,icon:G.Folder}];function oSe({hidden:e=!1}){let{state:t,actions:n}=W(),r=t.prefs.leftPanelSection,i=t.prefs.leftPanelOpen,a=t.ui.sidebarPinnedOverride??t.prefs.sidebarPinned,[o,s]=(0,v.useState)(0),[c,l]=(0,v.useState)(0),[u,d]=(0,v.useState)(()=>new Set([r]));(0,v.useEffect)(()=>{d(e=>e.has(r)?e:new Set([...e,r]))},[r]),(0,v.useEffect)(()=>{if(e)return;let t=e=>{!(e.ctrlKey||e.metaKey)||e.shiftKey||e.altKey||(e.key===`k`||e.key===`K`)&&window.oonacode?.host!==`vscode`&&(e.preventDefault(),n.showLeftSection(`search`),l(e=>e+1))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,n]);let f=e=>{let t=Yb({section:r,open:i},e,a);(t.section!==r||t.open!==i)&&n.savePrefs(Kb(t.section,t.open)),a||s(e=>e+1),t.open&&e===`search`&&l(e=>e+1)},p=h9.map(e=>({id:e.id,label:e.label,icon:e.icon,active:i&&e.id===r})),m=e=>e===`sessions`?(0,U.jsx)(qxe,{onOpenSearch:()=>l(e=>e+1)}):e===`search`?(0,U.jsx)(Vxe,{active:r===`search`,focusAsk:c}):(0,U.jsx)(e9,{});return(0,U.jsxs)(U.Fragment,{children:[e?null:(0,U.jsx)(`div`,{className:`hidden border-r border-border md:flex`,children:(0,U.jsx)(L7,{items:p,testId:`activity-bar-left`,label:`Side bar`,onPick:f})}),(0,U.jsx)(`div`,{className:`contents md:relative md:flex md:shrink-0`,children:(0,U.jsx)(aSe,{hidden:e,collapsed:!i,peekAsk:o,children:(0,U.jsxs)(`div`,{className:`flex h-full w-full flex-col`,"data-testid":`left-dock`,"data-section":r,children:[(0,U.jsx)(sSe,{section:r,onPick:e=>{n.showLeftSection(e),e===`search`&&l(e=>e+1)}}),wl.filter(e=>u.has(e)||e===r).map(e=>(0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,hidden:e!==r,"data-testid":`left-section-${e}`,children:m(e)},e))]})})})]})}function sSe({section:e,onPick:t}){return(0,U.jsx)(`div`,{className:`flex shrink-0 gap-1 border-b border-border p-1 md:hidden`,role:`tablist`,"aria-label":`Side bar`,children:h9.map(n=>(0,U.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n.id===e,onClick:()=>t(n.id),className:H(`flex flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1 text-xs`,n.id===e?`bg-surface-2 font-medium text-fg`:`text-fg-muted hover:bg-surface-2 hover:text-fg`),"data-testid":`left-tab-${n.id}`,children:[(0,U.jsx)(n.icon,{className:`w-3.5 h-3.5`}),n.title]},n.id))})}var g9={autosaveFiles:{hint:`Save a file as soon as you change it. Off by default.`,details:[`Applies to text files opened in this window’s file viewer.`,`While off, a changed file shows * on its tab and Ctrl+S saves it.`,`A file opened from another PC stays read-only.`]},autoAccept:{hint:`Allow every tool the agent wants to use, without asking you. Off by default.`,details:[`Answered by this PC itself, so it covers EVERY chat running here — started in this app, the oona terminal, your phone, Telegram, the website or another PC.`,`The agent’s questions to you (its multiple-choice cards) still wait for your answer.`,`A chat set to Ask first in the composer still asks you before each tool — that is what Ask first means.`,`Subagents never ask: their tool requests are always allowed.`,`Takes effect at the next tool request, even in a chat that is already working.`,`What a chat may attempt at all is still its own Build / Plan / Ask first / Autonomous choice in the composer; this only answers the prompts it would have shown you.`]},reasoning:{hint:`Show the model’s thinking between its messages.`,details:[`Display only — the model thinks the same either way.`,`Hidden thinking is also left out of chat search (Ctrl+F).`,`For the windows this PC serves (this app, the local web UI). The phone has its own switch.`]},colourScheme:{hint:`System follows your desktop’s light or dark setting: the operating system’s app mode (Windows: Settings → Personalisation → Colours → “Choose your default app mode”).`,details:[`Also colours this window’s title bar and menu.`,`Your own colours per element are under Theme.`]},notifications:{hint:`Desktop notifications from this app while its window is not in front.`,details:[`Nothing pops up while you are looking at the window.`,`Your phone’s push notifications are separate: the phone buzzes only while no window on this PC is open.`]},notifyFinished:{hint:`When a chat’s turn ends — finished, or failed.`,details:[`Named after the chat; clicking the notification opens it.`]},notifyWaiting:{hint:`When a chat waits for you: a permission, or one of the agent’s questions.`,details:[`With auto-accept on, only the agent’s questions still wait for you, so only they notify.`]},notifyError:{hint:`When a chat stops on an error.`,details:[`The error itself is also written into the chat.`]},transcriptWindow:{hint:`How many messages and tool cards of a chat stay drawn; older ones leave the top like a stack and come back when you scroll up.`,details:[`Only what is DRAWN: the whole chat is still kept, and still searched.`,`Smaller is faster on long agentic chats; larger keeps more on screen.`]},defaultCwd:{hint:`The folder a new chat runs in when it is not given one. Empty: each chat gets its own private folder.`,details:[`A folder here becomes each new chat’s project: its CLAUDE.md, .claude settings, hooks and skills load. Your home folder and drive roots never load as a project.`,`Empty is the safe default: the agent then works only inside that chat’s own folder under OonaCode’s data directory.`,`Used by chats started in this app. A project’s own folder (Projects → New chats) wins over it; the oona terminal always uses the folder you run it in.`]},remoteAccess:{hint:`Let your phone, Telegram, the website and your other PCs reach this PC.`,details:[`This PC keeps one outbound, end-to-end encrypted channel to your OonaCode server; every other device reaches it through that channel alone.`,`It is also how they read this PC’s chats: the chats are kept only here, never on our server, so they can be read while this PC is on and reachable.`,`Off: they still see this PC online, marked “remote access off”, and cannot list or open its chats, send prompts, unlock it remotely or delete its chats. This PC also cannot open chats on your other PCs.`,`Takes effect immediately.`]},telegram:{hint:`Let the OonaCode Telegram bot list, read, continue and delete this PC’s chats. Off by default.`,details:[`The bot reaches this PC through OonaCode’s server, and what you send and receive in Telegram passes through that server unencrypted — Telegram can read it too. Everything else stays end-to-end encrypted.`,`Off: this PC refuses every Telegram request, even from your own Telegram account, and a chat open in Telegram is closed at once. The bot says how to turn it back on.`,`Only this PC can turn it on — not the website, the phone or the bot.`,`Needs Remote access on as well, and Telegram connected to your account in the bot (/connect).`]},imageRetention:{hint:`Pictures in this PC’s chat history older than this are replaced with a short note. 0 keeps them forever. Default: a year.`,details:[`Replaced: the pictures stored in this PC’s chats — screenshots and other pictures a tool returned, and pictures you pasted into a message — once they are older than this.`,`Each becomes a one-line note saying a picture was there, why and when it went, e.g. “[Picture removed after 365 days to save space — picture from a tool (PNG), 412 KB]”.`,`Not affected: the words of every chat, and the files on your disk. The chat continues normally — the model no longer needs pictures that old.`,`Runs by itself: a few minutes after this PC’s OonaCode starts, then once a day, in small steps that never hold up a chat. A chat that is working, or was in the last hour, is done at the next run.`,`The database file stops growing from pictures; it does not shrink. The space is reused for new chats.`,`Only this PC holds its chats, so this is every copy there is.`]},chatAbout:{hint:`A short note per chat saying what it works on, which your other chats read through “Talk to other chats”. On by default.`,details:[`Written in the background by each chat’s housekeeper — the cheap helper model of the chat’s own provider — after a turn ends, only when the chat changed since, and at most once per interval below.`,`The same switch covers Regenerate (in a chat’s session info) and “Generate for all chats now” (View → What chats are about…). Off stops all three, so nothing is spent on abouts.`,`Paid by the chat’s own route: an OonaCode pool chat spends credits, your own API key is billed by your provider, and your own subscription’s plan covers it.`,`An about is part of its chat and stays on this PC: it is never uploaded to our server, and your other devices read it from this PC, like the chat.`]},providerUsagePing:{hint:`When you look at a provider’s usage card and its last figure is old, check it with one tiny request. On by default.`,details:[`Applies to providers you use with your OWN key or subscription — your Claude plan, an own DeepSeek, OpenAI, xAI, MiMo or Alibaba key, a ChatGPT plan, Meta’s Muse key. Google’s agy and SuperGrok have a usage report of their own, and the OonaCode pool shows credits instead: they are never checked.`,`Only when you look: opening the model picker’s card, or resting the pointer on the picker’s box while one of those models is active. Never in the background, and never while the last figure is younger than the time below.`,`The check is one “reply PONG” request of a few tokens, sent from this PC straight to the provider with your own plan or key — so it spends a few tokens of THEM, and nothing about it goes through our servers. Your Claude plan is asked through the genuine Claude engine, as a chat message is.`,`Only the rate-limit figures in the answer are kept (on this PC, with the time they were seen); the answer itself is thrown away. Off: the card shows the last figures it saw, or nothing, and never asks.`]},providerUsageStale:{hint:`How old the last usage figure may be before a look at the card checks again.`,details:[`0 never checks on a look (the card shows what it last saw). A card opened sooner than this after the last figure does not ask the provider anything.`,`A check that failed is not repeated for ten minutes, and “Check now” on the card makes at most one a minute.`]},chatAboutInterval:{hint:`At most one background about per chat in this many minutes.`,details:[`Only the background job waits for it: Regenerate and “Generate for all chats now” write at once.`,`A background about is written only after a turn ends and only when the chat changed, so a chat nobody uses costs nothing, whatever this says.`,`Shorter keeps abouts fresher and makes more calls.`]},chatAboutMaxWords:{hint:`The longest about the housekeeper may write.`,details:[`A longer answer is cut at this many words.`,`Applies to every about the housekeeper writes: in the background, by Regenerate and by “Generate for all chats now”. An about you write yourself may be longer (up to 2,000 characters).`,`A longer about costs a few more output tokens, and a chat that lists your chats reads every one of them.`]},chatAboutInputChars:{hint:`How much of a chat the housekeeper reads to write its about.`,details:[`Taken from the chat’s title, project and folder, its previous about, your first message, the newest summary of the earlier conversation, your latest messages and the agent’s last answer — each with a share, so no part crowds out the others.`,`Applies to the background job, Regenerate and “Generate for all chats now”.`,`Most of what a call costs: roughly a quarter as many tokens as characters. More gives a better-informed about and costs more.`]},safeguardFallback:{hint:`When a model refuses a message on content or safety grounds, run that one message once more on another model. On by default.`,details:[`Decided by this PC itself, for EVERY chat running here — started in this app, the oona terminal, your phone, Telegram, the website or another PC.`,`Only that message is sent to the other model; the chat stays on the model you picked. The refusal and the retry are both written into the chat, and the turn line says what happened.`,`Switch automatically: the best other model your chat’s route can serve — a Claude chat tries other Claude models first. Always switch to: the model you choose, every time. Never: the refusal is shown and nothing is retried.`,`OonaCode pool: the model that answers is charged at its own price. Your own key or subscription never switches to another provider — only to another model of the same one.`,`A fallback you set for one model (below) beats this choice, and a chat’s own --fallback-model (terminal, agent API) beats both.`,`Limit: Claude Code’s own engine still moves Opus 5, Opus 5.5 and Fable chats to Opus 4.8 by itself when their safeguards refuse — it cannot be switched off.`,`One retry only: if the second model refuses too, the chat says so and stops.`]},safeguardPerModel:{hint:`Pick the fallback for one model. It beats the choice above for that model only; “Never fall back” stops a model from being retried.`,details:[`Applies when the refused model is the one you name here, in any chat on this PC, however it was started.`,`A model you use through your own key or subscription can only fall back to a model of the same provider; an OonaCode pool model can fall back to any pool model.`,`Up to 64 models. A chat’s own --fallback-model still beats this table.`,`Charged by the model that answers: pool credits at its price, or your own key or plan.`]},keepUnlocked:{hint:`Leave your vault unlocked when you close or quit the app.`,details:[`Off (default): closing the window — to the tray too — or quitting stops the chats that are running and locks this PC until you unlock it. Your phone and other devices cannot use it meanwhile.`,`On: chats keep running and your other devices keep working after the window is closed. Choose it on a PC only you use.`]},server:{hint:`Your account’s OonaCode server.`,details:[`Where your account lives: sign-in, OonaCode-pool models and credits, your encrypted vault, remote access, and app updates.`,`Your own API keys and subscriptions never go through it — this PC calls those providers directly.`,`Set by signing in. (Developers point a build at another server with OONACODE_GATEWAY_URL.)`]},diagnostics:{hint:`While you are signed in, this PC sends OonaCode its warnings and errors, and a short report of any turn that fails.`,details:[`A report names the error, the model and the provider — never the content of your chats.`,`It is how bugs you never reported get fixed. There is no usage tracking.`]},allowDebugging:{hint:`Let a debugger attach to this app’s windows, to see and control them while fixing a bug. Off by default. Takes effect when OonaCode restarts.`,details:[`For finding bugs together: DevTools (chrome://inspect), Playwright or another Chrome DevTools Protocol client attaches to every window of this app — reads what it shows, clicks, types and runs code in it.`,`The risk: while it is on, ANY program on this PC can do the same — read your chats on screen and act as you in OonaCode, with no prompt. Turn it on only while you need it.`,`Only on this PC: the port is opened on 127.0.0.1, never on the network, and web pages in your browser cannot connect to it.`,`Desktop app only, this PC only: the local web UI in a browser, the phone, Telegram and your other PCs are not affected.`,`Read when the app starts, so a change applies at the next start (Restart now). The host service and your chats keep running through the restart.`,`While it is on, every window shows a red “Debugging on” badge and says so in its title.`]},debugPort:{hint:`The port on 127.0.0.1 a debugger connects to.`,details:[`Connect with http://127.0.0.1:<port> — e.g. chrome://inspect → Configure… → localhost:<port>, or Playwright’s connectOverCDP.`,`A port another program already uses is refused when you save.`,`With “Also debug the main process”, the next port is taken too.`]},debugMainProcess:{hint:`Also open Node’s inspector for the app’s main process, on the next port.`,details:[`For bugs in the desktop shell itself (windows, menus, updates, the tray), not in a window’s page.`,`Gives full control of the main process — it can run any program as you. Off unless you choose it.`,`Applies only while “Allow debugging” is on, at the next start.`]}};function cSe(e){if(!Lc(e))return`Off in this run: no debugging port is open.`;let t=[];return e.port!==null&&t.push(e.listening?`On in this run: windows on 127.0.0.1:${e.port}${e.fromCommandLine?` (from the command line)`:``}.`:`Port ${e.port} could not be opened — another program may be using it.`),e.inspectPort!==null&&t.push(e.inspectProblem?`Main-process inspector: ${e.inspectProblem}`:`Main process on 127.0.0.1:${e.inspectPort}.`),t.join(` `)}function lSe(e){return Rc(e.saved,e.running)}function uSe(e){return`Debugging is on: ${zc(e)}. While it is on, any program on this PC can read and control OonaCode. Click to change it in Settings → Developer.`}function dSe({providerId:e,configured:t}){let{api:n,state:r,actions:i}=W(),[a,o]=(0,v.useState)(null);return(0,v.useEffect)(()=>{if(t||!n.getAgyStatus)return;let e=!0;return n.getAgyStatus().then(t=>{e&&o({state:t.state,install:t.install})},()=>{e&&o(null)}),()=>{e=!1}},[n,t,r.providers]),(0,U.jsx)(K,{size:`sm`,variant:t?`secondary`:`primary`,onClick:()=>i.openProviderConnect(e),"data-testid":`agy-provider-button`,children:hbe(t,a)})}function _9(e,t){return t.get(e.providerId)??e.providerId}function fSe(e,t,n){let r=mm(t);if(!r)return[];let i=e.find(e=>e.models.some(e=>e.value===t)),a=gl(r.modelId);return(vl(r.providerId)?e.filter(e=>vl(e.providerId)):e.filter(e=>!vl(e.providerId)&&_9(e,n)===(i?_9(i,n):r.providerId))).map(e=>({...e,models:e.models.filter(e=>gl(e.modelId)!==a)})).filter(e=>e.models.length>0)}function v9({groups:e}){return(0,U.jsx)(U.Fragment,{children:e.map(e=>(0,U.jsx)(`optgroup`,{label:e.label,children:e.models.map(e=>(0,U.jsx)(`option`,{value:e.value,children:e.label},e.value))},`${e.providerId}:${e.variantId??``}`))})}var pSe=[{mode:`auto`,label:`Switch to another model automatically`,hint:`The best other model this chat can use. A Claude chat tries other Claude models first.`},{mode:`model`,label:`Always switch to:`,hint:`The model you choose, every time a model refuses.`},{mode:`off`,label:`Never — show the refusal`,hint:`Nothing is retried; the chat shows the refusal and where to change this.`}];function mSe(){let{state:e,actions:t}=W(),n=_l(e.prefs.safeguardFallback),r=(0,v.useMemo)(()=>ym(e.providers),[e.providers]),i=(0,v.useMemo)(()=>new Map(e.providers.map(e=>[e.definition.id,e.definition.clientGroup??e.definition.id])),[e.providers]),a=(0,v.useMemo)(()=>r.flatMap(e=>e.models.map(e=>({id:e.modelId,displayName:e.label}))),[r]),o=e=>bl(e,a),[s,c]=(0,v.useState)(!1),l=s?`model`:n.mode,u=e=>void t.savePrefs({safeguardFallback:_l(e)}),d=e=>{if(e===`model`){c(!0);return}c(!1),u({...n,mode:e,model:null})},f=(e=>e?r.flatMap(e=>e.models).find(t=>gl(t.modelId)===gl(e)):void 0)(n.model),[p,m]=(0,v.useState)(``),[h,g]=(0,v.useState)(``),_=(0,v.useMemo)(()=>p?fSe(r,p,i):[],[r,p,i]),y=Object.entries(n.perModel),b=y.length>=64,x=p!==``&&h!==``&&(h===`none`||_.some(e=>e.models.some(e=>e.value===h))),S=()=>{let e=mm(p);if(!e||!x)return;let t=h===`none`?pl:mm(h)?.modelId??``;if(!t)return;let r=gl(e.modelId);b&&n.perModel[r]===void 0||(u({...n,perModel:{...n.perModel,[r]:t}}),m(``),g(``))},C=e=>{let t={...n.perModel};delete t[e],u({...n,perModel:t})};return(0,U.jsxs)(`div`,{className:`space-y-4`,"data-testid":`settings-safeguards`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-sm font-medium text-fg`,children:[(0,U.jsx)(G.Shield,{className:`w-3.5 h-3.5`}),` When a model refuses a message`,(0,U.jsx)(BS,{label:`When a model refuses a message`,details:(0,U.jsx)(VS,{items:g9.safeguardFallback.details})})]}),(0,U.jsx)(`p`,{className:`text-xs text-fg-faint`,children:g9.safeguardFallback.hint}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-faint`,children:`On the OonaCode pool, the model that answers is charged at its own price. Your own key or subscription never switches to another provider.`}),(0,U.jsx)(`div`,{role:`radiogroup`,"aria-label":`When a model refuses a message`,className:`mt-2 space-y-1`,children:pSe.map(e=>(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md px-1 py-1.5 hover:bg-surface-2`,children:[(0,U.jsx)(`input`,{type:`radio`,name:`safeguard-mode`,className:`mt-1`,checked:l===e.mode,onChange:()=>d(e.mode),"data-testid":`safeguard-mode-${e.mode}`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.label}),(0,U.jsx)(`span`,{className:`block text-xs text-fg-faint`,children:e.hint}),e.mode===`model`?(0,U.jsxs)(`select`,{className:H(q,`mt-1.5 max-w-sm`),"aria-label":`Always switch to`,value:f?.value??``,disabled:l!==`model`,onChange:e=>{let t=mm(e.target.value);t&&(c(!1),u({...n,mode:`model`,model:t.modelId}))},"data-testid":`safeguard-model-select`,children:[(0,U.jsx)(`option`,{value:``,children:n.model&&!f?`${o(n.model)} (not listed)`:`Choose a model…`}),(0,U.jsx)(v9,{groups:r})]}):null]})]},e.mode))}),(0,U.jsx)(`p`,{className:`mt-2 rounded-md bg-surface-2 px-2.5 py-1.5 text-xs text-fg-muted`,children:`Claude Code’s own engine still moves Opus 5, Opus 5.5 and Fable chats to Opus 4.8 by itself when their safeguards refuse — that cannot be switched off.`})]}),(0,U.jsxs)(`div`,{className:`border-t border-border pt-3`,"data-testid":`safeguard-per-model`,children:[(0,U.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-sm font-medium text-fg`,children:[`Fallback per model`,(0,U.jsx)(BS,{label:`Fallback per model`,details:(0,U.jsx)(VS,{items:g9.safeguardPerModel.details})})]}),(0,U.jsx)(`p`,{className:`text-xs text-fg-faint`,children:g9.safeguardPerModel.hint}),y.length>0?(0,U.jsxs)(`table`,{className:`mt-2 w-full text-xs`,"data-testid":`safeguard-table`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{className:`text-left text-fg-faint`,children:[(0,U.jsx)(`th`,{className:`py-1 pr-2 font-medium`,children:`Refused model`}),(0,U.jsx)(`th`,{className:`py-1 pr-2 font-medium`,children:`Fallback`}),(0,U.jsx)(`th`,{className:`w-8`})]})}),(0,U.jsx)(`tbody`,{children:y.map(([e,t])=>(0,U.jsxs)(`tr`,{className:`border-t border-border`,"data-testid":`safeguard-row-${e}`,children:[(0,U.jsx)(`td`,{className:`py-1.5 pr-2 text-fg`,children:o(e)}),(0,U.jsx)(`td`,{className:`py-1.5 pr-2 text-fg-muted`,children:t===`none`?`Never`:o(t)}),(0,U.jsx)(`td`,{className:`py-1.5 text-right`,children:(0,U.jsx)(zS,{label:`Remove the fallback for ${o(e)}`,className:`p-0.5`,onClick:()=>C(e),"data-testid":`safeguard-remove-${e}`,children:(0,U.jsx)(G.Trash,{className:`w-3 h-3`})})})]},e))})]}):(0,U.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,"data-testid":`safeguard-table-empty`,children:`No per-model fallbacks — every model follows the choice above.`}),(0,U.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-end gap-2`,children:[(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs text-fg-muted`,children:[`When this model refuses`,(0,U.jsxs)(`select`,{className:H(q,`max-w-56`),value:p,onChange:e=>{m(e.target.value),g(``)},"data-testid":`safeguard-add-refused`,children:[(0,U.jsx)(`option`,{value:``,children:`Choose a model…`}),(0,U.jsx)(v9,{groups:r})]})]}),(0,U.jsxs)(`label`,{className:`flex min-w-0 flex-col gap-1 text-xs text-fg-muted`,children:[`Use`,(0,U.jsxs)(`select`,{className:H(q,`max-w-56`),value:h,disabled:p===``,onChange:e=>g(e.target.value),"data-testid":`safeguard-add-fallback`,children:[(0,U.jsx)(`option`,{value:``,children:`Choose a fallback…`}),(0,U.jsx)(`option`,{value:pl,children:`Never fall back`}),(0,U.jsx)(v9,{groups:_})]})]}),(0,U.jsxs)(K,{size:`sm`,variant:`primary`,disabled:!x||b&&n.perModel[gl(mm(p)?.modelId??``)]===void 0,onClick:S,"data-testid":`safeguard-add`,children:[(0,U.jsx)(G.Plus,{className:`w-3 h-3`}),` Add`]})]}),b?(0,U.jsxs)(`p`,{className:`mt-1 text-xs text-warn`,children:[`The table is full (`,64,` models). Remove one to add another.`]}):null,r.length===0?(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-faint`,children:`No models are listed on this PC yet — connect a provider first.`}):null]})]})}function hSe(){let{actions:e}=W(),[t,n]=(0,v.useState)(void 0),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(null),s=(0,v.useCallback)(async()=>{n(await e.listSkills())},[e]);return(0,v.useEffect)(()=>{s()},[s]),t===`unsupported`?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`This PC’s OonaCode is older than skills — update it to manage them here.`}):r?(0,U.jsx)(gSe,{onDone:()=>{i(!1),iI(),FN(),s()}}):(0,U.jsxs)(`div`,{className:`space-y-3`,"data-testid":`skills-section`,children:[(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`Skills every chat on this PC gets — type `,(0,U.jsx)(`span`,{className:`font-mono`,children:`/`}),` in the message box to use one for that message. They work with every model. A change applies from a chat’s next start (a new chat, or one idle for ten minutes).`]}),(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`skills-per-chat-note`,children:[`The model is not shown them on its own: each chat chooses which skills the model may use by itself, in the `,(0,U.jsx)(`span`,{className:`font-medium`,children:`Skills`}),` menu under its message box — only those cost tokens on every message of that chat.`]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(K,{size:`sm`,onClick:()=>i(!0),"data-testid":`skills-import-open`,children:[(0,U.jsx)(G.Download,{className:`h-3.5 w-3.5`}),` Import from Claude Code…`]}),t?(0,U.jsx)(`span`,{className:`truncate text-[11px] text-fg-faint`,title:t.dir,children:t.dir}):null]}),t===void 0?(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Loading…`}):t===null?(0,U.jsx)(`p`,{className:`text-xs text-danger`,children:`The host could not list the skills right now.`}):t.skills.length===0?(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`skills-empty`,children:[`No skills of your own yet. Import them from Claude Code, or put a folder with a`,` `,(0,U.jsx)(`span`,{className:`font-mono`,children:`SKILL.md`}),` in the folder above.`]}):(0,U.jsx)(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:t.skills.map(t=>(0,U.jsxs)(`li`,{className:`flex items-start gap-3 px-3 py-2 text-sm`,"data-testid":`skill-row`,"data-name":t.name,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,U.jsxs)(`span`,{className:`font-mono font-medium`,children:[`/`,t.name]}),t.argumentHint?(0,U.jsx)(`span`,{className:`font-mono text-xs text-fg-faint`,children:t.argumentHint}):null,t.broken?(0,U.jsx)(WS,{tone:`warn`,children:`no SKILL.md`}):null]}),t.description?(0,U.jsx)(`div`,{className:`line-clamp-2 text-xs text-fg-muted`,title:t.description,children:t.description}):null,(0,U.jsxs)(`div`,{className:`text-[11px] text-fg-faint`,children:[Ej(t.bytes),` · `,t.files,` file`,t.files===1?``:`s`,t.importedFrom?(0,U.jsxs)(U.Fragment,{children:[` `,`· imported `,t.importedAt?U_(t.importedAt):``,` from`,` `,(0,U.jsx)(`span`,{title:t.importedFrom,children:t.importedFrom})]}):null]})]}),(0,U.jsxs)(K,{size:`sm`,variant:`ghost`,busy:a===t.name,"aria-label":`Remove ${t.name}`,onClick:async()=>{o(t.name);let n=await e.removeSkill(t.name);o(null),n&&(iI(),FN(),await s())},"data-testid":`skill-remove`,children:[(0,U.jsx)(G.Trash,{className:`h-3.5 w-3.5`}),` Remove`]})]},t.name))})]})}function gSe({onDone:e}){let{actions:t}=W(),[n,r]=(0,v.useState)(void 0),[i,a]=(0,v.useState)(()=>new Set),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(null);(0,v.useEffect)(()=>{let e=!0;return t.scanClaudeSkills().then(t=>{e&&r(t)}),()=>{e=!1}},[t]);let f=(0,v.useMemo)(()=>{let e=new Map;for(let t of n?.skills??[]){let n=t.origin===`plugin`?`Plugin: ${t.plugin??`?`}`:`Your skills`;e.set(n,[...e.get(n)??[],t])}return[...e.entries()]},[n]),p=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,U.jsxs)(`div`,{className:`space-y-3`,"data-testid":`skills-import`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(K,{size:`sm`,variant:`ghost`,onClick:e,children:`← Back`}),(0,U.jsx)(`span`,{className:`text-sm font-medium`,children:`Import skills from Claude Code`})]}),(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[`Tick the skills to copy into OonaCode. Your Claude Code install is only read — nothing in it is changed.`,n?.roots.length?(0,U.jsxs)(U.Fragment,{children:[` `,`Read from `,(0,U.jsx)(`span`,{className:`font-mono`,children:n.roots.join(`, `)}),`.`]}):null]}),n===void 0?(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:`Looking…`}):n===null?(0,U.jsx)(`p`,{className:`text-xs text-danger`,children:`The host could not read Claude Code’s skills.`}):n.skills.length===0?(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`skills-import-empty`,children:`No skills found in Claude Code on this PC.`}):f.map(([e,t])=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wide text-fg-faint`,children:e}),(0,U.jsx)(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:t.map(e=>{let t=!!e.unavailable||e.alreadyInOonaCode&&!o;return(0,U.jsx)(`li`,{className:`px-3 py-1.5 text-sm`,children:(0,U.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`mt-1`,checked:i.has(e.key)&&!t,disabled:t,onChange:()=>p(e.key),"data-testid":`skills-import-pick`,"data-name":e.name}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`span`,{className:`font-mono font-medium`,children:[`/`,e.name]}),` `,e.alreadyInOonaCode?(0,U.jsx)(WS,{children:`already in OonaCode`}):null,` `,e.unavailable?(0,U.jsx)(WS,{tone:`warn`,children:e.unavailable}):null,e.description?(0,U.jsx)(`span`,{className:`line-clamp-2 block text-xs text-fg-muted`,children:e.description}):null,e.note?(0,U.jsx)(`span`,{className:`block text-[11px] text-warn`,children:e.note}):null,(0,U.jsxs)(`span`,{className:`block text-[11px] text-fg-faint`,children:[Ej(e.bytes),` · `,e.path]})]})]})},e.key)})})]},e)),n&&n.skills.some(e=>e.alreadyInOonaCode)?(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked)}),`Replace the ones already in OonaCode`]}):null,u?(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,role:`status`,"data-testid":`skills-import-outcome`,children:u}):null,(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsxs)(K,{variant:`primary`,size:`sm`,busy:c,disabled:i.size===0,"data-testid":`skills-import-go`,onClick:async()=>{l(!0);let n=await t.importClaudeSkills([...i],o);if(l(!1),!n)return;let r=n.skipped.map(e=>`${e.name||e.key}: ${e.reason}`);d(`Imported ${n.imported.length}`+(r.length>0?` · skipped ${r.join(`; `)}`:``)),n.skipped.length===0&&e()},children:[`Import `,i.size>0?i.size:``]}),(0,U.jsx)(K,{size:`sm`,onClick:e,children:`Cancel`})]})]})}function _Se({open:e,onClose:t,editingServer:n}){let{actions:r}=W(),[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(`all`),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(`stdio`),[x,S]=(0,v.useState)(`npx`),[C,w]=(0,v.useState)(``),[T,E]=(0,v.useState)(``),[D,O]=(0,v.useState)(``),[k,A]=(0,v.useState)(``),[j,M]=(0,v.useState)(!1),[N,ee]=(0,v.useState)({}),[te,P]=(0,v.useState)(!1),[F,ne]=(0,v.useState)(null),[I,re]=(0,v.useState)(!1),[ie,ae]=(0,v.useState)(null),[L,oe]=(0,v.useState)(null);n&&n.id!==L&&(oe(n.id),d(!0),l(null),p(n.id),h(n.name),_(n.description??``),b(n.transport),S(n.command??`npx`),w((n.args??[]).join(` `)),E(Object.entries(n.env??{}).map(([e,t])=>`${e}=${t}`).join(`
|
|
240
240
|
`)),O(n.url??``),A(Object.entries(n.headers??{}).map(([e,t])=>`${e}: ${t}`).join(`
|
|
241
241
|
`)),M(n.defaultOn),ne(null));let se=()=>{l(null),d(!1),oe(null),p(``),h(``),_(``),b(`stdio`),S(`npx`),w(``),E(``),O(``),A(``),M(!1),ee({}),ne(null),ae(null)},ce=()=>{se(),t()},le=e=>{l(e),d(!1),p(e.id),h(e.name),_(e.description),b(e.transport),S(e.defaultCommand??`npx`),w((e.defaultArgs??[]).join(` `)),E(Object.entries(e.defaultEnv??{}).map(([e,t])=>`${e}=${t}`).join(`
|
|
242
242
|
`)),O(e.defaultUrl??``),A(Object.entries(e.defaultHeaders??{}).map(([e,t])=>`${e}: ${t}`).join(`
|