@oonacode/win32-x64 0.3.224 → 0.3.226

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.
@@ -74,7 +74,7 @@ Error generating stack: `+e.message+`
74
74
 
75
75
  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 ua(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:pa(t,`input`,e.processors),output:pa(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function da(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 da(r.element,n);if(r.type===`set`)return da(r.valueType,n);if(r.type===`lazy`)return da(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 da(r.innerType,n);if(r.type===`intersection`)return da(r.left,n)||da(r.right,n);if(r.type===`record`||r.type===`map`)return da(r.keyType,n)||da(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:da(r.in,n)||da(r.out,n);if(r.type===`object`){for(let e in r.shape)if(da(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(da(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(da(e,n))return!0;return!!(r.rest&&da(r.rest,n))}return!1}var fa=(e,t={})=>n=>{let r=sa({...n,processors:t});return ca(e,r),la(r,e),ua(r,e)},pa=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=sa({...i??{},target:a,io:t,processors:n});return ca(e,o),la(o,e),ua(o,e)},ma={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ha=(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=ma[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}))])}},ga=(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)},_a=(e,t,n,r)=>{n.type=`boolean`},va=(e,t,n,r)=>{n.not={}},ya=(e,t,n,r)=>{let i=e._zod.def,a=We(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ba=(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}},xa=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Sa=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Ca=(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=ca(a.element,t,{...r,path:[...r.path,`items`]})},wa=(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]=ca(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=ca(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ta=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>ca(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ea=(e,t,n,r)=>{let i=e._zod.def,a=ca(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=ca(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]]},Da=(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=ca(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=ca(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=ca(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)}},Oa=(e,t,n,r)=>{let i=e._zod.def,a=ca(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`}]},ka=(e,t,n,r)=>{let i=e._zod.def;ca(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Aa=(e,t,n,r)=>{let i=e._zod.def;ca(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},ja=(e,t,n,r)=>{let i=e._zod.def;ca(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)))},Ma=(e,t,n,r)=>{let i=e._zod.def;ca(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},Na=(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;ca(o,t,r);let s=t.seen.get(e);s.ref=o},Pa=(e,t,n,r)=>{let i=e._zod.def;ca(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Fa=(e,t,n,r)=>{let i=e._zod.def;ca(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ia=V(`ZodISODateTime`,(e,t)=>{nr.init(e,t),co.init(e,t)});function La(e){return Oi(Ia,e)}var Ra=V(`ZodISODate`,(e,t)=>{rr.init(e,t),co.init(e,t)});function za(e){return ki(Ra,e)}var Ba=V(`ZodISOTime`,(e,t)=>{ir.init(e,t),co.init(e,t)});function Va(e){return Ai(Ba,e)}var Ha=V(`ZodISODuration`,(e,t)=>{ar.init(e,t),co.init(e,t)});function Ua(e){return ji(Ha,e)}var Wa=V(`ZodError`,(e,t)=>{Dt.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>At(e,t)},flatten:{value:t=>kt(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ge,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ge,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Ga=jt(Wa),Ka=Mt(Wa),qa=Nt(Wa),Ja=Ft(Wa),Ya=Lt(Wa),Xa=Rt(Wa),Za=zt(Wa),Qa=Bt(Wa),$a=Vt(Wa),eo=Ht(Wa),to=Ut(Wa),no=Wt(Wa),ro=new WeakMap;function io(e,t,n){let r=Object.getPrototypeOf(e),i=ro.get(r);if(i||(i=new Set,ro.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 ao=V(`ZodType`,(e,t)=>(Hn.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:pa(e,`input`),output:pa(e,`output`)}}),e.toJSONSchema=fa(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Ga(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>qa(e,t,n),e.parseAsync=async(t,n)=>Ka(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ja(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ya(e,t,n),e.decode=(t,n)=>Xa(e,t,n),e.encodeAsync=async(t,n)=>Za(e,t,n),e.decodeAsync=async(t,n)=>Qa(e,t,n),e.safeEncode=(t,n)=>$a(e,t,n),e.safeDecode=(t,n)=>eo(e,t,n),e.safeEncodeAsync=async(t,n)=>to(e,t,n),e.safeDecodeAsync=async(t,n)=>no(e,t,n),io(e,`ZodType`,{check(...e){let t=this.def;return this.clone($e(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 lt(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ss(e,t))},superRefine(e,t){return this.check(Cs(e,t))},overwrite(e){return this.check(Zi(e))},optional(){return is(this)},exactOptional(){return os(this)},nullable(){return cs(this)},nullish(){return is(cs(this))},nonoptional(e){return ms(this,e)},array(){return Bo(this)},or(e){return Wo([this,e])},and(e){return Jo(this,e)},transform(e){return vs(this,ns(e))},default(e){return us(this,e)},prefault(e){return fs(this,e)},catch(e){return gs(this,e)},pipe(e){return vs(this,e)},readonly(){return bs(this)},describe(e){let t=this.clone();return ii.add(t,{description:e}),t},meta(...e){if(e.length===0)return ii.get(this);let t=this.clone();return ii.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 ii.get(e)?.description},configurable:!0}),e)),oo=V(`_ZodString`,(e,t)=>{Un.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ha(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,io(e,`_ZodString`,{regex(...e){return this.check(Gi(...e))},includes(...e){return this.check(Ji(...e))},startsWith(...e){return this.check(Yi(...e))},endsWith(...e){return this.check(Xi(...e))},min(...e){return this.check(Ui(...e))},max(...e){return this.check(Hi(...e))},length(...e){return this.check(Wi(...e))},nonempty(...e){return this.check(Ui(1,...e))},lowercase(e){return this.check(Ki(e))},uppercase(e){return this.check(qi(e))},trim(){return this.check($i())},normalize(...e){return this.check(Qi(...e))},toLowerCase(){return this.check(ea())},toUpperCase(){return this.check(ta())},slugify(){return this.check(na())}})}),so=V(`ZodString`,(e,t)=>{Un.init(e,t),oo.init(e,t),e.email=t=>e.check(oi(lo,t)),e.url=t=>e.check(fi(po,t)),e.jwt=t=>e.check(Di(Oo,t)),e.emoji=t=>e.check(pi(mo,t)),e.guid=t=>e.check(si(uo,t)),e.uuid=t=>e.check(ci(fo,t)),e.uuidv4=t=>e.check(li(fo,t)),e.uuidv6=t=>e.check(ui(fo,t)),e.uuidv7=t=>e.check(di(fo,t)),e.nanoid=t=>e.check(mi(ho,t)),e.guid=t=>e.check(si(uo,t)),e.cuid=t=>e.check(hi(go,t)),e.cuid2=t=>e.check(gi(_o,t)),e.ulid=t=>e.check(_i(vo,t)),e.base64=t=>e.check(wi(To,t)),e.base64url=t=>e.check(Ti(Eo,t)),e.xid=t=>e.check(vi(yo,t)),e.ksuid=t=>e.check(yi(bo,t)),e.ipv4=t=>e.check(bi(xo,t)),e.ipv6=t=>e.check(xi(So,t)),e.cidrv4=t=>e.check(Si(Co,t)),e.cidrv6=t=>e.check(Ci(wo,t)),e.e164=t=>e.check(Ei(Do,t)),e.datetime=t=>e.check(La(t)),e.date=t=>e.check(za(t)),e.time=t=>e.check(Va(t)),e.duration=t=>e.check(Ua(t))});function U(e){return ai(so,e)}var co=V(`ZodStringFormat`,(e,t)=>{Wn.init(e,t),oo.init(e,t)}),lo=V(`ZodEmail`,(e,t)=>{qn.init(e,t),co.init(e,t)}),uo=V(`ZodGUID`,(e,t)=>{Gn.init(e,t),co.init(e,t)}),fo=V(`ZodUUID`,(e,t)=>{Kn.init(e,t),co.init(e,t)}),po=V(`ZodURL`,(e,t)=>{Jn.init(e,t),co.init(e,t)}),mo=V(`ZodEmoji`,(e,t)=>{Yn.init(e,t),co.init(e,t)}),ho=V(`ZodNanoID`,(e,t)=>{Xn.init(e,t),co.init(e,t)}),go=V(`ZodCUID`,(e,t)=>{Zn.init(e,t),co.init(e,t)}),_o=V(`ZodCUID2`,(e,t)=>{Qn.init(e,t),co.init(e,t)}),vo=V(`ZodULID`,(e,t)=>{$n.init(e,t),co.init(e,t)}),yo=V(`ZodXID`,(e,t)=>{er.init(e,t),co.init(e,t)}),bo=V(`ZodKSUID`,(e,t)=>{tr.init(e,t),co.init(e,t)}),xo=V(`ZodIPv4`,(e,t)=>{or.init(e,t),co.init(e,t)}),So=V(`ZodIPv6`,(e,t)=>{sr.init(e,t),co.init(e,t)}),Co=V(`ZodCIDRv4`,(e,t)=>{cr.init(e,t),co.init(e,t)}),wo=V(`ZodCIDRv6`,(e,t)=>{lr.init(e,t),co.init(e,t)}),To=V(`ZodBase64`,(e,t)=>{dr.init(e,t),co.init(e,t)}),Eo=V(`ZodBase64URL`,(e,t)=>{pr.init(e,t),co.init(e,t)}),Do=V(`ZodE164`,(e,t)=>{mr.init(e,t),co.init(e,t)}),Oo=V(`ZodJWT`,(e,t)=>{gr.init(e,t),co.init(e,t)}),ko=V(`ZodNumber`,(e,t)=>{_r.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ga(e,t,n,r),io(e,`ZodNumber`,{gt(e,t){return this.check(zi(e,t))},gte(e,t){return this.check(Bi(e,t))},min(e,t){return this.check(Bi(e,t))},lt(e,t){return this.check(Li(e,t))},lte(e,t){return this.check(Ri(e,t))},max(e,t){return this.check(Ri(e,t))},int(e){return this.check(Mo(e))},safe(e){return this.check(Mo(e))},positive(e){return this.check(zi(0,e))},nonnegative(e){return this.check(Bi(0,e))},negative(e){return this.check(Li(0,e))},nonpositive(e){return this.check(Ri(0,e))},multipleOf(e,t){return this.check(Vi(e,t))},step(e,t){return this.check(Vi(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 Ao(e){return Mi(ko,e)}var jo=V(`ZodNumberFormat`,(e,t)=>{vr.init(e,t),ko.init(e,t)});function Mo(e){return Ni(jo,e)}var No=V(`ZodBoolean`,(e,t)=>{yr.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_a(e,t,n,r)});function Po(e){return Pi(No,e)}var Fo=V(`ZodUnknown`,(e,t)=>{br.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Io(){return Fi(Fo)}var Lo=V(`ZodNever`,(e,t)=>{xr.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>va(e,t,n,r)});function Ro(e){return Ii(Lo,e)}var zo=V(`ZodArray`,(e,t)=>{Cr.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ca(e,t,n,r),e.element=t.element,io(e,`ZodArray`,{min(e,t){return this.check(Ui(e,t))},nonempty(e){return this.check(Ui(1,e))},max(e,t){return this.check(Hi(e,t))},length(e,t){return this.check(Wi(e,t))},unwrap(){return this.element}})});function Bo(e,t){return ra(zo,e,t)}var Vo=V(`ZodObject`,(e,t)=>{Or.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wa(e,t,n,r),Ze(e,`shape`,()=>t.shape),io(e,`ZodObject`,{keyof(){return Qo(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Io()})},loose(){return this.clone({...this._zod.def,catchall:Io()})},strict(){return this.clone({...this._zod.def,catchall:Ro()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return mt(this,e)},safeExtend(e){return ht(this,e)},merge(e){return gt(this,e)},pick(e){return ft(this,e)},omit(e){return pt(this,e)},partial(...e){return _t(rs,this,e[0])},required(...e){return vt(ps,this,e[0])}})});function Ho(e,t){return new Vo({type:`object`,shape:e??{},...H(t)})}var Uo=V(`ZodUnion`,(e,t)=>{Ar.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ta(e,t,n,r),e.options=t.options});function Wo(e,t){return new Uo({type:`union`,options:e,...H(t)})}var Go=V(`ZodDiscriminatedUnion`,(e,t)=>{Uo.init(e,t),jr.init(e,t)});function Ko(e,t,n){return new Go({type:`union`,options:t,discriminator:e,...H(n)})}var qo=V(`ZodIntersection`,(e,t)=>{Mr.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ea(e,t,n,r)});function Jo(e,t){return new qo({type:`intersection`,left:e,right:t})}var Yo=V(`ZodRecord`,(e,t)=>{Fr.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Da(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Xo(e,t,n){return!t||!t._zod?new Yo({type:`record`,keyType:U(),valueType:e,...H(t)}):new Yo({type:`record`,keyType:e,valueType:t,...H(n)})}var Zo=V(`ZodEnum`,(e,t)=>{Ir.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ya(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 Zo({...t,checks:[],...H(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 Zo({...t,checks:[],...H(r),entries:i})}});function Qo(e,t){return new Zo({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...H(t)})}var $o=V(`ZodLiteral`,(e,t)=>{Lr.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ba(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 es(e,t){return new $o({type:`literal`,values:Array.isArray(e)?e:[e],...H(t)})}var ts=V(`ZodTransform`,(e,t)=>{Rr.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sa(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ve(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Tt(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(Tt(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 ns(e){return new ts({type:`transform`,transform:e})}var rs=V(`ZodOptional`,(e,t)=>{Br.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function is(e){return new rs({type:`optional`,innerType:e})}var as=V(`ZodExactOptional`,(e,t)=>{Vr.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function os(e){return new as({type:`optional`,innerType:e})}var ss=V(`ZodNullable`,(e,t)=>{Hr.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function cs(e){return new ss({type:`nullable`,innerType:e})}var ls=V(`ZodDefault`,(e,t)=>{Ur.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function us(e,t){return new ls({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ot(t)}})}var ds=V(`ZodPrefault`,(e,t)=>{Gr.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ja(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fs(e,t){return new ds({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ot(t)}})}var ps=V(`ZodNonOptional`,(e,t)=>{Kr.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ka(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ms(e,t){return new ps({type:`nonoptional`,innerType:e,...H(t)})}var hs=V(`ZodCatch`,(e,t)=>{Jr.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ma(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function gs(e,t){return new hs({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var _s=V(`ZodPipe`,(e,t)=>{Yr.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Na(e,t,n,r),e.in=t.in,e.out=t.out});function vs(e,t){return new _s({type:`pipe`,in:e,out:t})}var ys=V(`ZodReadonly`,(e,t)=>{Zr.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bs(e){return new ys({type:`readonly`,innerType:e})}var xs=V(`ZodCustom`,(e,t)=>{$r.init(e,t),ao.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xa(e,t,n,r)});function Ss(e,t={}){return ia(xs,e,t)}function Cs(e,t){return aa(e,t)}var ws={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 Ts(e){return(e.credentialVariants??[]).filter(e=>!e.operatorOnly)}function Es(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 Ds(e,t){return e.filter(e=>e.definition.id===t||e.definition.clientGroup===t&&e.definition.id!==t)}function Os(e){return Es(e).filter(e=>e.definition.enabled&&e.definition.credentialClass!==`none`&&e.definition.poolOnly!==!0&&T(e.definition.id)&&!D(e.definition.id))}function ks(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 As(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}:ks(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 js=Ko(`type`,[Ho({type:es(`oauth-device`),deviceAuthorizationUrl:U().url(),tokenUrl:U().url(),clientId:U().min(1),scopes:Bo(U().min(1)).min(1),signInLabel:U().min(1).optional(),referrer:U().min(1).optional()}),Ho({type:es(`openai-device`),deviceAuthorizationUrl:U().url(),pollUrl:U().url(),tokenUrl:U().url(),verificationUri:U().url(),redirectUri:U().url(),clientId:U().min(1),signInLabel:U().min(1).optional()})]),Ms=Ho({type:es(`google-loopback`),authorizationUrl:U().url(),tokenUrl:U().url(),redirectUri:U().url(),scopes:Bo(U().min(1)).min(1),clientIdSetting:U().min(1),clientSecretSetting:U().min(1),userinfoUrl:U().url().optional(),signInLabel:U().min(1).optional()}),Ns=Ho({id:U().min(1),displayName:U().min(1),upstreamId:U().min(1).optional(),servedBy:Bo(U().min(1)).optional(),subscriptionServedBy:Bo(U().min(1)).optional(),contextWindow:Ao().int().positive().optional(),maxOutputTokens:Ao().int().positive().optional(),supportsTools:Po().optional(),supportsThinking:Po().optional(),effortLevels:Bo(Qo(ye)).optional(),helperModel:U().min(1).optional(),supportsVision:Po().optional(),inputPricePerM:Ao().nonnegative().optional(),outputPricePerM:Ao().nonnegative().optional(),creditsPerM:Ho({input:Ao().nonnegative(),output:Ao().nonnegative(),maxInput:Ao().nonnegative().optional(),maxOutput:Ao().nonnegative().optional()}).optional(),notes:U().optional(),free:Po().optional(),aaIntelligence:Ao().optional(),aaCoding:Ao().optional(),aaOutputTps:Ao().optional(),aaTtft:Ao().optional(),aa:Ho({fetchedAt:U(),creator:U().optional(),releaseDate:U().optional(),benchmarks:Xo(U(),Ao()).optional()}).loose().optional()}).loose(),Ps=Ho({id:U().regex(/^[a-z0-9][a-z0-9-]{1,40}$/,`provider id must be lowercase kebab-case`),displayName:U().min(1),kind:Qo([`anthropic-passthrough`,`openai-compatible`,`gemini`]),route:Qo([`gateway`,`direct`]),credentialClass:Qo([`api_key`,`subscription`,`none`]),baseUrl:U().url(),messagesPath:U().startsWith(`/`).optional(),modelsPath:U().startsWith(`/`).optional(),auth:Ho({header:Qo([`x-api-key`,`authorization-bearer`,`api-key`,`none`]),extraHeaders:Xo(U(),U()).optional()}),models:Bo(Ns),defaultModel:U().min(1),modelAliases:Xo(U(),U()).optional(),helperModel:U().min(1).optional(),capabilities:Ho({streaming:Po(),tools:Po(),thinking:Po(),vision:Po(),countTokens:Po(),promptCaching:Po(),promptCacheTtlSec:Ao().int().positive().optional()}),translate:Ho({maxTokensParam:Qo([`max_tokens`,`max_completion_tokens`]).optional(),reasoningEffortFromBudget:Po().optional(),reasoningContentField:U().nullable().optional(),supportsParallelToolCalls:Po().optional(),systemRole:Qo([`system`,`developer`]).optional(),streamIncludeUsage:Po().optional(),wire:Qo([`chat`,`responses`,`gemini-code-assist`]).optional()}).optional(),passthrough:Ho({stripCacheControl:Po().optional(),cacheChain:Po().optional(),toolSchemaRequiredArray:Po().optional(),toolDescriptionRequired:Po().optional(),keepOutputConfig:Po().optional(),allowedBetas:Bo(U()).optional(),anthropicVersion:U().optional()}).optional(),userBaseUrl:Po().optional(),engineEnv:Xo(U(),U()).optional(),directCapable:Po().optional(),subscriptionLogin:js.optional(),poolOnly:Po().optional(),phase:Wo([es(1),es(2)]),enabled:Po(),docsUrl:U().url().optional(),notes:U().optional(),references:Bo(Ho({label:U().min(1),url:U().url(),kind:Qo([`docs`,`pricing`,`models`,`console`,`status`,`keys`,`signup`,`other`]).optional()})).optional(),keyFormat:U().optional(),credentialVariants:Bo(Ho({id:U().min(1),label:U().min(1),header:Qo([`x-api-key`,`authorization-bearer`,`api-key`,`none`]).optional(),extraHeaders:Xo(U(),U()).optional(),operatorOnly:Po().optional(),requiresClaudeCodeIdentity:Po().optional(),subscriptionLogin:js.optional(),loopbackLogin:Ms.optional(),agyLogin:Ho({type:es(`agy-server`),signInLabel:U().optional()}).optional(),claudeCodeShape:Ho({betas:U().min(1),userAgent:U().min(1),billingHeader:U().min(1),headers:Xo(U(),U()).optional()}).optional(),baseUrl:U().url().optional(),keyFormat:U().optional(),notes:U().optional()})).optional(),adminGroup:U().optional(),clientGroup:U().optional(),recordLabel:U().optional(),engine:es(`agy`).optional(),effortLevels:Bo(Qo(ye)).optional()});Ho({version:Ao().int().positive(),updatedAt:U(),providers:Bo(Ps)});function Fs(e,t){return Is(e,Gs(e,t))}function Is(e,t){return e.models.find(e=>e.id===t)?.upstreamId??t}function Ls(e){return/^claude-/i.test(e)}function Rs(e){return/^claude-.+-\d{8}$/i.test(e)?e.replace(/-\d{8}$/,``):null}function zs(e){return e.replace(/\[1m\]$/i,``)}var Bs=new Set([`opus`,`sonnet`,`haiku`,`fable`]);function Vs(e){return Bs.has(e.toLowerCase())}function Hs(e,t){let n=zs(t);if(Vs(n)||e.models.some(e=>e.id===n))return null;let r=e.modelAliases;if(!r)return null;let i=Rs(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 Us(e,t){return{images:e.models.find(e=>e.id===t)?.supportsVision??e.capabilities.vision,documents:Ls(t)}}function Ws(e,t,n){let r=Us(e,t),i=new Set;for(let e of n){let t=e?.type;(t===`image`||t===`document`)&&i.add(t)}let a=e.models.find(e=>e.id===t)?.displayName??t;return i.has(`image`)&&!r.images?`${a} cannot read images. Remove the image, or pick a model that can — the model details say which.`:i.has(`document`)&&!r.documents?`${a} cannot read PDF documents — only Anthropic's Claude models take a PDF. Attach it as text, or pick a Claude model.`:null}function Gs(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=Hs(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 Ks={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`,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`,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`},qs=2048,Js=16384,Ys=8e3,Xs=5242880,Zs=12582912;new Set(`BCDFGHJKLMNPQRSTVWXZ`.split(``));var Qs=`discard-my-vault-and-history`,$s=`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.`,ec={name:120,instructions:2e4,goal:2e3,repositories:50,repositoryUrl:500,memory:2e4,minIntervalFloor:1,minIntervalCeiling:10080},tc=`⏰ Scheduled task "`;function nc(e){if(!e.startsWith(tc))return null;let t=e.indexOf(`"
76
76
 
77
- `,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 rc(e){return e===null||!Number.isFinite(e)?`neutral`:e>30?`ok`:e>10?`warn`:`danger`}var ic=[`mon`,`tue`,`wed`,`thu`,`fri`,`sat`,`sun`],ac=/^([01]\d|2[0-3]):[0-5]\d$/;Ho({tz:U().min(1),windows:Bo(Ho({from:U().regex(ac,`HH:MM`),to:U().regex(ac,`HH:MM`),days:Bo(Qo(ic)).optional(),kind:Qo([`peak`,`offpeak`])})),offpeakDiscount:Ao().nonnegative().max(1).optional()});var oc=[`priceInputCacheMissPeak`,`priceInputCacheMissOffpeak`,`priceInputCacheHitPeak`,`priceInputCacheHitOffpeak`,`priceCacheWritePeak`,`priceCacheWriteOffpeak`,`priceOutputPeak`,`priceOutputOffpeak`],sc=Ho({inputCacheMiss:Ao().nonnegative(),inputCacheHit:Ao().nonnegative().optional(),cacheWrite:Ao().nonnegative().optional(),output:Ao().nonnegative()});Ho({by:es(`prompt_tokens`),tiers:Bo(Ho({upToPromptTokens:Ao().int().positive().optional(),price:sc.optional(),cost:sc.optional()})).min(1),note:U().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})}),[...oc];var cc={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`};cc.realtime,cc.translations,cc.live,cc.speechStream,cc.transcriptionStream;var lc=`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`,uc=`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`,dc=`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`,fc=`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`,pc={oonacode:{hex:`#000000`,owner:`OonaCode`,d:lc,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:dc},xai:{hex:`#000000`,owner:`xAI`,d:uc},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:uc},"openai-subscription":{hex:`#000000`,owner:`OpenAI`,d:dc},"google-agy":{hex:`#8E75B2`,owner:`Google`,d:fc},antigravity:{hex:`#8E75B2`,owner:`Google`,d:fc},glm:{hex:`#2D2D2D`,owner:`Z.ai`,d:`M12.606 1.806l-1.677 2.388c-0.258 0.374-0.697 0.606-1.161 0.606h-9.162V1.794C0.594 1.806 12.606 1.806 12.606 1.806zM24 1.806L9.6 22.206 0 22.206 14.4 1.806zM11.394 22.206l1.69-2.4c0.258-0.374 0.697-0.606 1.161-0.606h9.149v3.006H11.394z`},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 mc(e){return pc[e]??null}function hc(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 gc=9230,_c=1024,vc=65534,yc=`127.0.0.1`;Object.freeze({enabled:!1,port:gc,inspectMain:!1}),Object.freeze({port:null,listening:!1,fromCommandLine:!1,inspectPort:null,inspectProblem:null});function bc(e){return e+1}function xc(e){return typeof e==`number`&&Number.isInteger(e)}function Sc(e){return!xc(e)||e<1024||e>65534?`The port must be a whole number from ${_c.toLocaleString(`en-US`)} to ${vc.toLocaleString(`en-US`)} (the main-process inspector takes the next one).`:null}function Cc(e){return e.port!==null||e.inspectPort!==null}function wc(e,t){let n=e.enabled?e.port:null,r=e.enabled&&e.inspectMain?bc(e.port):null;return!t.fromCommandLine&&t.port!==n||t.inspectPort!==r}function Tc(e){let t=[];return e.port!==null&&t.push(`${yc}:${e.port}`),e.inspectPort!==null&&t.push(`${yc}:${e.inspectPort}`),t.length===2?`${t[0]} (windows) and ${t[1]} (main process)`:e.inspectPort===null?t[0]??``:`${t[0]} (main process)`}var Ec=[`stable`,`dev`];function Dc(e){return typeof e==`string`&&Ec.includes(e)}function Oc(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return Dc(t)?t:null}var kc=[`win32`,`linux`,`darwin`],Ac=[`x64`,`arm64`];function jc(e,t){let n=Oc(e)??`stable`,r=[];return n!==`stable`&&r.push(`channel=${encodeURIComponent(n)}`),t&&kc.includes(t.platform)&&(r.push(`platform=${t.platform}`),t.arch&&Ac.includes(t.arch)&&r.push(`arch=${t.arch}`)),r.length>0?`${Ks.releasesLatest}?${r.join(`&`)}`:Ks.releasesLatest}function Mc(e,t){let n=Oc(t)??`stable`;return n===`stable`?e:`${e} (${n})`}var Nc={safeguards:`safeguards`,safety_filters:`safety filters`},Pc=[{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}],Fc=/blocked by (?:the )?(?:content[ -]safety|Gemini(?:'s)?) filters?|content safety filters?|blocked by Gemini(?:'s)? filters?/i,Ic=/blocked by Gemini(?:'s)? filters|Gemini(?:'s)? filters\.? They can occasionally trigger/i;function Lc(e){return typeof e==`string`&&Ic.test(e)}function Rc(e){return typeof e!=`string`||e===``||!/^\s*(?:Failed to authenticate\.\s*)?API Error\b/i.test(e)?null:Pc.find(t=>t.pattern.test(e))??null}function zc(e){return typeof e==`string`&&(Lc(e)||Fc.test(e)&&/blocked/i.test(e))}var Bc=`:free`;function Vc(e){return e.endsWith(Bc)}function Hc(e){return Vc(e)?e.slice(0,-5):e}var Uc=`model_refusal_fallback`,Wc=`model_refusal_no_fallback`;function Gc(e){return typeof e==`string`&&e.trim()!==``?e.trim():null}function Kc(e,t,n){return Gc(e[t])??Gc(e[n])}function qc(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:Kc(t,`original_model`,`originalModel`),fallbackModel:r===`fallback`?Kc(t,`fallback_model`,`fallbackModel`):null,category:Kc(t,`api_refusal_category`,`apiRefusalCategory`)??Gc(t.category),explanation:Kc(t,`api_refusal_explanation`,`apiRefusalExplanation`)??Gc(t.explanation),text:typeof t.content==`string`?t.content.trim():Gc(t.text)??``,retractedUuids:Array.isArray(i)?i.filter(e=>typeof e==`string`):[]}}function Jc(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 Yc(e,t){return!e||t.alive===!1||!e.live&&t.since!==null&&e.at!==null&&e.at<t.since?null:e}function Xc(e){let t=zs(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 Zc(e,t=[]){let n=zs(e.trim()),r=null;for(let e of t)for(let t of e.definition.models){if(t.id===n||zs(t.id)===n)return t.displayName;r===null&&(t.upstreamId===n||Hc(t.id)===n)&&(r=t.displayName)}return r??Xc(n)}function Qc(e){return`${e} (safeguard)`}var $c=`none`,el={mode:`auto`,model:null,perModel:{}};function tl(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 nl(e){return zs(e.trim()).toLowerCase()}function rl(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e:{},n=tl(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=tl(e),r=t===`none`?$c:tl(t);if(n!==null&&r!==null&&nl(n)!==nl(r)&&(a[nl(n)]=r,Object.keys(a).length>=64))break}return{mode:i,model:i===`model`?n:null,perModel:a}}function il(e){return e===w}var al=`oona settings safeguard-fallback auto`;function ol(e,t=[]){if(!e)return`the model`;let n=nl(e);return t.find(e=>nl(e.id)===n||e.upstreamId&&nl(e.upstreamId)===n)?.displayName??Xc(e)}function sl(e,t=e=>ol(e)){let n=`blocked by ${Nc[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 (${al})`;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 cl=5e4,ll=6,ul=[`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`],dl={agentFinished:!1,permissionRequired:!0,errorOccurred:!0},fl={autoAcceptPermissions:!1,safeguardFallback:el,showReasoningSummaries:!0,notifications:dl,showAgentPicker:!0,transcriptWindowSize:500,openTabs:[],draftTabs:[],draftTitles:{},activeTab:null,editorLayout:null,remoteTabs:{},sessionPanelOpen:!1,explorerOpen:!1,sidebarWidth:288,sidebarPinned:!0,dismissedUpdateVersion:null,lastSeenReleaseNotes:null,claudeImportOffered:!1,claudeImportOffers:0,collapsedProjects:[],themeColors:{light:{},dark:{}},pinned:[],sidebarView:`recent`};function pl(e){return Math.min(Math.max(typeof e==`number`&&Number.isFinite(e)?Math.floor(e):0,0),3)}function ml(e){return Math.min(640,Math.max(200,typeof e==`number`&&Number.isFinite(e)?Math.round(e):288))}function hl(e){return Math.min(cl,Math.max(100,typeof e==`number`&&Number.isFinite(e)?Math.round(e):500))}function gl(e,t){return typeof e==`boolean`?e:t}function _l(e){return typeof e==`string`&&e.length>0&&e.length<=64?e:null}function vl(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 yl(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 bl(e){if(typeof e!=`string`)return null;let t=e.trim();return/^#[0-9a-fA-F]{6}$/.test(t)?t.toLowerCase():null}function xl(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e)){if(!ul.includes(n))continue;let e=bl(r);e!==null&&(t[n]=e)}return t}function Sl(e){let t=typeof e==`object`&&e?e:{};return{light:xl(t.light),dark:xl(t.dark)}}function Cl(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 wl(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>ll||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 Tl(e,t,n){return e.some(e=>e.kind===t&&e.id===n)}function El(e,t,n,r){return r===Tl(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 Dl(e){let t=typeof e==`object`&&e?e:{},n=typeof t.notifications==`object`&&t.notifications!==null?t.notifications:{},r=vl(t.openTabs),i=vl(t.draftTabs).filter(e=>!r.includes(e)),a={};for(let[e,n]of Object.entries(yl(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;return{autoAcceptPermissions:gl(t.autoAcceptPermissions,fl.autoAcceptPermissions),safeguardFallback:rl(t.safeguardFallback),showReasoningSummaries:gl(t.showReasoningSummaries,fl.showReasoningSummaries),notifications:{agentFinished:gl(n.agentFinished,dl.agentFinished),permissionRequired:gl(n.permissionRequired,dl.permissionRequired),errorOccurred:gl(n.errorOccurred,dl.errorOccurred)},showAgentPicker:gl(t.showAgentPicker,fl.showAgentPicker),transcriptWindowSize:hl(t.transcriptWindowSize),openTabs:r,draftTabs:i,draftTitles:a,activeTab:c,editorLayout:wl(t.editorLayout,o),remoteTabs:yl(t.remoteTabs),sessionPanelOpen:gl(t.sessionPanelOpen,fl.sessionPanelOpen),explorerOpen:gl(t.explorerOpen,fl.explorerOpen),sidebarWidth:ml(t.sidebarWidth),sidebarPinned:gl(t.sidebarPinned,fl.sidebarPinned),dismissedUpdateVersion:_l(t.dismissedUpdateVersion),lastSeenReleaseNotes:_l(t.lastSeenReleaseNotes),claudeImportOffered:gl(t.claudeImportOffered,fl.claudeImportOffered),claudeImportOffers:pl(t.claudeImportOffers),collapsedProjects:vl(t.collapsedProjects),themeColors:Sl(t.themeColors),pinned:Cl(t.pinned),sidebarView:t.sidebarView===`projects`?`projects`:`recent`}}new Set(Object.keys(fl));var Ol=3650,kl=[{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 Al(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:jl(r.pre,i.pre)}function jl(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 Ml(e,t,n=kl,r=null){if(!e||e===`0.0.0`)return[];let i=n.filter(t=>Al(t.version,e)<=0&&(!r||!t.platforms||t.platforms.includes(r)));return[...t===null?i.filter(t=>Al(t.version,e)===0):i.filter(e=>Al(e.version,t)>0)].sort((e,t)=>Al(t.version,e.version))}function Nl(e,t,n,r=kl,i=null){if(!e||e===`0.0.0`)return{record:null,show:[]};let a=null;for(let e of r)(a===null||Al(e.version,a)>0)&&(a=e.version);let o=a!==null&&Al(e,a)>0?a:e;return{record:t===null||Al(o,t)>0?o:null,show:t===null&&!n?[]:Ml(e,t,r,i)}}function Pl(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 Fl=`the user skipped the question`,Il=`(the user skipped this question)`;function Ll(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 Rl(e,t,n={},r=new Set){let i={};return e.forEach((e,a)=>{if(r.has(a)){i[e.question]=Il;return}let o=(n[a]??``).trim();i[e.question]=o||(t[a]??[]).join(`, `)}),i}function zl(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 Bl(e){if(!e||typeof e!=`object`)return null;let t=e.answers;return t&&typeof t==`object`&&!Array.isArray(t)?t:null}var Vl=[`oauth`,`token`];function Hl(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 Ul=U().refine(e=>/^https:\/\/[^\s]+$/i.test(e),`must be an https address`),Wl=Ho({vendor:U().min(1).max(60),mcpUrl:Ul,readOnlyQuery:Xo(U(),U()).nullable(),auth:Ho({methods:Bo(Qo(Vl)).min(1),scopes:Bo(U()),offlineAccess:Po(),token:Ho({label:U(),createUrl:Ul,note:U().nullable()}).nullable()}),tools:Ho({deny:Bo(U()),allowWrites:Bo(U()),featured:Bo(U()),maxResultChars:Ao().int().min(1e3).max(2e5)}),cli:Ho({command:U().regex(/^[A-Za-z0-9._-]{1,40}$/),versionArg:U().regex(/^--?[A-Za-z0-9-]{1,20}$/),install:Xo(U(),U()),login:Ho({command:U(),tokenEnv:U().nullable()}),purpose:U()}).nullable(),skills:Bo(Ho({name:U().regex(/^[a-z0-9][a-z0-9_-]{0,47}$/),source:Ho({repo:U().regex(/^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/),ref:U().regex(/^[0-9a-f]{40}$/,`pin a full commit, never a branch`),path:U().refine(e=>!/(^|[\\/])\.\.([\\/]|$)|^[\\/]/.test(e),`relative path`)}),license:U(),exclude:Bo(U())})),docsUrl:Ul}).loose();function Gl(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 Kl(e){let t=Object.keys(e.arguments).slice(0,8);return`${e.vendor}: ${e.tool}${t.length>0?` (${t.join(`, `)})`:``}`}var ql=[`win32`,`linux`,`darwin`],Jl=[`demo`,`live`],Yl=[`allow`,`ask`],Xl=[`string`,`number`,`integer`,`boolean`,`array`,`object`];function Zl(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 Ql(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 $l(e,t){let n=t?.[e.slug];return typeof n==`boolean`?n:e.defaultOn}function eu(e,t){return e.filter(e=>$l(e,t))}var tu={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},nu=/^[A-Za-z0-9_-]+$/;function ru(e){return typeof e==`string`&&e.length>0&&e.length<=tu.entryTool&&nu.test(e)}function iu(e){return Math.ceil(e.length/4)}function au(e){return iu(`${e.entryTool} ${e.description}`)+55}function ou(e){return e.tokensPerRequest??au(e)+(e.promptLine?iu(e.promptLine):0)}var su=Ho({type:Qo(Xl),required:Po().optional(),enum:Bo(Wo([U(),Ao()])).optional(),description:U().optional()}),cu=Ho({slug:U().min(1),description:U(),params:Xo(U(),su),permission:Qo(Yl),sort:Ao()}),lu=Ho({version:U(),url:U(),sha256:U(),sizeBytes:Ao(),exe:U(),format:es(`zip`)}),uu=Ho({slug:U().min(1),name:U(),entryTool:U().refine(ru,`not a valid tool name`),description:U(),promptLine:U().nullable(),details:U().nullable().optional(),status:Qo(Jl),defaultOn:Po(),sort:Ao(),install:lu.nullable(),actions:Bo(cu),connector:Wl.nullable().optional().catch(null)}).loose();Ho({platform:Qo(ql),version:U(),packs:Bo(uu),refreshMinutes:Ao()});var du=Qo([`stdio`,`sse`,`http`]),fu=Ho({id:U().trim().regex(/^[a-z0-9][a-z0-9._-]{0,63}$/i,`ID must be 1-64 alphanumeric, dash, dot, or underscore characters`),name:U().trim().min(1).max(100),description:U().max(500).optional(),transport:du,command:U().min(1).max(500).optional(),args:Bo(U()).max(100).optional(),env:Xo(U(),U()).optional(),url:U().url().max(2e3).optional(),headers:Xo(U(),U()).optional(),defaultOn:Po(),enabled:Po().optional(),catalogId:U().max(100).optional()});fu.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`}),fu.partial(),Xo(U().regex(/^[a-z0-9][a-z0-9._-]{0,63}$/i),Po()).refine(e=>Object.keys(e).length<=128,`At most 128 MCP server switches`);function pu(e,t){if(e.enabled===!1)return!1;let n=t?t[e.id]:void 0;return typeof n==`boolean`?n:e.defaultOn}function mu(e,t,n){return{...e??{},[t]:n}}var hu=[{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`}],gu=[{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`}]}],_u=[`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(`
77
+ `,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 rc(e){return e===null||!Number.isFinite(e)?`neutral`:e>30?`ok`:e>10?`warn`:`danger`}var ic=[`mon`,`tue`,`wed`,`thu`,`fri`,`sat`,`sun`],ac=/^([01]\d|2[0-3]):[0-5]\d$/;Ho({tz:U().min(1),windows:Bo(Ho({from:U().regex(ac,`HH:MM`),to:U().regex(ac,`HH:MM`),days:Bo(Qo(ic)).optional(),kind:Qo([`peak`,`offpeak`])})),offpeakDiscount:Ao().nonnegative().max(1).optional()});var oc=[`priceInputCacheMissPeak`,`priceInputCacheMissOffpeak`,`priceInputCacheHitPeak`,`priceInputCacheHitOffpeak`,`priceCacheWritePeak`,`priceCacheWriteOffpeak`,`priceOutputPeak`,`priceOutputOffpeak`],sc=Ho({inputCacheMiss:Ao().nonnegative(),inputCacheHit:Ao().nonnegative().optional(),cacheWrite:Ao().nonnegative().optional(),output:Ao().nonnegative()});Ho({by:es(`prompt_tokens`),tiers:Bo(Ho({upToPromptTokens:Ao().int().positive().optional(),price:sc.optional(),cost:sc.optional()})).min(1),note:U().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})}),[...oc];var cc={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`};cc.realtime,cc.translations,cc.live,cc.speechStream,cc.transcriptionStream;var lc=`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`,uc=`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`,dc=`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`,fc=`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`,pc={oonacode:{hex:`#000000`,owner:`OonaCode`,d:lc,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:dc},xai:{hex:`#000000`,owner:`xAI`,d:uc},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:uc},"openai-subscription":{hex:`#000000`,owner:`OpenAI`,d:dc},"google-agy":{hex:`#8E75B2`,owner:`Google`,d:fc},antigravity:{hex:`#8E75B2`,owner:`Google`,d:fc},glm:{hex:`#2D2D2D`,owner:`Z.ai`,d:`M12.606 1.806l-1.677 2.388c-0.258 0.374-0.697 0.606-1.161 0.606h-9.162V1.794C0.594 1.806 12.606 1.806 12.606 1.806zM24 1.806L9.6 22.206 0 22.206 14.4 1.806zM11.394 22.206l1.69-2.4c0.258-0.374 0.697-0.606 1.161-0.606h9.149v3.006H11.394z`},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 mc(e){return pc[e]??null}function hc(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 gc=9230,_c=1024,vc=65534,yc=`127.0.0.1`;Object.freeze({enabled:!1,port:gc,inspectMain:!1}),Object.freeze({port:null,listening:!1,fromCommandLine:!1,inspectPort:null,inspectProblem:null});function bc(e){return e+1}function xc(e){return typeof e==`number`&&Number.isInteger(e)}function Sc(e){return!xc(e)||e<1024||e>65534?`The port must be a whole number from ${_c.toLocaleString(`en-US`)} to ${vc.toLocaleString(`en-US`)} (the main-process inspector takes the next one).`:null}function Cc(e){return e.port!==null||e.inspectPort!==null}function wc(e,t){let n=e.enabled?e.port:null,r=e.enabled&&e.inspectMain?bc(e.port):null;return!t.fromCommandLine&&t.port!==n||t.inspectPort!==r}function Tc(e){let t=[];return e.port!==null&&t.push(`${yc}:${e.port}`),e.inspectPort!==null&&t.push(`${yc}:${e.inspectPort}`),t.length===2?`${t[0]} (windows) and ${t[1]} (main process)`:e.inspectPort===null?t[0]??``:`${t[0]} (main process)`}var Ec=[`stable`,`dev`];function Dc(e){return typeof e==`string`&&Ec.includes(e)}function Oc(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return Dc(t)?t:null}var kc=[`win32`,`linux`,`darwin`],Ac=[`x64`,`arm64`];function jc(e,t){let n=Oc(e)??`stable`,r=[];return n!==`stable`&&r.push(`channel=${encodeURIComponent(n)}`),t&&kc.includes(t.platform)&&(r.push(`platform=${t.platform}`),t.arch&&Ac.includes(t.arch)&&r.push(`arch=${t.arch}`)),r.length>0?`${Ks.releasesLatest}?${r.join(`&`)}`:Ks.releasesLatest}function Mc(e,t){let n=Oc(t)??`stable`;return n===`stable`?e:`${e} (${n})`}var Nc={safeguards:`safeguards`,safety_filters:`safety filters`},Pc=[{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}],Fc=/blocked by (?:the )?(?:content[ -]safety|Gemini(?:'s)?) filters?|content safety filters?|blocked by Gemini(?:'s)? filters?/i,Ic=/blocked by Gemini(?:'s)? filters|Gemini(?:'s)? filters\.? They can occasionally trigger/i;function Lc(e){return typeof e==`string`&&Ic.test(e)}function Rc(e){return typeof e!=`string`||e===``||!/^\s*(?:Failed to authenticate\.\s*)?API Error\b/i.test(e)?null:Pc.find(t=>t.pattern.test(e))??null}function zc(e){return typeof e==`string`&&(Lc(e)||Fc.test(e)&&/blocked/i.test(e))}var Bc=`:free`;function Vc(e){return e.endsWith(Bc)}function Hc(e){return Vc(e)?e.slice(0,-5):e}var Uc=`model_refusal_fallback`,Wc=`model_refusal_no_fallback`;function Gc(e){return typeof e==`string`&&e.trim()!==``?e.trim():null}function Kc(e,t,n){return Gc(e[t])??Gc(e[n])}function qc(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:Kc(t,`original_model`,`originalModel`),fallbackModel:r===`fallback`?Kc(t,`fallback_model`,`fallbackModel`):null,category:Kc(t,`api_refusal_category`,`apiRefusalCategory`)??Gc(t.category),explanation:Kc(t,`api_refusal_explanation`,`apiRefusalExplanation`)??Gc(t.explanation),text:typeof t.content==`string`?t.content.trim():Gc(t.text)??``,retractedUuids:Array.isArray(i)?i.filter(e=>typeof e==`string`):[]}}function Jc(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 Yc(e,t){return!e||t.alive===!1||!e.live&&t.since!==null&&e.at!==null&&e.at<t.since?null:e}function Xc(e){let t=zs(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 Zc(e,t=[]){let n=zs(e.trim()),r=null;for(let e of t)for(let t of e.definition.models){if(t.id===n||zs(t.id)===n)return t.displayName;r===null&&(t.upstreamId===n||Hc(t.id)===n)&&(r=t.displayName)}return r??Xc(n)}function Qc(e){return`${e} (safeguard)`}var $c=`none`,el={mode:`auto`,model:null,perModel:{}};function tl(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 nl(e){return zs(e.trim()).toLowerCase()}function rl(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e:{},n=tl(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=tl(e),r=t===`none`?$c:tl(t);if(n!==null&&r!==null&&nl(n)!==nl(r)&&(a[nl(n)]=r,Object.keys(a).length>=64))break}return{mode:i,model:i===`model`?n:null,perModel:a}}function il(e){return e===w}var al=`oona settings safeguard-fallback auto`;function ol(e,t=[]){if(!e)return`the model`;let n=nl(e);return t.find(e=>nl(e.id)===n||e.upstreamId&&nl(e.upstreamId)===n)?.displayName??Xc(e)}function sl(e,t=e=>ol(e)){let n=`blocked by ${Nc[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 (${al})`;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 cl=5e4,ll=6,ul=[`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`],dl={agentFinished:!1,permissionRequired:!0,errorOccurred:!0},fl={autoAcceptPermissions:!1,safeguardFallback:el,showReasoningSummaries:!0,notifications:dl,showAgentPicker:!0,transcriptWindowSize:500,openTabs:[],draftTabs:[],draftTitles:{},activeTab:null,editorLayout:null,remoteTabs:{},sessionPanelOpen:!1,explorerOpen:!1,sidebarWidth:288,sidebarPinned:!0,dismissedUpdateVersion:null,lastSeenReleaseNotes:null,claudeImportOffered:!1,claudeImportOffers:0,collapsedProjects:[],themeColors:{light:{},dark:{}},pinned:[],sidebarView:`recent`};function pl(e){return Math.min(Math.max(typeof e==`number`&&Number.isFinite(e)?Math.floor(e):0,0),3)}function ml(e){return Math.min(640,Math.max(200,typeof e==`number`&&Number.isFinite(e)?Math.round(e):288))}function hl(e){return Math.min(cl,Math.max(100,typeof e==`number`&&Number.isFinite(e)?Math.round(e):500))}function gl(e,t){return typeof e==`boolean`?e:t}function _l(e){return typeof e==`string`&&e.length>0&&e.length<=64?e:null}function vl(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 yl(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 bl(e){if(typeof e!=`string`)return null;let t=e.trim();return/^#[0-9a-fA-F]{6}$/.test(t)?t.toLowerCase():null}function xl(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e)){if(!ul.includes(n))continue;let e=bl(r);e!==null&&(t[n]=e)}return t}function Sl(e){let t=typeof e==`object`&&e?e:{};return{light:xl(t.light),dark:xl(t.dark)}}function Cl(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 wl(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>ll||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 Tl(e,t,n){return e.some(e=>e.kind===t&&e.id===n)}function El(e,t,n,r){return r===Tl(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 Dl(e){let t=typeof e==`object`&&e?e:{},n=typeof t.notifications==`object`&&t.notifications!==null?t.notifications:{},r=vl(t.openTabs),i=vl(t.draftTabs).filter(e=>!r.includes(e)),a={};for(let[e,n]of Object.entries(yl(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;return{autoAcceptPermissions:gl(t.autoAcceptPermissions,fl.autoAcceptPermissions),safeguardFallback:rl(t.safeguardFallback),showReasoningSummaries:gl(t.showReasoningSummaries,fl.showReasoningSummaries),notifications:{agentFinished:gl(n.agentFinished,dl.agentFinished),permissionRequired:gl(n.permissionRequired,dl.permissionRequired),errorOccurred:gl(n.errorOccurred,dl.errorOccurred)},showAgentPicker:gl(t.showAgentPicker,fl.showAgentPicker),transcriptWindowSize:hl(t.transcriptWindowSize),openTabs:r,draftTabs:i,draftTitles:a,activeTab:c,editorLayout:wl(t.editorLayout,o),remoteTabs:yl(t.remoteTabs),sessionPanelOpen:gl(t.sessionPanelOpen,fl.sessionPanelOpen),explorerOpen:gl(t.explorerOpen,fl.explorerOpen),sidebarWidth:ml(t.sidebarWidth),sidebarPinned:gl(t.sidebarPinned,fl.sidebarPinned),dismissedUpdateVersion:_l(t.dismissedUpdateVersion),lastSeenReleaseNotes:_l(t.lastSeenReleaseNotes),claudeImportOffered:gl(t.claudeImportOffered,fl.claudeImportOffered),claudeImportOffers:pl(t.claudeImportOffers),collapsedProjects:vl(t.collapsedProjects),themeColors:Sl(t.themeColors),pinned:Cl(t.pinned),sidebarView:t.sidebarView===`projects`?`projects`:`recent`}}new Set(Object.keys(fl));var Ol=3650,kl=[{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 Al(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:jl(r.pre,i.pre)}function jl(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 Ml(e,t,n=kl,r=null){if(!e||e===`0.0.0`)return[];let i=n.filter(t=>Al(t.version,e)<=0&&(!r||!t.platforms||t.platforms.includes(r)));return[...t===null?i.filter(t=>Al(t.version,e)===0):i.filter(e=>Al(e.version,t)>0)].sort((e,t)=>Al(t.version,e.version))}function Nl(e,t,n,r=kl,i=null){if(!e||e===`0.0.0`)return{record:null,show:[]};let a=null;for(let e of r)(a===null||Al(e.version,a)>0)&&(a=e.version);let o=a!==null&&Al(e,a)>0?a:e;return{record:t===null||Al(o,t)>0?o:null,show:t===null&&!n?[]:Ml(e,t,r,i)}}function Pl(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 Fl=`the user skipped the question`,Il=`(the user skipped this question)`;function Ll(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 Rl(e,t,n={},r=new Set){let i={};return e.forEach((e,a)=>{if(r.has(a)){i[e.question]=Il;return}let o=(n[a]??``).trim();i[e.question]=o||(t[a]??[]).join(`, `)}),i}function zl(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 Bl(e){if(!e||typeof e!=`object`)return null;let t=e.answers;return t&&typeof t==`object`&&!Array.isArray(t)?t:null}var Vl=[`oauth`,`token`];function Hl(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 Ul=U().refine(e=>/^https:\/\/[^\s]+$/i.test(e),`must be an https address`),Wl=Ho({vendor:U().min(1).max(60),mcpUrl:Ul,readOnlyQuery:Xo(U(),U()).nullable(),auth:Ho({methods:Bo(Qo(Vl)).min(1),scopes:Bo(U()),offlineAccess:Po(),token:Ho({label:U(),createUrl:Ul,note:U().nullable()}).nullable()}),tools:Ho({deny:Bo(U()),allowWrites:Bo(U()),featured:Bo(U()),maxResultChars:Ao().int().min(1e3).max(2e5)}),cli:Ho({command:U().regex(/^[A-Za-z0-9._-]{1,40}$/),versionArg:U().regex(/^--?[A-Za-z0-9-]{1,20}$/),install:Xo(U(),U()),login:Ho({command:U(),tokenEnv:U().nullable()}),purpose:U()}).nullable(),skills:Bo(Ho({name:U().regex(/^[a-z0-9][a-z0-9_-]{0,47}$/),source:Ho({repo:U().regex(/^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/),ref:U().regex(/^[0-9a-f]{40}$/,`pin a full commit, never a branch`),path:U().refine(e=>!/(^|[\\/])\.\.([\\/]|$)|^[\\/]/.test(e),`relative path`)}),license:U(),exclude:Bo(U())})),docsUrl:Ul}).loose();function Gl(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 Kl(e){let t=Object.keys(e.arguments).slice(0,8);return`${e.vendor}: ${e.tool}${t.length>0?` (${t.join(`, `)})`:``}`}var ql=[`win32`,`linux`,`darwin`],Jl=[`demo`,`live`],Yl=[`allow`,`ask`],Xl=[`string`,`number`,`integer`,`boolean`,`array`,`object`];function Zl(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 Ql(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 $l(e,t){let n=t?.[e.slug];return typeof n==`boolean`?n:e.defaultOn}function eu(e,t){return e.filter(e=>$l(e,t))}var tu={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},nu=/^[A-Za-z0-9_-]+$/;function ru(e){return typeof e==`string`&&e.length>0&&e.length<=tu.entryTool&&nu.test(e)}function iu(e){return Math.ceil(e.length/4)}function au(e){return iu(`${e.entryTool} ${e.description}`)+55}function ou(e){return e.tokensPerRequest??au(e)+(e.promptLine?iu(e.promptLine):0)}var su=Ho({type:Qo(Xl),required:Po().optional(),enum:Bo(Wo([U(),Ao()])).optional(),description:U().optional()}),cu=Ho({slug:U().min(1),description:U(),params:Xo(U(),su),permission:Qo(Yl),sort:Ao()}),lu=Ho({version:U(),url:U(),sha256:U(),sizeBytes:Ao(),exe:U(),format:es(`zip`)}),uu=Ho({slug:U().min(1),name:U(),entryTool:U().refine(ru,`not a valid tool name`),description:U(),promptLine:U().nullable(),details:U().nullable().optional(),status:Qo(Jl),defaultOn:Po(),sort:Ao(),install:lu.nullable(),actions:Bo(cu),connector:Wl.nullable().optional().catch(null)}).loose();Ho({platform:Qo(ql),version:U(),packs:Bo(uu),refreshMinutes:Ao()});var du=Qo([`stdio`,`sse`,`http`]),fu=Ho({id:U().trim().regex(/^[a-z0-9][a-z0-9._-]{0,63}$/i,`ID must be 1-64 alphanumeric, dash, dot, or underscore characters`),name:U().trim().min(1).max(100),description:U().max(500).optional(),transport:du,command:U().min(1).max(500).optional(),args:Bo(U()).max(100).optional(),env:Xo(U(),U()).optional(),url:U().url().max(2e3).optional(),headers:Xo(U(),U()).optional(),defaultOn:Po(),enabled:Po().optional(),catalogId:U().max(100).optional()});fu.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`}),fu.partial(),Xo(U().regex(/^[a-z0-9][a-z0-9._-]{0,63}$/i),Po()).refine(e=>Object.keys(e).length<=128,`At most 128 MCP server switches`);function pu(e,t){if(e.enabled===!1)return!1;let n=t?t[e.id]:void 0;return typeof n==`boolean`?n:e.defaultOn}function mu(e,t,n){return{...e??{},[t]:n}}var hu=[{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`}],gu=[{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`}]}],_u=[`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(`
78
78
  `);var vu={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},yu={message:`✉️ Message from chat "`,reply:`↩️ Reply from chat "`,continue:`↻ Continue the message from chat "`},bu=`⚠ `,xu=`<local-command-stdout>`,Su=`</local-command-stdout>`,Cu=/^[A-Za-z0-9._:-]{1,128}$/;function wu(e){let t=(e??``).replace(/["“”]/g,`'`).replace(/\s+/g,` `).trim();if(!t)return`Untitled chat`;let n=vu.titleChars;return t.length>n?`${t.slice(0,n-1).trimEnd()}…`:t}function Tu(e){return wu(e.title?.trim()||e.firstPrompt?.trim()||`Chat ${e.id.slice(0,8)}`)}function Eu(e,t){let n=_u.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 Du=/^\[conv:(\S+) chat:(\S+) host:(\S+) msg:(\S+?)(?: reply-to:(\S+?))?( reply expected)?\]$/;function Ou(e){if(typeof e!=`string`)return null;let t=e;t.startsWith(xu)&&t.endsWith(Su)&&(t=t.slice(22,t.length-23)),t=t.replace(/\r\n/g,`
79
79
  `);let n=t.indexOf(`
80
80
  `);if(n<0)return null;let r=t.slice(0,n),i=t.slice(n+1),a=i.indexOf(`
@@ -145,9 +145,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
145
145
  `)?null:AN(e,t);if(r){let i=n?`block`:`code`;a=[ON(r.ref,i,[{type:`text`,value:e}],t,r.guess)],r.guess&&kN(t,r.ref)}}else i.type===`text`?a=jN(i.value??``,t):MN.has(i.type)||NN(i,t);t.marked=i.type===`text`&&DN.test(i.value??``),a?(r??=n.slice(0,e),r.push(...a)):r&&r.push(i)}r&&(e.children=r)}function PN(){return e=>{NN(e,{dir:null,marked:!1})}}var FN=3e4,IN=25,LN=5e3,RN=(e,t)=>`${e}\n${t}`;function zN(e){if(!e||typeof e!=`object`)return!1;let{status:t,message:n}=e;return t===501||t===404&&typeof n==`string`&&n.startsWith(`no route for`)}var BN=class{#e;#t;#n;#r;#i;#a;#o=new Map;#s=new Map;#c=new Map;#l=new Set;#u=new Map;#d=null;#f=!1;constructor(e){this.#e=e.stat,this.#t=e.ttlMs??FN,this.#n=e.batchMs??IN,this.#r=Math.max(1,Math.min(e.maxPerCall??100,500)),this.#i=e.maxEntries??LN,this.#a=e.now??Date.now}get unsupported(){return this.#f}peek(e,t){return this.#o.get(RN(e,t))?.answer}watch(e,t,n){let r=t.map(t=>RN(e,t));return r.forEach((r,i)=>{let a=this.#s.get(r);a||this.#s.set(r,a=new Set),a.add(n);let o=this.#o.get(r);(!o||this.#a()-o.at>=this.#t)&&this.#p(e,t[i])}),()=>{for(let e of r){let t=this.#s.get(e);t&&(t.delete(n),t.size===0&&this.#s.delete(e))}}}invalidate(e){this.#u.set(e,(this.#u.get(e)??0)+1);let t=`${e}\n`;for(let[e,n]of this.#o)e.startsWith(t)&&(n.at=-1/0);for(let n of this.#s.keys())n.startsWith(t)&&this.#p(e,n.slice(t.length))}#p(e,t){if(this.#f||this.#l.has(RN(e,t)))return;let n=this.#c.get(e);n||this.#c.set(e,n=new Set),n.add(t),this.#d??=setTimeout(()=>this.#m(),this.#n)}#m(){this.#d=null;let e=[...this.#c];this.#c.clear();for(let[t,n]of e){let e=[...n];for(let n=0;n<e.length;n+=this.#r)this.#h(t,e.slice(n,n+this.#r))}}async#h(e,t){let n=this.#u.get(e)??0,r=t.map(t=>RN(e,t));r.forEach(e=>this.#l.add(e));let i;try{let{results:n}=await this.#e(e,t);i=t.map((e,t)=>{let r=n[t]?.path===e?n[t]:n.find(t=>t.path===e);return r?r.exists?r.kind===`dir`?`dir`:`file`:`missing`:`unchecked`})}catch(e){if(zN(e)){r.forEach(e=>this.#l.delete(e)),this.#f=!0,this.#c.clear(),this.#_([...this.#s.keys()]);return}i=t.map(()=>`unchecked`)}r.forEach(e=>this.#l.delete(e));let a=(this.#u.get(e)??0)!==n,o=a?-1/0:this.#a(),s=[];r.forEach((n,r)=>{let c=i[r],l=this.#o.get(n);this.#o.delete(n),this.#o.set(n,{answer:c,at:o}),l?.answer!==c&&s.push(n),a&&this.#s.has(n)&&this.#p(e,t[r])}),this.#g(),this.#_(s)}#g(){for(;this.#o.size>this.#i;){let e=this.#o.keys().next().value;if(e===void 0)break;this.#o.delete(e)}}#_(e){let t=new Set;for(let n of e)this.#s.get(n)?.forEach(e=>t.add(e));t.forEach(e=>e())}};function VN(e){if(e===null||e.length===0)return{state:`unchecked`};for(let t=0;t<e.length;t++){let n=e[t];if(n===`file`||n===`dir`)return{state:`found`,index:t,kind:n};if(n===void 0)return{state:`unknown`};if(n===`unchecked`)return{state:`unchecked`}}return{state:`missing`}}var HN=(0,v.createContext)({sessionId:null,cwd:null,homeDir:null,platform:null,remote:!1,grant:null,openInViewer:null,bridge:null,notify:null,stat:null});function UN(e){typeof document>`u`||document.querySelectorAll(`audio, video`).forEach(t=>{t!==e&&!t.paused&&t.pause()})}var WN=`This file is on the PC that runs this chat — open it on that PC.`;function GN({kind:e}){let t=`h-3.5 w-3.5 text-fg-faint`;switch(e){case`audio`:return(0,G.jsx)(J.Music,{className:t});case`video`:return(0,G.jsx)(J.Film,{className:t});case`image`:return(0,G.jsx)(J.Image,{className:t});case`file`:return(0,G.jsx)(J.File,{className:t});case`dir`:return(0,G.jsx)(J.Folder,{className:t})}}var KN={file:`f`,dir:`d`,missing:`m`,unchecked:`u`},qN={f:`file`,d:`dir`,m:`missing`,u:`unchecked`};function JN(e,t,n){let r=n.join(`
146
146
  `),i=(0,v.useCallback)(r=>e&&t&&n.length>0?e.watch(t,n,r):()=>{},[e,t,r]),a=()=>!e||!t||n.length===0||e.unsupported?`X`:n.map(n=>{let r=e.peek(t,n);return r===void 0?`?`:KN[r]}).join(``),o=(0,v.useSyncExternalStore)(i,a,a);return(0,v.useMemo)(()=>VN(o===`X`?null:[...o].map(e=>qN[e])),[o])}function YN({variant:e,state:t,title:n,children:r}){return e===`block`?(0,G.jsx)(`div`,{className:`my-2`,"data-testid":`local-file-plain`,"data-state":t,children:(0,G.jsx)(`div`,{className:`max-w-full break-all rounded-md border border-border bg-code-bg px-2 py-1.5 font-mono text-[12.5px]`,children:(0,G.jsx)(`code`,{children:r})})}):e===`code`?(0,G.jsx)(`code`,{"data-testid":`local-file-plain`,"data-state":t,title:n,children:r}):(0,G.jsx)(`span`,{"data-testid":`local-file-plain`,"data-state":t,title:n,children:r})}function XN({label:e,onClick:t,testId:n,children:r}){return(0,G.jsx)(`button`,{type:`button`,"aria-label":e,title:e,"data-testid":n,onClick:e=>{e.preventDefault(),t()},className:`inline-flex items-center justify-center rounded p-0.5 text-fg-muted hover:bg-surface-3 hover:text-fg`,children:r})}function ZN(e){return e instanceof $m?e.status===404&&e.message.startsWith(`no route for`)?`This PC’s OonaCode cannot play files from the chat yet — update it.`:e.code===`session_not_found`?`Send a message first — this chat is not saved yet.`:e.status===404?`Not found on this PC.`:e.message:e instanceof Error?e.message:String(e)}function QN({sessionId:e,path:t,kind:n,grant:r}){let[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(0),[c,l]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let n=!0;return a(null),r(e,t).then(e=>{n&&a({url:e.url})},e=>{n&&a({error:ZN(e)})}),()=>{n=!1}},[e,t,r,o]),(0,v.useEffect)(()=>{if(!c||typeof window>`u`)return;let e=e=>{e.key===`Escape`&&l(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[c]);let u=()=>{o===0?s(1):a({error:`It could not be played here.`})},d=e=>UN(e.currentTarget);return i===null?(0,G.jsxs)(`span`,{className:`my-1 flex items-center gap-1 text-xs text-fg-muted`,"data-testid":`local-file-loading`,children:[(0,G.jsx)(J.Spinner,{className:`h-3 w-3`}),` Loading…`]}):`error`in i?(0,G.jsx)(`span`,{className:`my-1 block text-xs text-danger`,"data-testid":`local-file-error`,children:i.error}):n===`audio`?(0,G.jsx)(`audio`,{controls:!0,autoPlay:!0,preload:`metadata`,src:i.url,onPlay:d,onError:u,className:`my-1 block h-9 w-full max-w-sm`,"data-testid":`local-file-audio`}):n===`video`?(0,G.jsx)(`video`,{controls:!0,autoPlay:!0,preload:`metadata`,src:i.url,onPlay:d,onError:u,className:`my-1 block max-h-72 w-full max-w-md rounded border border-border bg-black`,"data-testid":`local-file-video`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`img`,{src:i.url,alt:TN(t),onError:u,onClick:()=>l(!0),title:`Enlarge`,className:`my-1 block max-h-40 max-w-full cursor-zoom-in rounded border border-border`,"data-testid":`local-file-image`}),c&&typeof document<`u`?(0,Sb.createPortal)((0,G.jsx)(`div`,{role:`dialog`,"aria-label":TN(t),onClick:()=>l(!1),className:`fixed inset-0 z-50 flex cursor-zoom-out items-center justify-center bg-black/70 p-6`,"data-testid":`local-file-zoom`,children:(0,G.jsx)(`img`,{src:i.url,alt:TN(t),className:`max-h-[90vh] max-w-[90vw] rounded shadow-lg`})}),document.body):null]})}var $N=(0,v.memo)(function({path:e,base:t,variant:n,altDir:r=null,altDirBase:i=null,guess:a=!1,children:o}){let s=(0,v.useContext)(HN),c=(0,v.useMemo)(()=>{let n=[],a=e=>{let t=xN(e,s);t!==null&&!n.includes(t)&&n.push(t)};return a({path:e,base:t}),t===`rel`&&r!==null&&i!==null&&a(lN({path:r,base:i},e)),n},[e,t,r,i,s.cwd,s.homeDir,s.platform]),l=JN(s.remote?null:s.stat,s.sessionId,c),[u,d]=(0,v.useState)(!1),f=l.state===`found`,p=f?c[l.index]:c[0]??null,m=f&&l.kind===`dir`?`dir`:CN(p??e),h=m===`audio`||m===`video`||m===`image`?m:null,g=l.state===`unknown`||l.state===`missing`?l.state:l.state===`unchecked`&&a?`unchecked`:null,_=!s.remote&&p!==null,y=_&&m!==`dir`?SN(p,s):null,b=y!==null&&s.openInViewer!==null&&wN(p),x=_&&!!s.bridge?.openPath,S=_&&!!s.bridge?.showItemInFolder,C=_&&h!==null&&s.grant!==null&&s.sessionId!==null,w=m===`dir`?`Open the folder`:`Open with its app`,T=()=>{!p||!s.bridge?.openPath||s.bridge.openPath(p).then(e=>{!e.ok&&e.message&&s.notify?.(e.shownInFolder?`info`:`error`,e.message)},e=>s.notify?.(`error`,ZN(e)))},E=()=>{!p||!s.bridge?.showItemInFolder||s.bridge.showItemInFolder(p).then(e=>{!e.ok&&e.message&&s.notify?.(`error`,e.message)},e=>s.notify?.(`error`,ZN(e)))},D=b?{run:()=>s.openInViewer(y),title:`Open in the file viewer`}:x?{run:T,title:w}:C?{run:()=>d(e=>!e),title:m===`image`?`Show here`:`Play here`}:null,O=p??e,k=s.remote?`${O}\n${WN}`:D?`${D.title}\n${O}`:O;if(g)return(0,G.jsx)(YN,{variant:n,state:g,title:n===`link`?O:void 0,children:o});let A=n===`code`||n===`block`?(0,G.jsx)(`code`,{className:n===`block`?`break-all`:void 0,children:o}):(0,G.jsx)(`span`,{className:W(`min-w-0 break-all`,n===`bare`&&`font-mono text-[0.92em]`),children:o}),j=D?(0,G.jsx)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),D.run()},title:k,"data-testid":`local-file-name`,className:`min-w-0 cursor-pointer text-left text-accent underline decoration-dotted underline-offset-2 hover:decoration-solid`,children:A}):(0,G.jsx)(`span`,{title:k,"data-testid":`local-file-name`,className:`min-w-0`,children:A}),M=(0,G.jsxs)(G.Fragment,{children:[C?(0,G.jsx)(XN,{label:u?`Close the player`:m===`image`?`Show here`:`Play here`,onClick:()=>d(e=>!e),testId:`local-file-play`,children:u?(0,G.jsx)(J.X,{className:`h-3 w-3`}):m===`image`?(0,G.jsx)(J.Image,{className:`h-3 w-3`}):(0,G.jsx)(J.Play,{className:`h-3 w-3`})}):null,x?(0,G.jsx)(XN,{label:w,onClick:T,testId:`local-file-open`,children:(0,G.jsx)(J.ExternalLink,{className:`h-3 w-3`})}):null,S?(0,G.jsx)(XN,{label:m===`dir`?`Show in its folder`:`Show in folder`,onClick:E,testId:`local-file-folder`,children:(0,G.jsx)(J.Folder,{className:`h-3 w-3`})}):null,s.remote?(0,G.jsx)(`span`,{title:WN,"aria-label":WN,"data-testid":`local-file-remote`,children:(0,G.jsx)(J.Monitor,{className:`h-3 w-3 text-fg-faint`})}):null]}),N=u&&C&&h?(0,G.jsx)(`span`,{className:`block`,"data-testid":`local-file-player`,children:(0,G.jsx)(QN,{sessionId:s.sessionId,path:p,kind:h,grant:s.grant})}):null;return n===`block`?(0,G.jsxs)(`div`,{className:`my-2`,"data-testid":`local-file`,"data-kind":m,"data-path":O,children:[(0,G.jsxs)(`div`,{className:`flex max-w-full items-center gap-1 rounded-md border border-border bg-code-bg px-2 py-1.5 font-mono text-[12.5px]`,children:[(0,G.jsx)(GN,{kind:m}),j,M]}),N]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:W(`inline-flex max-w-full items-center gap-0.5 align-baseline`,n===`link`&&`rounded border border-border bg-surface-2 px-1 py-px`),"data-testid":`local-file`,"data-kind":m,"data-path":O,children:[n===`link`?(0,G.jsx)(GN,{kind:m}):null,j,M]}),N]})});function eP(e){let{filePath:t,fileBase:n,fileVariant:r,fileAltDir:i,fileAltDirBase:a,fileGuess:o,children:s}=e;return!t||!n?(0,G.jsx)(G.Fragment,{children:s}):(0,G.jsx)($N,{path:t,base:n,variant:r??`bare`,altDir:i&&a?i:null,altDirBase:i&&a?a:null,guess:o===!0,children:s})}var tP=(0,v.memo)(function({text:e}){let t=(0,v.useMemo)(()=>{let t=gN(e);if(t.length===0)return null;let n=[],r=0;for(let i of t)i.start>r&&n.push(e.slice(r,i.start)),n.push((0,G.jsx)($N,{path:i.ref.path,base:i.ref.base,variant:i.label===void 0?`bare`:`link`,guess:i.folder===!0,children:i.label??e.slice(i.start,i.end)},i.start)),r=i.end;return r<e.length&&n.push(e.slice(r)),n},[e]);return(0,G.jsx)(G.Fragment,{children:t??e})});async function nP(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}function rP({text:e,className:t}){let[n,r]=(0,v.useState)(!1);return(0,G.jsxs)(`button`,{type:`button`,"aria-label":`Copy to clipboard`,title:`Copy`,className:W(`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-fg-muted hover:bg-surface-3 hover:text-fg`,t),onClick:()=>{nP(e).then(e=>{e&&(r(!0),setTimeout(()=>r(!1),1500))})},children:[n?(0,G.jsx)(J.Check,{className:`w-3 h-3`}):(0,G.jsx)(J.Copy,{className:`w-3 h-3`}),n?`Copied`:`Copy`]})}function iP({code:e,language:t,className:n,maxHeight:r}){return(0,G.jsxs)(`div`,{className:W(`group relative my-2 overflow-hidden rounded-md border border-border bg-code-bg`,n),children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-2 py-0.5 text-[11px] text-fg-faint`,children:[(0,G.jsx)(`span`,{className:`font-mono`,children:t||`text`}),(0,G.jsx)(rP,{text:e})]}),(0,G.jsx)(`pre`,{className:`m-0 overflow-x-auto p-3 font-mono text-[12.5px] leading-relaxed`,style:r?{maxHeight:r,overflowY:`auto`}:void 0,children:(0,G.jsx)(`code`,{children:e})})]})}function aP(e){return typeof e==`string`?e:Array.isArray(e)?e.map(aP).join(``):e&&typeof e==`object`&&`props`in e?aP(e.props.children):``}function oP(e){window.oonacode?.openExternal?window.oonacode.openExternal(e):window.open(e,`_blank`,`noopener,noreferrer`)}var sP={pre({children:e}){let t=Array.isArray(e)?e[0]:e,n=t&&typeof t==`object`&&`props`in t?t.props:null,r=n?.className?.match(/language-([\w-]+)/)?.[1]??null,i=aP(n?.children??e).replace(/\n$/,``);return(0,G.jsx)(iP,{code:i,language:r})},a({href:e,children:t}){let n=e??``;return(0,G.jsx)(`a`,{href:n,onClick:e=>{/^https?:/i.test(n)&&(e.preventDefault(),oP(n))},rel:`noopener noreferrer`,target:`_blank`,children:t})}},cP=[vM],lP=[vM,PN],uP={...sP,[EN]:eP},dP=(0,v.memo)(function({text:e,className:t,localFiles:n=!1}){return(0,G.jsx)(`div`,{className:W(`md break-words`,t),children:(0,G.jsx)(mk,{remarkPlugins:n?lP:cP,components:n?uP:sP,children:e})})});function fP({pack:e,where:t}){let n=`shrink-0 rounded-sm px-1 py-px text-[10px] leading-none font-semibold tracking-wide uppercase`;return(0,G.jsxs)(G.Fragment,{children:[e.builtin?(0,G.jsx)(`span`,{"data-testid":t===`row`?`tool-pack-builtin-${e.slug}`:void 0,className:W(n,`bg-accent-soft text-accent`),children:`Built in`}):null,e.status===`demo`?(0,G.jsx)(`span`,{"data-testid":t===`row`?`tool-pack-demo-${e.slug}`:void 0,className:W(n,`bg-warn-soft text-warn`),children:`Demo`}):null,e.status===`live`&&e.install&&e.installed===!1?(0,G.jsx)(`span`,{"data-testid":t===`row`?`tool-pack-install-${e.slug}`:void 0,title:`The first time a chat uses it, OonaCode asks once to install it (${Zl(e.install.sizeBytes)}).`,className:W(n,`bg-surface-2 text-fg-muted`),children:`Installs on first use`}):null]})}function pP({pack:e,row:t,panel:n,id:r,cardRef:i,onMouseEnter:a,onMouseLeave:o,onBlur:s}){let[c,l]=(0,v.useState)(0),[u,d]=(0,v.useState)(()=>({width:window.innerWidth,height:window.innerHeight}));(0,v.useLayoutEffect)(()=>{let e=i.current?.offsetHeight??0;e!==c&&l(e)}),(0,v.useEffect)(()=>{let e=()=>d({width:window.innerWidth,height:window.innerHeight});return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let f=m_({row:t,panel:n,height:c,viewport:u}),p=zf(e),m=ou(e);return(0,Sb.createPortal)((0,G.jsxs)(`div`,{ref:i,id:r,role:`tooltip`,tabIndex:-1,"data-testid":`tool-pack-card`,"data-pack":e.slug,"data-side":f.side,onMouseEnter:a,onMouseLeave:o,onBlur:s,className:`fixed z-[60] flex flex-col overflow-hidden rounded-lg border border-border bg-surface text-xs text-fg shadow-lg focus:outline-none`,style:{left:f.left,top:f.top,width:f.width,maxHeight:f.maxHeight},children:[(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 border-b border-border px-3 py-2`,children:[(0,G.jsx)(J.Tool,{className:`w-3.5 h-3.5 shrink-0 text-fg-faint`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.name}),(0,G.jsx)(fP,{pack:e,where:`card`})]}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-2`,"data-testid":`tool-pack-card-body`,children:p?(0,G.jsx)(dP,{text:p,className:`md-compact leading-relaxed`}):(0,G.jsxs)(`div`,{"data-testid":`tool-pack-card-fallback`,className:`space-y-1.5 leading-snug`,children:[(0,G.jsx)(`p`,{className:`text-fg-muted`,children:Bf(e)}),e.status===`demo`?(0,G.jsx)(`p`,{className:`text-fg-faint`,children:Vf}):null]})}),(0,G.jsxs)(`div`,{className:`shrink-0 border-t border-border px-3 py-1.5 text-[10px] text-fg-faint`,children:[`≈`,m.toLocaleString(),` tokens on every request while it is on`]})]}),document.body)}var mP=352,hP=388;function gP(e){let t=e?.getBoundingClientRect();return t?{left:t.left,top:t.top,right:t.right,bottom:t.bottom}:null}function _P({disabled:e}){let{state:t,actions:n,api:r}=K(),i=hb(),a=gb(),o=mb(),s=pb(),c=t.agentTools?.packs,l=Lm(fS().providerId),u=(0,v.useMemo)(()=>(c??[]).filter(e=>!(l&&e.slug===`images`)),[c,l]),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)({up:!0,right:!1}),h=(0,v.useRef)(null),g=(0,v.useRef)(null),_=(0,v.useRef)(null),y=(0,v.useRef)(null),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(null),w=DS(r,u.some(gS)&&(d||S!==null)),T=(0,v.useCallback)(()=>C(null),[]),E=(0,v.useId)(),D=(0,v.useRef)(null),O=(0,v.useRef)(null),k=(0,v.useRef)(!1),A=()=>{D.current&&clearTimeout(D.current),O.current&&clearTimeout(O.current),D.current=null,O.current=null};if((0,v.useEffect)(()=>A,[]),(0,v.useEffect)(()=>{f(!1)},[s]),(0,v.useEffect)(()=>{d||(A(),x(null))},[d]),(0,v.useEffect)(()=>{if(!d)return;let e=e=>{let t=e.target;y.current?.contains(t)||t instanceof Element&&t.closest(`[role="dialog"][aria-modal="true"]`)||h.current&&!h.current.contains(t)&&f(!1)},t=e=>{if(e.key===`Escape`){if(e.preventDefault(),y.current){let e=y.current.dataset.pack,t=y.current.contains(document.activeElement);A(),x(null),t&&e&&(k.current=!0,Array.from(_.current?.querySelectorAll(`[data-testid^="tool-pack-info-"]`)??[]).find(t=>t.dataset.testid===`tool-pack-info-${e}`)?.focus(),k.current=!1);return}f(!1),g.current?.focus()}};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[d]),(0,v.useEffect)(()=>{d&&_.current?.querySelector(`[role="switch"]`)?.focus()},[d]),(0,v.useEffect)(()=>{if(!d)return;let e=()=>{let e=h.current?.getBoundingClientRect();if(!e)return;let t=window.innerHeight-e.bottom,n=e.top;m({up:t>=hP?!1:n>t,right:e.left+mP>window.innerWidth&&e.right>=mP})};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[d]),u.length===0||!s||t.remote.tabs[s])return null;let j=a?a.toolPacks:i?.toolPacks,M=If(u,j),N=!a&&((o?.items.length??0)>0||(i?.entryCount??0)>0),ee=(e=!0)=>{f(!1),e&&g.current?.focus()},te=(e,t,n)=>{let r=gP(t);if(!r)return;let i=gP(_.current)??r;x(t=>t&&t.slug===e&&t.via===`focus`&&n===`hover`?t:{slug:e,row:r,panel:i,via:n})},P=()=>{O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{O.current=null,x(e=>e?.via===`hover`?null:e)},200)},F=(e,t)=>{if(A(),b?.slug!==e){if(b){te(e,t,`hover`);return}D.current=setTimeout(()=>{D.current=null,te(e,t,`hover`)},300)}},ne=()=>{D.current&&clearTimeout(D.current),D.current=null,b?.via===`hover`&&P()},re=(e,t)=>{k.current||(A(),te(e,t.closest(`li`),`focus`))},ie=e=>{let t=e.relatedTarget;t&&y.current?.contains(t)||t instanceof HTMLElement&&t.dataset.testid===`tool-pack-info-${b?.slug}`||x(e=>e?.via===`focus`?null:e)},I=d&&b?u.find(e=>e.slug===b.slug):void 0,L=vS()?t.connection.hostName??`that PC`:null,R=S?u.find(e=>e.slug===S):void 0,z=e=>{let t=!$l(e,j);n.setSessionToolPacks(s,Ff(j,e.slug,t))};return(0,G.jsxs)(`span`,{ref:h,className:`relative inline-flex items-center`,children:[(0,G.jsxs)(`button`,{type:`button`,ref:g,"aria-label":M.label,"aria-haspopup":`dialog`,"aria-expanded":d,title:M.title,"data-testid":`tools-picker`,"data-count":M.count,disabled:e,onClick:()=>d?ee():f(!0),className:W(`flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded px-1.5 py-0.5 text-xs hover:bg-fg/5 disabled:opacity-50`,M.count>0?`text-fg`:`text-fg-muted`),children:[(0,G.jsx)(J.Tool,{className:`w-3.5 h-3.5`}),(0,G.jsx)(`span`,{children:`Tools`}),(0,G.jsxs)(`span`,{className:M.count>0?`text-accent`:`text-fg-faint`,children:[`· `,M.count]})]}),d?(0,G.jsx)(`div`,{ref:_,role:`dialog`,"aria-label":`Tools for this chat`,"data-testid":`tools-panel`,onKeyDown:e=>{if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=Array.from(_.current?.querySelectorAll(`[role="switch"]:not([disabled])`)??[]);if(t.length===0)return;e.preventDefault();let n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus()},className:W(`absolute z-50 w-[22rem] max-w-[calc(100vw-2rem)]`,p.up?`bottom-full mb-1`:`top-full mt-1`,p.right?`right-0`:`left-0`),children:(0,G.jsxs)(`div`,{className:`flex max-h-[24rem] flex-col overflow-hidden rounded-lg border border-border bg-surface shadow-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-2.5 py-1.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:[(0,G.jsx)(J.Tool,{className:`w-3.5 h-3.5 text-fg-faint`}),(0,G.jsx)(`span`,{className:`flex-1`,children:`OonaCode tools`}),(0,G.jsxs)(`span`,{className:`normal-case tracking-normal text-fg-faint`,children:[M.count,` of `,u.length,` on`]})]}),(0,G.jsx)(`ul`,{className:`min-h-0 flex-1 overflow-y-auto py-1`,onScroll:()=>{b&&x(null)},children:u.map(t=>(0,G.jsx)(vP,{pack:t,on:$l(t,j),disabled:e,onToggle:()=>z(t),needsSignIn:gS(t)&&(w.unavailable||w.byslug?.[t.slug]?.state!==`connected`),unavailable:gS(t)&&w.unavailable,extra:gS(t)?(0,G.jsx)(AS,{pack:t,status:w.byslug?.[t.slug],view:w,remoteName:L,onSignIn:()=>{w.clearError(),C(t.slug)}}):null,cardOpen:I?.slug===t.slug,cardId:E,onEnter:e=>F(t.slug,e),onLeave:ne,onInfoFocus:e=>re(t.slug,e),onInfoBlur:ie},t.slug))}),N?(0,G.jsx)(`div`,{className:`border-t border-border px-2.5 py-1.5 text-[11px] leading-snug text-fg-faint`,"data-testid":`tools-restart-note`,children:Rf}):null]})}):null,R&&gS(R)?(0,G.jsx)(jb,{open:!0,title:`Sign in to ${R.connector.vendor}`,onClose:T,children:(0,G.jsx)(jS,{pack:R,status:w.byslug?.[R.slug],view:w,onDone:T})}):null,I&&b?(0,G.jsx)(pP,{pack:I,row:b.row,panel:b.panel,id:E,cardRef:y,onMouseEnter:()=>{O.current&&clearTimeout(O.current),O.current=null},onMouseLeave:()=>{b.via===`hover`&&P()},onBlur:ie}):null]})}function vP({pack:e,on:t,disabled:n,onToggle:r,needsSignIn:i,unavailable:a,extra:o,cardOpen:s,cardId:c,onEnter:l,onLeave:u,onInfoFocus:d,onInfoBlur:f}){let p=ou(e),m=i&&!t;return(0,G.jsxs)(`li`,{className:W(`flex items-start gap-3 px-2.5 py-2 hover:bg-surface-2`,s&&`bg-surface-2`),"data-testid":`tool-pack-${e.slug}`,onMouseEnter:e=>l(e.currentTarget),onMouseLeave:u,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`truncate text-xs font-medium text-fg`,children:e.name}),(0,G.jsx)(fP,{pack:e,where:`row`}),(0,G.jsx)(`button`,{type:`button`,"aria-label":`About ${e.name}`,"aria-expanded":s,"aria-describedby":s?c:void 0,"data-testid":`tool-pack-info-${e.slug}`,onFocus:e=>d(e.currentTarget),onClick:e=>d(e.currentTarget),onBlur:f,className:`shrink-0 cursor-help rounded text-fg-faint hover:text-fg focus-visible:text-fg focus-visible:outline-2 focus-visible:outline-accent`,children:(0,G.jsx)(J.Info,{className:`w-3.5 h-3.5`})})]}),e.description?(0,G.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-[11px] leading-snug text-fg-muted`,children:e.description}):null,(0,G.jsxs)(`p`,{className:`mt-0.5 text-[10px] text-fg-faint`,children:[`≈`,p.toLocaleString(),` tokens per request`]}),o,m&&!a?(0,G.jsx)(`p`,{className:`mt-0.5 text-[10px] text-fg-faint`,"data-testid":`tool-pack-signin-first-${e.slug}`,children:mS}):null]}),(0,G.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"aria-label":e.name,disabled:n||m,title:m?a?pS:mS:void 0,"data-testid":`tool-pack-switch-${e.slug}`,onClick:r,className:W(`relative mt-0.5 h-5 w-9 shrink-0 rounded-full border transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent disabled:opacity-50`,t?`border-accent bg-accent`:`border-border bg-surface-2`),children:(0,G.jsx)(`span`,{className:W(`absolute top-0.5 h-3.5 w-3.5 rounded-full bg-surface transition-all`,t?`left-[1.15rem]`:`left-0.5`)})})]})}var yP=320,bP=300;function xP({disabled:e}){let{state:t,actions:n}=K(),r=pb(),i=hb(),a=r?t.drafts[r]:null,[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)({up:!1,right:!1}),u=(0,v.useRef)(null),d=(0,v.useRef)(null),f=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(!o)return;let e=e=>{let t=e.target;u.current?.contains(t)||s(!1)},t=e=>{e.key===`Escape`&&(s(!1),d.current?.focus())};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[o]),(0,v.useEffect)(()=>{if(!o)return;let e=()=>{let e=u.current?.getBoundingClientRect();if(!e)return;let t=window.innerHeight-e.bottom,n=e.top;l({up:t>=bP?!1:n>t,right:e.left+yP>window.innerWidth&&e.right>=yP})};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[o]),(0,v.useEffect)(()=>{o&&f.current?.querySelector(`[role="switch"]`)?.focus()},[o]);let p=(t.mcpServers??[]).filter(e=>e.enabled!==!1);if(p.length===0||!r||t.remote.tabs[r])return null;let m=a?a.mcpSwitches:i?.mcpSwitches,h=p.filter(e=>pu(e,m)).length,g=e=>{let t=!pu(e,m);n.setSessionMcpSwitches(r,mu(m??void 0,e.id,t))};return(0,G.jsxs)(`div`,{ref:u,className:`relative inline-block shrink-0`,children:[(0,G.jsxs)(`button`,{ref:d,type:`button`,disabled:e,onClick:()=>s(!o),"aria-haspopup":`dialog`,"aria-expanded":o,"aria-label":`MCP Servers for this chat`,"data-testid":`mcp-picker`,className:W(`flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded px-1.5 py-0.5 text-xs hover:bg-fg/5 disabled:opacity-50 transition-colors`,h>0?`text-fg`:`text-fg-muted`),children:[(0,G.jsx)(J.Plug,{className:W(`w-3.5 h-3.5`,h>0?`text-accent`:`text-fg-muted`)}),(0,G.jsx)(`span`,{children:`MCP`}),(0,G.jsxs)(`span`,{className:h>0?`text-accent font-medium`:`text-fg-faint`,children:[`· `,h]})]}),o&&(0,G.jsxs)(`div`,{ref:f,role:`dialog`,"aria-label":`MCP Servers for this chat`,className:W(`absolute z-50 w-80 rounded-lg border border-border bg-surface p-3 shadow-xl text-xs flex flex-col gap-2.5`,c.up?`bottom-full mb-1`:`top-full mt-1`,c.right?`right-0`:`left-0`),children:[(0,G.jsxs)(`div`,{className:`border-b border-border pb-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`font-semibold text-fg`,children:`MCP Servers in this chat`}),(0,G.jsxs)(`span`,{className:`text-[11px] text-accent font-medium`,children:[h,` of `,p.length,` on`]})]}),(0,G.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-muted`,children:`Enable only the servers needed for this conversation to prevent token waste.`})]}),(0,G.jsx)(`div`,{className:`max-h-60 overflow-y-auto space-y-1.5 pr-0.5`,children:p.map(t=>{let n=pu(t,m);return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-md p-1.5 hover:bg-surface-2 transition-colors`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`font-medium text-fg truncate text-xs`,children:t.name}),(0,G.jsx)(Q,{tone:`neutral`,children:t.transport})]}),t.description&&(0,G.jsx)(`p`,{className:`text-[11px] text-fg-muted truncate`,children:t.description})]}),(0,G.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":n,"aria-label":`Toggle ${t.name}`,disabled:e,onClick:()=>g(t),className:W(`relative h-5 w-9 shrink-0 rounded-full border transition-colors focus-visible:outline-2 focus-visible:outline-accent disabled:opacity-50`,n?`border-accent bg-accent`:`border-border bg-surface-2`),children:(0,G.jsx)(`span`,{className:W(`absolute top-0.5 h-3.5 w-3.5 rounded-full bg-surface transition-all`,n?`left-[1.15rem]`:`left-0.5`)})})]},t.id)})}),(0,G.jsxs)(`div`,{className:`pt-2 border-t border-border flex items-center justify-between text-[11px]`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>{s(!1),n.openSettings(`mcp`)},className:`text-accent hover:underline flex items-center gap-1`,children:[(0,G.jsx)(`span`,{children:`Configure in Settings`}),(0,G.jsx)(J.ExternalLink,{className:`w-3 h-3`})]}),(0,G.jsx)(`span`,{className:`text-fg-muted`,children:h===0?`No tools loaded`:`${h} loaded`})]})]})]})}var SP=new Map;function CP(e){e===void 0?SP.clear():SP.delete(e)}function wP(e,t,n){let[,r]=(0,v.useState)(0),i=(0,v.useRef)(null),a=e===null?void 0:SP.get(e),o=a!==void 0&&Date.now()-a.at<6e4;return(0,v.useEffect)(()=>{if(!t||e===null||o||i.current===e)return;i.current=e;let a=!0;return n(e).then(t=>SP.set(e,{at:Date.now(),value:t})).catch(()=>SP.set(e,{at:Date.now(),value:null})).finally(()=>{i.current===e&&(i.current=null),a&&r(e=>e+1)}),()=>{a=!1}},[t,e,o,n]),a===void 0?{status:t?`loading`:`idle`,data:null}:a.value===`unsupported`?{status:`unsupported`,data:null}:a.value===null?{status:`error`,data:null}:{status:`ready`,data:a.value}}function TP(e){return e!==null&&SP.get(e)?.value===`unsupported`}function EP({skill:e,where:t}){return(0,G.jsx)(`span`,{"data-testid":t===`row`?`skill-source-${e.name}`:void 0,className:W(`shrink-0 rounded-sm px-1 py-px text-[10px] leading-none font-semibold tracking-wide uppercase`,e.source===`user`?`bg-accent-soft text-accent`:e.source===`project`?`bg-warn-soft text-warn`:`bg-surface-2 text-fg-muted`),children:xm(e.source)})}function DP({skill:e,on:t,row:n,panel:r,id:i,cardRef:a,onMouseEnter:o,onMouseLeave:s,onBlur:c}){let[l,u]=(0,v.useState)(0),[d,f]=(0,v.useState)(()=>({width:window.innerWidth,height:window.innerHeight}));(0,v.useLayoutEffect)(()=>{let e=a.current?.offsetHeight??0;e!==l&&u(e)}),(0,v.useEffect)(()=>{let e=()=>f({width:window.innerWidth,height:window.innerHeight});return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let p=m_({row:n,panel:r,height:l,viewport:d});return(0,Sb.createPortal)((0,G.jsxs)(`div`,{ref:a,id:i,role:`tooltip`,tabIndex:-1,"data-testid":`skill-card`,"data-skill":e.name,"data-side":p.side,onMouseEnter:o,onMouseLeave:s,onBlur:c,className:`fixed z-[60] flex flex-col overflow-hidden rounded-lg border border-border bg-surface text-xs text-fg shadow-lg focus:outline-none`,style:{left:p.left,top:p.top,width:p.width,maxHeight:p.maxHeight},children:[(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 border-b border-border px-3 py-2`,children:[(0,G.jsx)(J.Skill,{className:`w-3.5 h-3.5 shrink-0 text-fg-faint`}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-medium font-mono`,children:[`/`,e.label]}),(0,G.jsx)(EP,{skill:e,where:`card`})]}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-2`,"data-testid":`skill-card-body`,children:(0,G.jsx)(dP,{text:Cm(e,t),className:`md-compact leading-relaxed`})}),(0,G.jsxs)(`div`,{className:`shrink-0 border-t border-border px-3 py-1.5 text-[10px] text-fg-faint`,children:[`≈`,e.tokens.toLocaleString(),` tokens on every request while it is on`]})]}),document.body)}var OP=384,kP=420;function AP(e){let t=e?.getBoundingClientRect();return t?{left:t.left,top:t.top,right:t.right,bottom:t.bottom}:null}function jP({disabled:e}){let{state:t,actions:n}=K(),r=hb(),i=gb(),a=mb(),o=pb(),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)({up:!0,right:!1}),d=(0,v.useRef)(null),f=(0,v.useRef)(null),p=(0,v.useRef)(null),m=(0,v.useRef)(null),[h,g]=(0,v.useState)(null),_=(0,v.useId)(),y=(0,v.useRef)(null),b=(0,v.useRef)(null),x=(0,v.useRef)(!1),S=o?!!t.remote.tabs[o]:!1,{status:C,data:w}=wP(S?null:o,s,n.listChatSkills),T=()=>{y.current&&clearTimeout(y.current),b.current&&clearTimeout(b.current),y.current=null,b.current=null};if((0,v.useEffect)(()=>T,[]),(0,v.useEffect)(()=>{c(!1)},[o]),(0,v.useEffect)(()=>{s||(T(),g(null))},[s]),(0,v.useEffect)(()=>{if(!s)return;let e=e=>{let t=e.target;m.current?.contains(t)||d.current&&!d.current.contains(t)&&c(!1)},t=e=>{if(e.key===`Escape`){if(e.preventDefault(),m.current){let e=m.current.dataset.skill,t=m.current.contains(document.activeElement);T(),g(null),t&&e&&(x.current=!0,Array.from(p.current?.querySelectorAll(`[data-skill-info]`)??[]).find(t=>t.dataset.skillInfo===e)?.focus(),x.current=!1);return}c(!1),f.current?.focus()}};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[s]),(0,v.useEffect)(()=>{!s||C!==`ready`||p.current?.querySelector(`[role="switch"]`)?.focus()},[s,C]),(0,v.useEffect)(()=>{if(!s)return;let e=()=>{let e=d.current?.getBoundingClientRect();if(!e)return;let t=window.innerHeight-e.bottom,n=e.top;u({up:t>=kP?!1:n>t,right:e.left+OP>window.innerWidth&&e.right>=OP})};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[s]),!o||S||TP(o))return null;let E=(i?i.modelSkills:r?.modelSkills)??[],D=w?.skills??[],O=gm(w?D:null,E),k=hm(D,E),A=!i&&((a?.items.length??0)>0||(r?.entryCount??0)>0),j=(e=!0)=>{c(!1),e&&f.current?.focus()},M=(e,t,n)=>{let r=AP(t);if(!r)return;let i=AP(p.current)??r;g(t=>t&&t.name===e&&t.via===`focus`&&n===`hover`?t:{name:e,row:r,panel:i,via:n})},N=()=>{b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{b.current=null,g(e=>e?.via===`hover`?null:e)},200)},ee=(e,t)=>{if(T(),h?.name!==e){if(h){M(e,t,`hover`);return}y.current=setTimeout(()=>{y.current=null,M(e,t,`hover`)},300)}},te=()=>{y.current&&clearTimeout(y.current),y.current=null,h?.via===`hover`&&N()},P=(e,t)=>{x.current||(T(),M(e,t.closest(`li`),`focus`))},F=e=>{let t=e.relatedTarget;t&&m.current?.contains(t)||t instanceof HTMLElement&&t.dataset.skillInfo===h?.name||g(e=>e?.via===`focus`?null:e)},ne=s&&h?D.find(e=>e.name===h.name):void 0,re=e=>{let t=!mm(E,e.name);n.setSessionModelSkills(o,pm(E,e.name,t))};return(0,G.jsxs)(`span`,{ref:d,className:`relative inline-flex items-center`,children:[(0,G.jsxs)(`button`,{type:`button`,ref:f,"aria-label":O.label,"aria-haspopup":`dialog`,"aria-expanded":s,title:O.title,"data-testid":`skills-picker`,"data-count":O.count,disabled:e,onClick:()=>s?j():c(!0),className:W(`flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded px-1.5 py-0.5 text-xs hover:bg-fg/5 disabled:opacity-50`,O.count>0?`text-fg`:`text-fg-muted`),children:[(0,G.jsx)(J.Skill,{className:`w-3.5 h-3.5`}),(0,G.jsx)(`span`,{children:`Skills`}),(0,G.jsxs)(`span`,{className:O.count>0?`text-accent`:`text-fg-faint`,children:[`· `,O.count]})]}),s?(0,G.jsx)(`div`,{ref:p,role:`dialog`,"aria-label":`Skills for this chat`,"data-testid":`skills-panel`,onKeyDown:e=>{if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=Array.from(p.current?.querySelectorAll(`[role="switch"]:not([disabled])`)??[]);if(t.length===0)return;e.preventDefault();let n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus()},className:W(`absolute z-50 w-[24rem] max-w-[calc(100vw-2rem)]`,l.up?`bottom-full mb-1`:`top-full mt-1`,l.right?`right-0`:`left-0`),children:(0,G.jsxs)(`div`,{className:`flex max-h-[26rem] flex-col overflow-hidden rounded-lg border border-border bg-surface shadow-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-2.5 py-1.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:[(0,G.jsx)(J.Skill,{className:`w-3.5 h-3.5 text-fg-faint`}),(0,G.jsx)(`span`,{className:`flex-1`,children:`Skills`}),(0,G.jsxs)(`span`,{className:`normal-case tracking-normal text-fg-faint`,"data-testid":`skills-panel-count`,children:[O.count,` of `,D.length,` on`,k>0?` · ≈${k.toLocaleString()} tokens/request`:``]})]}),(0,G.jsx)(`p`,{className:`border-b border-border px-2.5 py-1.5 text-[11px] leading-snug text-fg-muted`,"data-testid":`skills-intro`,children:vm}),C===`loading`||C===`idle`?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-2.5 py-2 text-xs text-fg-muted`,role:`status`,children:[(0,G.jsx)(J.Spinner,{className:`h-3.5 w-3.5 animate-spin`}),` Reading this chat’s skills…`]}):C===`error`?(0,G.jsx)(`div`,{className:`px-2.5 py-2 text-xs text-fg-muted`,role:`status`,children:`The host could not list this chat’s skills right now — typing one still runs it.`}):D.length===0?(0,G.jsx)(`div`,{className:`px-2.5 py-2 text-xs text-fg-muted`,role:`status`,"data-testid":`skills-empty`,children:`No skill the model could use here yet.`}):(0,G.jsx)(`ul`,{className:`min-h-0 flex-1 overflow-y-auto py-1`,onScroll:()=>{h&&g(null)},children:D.map(t=>(0,G.jsx)(MP,{skill:t,on:mm(E,t.name),disabled:e,onToggle:()=>re(t),cardOpen:ne?.name===t.name,cardId:_,onEnter:e=>ee(t.name,e),onLeave:te,onInfoFocus:e=>P(t.name,e),onInfoBlur:F},t.name))}),(0,G.jsxs)(`div`,{className:`space-y-0.5 border-t border-border px-2.5 py-1.5 text-[11px] leading-snug text-fg-faint`,children:[w&&w.typeOnly>0?(0,G.jsx)(`p`,{"data-testid":`skills-type-only`,children:w.typeOnly===1?`1 more skill is in the / menu for typing only — the model is never shown it.`:`${w.typeOnly} more skills are in the / menu for typing only — the model is never shown them.`}):null,O.count===0?(0,G.jsx)(`p`,{"data-testid":`skills-tool-note`,children:bm}):null,A?(0,G.jsx)(`p`,{"data-testid":`skills-restart-note`,children:ym}):null]})]})}):null,ne&&h?(0,G.jsx)(DP,{skill:ne,on:mm(E,ne.name),row:h.row,panel:h.panel,id:_,cardRef:m,onMouseEnter:()=>{b.current&&clearTimeout(b.current),b.current=null},onMouseLeave:()=>{h.via===`hover`&&N()},onBlur:F}):null]})}function MP({skill:e,on:t,disabled:n,onToggle:r,cardOpen:i,cardId:a,onEnter:o,onLeave:s,onInfoFocus:c,onInfoBlur:l}){let u=`${e.label}: the model may use it on its own in this chat`;return(0,G.jsxs)(`li`,{className:W(`flex items-start gap-3 px-2.5 py-2 hover:bg-surface-2`,i&&`bg-surface-2`),"data-testid":`skill-row-${e.name}`,onMouseEnter:e=>o(e.currentTarget),onMouseLeave:s,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsxs)(`span`,{className:`truncate font-mono text-xs font-medium text-fg`,children:[`/`,e.label]}),(0,G.jsx)(EP,{skill:e,where:`row`}),(0,G.jsx)(`button`,{type:`button`,"aria-label":`About ${e.label}`,"aria-expanded":i,"aria-describedby":i?a:void 0,"data-testid":`skill-info-${e.name}`,"data-skill-info":e.name,onFocus:e=>c(e.currentTarget),onClick:e=>c(e.currentTarget),onBlur:l,className:`shrink-0 cursor-help rounded text-fg-faint hover:text-fg focus-visible:text-fg focus-visible:outline-2 focus-visible:outline-accent`,children:(0,G.jsx)(J.Info,{className:`w-3.5 h-3.5`})})]}),e.description?(0,G.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-[11px] leading-snug text-fg-muted`,children:e.description}):null,(0,G.jsxs)(`p`,{className:`mt-0.5 text-[10px] text-fg-faint`,"data-testid":`skill-tokens-${e.name}`,children:[`≈`,e.tokens.toLocaleString(),` tokens per request while on`,e.typeable?` · type it to use it once`:` · the model’s only — cannot be typed`]})]}),(0,G.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"aria-label":u,title:`Model may use it on its own`,disabled:n,"data-testid":`skill-switch-${e.name}`,onClick:r,className:W(`relative mt-0.5 h-5 w-9 shrink-0 rounded-full border transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent disabled:opacity-50`,t?`border-accent bg-accent`:`border-border bg-surface-2`),children:(0,G.jsx)(`span`,{className:W(`absolute top-0.5 h-3.5 w-3.5 rounded-full bg-surface transition-all`,t?`left-[1.15rem]`:`left-0.5`)})})]})}var NP=new Set([`Task`,`Agent`,`Workflow`]);function PP(e){let t=[],n=[];for(let r of e)(r.running?t:n).push(r);return t.concat(n)}function FP(e){return e.kind===`tool`&&NP.has(e.name)}var IP=new Set([`streaming`,`pending`,`running`]);function LP(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function RP(e){return typeof e==`string`&&e.trim()?e.trim():null}function zP(e){let t=e.result?.structured;return t&&typeof t==`object`?t:null}function BP(e){if(e.kind===`tool`&&e.startedAt!==null)return e.startedAt;if(e.timestamp){let t=Date.parse(e.timestamp);if(Number.isFinite(t))return t}return null}var VP=new Map;function HP(e,t){let n=VP.get(t);n||(n=RegExp(`<${t}>([\\s\\S]*?)</${t}>`),VP.set(t,n));let r=n.exec(e);return r?r[1].trim():null}function UP(e,t,n){for(let r of e){if(HP(r.text,`task-id`)!==t)continue;let e=HP(r.text,`tool-use-id`);if(e&&e!==n)continue;let i=HP(r.text,`usage`)??``;return{status:HP(r.text,`status`),tokens:LP(Number(HP(i,`subagent_tokens`)??NaN)),toolUses:LP(Number(HP(i,`tool_uses`)??NaN)),durationMs:LP(Number(HP(i,`duration_ms`)??NaN)),at:BP(r)}}return null}var WP={alive:!0,since:null};function GP(e,t){return e.alive?e.since===null||t===null||t<=0||t>=e.since:!1}function KP(e,t=Date.now(),n={},r=WP){let i=e.filter(FP),a=e.filter(e=>e.kind===`user`&&e.text.includes(`<task-notification>`)),o=JP(i,e,a,t,r),s=qP(e,a,new Set(o.map(e=>e.agentId)),t,n,r);return[...o,...s]}function qP(e,t,n,r,i,a){let o=[],s=new Set(n),c=new Map;for(let e of t){let t=HP(e.text,`task-id`);if(!t||n.has(t))continue;let r=HP(e.text,`usage`)??``,i=HP(e.text,`status`),a=(HP(e.text,`summary`)??``).split(`
147
147
  `)[0].trim(),o=BP(e)??0,s=c.get(t);s&&s.at>o||c.set(t,{at:o,view:{id:`note:${t}`,agentId:t,name:a.length>0?a.length>80?`${a.slice(0,79)}…`:a:`background task`,type:null,model:null,status:i&&i!==`completed`?`error`:`done`,running:!1,startedAt:null,endedAt:o>0?o:null,durationMs:LP(Number(HP(r,`duration_ms`)??NaN)),tokens:LP(Number(HP(r,`subagent_tokens`)??NaN)),toolCalls:LP(Number(HP(r,`tool_uses`)??NaN))??0,runs:1,nested:0,depth:0}})}for(let[e,t]of c)s.add(e),o.push(t.view);let l=new Map;for(let t of e){if(t.kind!==`permission`)continue;let e=t.request.agentId;if(!e||s.has(e))continue;let n=BP(t),r=l.get(e);r?(r.count+=1,(r.first===null||n!==null&&n<r.first)&&(r.first=n),n!==null&&(r.last===null||n>r.last)&&(r.last=n)):l.set(e,{first:n,last:n,count:1})}for(let[e,t]of l){let n=i[e],c=n?.finished===!0,l=n&&n.at>0?n.at:t.last,u=!c&&GP(a,l),d=n&&n.firstAt>0?t.first===null?n.firstAt:Math.min(t.first,n.firstAt):t.first,f=u?null:c&&n&&n.at>0?n.at:null;o.push({id:`perm:${e}`,agentId:e,name:`background agent`,type:null,model:null,status:u?`running`:c?`done`:`cancelled`,running:u,startedAt:d,endedAt:f,durationMs:d===null?null:Math.max(0,(u?r:f??l??d)-d),tokens:null,toolCalls:Math.max(t.count,n?.toolUses??0),runs:1,nested:0,depth:0}),s.add(e)}for(let[e,t]of Object.entries(i)){if(s.has(e)||l.has(e))continue;let n=!t.finished&&GP(a,t.at>0?t.at:null),i=t.firstAt>0?t.firstAt:null,c=n?null:t.finished&&t.at>0?t.at:null,u=n?r:t.at>0?t.at:i;o.push({id:`act:${e}`,agentId:e,name:`background agent`,type:null,model:null,status:n?`running`:t.finished?`done`:`cancelled`,running:n,startedAt:i,endedAt:c,durationMs:i!==null&&u!==null&&u>0?Math.max(0,u-i):null,tokens:null,toolCalls:t.toolUses,runs:1,nested:0,depth:0})}return o}function JP(e,t,n,r,i){if(e.length===0)return[];let a=new Map(e.map(e=>[e.toolUseId,e])),o=t.filter(e=>e.kind===`tool`&&e.name===`SendMessage`),s=new Map,c=new Map,l=new Map;for(let e of t){if(!e.parentToolUseId||!a.has(e.parentToolUseId))continue;if(e.kind===`assistant`){L(e.model)&&l.set(e.parentToolUseId,e.model);continue}if(e.kind!==`tool`)continue;let t=FP(e)?c:s;t.set(e.parentToolUseId,(t.get(e.parentToolUseId)??0)+1)}let u=e=>{let t=0,n=e.parentToolUseId;for(;n&&a.has(n)&&t<8;)t+=1,n=a.get(n).parentToolUseId;return t};return e.map(e=>{let t=zP(e),a=RP(e.input?.subagent_type),d=RP(e.input?.description)??RP(e.input?.name)??a??e.name,f=RP(t?.agentId)??e.toolUseId,p=t?.isAsync===!0||t?.status===`async_launched`,m={id:e.toolUseId,agentId:f,name:d,type:a,model:l.get(e.toolUseId)??null,startedAt:e.startedAt,nested:c.get(e.toolUseId)??0,depth:u(e)};if(!p){let n=IP.has(e.status)&&!e.result&&GP(i,e.startedAt),a=LP(t?.totalDurationMs)??e.durationMs??(n&&e.startedAt!==null?Math.max(0,r-e.startedAt):e.elapsedSec===null?null:e.elapsedSec*1e3);return{...m,status:n?e.status:IP.has(e.status)?`cancelled`:e.status,running:n,endedAt:n?null:e.finishedAt,durationMs:a,tokens:LP(t?.totalTokens),toolCalls:LP(t?.totalToolUseCount)??s.get(e.toolUseId)??0,runs:1}}let h=[e,...o.filter(e=>{let t=zP(e),n=RP(e.input?.to);return RP(t?.resumedAgentId)===f||n===f||n===d})],g=null,_=null,v=!1,y=!1,b=!1,x=null,S=null,C=null;for(let t of h){let a=UP(n,f,t.toolUseId),o=BP(t);if(!a){if(t!==e&&zP(t)?.success===!1||t!==e&&t.result?.isError)continue;S=o,GP(i,o)?(v=!0,x=o===null?null:Math.max(0,r-o)):(b=!0,x=null),C=null;continue}a.tokens!==null&&(g=(g??0)+a.tokens),a.toolUses!==null&&(_=(_??0)+a.toolUses),a.status&&a.status!==`completed`&&(y=!0),x=a.durationMs??(a.at!==null&&o!==null?Math.max(0,a.at-o):null),S=o,C=a.at}let w=v?`running`:y||e.status===`error`||e.status===`denied`?`error`:b?`cancelled`:`done`;return{...m,startedAt:S??e.startedAt,status:w,running:v,endedAt:v?null:C,durationMs:x,tokens:g,toolCalls:Math.max(_??0,s.get(e.toolUseId)??0),runs:h.length}})}var YP=1e3,XP=6e4;function ZP(){let e=mb(),t=hb(),n=e?.items,[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(()=>Date.now()),s=(0,v.useRef)(null),c=e?.agentActivity,l=e?.status===`running`||e?.status===`waiting_permission`,u=e?.engineSince??null,d=e?.hasSubagentItems===!0||t?.hasSubagents===!0||Object.keys(c??{}).length>0,f=(0,v.useMemo)(()=>n&&d?KP(n,a,c??{},{alive:l,since:u}):[],[n,d,a,c,l,u]),p=f.filter(e=>e.running).length,[m,h]=(0,v.useState)(!1),g=(0,v.useMemo)(()=>m?f:f.filter(e=>e.running||e.endedAt!==null&&a-e.endedAt<XP),[f,a,m]),_=f.length-g.length;if((0,v.useEffect)(()=>{if(!r)return;let e=setInterval(()=>o(Date.now()),YP);return()=>clearInterval(e)},[r]),(0,v.useEffect)(()=>{if(!r)return;let e=e=>{s.current?.contains(e.target)||i(!1)},t=e=>{e.key===`Escape`&&i(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[r]),(0,v.useEffect)(()=>{i(!1),h(!1)},[e?.sessionId]),f.length===0)return null;let y=p>0?`${p} working`:`${f.length} ${f.length===1?`agent`:`agents`} finished`;return(0,G.jsxs)(`span`,{ref:s,className:`relative inline-flex items-center`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-label":y,title:y,"aria-haspopup":`dialog`,"aria-expanded":r,"data-testid":`subagents-badge`,onClick:()=>{o(Date.now()),i(e=>!e)},className:W(`flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded px-1.5 py-0.5 text-xs text-fg-muted hover:bg-fg/5`),children:[(0,G.jsx)(J.Bot,{className:W(`w-3.5 h-3.5`,p>0&&`text-accent`)}),(0,G.jsxs)(`span`,{"data-testid":`subagents-total`,children:[f.length,` `,f.length===1?`agent`:`agents`]}),p>0?(0,G.jsxs)(`span`,{className:`text-accent`,"data-testid":`subagents-working`,children:[`· `,p,` working`]}):null,p>0?(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 animate-pulse rounded-full bg-accent`,"data-testid":`subagents-running`}):null]}),r?(0,G.jsx)(`div`,{role:`dialog`,"aria-label":`Subagents of this chat`,"data-testid":`subagents-panel`,className:`absolute bottom-full left-0 z-50 mb-1 w-[24rem] max-w-[calc(100vw-2rem)]`,children:(0,G.jsxs)(`div`,{className:`max-h-[22rem] overflow-hidden rounded-lg border border-border bg-surface shadow-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-2.5 py-1.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:[(0,G.jsx)(J.Bot,{className:`w-3.5 h-3.5 text-fg-faint`}),(0,G.jsx)(`span`,{className:`flex-1`,children:`Subagents`}),(0,G.jsx)(`span`,{className:`normal-case tracking-normal text-fg-faint`,children:y})]}),(0,G.jsxs)(`ul`,{className:`max-h-[19rem] overflow-y-auto py-1`,children:[PP(g).map(e=>(0,G.jsx)(QP,{agent:e,onJump:()=>i(!1)},e.id)),g.length===0?(0,G.jsx)(`li`,{className:`px-2.5 py-2 text-xs text-fg-faint`,children:`Nothing is working now.`}):null]}),_>0||m?(0,G.jsx)(`button`,{type:`button`,onClick:()=>h(e=>!e),"data-testid":`subagents-toggle-finished`,className:`w-full border-t border-border px-2.5 py-1.5 text-left text-[11px] text-fg-faint hover:bg-surface-2 hover:text-fg`,children:m?`Hide finished agents`:`${_} finished ${_===1?`agent`:`agents`} hidden — show`}):null]})}):null]})}function QP({agent:e,onJump:t}){let n=()=>{document.querySelector(`[data-testid="tool-${e.id}"]`)?.scrollIntoView({block:`center`,behavior:`smooth`}),t()},r=e.status===`error`||e.status===`denied`,i=r?`danger`:e.running?`accent`:`neutral`,a=e.running?`working`:e.status,o=!e.running;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:n,"data-testid":`subagent-${e.id}`,"data-state":e.running?`working`:r?`failed`:`done`,title:`Show this subagent's card in the chat`,className:W(`flex w-full flex-col gap-0.5 px-2.5 py-1.5 text-left hover:bg-surface-2`,o&&!r&&`opacity-60 hover:opacity-100`),style:e.depth?{paddingLeft:`${.625+e.depth*.75}rem`}:void 0,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.running?(0,G.jsx)(J.Spinner,{className:`w-3 h-3 text-accent`}):(0,G.jsx)(J.Bot,{className:`w-3 h-3 text-fg-faint`}),(0,G.jsx)(`span`,{className:W(`min-w-0 flex-1 truncate text-sm font-medium`,o?`text-fg-muted`:`text-fg`),children:e.name}),(0,G.jsx)(Q,{tone:i,children:a})]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-3 pl-5 text-[11px] text-fg-faint`,children:[e.type&&e.type!==e.name?(0,G.jsx)(`span`,{className:`font-mono`,children:e.type}):null,e.model?(0,G.jsx)(`span`,{className:`font-mono`,"data-testid":`subagent-model-${e.agentId}`,children:e.model}):null,e.runs>1?(0,G.jsxs)(`span`,{children:[`resumed ×`,e.runs-1]}):null,e.durationMs===null?null:(0,G.jsx)(`span`,{children:Hg(e.durationMs)}),e.tokens===null?null:(0,G.jsxs)(`span`,{children:[Ug(e.tokens),` tokens`]}),(0,G.jsxs)(`span`,{children:[e.toolCalls,` `,e.toolCalls===1?`tool call`:`tool calls`]}),e.nested>0?(0,G.jsxs)(`span`,{children:[e.nested,` `,e.nested===1?`subagent`:`subagents`]}):null]})]})})}function $P({sessionId:e,projectId:t,showChat:n=!1}){let{state:r,actions:i}=K(),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(null),l=r.scheduledTasksVersion;(0,v.useEffect)(()=>{let n=!0;return i.listScheduledTasks({...e?{sessionId:e}:{},...t?{projectId:t}:{}}).then(e=>{n&&o(e)}),()=>{n=!1}},[e,t,l]);let u=e=>r.sessions.find(t=>t.id===e)?.title??`a chat`;return a===null?null:a.length===0?(0,G.jsx)(`p`,{className:`text-xs text-fg-muted`,"data-testid":`scheduled-tasks-empty`,children:`No scheduled tasks. Ask the agent to do something later or on a repeat — it uses OonaCode's scheduler, which runs on this PC even when the chat has gone quiet.`}):(0,G.jsx)(`ul`,{className:`space-y-1.5`,"data-testid":`scheduled-tasks`,children:a.map(e=>(0,G.jsxs)(`li`,{className:`rounded-md border border-border px-2.5 py-1.5 text-xs`,"data-testid":`scheduled-task-${e.id}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-fg`,title:e.prompt,children:e.title}),(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,onClick:()=>void i.updateScheduledTask(e.id,{enabled:!e.enabled}),disabled:!e.enabled&&e.nextRunAt===null&&`at`in e.when,"data-testid":`scheduled-task-toggle`,children:e.enabled?`Pause`:`Resume`}),(0,G.jsx)(Y,{size:`sm`,variant:s===e.id?`danger`:`ghost`,onClick:()=>{if(s!==e.id){c(e.id);return}c(null),i.deleteScheduledTask(e.id)},"data-testid":`scheduled-task-delete`,children:s===e.id?`Delete?`:`Delete`})]}),(0,G.jsxs)(`div`,{className:`mt-0.5 text-fg-muted`,children:[Uf(e.when),` · `,Wf(e.nextRunAt,e.enabled),n?` · in “${u(e.sessionId)}”`:``,e.createdBy===`model`?` · set by the agent`:``]}),e.lastResult?(0,G.jsxs)(`div`,{className:`text-fg-faint`,"data-testid":`scheduled-task-result`,children:[`last: `,e.lastResult]}):null]},e.id))})}function eF(e,t){let n=new Date(e),r=n.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});return n.toDateString()===t.toDateString()?r:`${n.toLocaleDateString(void 0,{month:`short`,day:`numeric`})} ${r}`}function tF(){let{state:e,actions:t}=K(),n=hb(),r=n?.id??null,i=e.scheduledTasksVersion,[a,o]=(0,v.useState)([]),[s,c]=(0,v.useState)(!1),l=(0,v.useRef)(null);if((0,v.useEffect)(()=>{if(!r){o([]);return}let e=!0;return t.listScheduledTasks({sessionId:r}).then(t=>{e&&o(t)}).catch(()=>{e&&o([])}),()=>{e=!1}},[r,i]),(0,v.useEffect)(()=>{if(!s)return;let e=e=>{l.current?.contains(e.target)||c(!1)},t=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[s]),(0,v.useEffect)(()=>c(!1),[r]),!r||a.length===0)return null;let u=e.providers.find(e=>e.definition.id===n?.providerId),d=u?.definition.models.find(e=>e.id===n?.model)?.displayName??n?.model??null,f=a.filter(e=>e.enabled&&e.nextRunAt!==null),p=f.map(e=>e.nextRunAt).sort().at(0),m=f.length>0?`${f.length} scheduled${p?` · next ${eF(p,new Date)}`:``}`:`${a.length} scheduled · paused`;return(0,G.jsxs)(`span`,{ref:l,className:`relative inline-flex items-center`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-label":`Scheduled tasks: ${m}`,title:`Scheduled tasks of this chat — ${m}`,"aria-haspopup":`dialog`,"aria-expanded":s,"data-testid":`scheduled-badge`,onClick:()=>c(e=>!e),className:W(`flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded px-1.5 py-0.5 text-xs hover:bg-fg/5`,f.length>0?`text-accent`:`text-fg-muted`),children:[(0,G.jsx)(J.Clock,{className:`w-3.5 h-3.5`}),(0,G.jsx)(`span`,{children:m})]}),s?(0,G.jsx)(`div`,{role:`dialog`,"aria-label":`Scheduled tasks of this chat`,"data-testid":`scheduled-panel`,className:`absolute bottom-full left-0 z-50 mb-1 w-[26rem] max-w-[calc(100vw-2rem)]`,children:(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-border bg-surface shadow-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-2.5 py-1.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:[(0,G.jsx)(J.Clock,{className:`w-3.5 h-3.5 text-fg-faint`}),(0,G.jsx)(`span`,{className:`flex-1`,children:`Scheduled tasks`}),(0,G.jsx)(`span`,{className:`normal-case tracking-normal text-fg-faint`,children:`runs on this PC`})]}),d?(0,G.jsxs)(`div`,{className:`border-b border-border px-2.5 py-1 text-xs text-fg-muted`,"data-testid":`scheduled-model`,children:[`Each run uses this chat's model at that moment — now`,` `,(0,G.jsx)(`span`,{className:`text-fg`,children:d}),u?` · ${u.definition.displayName}`:``,`. Change the chat's model and the next run follows it.`]}):null,(0,G.jsx)(`div`,{className:`max-h-[22rem] overflow-y-auto p-2`,children:(0,G.jsx)($P,{sessionId:r})})]})}):null]})}function nF(){let{state:e,actions:t}=K(),n=hb()?.id??null,r=n!==null&&e.remote.tabs[n]!==void 0,i=n?e.chatConversations[n]:void 0,a=e.conversationsChange,[o,s]=(0,v.useState)(!1),c=(0,v.useRef)(null),l=(0,v.useRef)({sessionId:null,seq:-1}),u=(0,v.useRef)(i);if(u.current=i,(0,v.useEffect)(()=>{if(!n||r)return;let e=l.current,i=e.sessionId!==n;if(!i&&e.seq===a.seq)return;l.current={sessionId:n,seq:a.seq};let o=(u.current??[]).map(e=>e.id);!i&&!df(a,{sessionId:n,conversationIds:o})||t.refreshChatConversations(n)},[n,r,a,t]),(0,v.useEffect)(()=>{if(!o)return;let e=e=>{c.current?.contains(e.target)||s(!1)},t=e=>{e.key===`Escape`&&s(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[o]),(0,v.useEffect)(()=>s(!1),[n]),!n||r||!i)return null;let d=hf(i,n);if(d.length===0)return null;let f=_f(d),p=d.some(gf),m=async e=>{await t.conversationAction(e.id,e.status===`active`?`pause`:`resume`)&&t.refreshChatConversations(n)},h=e=>{s(!1),t.openConversations(e??null)};return(0,G.jsxs)(`span`,{ref:c,className:`relative inline-flex items-center`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-label":`Conversations with other chats: ${f}`,title:`This chat's conversations with your other chats — ${f}. A conversation is active while one of its chats is on a turn or a message of it waits to be delivered.`,"aria-haspopup":`dialog`,"aria-expanded":o,"data-testid":`conversations-badge`,onClick:()=>s(e=>!e),className:W(`flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded px-1.5 py-0.5 text-xs hover:bg-fg/5`,p?`text-accent`:`text-fg-muted`),children:[(0,G.jsx)(J.Chats,{className:`w-3.5 h-3.5`}),(0,G.jsx)(`span`,{children:f})]}),o?(0,G.jsx)(`div`,{role:`dialog`,"aria-label":`Conversations of this chat`,"data-testid":`conversations-badge-panel`,className:`absolute bottom-full left-0 z-50 mb-1 w-[26rem] max-w-[calc(100vw-2rem)]`,children:(0,G.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-border bg-surface shadow-lg`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-2.5 py-1.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:[(0,G.jsx)(J.Chats,{className:`w-3.5 h-3.5 text-fg-faint`}),(0,G.jsx)(`span`,{className:`flex-1`,children:`Conversations with other chats`}),(0,G.jsx)(`span`,{className:`normal-case tracking-normal text-fg-faint`,children:`on this PC`})]}),(0,G.jsx)(`ul`,{className:`max-h-[22rem] space-y-1.5 overflow-y-auto p-2`,children:d.map(e=>(0,G.jsxs)(`li`,{className:`rounded-md border border-border px-2.5 py-1.5 text-xs`,"data-testid":`conversations-badge-item-${e.id}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-fg`,children:pf(e)}),(0,G.jsx)(`span`,{title:Pf.status,children:(0,G.jsx)(Q,{tone:yf(e.status),children:vf[e.status]})})]}),(0,G.jsxs)(`div`,{className:`mt-0.5 text-fg-muted`,"data-testid":`conversations-badge-usage`,children:[e.used.messages,` of `,e.budget.messages,` messages ·`,` `,Ug(e.used.tokens),` of `,Ug(e.budget.tokens),` tokens`]}),e.status===`paused`&&e.pausedReason?(0,G.jsxs)(`div`,{className:`text-warn`,children:[`Paused: `,e.pausedReason]}):null,(0,G.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,onClick:()=>void m(e),title:e.status===`active`?Pf.pause:Pf.resume,"data-testid":`conversations-badge-toggle`,children:e.status===`active`?`Pause`:`Resume`}),(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,onClick:()=>h(e.id),title:`See every message of this conversation, what it cost, and all its controls`,"data-testid":`conversations-badge-open`,children:`Open in Conversations`})]})]},e.id))}),(0,G.jsx)(`div`,{className:`border-t border-border px-2.5 py-1.5 text-right`,children:(0,G.jsx)(`button`,{type:`button`,className:`text-xs text-accent hover:underline`,onClick:()=>h(),"data-testid":`conversations-badge-all`,children:`All conversations on this PC`})})]})}):null]})}var rF=null,iF=460,aF=8;function oF(e,t){if(typeof window>`u`)return e;let n=t?.offsetWidth??iF,r=t?.offsetHeight??200;return{left:Math.min(Math.max(aF,e.left),Math.max(aF,window.innerWidth-n-aF)),top:Math.min(Math.max(aF,e.top),Math.max(aF,window.innerHeight-r-aF))}}function sF(e,t,n,r){return e===t?`current`:r[e]?`skipped`:n[e]?`answered`:`open`}function cF({item:e,onDecide:t,cardRef:n,stackIndex:r=0}){let i=e.request,a=Ll(i.input),{groupId:o}=fb(),[s,c]=(0,v.useState)(0),[l,u]=(0,v.useState)({}),[d,f]=(0,v.useState)({}),[p,m]=(0,v.useState)({}),[h,g]=(0,v.useState)(rF),_=(0,v.useRef)(null),y=a[s],b=s===a.length-1,x=e=>(l[e]??[]).length>0||(d[e]??``).trim().length>0,S={};a.forEach((e,t)=>{S[t]=x(t)});let C=new Set(Object.entries(p).filter(([,e])=>e).map(([e])=>Number(e))),w=Rl(a,l,d,C),T=a.every((e,t)=>S[t]||p[t]),E=a.some((e,t)=>S[t]&&!p[t]),D=(e,t,n)=>{m(t=>t[e]?{...t,[e]:!1}:t),f(t=>t[e]?{...t,[e]:``}:t),u(r=>{let i=r[e]??[];return n?{...r,[e]:i.includes(t)?i.filter(e=>e!==t):[...i,t]}:{...r,[e]:i[0]===t?[]:[t]}})},O=(0,v.useCallback)(()=>{if(T){if(!E){t({behavior:`deny`,message:Fl});return}t({behavior:`allow`,updatedInput:{...i.input,answers:w}})}},[T,E,t,i.input,w]),k=()=>{y&&(!S[s]&&!p[s]||(b?O():c(s+1)))},A=()=>{if(m(e=>({...e,[s]:!0})),u(e=>({...e,[s]:[]})),f(e=>({...e,[s]:``})),b){let e=new Set([...C,s]);if(!a.some((t,n)=>S[n]&&!e.has(n))){t({behavior:`deny`,message:Fl});return}let n={...l,[s]:[]},r={...d,[s]:``};t({behavior:`allow`,updatedInput:{...i.input,answers:Rl(a,n,r,e)}});return}c(s+1)},j=e=>{if(e.button!==0)return;let t=n.current;if(!t)return;let r=t.getBoundingClientRect();_.current={dx:e.clientX-r.left,dy:e.clientY-r.top},e.preventDefault();let i=e=>{let t=_.current;if(!t)return;let r=oF({left:e.clientX-t.dx,top:e.clientY-t.dy},n.current);rF=r,g(r)},a=()=>{_.current=null,document.removeEventListener(`mousemove`,i),document.removeEventListener(`mouseup`,a)};document.addEventListener(`mousemove`,i),document.addEventListener(`mouseup`,a)};if((0,v.useEffect)(()=>{if(h){let e=oF(h,n.current);(e.left!==h.left||e.top!==h.top)&&g(e)}},[]),typeof document>`u`||a.length===0)return null;let M=h?{left:h.left+r*24,top:h.top+r*24}:{right:16+r*24,bottom:132+r*24};return(0,Sb.createPortal)((0,G.jsxs)(`div`,{ref:n,className:`fixed z-30 flex max-h-[70vh] w-[460px] max-w-[calc(100vw-16px)] flex-col rounded-xl border border-accent/50 bg-surface text-sm shadow-xl`,style:M,role:`group`,"aria-label":`The model has a question`,"data-permission-pending":`true`,"data-chat-group":o,"data-testid":`question-${i.requestId}`,children:[(0,G.jsxs)(`div`,{className:`flex cursor-move select-none items-center gap-2 rounded-t-xl border-b border-border bg-accent-soft/40 px-3 py-2`,onMouseDown:j,"data-testid":`question-drag-handle`,title:`Drag to move`,children:[(0,G.jsx)(J.Info,{className:`w-4 h-4 text-accent`}),(0,G.jsx)(`span`,{className:`font-semibold`,children:a.length>1?`The model has questions`:`The model has a question`}),i.agentId?(0,G.jsx)(Q,{tone:`think`,children:`subagent`}):null,(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsxs)(`span`,{className:`text-[11px] text-fg-faint`,"data-testid":`question-step`,children:[s+1,` of `,a.length]})]}),a.length>1?(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1 border-b border-border px-3 py-1.5`,role:`tablist`,"data-testid":`question-tabs`,children:a.map((e,t)=>{let n=sF(t,s,S,p);return(0,G.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t===s,onClick:()=>c(t),"data-testid":`question-tab`,"data-state":n,title:e.question,className:`flex items-center gap-1 rounded-md border px-2 py-0.5 text-[11px] transition `+(t===s?`border-accent bg-accent text-accent-fg`:`border-border bg-surface text-fg-muted hover:border-accent/60`),children:[n===`answered`?(0,G.jsx)(J.Check,{className:`w-3 h-3`}):null,n===`skipped`?(0,G.jsx)(`span`,{"aria-hidden":!0,children:`–`}):null,e.header||`Q${t+1}`]},t)})}):null,y?(0,G.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 py-2.5`,"data-testid":`question-body`,children:[(0,G.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[y.header?(0,G.jsx)(Q,{tone:`accent`,children:y.header}):null,(0,G.jsx)(`span`,{className:`font-medium`,children:y.question})]}),(0,G.jsx)(`div`,{className:`space-y-1`,role:y.multiSelect?`group`:`radiogroup`,"aria-label":y.multiSelect?`choose any`:`choose one`,children:y.options.map(e=>{let t=(l[s]??[]).includes(e.label);return(0,G.jsxs)(`button`,{type:`button`,role:y.multiSelect?`checkbox`:`radio`,"aria-checked":t,onClick:()=>D(s,e.label,y.multiSelect),"data-testid":`question-option`,"data-label":e.label,className:`flex w-full items-start gap-2.5 rounded-md border px-2.5 py-1.5 text-left transition `+(t?`border-accent bg-accent-soft/60`:`border-border bg-surface hover:border-accent/60`),children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`mt-0.5 flex h-3.5 w-3.5 shrink-0 items-center justify-center border `+(y.multiSelect?`rounded-sm `:`rounded-full `)+(t?`border-accent bg-accent text-accent-fg`:`border-fg-faint`),children:t?(0,G.jsx)(J.Check,{className:`w-2.5 h-2.5`}):null}),(0,G.jsxs)(`span`,{className:`min-w-0`,children:[(0,G.jsx)(`span`,{className:`block text-sm`,children:e.label}),e.description?(0,G.jsx)(`span`,{className:`block text-[11px] leading-snug text-fg-muted`,children:e.description}):null]})]},e.label)})}),(0,G.jsx)(`input`,{className:Z+` mt-2 text-xs`,value:d[s]??``,onChange:e=>{let t=e.target.value;f(e=>({...e,[s]:t})),t.trim()&&(m(e=>e[s]?{...e,[s]:!1}:e),u(e=>(e[s]??[]).length>0?{...e,[s]:[]}:e))},placeholder:y.options.length>0?`Other — type your own answer`:`Type your answer`,autoComplete:`off`,"data-testid":`question-custom`,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),k())}}),y.multiSelect?(0,G.jsx)(`div`,{className:`mt-1 text-[11px] text-fg-faint`,children:`Choose any that apply.`}):null]}):null,(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-border px-3 py-2`,children:[(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,disabled:s===0,onClick:()=>c(s-1),"data-testid":`question-back`,children:`Back`}),(0,G.jsx)(Y,{size:`sm`,onClick:A,"data-testid":`question-skip`,children:`Skip`}),(0,G.jsx)(`span`,{className:`flex-1`}),b?(0,G.jsx)(Y,{size:`sm`,variant:`primary`,disabled:!T,onClick:O,"data-testid":`question-answer`,children:`Answer`}):(0,G.jsxs)(Y,{size:`sm`,variant:`primary`,disabled:!S[s]&&!p[s],onClick:k,"data-testid":`question-next`,children:[`Next `,(0,G.jsx)(J.ChevronRight,{className:`w-3.5 h-3.5`})]})]})]}),document.body)}function lF({input:e,requestId:t,onDecide:n,cardRef:r}){return(0,G.jsxs)(`div`,{ref:r,className:`my-2 rounded-lg border border-accent/50 bg-accent-soft/40 p-3 text-sm shadow-sm`,role:`group`,"aria-label":`Install ${e.name}`,"data-permission-pending":`true`,"data-testid":`permission-${t}`,"data-install-pack":e.pack,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(J.Download,{className:`mt-0.5 w-4 h-4 shrink-0 text-accent`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`font-semibold`,"data-testid":`tool-install-title`,children:[`Install `,e.name,`?`]}),(0,G.jsxs)(`div`,{className:`mt-0.5 text-fg-muted`,children:[`The agent wants to use `,e.name,`. It is downloaded once —`,` `,(0,G.jsx)(`span`,{className:`font-medium text-fg`,"data-testid":`tool-install-size`,children:Zl(e.sizeBytes)}),` `,`— and after that it opens without asking, in every chat.`]}),(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-fg-faint`,children:[`Installs into`,` `,(0,G.jsx)(`span`,{className:`break-all font-mono`,"data-testid":`tool-install-path`,children:e.path}),` `,`· version `,e.version]})]})]}),(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(Y,{variant:`inverse`,onClick:()=>n({behavior:`allow`}),"data-testid":`tool-install-allow`,"data-autofocus":!0,children:[(0,G.jsx)(J.Download,{className:`w-3.5 h-3.5`}),` Install`]}),(0,G.jsx)(Y,{variant:`ghost`,onClick:()=>n({behavior:`deny`,message:`The person chose not to install ${e.name} now.`}),"data-testid":`tool-install-deny`,children:`Not now`}),(0,G.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`Esc = not now`})]})]})}var uF={downloading:`Downloading`,verifying:`Checking`,unpacking:`Unpacking`,done:`Installed`,failed:`Could not install`};function dF(e){let t=`${uF[e.phase]} ${e.name}`;return e.phase===`failed`?`${t}: ${e.error??`unknown error`}`:e.phase===`downloading`&&e.totalBytes>0?`${t} — ${Zl(e.receivedBytes)} of ${Zl(e.totalBytes)}`:e.phase===`unpacking`&&e.totalBytes>0?`${t} — ${Math.min(100,Math.round(e.receivedBytes/e.totalBytes*100))} %`:`${t}…`}function fF({frame:e,onDismiss:t}){let n=e.phase===`failed`,r=(e.phase===`downloading`||e.phase===`unpacking`)&&e.totalBytes>0?Math.min(100,Math.round(e.receivedBytes/e.totalBytes*100)):e.phase===`verifying`?100:null;return(0,G.jsxs)(`div`,{className:`mb-2 rounded-md border px-3 py-2 text-xs `+(n?`border-danger/40 bg-danger/10 text-danger`:`border-accent/40 bg-accent/10 text-fg`),role:`status`,"data-testid":`tool-install-progress`,"data-phase":e.phase,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1`,children:dF(e)}),n?(0,G.jsx)(`button`,{type:`button`,"aria-label":`Dismiss`,className:`shrink-0 rounded p-0.5 hover:bg-danger/20`,onClick:t,children:(0,G.jsx)(J.X,{className:`w-3 h-3`})}):null]}),r===null?null:(0,G.jsx)(`div`,{className:`mt-1 h-1 w-full overflow-hidden rounded bg-fg/10`,children:(0,G.jsx)(`div`,{className:`h-full bg-accent transition-[width] duration-200`,style:{width:`${r}%`},"data-testid":`tool-install-bar`})})]})}function pF({input:e,requestId:t,onDecide:n,cardRef:r}){let i=(0,v.useMemo)(()=>wS(e.arguments),[e.arguments]),a=Object.keys(e.arguments);return(0,G.jsxs)(`div`,{ref:r,className:`my-2 rounded-lg border border-warn/60 bg-warn-soft/40 p-3 text-sm shadow-sm`,role:`group`,"aria-label":`${e.vendor} change request`,"data-permission-pending":`true`,"data-testid":`permission-${t}`,"data-connector-change":e.connector,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(J.Shield,{className:`mt-0.5 w-4 h-4 shrink-0 text-warn`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`font-semibold`,"data-testid":`connector-change-title`,children:[e.vendor,` — the agent wants to run`,` `,(0,G.jsx)(`code`,{className:`rounded bg-surface-2 px-1 font-mono text-[0.9em]`,children:e.tool})]}),e.description?(0,G.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,"data-testid":`connector-change-description`,children:e.description}):null,(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-fg-faint`,children:[`This changes something on your `,e.vendor,` account. Read the details before you agree.`]})]})]}),(0,G.jsxs)(`div`,{className:`mt-2`,children:[(0,G.jsxs)(`div`,{className:`mb-0.5 text-[11px] font-medium text-fg-muted`,children:[`Arguments`,a.length>0?` (${a.join(`, `)})`:``]}),(0,G.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words rounded border border-border bg-surface px-2 py-1.5 font-mono text-xs`,"data-testid":`connector-change-args`,tabIndex:0,children:i.text}),i.shortened?(0,G.jsx)(`div`,{className:`mt-0.5 text-[11px] text-fg-faint`,"data-testid":`connector-change-shortened`,children:`shortened — long values are cut for display.`}):null]}),(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(Y,{variant:`secondary`,onClick:()=>n({behavior:`deny`,message:`The person did not allow ${e.tool} on ${e.vendor}.`}),"data-testid":`connector-change-deny`,"data-autofocus":!0,children:[(0,G.jsx)(J.X,{className:`w-3.5 h-3.5`}),` Deny`]}),(0,G.jsxs)(Y,{variant:`inverse`,onClick:()=>n({behavior:`allow`}),"data-testid":`connector-change-allow`,children:[(0,G.jsx)(J.Check,{className:`w-3.5 h-3.5`}),` Allow once`]}),(0,G.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`Esc = deny`})]})]})}function mF({input:e,requestId:t,onDecide:n,cardRef:r}){return(0,G.jsxs)(`div`,{ref:r,className:`my-2 rounded-lg border border-accent/50 bg-accent-soft/40 p-3 text-sm shadow-sm`,role:`group`,"aria-label":`Switch this chat's workspace`,"data-permission-pending":`true`,"data-testid":`permission-${t}`,"data-workspace-switch":`true`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(J.Folder,{className:`mt-0.5 w-4 h-4 shrink-0 text-accent`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`font-semibold`,"data-testid":`workspace-switch-title`,children:[`Switch this chat's workspace to`,` `,(0,G.jsx)(`span`,{className:`break-all font-mono`,children:e.to}),`?`]}),(0,G.jsxs)(`div`,{className:`mt-1 text-xs text-fg-faint`,children:[`Now in`,` `,(0,G.jsx)(`span`,{className:`break-all font-mono`,"data-testid":`workspace-switch-from`,children:e.from}),e.create?` · the new folder is created on Switch`:``]}),(0,G.jsx)(`div`,{className:`mt-1 text-fg-muted`,children:`The chat moves when the agent's current turn ends. Your next message restarts the agent there, with that folder's CLAUDE.md and settings — the conversation is kept.`})]})]}),(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(Y,{variant:`inverse`,onClick:()=>n({behavior:`allow`}),"data-testid":`workspace-switch-allow`,"data-autofocus":!0,children:[(0,G.jsx)(J.Folder,{className:`w-3.5 h-3.5`}),` Switch`]}),(0,G.jsx)(Y,{variant:`ghost`,onClick:()=>n({behavior:`deny`}),"data-testid":`workspace-switch-deny`,children:`Not now`}),(0,G.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`Esc = not now`})]})]})}var hF=(0,v.createContext)({openChat:()=>{},openConversation:()=>{},conversationTitle:()=>null,canOpenChat:()=>!1,answerState:()=>null}),gF={message:`Message from chat`,reply:`Reply from chat`,continue:`Continue: a message from chat`},_F={message:`Another chat's agent sent this chat a message. This chat works on it with its own model, folder and permissions; its final answer goes back by itself.`,reply:`The answer another chat sent back to a message this chat sent it.`,continue:`OonaCode restarted while this chat was working on a message from another chat, so it was handed over again to finish.`},vF=(0,v.memo)(function({item:e}){let t=e.chatMarker;if(!t)return null;if(t.kind===`notice`)return(0,G.jsx)(bF,{marker:t,timestamp:e.timestamp});let n=e.chatBatch??[t];return n.length===1?(0,G.jsx)(yF,{marker:t,timestamp:e.timestamp}):(0,G.jsx)(`div`,{"data-testid":`chat-message-batch`,"data-count":n.length,children:n.map(t=>(0,G.jsx)(yF,{marker:t,timestamp:e.timestamp},t.messageId))})});function yF({marker:e,timestamp:t}){let n=(0,v.useContext)(hF);if(e.kind===`notice`)return null;let r=e.kind,i=e.title||`another chat`,a=n.conversationTitle(e.conversationId),o=r===`reply`?J.Reply:r===`continue`?J.Refresh:J.Mail,s=e.chatId!==`_`&&n.canOpenChat(e.chatId,e.hostId),c=e.replyExpected?wf(n.answerState(e.messageId)):null;return(0,G.jsxs)(`div`,{className:`my-2 overflow-hidden rounded-lg border border-accent/40 bg-accent-soft/20 text-sm`,"data-testid":`chat-message-card`,"data-kind":r,"data-message-id":e.messageId,title:Kg(t),children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-accent/20 px-3 py-1.5`,children:[(0,G.jsx)(o,{className:`h-3.5 w-3.5 shrink-0 text-accent`}),(0,G.jsxs)(`span`,{className:`min-w-0 font-medium text-fg`,title:_F[r],"data-testid":`chat-message-card-title`,children:[gF[r],` "`,i,`"`]}),e.pc?(0,G.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`on `,e.pc]}):null,a?(0,G.jsx)(`span`,{title:`The conversation this message belongs to`,children:(0,G.jsx)(Q,{tone:`accent`,children:(0,G.jsx)(`span`,{"data-testid":`chat-message-card-conversation`,children:a})})}):null,c?(0,G.jsx)(`span`,{title:c.answeredAt?`${c.help}\n\nAnswered ${Kg(c.answeredAt)}.`:c.help,children:(0,G.jsx)(Q,{tone:`neutral`,children:(0,G.jsxs)(`span`,{"data-testid":`chat-message-card-answer`,"data-state":c.label,children:[c.label,c.answeredAt?` ${qg(c.answeredAt)}`:``]})})}):null,(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>n.openConversation(e.conversationId),title:`See the whole conversation, what it cost, and pause or close it`,className:`rounded px-1.5 py-0.5 text-xs text-fg-muted hover:bg-surface-2 hover:text-fg`,"data-testid":`chat-message-card-conversation-link`,children:`Conversation`}),s?(0,G.jsxs)(`button`,{type:`button`,onClick:()=>n.openChat(e.chatId),title:`Open the chat "${i}" in a tab`,className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-accent hover:bg-accent-soft`,"data-testid":`chat-message-card-open`,children:[(0,G.jsx)(J.ExternalLink,{className:`h-3 w-3`}),` Open chat`]}):null]}),(0,G.jsx)(`div`,{className:`px-3 py-2`,"data-testid":`chat-message-card-body`,children:(0,G.jsx)(dP,{text:e.body})})]})}function bF({marker:e,timestamp:t}){let n=(0,v.useContext)(hF),r=e.body?`${e.headline}\n\n${e.body}`:e.headline,i=Kg(t);return(0,G.jsxs)(`div`,{className:`my-2 flex items-center gap-2 rounded-md border border-warn/40 bg-warn-soft px-3 py-1.5 text-xs text-warn`,"data-testid":`chat-notice`,role:`note`,children:[(0,G.jsx)(J.Alert,{className:`h-3.5 w-3.5 shrink-0`}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,title:i?`${r}\n\n${i}`:r,children:[e.headline,e.body?(0,G.jsxs)(`span`,{className:`opacity-80`,children:[` — `,e.body]}):null]}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>n.openConversation(e.conversationId),title:`Open the conversation this is about`,className:`shrink-0 rounded px-1.5 py-0.5 text-xs font-medium hover:bg-warn/10`,"data-testid":`chat-notice-open`,children:`Conversation`})]})}function xF({input:e,requestId:t,onDecide:n,cardRef:r}){let[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(e.title),[c,l]=(0,v.useState)(e.prompt),u=o.trim()!==e.title.trim(),d=c.trim()!==e.prompt.trim(),f=o.trim().length>0&&c.trim().length>0;return(0,G.jsxs)(`div`,{ref:r,className:`my-2 rounded-lg border border-accent/50 bg-accent-soft/40 p-3 text-sm shadow-sm`,role:`group`,"aria-label":`Start a new chat for this task`,"data-permission-pending":`true`,"data-testid":`permission-${t}`,"data-new-chat":`true`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(J.Chats,{className:`mt-0.5 w-4 h-4 shrink-0 text-accent`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`font-semibold`,"data-testid":`new-chat-title`,children:[`Start a new chat `,(0,G.jsxs)(`span`,{className:`break-words`,children:[`“`,o.trim()||e.title,`”`]}),` `,`for this task?`]}),e.reason?(0,G.jsx)(`div`,{className:`mt-1 text-fg-muted`,"data-testid":`new-chat-reason`,children:e.reason}):null,(0,G.jsxs)(`dl`,{className:`mt-2 grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs`,children:[(0,G.jsx)(`dt`,{className:`text-fg-faint`,children:`Folder`}),(0,G.jsx)(`dd`,{className:`min-w-0 break-all font-mono`,"data-testid":`new-chat-folder`,children:Pp(e)}),e.providerId?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-fg-faint`,children:`Provider`}),(0,G.jsx)(`dd`,{className:`min-w-0 break-all font-mono`,"data-testid":`new-chat-provider`,children:e.providerId})]}):null,(0,G.jsx)(`dt`,{className:`text-fg-faint`,children:`Model`}),(0,G.jsx)(`dd`,{className:`min-w-0 break-all font-mono`,"data-testid":`new-chat-model`,children:e.model??`the default model`}),e.effort?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-fg-faint`,children:`Effort`}),(0,G.jsx)(`dd`,{className:`min-w-0 break-all font-mono`,"data-testid":`new-chat-effort`,children:e.effort})]}):null,e.project?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-fg-faint`,children:`Project`}),(0,G.jsx)(`dd`,{className:`min-w-0 break-words`,"data-testid":`new-chat-project`,children:e.project})]}):null]}),e.temporary?(0,G.jsxs)(`div`,{className:`mt-1.5 text-xs text-fg-muted`,"data-testid":`new-chat-temporary`,children:[(0,G.jsx)(Q,{tone:`accent`,children:`temporary`}),` You can delete it when the task is done.`]}):null,(0,G.jsx)(`div`,{className:`mt-2 text-xs text-fg-faint`,children:`Its first message — the new chat has none of this chat's history:`}),i?(0,G.jsxs)(`div`,{className:`mt-1 space-y-2`,children:[(0,G.jsxs)(`label`,{className:`block text-xs text-fg-faint`,children:[`Title`,(0,G.jsx)(`input`,{className:`${Z} mt-0.5`,value:o,onChange:e=>s(e.target.value),"data-keep-escape":!0,"data-testid":`new-chat-title-input`})]}),(0,G.jsx)(`textarea`,{className:`${Z} min-h-[10rem] resize-y font-mono text-xs leading-relaxed`,rows:12,value:c,onChange:e=>l(e.target.value),"aria-label":`The new chat's first message`,"data-keep-escape":!0,"data-testid":`new-chat-prompt-input`})]}):(0,G.jsx)(`div`,{className:`mt-1 max-h-24 overflow-hidden whitespace-pre-wrap break-words rounded-md border border-border bg-surface px-2.5 py-1.5 font-mono text-xs text-fg-muted`,"data-testid":`new-chat-prompt`,children:c}),(0,G.jsx)(`button`,{type:`button`,className:`mt-1 text-xs text-accent hover:underline`,onClick:()=>a(e=>!e),"data-testid":`new-chat-expand`,children:i?`Hide the message`:`Show and edit the message`})]})]}),(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(Y,{variant:`inverse`,disabled:!f,onClick:()=>{if(!f)return;let e={...u?{title:o.trim()}:{},...d?{prompt:c.trim()}:{}};n(Object.keys(e).length>0?{behavior:`allow`,updatedInput:e}:{behavior:`allow`})},"data-testid":`new-chat-start`,"data-autofocus":!0,children:[(0,G.jsx)(J.Plus,{className:`w-3.5 h-3.5`}),` Start new chat`]}),(0,G.jsx)(Y,{variant:`ghost`,onClick:()=>n({behavior:`deny`}),"data-testid":`new-chat-deny`,children:`Not now`}),u||d?(0,G.jsx)(`span`,{"data-testid":`new-chat-edited`,children:(0,G.jsx)(Q,{tone:`accent`,children:`edited`})}):null,(0,G.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`The new chat opens in a tab and runs there · Esc = not now`})]})]})}function SF({chat:e,timestamp:t}){let n=(0,v.useContext)(hF),r=Kg(t);return(0,G.jsxs)(`div`,{className:`my-2 flex items-center gap-2 rounded-md border border-accent/40 bg-accent-soft/30 px-3 py-1.5 text-xs text-fg`,"data-testid":`new-chat-note`,role:`note`,title:r||void 0,children:[(0,G.jsx)(J.Chats,{className:`h-3.5 w-3.5 shrink-0 text-accent`}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[`Started a new chat “`,e.title,`” for this task — it runs there.`]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>n.openChat(e.sessionId),title:`Open the chat “${e.title}” in a tab`,className:`inline-flex shrink-0 items-center gap-1 rounded px-1.5 py-0.5 font-medium text-accent hover:bg-accent-soft`,"data-testid":`new-chat-note-open`,children:[(0,G.jsx)(J.ExternalLink,{className:`h-3 w-3`}),` Open chat`]})]})}function CF(e){return Math.max(100,Math.min(1e3,Math.round(e/100)))}function wF(e,t=600){let n=e.length-t;if(n<=0)return{head:``,tail:e};let r=!1,i=-1,a=0;for(;a<n;){let t=e.indexOf(`
148
- `,a),o=t===-1?e.length:t,s=e.slice(a,o);if(/^\s{0,3}(```|~~~)/.test(s)&&(r=!r),!r&&s.trim()===``&&a>0&&o<=n&&(i=a-1),t===-1)break;a=t+1}return i<=0?{head:``,tail:e}:{head:e.slice(0,i),tail:e.slice(i)}}function TF(e,t){let[n,r]=(0,v.useState)(e),i=(0,v.useRef)(e);i.current=e;let a=CF(e.length);return(0,v.useEffect)(()=>{if(!t)return;let e=window.setInterval(()=>r(i.current),a);return()=>window.clearInterval(e)},[t,a]),t?n:e}var EF=new Set;function DF(){let e=EF,t=new Set;return{get:()=>e,set(n){if(n.size!==0||e.size!==0){e=n.size===0?EF:n;for(let e of t)e()}},subscribe(e){return t.add(e),()=>t.delete(e)}}}var OF=(0,v.createContext)({get:()=>EF,set:()=>{},subscribe:()=>()=>{}});function kF(e){let t=(0,v.useContext)(OF),n=()=>{let n=t.get();return n.size===0?!1:typeof e==`string`?n.has(e):e.some(e=>n.has(e))};return(0,v.useSyncExternalStore)(t.subscribe,n,n)}function AF(e,t){let n=kF(e);return(0,v.useEffect)(()=>{n&&t(!0)},[n,t]),n}var jF=6e4;function MF(e){let t=new TextEncoder().encode(e),n=``,r=32768;for(let e=0;e<t.length;e+=r)n+=String.fromCharCode(...t.subarray(e,e+r));return btoa(n)}function NF(e,t){let n=atob(e),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return new Blob([r],{type:t})}var PF={"image/png":`png`,"image/jpeg":`jpg`,"image/gif":`gif`,"image/webp":`webp`,"image/bmp":`bmp`,"image/svg+xml":`svg`,"application/pdf":`pdf`,"text/plain":`txt`};function FF(e,t){let n=PF[t.split(`;`)[0]?.trim().toLowerCase()??``];return n?`${e}.${n}`:e}function IF(e){let t=/^Attached file ([^\n]+?):\n\n```\n([\s\S]*)\n```$/.exec(e);return t?{name:t[1],content:t[2]}:null}function LF(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 RF(e){let t=/^Attached file (.+?) \([^()\n]+\) — a local file, its content is NOT included:\n`([^`\n]+)`/.exec(e);return t?{name:t[1],path:t[2]}:null}function zF(){if(typeof window>`u`)return null;let e=window.oonacode;return e?.pathForFile?t=>{try{return e.pathForFile?.(t)||null}catch{return null}}:null}async function BF(e,t){if(typeof window>`u`||!window.oonacode?.openPath)return t?.(`error`,`This file can only be opened in the OonaCode desktop app, on the PC it is on.`),!1;try{let n=await window.oonacode.openPath(e);return n.ok?!0:(n.message&&t?.(n.shownInFolder?`info`:`error`,n.message),!1)}catch(e){return t?.(`error`,e instanceof Error?e.message:`The file could not be opened.`),!1}}function VF(){if(typeof window>`u`)return null;let e=window.oonacode;return e?.openData?e.openData.bind(e):null}function HF(){return VF()!==null}function UF(e,t){if(typeof URL>`u`||typeof URL.createObjectURL!=`function`)return t?.(`error`,`This browser cannot open the file — it has no way to hold it.`),!1;let n;try{n=URL.createObjectURL(NF(e.base64,e.mediaType||`application/octet-stream`))}catch{return t?.(`error`,`The file could not be read.`),!1}let r=()=>setTimeout(()=>URL.revokeObjectURL?.(n),jF);if(e.mediaType===`application/pdf`){let e=window.open(n,`_blank`);if(e){try{e.opener=null}catch{}return r(),!0}}let i=document.createElement(`a`);return i.href=n,i.download=e.name||`attachment`,i.rel=`noopener`,i.style.display=`none`,document.body.appendChild(i),i.click(),i.remove(),r(),!0}async function WF(e,t){let n=VF();if(!n)return UF(e,t);try{let r=await n({name:e.name,mediaType:e.mediaType,base64:e.base64});return r.ok?!0:(r.message&&t?.(r.shownInFolder?`info`:`error`,r.message),!1)}catch(e){return t?.(`error`,e instanceof Error?e.message:`The file could not be opened.`),!1}}var GF=.1,KF=1.25,qF={fit:!0,scale:1,x:0,y:0};function JF(e){return Number.isFinite(e)?Math.min(8,Math.max(GF,e)):1}function YF(e,t){return e.w<=0||e.h<=0||t.w<=0||t.h<=0?1:JF(Math.min(1,t.w/e.w,t.h/e.h))}function XF(e,t){return JF(t===1?e*KF:e/KF)}function ZF(e){return!Number.isFinite(e)||e===0?1:Math.exp(-Math.max(-600,Math.min(600,e))*.002)}function QF(e){return`${Math.round(e*100)}%`}function $F(e,t,n){let r=(e,t)=>Math.max(0,(e-t)/2),i=r(t.w*e.scale,n.w),a=r(t.h*e.scale,n.h);return{x:Math.min(i,Math.max(-i,e.x))+0,y:Math.min(a,Math.max(-a,e.y))+0}}function eI(e,t,n,r,i){let a=JF(t),o=e.scale>0?a/e.scale:1,s=$F({scale:a,x:n.x-(n.x-e.x)*o,y:n.y-(n.y-e.y)*o},r,i);return{fit:!1,scale:a,x:s.x,y:s.y}}function tI(e,t){return Math.round(e*100)===Math.round(t*100)}function nI(e,t){return tI(e,t)?{scale:tI(t,1)?2:1}:{fit:!0}}function rI({picture:e,onClose:t,notify:n}){return(0,G.jsx)(jb,{open:e!==null,title:e?.name||`Picture`,onClose:t,full:!0,children:e?(0,G.jsx)(iI,{picture:e,notify:n}):null})}function iI({picture:e,notify:t}){let n=(0,v.useRef)(null),[r,i]=(0,v.useState)({w:0,h:0}),[a,o]=(0,v.useState)({w:0,h:0}),[s,c]=(0,v.useState)(qF),[l,u]=(0,v.useState)(!1),d=YF(r,a),f=s.fit?d:s.scale,p=s.fit?{x:0,y:0}:$F(s,r,a),m=r.w*f>a.w+.5||r.h*f>a.h+.5,h=(0,v.useRef)({scale:f,pan:p,natural:r,box:a,fit:d});h.current={scale:f,pan:p,natural:r,box:a,fit:d},(0,v.useLayoutEffect)(()=>{let e=n.current;if(!e)return;let t=()=>o({w:e.clientWidth,h:e.clientHeight});if(t(),typeof ResizeObserver>`u`)return;let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[]);let g=(0,v.useCallback)((e,t)=>{let n=h.current;c(eI({scale:n.scale,x:n.pan.x,y:n.pan.y},e,t,n.natural,n.box))},[]),_=(0,v.useCallback)(e=>g(XF(h.current.scale,e),{x:0,y:0}),[g]),y=(0,v.useCallback)(()=>c(qF),[]),b=(0,v.useCallback)(()=>g(1,{x:0,y:0}),[g]),x=(e,t)=>{let r=n.current?.getBoundingClientRect();return r?{x:e-(r.left+r.width/2),y:t-(r.top+r.height/2)}:{x:0,y:0}};(0,v.useEffect)(()=>{let e=n.current;if(!e)return;let t=t=>{t.preventDefault();let n=e.getBoundingClientRect(),r={x:t.clientX-(n.left+n.width/2),y:t.clientY-(n.top+n.height/2)},i=t.deltaMode===1?t.deltaY*16:t.deltaY;g(h.current.scale*ZF(i),r)};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[g]),(0,v.useEffect)(()=>{let e=e=>{if(!(e.ctrlKey||e.metaKey||e.altKey)){if(e.key===`+`||e.key===`=`)_(1);else if(e.key===`-`||e.key===`_`)_(-1);else if(e.key===`0`)y();else if(e.key===`1`)b();else return;e.preventDefault()}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[_,y,b]);let S=(0,v.useRef)(null),C=e=>{if(!(e.button!==0||!m)){S.current={from:{x:e.clientX,y:e.clientY},origin:{...h.current.pan}},u(!0);try{e.currentTarget.setPointerCapture?.(e.pointerId)}catch{}}},w=e=>{let t=S.current;if(!t)return;let n=h.current,r=$F({scale:n.scale,x:t.origin.x+(e.clientX-t.from.x),y:t.origin.y+(e.clientY-t.from.y)},n.natural,n.box);c({fit:!1,scale:n.scale,x:r.x,y:r.y})},T=()=>{S.current=null,u(!1)},E=e=>{let t=h.current,n=nI(t.scale,t.fit);`fit`in n?y():g(n.scale,x(e.clientX,e.clientY))},D=HF(),O=`data:${e.mediaType||`image/png`};base64,${e.base64}`;return(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2`,"data-testid":`image-viewer`,children:[(0,G.jsxs)(`div`,{role:`toolbar`,"aria-label":`Picture zoom`,className:`flex flex-wrap items-center gap-1.5`,"data-testid":`viewer-toolbar`,children:[(0,G.jsx)(Y,{size:`sm`,"aria-label":`Zoom out`,title:`Zoom out (-)`,"data-testid":`viewer-zoom-out`,disabled:f<=GF+1e-9,onClick:()=>_(-1),children:`−`}),(0,G.jsx)(`span`,{className:`min-w-[3.5rem] text-center text-xs tabular-nums text-fg-muted`,"aria-live":`polite`,"data-testid":`viewer-percent`,children:QF(f)}),(0,G.jsx)(Y,{size:`sm`,"aria-label":`Zoom in`,title:`Zoom in (+)`,"data-testid":`viewer-zoom-in`,disabled:f>=8-1e-9,onClick:()=>_(1),children:`+`}),(0,G.jsx)(Y,{size:`sm`,"aria-label":`Fit to window`,title:`Fit to window (0)`,"data-testid":`viewer-fit`,"aria-pressed":s.fit,onClick:y,children:`Fit`}),(0,G.jsx)(Y,{size:`sm`,"aria-label":`Actual size`,title:`Actual size (1)`,"data-testid":`viewer-actual`,"aria-pressed":!s.fit&&tI(f,1),onClick:b,children:`100%`}),(0,G.jsx)(`span`,{className:`mx-1 min-w-0 flex-1 truncate text-xs text-fg-faint`,title:e.name,children:e.name}),(0,G.jsx)(Y,{size:`sm`,"aria-label":D?`Open externally`:`Download`,title:D?`Open in the program your computer gives this picture`:`Download the picture`,"data-testid":`viewer-open`,onClick:()=>void WF(e,t),children:D?`Open externally`:`Download`})]}),(0,G.jsx)(`div`,{ref:n,className:`relative min-h-0 flex-1 touch-none select-none overflow-hidden rounded-md border border-border bg-black/70`,style:{cursor:m?l?`grabbing`:`grab`:`zoom-in`},"data-testid":`viewer-canvas`,onPointerDown:C,onPointerMove:w,onPointerUp:T,onPointerCancel:T,onDoubleClick:E,children:(0,G.jsx)(`img`,{src:O,alt:e.name,draggable:!1,"data-testid":`viewer-image`,"data-scale":f.toFixed(4),onLoad:e=>i({w:e.currentTarget.naturalWidth,h:e.currentTarget.naturalHeight}),onDragStart:e=>e.preventDefault(),style:{position:`absolute`,left:`50%`,top:`50%`,maxWidth:`none`,maxHeight:`none`,...r.w>0?{width:r.w,height:r.h}:{},transform:`translate(-50%, -50%) translate(${p.x}px, ${p.y}px) scale(${f})`,transformOrigin:`center`}})}),(0,G.jsx)(`p`,{className:`text-[11px] text-fg-faint`,children:`Scroll to zoom · drag to move · double-click for Fit / 100% · + − 0 on the keyboard`})]})}function aI(e){if(e.type!==`image`)return null;let t=e.source;return t?.type===`base64`&&t.data?{mediaType:t.media_type||`image/png`,base64:t.data,url:null}:t?.url?{mediaType:t.media_type||`image/png`,base64:null,url:t.url}:null}function oI(e){if(!e||typeof e.content==`string`)return null;for(let t of e.content){let e=aI(t);if(e)return e}return null}function sI(e){return e.base64===null?e.url??``:`data:${e.mediaType};base64,${e.base64}`}function cI(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function lI(e,t,n){let r=e===`Read`?t?.file_path:null;return typeof r==`string`&&r.trim()?cI(r.trim()):FF(`picture`,n)}function uI(e,t){let n=e?Vg(e):``,r=(/^Saved (.+?) \(\d/.exec(n)??/^Picture made by agy: (.+)$/m.exec(n))?.[1]?.trim();return r?cI(r):FF(`picture`,t)}var dI=360,fI=376,pI=398,mI=8;function hI(e,t,n){let r=Math.max(mI,Math.min(t+12,n.w-fI-mI));return n.h-e.bottom-6>=pI?{left:r,top:e.bottom+6}:e.top-6>=pI?{left:r,bottom:n.h-e.top+6}:{left:r,top:Math.max(mI,n.h-pI-mI)}}function gI({picture:e,name:t,place:n}){let r=(0,v.useMemo)(()=>sI(e),[e]);return(0,Sb.createPortal)((0,G.jsxs)(`div`,{role:`tooltip`,"data-testid":`picture-preview`,className:`pointer-events-none fixed z-[60] rounded-lg border border-border bg-surface p-2 text-xs text-fg shadow-lg`,style:{left:n.left,top:n.top,bottom:n.bottom,maxWidth:fI},children:[(0,G.jsx)(`img`,{src:r,alt:t,"data-testid":`picture-preview-image`,draggable:!1,className:`block rounded object-contain`,style:{maxWidth:dI,maxHeight:dI}}),(0,G.jsx)(`div`,{className:`mt-1 truncate text-fg-muted`,"data-testid":`picture-preview-name`,title:t,children:t})]}),document.body)}function _I(){return typeof window>`u`||typeof window.matchMedia!=`function`||!window.matchMedia(`(hover: none)`).matches}var vI={};function yI(e,t){let[n,r]=(0,v.useState)(null),i=(0,v.useRef)(!1),a=e!==null&&n!==null;if((0,v.useEffect)(()=>{if(!a)return;let e=e=>{e.key===`Escape`&&r(null)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),!e)return{handlers:vI,popup:null};let o=(e,t)=>{let n=e.getBoundingClientRect();r(hI({top:n.top,bottom:n.bottom},t??n.left+24,{w:window.innerWidth,h:window.innerHeight}))};return{handlers:{onMouseEnter:e=>{_I()&&o(e.currentTarget,e.clientX)},onMouseLeave:()=>r(null),onMouseDown:()=>{i.current=!0},onFocus:e=>{_I()&&!i.current&&o(e.currentTarget,null)},onBlur:()=>{i.current=!1,r(null)},onClick:()=>r(null)},popup:n?(0,G.jsx)(gI,{picture:e,name:t,place:n}):null}}var bI=(0,v.memo)(function({block:e,toolName:t,input:n,onOpen:r}){let i=(0,v.useMemo)(()=>aI(e),[e]),a=(0,v.useMemo)(()=>i?sI(i):``,[i]);if(!i)return(0,G.jsx)(`div`,{children:`[image]`});let o=lI(t,n,i.mediaType),s=(0,G.jsx)(`img`,{src:a,alt:`tool result`,className:`block max-h-64 max-w-full rounded border border-border`});if(i.base64===null)return s;let c=i.base64;return(0,G.jsx)(`button`,{type:`button`,"aria-label":`Open ${o} in the viewer`,title:`Open in the viewer`,"data-testid":`tool-result-picture`,onClick:()=>r({name:o,mediaType:i.mediaType,base64:c}),className:`block max-w-full cursor-zoom-in rounded p-0 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:s})});function xI({picture:e,onClose:t}){let n=(0,v.useContext)(HN).notify??void 0;return(0,G.jsx)(rI,{picture:e,onClose:t,notify:n})}function SI(e){return typeof e==`string`?e:null}function CI(e,t){if(!t)return``;switch(e){case`Bash`:case`PowerShell`:return Yg((SI(t.command)??``).replace(/\s+/g,` `),90);case`Read`:case`Write`:case`Edit`:case`MultiEdit`:case`NotebookEdit`:return SI(t.file_path)??SI(t.notebook_path)??``;case`Glob`:case`Grep`:return`${SI(t.pattern)??``}${SI(t.path)?` in ${SI(t.path)}`:``}`;case`Task`:case`Agent`:return SI(t.description)??Yg(SI(t.prompt)??``,80);case`WebFetch`:case`WebSearch`:return SI(t.url)??SI(t.query)??``;case`TodoWrite`:return`update todo list`;case Dp:return Yg(SI(t.title)??``,80);case Au:return Yg((SI(t.prompt)??SI(t.file)??``).replace(/\s+/g,` `),60);default:{let e=Object.entries(t).find(([,e])=>typeof e==`string`);return e?Yg(String(e[1]).replace(/\s+/g,` `),80):``}}}var wI=(0,v.memo)(function({oldText:e,newText:t}){let n=(0,v.useMemo)(()=>e.split(`
148
+ `,a),o=t===-1?e.length:t,s=e.slice(a,o);if(/^\s{0,3}(```|~~~)/.test(s)&&(r=!r),!r&&s.trim()===``&&a>0&&o<=n&&(i=a-1),t===-1)break;a=t+1}return i<=0?{head:``,tail:e}:{head:e.slice(0,i),tail:e.slice(i)}}function TF(e,t){let[n,r]=(0,v.useState)(e),i=(0,v.useRef)(e);i.current=e;let a=CF(e.length);return(0,v.useEffect)(()=>{if(!t)return;let e=window.setInterval(()=>r(i.current),a);return()=>window.clearInterval(e)},[t,a]),t?n:e}var EF=new Set;function DF(){let e=EF,t=new Set;return{get:()=>e,set(n){if(n.size!==0||e.size!==0){e=n.size===0?EF:n;for(let e of t)e()}},subscribe(e){return t.add(e),()=>t.delete(e)}}}var OF=(0,v.createContext)({get:()=>EF,set:()=>{},subscribe:()=>()=>{}});function kF(e){let t=(0,v.useContext)(OF),n=()=>{let n=t.get();return n.size===0?!1:typeof e==`string`?n.has(e):e.some(e=>n.has(e))};return(0,v.useSyncExternalStore)(t.subscribe,n,n)}function AF(e,t){let n=kF(e);return(0,v.useEffect)(()=>{n&&t(!0)},[n,t]),n}var jF=6e4;function MF(e){let t=new TextEncoder().encode(e),n=``,r=32768;for(let e=0;e<t.length;e+=r)n+=String.fromCharCode(...t.subarray(e,e+r));return btoa(n)}function NF(e,t){let n=atob(e),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return new Blob([r],{type:t})}var PF={"image/png":`png`,"image/jpeg":`jpg`,"image/gif":`gif`,"image/webp":`webp`,"image/bmp":`bmp`,"image/svg+xml":`svg`,"application/pdf":`pdf`,"text/plain":`txt`};function FF(e,t){let n=PF[t.split(`;`)[0]?.trim().toLowerCase()??``];return n?`${e}.${n}`:e}function IF(e){let t=/^Attached file ([^\n]+?):\n\n```\n([\s\S]*)\n```$/.exec(e);return t?{name:t[1],content:t[2]}:null}function LF(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 RF(e){let t=/^Attached file (.+?) \([^()\n]+\) — a local file, its content is NOT included:\n`([^`\n]+)`/.exec(e);return t?{name:t[1],path:t[2]}:null}function zF(){if(typeof window>`u`)return null;let e=window.oonacode;return e?.pathForFile?t=>{try{return e.pathForFile?.(t)||null}catch{return null}}:null}async function BF(e,t){if(typeof window>`u`||!window.oonacode?.openPath)return t?.(`error`,`This file can only be opened in the OonaCode desktop app, on the PC it is on.`),!1;try{let n=await window.oonacode.openPath(e);return n.ok?!0:(n.message&&t?.(n.shownInFolder?`info`:`error`,n.message),!1)}catch(e){return t?.(`error`,e instanceof Error?e.message:`The file could not be opened.`),!1}}function VF(){if(typeof window>`u`)return null;let e=window.oonacode;return e?.openData?e.openData.bind(e):null}function HF(){return VF()!==null}function UF(e,t){if(typeof URL>`u`||typeof URL.createObjectURL!=`function`)return t?.(`error`,`This browser cannot open the file — it has no way to hold it.`),!1;let n;try{n=URL.createObjectURL(NF(e.base64,e.mediaType||`application/octet-stream`))}catch{return t?.(`error`,`The file could not be read.`),!1}let r=()=>setTimeout(()=>URL.revokeObjectURL?.(n),jF);if(e.mediaType===`application/pdf`){let e=window.open(n,`_blank`);if(e){try{e.opener=null}catch{}return r(),!0}}let i=document.createElement(`a`);return i.href=n,i.download=e.name||`attachment`,i.rel=`noopener`,i.style.display=`none`,document.body.appendChild(i),i.click(),i.remove(),r(),!0}async function WF(e,t){let n=VF();if(!n)return UF(e,t);try{let r=await n({name:e.name,mediaType:e.mediaType,base64:e.base64});return r.ok?!0:(r.message&&t?.(r.shownInFolder?`info`:`error`,r.message),!1)}catch(e){return t?.(`error`,e instanceof Error?e.message:`The file could not be opened.`),!1}}var GF=.1,KF=1.25,qF={fit:!0,scale:1,x:0,y:0};function JF(e){return Number.isFinite(e)?Math.min(8,Math.max(GF,e)):1}function YF(e,t){return e.w<=0||e.h<=0||t.w<=0||t.h<=0?1:JF(Math.min(1,t.w/e.w,t.h/e.h))}function XF(e,t){return JF(t===1?e*KF:e/KF)}function ZF(e){return!Number.isFinite(e)||e===0?1:Math.exp(-Math.max(-600,Math.min(600,e))*.002)}function QF(e){return`${Math.round(e*100)}%`}function $F(e,t,n){let r=(e,t)=>Math.max(0,(e-t)/2),i=r(t.w*e.scale,n.w),a=r(t.h*e.scale,n.h);return{x:Math.min(i,Math.max(-i,e.x))+0,y:Math.min(a,Math.max(-a,e.y))+0}}function eI(e,t,n,r,i){let a=JF(t),o=e.scale>0?a/e.scale:1,s=$F({scale:a,x:n.x-(n.x-e.x)*o,y:n.y-(n.y-e.y)*o},r,i);return{fit:!1,scale:a,x:s.x,y:s.y}}function tI(e,t){return Math.round(e*100)===Math.round(t*100)}function nI(e,t){return tI(e,t)?{scale:tI(t,1)?2:1}:{fit:!0}}function rI({picture:e,onClose:t,notify:n}){return(0,G.jsx)(jb,{open:e!==null,title:e?.name||`Picture`,onClose:t,full:!0,children:e?(0,G.jsx)(iI,{picture:e,notify:n}):null})}function iI({picture:e,notify:t}){let n=(0,v.useRef)(null),[r,i]=(0,v.useState)({w:0,h:0}),[a,o]=(0,v.useState)({w:0,h:0}),[s,c]=(0,v.useState)(qF),[l,u]=(0,v.useState)(!1),d=YF(r,a),f=s.fit?d:s.scale,p=s.fit?{x:0,y:0}:$F(s,r,a),m=r.w*f>a.w+.5||r.h*f>a.h+.5,h=(0,v.useRef)({scale:f,pan:p,natural:r,box:a,fit:d});h.current={scale:f,pan:p,natural:r,box:a,fit:d},(0,v.useLayoutEffect)(()=>{let e=n.current;if(!e)return;let t=()=>o({w:e.clientWidth,h:e.clientHeight});if(t(),typeof ResizeObserver>`u`)return;let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[]);let g=(0,v.useCallback)((e,t)=>{let n=h.current;c(eI({scale:n.scale,x:n.pan.x,y:n.pan.y},e,t,n.natural,n.box))},[]),_=(0,v.useCallback)(e=>g(XF(h.current.scale,e),{x:0,y:0}),[g]),y=(0,v.useCallback)(()=>c(qF),[]),b=(0,v.useCallback)(()=>g(1,{x:0,y:0}),[g]),x=(e,t)=>{let r=n.current?.getBoundingClientRect();return r?{x:e-(r.left+r.width/2),y:t-(r.top+r.height/2)}:{x:0,y:0}};(0,v.useEffect)(()=>{let e=n.current;if(!e)return;let t=t=>{t.preventDefault();let n=e.getBoundingClientRect(),r={x:t.clientX-(n.left+n.width/2),y:t.clientY-(n.top+n.height/2)},i=t.deltaMode===1?t.deltaY*16:t.deltaY;g(h.current.scale*ZF(i),r)};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[g]),(0,v.useEffect)(()=>{let e=e=>{if(!(e.ctrlKey||e.metaKey||e.altKey)){if(e.key===`+`||e.key===`=`)_(1);else if(e.key===`-`||e.key===`_`)_(-1);else if(e.key===`0`)y();else if(e.key===`1`)b();else return;e.preventDefault()}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[_,y,b]);let S=(0,v.useRef)(null),C=e=>{if(!(e.button!==0||!m)){S.current={from:{x:e.clientX,y:e.clientY},origin:{...h.current.pan}},u(!0);try{e.currentTarget.setPointerCapture?.(e.pointerId)}catch{}}},w=e=>{let t=S.current;if(!t)return;let n=h.current,r=$F({scale:n.scale,x:t.origin.x+(e.clientX-t.from.x),y:t.origin.y+(e.clientY-t.from.y)},n.natural,n.box);c({fit:!1,scale:n.scale,x:r.x,y:r.y})},T=()=>{S.current=null,u(!1)},E=e=>{let t=h.current,n=nI(t.scale,t.fit);`fit`in n?y():g(n.scale,x(e.clientX,e.clientY))},D=HF(),O=`data:${e.mediaType||`image/png`};base64,${e.base64}`;return(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2`,"data-testid":`image-viewer`,children:[(0,G.jsxs)(`div`,{role:`toolbar`,"aria-label":`Picture zoom`,className:`flex flex-wrap items-center gap-1.5`,"data-testid":`viewer-toolbar`,children:[(0,G.jsx)(Y,{size:`sm`,"aria-label":`Zoom out`,title:`Zoom out (-)`,"data-testid":`viewer-zoom-out`,disabled:f<=GF+1e-9,onClick:()=>_(-1),children:`−`}),(0,G.jsx)(`span`,{className:`min-w-[3.5rem] text-center text-xs tabular-nums text-fg-muted`,"aria-live":`polite`,"data-testid":`viewer-percent`,children:QF(f)}),(0,G.jsx)(Y,{size:`sm`,"aria-label":`Zoom in`,title:`Zoom in (+)`,"data-testid":`viewer-zoom-in`,disabled:f>=8-1e-9,onClick:()=>_(1),children:`+`}),(0,G.jsx)(Y,{size:`sm`,"aria-label":`Fit to window`,title:`Fit to window (0)`,"data-testid":`viewer-fit`,"aria-pressed":s.fit,onClick:y,children:`Fit`}),(0,G.jsx)(Y,{size:`sm`,"aria-label":`Actual size`,title:`Actual size (1)`,"data-testid":`viewer-actual`,"aria-pressed":!s.fit&&tI(f,1),onClick:b,children:`100%`}),(0,G.jsx)(`span`,{className:`mx-1 min-w-0 flex-1 truncate text-xs text-fg-faint`,title:e.name,children:e.name}),(0,G.jsx)(Y,{size:`sm`,"aria-label":D?`Open externally`:`Download`,title:D?`Open in the program your computer gives this picture`:`Download the picture`,"data-testid":`viewer-open`,onClick:()=>void WF(e,t),children:D?`Open externally`:`Download`})]}),(0,G.jsx)(`div`,{ref:n,className:`relative min-h-0 flex-1 touch-none select-none overflow-hidden rounded-md border border-border bg-black/70`,style:{cursor:m?l?`grabbing`:`grab`:`zoom-in`},"data-testid":`viewer-canvas`,onPointerDown:C,onPointerMove:w,onPointerUp:T,onPointerCancel:T,onDoubleClick:E,children:(0,G.jsx)(`img`,{src:O,alt:e.name,draggable:!1,"data-testid":`viewer-image`,"data-scale":f.toFixed(4),onLoad:e=>i({w:e.currentTarget.naturalWidth,h:e.currentTarget.naturalHeight}),onDragStart:e=>e.preventDefault(),style:{position:`absolute`,left:`50%`,top:`50%`,maxWidth:`none`,maxHeight:`none`,...r.w>0?{width:r.w,height:r.h}:{},transform:`translate(-50%, -50%) translate(${p.x}px, ${p.y}px) scale(${f})`,transformOrigin:`center`}})}),(0,G.jsx)(`p`,{className:`text-[11px] text-fg-faint`,children:`Scroll to zoom · drag to move · double-click for Fit / 100% · + − 0 on the keyboard`})]})}function aI(e){if(e.type!==`image`)return null;let t=e.source;return t?.type===`base64`&&t.data?{mediaType:t.media_type||`image/png`,base64:t.data,url:null}:t?.url?{mediaType:t.media_type||`image/png`,base64:null,url:t.url}:null}function oI(e){if(!e||typeof e.content==`string`)return null;for(let t of e.content){let e=aI(t);if(e)return e}return null}function sI(e){return e.base64===null?e.url??``:`data:${e.mediaType};base64,${e.base64}`}function cI(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function lI(e,t,n){let r=e===`Read`||e===`view_file`?t?.file_path??t?.AbsolutePath??t?.path:null;return typeof r==`string`&&r.trim()?cI(r.trim()):FF(`picture`,n)}function uI(e,t){let n=e?Vg(e):``,r=(/^Saved (.+?) \(\d/.exec(n)??/^Picture made by agy: (.+)$/m.exec(n))?.[1]?.trim();return r?cI(r):FF(`picture`,t)}var dI=360,fI=376,pI=398,mI=8;function hI(e,t,n){let r=Math.max(mI,Math.min(t+12,n.w-fI-mI));return n.h-e.bottom-6>=pI?{left:r,top:e.bottom+6}:e.top-6>=pI?{left:r,bottom:n.h-e.top+6}:{left:r,top:Math.max(mI,n.h-pI-mI)}}function gI({picture:e,name:t,place:n}){let r=(0,v.useMemo)(()=>sI(e),[e]);return(0,Sb.createPortal)((0,G.jsxs)(`div`,{role:`tooltip`,"data-testid":`picture-preview`,className:`pointer-events-none fixed z-[60] rounded-lg border border-border bg-surface p-2 text-xs text-fg shadow-lg`,style:{left:n.left,top:n.top,bottom:n.bottom,maxWidth:fI},children:[(0,G.jsx)(`img`,{src:r,alt:t,"data-testid":`picture-preview-image`,draggable:!1,className:`block rounded object-contain`,style:{maxWidth:dI,maxHeight:dI}}),(0,G.jsx)(`div`,{className:`mt-1 truncate text-fg-muted`,"data-testid":`picture-preview-name`,title:t,children:t})]}),document.body)}function _I(){return typeof window>`u`||typeof window.matchMedia!=`function`||!window.matchMedia(`(hover: none)`).matches}var vI={};function yI(e,t){let[n,r]=(0,v.useState)(null),i=(0,v.useRef)(!1),a=e!==null&&n!==null;if((0,v.useEffect)(()=>{if(!a)return;let e=e=>{e.key===`Escape`&&r(null)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),!e)return{handlers:vI,popup:null};let o=(e,t)=>{let n=e.getBoundingClientRect();r(hI({top:n.top,bottom:n.bottom},t??n.left+24,{w:window.innerWidth,h:window.innerHeight}))};return{handlers:{onMouseEnter:e=>{_I()&&o(e.currentTarget,e.clientX)},onMouseLeave:()=>r(null),onMouseDown:()=>{i.current=!0},onFocus:e=>{_I()&&!i.current&&o(e.currentTarget,null)},onBlur:()=>{i.current=!1,r(null)},onClick:()=>r(null)},popup:n?(0,G.jsx)(gI,{picture:e,name:t,place:n}):null}}var bI=(0,v.memo)(function({block:e,toolName:t,input:n,onOpen:r}){let i=(0,v.useMemo)(()=>aI(e),[e]),a=(0,v.useMemo)(()=>i?sI(i):``,[i]);if(!i)return(0,G.jsx)(`div`,{children:`[image]`});let o=lI(t,n,i.mediaType),s=(0,G.jsx)(`img`,{src:a,alt:`tool result`,className:`block max-h-64 max-w-full rounded border border-border`});if(i.base64===null)return s;let c=i.base64;return(0,G.jsx)(`button`,{type:`button`,"aria-label":`Open ${o} in the viewer`,title:`Open in the viewer`,"data-testid":`tool-result-picture`,onClick:()=>r({name:o,mediaType:i.mediaType,base64:c}),className:`block max-w-full cursor-zoom-in rounded p-0 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:s})});function xI({picture:e,onClose:t}){let n=(0,v.useContext)(HN).notify??void 0;return(0,G.jsx)(rI,{picture:e,onClose:t,notify:n})}function SI(e){return typeof e==`string`?e:null}function CI(e,t){if(!t)return``;switch(e){case`Bash`:case`PowerShell`:case`run_command`:return Yg((SI(t.CommandLine)??SI(t.command)??``).replace(/\s+/g,` `),90);case`Read`:case`view_file`:case`Write`:case`write_to_file`:case`Edit`:case`replace_file_content`:case`multi_replace_file_content`:case`MultiEdit`:case`NotebookEdit`:return SI(t.AbsolutePath)??SI(t.file_path)??SI(t.TargetFile)??SI(t.notebook_path)??SI(t.path)??``;case`Glob`:case`Grep`:case`grep_search`:case`find_by_name`:return`${SI(t.pattern)??SI(t.query)??``}${SI(t.path)??SI(t.dir_path)?` in ${SI(t.path)??SI(t.dir_path)}`:``}`;case`list_dir`:return SI(t.DirectoryPath)??SI(t.dir_path)??SI(t.path)??``;case`Task`:case`Agent`:return SI(t.description)??Yg(SI(t.prompt)??``,80);case`WebFetch`:case`WebSearch`:return SI(t.url)??SI(t.query)??``;case`TodoWrite`:return`update todo list`;case Dp:return Yg(SI(t.title)??``,80);case Au:return Yg((SI(t.prompt)??SI(t.file)??``).replace(/\s+/g,` `),60);default:{let e=Object.entries(t).find(([,e])=>typeof e==`string`);return e?Yg(String(e[1]).replace(/\s+/g,` `),80):``}}}var wI=(0,v.memo)(function({oldText:e,newText:t}){let n=(0,v.useMemo)(()=>e.split(`
149
149
  `),[e]),r=(0,v.useMemo)(()=>t.split(`
150
- `),[t]);return(0,G.jsxs)(`pre`,{className:`lazy-block m-0 max-h-72 overflow-auto rounded-md border border-border bg-code-bg p-2 font-mono text-[12.5px] leading-relaxed`,children:[n.map((e,t)=>(0,G.jsxs)(`div`,{className:`bg-danger-soft text-danger`,children:[(0,G.jsx)(`span`,{className:`select-none pr-2 text-fg-faint`,children:`-`}),e]},`o${t}`)),r.map((e,t)=>(0,G.jsxs)(`div`,{className:`bg-ok-soft text-ok`,children:[(0,G.jsx)(`span`,{className:`select-none pr-2 text-fg-faint`,children:`+`}),e]},`n${t}`))]})}),TI=AM;function EI({name:e,input:t,inputJson:n,streaming:r}){if(!t)return n?(0,G.jsx)(iP,{code:n,language:`json`,maxHeight:`14rem`}):r?(0,G.jsx)(`div`,{className:`text-xs text-fg-faint`,children:`Receiving arguments…`}):null;switch(e){case`Bash`:case`PowerShell`:{let n=SI(t.description);return(0,G.jsxs)(`div`,{children:[n?(0,G.jsx)(`div`,{className:`mb-1 text-xs text-fg-muted`,children:n}):null,(0,G.jsx)(iP,{code:SI(t.command)??Xg(t),language:e===`PowerShell`?`powershell`:`bash`,maxHeight:`14rem`})]})}case`Edit`:{let e=SI(t.file_path);return(0,G.jsxs)(`div`,{className:`space-y-1`,children:[e?(0,G.jsxs)(`div`,{className:`font-mono text-xs text-fg-muted`,children:[e,t.replace_all?` (replace all)`:``]}):null,(0,G.jsx)(wI,{oldText:SI(t.old_string)??``,newText:SI(t.new_string)??``})]})}case`Write`:{let e=SI(t.file_path);return(0,G.jsxs)(`div`,{children:[e?(0,G.jsx)(`div`,{className:`mb-1 font-mono text-xs text-fg-muted`,children:e}):null,(0,G.jsx)(iP,{code:SI(t.content)??``,language:TI(e),maxHeight:`18rem`})]})}case`Read`:{let e=SI(t.file_path)??``,n=[t.offset===void 0?null:`offset ${String(t.offset)}`,t.limit===void 0?null:`limit ${String(t.limit)}`].filter(Boolean).join(`, `);return(0,G.jsxs)(`div`,{className:`font-mono text-xs text-fg-muted`,children:[e,n?` (${n})`:``]})}default:return(0,G.jsx)(iP,{code:Xg(t),language:`json`,maxHeight:`14rem`})}}function DI({blocks:e,toolName:t,input:n,onOpenPicture:r,hideImages:i}){return(0,G.jsx)(`div`,{className:`space-y-1`,children:e.map((e,a)=>{if(e.type===`image`&&i)return null;if(e.type===`image`)return(0,G.jsx)(bI,{block:e,toolName:t,input:n,onOpen:r},a);let o=e.type===`text`?e.text??``:`[${e.type}]`;return(0,G.jsx)(`pre`,{className:`pre-wrap m-0 font-mono text-[12.5px] leading-relaxed`,children:o},a)})})}var OI=`Code snippet`;function kI(e){return e===`unknown`?OI:e===Cp?wp:e===Dp?Op:e===Au?ju:e}var AI={streaming:`preparing`,pending:`needs approval`,running:`running`,done:`done`,error:`error`,denied:`denied`,skipped:`skipped`,cancelled:`cancelled`};function jI({status:e}){switch(e){case`streaming`:case`running`:return(0,G.jsx)(J.Spinner,{className:`w-3.5 h-3.5 text-accent`});case`pending`:return(0,G.jsx)(J.Shield,{className:`w-3.5 h-3.5 text-warn`});case`done`:return(0,G.jsx)(J.Check,{className:`w-3.5 h-3.5 text-ok`});case`error`:case`denied`:return(0,G.jsx)(J.X,{className:`w-3.5 h-3.5 text-danger`});case`skipped`:case`cancelled`:return(0,G.jsx)(J.X,{className:`w-3.5 h-3.5 text-fg-faint`})}}function MI(e){for(let t of e)if(t.item.kind===`permission`&&t.item.status===`pending`||t.children.length>0&&MI(t.children))return!0;return!1}var NI=(0,v.memo)(function({node:e,renderChildren:t}){let n=e.item,r=n.status===`error`||n.status===`denied`,[i,a]=(0,v.useState)(null),o=AF(n.id,a),s=MI(e.children),c=NP.has(n.name)&&(n.status===`done`||n.status===`cancelled`),l=s||o||(i??(r||n.status===`pending`||e.children.length>0&&!c)),u=(0,v.useMemo)(()=>CI(n.name,n.input),[n.name,n.input]),d=(0,v.useMemo)(()=>n.name===`Read`?oI(n.result):null,[n.name,n.result]),f=yI(d,lI(n.name,n.input,d?.mediaType??`image/png`)),{onClick:p,...m}=f.handlers,h=(0,v.useMemo)(()=>n.name===Au?oI(n.result):null,[n.name,n.result]),g=(0,v.useMemo)(()=>h?sI(h):``,[h]),_=(0,v.useMemo)(()=>h?uI(n.result,h.mediaType):``,[h,n.result]),[y,b]=(0,v.useState)(null),x=(0,v.useMemo)(()=>l?Vg(n.result):``,[l,n.result]),S=n.result!==null&&!n.result.isError&&(typeof n.result.content==`string`&&/^Async agent launched/i.test(n.result.content.trimStart())||n.result.structured?.status===`async_launched`),C=n.durationMs===null?n.elapsedSec!==null&&!n.result?Hg(n.elapsedSec*1e3):``:Hg(n.durationMs);return(0,G.jsxs)(`div`,{"data-testid":`tool-${n.toolUseId}`,className:W(`my-1.5 overflow-hidden rounded-lg border bg-surface text-sm`,r?`border-danger/50`:n.status===`pending`?`border-warn/60`:`border-border`),children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":l,onClick:()=>{p?.(),a(s?null:!l)},...m,className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left hover:bg-surface-2`,children:[(0,G.jsx)(jI,{status:n.status}),(0,G.jsx)(J.Tool,{className:`w-3.5 h-3.5 text-fg-faint`}),(0,G.jsx)(`span`,{className:`font-medium`,children:kI(n.name)}),u?(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-fg-muted`,children:u}):(0,G.jsx)(`span`,{className:`flex-1`}),C?(0,G.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:C}):null,(0,G.jsx)(Q,{tone:r?`danger`:n.status===`pending`?`warn`:n.status===`done`?`ok`:`neutral`,children:AI[n.status]}),(0,G.jsx)(J.Chevron,{open:l,className:`w-3.5 h-3.5 text-fg-faint`})]}),h&&!r?(0,G.jsxs)(`div`,{className:`border-t border-border px-2.5 py-2`,"data-testid":`tool-generated`,children:[h.base64===null?(0,G.jsx)(`img`,{src:g,alt:_,className:`block rounded border border-border object-contain`,style:{maxWidth:280,maxHeight:280}}):(0,G.jsx)(`button`,{type:`button`,"aria-label":`Open ${_} in the viewer`,title:`${_} — open in the viewer`,"data-testid":`tool-generated-picture`,onClick:()=>b({name:_,mediaType:h.mediaType,base64:h.base64}),className:`block cursor-zoom-in rounded p-0 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,G.jsx)(`img`,{src:g,alt:_,draggable:!1,className:`block rounded border border-border object-contain`,style:{maxWidth:280,maxHeight:280}})}),(0,G.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-muted`,title:_,children:_})]}):null,l?(0,G.jsxs)(`div`,{className:`space-y-2 border-t border-border px-2.5 py-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1 text-[11px] uppercase tracking-wide text-fg-faint`,children:`Input`}),(0,G.jsx)(EI,{name:n.name,input:n.input,inputJson:n.inputJson,streaming:n.status===`streaming`})]}),e.children.length>0?(0,G.jsxs)(`div`,{className:`border-l-2 border-think/40 pl-2`,children:[(0,G.jsx)(`div`,{className:`mb-1 text-[11px] uppercase tracking-wide text-think`,children:`Subagent`}),t(e.children)]}):null,n.result&&S?(0,G.jsx)(`div`,{className:`text-xs text-fg-faint`,"data-testid":`tool-launch-note`,children:`Launched in the background — the chat is told when it finishes.`}):n.result?(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-1 flex items-center justify-between text-[11px] uppercase tracking-wide text-fg-faint`,children:[(0,G.jsx)(`span`,{children:n.result.isError?`Error`:`Result`}),x?(0,G.jsxs)(`span`,{className:`normal-case`,children:[x.length.toLocaleString(),` chars`]}):null]}),(0,G.jsx)(`div`,{className:W(`lazy-block max-h-72 overflow-auto rounded-md border p-2`,n.result.isError?`border-danger/40 bg-danger-soft text-danger`:`border-border bg-code-bg`),children:typeof n.result.content==`string`?(0,G.jsx)(`pre`,{className:`pre-wrap m-0 font-mono text-[12.5px] leading-relaxed`,children:n.result.content.replace(/<\/?tool_use_error>/g,``).trim()||`(empty)`}):(0,G.jsx)(DI,{blocks:n.result.content,toolName:n.name,input:n.input,onOpenPicture:b,hideImages:h!==null})})]}):n.status===`cancelled`?(0,G.jsx)(`div`,{className:`text-xs text-fg-faint`,children:`No result (turn ended before the tool finished).`}):null]}):null,f.popup,y?(0,G.jsx)(xI,{picture:y,onClose:()=>b(null)}):null]})}),PI=(0,v.memo)(function({item:e}){let[t,n]=(0,v.useState)(null),r=AF(e.id,n)||(t??e.streaming),i=TF(e.text,e.streaming),a=FI(i);return!e.streaming&&(e.redacted||a===0)?(0,G.jsxs)(`div`,{className:`my-1.5 flex items-center gap-2 rounded-lg border border-think/20 bg-think-soft/20 px-2.5 py-1.5 text-sm text-think/70`,"data-testid":`thought-empty`,title:e.redacted?`The provider hid this thought: only an encrypted copy came back, which the model reads and nobody else can.`:`The model thought here, but its provider sent no text for it — only a signature. There is nothing to show.`,children:[(0,G.jsx)(J.Brain,{className:`w-3.5 h-3.5`}),(0,G.jsx)(`span`,{className:`font-medium`,children:e.redacted?`Redacted thinking`:`Thought`}),(0,G.jsx)(`span`,{className:`text-xs opacity-70`,children:e.redacted?`hidden`:`empty`})]}):(0,G.jsxs)(`div`,{className:`my-1.5 rounded-lg border border-think/30 bg-think-soft/40 text-sm`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>n(!r),className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-think`,children:[e.streaming?(0,G.jsx)(J.Spinner,{className:`w-3.5 h-3.5`}):(0,G.jsx)(J.Brain,{className:`w-3.5 h-3.5`}),(0,G.jsx)(`span`,{className:`font-medium`,children:e.redacted?`Redacted thinking`:e.streaming?`Thinking…`:`Thought`}),a?(0,G.jsxs)(`span`,{className:`text-xs opacity-70`,"data-testid":`thought-words`,children:[a.toLocaleString(`en-US`),` `,a===1?`word`:`words`]}):null,(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(J.Chevron,{open:r,className:`w-3.5 h-3.5 opacity-70`})]}),r&&!e.redacted?(0,G.jsx)(`div`,{className:W(`border-t border-think/20 px-3 py-2 text-fg-muted`,e.streaming&&`caret`),children:e.streaming?(0,G.jsx)(`div`,{className:`pre-wrap`,"data-testid":`thinking-stream`,children:i}):(0,G.jsx)(dP,{text:e.text})}):null]})});function FI(e){let t=0,n=!1;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i===32||i===10||i===13||i===9?n=!1:n||(n=!0,t++)}return t}function II(e){if(!e)return!1;if(e.tagName===`TEXTAREA`)return!0;if(e.tagName===`INPUT`){let t=(e.type||`text`).toLowerCase();return![`button`,`checkbox`,`radio`,`submit`,`reset`,`range`,`color`,`file`].includes(t)}return e.isContentEditable===!0}function LI(e){!e||typeof document>`u`||II(document.activeElement)||e.querySelector(`[data-autofocus]`)?.focus()}function RI(e){if(!e)return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e instanceof HTMLElement&&e.isContentEditable}function zI(e,t,n){if(!e||!n||n.querySelector(`[role="dialog"][aria-modal="true"]`))return!1;let r=t instanceof Element?t:null;if(r&&r.closest(`[data-keep-escape]`))return!1;let i=BI(e);if(i!==null&&r&&r!==n.body){let e=BI(r);if(e!==null&&e!==i)return!1}if(r&&RI(r)&&!e.contains(r)&&r.closest(`[data-testid="composer"]`)===null)return!1;let a=Array.from(n.querySelectorAll(`[data-permission-pending="true"]`)).find(e=>i===null||BI(e)===i);return a===void 0||a===e}function BI(e){return e.closest(`[data-chat-group]`)?.getAttribute(`data-chat-group`)??e.closest(`[data-editor-group]`)?.getAttribute(`data-editor-group`)??null}var VI=(0,v.memo)(function({item:e,agentName:t}){let n=e.request,[r,i]=(0,v.useState)(!1),a=e.status===`allowed`,o=(0,v.useMemo)(()=>zp(n.toolName,n.input,110),[n]),s=n.agentId?t??`background agent`:null;if(n.toolName===`AskUserQuestion`){let e=Ll(n.input).length;return(0,G.jsxs)(`div`,{className:`my-1 flex items-center gap-2 px-1 py-0.5 text-xs text-fg-faint`,children:[a?(0,G.jsx)(J.Check,{className:`w-3 h-3 shrink-0 text-ok`}):(0,G.jsx)(J.X,{className:`w-3 h-3 shrink-0`}),(0,G.jsx)(`span`,{"data-testid":`permission-${n.requestId}`,children:zl({outcome:a?`answered`:`dismissed`,questions:e})}),s?(0,G.jsx)(`span`,{title:n.agentId??void 0,className:`shrink-0`,children:(0,G.jsx)(Q,{tone:`think`,children:s})}):null]})}let c=xS(n);return(0,G.jsxs)(`div`,{className:`my-1 text-xs text-fg-faint`,"data-testid":`permission-${n.requestId}`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(e=>!e),className:`flex w-full min-w-0 items-center gap-2 rounded px-1 py-0.5 text-left hover:bg-surface-2`,children:[a?(0,G.jsx)(J.Check,{className:`w-3 h-3 shrink-0 text-ok`}):(0,G.jsx)(J.X,{className:`w-3 h-3 shrink-0 text-danger`}),(0,G.jsxs)(`span`,{className:`shrink-0`,"data-testid":c?`connector-settled`:void 0,children:[c?SS(c,a):`${a?`Allowed`:`Denied`} ${n.displayName??n.toolName}`,e.resolvedBy===`auto`?` (automatically)`:e.resolvedBy&&e.resolvedBy!==`local`?` (by ${e.resolvedBy})`:``]}),o?(0,G.jsx)(`span`,{className:`min-w-0 truncate font-mono text-fg-muted`,"data-testid":`permission-summary`,children:o}):null,s?(0,G.jsx)(`span`,{title:n.agentId??void 0,className:`shrink-0`,children:(0,G.jsx)(Q,{tone:`think`,children:s})}):null,(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(J.Chevron,{open:r,className:`w-3 h-3 shrink-0`})]}),r?(0,G.jsx)(`div`,{className:`ml-5 mt-1`,children:(0,G.jsx)(EI,{name:n.toolName,input:n.input})}):null]})});function HI({items:e,agentNameOf:t}){let[n,r]=(0,v.useState)(!1),i=AF((0,v.useMemo)(()=>e.map(e=>e.id),[e]),r),{allowed:a,denied:o,tools:s,who:c}=(0,v.useMemo)(()=>{let n=e.filter(e=>e.status===`allowed`).length,r=new Map,i=new Set;for(let n of e){let e=xS(n.request),a=e?`${e.tool} (${e.vendor})`:n.request.displayName??n.request.toolName;r.set(a,(r.get(a)??0)+1),n.request.agentId&&i.add(t(n.request.agentId)??`background agent`)}return{allowed:n,denied:e.length-n,tools:[...r.entries()].sort((e,t)=>t[1]-e[1]).map(([e,t])=>t>1?`${e} ×${t}`:e).join(`, `),who:[...i]}},[e,t]);return(0,G.jsxs)(`div`,{className:`my-1 text-xs text-fg-faint`,"data-testid":`permission-run`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":n||i,onClick:()=>r(e=>!e),className:`flex w-full min-w-0 items-center gap-2 rounded px-1 py-0.5 text-left hover:bg-surface-2`,children:[o===0?(0,G.jsx)(J.Check,{className:`w-3 h-3 shrink-0 text-ok`}):(0,G.jsx)(J.X,{className:`w-3 h-3 shrink-0 text-danger`}),(0,G.jsxs)(`span`,{className:`shrink-0`,children:[a>0?`Allowed ${a}`:``,a>0&&o>0?` · `:``,o>0?`Denied ${o}`:``]}),(0,G.jsx)(`span`,{className:`min-w-0 truncate text-fg-muted`,"data-testid":`permission-run-tools`,children:s}),c.length>0?(0,G.jsx)(`span`,{className:`shrink-0`,children:(0,G.jsx)(Q,{tone:`think`,children:c.length===1?c[0]:`${c.length} agents`})}):null,(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(J.Chevron,{open:n||i,className:`w-3 h-3 shrink-0`})]}),n||i?(0,G.jsx)(`div`,{className:`ml-3`,children:e.map(e=>(0,G.jsx)(VI,{item:e,agentName:e.request.agentId?t(e.request.agentId):null},e.id))}):null]})}function UI({item:e,onDecide:t,stackIndex:n,agentName:r}){let i=e.request,[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(``),l=i.title??`Allow ${i.displayName??i.toolName}?`,u=(0,v.useRef)(t);u.current=t;let d=(0,v.useRef)(null),f=e.status===`pending`;if((0,v.useEffect)(()=>{if(f&&typeof document<`u`){let e=e=>{e.key===`Escape`&&zI(d.current,e.target,document)&&(e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation(),u.current({behavior:`deny`}))};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)}},[f]),(0,v.useEffect)(()=>{f&&LI(d.current)},[f]),e.status!==`pending`)return(0,G.jsx)(VI,{item:e,agentName:r??null});if(i.toolName===`AskUserQuestion`)return(0,G.jsx)(cF,{item:e,onDecide:t,cardRef:d,...n===void 0?{}:{stackIndex:n}});let p=Ql(i);if(p)return(0,G.jsx)(lF,{input:p,requestId:i.requestId,onDecide:t,cardRef:d});let m=xS(i);if(m)return(0,G.jsx)(pF,{input:m,requestId:i.requestId,onDecide:t,cardRef:d});let h=jp(i);if(h)return(0,G.jsx)(xF,{input:h,requestId:i.requestId,onDecide:t,cardRef:d});let g=Tp(i);return g?(0,G.jsx)(mF,{input:g,requestId:i.requestId,onDecide:t,cardRef:d}):(0,G.jsxs)(`div`,{ref:d,className:`my-2 rounded-lg border border-warn/60 bg-warn-soft/40 p-3 text-sm shadow-sm`,role:`group`,"aria-label":`Permission request`,"data-permission-pending":`true`,"data-testid":`permission-${i.requestId}`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(J.Shield,{className:`mt-0.5 w-4 h-4 text-warn`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-semibold`,children:l}),(0,G.jsx)(Q,{tone:`warn`,children:i.toolName}),i.agentId?(0,G.jsx)(Q,{tone:`think`,children:`subagent`}):null]}),i.description?(0,G.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,children:i.description}):null,i.decisionReason?(0,G.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-faint`,children:i.decisionReason}):null,i.blockedPath?(0,G.jsxs)(`div`,{className:`mt-0.5 font-mono text-xs text-danger`,children:[`Blocked path: `,i.blockedPath]}):null]})]}),(0,G.jsx)(`div`,{className:`mt-2`,children:(0,G.jsx)(EI,{name:i.toolName,input:i.input})}),a?(0,G.jsx)(`div`,{className:`mt-2`,children:(0,G.jsx)(`input`,{className:Z,placeholder:`Optional: tell the agent why (sent as the tool result)`,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&t(s.trim()?{behavior:`deny`,message:s.trim()}:{behavior:`deny`})}})}):null,(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(Y,{variant:`inverse`,onClick:()=>t({behavior:`allow`}),"data-autofocus":!0,children:[(0,G.jsx)(J.Check,{className:`w-3.5 h-3.5`}),` Allow`]}),(0,G.jsx)(Y,{variant:`secondary`,title:`Allow and remember this rule for the session/project`,onClick:()=>t({behavior:`allow`,remember:!0}),children:`Allow always`}),a?(0,G.jsx)(Y,{variant:`secondary`,onClick:()=>t(s.trim()?{behavior:`deny`,message:s.trim()}:{behavior:`deny`}),children:`Confirm deny`}):(0,G.jsxs)(Y,{variant:`ghost`,onClick:()=>o(!0),children:[(0,G.jsx)(J.X,{className:`w-3.5 h-3.5`}),` Deny`]}),(0,G.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`Enter = allow · Esc = deny`})]})]})}var WI=6e4,GI=1e4;function KI(e,t=GI,n=300){if(e.length>=t)return!0;let r=1;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)===10&&(r++,r>=n))return!0;return!1}function qI(e){return Math.ceil(Math.max(0,e)/3)*4}function JI(e,t){return t?Math.min(e.size,WI):qI(e.size)}function YI(e){return e>=1048576?`${(e/1048576).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${Math.max(0,Math.round(e))} B`}function XI(e,t={}){let n=t.budget??6291456,r=t.isText??(()=>!1),i=Math.max(0,t.usedBytes??0),a=[],o=[],s=0;for(let t of e){let e=JI(t,r(t));if(e>n){o.push({name:t.name,reason:`too large — ${YI(t.size)} becomes ${YI(e)} once encoded (limit ${YI(n)})`});continue}if(i+e>n){o.push({name:t.name,reason:`would exceed the ${YI(n)} attachment budget — send the staged files first`});continue}i+=e,s+=e,a.push(t)}return{accepted:a,rejected:o,addedBytes:s}}var ZI=3e3;function QI(e,t,n){return e?.providerId!==`oonacode`||(n?.priceUsdMonthly??0)>0?null:t?.free===!0?`free`:`pool`}function $I(e){switch(e){case`free`:return`Waiting for a free-lane slot — free requests are paced, so the first reply can take a few seconds.`;case`pool`:return`Waiting for a slot on the OonaCode pool — the request is queued behind the provider’s rate limits.`;default:return null}}function eL(e,t,n=ZI){let[r,i]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{if(i(!1),!e)return;let t=setTimeout(()=>i(!0),n);return()=>clearTimeout(t)},[e,t,n]),r}function tL(e){let t=Math.floor(e/6e4);if(t<60)return`${Math.max(1,t)}m`;let n=Math.floor(t/60);if(n<24)return`${n}h ${t-n*60}m`;let r=Math.floor(n/24);return`${r}d ${n-r*24}h`}function nL(e){return e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e))}function rL(e){let{lastTurnEndedAt:t,now:n,ttlSec:r,contextTokens:i,running:a}=e;if(a||t===null||r===null||r<=0||i!==null&&i<1024)return null;let o=n-t;if(!Number.isFinite(o)||o<r*1e3)return null;let s=i===null?`the whole conversation`:`about ${nL(i)} tokens`;return`Idle ${tL(o)}. The prompt cache has likely expired, so your next message will re-cache ${s}.`}var iL=new Set([`Alt`,`AltGraph`,`Control`,`Shift`,`Meta`,`OS`,`CapsLock`]),aL=1500,oL=24;function sL(e){if(!e)return`none`;if(typeof document<`u`&&e===document.body)return`BODY`;let t=e.tagName??`?`,n=e.getAttribute?.(`data-testid`)??e.getAttribute?.(`aria-label`)??e.getAttribute?.(`role`),r=typeof e.className==`string`?e.className.split(/\s+/).filter(Boolean).slice(0,3):[];return`${t}${n?`[${n.slice(0,60)}]`:``}${r.length>0?`.${r.join(`.`)}`:``}`}function cL(e,t){let n=t.now??(()=>Date.now()),r=-1/0,i=-1/0,a=[],o=e=>{iL.has(e.key)||(r=n())},s=()=>{i=n()},c=()=>{let e=n();return a.filter(t=>e-t.t<=aL).map(e=>e.what)},l=a=>{let o=n();if(o-r>2e3||o-i<=1e3)return;let s=a.relatedTarget instanceof Element?a.relatedTarget:null,l=c();setTimeout(()=>{if(typeof document<`u`&&!document.hasFocus()||typeof document<`u`&&document.activeElement===e)return;let n=typeof document<`u`?document.activeElement:null;n&&n!==e&&n.closest?.(`[data-testid="composer"]`)||t.report({activeAfter:sL(typeof document<`u`?document.activeElement:null),relatedTarget:sL(s),boxConnected:e.isConnected,boxDisabled:e.disabled,recentlyAdded:l,sinceKeyMs:Math.round(o-r),unmounted:!1})},0)},u=null,d=t.root??(typeof document<`u`?document.body:null);return d&&typeof MutationObserver<`u`&&(u=new MutationObserver(e=>{let t=n();for(let n of e)for(let e of Array.from(n.addedNodes))e.nodeType===1&&(a.push({t,what:sL(e)}),a.length>oL&&a.shift())}),u.observe(d,{childList:!0,subtree:!0})),e.addEventListener(`keydown`,o),e.addEventListener(`blur`,l),typeof document<`u`&&document.addEventListener(`pointerdown`,s,!0),()=>{let a=n();typeof document<`u`&&document.activeElement===e&&a-r<=2e3&&a-i>1e3&&t.report({activeAfter:`unmounting`,relatedTarget:`none`,boxConnected:e.isConnected,boxDisabled:e.disabled,recentlyAdded:c(),sinceKeyMs:Math.round(a-r),unmounted:!0}),u?.disconnect(),e.removeEventListener(`keydown`,o),e.removeEventListener(`blur`,l),typeof document<`u`&&document.removeEventListener(`pointerdown`,s,!0)}}var lL=new Map;function uL(e){e===void 0?lL.clear():lL.delete(e)}function dL(e){let{text:t,chatId:n,disabled:r=!1,load:i,onPick:a}=e,o=Xp(t),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(null),[,d]=(0,v.useState)(0),f=(0,v.useRef)(null);(0,v.useEffect)(()=>{o===null&&c(!1)},[o]),(0,v.useEffect)(()=>{u(null)},[o,n]);let p=o!==null&&!s&&!r&&n!==null,m=n!==null&&!r&&(p||/^\/\S+\s/.test(t)),h=n===null?void 0:lL.get(n),g=h!==void 0&&Date.now()-h.at<6e4;(0,v.useEffect)(()=>{if(!m||n===null||g||f.current===n)return;f.current=n;let e=!0;return i(n).then(e=>{lL.set(n,{at:Date.now(),commands:e===null||e===`unsupported`?null:[...tm(e.commands)],unsupported:e===`unsupported`})}).catch(()=>{lL.set(n,{at:Date.now(),commands:null,unsupported:!1})}).finally(()=>{f.current===n&&(f.current=null),e&&d(e=>e+1)}),()=>{e=!1}},[m,n,g,i]);let _=h?.commands??null,{items:y,sections:b,best:x}=(0,v.useMemo)(()=>{if(!_||o===null)return{items:[],sections:[],best:0};let e=nm(_,o),t=cm(e),n=[],r=0;for(let e of am)t[e].length!==0&&(n.push({id:e,title:om[e],start:r,items:t[e]}),r+=t[e].length);let i=n.flatMap(e=>e.items),a=e[0];return{items:i,sections:n,best:o.length>0&&a?Math.max(i.indexOf(a),0):0}},[_,o]),S=(0,v.useMemo)(()=>_?rm(t,_):null,[_,t]),C=h===void 0?`loading`:h.unsupported?`unsupported`:h.commands===null?`error`:`ready`,w=p&&C!==`unsupported`,T=y.length===0?0:Math.min(l??x,y.length-1),E=(0,v.useCallback)(e=>`/${e.name} `,[]),D=(0,v.useCallback)(()=>c(!0),[]);return{open:w,status:C,query:o??``,items:y,sections:b,active:T,setActive:u,inArguments:S,onKeyDown:e=>{if(!w||e.nativeEvent.isComposing)return!1;if(e.key===`Escape`)return e.preventDefault(),c(!0),!0;if(y.length===0)return!1;if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;return u((T+t+y.length)%y.length),!0}let t=y[T];if(e.key===`Enter`&&!e.shiftKey||e.key===`Tab`&&!e.shiftKey){let n=o!==null&&(t.name.toLowerCase()===o.toLowerCase()||(t.aliases??[]).some(e=>e.toLowerCase()===o.toLowerCase()));return e.key===`Enter`&&n?!1:t.availability===`ok`?(e.preventDefault(),a(E(t)),!0):(e.preventDefault(),!0)}return!1},textFor:E,dismiss:D}}var fL=`slash-command-menu`,pL=e=>`slash-command-option-${e}`,mL=`The model may also use it on its own in this chat (switched on in the Skills menu)`,hL=`Picking or typing a skill runs it once, in this message, whatever the Skills menu says. The model is shown a skill on its own only when it is switched on in the Skills menu under the message box — then it costs its tokens on every message.`;function gL({menu:e,onPick:t,modelSkills:n=null}){let r=(0,v.useRef)(null);return(0,v.useEffect)(()=>{(r.current?.querySelector(`#${pL(e.active)}`))?.scrollIntoView?.({block:`nearest`})},[e.active,e.items]),e.open?(0,G.jsxs)(`div`,{className:`absolute bottom-full left-0 right-0 z-20 mb-1 overflow-hidden rounded-lg border border-border bg-surface shadow-lg`,"data-testid":`slash-menu`,children:[e.status===`loading`?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-xs text-fg-muted`,role:`status`,children:[(0,G.jsx)(J.Spinner,{className:`h-3.5 w-3.5 animate-spin`}),` Reading this chat’s commands…`]}):e.status===`error`?(0,G.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,role:`status`,children:`The host could not list this chat’s commands right now — type the command, it still runs.`}):e.items.length===0?(0,G.jsxs)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,role:`status`,"data-testid":`slash-empty`,children:[`No command or skill matches “/`,e.query,`” — Enter sends it to the model as a message.`]}):(0,G.jsx)(`ul`,{ref:r,id:fL,role:`listbox`,"aria-label":`Skills and commands`,className:`max-h-72 overflow-y-auto pb-1`,children:e.sections.map(r=>(0,G.jsx)(_L,{section:r,menu:e,onPick:t,modelSkills:n},r.id))}),(0,G.jsx)(`div`,{className:`hidden border-t border-border px-3 py-0.5 text-right text-[10px] text-fg-faint sm:block`,children:`↑↓ to move · Enter or Tab to pick · Esc to close`})]}):null}function _L({section:e,menu:t,onPick:n,modelSkills:r}){let i=`slash-section-${e.id}`,a=e=>e.modelSkill===void 0?null:(r??[]).includes(e.modelSkill),o=e.items.filter(e=>a(e)!==null),s=o.some(e=>a(e)===!0);return(0,G.jsxs)(`li`,{role:`presentation`,"data-testid":`slash-section`,"data-section":e.id,children:[(0,G.jsxs)(`div`,{id:i,className:`sticky top-0 z-10 flex items-baseline gap-2 border-b border-border bg-surface px-3 pb-0.5 pt-1.5 text-[11px]`,children:[(0,G.jsx)(`span`,{className:`font-semibold uppercase tracking-wide text-fg-muted`,"data-testid":`slash-section-title`,children:e.title}),e.id===`skills`?(0,G.jsx)(`span`,{className:`ml-auto flex min-w-0 items-center gap-1 truncate text-fg-faint`,title:hL,"data-testid":`slash-skills-note`,children:o.length===0?`Picking one runs it once`:s?(0,G.jsxs)(G.Fragment,{children:[`Picking one runs it once · `,(0,G.jsx)(J.Skill,{className:`h-3 w-3 shrink-0 text-accent`}),` `,`the model may also use it here`]}):`Picking one runs it once · the model is not shown these here`}):null]}),(0,G.jsx)(`ul`,{role:`group`,"aria-labelledby":i,children:e.items.map((r,i)=>{let o=e.start+i;return(0,G.jsx)(vL,{item:r,index:o,active:o===t.active,onHover:t.setActive,onPick:n,modelOn:a(r)},r.name)})})]})}var vL=(0,v.memo)(function({item:e,index:t,active:n,onHover:r,onPick:i,modelOn:a}){let o=e.availability!==`ok`,s=im(e.source),c=um(e.description);return(0,G.jsxs)(`li`,{id:pL(t),role:`option`,"aria-selected":n,"aria-disabled":o||void 0,"data-testid":`slash-item`,"data-name":e.name,"data-model-skill":a===null?void 0:a?`on`:`off`,title:e.description||void 0,className:W(`flex cursor-pointer flex-col gap-0.5 px-3 py-1.5 text-xs`,n?`bg-accent-soft`:`hover:bg-surface-2`,o&&`cursor-default opacity-60`),onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>r(t),onClick:()=>{o||i(e)},children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,G.jsxs)(`span`,{className:`shrink-0 font-mono font-medium text-fg`,children:[`/`,e.name]}),e.argumentHint?(0,G.jsx)(`span`,{className:`min-w-0 truncate font-mono text-fg-faint`,children:e.argumentHint}):null,(0,G.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[a===!0&&!o?(0,G.jsx)(`span`,{className:`text-accent`,title:mL,"aria-label":mL,"data-testid":`slash-model-state`,children:(0,G.jsx)(J.Skill,{className:`h-3 w-3`})}):null,s?(0,G.jsx)(`span`,{className:`rounded border border-border px-1 text-[10px] uppercase tracking-wide text-fg-muted`,children:s}):null]})]}),o?(0,G.jsxs)(`div`,{className:`text-fg-muted`,"data-testid":`slash-reason`,children:[`Not available here — `,e.reason]}):c?(0,G.jsx)(`div`,{className:`truncate text-fg-muted`,"data-testid":`slash-summary`,children:c}):null]})});function yL({item:e}){return e&&e.availability!==`ok`?(0,G.jsxs)(`div`,{className:`px-1 pt-0.5 text-[11px] text-warn`,"data-testid":`slash-hint`,children:[(0,G.jsxs)(`span`,{className:`font-mono`,children:[`/`,e.name]}),` is not available here — `,e.reason]}):!e||!e.argumentHint&&!e.note?null:(0,G.jsxs)(`div`,{className:`px-1 pt-0.5 text-[11px] text-fg-faint`,"data-testid":`slash-hint`,children:[(0,G.jsxs)(`span`,{className:`font-mono`,children:[`/`,e.name,` `,e.argumentHint]}),e.note?(0,G.jsxs)(`span`,{children:[` — `,e.note]}):null]})}var bL=`field-sizing-content w-auto max-w-full shrink-0 rounded-md border border-border bg-surface-2 py-0.5 pl-1.5 pr-1 text-xs text-fg hover:border-fg-faint focus:border-accent focus:outline-none disabled:opacity-50`,xL=[{value:`default`,label:`Ask (default)`},{value:`acceptEdits`,label:`Accept edits`},{value:`plan`,label:`Plan`},{value:`auto`,label:`Auto`},{value:`dontAsk`,label:`Don't ask`},{value:`bypassPermissions`,label:`Bypass permissions`}],SL=`Ask anything — build, fix, explain…`,CL=M;function wL(e){return new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error??Error(`read failed`)),r.onload=()=>{let e=String(r.result??``);t(e.slice(e.indexOf(`,`)+1))},r.readAsDataURL(e)})}function TL(e){return new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error??Error(`read failed`)),r.onload=()=>t(String(r.result??``)),r.readAsText(e)})}function EL(e){if(e.type.startsWith(`image/`))return`image`;if(e.type===`application/pdf`)return`document`;if(e.type.startsWith(`text/`))return`text`;if(e.type)return`path`;let t=MM(e.name);return t.kind===`image`?`image`:t.kind===`pdf`?`document`:t.kind===`audio`||t.kind===`video`?`path`:`text`}function DL(e){return e.map(e=>e.kind===`image`?{type:`image`,source:{type:`base64`,media_type:e.mediaType,data:e.data}}:e.kind===`document`?{type:`document`,source:{type:`base64`,media_type:e.mediaType||`application/pdf`,data:e.data}}:e.kind===`path`?{type:`text`,text:LF({name:e.name,mediaType:e.mediaType||`file`,sizeText:YI(e.size),path:e.path??e.name})}:{type:`text`,text:`Attached file ${e.name}:\n\n\`\`\`\n${e.data}\n\`\`\``})}function OL(){let{state:e,actions:t,dispatch:n,api:r}=K(),i=hb(),a=gb(),o=mb(),{sessionId:s,focused:c}=fb(),l=s?e.unsent[s]:void 0,[u,d]=(0,v.useState)(()=>l?.text??``),[f,p]=(0,v.useState)(()=>[...l?.attachments??[]]),[m,h]=(0,v.useState)(()=>[...l?.replies??[]]),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(CL),[x,S]=(0,v.useState)(!1),C=(0,v.useRef)(null),w=(0,v.useRef)(null),T=(0,v.useRef)(0),E=(0,v.useRef)(!0),[D,O]=(0,v.useState)(null),k=(0,v.useCallback)(e=>{if(e.kind===`path`){BF(e.path??``,t.toast);return}WF(e.kind===`text`?{name:e.name,mediaType:`text/plain`,base64:MF(e.data)}:{name:e.name,mediaType:e.mediaType||`application/pdf`,base64:e.data},t.toast)},[t]),A=(0,v.useRef)({text:u,attachments:f,replies:m});A.current={text:u,attachments:f,replies:m},(0,v.useEffect)(()=>(E.current=!0,()=>{E.current=!1}),[]);let j=(0,v.useRef)(o?.status??null);j.current=o?.status??null,(0,v.useEffect)(()=>{let e=C.current;if(e)return cL(e,{report:e=>t.reportDiagnostic(`message box lost the focus while typing`,{...e,chatStatus:j.current})})},[t]),(0,v.useEffect)(()=>{if(s)return()=>t.rememberUnsent(s,A.current)},[s,t]),(0,v.useEffect)(()=>{if(s)return wv(s,()=>A.current)},[s]),(0,v.useEffect)(()=>{l&&(d(e=>e.length===0?l.text:e),p(e=>e.length===0?[...l.attachments]:e),h(e=>e.length===0?[...l.replies??[]]:e))},[l]);let M=e.composerQuote,P=(0,v.useRef)(M?.seq??0);(0,v.useEffect)(()=>{!M||M.seq<=P.current||(P.current=M.seq,M.sessionId===s&&(h(e=>e.some(e=>e.quote===M.text)?e:[...e,{id:`reply-${M.seq}`,quote:M.text,preview:M.preview,itemId:M.itemId}]),C.current?.focus()))},[M,s]);let F=i?.effort??a?.effort??``;(0,v.useEffect)(()=>{_(F)},[s,F]);let re=o?.status===`running`||o?.status===`waiting_permission`,ie=e.connection.status===`open`,I=Kx(),L=qx(),R=!s||I||L!==null,z=fS(),ae=Ce(z.option),oe=(0,v.useMemo)(()=>{let e=Fm(z.option,z.modelId);return e.length===0?[]:F&&!e.includes(F)?[...e,F]:e},[z.option,z.modelId,F]),se=oe.length>0,ce=(0,v.useMemo)(()=>e.providers.find(e=>e.definition.id===z.providerId)?.definition,[e.providers,z.providerId]),le=I?`This session runs on a PC that is offline — read-only`:L?`${L} is no longer offered — pick another model to continue`:R?`Open a chat to start`:re?`Agent is working — a message sent now is handed to it and read at its next step (Esc to stop)`:SL;(0,v.useEffect)(()=>{let e=C.current;if(!e)return;let t=()=>{e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,240)}px`};if(t(),typeof ResizeObserver>`u`)return;let n=e.clientWidth,r=new ResizeObserver(()=>{e.clientWidth!==n&&(n=e.clientWidth,t())});return r.observe(e),()=>r.disconnect()},[u,le]);let ue=(0,v.useRef)(c);ue.current=c,(0,v.useEffect)(()=>{ue.current&&C.current?.focus()},[s]);let de=ne(a?.permissionMode?{permissionMode:a.permissionMode,posture:a.posture??null}:i);(0,v.useEffect)(()=>{b(ae?de:CL)},[ae,de,s]);let fe=Lm(z.providerId),pe=zm(z.providerId);(0,v.useEffect)(()=>{!a||!ae||!fe||zm(z.providerId).some(e=>e.id===de)||t.setSessionPosture(CL,s??void 0)},[a,ae,fe,z.providerId,de,s,t]);let me=(0,v.useMemo)(()=>f.reduce((e,t)=>e+t.data.length,0),[f]),he=(0,v.useRef)(me);he.current=me;let ge=(0,v.useCallback)(async(e,n={})=>{let o=Array.from(e);if(o.length===0)return;let c=XI(o,{usedBytes:he.current,isText:e=>{let t=EL(e);return t===`text`||t===`path`||t===`image`&&e.size>2097152}});for(let e of c.rejected)t.toast(`error`,`${e.name} was not attached: ${e.reason}`);let l=zF(),u=`this window cannot say where the file lives — type its full path into the message, or use the desktop app`,d=[],f=i?.cwd||(a?.projectDir??null);for(let e of c.accepted){let i=EL(e);if(i===`image`&&e.size>2097152&&(i=`path`),(i===`image`||i===`document`)&&ce&&z.modelId){let n=Ws(ce,z.modelId,[{type:i}]);if(n){t.toast(`error`,`${e.name||`File`} was not attached: ${n}`);continue}}if(i===`path`){let a=l?.(e)??null;if(!a&&(n.isPaste||i===`path`&&e.type?.startsWith(`image/`))&&r?.saveTmpFile)try{let t=await wL(e),n=await r.saveTmpFile({sessionId:s??null,cwd:f,name:e.name||`attachment`,mediaType:e.type||MM(e.name).mime||`application/octet-stream`,base64:t});n.ok&&n.path&&(a=n.path)}catch{}if(!a){t.toast(`error`,`${e.name||`File`} was not attached: ${u}`);continue}d.push({id:`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:e.name||`file`,mediaType:e.type||MM(e.name).mime||`application/octet-stream`,data:``,kind:i,path:a,size:e.size});continue}try{let a=i===`text`?(await TL(e)).slice(0,WI):await wL(e);if(i===`text`&&VM(a)){let i=l?.(e)??null;if(!i&&n.isPaste&&r?.saveTmpFile)try{let t=await wL(e),n=await r.saveTmpFile({sessionId:s??null,cwd:f,name:e.name||`file.bin`,mediaType:e.type||`application/octet-stream`,base64:t});n.ok&&n.path&&(i=n.path)}catch{}i?d.push({id:`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:e.name||`file`,mediaType:e.type||`application/octet-stream`,data:``,kind:`path`,path:i,size:e.size}):t.toast(`error`,`${e.name||`File`} was not attached: it is not text, and ${u}`);continue}let o=l?.(e)??null;if(!o&&i===`image`&&r?.saveTmpFile)try{let t=await r.saveTmpFile({sessionId:s??null,cwd:f,name:e.name||`image.png`,mediaType:e.type||`image/png`,base64:a});t.ok&&t.path&&(o=t.path)}catch{}d.push({id:`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:e.name||(i===`image`?`image`:`file`),mediaType:e.type||(i===`text`?`text/plain`:`application/octet-stream`),data:a,kind:i,path:o??void 0,size:e.size})}catch{t.toast(`error`,`${e.name||`File`} could not be read — nothing was attached`)}}d.length>0&&p(e=>[...e,...d])},[t,r,ce,z.modelId,a?.projectDir,i?.cwd,s]),_e=y===CL?null:ee(y),ve=(0,v.useCallback)(e=>{d(e);let t=C.current;t&&(t.focus(),requestAnimationFrame(()=>t.setSelectionRange(e.length,e.length)))},[]),ye=dL({text:u,chatId:s,disabled:R,load:t.listCommands,onPick:ve}),be=(0,v.useCallback)(()=>{let e=u.trim();if(!s||L!==null||!e&&f.length===0)return;let n=Zv(m.map(e=>e.quote),e||`Please look at the attached file(s).`),r=Qp(n,`app`);if(r){t.toast(`error`,$p(r));return}let i=f,a=m,o=DL(i),c={};g&&(c.effort=g),_e&&(c.permissionMode=_e,c.posture=y);let l=s;d(``),p([]),h([]),C.current?.focus(),t.sendPrompt(n,o,Object.keys(c).length>0?c:void 0,l??void 0).then(e=>{if(E.current){let e=document.activeElement;(!e||e===document.body)&&C.current?.focus()}if(!e){if(E.current){d(e=>e.length===0?u:e),p(e=>e.length===0?i:e),h(e=>e.length===0?a:e);return}t.rememberUnsent(l,{text:u,attachments:i,replies:a},!0)}})},[u,f,m,s,L,t,g,_e,y]),xe=e=>{ye.onKeyDown(e)||(e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing?(e.preventDefault(),be()):e.key===`Escape`&&re&&(e.preventDefault(),t.interrupt(s??void 0)))},Se=e=>{let n=Array.from(e.clipboardData?.files??[]);if(n.length>0){e.preventDefault(),ge(n,{isPaste:!0});return}let o=e.clipboardData?.getData(`text/plain`)??``;if(o&&KI(o)){e.preventDefault();let n=i?.cwd||(a?.projectDir??null),c=new TextEncoder().encode(o),l=MF(o),u=r?.saveTmpFile;if(u){(async()=>{try{let e=await u({sessionId:s??null,cwd:n,name:`pasted-text.txt`,mediaType:`text/plain`,base64:l});if(e.ok&&e.path){p(t=>[...t,{id:`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:`pasted-text.txt`,mediaType:`text/plain`,data:``,kind:`path`,path:e.path,size:c.byteLength}]),t.toast(`info`,`Large pasted text (${YI(c.byteLength)}) saved to ${e.path} and attached by path.`);return}}catch{}d(e=>e+o)})();return}}},we=e=>{e.preventDefault(),T.current=0,S(!1),e.dataTransfer?.files?.length&&ge(e.dataTransfer.files)},Te=e=>{e.dataTransfer?.types?.includes(`Files`)&&(T.current+=1,S(!0))},Ee=()=>{T.current=Math.max(0,T.current-1),T.current===0&&S(!1)},De=e=>{e.target.files&&ge(e.target.files),e.target.value=``},{pendingQuestions:Oe,pendingPermissions:ke}=(0,v.useMemo)(()=>{let e=[],t=[];for(let n of o?.items??[])n.kind===`permission`&&n.status===`pending`&&(n.request.toolName===`AskUserQuestion`?e.push(n):t.push(n));return{pendingQuestions:e,pendingPermissions:t}},[o?.items]),Ae=QI(i,z.option,e.plan),je=eL(o?.status===`running`,o?.items.length??0)&&Ae?$I(Ae):null,[Me,Ne]=(0,v.useState)(()=>Date.now());(0,v.useEffect)(()=>{let e=setInterval(()=>Ne(Date.now()),6e4);return()=>clearInterval(e)},[]);let B=(0,v.useMemo)(()=>{if(!o||!i)return null;let t=o.items,n=null;for(let e=t.length-1;e>=0;e--)if(t[e].kind===`result`){n=t[e];break}if(!n||n.kind!==`result`){if(t.length===0)return null;let n=e.providers.find(e=>e.definition.id===z.providerId)?.definition.capabilities.promptCacheTtlSec??null,r=Date.parse(i.updatedAt);return rL({lastTurnEndedAt:Number.isFinite(r)?r:null,now:Me,ttlSec:n,contextTokens:o.contextTokens,running:re})}let r=n.timestamp?Date.parse(n.timestamp):Date.parse(i.updatedAt),a=e.providers.find(e=>e.definition.id===z.providerId)?.definition.capabilities.promptCacheTtlSec??null;return rL({lastTurnEndedAt:Number.isFinite(r)?r:null,now:Me,ttlSec:a,contextTokens:o.contextTokens,running:re})},[o,i,e.providers,z.providerId,Me,re]);return(0,G.jsxs)(`div`,{className:`relative border-t border-border bg-surface px-3 py-2 sm:px-6`,onDrop:we,onDragOver:e=>e.preventDefault(),onDragEnter:Te,onDragLeave:Ee,"data-testid":`composer`,children:[x?(0,G.jsxs)(`div`,{className:`pointer-events-none absolute inset-1 z-10 flex items-center justify-center rounded-xl border-2 border-dashed border-accent bg-accent-soft/70 text-sm font-medium text-accent`,"data-testid":`drop-overlay`,children:[(0,G.jsx)(J.Upload,{className:`mr-2 w-4 h-4`}),` Drop files to attach`]}):null,(0,G.jsxs)(`div`,{className:`w-full`,children:[s&&e.toolInstalls[s]?(0,G.jsx)(fF,{frame:e.toolInstalls[s],onDismiss:()=>n({type:`tool_install_dismiss`,sessionId:s})}):null,ke.length>0?(0,G.jsx)(`div`,{className:`mb-2 max-h-[45vh] space-y-2 overflow-y-auto`,"data-testid":`composer-pending`,children:ke.map(e=>(0,G.jsx)(UI,{item:e,onDecide:n=>t.respondPermission(e.request.requestId,n,s??void 0)},e.id))}):null,Oe.map((e,n)=>(0,G.jsx)(UI,{item:e,stackIndex:n,onDecide:n=>t.respondPermission(e.request.requestId,n,s??void 0)},e.id)),B&&!je?(0,G.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 rounded-md bg-surface-2 px-2.5 py-1.5 text-[11px] text-fg-muted`,"data-testid":`idle-cache-hint`,children:[(0,G.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full bg-fg-faint`}),B]}):null,je?(0,G.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 rounded-md bg-surface-2 px-2.5 py-1.5 text-[11px] text-fg-muted`,"data-testid":`pacing-hint`,"data-lane":Ae??void 0,children:[(0,G.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-warn`}),je]}):null,!ie&&s?(0,G.jsx)(`div`,{className:`mb-2 text-xs text-fg-faint`,children:e.connection.status===`unauthorized`?`The host rejected this token.`:`Not connected to the host — messages will be sent over HTTP when possible.`}):null,m.length>0?(0,G.jsx)(`div`,{className:`mb-2 flex flex-col gap-1`,"data-testid":`reply-chips`,children:m.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border-l-2 border-accent bg-accent-soft/60 py-1 pl-2 pr-1 text-xs`,"data-testid":`reply-chip`,children:[(0,G.jsx)(J.Reply,{className:`h-3.5 w-3.5 shrink-0 text-accent`}),(0,G.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 truncate text-left text-fg-muted hover:text-fg`,title:`Go to the message this replies to`,disabled:!e.itemId||!s,onClick:()=>{e.itemId&&s&&t.jumpToItem(s,e.itemId)},"data-testid":`reply-chip-jump`,children:[(0,G.jsx)(`span`,{className:`text-fg`,children:`Reply to `}),e.preview]}),(0,G.jsx)(`button`,{type:`button`,"aria-label":`Remove this reply`,onClick:()=>h(t=>t.filter(t=>t.id!==e.id)),className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-fg-muted hover:text-danger`,"data-testid":`reply-chip-remove`,children:(0,G.jsx)(J.X,{className:`h-3 w-3`})})]},e.id))}):null,f.length>0?(0,G.jsxs)(`div`,{className:`mb-2 flex flex-wrap gap-2`,"data-testid":`attachments`,children:[f.map(e=>(0,G.jsxs)(`div`,{className:`relative`,children:[e.kind===`image`?(0,G.jsx)(`button`,{type:`button`,"aria-label":`View ${e.name}`,title:`View ${e.name}`,"data-testid":`attachment-thumb`,onClick:()=>O({name:e.name,mediaType:e.mediaType,base64:e.data}),className:`block cursor-zoom-in rounded p-0 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,G.jsx)(`img`,{src:`data:${e.mediaType};base64,${e.data}`,alt:e.name,className:`h-14 w-14 rounded border border-border object-cover`})}):(0,G.jsxs)(`button`,{type:`button`,"aria-label":`Open ${e.name}`,title:e.kind===`path`?`Open ${e.name} — ${e.path??``}`:`Open ${e.name} in its own program`,"data-testid":e.kind===`path`?`attachment-path`:`attachment-file`,onClick:()=>k(e),className:`flex h-14 min-w-[7rem] max-w-[12rem] flex-col justify-center rounded border border-border bg-surface-2 px-2 text-left text-[11px] hover:bg-surface-3 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium`,children:Yg(e.name,22)}),(0,G.jsx)(`span`,{className:`text-fg-faint`,children:e.kind===`document`?`PDF · ${Math.ceil(e.size/1024)} KB`:e.kind===`path`?`${e.mediaType.startsWith(`video/`)?`video`:e.mediaType.startsWith(`audio/`)?`audio`:`file`} · ${YI(e.size)} · path`:`text · ${Math.ceil(e.size/1024)} KB`})]}),(0,G.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,onClick:()=>p(t=>t.filter(t=>t.id!==e.id)),className:`absolute -right-1.5 -top-1.5 flex h-5 w-5 items-center justify-center rounded-full border border-border bg-surface text-fg-muted hover:text-danger`,children:(0,G.jsx)(J.X,{className:`w-3 h-3`})})]},e.id)),(0,G.jsx)(rI,{picture:D,onClose:()=>O(null),notify:t.toast})]}):null,L?(0,G.jsxs)(`p`,{className:`px-1 text-xs text-danger`,role:`status`,"data-testid":`model-withdrawn`,children:[L,` is no longer available. Pick another model below to continue this chat — its history stays.`]}):null,(0,G.jsxs)(`div`,{className:W(`relative flex flex-col gap-1 rounded-xl border bg-bg px-2 py-1.5`,R?`border-border opacity-60`:`border-border`),children:[(0,G.jsx)(gL,{menu:ye,onPick:e=>ve(ye.textFor(e)),modelSkills:(a?a.modelSkills:i?.modelSkills)??null}),(0,G.jsx)(`textarea`,{ref:C,"aria-label":`Message`,rows:1,value:u,"aria-controls":ye.open?fL:void 0,"aria-activedescendant":ye.open&&ye.items.length>0?pL(ye.active):void 0,disabled:R,placeholder:le,onChange:e=>d(e.target.value),onKeyDown:xe,onPaste:Se,className:`max-h-60 min-h-[2.25rem] w-full resize-none bg-transparent px-1 py-1.5 text-sm outline-none placeholder:text-fg-faint`}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1`,"data-testid":`composer-controls`,children:[(0,G.jsx)(`input`,{ref:w,type:`file`,multiple:!0,className:`hidden`,onChange:De,"data-testid":`file-input`}),(0,G.jsx)(X,{label:`Attach files or images`,disabled:R,onClick:()=>w.current?.click(),children:(0,G.jsx)(J.Upload,{className:`w-4 h-4`})}),(0,G.jsx)(dS,{disabled:!s||I}),(0,G.jsx)(_P,{disabled:R}),(0,G.jsx)(xP,{disabled:R}),(0,G.jsx)(jP,{disabled:R}),(0,G.jsx)(ZP,{}),(0,G.jsx)(tF,{}),(0,G.jsx)(nF,{}),i&&!I?(0,G.jsx)(X,{label:`Listen to this chat — a spoken summary`,"data-testid":`listen-button`,onClick:()=>t.openVoiceSummary(i.id),children:(0,G.jsx)(J.Speaker,{className:`w-4 h-4`})}):null,ae?(0,G.jsxs)(`select`,{"aria-label":`Agent`,"data-testid":`agent-picker`,className:bL,value:y,disabled:R,title:fe?Bm:void 0,onChange:e=>{let n=e.target.value;N(n)&&(b(n),t.setSessionPosture(n,s??void 0))},children:[pe.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.label},e.id)),pe.some(e=>e.id===y)?null:(0,G.jsx)(`option`,{value:y,disabled:!0,children:te(y)})]}):null,ae&&fe?(0,G.jsx)(`span`,{className:`inline-flex`,"data-testid":`agy-posture-note`,children:(0,G.jsx)(Db,{label:`the agent picker`,details:Bm})}):null,se?(0,G.jsxs)(`select`,{"aria-label":`Effort`,className:bL,value:g,disabled:R,onChange:e=>{let n=e.target.value;_(n),t.setSessionEffort(n||null,s??void 0)},children:[(0,G.jsx)(`option`,{value:``,children:`effort: default`}),oe.map(e=>(0,G.jsxs)(`option`,{value:e,children:[`effort: `,e]},e))]}):null,(0,G.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,"data-testid":`composer-actions`,children:[re?(0,G.jsxs)(Y,{variant:`danger`,size:`sm`,onClick:()=>void t.interrupt(s??void 0),title:`Interrupt (Esc)`,"aria-label":`Interrupt`,"data-testid":`stop-button`,children:[(0,G.jsx)(J.Stop,{className:`w-3.5 h-3.5`}),` Stop`]}):null,(0,G.jsxs)(Y,{variant:`primary`,size:`sm`,onMouseDown:e=>e.preventDefault(),onClick:be,disabled:R||!u.trim()&&f.length===0,"aria-label":re?`Queue message`:`Send`,title:re?`Queue this message — the agent reads it at its next step`:void 0,children:[(0,G.jsx)(J.Send,{className:`w-3.5 h-3.5`}),` `,re?`Queue`:`Send`]})]})]})]}),ye.open?null:(0,G.jsx)(yL,{item:ye.inArguments}),o&&o.totals.turns>0?(0,G.jsxs)(`div`,{className:`mt-1 text-right text-[11px] text-fg-faint`,children:[o.totals.turns,` turn`,o.totals.turns===1?``:`s`,` ·`,` `,i?.providerId===`oonacode`?Ru(i.poolCredits??0):Vu(Hu(e.providers.find(e=>e.definition.id===i?.providerId)?.definition))]}):null]})]})}function kL({name:e,state:t,behind:n,detail:r}){return(0,G.jsxs)(`div`,{"data-testid":`sync-side`,className:`min-w-0 flex-1 rounded-md border p-3 ${n?`border-warn bg-warn-soft/40`:`border-border bg-surface-2`}`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-sm font-medium`,children:[(0,G.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n?(0,G.jsx)(`span`,{className:`shrink-0 text-[11px] font-normal text-warn`,children:`behind`}):null]}),(0,G.jsx)(`div`,{className:`mt-1 text-[11px] text-fg-faint`,children:t.entryCount===null?`size not read`:`${t.entryCount} ${t.entryCount===1?`entry`:`entries`}`}),(0,G.jsx)(`div`,{className:`text-[11px] text-fg-faint`,title:Kg(t.lastEntryAt),children:t.lastEntryAt?`last message ${Wg(t.lastEntryAt)}`:`no timestamps`}),r?(0,G.jsx)(`div`,{className:`mt-1 break-all text-[11px] text-fg-faint`,children:r}):null]})}function AL({sessionId:e,sessionTitle:t,onClose:n}){let{actions:r}=K(),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(null),f=(0,v.useCallback)(async()=>{if(e){s(!0);try{a(await r.refreshSessionLink(e))}finally{s(!1)}}},[e,r]);(0,v.useEffect)(()=>{d(null),a(null),f()},[f]);let p=async()=>{if(e){l(!0);try{let t=await r.syncSessionDown(e);d(t),t&&a(t.link)}finally{l(!1)}}},m=i?.status===`ours-behind`,h=i?.status===`theirs-behind`;return(0,G.jsx)(jb,{open:e!==null,title:`Sync with the original chat`,onClose:n,footer:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{variant:`ghost`,onClick:n,children:`Close`}),(0,G.jsx)(Y,{variant:`primary`,busy:c,onClick:()=>void p(),disabled:!i?.canDownstream||o,"data-testid":`sync-down-confirm`,children:c?`Syncing…`:m?`Bring the new messages in`:`Check again`})]}),children:o&&!i?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-sm text-fg-muted`,children:[(0,G.jsx)(J.Spinner,{className:`w-4 h-4 spin`}),` Reading the original…`]}):i?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,G.jsx)(kL,{name:`OonaCode · ${t}`,state:i.ours,behind:m}),(0,G.jsx)(kL,{name:i.agentName,state:i.theirs,behind:h,detail:i.file})]}),(0,G.jsx)(`p`,{className:`text-sm text-fg-muted`,"data-testid":`sync-explanation`,children:m?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`strong`,{children:[i.agentName,` has newer messages.`]}),` Bringing them in adds them to this chat — nothing here is replaced or removed, and `,i.agentName,` is not written to.`]}):h?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`strong`,{children:`This chat is the newer one.`}),` Nothing is sent back: OonaCode never writes into your `,i.agentName,` install, so the copy over there stays as it is.`]}):(0,G.jsx)(G.Fragment,{children:`Both copies are at the same point. There is nothing to bring in.`})}),u?(0,G.jsx)(`div`,{className:`rounded-md border border-border bg-surface-2 p-3 text-sm`,"data-testid":`sync-result`,children:u.added>0?`${u.added} new ${u.added===1?`message`:`messages`} added to this chat.`:`Already up to date — nothing to bring in.`}):null]}):(0,G.jsx)(`p`,{className:`py-4 text-sm text-fg-muted`,children:`This PC no longer has the chat this one was imported from, so there is nothing to compare it with. Nothing is wrong with the chat itself — it stays exactly as it is.`})})}function jL({status:e}){return(0,G.jsx)(`span`,{className:W(`inline-block h-2 w-2 shrink-0 rounded-full`,e===`running`?`bg-accent animate-pulse`:e===`waiting_permission`?`bg-warn animate-pulse`:e===`error`?`bg-danger`:`bg-transparent`),"aria-hidden":!0})}function ML(e){return e.some(e=>e.status===`running`)?`running`:e.some(e=>e.status===`waiting_permission`)?`waiting_permission`:`idle`}function NL({sessions:e,testId:t}){let n=ML(e);if(n===`idle`)return null;let r=e.filter(e=>e.status===`running`||e.status===`waiting_permission`).length;return(0,G.jsx)(`span`,{className:`inline-flex shrink-0 items-center`,title:n===`running`?`${r} chat${r===1?``:`s`} working`:`${r} chat${r===1?``:`s`} waiting for permission`,"aria-label":`${r} active chat${r===1?``:`s`}`,"data-testid":t,children:(0,G.jsx)(jL,{status:n})})}var PL={idle:`idle`,running:`working`,waiting_permission:`waiting for permission`,error:`error`};function FL({label:e,value:t}){return t==null||t===``?null:(0,G.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-fg-faint`,children:e}),(0,G.jsx)(`span`,{className:`min-w-0 truncate text-right text-fg`,title:t,children:t})]})}function IL({session:e,anchor:t}){let{state:n}=K(),r=n.providers.find(t=>t.definition.id===e.providerId)?.definition,i=r?.models.find(t=>t.id===e.model),a=e.projectId?n.vaultProjects.find(t=>t.id===e.projectId):void 0,o=e.startedBy?n.sessions.find(t=>t.id===e.startedBy):void 0,s=ne(e),c=ee(s)===e.permissionMode?te(s):xL.find(t=>t.value===e.permissionMode)?.label??e.permissionMode,l=Uu(e,Hu(r)),u=Math.max(8,Math.min(t.right+8,window.innerWidth-304-8)),d=Math.max(8,Math.min(t.top,window.innerHeight-360));return(0,Sb.createPortal)((0,G.jsxs)(`div`,{role:`tooltip`,"data-testid":`session-details-${e.id}`,className:`fixed z-50 max-h-[22rem] w-[19rem] overflow-y-auto rounded-lg border border-border bg-surface p-3 text-xs shadow-lg`,style:{left:u,top:d},children:[(0,G.jsx)(`div`,{className:`mb-2 truncate text-sm font-medium text-fg`,children:Qg(e)}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(FL,{label:`Model`,value:r&&e.model?`${e.model} · ${r.displayName}`:e.model}),(0,G.jsx)(FL,{label:`Effort`,value:e.effort??`default`}),(0,G.jsx)(FL,{label:`Mode`,value:c}),(0,G.jsx)(FL,{label:`Status`,value:PL[e.status]}),(0,G.jsx)(FL,{label:`Context window`,value:i?.contextWindow?`${Ug(i.contextWindow)} tokens`:null}),(0,G.jsx)(FL,{label:`Tokens`,value:`${Ug(e.inputTokens)} in · ${Ug(e.outputTokens)} out`}),(0,G.jsx)(FL,{label:`Cost`,value:l}),(0,G.jsx)(FL,{label:`Messages`,value:String(e.entryCount)}),(0,G.jsx)(FL,{label:`Folder`,value:e.projectDir??e.cwd}),(0,G.jsx)(FL,{label:`Project`,value:a?.name??null}),(0,G.jsx)(FL,{label:`Created`,value:Kg(e.createdAt)}),(0,G.jsx)(FL,{label:`Updated`,value:Kg(e.updatedAt)}),(0,G.jsx)(FL,{label:`Forked from`,value:e.forkedFrom}),(0,G.jsx)(FL,{label:`Started by`,value:o?Qg(o):e.startedBy}),(0,G.jsx)(FL,{label:`Temporary`,value:e.temporary?`yes — safe to delete when done`:null}),(0,G.jsx)(FL,{label:`Subagents`,value:e.hasSubagents?`yes`:null}),(0,G.jsx)(FL,{label:`Engine since`,value:Kg(e.engineSince)})]})]}),document.body)}function LL({link:e}){return e?.status===`ours-behind`?(0,G.jsxs)(`span`,{className:`ml-1 inline-flex shrink-0 items-center gap-0.5 rounded bg-warn-soft px-1 text-[10px] font-medium leading-4 text-warn`,title:`${e.agentName} has newer messages in this chat — right-click to bring them in`,"data-testid":`session-behind-${e.sessionId}`,"aria-label":`behind its original`,children:[(0,G.jsx)(J.ArrowDown,{className:`w-2.5 h-2.5`}),`behind`]}):null}function RL({session:e}){return!e.startedBy&&!e.temporary?null:(0,G.jsxs)(G.Fragment,{children:[e.startedBy?(0,G.jsx)(`span`,{className:`ml-1 shrink-0 text-fg-faint`,title:`Started by another chat — rest the pointer on the chat for its name`,"data-testid":`session-started-${e.id}`,children:`· started by a chat`}):null,e.temporary?(0,G.jsx)(`span`,{className:`ml-1 inline-flex shrink-0 items-center rounded bg-surface-2 px-1 text-[10px] font-medium leading-4 text-fg-muted`,title:`Temporary: the model marked this chat throwaway — delete it from its menu when done`,"data-testid":`session-temporary-${e.id}`,children:`temporary`}):null]})}var zL=(0,v.memo)(function({session:e,active:t,link:n,onOpen:r,onMenu:i,menuOpen:a=!1,projectName:o=null,kindIcon:s=!1,testIdPrefix:c=`session`,clock:l}){let u=Qg(e),d=t=>{let n=t.currentTarget.getBoundingClientRect();i(e,{x:n.left,y:n.bottom+2},f.current)},f=(0,v.useRef)(null),p=(0,v.useRef)(null),[m,h]=(0,v.useState)(null),g=(0,v.useCallback)(()=>{p.current!==null&&(clearTimeout(p.current),p.current=null),h(null)},[]),_=(0,v.useRef)(a);return _.current=a,(0,v.useEffect)(()=>{a&&g()},[a,g]),(0,v.useEffect)(()=>{if(m===null)return;let e=e=>{zx(e.target,f.current)&&g()};return window.addEventListener(`scroll`,e,!0),()=>window.removeEventListener(`scroll`,e,!0)},[m,g]),(0,v.useEffect)(()=>()=>{p.current!==null&&clearTimeout(p.current)},[]),(0,G.jsxs)(`div`,{ref:f,className:W(`group relative flex items-center rounded-md`,t?`bg-accent-soft`:`hover:bg-surface-2`),onMouseEnter:()=>{p.current!==null&&clearTimeout(p.current),!_.current&&(p.current=setTimeout(()=>{p.current=null,f.current&&!_.current&&h(f.current.getBoundingClientRect())},450))},onMouseLeave:g,onClick:g,onContextMenu:t=>{t.preventDefault(),g(),i(e,{x:t.clientX,y:t.clientY},f.current)},children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`flex min-w-0 flex-1 items-center gap-2 px-2 py-1.5 text-left`,"aria-current":t?`true`:void 0,"data-testid":`${c}-${e.id}`,children:[s?(0,G.jsx)(J.Chats,{className:`w-3.5 h-3.5 shrink-0 text-fg-faint`}):null,s&&e.status===`idle`?null:(0,G.jsx)(jL,{status:e.status}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-1`,children:(0,G.jsx)(`span`,{className:W(`min-w-0 flex-1 truncate text-sm`,t?`text-fg font-medium`:`text-fg`),children:u})}),(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center text-[11px] text-fg-faint`,children:[o?(0,G.jsxs)(`span`,{className:`mr-1 inline-flex min-w-0 max-w-[45%] shrink-0 items-center gap-0.5 text-project`,"data-testid":`session-project-${e.id}`,title:`Filed under ${o}`,children:[(0,G.jsx)(J.Project,{className:`w-2.5 h-2.5 shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,children:o}),(0,G.jsx)(`span`,{className:`text-fg-faint`,children:`·`})]}):null,(0,G.jsxs)(`span`,{className:`truncate`,children:[Wg(e.updatedAt,l),e.model?` · ${e.model}`:``,` · ${Jg(e.projectDir??e.cwd)}`]}),(0,G.jsx)(LL,{link:n}),(0,G.jsx)(RL,{session:e})]})]})]}),(0,G.jsx)(X,{label:`Chat 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":`${c}-menu-${e.id}`,onClick:e=>{e.stopPropagation(),d(e)},children:(0,G.jsx)(J.More,{className:`w-3.5 h-3.5`})}),m===null?null:(0,G.jsx)(IL,{session:e,anchor:m})]})});function BL({session:e,link:t,pinned:n,actions:r,onSync:i,onRename:a,onDelete:o}){let s=[];return t?.status===`ours-behind`&&s.push({key:`sync`,label:`Sync with ${t.agentName}…`,hint:`behind`,icon:(0,G.jsx)(J.Download,{className:`w-3.5 h-3.5`}),onSelect:i,testId:`session-menu-sync`}),s.push({key:`pin`,label:n?`Unpin`:`Pin to top`,icon:(0,G.jsx)(J.Pin,{className:`w-3.5 h-3.5`}),separated:s.length>0,onSelect:()=>r.setPinned(`chat`,e.id,!n),testId:`session-menu-pin`},{key:`project`,label:`Move to Project`,icon:(0,G.jsx)(J.Project,{className:`w-3.5 h-3.5`}),onSelect:()=>r.openAssignProject(e.id),testId:`session-menu-project`},...e.projectId?[{key:`project-settings`,label:`Project settings…`,icon:(0,G.jsx)(J.Settings,{className:`w-3.5 h-3.5`}),onSelect:()=>r.openProjectSettings(e.projectId),testId:`session-menu-project-settings`}]:[],{key:`folder`,label:`Change folder…`,icon:(0,G.jsx)(J.Folder,{className:`w-3.5 h-3.5`}),onSelect:()=>{r.selectSession(e.id),r.openDialog(`project`)},testId:`session-menu-folder`},{key:`details`,label:`Details`,icon:(0,G.jsx)(J.Info,{className:`w-3.5 h-3.5`}),onSelect:()=>{r.selectSession(e.id),r.savePrefs({sessionPanelOpen:!0})},testId:`session-menu-details`},{key:`listen`,label:`Listen to this chat…`,icon:(0,G.jsx)(J.Speaker,{className:`w-3.5 h-3.5`}),onSelect:()=>r.openVoiceSummary(e.id),testId:`session-menu-listen`},{key:`files`,label:`Files`,icon:(0,G.jsx)(J.File,{className:`w-3.5 h-3.5`}),onSelect:()=>{r.selectSession(e.id),r.savePrefs({explorerOpen:!0})},testId:`session-menu-files`},{key:`rename`,label:`Rename…`,icon:(0,G.jsx)(J.Edit,{className:`w-3.5 h-3.5`}),onSelect:a,testId:`session-menu-rename`},{key:`fork`,label:`Fork`,icon:(0,G.jsx)(J.Fork,{className:`w-3.5 h-3.5`}),onSelect:()=>void r.forkSession(e.id),testId:`session-menu-fork`},{key:`delete`,label:`Delete`,icon:(0,G.jsx)(J.Trash,{className:`w-3.5 h-3.5`}),danger:!0,separated:!0,onSelect:o,testId:`session-menu-delete`}),s}function VL(){let{state:e,actions:t}=K(),[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(null),u=(0,v.useCallback)((e,t,n)=>r({session:e,at:t,el:n}),[]),d=(0,v.useCallback)(()=>r(null),[]),f=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Vx,{open:n!==null,at:n?.at??{x:0,y:0},anchorEl:n?.el??null,label:`Chat actions`,onClose:d,items:n?BL({session:n.session,link:e.sessionLinks[n.session.id]??null,pinned:Tl(e.prefs.pinned,`chat`,n.session.id),actions:t,onSync:()=>a(n.session),onRename:()=>s(n.session),onDelete:()=>l(n.session)}):[]}),(0,G.jsx)(AL,{sessionId:i?.id??null,sessionTitle:i?Qg(i):``,onClose:()=>a(null)}),(0,G.jsx)(Fb,{open:c!==null,title:`Delete this chat?`,message:`It is deleted from this PC — the only place it is kept — so it is gone from every device. Your files, folder and code are not touched — only the chat is deleted.`,onConfirm:()=>{c&&t.deleteSession(c.id)},onClose:()=>l(null)}),(0,G.jsx)(Ib,{open:o!==null,title:`Rename chat`,label:`Session title`,initialValue:o?Qg(o):``,onSubmit:e=>{o&&e!==Qg(o)&&t.renameSession(o.id,e)},onClose:()=>s(null)})]});return{openMenu:u,menuFor:n?.session.id??null,element:f}}function HL({projectId:e,pinned:t,fold:n,actions:r}){let i=[];return e?i.push({key:`open`,label:`Open project`,icon:(0,G.jsx)(J.Project,{className:`w-3.5 h-3.5`}),onSelect:()=>r.openPage({kind:`project`,projectId:e}),testId:`project-menu-open`},{key:`settings`,label:`Project settings…`,icon:(0,G.jsx)(J.Settings,{className:`w-3.5 h-3.5`}),onSelect:()=>r.openProjectSettings(e),testId:`project-menu-settings`},{key:`new-chat`,label:`New chat in this project`,icon:(0,G.jsx)(J.Plus,{className:`w-3.5 h-3.5`}),onSelect:()=>r.newTab({projectId:e}),testId:`project-menu-new-chat`},{key:`pin`,label:t?`Unpin`:`Pin to top`,icon:(0,G.jsx)(J.Pin,{className:`w-3.5 h-3.5`}),onSelect:()=>r.setPinned(`project`,e,!t),testId:`project-menu-pin`}):i.push({key:`new-project`,label:`New project…`,icon:(0,G.jsx)(J.Project,{className:`w-3.5 h-3.5`}),onSelect:()=>r.openNewProject(),testId:`project-menu-new-project`}),n&&i.push({key:`fold`,label:n.collapsed?`Expand`:`Collapse`,icon:(0,G.jsx)(J.Chevron,{open:n.collapsed,className:`w-3.5 h-3.5`}),separated:!0,onSelect:n.onToggle,testId:`project-menu-fold`}),i}var UL=[{value:`activity`,label:`Recent activity`},{value:`name`,label:`Name`},{value:`created`,label:`Date created`}];function WL(e){let t=e.goal?.trim()??``;return t===``?(e.instructions??``).split(/\r?\n/).find(e=>e.trim()!==``)?.trim()??``:t}function GL(e,t){let n=new Map;for(let e of t){if(!e.projectId)continue;let t=n.get(e.projectId);t?t.push(e):n.set(e.projectId,[e])}return e.map(e=>{let t=n.get(e.id)??[],r=t.reduce((e,t)=>Math.max(e,t.mtime),-1/0),i=Date.parse(e.updatedAt);return{project:e,description:WL(e),chatCount:e.sessionCount??t.length,working:t.filter(e=>e.status===`running`||e.status===`waiting_permission`).length,lastActivity:Number.isFinite(r)?r:Number.isFinite(i)?i:0}})}function KL(e,t){let n=t.trim().toLowerCase();return n===``?e.slice():e.filter(({project:e})=>[e.name,e.goal??``,e.instructions??``].some(e=>e.toLowerCase().includes(n)))}var qL=(e,t)=>e.project.name.localeCompare(t.project.name,void 0,{sensitivity:`base`});function JL(e,t){let n=e.slice();return t===`name`?n.sort(qL):t===`created`?n.sort((e,t)=>(Date.parse(t.project.createdAt)||0)-(Date.parse(e.project.createdAt)||0)||qL(e,t)):n.sort((e,t)=>t.lastActivity-e.lastActivity||qL(e,t))}function YL(){let{state:e,actions:t}=K(),n=e.scheduledTasksVersion,[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(0);return(0,v.useEffect)(()=>{let e=!0;return t.listScheduledTasks({}).then(t=>{e&&i(t)}),()=>{e=!1}},[t,n,a]),{tasks:r,reload:(0,v.useCallback)(()=>o(e=>e+1),[])}}function XL(){let[e,t]=(0,v.useState)(()=>Date.now());return(0,v.useEffect)(()=>{let e=setInterval(()=>t(Date.now()),6e4);return()=>clearInterval(e)},[]),e}function ZL(e){return e===1?`1 chat`:`${e} chats`}function QL({card:e,pinned:t,actions:n,onDelete:r}){let i=e.chatCount;return[...HL({projectId:e.project.id,pinned:t,fold:null,actions:n}),{key:`delete`,label:`Delete project`,icon:(0,G.jsx)(J.Trash,{className:`w-3.5 h-3.5`}),danger:!0,separated:!0,disabled:i>0,...i>0?{hint:`${ZL(i)} in it`}:{},onSelect:r,testId:`project-card-delete`}]}function $L(){let{state:e,actions:t}=K(),n=XL(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(`activity`),[l,u]=(0,v.useState)(null),d=(0,v.useCallback)(()=>u(null),[]),[f,p]=(0,v.useState)(null),m=(0,v.useCallback)(()=>p(null),[]),[h,g]=(0,v.useState)(null),_=(0,v.useRef)(null),y=(0,v.useMemo)(()=>GL(e.vaultProjects,e.sessions),[e.vaultProjects,e.sessions]),b=(0,v.useMemo)(()=>JL(KL(y,r),s),[y,r,s]),x=e=>t.openPage({kind:`project`,projectId:e}),S=(e,t,n)=>p({card:e,at:t,el:n});return(0,G.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto bg-bg`,"data-testid":`projects-page`,children:[(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl px-4 py-6 sm:px-8`,children:[(0,G.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`h1`,{className:`mr-auto text-2xl font-semibold text-fg`,children:`Projects`}),a||r!==``?(0,G.jsx)(`input`,{ref:_,autoFocus:!0,"aria-label":`Search projects`,className:W(Z,`w-56`),placeholder:`Search projects`,value:r,onChange:e=>i(e.target.value),onBlur:()=>{r===``&&o(!1)},onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),i(``),o(!1))},"data-testid":`projects-search`}):null,(0,G.jsx)(X,{label:`Search projects — by name, goal and instructions`,onClick:()=>{o(!0),_.current?.focus()},"data-testid":`projects-search-toggle`,children:(0,G.jsx)(J.Search,{})}),(0,G.jsx)(X,{label:`Sort — ${UL.find(e=>e.value===s)?.label??``}`,"aria-haspopup":`menu`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();u({at:{x:t.left,y:t.bottom+2},el:e.currentTarget})},"data-testid":`projects-sort`,children:(0,G.jsx)(J.Sliders,{})}),(0,G.jsxs)(Y,{variant:`inverse`,onClick:()=>t.openNewProject(),"data-testid":`projects-new`,children:[(0,G.jsx)(J.Plus,{className:`w-3.5 h-3.5`}),`New project`]})]}),e.vaultProjects.length===0?(0,G.jsx)(Pb,{icon:(0,G.jsx)(J.Project,{className:`h-8 w-8`}),title:`No projects yet`,hint:`A project groups chats, whatever folders they run in, and gives every chat in it the same standing instructions, goal and memory. Projects live in your vault, so they follow you to every PC.`,action:(0,G.jsxs)(Y,{variant:`primary`,onClick:()=>t.openNewProject(),children:[(0,G.jsx)(J.Plus,{className:`w-3.5 h-3.5`}),`New project`]})}):b.length===0?(0,G.jsxs)(`p`,{className:`py-10 text-center text-sm text-fg-muted`,"data-testid":`projects-no-match`,children:[`No project matches “`,r.trim(),`”.`]}):(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2 2xl:grid-cols-3`,"data-testid":`projects-grid`,children:b.map(t=>(0,G.jsx)(eR,{card:t,clock:n,pinned:Tl(e.prefs.pinned,`project`,t.project.id),onOpen:x,onMenu:S},t.project.id))})]}),(0,G.jsx)(Vx,{open:l!==null,at:l?.at??{x:0,y:0},anchorEl:l?.el??null,label:`Sort projects`,testId:`projects-sort-menu`,onClose:d,items:UL.map(e=>({key:e.value,label:e.label,icon:e.value===s?(0,G.jsx)(J.Check,{className:`w-3.5 h-3.5 text-accent`}):(0,G.jsx)(`span`,{className:`w-3.5`}),onSelect:()=>c(e.value),testId:`projects-sort-${e.value}`}))}),(0,G.jsx)(Vx,{open:f!==null,at:f?.at??{x:0,y:0},anchorEl:f?.el??null,label:`Project actions`,testId:`project-card-menu`,onClose:m,items:f?QL({card:f.card,pinned:Tl(e.prefs.pinned,`project`,f.card.project.id),actions:t,onDelete:()=>g(f.card.project)}):[]}),(0,G.jsx)(Fb,{open:h!==null,title:h?`Delete ${h.name}?`:`Delete this project?`,message:`Its instructions, goal, memory and settings are removed from your vault, on every device. No chat is filed under it, so no chat changes.`,onConfirm:()=>{h&&t.deleteVaultProject(h.id)},onClose:()=>g(null)})]})}function eR({card:e,clock:t,pinned:n,onOpen:r,onMenu:i}){let{project:a}=e,o=(0,v.useRef)(null);return(0,G.jsxs)(`div`,{ref:o,className:`group relative rounded-xl border border-border bg-surface transition-colors hover:border-fg-faint hover:bg-surface-2/40`,"data-testid":`project-card-${a.id}`,onContextMenu:t=>{t.preventDefault(),o.current&&i(e,{x:t.clientX,y:t.clientY},o.current)},children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex h-full min-h-[7.5rem] w-full flex-col items-start gap-1 p-4 text-left`,onClick:()=>r(a.id),"data-testid":`project-card-open-${a.id}`,children:[(0,G.jsxs)(`span`,{className:`flex w-full min-w-0 items-center gap-2 pr-7`,children:[(0,G.jsx)(J.Project,{className:`w-4 h-4 shrink-0 text-project`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate text-[15px] font-medium text-fg`,children:a.name}),n?(0,G.jsx)(J.Pin,{className:`w-3 h-3 shrink-0 text-fg-faint`,title:`Pinned to the top of the session list`}):null]}),e.description?(0,G.jsx)(`span`,{className:`line-clamp-2 text-sm text-fg-muted`,"data-testid":`project-card-description`,children:e.description}):null,(0,G.jsxs)(`span`,{className:`mt-auto flex items-center gap-1.5 pt-2 text-xs text-fg-faint`,children:[e.working>0?(0,G.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full bg-accent animate-pulse`,title:`${e.working} working now`,"aria-hidden":!0}):null,(0,G.jsxs)(`span`,{"data-testid":`project-card-meta`,children:[ZL(e.chatCount),e.lastActivity>0?` · ${Gg(e.lastActivity,t)}`:``]})]})]}),(0,G.jsx)(X,{label:`Actions for ${a.name}`,className:`absolute right-2 top-2 p-1 opacity-60 group-hover:opacity-100 focus:opacity-100`,onClick:t=>{let n=t.currentTarget.getBoundingClientRect();o.current&&i(e,{x:n.left,y:n.bottom+2},o.current)},"data-testid":`project-card-menu-${a.id}`,children:(0,G.jsx)(J.More,{className:`w-4 h-4`})})]})}function tR({projectId:e}){let{state:t,actions:n}=K(),r=XL(),i=VL(),a=t.vaultProjects.find(t=>t.id===e)??null,o=(0,v.useMemo)(()=>t.sessions.filter(n=>n.projectId===e&&!t.remote.tabs[n.id]).sort((e,t)=>t.mtime-e.mtime),[t.sessions,t.remote.tabs,e]),s=(0,v.useCallback)(e=>n.selectSession(e),[n]),c=()=>n.openPage({kind:`projects`});if(!a)return(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto bg-bg`,"data-testid":`project-page`,children:(0,G.jsx)(Pb,{icon:(0,G.jsx)(J.Project,{className:`h-8 w-8`}),title:`This project is not here`,hint:`It was deleted, or your vault has not loaded it yet.`,action:(0,G.jsx)(Y,{onClick:c,"data-testid":`project-page-back`,children:`All projects`})})});let l=Tl(t.prefs.pinned,`project`,a.id),u=a.instructions.trim(),d=a.repositories??[],f=a.sessionCount??o.length;return(0,G.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto bg-bg`,"data-testid":`project-page`,children:[(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-4xl px-4 py-6 sm:px-8`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`mb-3 inline-flex items-center gap-1 text-xs text-fg-muted hover:text-fg`,onClick:c,"data-testid":`project-page-back`,children:[(0,G.jsx)(J.Chevron,{className:`w-3 h-3 rotate-180`}),`All projects`]}),(0,G.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(J.Project,{className:`w-5 h-5 shrink-0 text-project`}),(0,G.jsx)(`h1`,{className:`mr-auto min-w-0 truncate text-2xl font-semibold text-fg`,"data-testid":`project-page-name`,children:a.name}),(0,G.jsx)(X,{label:l?`Unpin from the session list`:`Pin to the top of the session list`,"aria-pressed":l,className:l?`text-accent`:void 0,onClick:()=>n.setPinned(`project`,a.id,!l),"data-testid":`project-page-pin`,children:(0,G.jsx)(J.Pin,{})}),(0,G.jsxs)(Y,{variant:`ghost`,onClick:()=>n.openProjectSettings(a.id),"data-testid":`project-page-settings`,children:[(0,G.jsx)(J.Settings,{className:`w-3.5 h-3.5`}),`Project settings`]}),(0,G.jsxs)(Y,{variant:`inverse`,onClick:()=>n.newTab({projectId:a.id}),"data-testid":`project-page-new-chat`,children:[(0,G.jsx)(J.Plus,{className:`w-3.5 h-3.5`}),`New chat in this project`]})]}),a.goal?.trim()?(0,G.jsx)(`p`,{className:`mb-4 text-sm text-fg-muted`,"data-testid":`project-page-goal`,children:a.goal.trim()}):null,(0,G.jsxs)(`section`,{className:`mb-5 rounded-xl border border-border bg-surface p-4`,children:[(0,G.jsx)(`h2`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-faint`,children:`Instructions`}),u?(0,G.jsx)(`div`,{className:`max-h-64 overflow-y-auto whitespace-pre-wrap break-words text-sm text-fg`,"data-testid":`project-page-instructions`,children:u}):(0,G.jsx)(`p`,{className:`text-sm text-fg-faint`,children:`None — chats here start with nothing extra.`}),d.length>0?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h2`,{className:`mb-1 mt-4 text-xs font-semibold uppercase tracking-wide text-fg-faint`,children:`Repositories`}),(0,G.jsx)(`ul`,{className:`space-y-0.5 text-sm`,"data-testid":`project-page-repositories`,children:d.map(e=>(0,G.jsx)(`li`,{className:`truncate font-mono text-xs text-fg-muted`,children:e},e))})]}):null]}),(0,G.jsxs)(`section`,{children:[(0,G.jsxs)(`h2`,{className:`mb-1 flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-fg-faint`,children:[`Chats`,(0,G.jsx)(`span`,{className:`font-normal normal-case`,"data-testid":`project-page-count`,children:f})]}),o.length===0?(0,G.jsx)(`p`,{className:`py-3 text-sm text-fg-faint`,"data-testid":`project-page-no-chats`,children:f>0?`${ZL(f)} filed here are older than the list this window holds.`:`No chats in this project yet — start one with “New chat in this project”.`}):(0,G.jsx)(`div`,{className:`rounded-xl border border-border bg-surface p-1`,"data-testid":`project-page-chats`,children:o.map(e=>(0,G.jsx)(zL,{session:e,active:!1,link:t.sessionLinks[e.id]??null,menuOpen:i.menuFor===e.id,onOpen:s,onMenu:i.openMenu,clock:r,testIdPrefix:`project-chat`},e.id))}),f>0&&o.length>0&&f>o.length?(0,G.jsxs)(`p`,{className:`mt-1 text-xs text-fg-faint`,children:[f-o.length,` older `,f-o.length===1?`chat is`:`chats are`,` `,`not in the list this window holds — search for`,` `,f-o.length===1?`it`:`them`,` in the session list.`]}):null]})]}),i.element]})}var nR=`waiting: the chat is busy`;function rR(e){return e.enabled&&typeof e.lastResult==`string`&&e.lastResult.startsWith(`waiting:`)&&e.lastResult!==nR}function iR(e,t){if(!e.enabled||!e.nextRunAt)return!1;let n=Date.parse(e.nextRunAt);return Number.isFinite(n)&&n-t<=36e5}function aR(e,t){let n=e=>e===1?`1 scheduled task`:`${e} scheduled tasks`,r=e.filter(rR).length;if(r>0)return{tone:`stuck`,count:r,text:`${n(r)} could not run — open Scheduled to see why`};let i=e.filter(e=>iR(e,t)).length;return i>0?{tone:`soon`,count:i,text:`${n(i)} due within the hour`}:null}function oR(e){return e.split(/\r?\n/).find(e=>e.trim()!==``)?.trim()??``}function sR(){let{state:e,actions:t}=K(),{tasks:n,reload:r}=YL(),i=XL(),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(null),l=(0,v.useMemo)(()=>{let t=new Map(e.sessions.map(e=>[e.id,Qg(e)]));for(let[n,r]of Object.entries(e.pinnedRows))t.has(n)||t.set(n,Qg(r));return e=>t.get(e)??null},[e.sessions,e.pinnedRows]),u=async(e,t)=>{c(e.id);try{await t()&&r()}finally{c(null)}},d=n?.filter(e=>Pe(e)).length??0;return(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto bg-bg`,"data-testid":`scheduled-page`,children:(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-4xl px-4 py-6 sm:px-8`,children:[(0,G.jsxs)(`div`,{className:`mb-1 flex items-center gap-2`,children:[(0,G.jsx)(J.Clock,{className:`w-5 h-5 shrink-0 text-fg-muted`}),(0,G.jsx)(`h1`,{className:`text-2xl font-semibold text-fg`,children:`Scheduled`})]}),(0,G.jsxs)(`p`,{className:`mb-5 text-sm text-fg-muted`,children:[`What OonaCode's scheduler sends into your chats on this PC — once, or on a repeat — even when the chat has gone quiet.`,n&&n.length>0?` ${d} active${n.length>d?`, ${n.length-d} paused or done`:``}.`:``]}),n===null?null:n.length===0?(0,G.jsx)(`div`,{"data-testid":`scheduled-empty`,children:(0,G.jsx)(Pb,{icon:(0,G.jsx)(J.Clock,{className:`h-8 w-8`}),title:`Nothing scheduled`,hint:`Ask a chat to do something later or on a repeat — “remind me at 9 to check the build”, “every morning, summarise the new issues” — and its model schedules it with OonaCode’s scheduler. Every task, from every chat, shows here.`})}):(0,G.jsx)(`ul`,{className:`space-y-2`,"data-testid":`scheduled-list`,children:n.map(e=>{let n=rR(e),r=iR(e,i),c=l(e.sessionId),d=oR(e.prompt),f=Pe(e),p=Fe(e);return(0,G.jsxs)(`li`,{className:W(`rounded-xl border p-3 text-sm`,f?`bg-surface`:`bg-surface-2 opacity-60`,n?`border-warn/60`:`border-border`),"data-testid":`scheduled-row-${e.id}`,"data-active":f?`true`:`false`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-fg`,title:e.title,children:e.title}),r&&!n?(0,G.jsx)(`span`,{className:`rounded-full bg-accent-soft px-1.5 text-[11px] text-accent`,children:`due soon`}):null,e.createdBy===`model`?(0,G.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`set by the agent`}):null,(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,disabled:s===e.id||!e.enabled&&e.nextRunAt===null&&`at`in e.when,onClick:()=>void u(e,()=>t.updateScheduledTask(e.id,{enabled:!e.enabled})),"data-testid":`scheduled-row-toggle`,children:e.enabled?`Pause`:`Resume`}),(0,G.jsx)(Y,{size:`sm`,variant:a===e.id?`danger`:`ghost`,disabled:s===e.id,onClick:()=>{if(a!==e.id){o(e.id);return}o(null),u(e,()=>t.deleteScheduledTask(e.id))},"data-testid":`scheduled-row-delete`,children:a===e.id?`Delete?`:`Delete`})]}),d?(0,G.jsxs)(`div`,{className:`mt-1 truncate text-fg-muted`,title:e.prompt,"data-testid":`scheduled-row-sends`,children:[`Sends: “`,d,`”`]}):null,(0,G.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs text-fg-muted`,children:[(0,G.jsx)(`span`,{"data-testid":`scheduled-row-when`,children:Uf(e.when)}),(0,G.jsx)(`span`,{"data-testid":`scheduled-row-next`,children:Wf(e.nextRunAt,e.enabled)}),(0,G.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[`in`,(0,G.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-accent hover:underline`,title:`Open this chat`,onClick:()=>t.selectSession(e.sessionId),"data-testid":`scheduled-row-chat`,children:c??`a chat`})]})]}),e.lastRunAt||e.lastResult?(0,G.jsxs)(`div`,{className:W(`mt-0.5 text-xs`,n?`text-warn`:`text-fg-faint`),"data-testid":`scheduled-row-last`,children:[e.lastRunAt?(0,G.jsxs)(`span`,{title:Kg(e.lastRunAt),children:[`last ran `,Wg(e.lastRunAt,i)]}):(0,G.jsx)(`span`,{children:`not run yet`}),e.lastResult?` · ${e.lastResult}`:``]}):null,f?null:(0,G.jsxs)(`div`,{className:`mt-0.5 text-xs text-fg-faint`,title:`Tasks that are paused or have finished are deleted 10 days after their last change`,"data-testid":`scheduled-row-deletes`,children:[e.nextRunAt===null?`Finished`:`Paused`,p?` — deleted automatically on ${Kg(p)}`:``]})]},e.id)})})]})})}var cR=5e3,lR=12;function uR(e){return Math.min(lR,Math.max(4,e))}var dR=(0,v.memo)(function({messages:e,onPick:t}){let[n,r]=(0,v.useState)(!1),i=(0,v.useRef)(null);return(0,v.useLayoutEffect)(()=>{let e=i.current;n&&e&&(e.scrollTop=e.scrollHeight)},[n]),e.length<2?null:(0,G.jsxs)(`div`,{className:`absolute right-2 top-1/2 z-10 -translate-y-1/2`,"data-testid":`user-message-rail`,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onFocus:()=>r(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||r(!1)},onKeyDown:e=>{e.key===`Escape`&&r(!1)},children:[(0,G.jsx)(`button`,{type:`button`,"aria-label":`Your messages in this chat`,"aria-haspopup":`true`,"aria-expanded":n,className:`flex flex-col items-end gap-1 p-1 text-fg opacity-70 hover:opacity-100 focus-visible:opacity-100`,onClick:()=>r(!0),"data-testid":`user-message-rail-handle`,children:Array.from({length:uR(e.length)},(e,t)=>(0,G.jsx)(`span`,{className:`block h-[2px] w-5 rounded-full bg-current`},t))}),n?(0,G.jsx)(`div`,{className:`absolute right-full top-1/2 -translate-y-1/2 pr-2`,"data-testid":`user-message-rail-bridge`,children:(0,G.jsx)(`div`,{ref:i,className:`max-h-[60vh] w-72 max-w-[70vw] overflow-y-auto rounded-md border border-border bg-surface p-1 shadow-md`,"data-testid":`user-message-rail-list`,children:e.map(e=>{let n=e.reachable!==!1,i=[e.at?Kg(e.at):null,e.label,n?null:`Too far back to jump to (more than ${cR.toLocaleString()} lines ago).`].filter(e=>e!==null).join(`
150
+ `),[t]);return(0,G.jsxs)(`pre`,{className:`lazy-block m-0 max-h-72 overflow-auto rounded-md border border-border bg-code-bg p-2 font-mono text-[12.5px] leading-relaxed`,children:[n.map((e,t)=>(0,G.jsxs)(`div`,{className:`bg-danger-soft text-danger`,children:[(0,G.jsx)(`span`,{className:`select-none pr-2 text-fg-faint`,children:`-`}),e]},`o${t}`)),r.map((e,t)=>(0,G.jsxs)(`div`,{className:`bg-ok-soft text-ok`,children:[(0,G.jsx)(`span`,{className:`select-none pr-2 text-fg-faint`,children:`+`}),e]},`n${t}`))]})}),TI=AM;function EI({name:e,input:t,inputJson:n,streaming:r}){if(!t)return n?(0,G.jsx)(iP,{code:n,language:`json`,maxHeight:`14rem`}):r?(0,G.jsx)(`div`,{className:`text-xs text-fg-faint`,children:`Receiving arguments…`}):null;switch(e){case`Bash`:case`PowerShell`:case`run_command`:{let n=SI(t.Description)??SI(t.description);return(0,G.jsxs)(`div`,{children:[n?(0,G.jsx)(`div`,{className:`mb-1 text-xs text-fg-muted`,children:n}):null,(0,G.jsx)(iP,{code:SI(t.CommandLine)??SI(t.command)??Xg(t),language:e===`PowerShell`?`powershell`:`bash`,maxHeight:`14rem`})]})}case`Edit`:case`replace_file_content`:case`multi_replace_file_content`:{let e=SI(t.TargetFile)??SI(t.file_path),n=SI(t.TargetContent)??SI(t.old_string)??``,r=SI(t.ReplacementContent)??SI(t.new_string)??``;return(0,G.jsxs)(`div`,{className:`space-y-1`,children:[e?(0,G.jsxs)(`div`,{className:`font-mono text-xs text-fg-muted`,children:[e,t.replace_all?` (replace all)`:``]}):null,(0,G.jsx)(wI,{oldText:n,newText:r})]})}case`Write`:case`write_to_file`:{let e=SI(t.TargetFile)??SI(t.file_path),n=SI(t.CodeContent)??SI(t.content)??``;return(0,G.jsxs)(`div`,{children:[e?(0,G.jsx)(`div`,{className:`mb-1 font-mono text-xs text-fg-muted`,children:e}):null,(0,G.jsx)(iP,{code:n,language:TI(e),maxHeight:`18rem`})]})}case`Read`:case`view_file`:{let e=SI(t.AbsolutePath)??SI(t.file_path)??SI(t.path)??``,n=[t.offset===void 0?null:`offset ${String(t.offset)}`,t.limit===void 0?null:`limit ${String(t.limit)}`,t.StartLine===void 0?null:`lines ${String(t.StartLine)}${t.EndLine===void 0?``:`-${String(t.EndLine)}`}`].filter(Boolean).join(`, `);return(0,G.jsxs)(`div`,{className:`font-mono text-xs text-fg-muted`,children:[e,n?` (${n})`:``]})}default:return(0,G.jsx)(iP,{code:Xg(t),language:`json`,maxHeight:`14rem`})}}function DI({blocks:e,toolName:t,input:n,onOpenPicture:r,hideImages:i}){return(0,G.jsx)(`div`,{className:`space-y-1`,children:e.map((e,a)=>{if(e.type===`image`&&i)return null;if(e.type===`image`)return(0,G.jsx)(bI,{block:e,toolName:t,input:n,onOpen:r},a);let o=e.type===`text`?e.text??``:`[${e.type}]`;return(0,G.jsx)(`pre`,{className:`pre-wrap m-0 font-mono text-[12.5px] leading-relaxed`,children:o},a)})})}var OI=`Code snippet`;function kI(e){return e===`unknown`?OI:e===`view_file`?`View file`:e===`write_to_file`?`Write`:e===`replace_file_content`||e===`multi_replace_file_content`?`Edit`:e===`run_command`?`Run command`:e===`grep_search`?`Grep`:e===`find_by_name`?`Find`:e===`list_dir`?`List directory`:e===Cp?wp:e===Dp?Op:e===Au?ju:e}var AI={streaming:`preparing`,pending:`needs approval`,running:`running`,done:`done`,error:`error`,denied:`denied`,skipped:`skipped`,cancelled:`cancelled`};function jI({status:e}){switch(e){case`streaming`:case`running`:return(0,G.jsx)(J.Spinner,{className:`w-3.5 h-3.5 text-accent`});case`pending`:return(0,G.jsx)(J.Shield,{className:`w-3.5 h-3.5 text-warn`});case`done`:return(0,G.jsx)(J.Check,{className:`w-3.5 h-3.5 text-ok`});case`error`:case`denied`:return(0,G.jsx)(J.X,{className:`w-3.5 h-3.5 text-danger`});case`skipped`:case`cancelled`:return(0,G.jsx)(J.X,{className:`w-3.5 h-3.5 text-fg-faint`})}}function MI(e){for(let t of e)if(t.item.kind===`permission`&&t.item.status===`pending`||t.children.length>0&&MI(t.children))return!0;return!1}var NI=(0,v.memo)(function({node:e,renderChildren:t}){let n=e.item,r=n.status===`error`||n.status===`denied`,[i,a]=(0,v.useState)(null),o=AF(n.id,a),s=MI(e.children),c=NP.has(n.name)&&(n.status===`done`||n.status===`cancelled`),l=n.name===`Read`||n.name===`view_file`,u=(0,v.useMemo)(()=>{if(!l||!n.input)return null;let e=SI(n.input.AbsolutePath)??SI(n.input.file_path)??SI(n.input.path);return e&&e.trim()?e.trim():null},[l,n.input]),d=(0,v.useMemo)(()=>u?Hp(u):null,[u]),f=(0,v.useContext)(HN),p=(0,v.useMemo)(()=>{if(!u)return null;if(/^[A-Za-z]:[\\/]/.test(u)||u.startsWith(`/`))return u;if(f.cwd){let e=f.platform===`win32`||f.cwd.includes(`\\`)?`\\`:`/`;return`${f.cwd.replace(/[\\/]+$/,``)}${e}${u}`}return u},[u,f.cwd,f.platform]),m=s||o||(i??(r||n.status===`pending`||e.children.length>0&&!c)),h=(0,v.useMemo)(()=>CI(n.name,n.input),[n.name,n.input]),g=(0,v.useMemo)(()=>l?oI(n.result):null,[l,n.result]),_=yI(g,lI(n.name,n.input,g?.mediaType??`image/png`)),{onClick:y,...b}=_.handlers,x=(0,v.useMemo)(()=>n.name===Au?oI(n.result):null,[n.name,n.result]),S=(0,v.useMemo)(()=>x?sI(x):``,[x]),C=(0,v.useMemo)(()=>x?uI(n.result,x.mediaType):``,[x,n.result]),[w,T]=(0,v.useState)(null),E=(0,v.useMemo)(()=>m?Vg(n.result):``,[m,n.result]),D=n.result!==null&&!n.result.isError&&(typeof n.result.content==`string`&&/^Async agent launched/i.test(n.result.content.trimStart())||n.result.structured?.status===`async_launched`),O=n.durationMs===null?n.elapsedSec!==null&&!n.result?Hg(n.elapsedSec*1e3):``:Hg(n.durationMs);return(0,G.jsxs)(`div`,{"data-testid":`tool-${n.toolUseId}`,className:W(`my-1.5 overflow-hidden rounded-lg border bg-surface text-sm`,r?`border-danger/50`:n.status===`pending`?`border-warn/60`:`border-border`),children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":m,onClick:()=>{y?.(),a(s?null:!m)},...b,className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left hover:bg-surface-2`,children:[(0,G.jsx)(jI,{status:n.status}),(0,G.jsx)(J.Tool,{className:`w-3.5 h-3.5 text-fg-faint`}),(0,G.jsx)(`span`,{className:`font-medium`,children:kI(n.name)}),h?(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-fg-muted`,children:h}):(0,G.jsx)(`span`,{className:`flex-1`}),O?(0,G.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:O}):null,(0,G.jsx)(Q,{tone:r?`danger`:n.status===`pending`?`warn`:n.status===`done`?`ok`:`neutral`,children:AI[n.status]}),(0,G.jsx)(J.Chevron,{open:m,className:`w-3.5 h-3.5 text-fg-faint`})]}),x&&!r?(0,G.jsxs)(`div`,{className:`border-t border-border px-2.5 py-2`,"data-testid":`tool-generated`,children:[x.base64===null?(0,G.jsx)(`img`,{src:S,alt:C,className:`block rounded border border-border object-contain`,style:{maxWidth:280,maxHeight:280}}):(0,G.jsx)(`button`,{type:`button`,"aria-label":`Open ${C} in the viewer`,title:`${C} — open in the viewer`,"data-testid":`tool-generated-picture`,onClick:()=>T({name:C,mediaType:x.mediaType,base64:x.base64}),className:`block cursor-zoom-in rounded p-0 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,G.jsx)(`img`,{src:S,alt:C,draggable:!1,className:`block rounded border border-border object-contain`,style:{maxWidth:280,maxHeight:280}})}),(0,G.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-muted`,title:C,children:C})]}):null,m?(0,G.jsxs)(`div`,{className:`space-y-2 border-t border-border px-2.5 py-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1 text-[11px] uppercase tracking-wide text-fg-faint`,children:`Input`}),(0,G.jsx)(EI,{name:n.name,input:n.input,inputJson:n.inputJson,streaming:n.status===`streaming`})]}),e.children.length>0?(0,G.jsxs)(`div`,{className:`border-l-2 border-think/40 pl-2`,children:[(0,G.jsx)(`div`,{className:`mb-1 text-[11px] uppercase tracking-wide text-think`,children:`Subagent`}),t(e.children)]}):null,n.result&&D?(0,G.jsx)(`div`,{className:`text-xs text-fg-faint`,"data-testid":`tool-launch-note`,children:`Launched in the background — the chat is told when it finishes.`}):n.result?(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`mb-1 flex items-center justify-between text-[11px] uppercase tracking-wide text-fg-faint`,children:[(0,G.jsx)(`span`,{children:n.result.isError?`Error`:`Result`}),E?(0,G.jsxs)(`span`,{className:`normal-case`,children:[E.length.toLocaleString(),` chars`]}):null]}),d&&!n.result.isError&&f.grant&&f.sessionId&&p&&(d.kind===`audio`||d.kind===`video`||d.kind===`image`&&!g)?(0,G.jsx)(`div`,{className:`mb-2`,"data-testid":`tool-inline-media`,children:(0,G.jsx)(QN,{sessionId:f.sessionId,path:p,kind:d.kind,grant:f.grant})}):null,(0,G.jsx)(`div`,{className:W(`lazy-block max-h-72 overflow-auto rounded-md border p-2`,n.result.isError?`border-danger/40 bg-danger-soft text-danger`:`border-border bg-code-bg`),children:typeof n.result.content==`string`?(0,G.jsx)(`pre`,{className:`pre-wrap m-0 font-mono text-[12.5px] leading-relaxed`,children:n.result.content.replace(/<\/?tool_use_error>/g,``).trim()||`(empty)`}):(0,G.jsx)(DI,{blocks:n.result.content,toolName:n.name,input:n.input,onOpenPicture:T,hideImages:x!==null})})]}):n.status===`cancelled`?(0,G.jsx)(`div`,{className:`text-xs text-fg-faint`,children:`No result (turn ended before the tool finished).`}):null]}):null,_.popup,w?(0,G.jsx)(xI,{picture:w,onClose:()=>T(null)}):null]})}),PI=(0,v.memo)(function({item:e}){let[t,n]=(0,v.useState)(null),r=AF(e.id,n)||(t??e.streaming),i=TF(e.text,e.streaming),a=FI(i);return!e.streaming&&(e.redacted||a===0)?(0,G.jsxs)(`div`,{className:`my-1.5 flex items-center gap-2 rounded-lg border border-think/20 bg-think-soft/20 px-2.5 py-1.5 text-sm text-think/70`,"data-testid":`thought-empty`,title:e.redacted?`The provider hid this thought: only an encrypted copy came back, which the model reads and nobody else can.`:`The model thought here, but its provider sent no text for it — only a signature. There is nothing to show.`,children:[(0,G.jsx)(J.Brain,{className:`w-3.5 h-3.5`}),(0,G.jsx)(`span`,{className:`font-medium`,children:e.redacted?`Redacted thinking`:`Thought`}),(0,G.jsx)(`span`,{className:`text-xs opacity-70`,children:e.redacted?`hidden`:`empty`})]}):(0,G.jsxs)(`div`,{className:`my-1.5 rounded-lg border border-think/30 bg-think-soft/40 text-sm`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>n(!r),className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-think`,children:[e.streaming?(0,G.jsx)(J.Spinner,{className:`w-3.5 h-3.5`}):(0,G.jsx)(J.Brain,{className:`w-3.5 h-3.5`}),(0,G.jsx)(`span`,{className:`font-medium`,children:e.redacted?`Redacted thinking`:e.streaming?`Thinking…`:`Thought`}),a?(0,G.jsxs)(`span`,{className:`text-xs opacity-70`,"data-testid":`thought-words`,children:[a.toLocaleString(`en-US`),` `,a===1?`word`:`words`]}):null,(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(J.Chevron,{open:r,className:`w-3.5 h-3.5 opacity-70`})]}),r&&!e.redacted?(0,G.jsx)(`div`,{className:W(`border-t border-think/20 px-3 py-2 text-fg-muted`,e.streaming&&`caret`),children:e.streaming?(0,G.jsx)(`div`,{className:`pre-wrap`,"data-testid":`thinking-stream`,children:i}):(0,G.jsx)(dP,{text:e.text})}):null]})});function FI(e){let t=0,n=!1;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i===32||i===10||i===13||i===9?n=!1:n||(n=!0,t++)}return t}function II(e){if(!e)return!1;if(e.tagName===`TEXTAREA`)return!0;if(e.tagName===`INPUT`){let t=(e.type||`text`).toLowerCase();return![`button`,`checkbox`,`radio`,`submit`,`reset`,`range`,`color`,`file`].includes(t)}return e.isContentEditable===!0}function LI(e){!e||typeof document>`u`||II(document.activeElement)||e.querySelector(`[data-autofocus]`)?.focus()}function RI(e){if(!e)return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e instanceof HTMLElement&&e.isContentEditable}function zI(e,t,n){if(!e||!n||n.querySelector(`[role="dialog"][aria-modal="true"]`))return!1;let r=t instanceof Element?t:null;if(r&&r.closest(`[data-keep-escape]`))return!1;let i=BI(e);if(i!==null&&r&&r!==n.body){let e=BI(r);if(e!==null&&e!==i)return!1}if(r&&RI(r)&&!e.contains(r)&&r.closest(`[data-testid="composer"]`)===null)return!1;let a=Array.from(n.querySelectorAll(`[data-permission-pending="true"]`)).find(e=>i===null||BI(e)===i);return a===void 0||a===e}function BI(e){return e.closest(`[data-chat-group]`)?.getAttribute(`data-chat-group`)??e.closest(`[data-editor-group]`)?.getAttribute(`data-editor-group`)??null}var VI=(0,v.memo)(function({item:e,agentName:t}){let n=e.request,[r,i]=(0,v.useState)(!1),a=e.status===`allowed`,o=(0,v.useMemo)(()=>zp(n.toolName,n.input,110),[n]),s=n.agentId?t??`background agent`:null;if(n.toolName===`AskUserQuestion`){let e=Ll(n.input).length;return(0,G.jsxs)(`div`,{className:`my-1 flex items-center gap-2 px-1 py-0.5 text-xs text-fg-faint`,children:[a?(0,G.jsx)(J.Check,{className:`w-3 h-3 shrink-0 text-ok`}):(0,G.jsx)(J.X,{className:`w-3 h-3 shrink-0`}),(0,G.jsx)(`span`,{"data-testid":`permission-${n.requestId}`,children:zl({outcome:a?`answered`:`dismissed`,questions:e})}),s?(0,G.jsx)(`span`,{title:n.agentId??void 0,className:`shrink-0`,children:(0,G.jsx)(Q,{tone:`think`,children:s})}):null]})}let c=xS(n);return(0,G.jsxs)(`div`,{className:`my-1 text-xs text-fg-faint`,"data-testid":`permission-${n.requestId}`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(e=>!e),className:`flex w-full min-w-0 items-center gap-2 rounded px-1 py-0.5 text-left hover:bg-surface-2`,children:[a?(0,G.jsx)(J.Check,{className:`w-3 h-3 shrink-0 text-ok`}):(0,G.jsx)(J.X,{className:`w-3 h-3 shrink-0 text-danger`}),(0,G.jsxs)(`span`,{className:`shrink-0`,"data-testid":c?`connector-settled`:void 0,children:[c?SS(c,a):`${a?`Allowed`:`Denied`} ${n.displayName??n.toolName}`,e.resolvedBy===`auto`?` (automatically)`:e.resolvedBy&&e.resolvedBy!==`local`?` (by ${e.resolvedBy})`:``]}),o?(0,G.jsx)(`span`,{className:`min-w-0 truncate font-mono text-fg-muted`,"data-testid":`permission-summary`,children:o}):null,s?(0,G.jsx)(`span`,{title:n.agentId??void 0,className:`shrink-0`,children:(0,G.jsx)(Q,{tone:`think`,children:s})}):null,(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(J.Chevron,{open:r,className:`w-3 h-3 shrink-0`})]}),r?(0,G.jsx)(`div`,{className:`ml-5 mt-1`,children:(0,G.jsx)(EI,{name:n.toolName,input:n.input})}):null]})});function HI({items:e,agentNameOf:t}){let[n,r]=(0,v.useState)(!1),i=AF((0,v.useMemo)(()=>e.map(e=>e.id),[e]),r),{allowed:a,denied:o,tools:s,who:c}=(0,v.useMemo)(()=>{let n=e.filter(e=>e.status===`allowed`).length,r=new Map,i=new Set;for(let n of e){let e=xS(n.request),a=e?`${e.tool} (${e.vendor})`:n.request.displayName??n.request.toolName;r.set(a,(r.get(a)??0)+1),n.request.agentId&&i.add(t(n.request.agentId)??`background agent`)}return{allowed:n,denied:e.length-n,tools:[...r.entries()].sort((e,t)=>t[1]-e[1]).map(([e,t])=>t>1?`${e} ×${t}`:e).join(`, `),who:[...i]}},[e,t]);return(0,G.jsxs)(`div`,{className:`my-1 text-xs text-fg-faint`,"data-testid":`permission-run`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":n||i,onClick:()=>r(e=>!e),className:`flex w-full min-w-0 items-center gap-2 rounded px-1 py-0.5 text-left hover:bg-surface-2`,children:[o===0?(0,G.jsx)(J.Check,{className:`w-3 h-3 shrink-0 text-ok`}):(0,G.jsx)(J.X,{className:`w-3 h-3 shrink-0 text-danger`}),(0,G.jsxs)(`span`,{className:`shrink-0`,children:[a>0?`Allowed ${a}`:``,a>0&&o>0?` · `:``,o>0?`Denied ${o}`:``]}),(0,G.jsx)(`span`,{className:`min-w-0 truncate text-fg-muted`,"data-testid":`permission-run-tools`,children:s}),c.length>0?(0,G.jsx)(`span`,{className:`shrink-0`,children:(0,G.jsx)(Q,{tone:`think`,children:c.length===1?c[0]:`${c.length} agents`})}):null,(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(J.Chevron,{open:n||i,className:`w-3 h-3 shrink-0`})]}),n||i?(0,G.jsx)(`div`,{className:`ml-3`,children:e.map(e=>(0,G.jsx)(VI,{item:e,agentName:e.request.agentId?t(e.request.agentId):null},e.id))}):null]})}function UI({item:e,onDecide:t,stackIndex:n,agentName:r}){let i=e.request,[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(``),l=i.title??`Allow ${i.displayName??i.toolName}?`,u=(0,v.useRef)(t);u.current=t;let d=(0,v.useRef)(null),f=e.status===`pending`;if((0,v.useEffect)(()=>{if(f&&typeof document<`u`){let e=e=>{e.key===`Escape`&&zI(d.current,e.target,document)&&(e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation(),u.current({behavior:`deny`}))};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)}},[f]),(0,v.useEffect)(()=>{f&&LI(d.current)},[f]),e.status!==`pending`)return(0,G.jsx)(VI,{item:e,agentName:r??null});if(i.toolName===`AskUserQuestion`)return(0,G.jsx)(cF,{item:e,onDecide:t,cardRef:d,...n===void 0?{}:{stackIndex:n}});let p=Ql(i);if(p)return(0,G.jsx)(lF,{input:p,requestId:i.requestId,onDecide:t,cardRef:d});let m=xS(i);if(m)return(0,G.jsx)(pF,{input:m,requestId:i.requestId,onDecide:t,cardRef:d});let h=jp(i);if(h)return(0,G.jsx)(xF,{input:h,requestId:i.requestId,onDecide:t,cardRef:d});let g=Tp(i);return g?(0,G.jsx)(mF,{input:g,requestId:i.requestId,onDecide:t,cardRef:d}):(0,G.jsxs)(`div`,{ref:d,className:`my-2 rounded-lg border border-warn/60 bg-warn-soft/40 p-3 text-sm shadow-sm`,role:`group`,"aria-label":`Permission request`,"data-permission-pending":`true`,"data-testid":`permission-${i.requestId}`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(J.Shield,{className:`mt-0.5 w-4 h-4 text-warn`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-semibold`,children:l}),(0,G.jsx)(Q,{tone:`warn`,children:i.toolName}),i.agentId?(0,G.jsx)(Q,{tone:`think`,children:`subagent`}):null]}),i.description?(0,G.jsx)(`div`,{className:`mt-0.5 text-fg-muted`,children:i.description}):null,i.decisionReason?(0,G.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-faint`,children:i.decisionReason}):null,i.blockedPath?(0,G.jsxs)(`div`,{className:`mt-0.5 font-mono text-xs text-danger`,children:[`Blocked path: `,i.blockedPath]}):null]})]}),(0,G.jsx)(`div`,{className:`mt-2`,children:(0,G.jsx)(EI,{name:i.toolName,input:i.input})}),a?(0,G.jsx)(`div`,{className:`mt-2`,children:(0,G.jsx)(`input`,{className:Z,placeholder:`Optional: tell the agent why (sent as the tool result)`,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&t(s.trim()?{behavior:`deny`,message:s.trim()}:{behavior:`deny`})}})}):null,(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(Y,{variant:`inverse`,onClick:()=>t({behavior:`allow`}),"data-autofocus":!0,children:[(0,G.jsx)(J.Check,{className:`w-3.5 h-3.5`}),` Allow`]}),(0,G.jsx)(Y,{variant:`secondary`,title:`Allow and remember this rule for the session/project`,onClick:()=>t({behavior:`allow`,remember:!0}),children:`Allow always`}),a?(0,G.jsx)(Y,{variant:`secondary`,onClick:()=>t(s.trim()?{behavior:`deny`,message:s.trim()}:{behavior:`deny`}),children:`Confirm deny`}):(0,G.jsxs)(Y,{variant:`ghost`,onClick:()=>o(!0),children:[(0,G.jsx)(J.X,{className:`w-3.5 h-3.5`}),` Deny`]}),(0,G.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`Enter = allow · Esc = deny`})]})]})}var WI=6e4,GI=1e4;function KI(e,t=GI,n=300){if(e.length>=t)return!0;let r=1;for(let t=0;t<e.length;t++)if(e.charCodeAt(t)===10&&(r++,r>=n))return!0;return!1}function qI(e){return Math.ceil(Math.max(0,e)/3)*4}function JI(e,t){return t?Math.min(e.size,WI):qI(e.size)}function YI(e){return e>=1048576?`${(e/1048576).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${Math.max(0,Math.round(e))} B`}function XI(e,t={}){let n=t.budget??6291456,r=t.isText??(()=>!1),i=Math.max(0,t.usedBytes??0),a=[],o=[],s=0;for(let t of e){let e=JI(t,r(t));if(e>n){o.push({name:t.name,reason:`too large — ${YI(t.size)} becomes ${YI(e)} once encoded (limit ${YI(n)})`});continue}if(i+e>n){o.push({name:t.name,reason:`would exceed the ${YI(n)} attachment budget — send the staged files first`});continue}i+=e,s+=e,a.push(t)}return{accepted:a,rejected:o,addedBytes:s}}var ZI=3e3;function QI(e,t,n){return e?.providerId!==`oonacode`||(n?.priceUsdMonthly??0)>0?null:t?.free===!0?`free`:`pool`}function $I(e){switch(e){case`free`:return`Waiting for a free-lane slot — free requests are paced, so the first reply can take a few seconds.`;case`pool`:return`Waiting for a slot on the OonaCode pool — the request is queued behind the provider’s rate limits.`;default:return null}}function eL(e,t,n=ZI){let[r,i]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{if(i(!1),!e)return;let t=setTimeout(()=>i(!0),n);return()=>clearTimeout(t)},[e,t,n]),r}function tL(e){let t=Math.floor(e/6e4);if(t<60)return`${Math.max(1,t)}m`;let n=Math.floor(t/60);if(n<24)return`${n}h ${t-n*60}m`;let r=Math.floor(n/24);return`${r}d ${n-r*24}h`}function nL(e){return e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e))}function rL(e){let{lastTurnEndedAt:t,now:n,ttlSec:r,contextTokens:i,running:a}=e;if(a||t===null||r===null||r<=0||i!==null&&i<1024)return null;let o=n-t;if(!Number.isFinite(o)||o<r*1e3)return null;let s=i===null?`the whole conversation`:`about ${nL(i)} tokens`;return`Idle ${tL(o)}. The prompt cache has likely expired, so your next message will re-cache ${s}.`}var iL=new Set([`Alt`,`AltGraph`,`Control`,`Shift`,`Meta`,`OS`,`CapsLock`]),aL=1500,oL=24;function sL(e){if(!e)return`none`;if(typeof document<`u`&&e===document.body)return`BODY`;let t=e.tagName??`?`,n=e.getAttribute?.(`data-testid`)??e.getAttribute?.(`aria-label`)??e.getAttribute?.(`role`),r=typeof e.className==`string`?e.className.split(/\s+/).filter(Boolean).slice(0,3):[];return`${t}${n?`[${n.slice(0,60)}]`:``}${r.length>0?`.${r.join(`.`)}`:``}`}function cL(e,t){let n=t.now??(()=>Date.now()),r=-1/0,i=-1/0,a=[],o=e=>{iL.has(e.key)||(r=n())},s=()=>{i=n()},c=()=>{let e=n();return a.filter(t=>e-t.t<=aL).map(e=>e.what)},l=a=>{let o=n();if(o-r>2e3||o-i<=1e3)return;let s=a.relatedTarget instanceof Element?a.relatedTarget:null,l=c();setTimeout(()=>{if(typeof document<`u`&&!document.hasFocus()||typeof document<`u`&&document.activeElement===e)return;let n=typeof document<`u`?document.activeElement:null;n&&n!==e&&n.closest?.(`[data-testid="composer"]`)||t.report({activeAfter:sL(typeof document<`u`?document.activeElement:null),relatedTarget:sL(s),boxConnected:e.isConnected,boxDisabled:e.disabled,recentlyAdded:l,sinceKeyMs:Math.round(o-r),unmounted:!1})},0)},u=null,d=t.root??(typeof document<`u`?document.body:null);return d&&typeof MutationObserver<`u`&&(u=new MutationObserver(e=>{let t=n();for(let n of e)for(let e of Array.from(n.addedNodes))e.nodeType===1&&(a.push({t,what:sL(e)}),a.length>oL&&a.shift())}),u.observe(d,{childList:!0,subtree:!0})),e.addEventListener(`keydown`,o),e.addEventListener(`blur`,l),typeof document<`u`&&document.addEventListener(`pointerdown`,s,!0),()=>{let a=n();typeof document<`u`&&document.activeElement===e&&a-r<=2e3&&a-i>1e3&&t.report({activeAfter:`unmounting`,relatedTarget:`none`,boxConnected:e.isConnected,boxDisabled:e.disabled,recentlyAdded:c(),sinceKeyMs:Math.round(a-r),unmounted:!0}),u?.disconnect(),e.removeEventListener(`keydown`,o),e.removeEventListener(`blur`,l),typeof document<`u`&&document.removeEventListener(`pointerdown`,s,!0)}}var lL=new Map;function uL(e){e===void 0?lL.clear():lL.delete(e)}function dL(e){let{text:t,chatId:n,disabled:r=!1,load:i,onPick:a}=e,o=Xp(t),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(null),[,d]=(0,v.useState)(0),f=(0,v.useRef)(null);(0,v.useEffect)(()=>{o===null&&c(!1)},[o]),(0,v.useEffect)(()=>{u(null)},[o,n]);let p=o!==null&&!s&&!r&&n!==null,m=n!==null&&!r&&(p||/^\/\S+\s/.test(t)),h=n===null?void 0:lL.get(n),g=h!==void 0&&Date.now()-h.at<6e4;(0,v.useEffect)(()=>{if(!m||n===null||g||f.current===n)return;f.current=n;let e=!0;return i(n).then(e=>{lL.set(n,{at:Date.now(),commands:e===null||e===`unsupported`?null:[...tm(e.commands)],unsupported:e===`unsupported`})}).catch(()=>{lL.set(n,{at:Date.now(),commands:null,unsupported:!1})}).finally(()=>{f.current===n&&(f.current=null),e&&d(e=>e+1)}),()=>{e=!1}},[m,n,g,i]);let _=h?.commands??null,{items:y,sections:b,best:x}=(0,v.useMemo)(()=>{if(!_||o===null)return{items:[],sections:[],best:0};let e=nm(_,o),t=cm(e),n=[],r=0;for(let e of am)t[e].length!==0&&(n.push({id:e,title:om[e],start:r,items:t[e]}),r+=t[e].length);let i=n.flatMap(e=>e.items),a=e[0];return{items:i,sections:n,best:o.length>0&&a?Math.max(i.indexOf(a),0):0}},[_,o]),S=(0,v.useMemo)(()=>_?rm(t,_):null,[_,t]),C=h===void 0?`loading`:h.unsupported?`unsupported`:h.commands===null?`error`:`ready`,w=p&&C!==`unsupported`,T=y.length===0?0:Math.min(l??x,y.length-1),E=(0,v.useCallback)(e=>`/${e.name} `,[]),D=(0,v.useCallback)(()=>c(!0),[]);return{open:w,status:C,query:o??``,items:y,sections:b,active:T,setActive:u,inArguments:S,onKeyDown:e=>{if(!w||e.nativeEvent.isComposing)return!1;if(e.key===`Escape`)return e.preventDefault(),c(!0),!0;if(y.length===0)return!1;if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;return u((T+t+y.length)%y.length),!0}let t=y[T];if(e.key===`Enter`&&!e.shiftKey||e.key===`Tab`&&!e.shiftKey){let n=o!==null&&(t.name.toLowerCase()===o.toLowerCase()||(t.aliases??[]).some(e=>e.toLowerCase()===o.toLowerCase()));return e.key===`Enter`&&n?!1:t.availability===`ok`?(e.preventDefault(),a(E(t)),!0):(e.preventDefault(),!0)}return!1},textFor:E,dismiss:D}}var fL=`slash-command-menu`,pL=e=>`slash-command-option-${e}`,mL=`The model may also use it on its own in this chat (switched on in the Skills menu)`,hL=`Picking or typing a skill runs it once, in this message, whatever the Skills menu says. The model is shown a skill on its own only when it is switched on in the Skills menu under the message box — then it costs its tokens on every message.`;function gL({menu:e,onPick:t,modelSkills:n=null}){let r=(0,v.useRef)(null);return(0,v.useEffect)(()=>{(r.current?.querySelector(`#${pL(e.active)}`))?.scrollIntoView?.({block:`nearest`})},[e.active,e.items]),e.open?(0,G.jsxs)(`div`,{className:`absolute bottom-full left-0 right-0 z-20 mb-1 overflow-hidden rounded-lg border border-border bg-surface shadow-lg`,"data-testid":`slash-menu`,children:[e.status===`loading`?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-xs text-fg-muted`,role:`status`,children:[(0,G.jsx)(J.Spinner,{className:`h-3.5 w-3.5 animate-spin`}),` Reading this chat’s commands…`]}):e.status===`error`?(0,G.jsx)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,role:`status`,children:`The host could not list this chat’s commands right now — type the command, it still runs.`}):e.items.length===0?(0,G.jsxs)(`div`,{className:`px-3 py-2 text-xs text-fg-muted`,role:`status`,"data-testid":`slash-empty`,children:[`No command or skill matches “/`,e.query,`” — Enter sends it to the model as a message.`]}):(0,G.jsx)(`ul`,{ref:r,id:fL,role:`listbox`,"aria-label":`Skills and commands`,className:`max-h-72 overflow-y-auto pb-1`,children:e.sections.map(r=>(0,G.jsx)(_L,{section:r,menu:e,onPick:t,modelSkills:n},r.id))}),(0,G.jsx)(`div`,{className:`hidden border-t border-border px-3 py-0.5 text-right text-[10px] text-fg-faint sm:block`,children:`↑↓ to move · Enter or Tab to pick · Esc to close`})]}):null}function _L({section:e,menu:t,onPick:n,modelSkills:r}){let i=`slash-section-${e.id}`,a=e=>e.modelSkill===void 0?null:(r??[]).includes(e.modelSkill),o=e.items.filter(e=>a(e)!==null),s=o.some(e=>a(e)===!0);return(0,G.jsxs)(`li`,{role:`presentation`,"data-testid":`slash-section`,"data-section":e.id,children:[(0,G.jsxs)(`div`,{id:i,className:`sticky top-0 z-10 flex items-baseline gap-2 border-b border-border bg-surface px-3 pb-0.5 pt-1.5 text-[11px]`,children:[(0,G.jsx)(`span`,{className:`font-semibold uppercase tracking-wide text-fg-muted`,"data-testid":`slash-section-title`,children:e.title}),e.id===`skills`?(0,G.jsx)(`span`,{className:`ml-auto flex min-w-0 items-center gap-1 truncate text-fg-faint`,title:hL,"data-testid":`slash-skills-note`,children:o.length===0?`Picking one runs it once`:s?(0,G.jsxs)(G.Fragment,{children:[`Picking one runs it once · `,(0,G.jsx)(J.Skill,{className:`h-3 w-3 shrink-0 text-accent`}),` `,`the model may also use it here`]}):`Picking one runs it once · the model is not shown these here`}):null]}),(0,G.jsx)(`ul`,{role:`group`,"aria-labelledby":i,children:e.items.map((r,i)=>{let o=e.start+i;return(0,G.jsx)(vL,{item:r,index:o,active:o===t.active,onHover:t.setActive,onPick:n,modelOn:a(r)},r.name)})})]})}var vL=(0,v.memo)(function({item:e,index:t,active:n,onHover:r,onPick:i,modelOn:a}){let o=e.availability!==`ok`,s=im(e.source),c=um(e.description);return(0,G.jsxs)(`li`,{id:pL(t),role:`option`,"aria-selected":n,"aria-disabled":o||void 0,"data-testid":`slash-item`,"data-name":e.name,"data-model-skill":a===null?void 0:a?`on`:`off`,title:e.description||void 0,className:W(`flex cursor-pointer flex-col gap-0.5 px-3 py-1.5 text-xs`,n?`bg-accent-soft`:`hover:bg-surface-2`,o&&`cursor-default opacity-60`),onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>r(t),onClick:()=>{o||i(e)},children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,G.jsxs)(`span`,{className:`shrink-0 font-mono font-medium text-fg`,children:[`/`,e.name]}),e.argumentHint?(0,G.jsx)(`span`,{className:`min-w-0 truncate font-mono text-fg-faint`,children:e.argumentHint}):null,(0,G.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[a===!0&&!o?(0,G.jsx)(`span`,{className:`text-accent`,title:mL,"aria-label":mL,"data-testid":`slash-model-state`,children:(0,G.jsx)(J.Skill,{className:`h-3 w-3`})}):null,s?(0,G.jsx)(`span`,{className:`rounded border border-border px-1 text-[10px] uppercase tracking-wide text-fg-muted`,children:s}):null]})]}),o?(0,G.jsxs)(`div`,{className:`text-fg-muted`,"data-testid":`slash-reason`,children:[`Not available here — `,e.reason]}):c?(0,G.jsx)(`div`,{className:`truncate text-fg-muted`,"data-testid":`slash-summary`,children:c}):null]})});function yL({item:e}){return e&&e.availability!==`ok`?(0,G.jsxs)(`div`,{className:`px-1 pt-0.5 text-[11px] text-warn`,"data-testid":`slash-hint`,children:[(0,G.jsxs)(`span`,{className:`font-mono`,children:[`/`,e.name]}),` is not available here — `,e.reason]}):!e||!e.argumentHint&&!e.note?null:(0,G.jsxs)(`div`,{className:`px-1 pt-0.5 text-[11px] text-fg-faint`,"data-testid":`slash-hint`,children:[(0,G.jsxs)(`span`,{className:`font-mono`,children:[`/`,e.name,` `,e.argumentHint]}),e.note?(0,G.jsxs)(`span`,{children:[` — `,e.note]}):null]})}var bL=`field-sizing-content w-auto max-w-full shrink-0 rounded-md border border-border bg-surface-2 py-0.5 pl-1.5 pr-1 text-xs text-fg hover:border-fg-faint focus:border-accent focus:outline-none disabled:opacity-50`,xL=[{value:`default`,label:`Ask (default)`},{value:`acceptEdits`,label:`Accept edits`},{value:`plan`,label:`Plan`},{value:`auto`,label:`Auto`},{value:`dontAsk`,label:`Don't ask`},{value:`bypassPermissions`,label:`Bypass permissions`}],SL=`Ask anything — build, fix, explain…`,CL=M;function wL(e){return new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error??Error(`read failed`)),r.onload=()=>{let e=String(r.result??``);t(e.slice(e.indexOf(`,`)+1))},r.readAsDataURL(e)})}function TL(e){return new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error??Error(`read failed`)),r.onload=()=>t(String(r.result??``)),r.readAsText(e)})}function EL(e){if(e.type.startsWith(`image/`))return`image`;if(e.type===`application/pdf`)return`document`;if(e.type.startsWith(`text/`))return`text`;if(e.type)return`path`;let t=MM(e.name);return t.kind===`image`?`image`:t.kind===`pdf`?`document`:t.kind===`audio`||t.kind===`video`?`path`:`text`}function DL(e){return e.map(e=>e.kind===`image`?{type:`image`,source:{type:`base64`,media_type:e.mediaType,data:e.data}}:e.kind===`document`?{type:`document`,source:{type:`base64`,media_type:e.mediaType||`application/pdf`,data:e.data}}:e.kind===`path`?{type:`text`,text:LF({name:e.name,mediaType:e.mediaType||`file`,sizeText:YI(e.size),path:e.path??e.name})}:{type:`text`,text:`Attached file ${e.name}:\n\n\`\`\`\n${e.data}\n\`\`\``})}function OL(){let{state:e,actions:t,dispatch:n,api:r}=K(),i=hb(),a=gb(),o=mb(),{sessionId:s,focused:c}=fb(),l=s?e.unsent[s]:void 0,[u,d]=(0,v.useState)(()=>l?.text??``),[f,p]=(0,v.useState)(()=>[...l?.attachments??[]]),[m,h]=(0,v.useState)(()=>[...l?.replies??[]]),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(CL),[x,S]=(0,v.useState)(!1),C=(0,v.useRef)(null),w=(0,v.useRef)(null),T=(0,v.useRef)(0),E=(0,v.useRef)(!0),[D,O]=(0,v.useState)(null),k=(0,v.useCallback)(e=>{if(e.kind===`path`){BF(e.path??``,t.toast);return}WF(e.kind===`text`?{name:e.name,mediaType:`text/plain`,base64:MF(e.data)}:{name:e.name,mediaType:e.mediaType||`application/pdf`,base64:e.data},t.toast)},[t]),A=(0,v.useRef)({text:u,attachments:f,replies:m});A.current={text:u,attachments:f,replies:m},(0,v.useEffect)(()=>(E.current=!0,()=>{E.current=!1}),[]);let j=(0,v.useRef)(o?.status??null);j.current=o?.status??null,(0,v.useEffect)(()=>{let e=C.current;if(e)return cL(e,{report:e=>t.reportDiagnostic(`message box lost the focus while typing`,{...e,chatStatus:j.current})})},[t]),(0,v.useEffect)(()=>{if(s)return()=>t.rememberUnsent(s,A.current)},[s,t]),(0,v.useEffect)(()=>{if(s)return wv(s,()=>A.current)},[s]),(0,v.useEffect)(()=>{l&&(d(e=>e.length===0?l.text:e),p(e=>e.length===0?[...l.attachments]:e),h(e=>e.length===0?[...l.replies??[]]:e))},[l]);let M=e.composerQuote,P=(0,v.useRef)(M?.seq??0);(0,v.useEffect)(()=>{!M||M.seq<=P.current||(P.current=M.seq,M.sessionId===s&&(h(e=>e.some(e=>e.quote===M.text)?e:[...e,{id:`reply-${M.seq}`,quote:M.text,preview:M.preview,itemId:M.itemId}]),C.current?.focus()))},[M,s]);let F=i?.effort??a?.effort??``;(0,v.useEffect)(()=>{_(F)},[s,F]);let re=o?.status===`running`||o?.status===`waiting_permission`,ie=e.connection.status===`open`,I=Kx(),L=qx(),R=!s||I||L!==null,z=fS(),ae=Ce(z.option),oe=(0,v.useMemo)(()=>{let e=Fm(z.option,z.modelId);return e.length===0?[]:F&&!e.includes(F)?[...e,F]:e},[z.option,z.modelId,F]),se=oe.length>0,ce=(0,v.useMemo)(()=>e.providers.find(e=>e.definition.id===z.providerId)?.definition,[e.providers,z.providerId]),le=I?`This session runs on a PC that is offline — read-only`:L?`${L} is no longer offered — pick another model to continue`:R?`Open a chat to start`:re?`Agent is working — a message sent now is handed to it and read at its next step (Esc to stop)`:SL;(0,v.useEffect)(()=>{let e=C.current;if(!e)return;let t=()=>{e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,240)}px`};if(t(),typeof ResizeObserver>`u`)return;let n=e.clientWidth,r=new ResizeObserver(()=>{e.clientWidth!==n&&(n=e.clientWidth,t())});return r.observe(e),()=>r.disconnect()},[u,le]);let ue=(0,v.useRef)(c);ue.current=c,(0,v.useEffect)(()=>{ue.current&&C.current?.focus()},[s]);let de=ne(a?.permissionMode?{permissionMode:a.permissionMode,posture:a.posture??null}:i);(0,v.useEffect)(()=>{b(ae?de:CL)},[ae,de,s]);let fe=Lm(z.providerId),pe=zm(z.providerId);(0,v.useEffect)(()=>{!a||!ae||!fe||zm(z.providerId).some(e=>e.id===de)||t.setSessionPosture(CL,s??void 0)},[a,ae,fe,z.providerId,de,s,t]);let me=(0,v.useMemo)(()=>f.reduce((e,t)=>e+t.data.length,0),[f]),he=(0,v.useRef)(me);he.current=me;let ge=(0,v.useCallback)(async(e,n={})=>{let o=Array.from(e);if(o.length===0)return;let c=XI(o,{usedBytes:he.current,isText:e=>{let t=EL(e);return t===`text`||t===`path`||t===`image`&&e.size>2097152}});for(let e of c.rejected)t.toast(`error`,`${e.name} was not attached: ${e.reason}`);let l=zF(),u=`this window cannot say where the file lives — type its full path into the message, or use the desktop app`,d=[],f=i?.cwd||(a?.projectDir??null);for(let e of c.accepted){let i=EL(e);if(i===`image`&&e.size>2097152&&(i=`path`),(i===`image`||i===`document`)&&ce&&z.modelId){let n=Ws(ce,z.modelId,[{type:i}]);if(n){t.toast(`error`,`${e.name||`File`} was not attached: ${n}`);continue}}if(i===`path`){let a=l?.(e)??null;if(!a&&(n.isPaste||i===`path`&&e.type?.startsWith(`image/`))&&r?.saveTmpFile)try{let t=await wL(e),n=await r.saveTmpFile({sessionId:s??null,cwd:f,name:e.name||`attachment`,mediaType:e.type||MM(e.name).mime||`application/octet-stream`,base64:t});n.ok&&n.path&&(a=n.path)}catch{}if(!a){t.toast(`error`,`${e.name||`File`} was not attached: ${u}`);continue}d.push({id:`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:e.name||`file`,mediaType:e.type||MM(e.name).mime||`application/octet-stream`,data:``,kind:i,path:a,size:e.size});continue}try{let a=i===`text`?(await TL(e)).slice(0,WI):await wL(e);if(i===`text`&&VM(a)){let i=l?.(e)??null;if(!i&&n.isPaste&&r?.saveTmpFile)try{let t=await wL(e),n=await r.saveTmpFile({sessionId:s??null,cwd:f,name:e.name||`file.bin`,mediaType:e.type||`application/octet-stream`,base64:t});n.ok&&n.path&&(i=n.path)}catch{}i?d.push({id:`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:e.name||`file`,mediaType:e.type||`application/octet-stream`,data:``,kind:`path`,path:i,size:e.size}):t.toast(`error`,`${e.name||`File`} was not attached: it is not text, and ${u}`);continue}let o=l?.(e)??null;if(!o&&i===`image`&&r?.saveTmpFile)try{let t=await r.saveTmpFile({sessionId:s??null,cwd:f,name:e.name||`image.png`,mediaType:e.type||`image/png`,base64:a});t.ok&&t.path&&(o=t.path)}catch{}d.push({id:`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:e.name||(i===`image`?`image`:`file`),mediaType:e.type||(i===`text`?`text/plain`:`application/octet-stream`),data:a,kind:i,path:o??void 0,size:e.size})}catch{t.toast(`error`,`${e.name||`File`} could not be read — nothing was attached`)}}d.length>0&&p(e=>[...e,...d])},[t,r,ce,z.modelId,a?.projectDir,i?.cwd,s]),_e=y===CL?null:ee(y),ve=(0,v.useCallback)(e=>{d(e);let t=C.current;t&&(t.focus(),requestAnimationFrame(()=>t.setSelectionRange(e.length,e.length)))},[]),ye=dL({text:u,chatId:s,disabled:R,load:t.listCommands,onPick:ve}),be=(0,v.useCallback)(()=>{let e=u.trim();if(!s||L!==null||!e&&f.length===0)return;let n=Zv(m.map(e=>e.quote),e||`Please look at the attached file(s).`),r=Qp(n,`app`);if(r){t.toast(`error`,$p(r));return}let i=f,a=m,o=DL(i),c={};g&&(c.effort=g),_e&&(c.permissionMode=_e,c.posture=y);let l=s;d(``),p([]),h([]),C.current?.focus(),t.sendPrompt(n,o,Object.keys(c).length>0?c:void 0,l??void 0).then(e=>{if(E.current){let e=document.activeElement;(!e||e===document.body)&&C.current?.focus()}if(!e){if(E.current){d(e=>e.length===0?u:e),p(e=>e.length===0?i:e),h(e=>e.length===0?a:e);return}t.rememberUnsent(l,{text:u,attachments:i,replies:a},!0)}})},[u,f,m,s,L,t,g,_e,y]),xe=e=>{ye.onKeyDown(e)||(e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing?(e.preventDefault(),be()):e.key===`Escape`&&re&&(e.preventDefault(),t.interrupt(s??void 0)))},Se=e=>{let n=Array.from(e.clipboardData?.files??[]);if(n.length>0){e.preventDefault(),ge(n,{isPaste:!0});return}let o=e.clipboardData?.getData(`text/plain`)??``;if(o&&KI(o)){e.preventDefault();let n=i?.cwd||(a?.projectDir??null),c=new TextEncoder().encode(o),l=MF(o),u=r?.saveTmpFile;if(u){(async()=>{try{let e=await u({sessionId:s??null,cwd:n,name:`pasted-text.txt`,mediaType:`text/plain`,base64:l});if(e.ok&&e.path){p(t=>[...t,{id:`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:`pasted-text.txt`,mediaType:`text/plain`,data:``,kind:`path`,path:e.path,size:c.byteLength}]),t.toast(`info`,`Large pasted text (${YI(c.byteLength)}) saved to ${e.path} and attached by path.`);return}}catch{}d(e=>e+o)})();return}}},we=e=>{e.preventDefault(),T.current=0,S(!1),e.dataTransfer?.files?.length&&ge(e.dataTransfer.files)},Te=e=>{e.dataTransfer?.types?.includes(`Files`)&&(T.current+=1,S(!0))},Ee=()=>{T.current=Math.max(0,T.current-1),T.current===0&&S(!1)},De=e=>{e.target.files&&ge(e.target.files),e.target.value=``},{pendingQuestions:Oe,pendingPermissions:ke}=(0,v.useMemo)(()=>{let e=[],t=[];for(let n of o?.items??[])n.kind===`permission`&&n.status===`pending`&&(n.request.toolName===`AskUserQuestion`?e.push(n):t.push(n));return{pendingQuestions:e,pendingPermissions:t}},[o?.items]),Ae=QI(i,z.option,e.plan),je=eL(o?.status===`running`,o?.items.length??0)&&Ae?$I(Ae):null,[Me,Ne]=(0,v.useState)(()=>Date.now());(0,v.useEffect)(()=>{let e=setInterval(()=>Ne(Date.now()),6e4);return()=>clearInterval(e)},[]);let B=(0,v.useMemo)(()=>{if(!o||!i)return null;let t=o.items,n=null;for(let e=t.length-1;e>=0;e--)if(t[e].kind===`result`){n=t[e];break}if(!n||n.kind!==`result`){if(t.length===0)return null;let n=e.providers.find(e=>e.definition.id===z.providerId)?.definition.capabilities.promptCacheTtlSec??null,r=Date.parse(i.updatedAt);return rL({lastTurnEndedAt:Number.isFinite(r)?r:null,now:Me,ttlSec:n,contextTokens:o.contextTokens,running:re})}let r=n.timestamp?Date.parse(n.timestamp):Date.parse(i.updatedAt),a=e.providers.find(e=>e.definition.id===z.providerId)?.definition.capabilities.promptCacheTtlSec??null;return rL({lastTurnEndedAt:Number.isFinite(r)?r:null,now:Me,ttlSec:a,contextTokens:o.contextTokens,running:re})},[o,i,e.providers,z.providerId,Me,re]);return(0,G.jsxs)(`div`,{className:`relative border-t border-border bg-surface px-3 py-2 sm:px-6`,onDrop:we,onDragOver:e=>e.preventDefault(),onDragEnter:Te,onDragLeave:Ee,"data-testid":`composer`,children:[x?(0,G.jsxs)(`div`,{className:`pointer-events-none absolute inset-1 z-10 flex items-center justify-center rounded-xl border-2 border-dashed border-accent bg-accent-soft/70 text-sm font-medium text-accent`,"data-testid":`drop-overlay`,children:[(0,G.jsx)(J.Upload,{className:`mr-2 w-4 h-4`}),` Drop files to attach`]}):null,(0,G.jsxs)(`div`,{className:`w-full`,children:[s&&e.toolInstalls[s]?(0,G.jsx)(fF,{frame:e.toolInstalls[s],onDismiss:()=>n({type:`tool_install_dismiss`,sessionId:s})}):null,ke.length>0?(0,G.jsx)(`div`,{className:`mb-2 max-h-[45vh] space-y-2 overflow-y-auto`,"data-testid":`composer-pending`,children:ke.map(e=>(0,G.jsx)(UI,{item:e,onDecide:n=>t.respondPermission(e.request.requestId,n,s??void 0)},e.id))}):null,Oe.map((e,n)=>(0,G.jsx)(UI,{item:e,stackIndex:n,onDecide:n=>t.respondPermission(e.request.requestId,n,s??void 0)},e.id)),B&&!je?(0,G.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 rounded-md bg-surface-2 px-2.5 py-1.5 text-[11px] text-fg-muted`,"data-testid":`idle-cache-hint`,children:[(0,G.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full bg-fg-faint`}),B]}):null,je?(0,G.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 rounded-md bg-surface-2 px-2.5 py-1.5 text-[11px] text-fg-muted`,"data-testid":`pacing-hint`,"data-lane":Ae??void 0,children:[(0,G.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-warn`}),je]}):null,!ie&&s?(0,G.jsx)(`div`,{className:`mb-2 text-xs text-fg-faint`,children:e.connection.status===`unauthorized`?`The host rejected this token.`:`Not connected to the host — messages will be sent over HTTP when possible.`}):null,m.length>0?(0,G.jsx)(`div`,{className:`mb-2 flex flex-col gap-1`,"data-testid":`reply-chips`,children:m.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border-l-2 border-accent bg-accent-soft/60 py-1 pl-2 pr-1 text-xs`,"data-testid":`reply-chip`,children:[(0,G.jsx)(J.Reply,{className:`h-3.5 w-3.5 shrink-0 text-accent`}),(0,G.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 truncate text-left text-fg-muted hover:text-fg`,title:`Go to the message this replies to`,disabled:!e.itemId||!s,onClick:()=>{e.itemId&&s&&t.jumpToItem(s,e.itemId)},"data-testid":`reply-chip-jump`,children:[(0,G.jsx)(`span`,{className:`text-fg`,children:`Reply to `}),e.preview]}),(0,G.jsx)(`button`,{type:`button`,"aria-label":`Remove this reply`,onClick:()=>h(t=>t.filter(t=>t.id!==e.id)),className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-fg-muted hover:text-danger`,"data-testid":`reply-chip-remove`,children:(0,G.jsx)(J.X,{className:`h-3 w-3`})})]},e.id))}):null,f.length>0?(0,G.jsxs)(`div`,{className:`mb-2 flex flex-wrap gap-2`,"data-testid":`attachments`,children:[f.map(e=>(0,G.jsxs)(`div`,{className:`relative`,children:[e.kind===`image`?(0,G.jsx)(`button`,{type:`button`,"aria-label":`View ${e.name}`,title:`View ${e.name}`,"data-testid":`attachment-thumb`,onClick:()=>O({name:e.name,mediaType:e.mediaType,base64:e.data}),className:`block cursor-zoom-in rounded p-0 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,G.jsx)(`img`,{src:`data:${e.mediaType};base64,${e.data}`,alt:e.name,className:`h-14 w-14 rounded border border-border object-cover`})}):(0,G.jsxs)(`button`,{type:`button`,"aria-label":`Open ${e.name}`,title:e.kind===`path`?`Open ${e.name} — ${e.path??``}`:`Open ${e.name} in its own program`,"data-testid":e.kind===`path`?`attachment-path`:`attachment-file`,onClick:()=>k(e),className:`flex h-14 min-w-[7rem] max-w-[12rem] flex-col justify-center rounded border border-border bg-surface-2 px-2 text-left text-[11px] hover:bg-surface-3 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium`,children:Yg(e.name,22)}),(0,G.jsx)(`span`,{className:`text-fg-faint`,children:e.kind===`document`?`PDF · ${Math.ceil(e.size/1024)} KB`:e.kind===`path`?`${e.mediaType.startsWith(`video/`)?`video`:e.mediaType.startsWith(`audio/`)?`audio`:`file`} · ${YI(e.size)} · path`:`text · ${Math.ceil(e.size/1024)} KB`})]}),(0,G.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,onClick:()=>p(t=>t.filter(t=>t.id!==e.id)),className:`absolute -right-1.5 -top-1.5 flex h-5 w-5 items-center justify-center rounded-full border border-border bg-surface text-fg-muted hover:text-danger`,children:(0,G.jsx)(J.X,{className:`w-3 h-3`})})]},e.id)),(0,G.jsx)(rI,{picture:D,onClose:()=>O(null),notify:t.toast})]}):null,L?(0,G.jsxs)(`p`,{className:`px-1 text-xs text-danger`,role:`status`,"data-testid":`model-withdrawn`,children:[L,` is no longer available. Pick another model below to continue this chat — its history stays.`]}):null,(0,G.jsxs)(`div`,{className:W(`relative flex flex-col gap-1 rounded-xl border bg-bg px-2 py-1.5`,R?`border-border opacity-60`:`border-border`),children:[(0,G.jsx)(gL,{menu:ye,onPick:e=>ve(ye.textFor(e)),modelSkills:(a?a.modelSkills:i?.modelSkills)??null}),(0,G.jsx)(`textarea`,{ref:C,"aria-label":`Message`,rows:1,value:u,"aria-controls":ye.open?fL:void 0,"aria-activedescendant":ye.open&&ye.items.length>0?pL(ye.active):void 0,disabled:R,placeholder:le,onChange:e=>d(e.target.value),onKeyDown:xe,onPaste:Se,className:`max-h-60 min-h-[2.25rem] w-full resize-none bg-transparent px-1 py-1.5 text-sm outline-none placeholder:text-fg-faint`}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-1.5 gap-y-1`,"data-testid":`composer-controls`,children:[(0,G.jsx)(`input`,{ref:w,type:`file`,multiple:!0,className:`hidden`,onChange:De,"data-testid":`file-input`}),(0,G.jsx)(X,{label:`Attach files or images`,disabled:R,onClick:()=>w.current?.click(),children:(0,G.jsx)(J.Upload,{className:`w-4 h-4`})}),(0,G.jsx)(dS,{disabled:!s||I}),(0,G.jsx)(_P,{disabled:R}),(0,G.jsx)(xP,{disabled:R}),(0,G.jsx)(jP,{disabled:R}),(0,G.jsx)(ZP,{}),(0,G.jsx)(tF,{}),(0,G.jsx)(nF,{}),i&&!I?(0,G.jsx)(X,{label:`Listen to this chat — a spoken summary`,"data-testid":`listen-button`,onClick:()=>t.openVoiceSummary(i.id),children:(0,G.jsx)(J.Speaker,{className:`w-4 h-4`})}):null,ae?(0,G.jsxs)(`select`,{"aria-label":`Agent`,"data-testid":`agent-picker`,className:bL,value:y,disabled:R,title:fe?Bm:void 0,onChange:e=>{let n=e.target.value;N(n)&&(b(n),t.setSessionPosture(n,s??void 0))},children:[pe.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.label},e.id)),pe.some(e=>e.id===y)?null:(0,G.jsx)(`option`,{value:y,disabled:!0,children:te(y)})]}):null,ae&&fe?(0,G.jsx)(`span`,{className:`inline-flex`,"data-testid":`agy-posture-note`,children:(0,G.jsx)(Db,{label:`the agent picker`,details:Bm})}):null,se?(0,G.jsxs)(`select`,{"aria-label":`Effort`,className:bL,value:g,disabled:R,onChange:e=>{let n=e.target.value;_(n),t.setSessionEffort(n||null,s??void 0)},children:[(0,G.jsx)(`option`,{value:``,children:`effort: default`}),oe.map(e=>(0,G.jsxs)(`option`,{value:e,children:[`effort: `,e]},e))]}):null,(0,G.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,"data-testid":`composer-actions`,children:[re?(0,G.jsxs)(Y,{variant:`danger`,size:`sm`,onClick:()=>void t.interrupt(s??void 0),title:`Interrupt (Esc)`,"aria-label":`Interrupt`,"data-testid":`stop-button`,children:[(0,G.jsx)(J.Stop,{className:`w-3.5 h-3.5`}),` Stop`]}):null,(0,G.jsxs)(Y,{variant:`primary`,size:`sm`,onMouseDown:e=>e.preventDefault(),onClick:be,disabled:R||!u.trim()&&f.length===0,"aria-label":re?`Queue message`:`Send`,title:re?`Queue this message — the agent reads it at its next step`:void 0,children:[(0,G.jsx)(J.Send,{className:`w-3.5 h-3.5`}),` `,re?`Queue`:`Send`]})]})]})]}),ye.open?null:(0,G.jsx)(yL,{item:ye.inArguments}),o&&o.totals.turns>0?(0,G.jsxs)(`div`,{className:`mt-1 text-right text-[11px] text-fg-faint`,children:[o.totals.turns,` turn`,o.totals.turns===1?``:`s`,` ·`,` `,i?.providerId===`oonacode`?Ru(i.poolCredits??0):Vu(Hu(e.providers.find(e=>e.definition.id===i?.providerId)?.definition))]}):null]})]})}function kL({name:e,state:t,behind:n,detail:r}){return(0,G.jsxs)(`div`,{"data-testid":`sync-side`,className:`min-w-0 flex-1 rounded-md border p-3 ${n?`border-warn bg-warn-soft/40`:`border-border bg-surface-2`}`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-sm font-medium`,children:[(0,G.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n?(0,G.jsx)(`span`,{className:`shrink-0 text-[11px] font-normal text-warn`,children:`behind`}):null]}),(0,G.jsx)(`div`,{className:`mt-1 text-[11px] text-fg-faint`,children:t.entryCount===null?`size not read`:`${t.entryCount} ${t.entryCount===1?`entry`:`entries`}`}),(0,G.jsx)(`div`,{className:`text-[11px] text-fg-faint`,title:Kg(t.lastEntryAt),children:t.lastEntryAt?`last message ${Wg(t.lastEntryAt)}`:`no timestamps`}),r?(0,G.jsx)(`div`,{className:`mt-1 break-all text-[11px] text-fg-faint`,children:r}):null]})}function AL({sessionId:e,sessionTitle:t,onClose:n}){let{actions:r}=K(),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(null),f=(0,v.useCallback)(async()=>{if(e){s(!0);try{a(await r.refreshSessionLink(e))}finally{s(!1)}}},[e,r]);(0,v.useEffect)(()=>{d(null),a(null),f()},[f]);let p=async()=>{if(e){l(!0);try{let t=await r.syncSessionDown(e);d(t),t&&a(t.link)}finally{l(!1)}}},m=i?.status===`ours-behind`,h=i?.status===`theirs-behind`;return(0,G.jsx)(jb,{open:e!==null,title:`Sync with the original chat`,onClose:n,footer:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{variant:`ghost`,onClick:n,children:`Close`}),(0,G.jsx)(Y,{variant:`primary`,busy:c,onClick:()=>void p(),disabled:!i?.canDownstream||o,"data-testid":`sync-down-confirm`,children:c?`Syncing…`:m?`Bring the new messages in`:`Check again`})]}),children:o&&!i?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-sm text-fg-muted`,children:[(0,G.jsx)(J.Spinner,{className:`w-4 h-4 spin`}),` Reading the original…`]}):i?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,G.jsx)(kL,{name:`OonaCode · ${t}`,state:i.ours,behind:m}),(0,G.jsx)(kL,{name:i.agentName,state:i.theirs,behind:h,detail:i.file})]}),(0,G.jsx)(`p`,{className:`text-sm text-fg-muted`,"data-testid":`sync-explanation`,children:m?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`strong`,{children:[i.agentName,` has newer messages.`]}),` Bringing them in adds them to this chat — nothing here is replaced or removed, and `,i.agentName,` is not written to.`]}):h?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`strong`,{children:`This chat is the newer one.`}),` Nothing is sent back: OonaCode never writes into your `,i.agentName,` install, so the copy over there stays as it is.`]}):(0,G.jsx)(G.Fragment,{children:`Both copies are at the same point. There is nothing to bring in.`})}),u?(0,G.jsx)(`div`,{className:`rounded-md border border-border bg-surface-2 p-3 text-sm`,"data-testid":`sync-result`,children:u.added>0?`${u.added} new ${u.added===1?`message`:`messages`} added to this chat.`:`Already up to date — nothing to bring in.`}):null]}):(0,G.jsx)(`p`,{className:`py-4 text-sm text-fg-muted`,children:`This PC no longer has the chat this one was imported from, so there is nothing to compare it with. Nothing is wrong with the chat itself — it stays exactly as it is.`})})}function jL({status:e}){return(0,G.jsx)(`span`,{className:W(`inline-block h-2 w-2 shrink-0 rounded-full`,e===`running`?`bg-accent animate-pulse`:e===`waiting_permission`?`bg-warn animate-pulse`:e===`error`?`bg-danger`:`bg-transparent`),"aria-hidden":!0})}function ML(e){return e.some(e=>e.status===`running`)?`running`:e.some(e=>e.status===`waiting_permission`)?`waiting_permission`:`idle`}function NL({sessions:e,testId:t}){let n=ML(e);if(n===`idle`)return null;let r=e.filter(e=>e.status===`running`||e.status===`waiting_permission`).length;return(0,G.jsx)(`span`,{className:`inline-flex shrink-0 items-center`,title:n===`running`?`${r} chat${r===1?``:`s`} working`:`${r} chat${r===1?``:`s`} waiting for permission`,"aria-label":`${r} active chat${r===1?``:`s`}`,"data-testid":t,children:(0,G.jsx)(jL,{status:n})})}var PL={idle:`idle`,running:`working`,waiting_permission:`waiting for permission`,error:`error`};function FL({label:e,value:t}){return t==null||t===``?null:(0,G.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,G.jsx)(`span`,{className:`shrink-0 text-fg-faint`,children:e}),(0,G.jsx)(`span`,{className:`min-w-0 truncate text-right text-fg`,title:t,children:t})]})}function IL({session:e,anchor:t}){let{state:n}=K(),r=n.providers.find(t=>t.definition.id===e.providerId)?.definition,i=r?.models.find(t=>t.id===e.model),a=e.projectId?n.vaultProjects.find(t=>t.id===e.projectId):void 0,o=e.startedBy?n.sessions.find(t=>t.id===e.startedBy):void 0,s=ne(e),c=ee(s)===e.permissionMode?te(s):xL.find(t=>t.value===e.permissionMode)?.label??e.permissionMode,l=Uu(e,Hu(r)),u=Math.max(8,Math.min(t.right+8,window.innerWidth-304-8)),d=Math.max(8,Math.min(t.top,window.innerHeight-360));return(0,Sb.createPortal)((0,G.jsxs)(`div`,{role:`tooltip`,"data-testid":`session-details-${e.id}`,className:`fixed z-50 max-h-[22rem] w-[19rem] overflow-y-auto rounded-lg border border-border bg-surface p-3 text-xs shadow-lg`,style:{left:u,top:d},children:[(0,G.jsx)(`div`,{className:`mb-2 truncate text-sm font-medium text-fg`,children:Qg(e)}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(FL,{label:`Model`,value:r&&e.model?`${e.model} · ${r.displayName}`:e.model}),(0,G.jsx)(FL,{label:`Effort`,value:e.effort??`default`}),(0,G.jsx)(FL,{label:`Mode`,value:c}),(0,G.jsx)(FL,{label:`Status`,value:PL[e.status]}),(0,G.jsx)(FL,{label:`Context window`,value:i?.contextWindow?`${Ug(i.contextWindow)} tokens`:null}),(0,G.jsx)(FL,{label:`Tokens`,value:`${Ug(e.inputTokens)} in · ${Ug(e.outputTokens)} out`}),(0,G.jsx)(FL,{label:`Cost`,value:l}),(0,G.jsx)(FL,{label:`Messages`,value:String(e.entryCount)}),(0,G.jsx)(FL,{label:`Folder`,value:e.projectDir??e.cwd}),(0,G.jsx)(FL,{label:`Project`,value:a?.name??null}),(0,G.jsx)(FL,{label:`Created`,value:Kg(e.createdAt)}),(0,G.jsx)(FL,{label:`Updated`,value:Kg(e.updatedAt)}),(0,G.jsx)(FL,{label:`Forked from`,value:e.forkedFrom}),(0,G.jsx)(FL,{label:`Started by`,value:o?Qg(o):e.startedBy}),(0,G.jsx)(FL,{label:`Temporary`,value:e.temporary?`yes — safe to delete when done`:null}),(0,G.jsx)(FL,{label:`Subagents`,value:e.hasSubagents?`yes`:null}),(0,G.jsx)(FL,{label:`Engine since`,value:Kg(e.engineSince)})]})]}),document.body)}function LL({link:e}){return e?.status===`ours-behind`?(0,G.jsxs)(`span`,{className:`ml-1 inline-flex shrink-0 items-center gap-0.5 rounded bg-warn-soft px-1 text-[10px] font-medium leading-4 text-warn`,title:`${e.agentName} has newer messages in this chat — right-click to bring them in`,"data-testid":`session-behind-${e.sessionId}`,"aria-label":`behind its original`,children:[(0,G.jsx)(J.ArrowDown,{className:`w-2.5 h-2.5`}),`behind`]}):null}function RL({session:e}){return!e.startedBy&&!e.temporary?null:(0,G.jsxs)(G.Fragment,{children:[e.startedBy?(0,G.jsx)(`span`,{className:`ml-1 shrink-0 text-fg-faint`,title:`Started by another chat — rest the pointer on the chat for its name`,"data-testid":`session-started-${e.id}`,children:`· started by a chat`}):null,e.temporary?(0,G.jsx)(`span`,{className:`ml-1 inline-flex shrink-0 items-center rounded bg-surface-2 px-1 text-[10px] font-medium leading-4 text-fg-muted`,title:`Temporary: the model marked this chat throwaway — delete it from its menu when done`,"data-testid":`session-temporary-${e.id}`,children:`temporary`}):null]})}var zL=(0,v.memo)(function({session:e,active:t,link:n,onOpen:r,onMenu:i,menuOpen:a=!1,projectName:o=null,kindIcon:s=!1,testIdPrefix:c=`session`,clock:l}){let u=Qg(e),d=t=>{let n=t.currentTarget.getBoundingClientRect();i(e,{x:n.left,y:n.bottom+2},f.current)},f=(0,v.useRef)(null),p=(0,v.useRef)(null),[m,h]=(0,v.useState)(null),g=(0,v.useCallback)(()=>{p.current!==null&&(clearTimeout(p.current),p.current=null),h(null)},[]),_=(0,v.useRef)(a);return _.current=a,(0,v.useEffect)(()=>{a&&g()},[a,g]),(0,v.useEffect)(()=>{if(m===null)return;let e=e=>{zx(e.target,f.current)&&g()};return window.addEventListener(`scroll`,e,!0),()=>window.removeEventListener(`scroll`,e,!0)},[m,g]),(0,v.useEffect)(()=>()=>{p.current!==null&&clearTimeout(p.current)},[]),(0,G.jsxs)(`div`,{ref:f,className:W(`group relative flex items-center rounded-md`,t?`bg-accent-soft`:`hover:bg-surface-2`),onMouseEnter:()=>{p.current!==null&&clearTimeout(p.current),!_.current&&(p.current=setTimeout(()=>{p.current=null,f.current&&!_.current&&h(f.current.getBoundingClientRect())},450))},onMouseLeave:g,onClick:g,onContextMenu:t=>{t.preventDefault(),g(),i(e,{x:t.clientX,y:t.clientY},f.current)},children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`flex min-w-0 flex-1 items-center gap-2 px-2 py-1.5 text-left`,"aria-current":t?`true`:void 0,"data-testid":`${c}-${e.id}`,children:[s?(0,G.jsx)(J.Chats,{className:`w-3.5 h-3.5 shrink-0 text-fg-faint`}):null,s&&e.status===`idle`?null:(0,G.jsx)(jL,{status:e.status}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-1`,children:(0,G.jsx)(`span`,{className:W(`min-w-0 flex-1 truncate text-sm`,t?`text-fg font-medium`:`text-fg`),children:u})}),(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center text-[11px] text-fg-faint`,children:[o?(0,G.jsxs)(`span`,{className:`mr-1 inline-flex min-w-0 max-w-[45%] shrink-0 items-center gap-0.5 text-project`,"data-testid":`session-project-${e.id}`,title:`Filed under ${o}`,children:[(0,G.jsx)(J.Project,{className:`w-2.5 h-2.5 shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,children:o}),(0,G.jsx)(`span`,{className:`text-fg-faint`,children:`·`})]}):null,(0,G.jsxs)(`span`,{className:`truncate`,children:[Wg(e.updatedAt,l),e.model?` · ${e.model}`:``,` · ${Jg(e.projectDir??e.cwd)}`]}),(0,G.jsx)(LL,{link:n}),(0,G.jsx)(RL,{session:e})]})]})]}),(0,G.jsx)(X,{label:`Chat 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":`${c}-menu-${e.id}`,onClick:e=>{e.stopPropagation(),d(e)},children:(0,G.jsx)(J.More,{className:`w-3.5 h-3.5`})}),m===null?null:(0,G.jsx)(IL,{session:e,anchor:m})]})});function BL({session:e,link:t,pinned:n,actions:r,onSync:i,onRename:a,onDelete:o}){let s=[];return t?.status===`ours-behind`&&s.push({key:`sync`,label:`Sync with ${t.agentName}…`,hint:`behind`,icon:(0,G.jsx)(J.Download,{className:`w-3.5 h-3.5`}),onSelect:i,testId:`session-menu-sync`}),s.push({key:`pin`,label:n?`Unpin`:`Pin to top`,icon:(0,G.jsx)(J.Pin,{className:`w-3.5 h-3.5`}),separated:s.length>0,onSelect:()=>r.setPinned(`chat`,e.id,!n),testId:`session-menu-pin`},{key:`project`,label:`Move to Project`,icon:(0,G.jsx)(J.Project,{className:`w-3.5 h-3.5`}),onSelect:()=>r.openAssignProject(e.id),testId:`session-menu-project`},...e.projectId?[{key:`project-settings`,label:`Project settings…`,icon:(0,G.jsx)(J.Settings,{className:`w-3.5 h-3.5`}),onSelect:()=>r.openProjectSettings(e.projectId),testId:`session-menu-project-settings`}]:[],{key:`folder`,label:`Change folder…`,icon:(0,G.jsx)(J.Folder,{className:`w-3.5 h-3.5`}),onSelect:()=>{r.selectSession(e.id),r.openDialog(`project`)},testId:`session-menu-folder`},{key:`details`,label:`Details`,icon:(0,G.jsx)(J.Info,{className:`w-3.5 h-3.5`}),onSelect:()=>{r.selectSession(e.id),r.savePrefs({sessionPanelOpen:!0})},testId:`session-menu-details`},{key:`listen`,label:`Listen to this chat…`,icon:(0,G.jsx)(J.Speaker,{className:`w-3.5 h-3.5`}),onSelect:()=>r.openVoiceSummary(e.id),testId:`session-menu-listen`},{key:`files`,label:`Files`,icon:(0,G.jsx)(J.File,{className:`w-3.5 h-3.5`}),onSelect:()=>{r.selectSession(e.id),r.savePrefs({explorerOpen:!0})},testId:`session-menu-files`},{key:`rename`,label:`Rename…`,icon:(0,G.jsx)(J.Edit,{className:`w-3.5 h-3.5`}),onSelect:a,testId:`session-menu-rename`},{key:`fork`,label:`Fork`,icon:(0,G.jsx)(J.Fork,{className:`w-3.5 h-3.5`}),onSelect:()=>void r.forkSession(e.id),testId:`session-menu-fork`},{key:`delete`,label:`Delete`,icon:(0,G.jsx)(J.Trash,{className:`w-3.5 h-3.5`}),danger:!0,separated:!0,onSelect:o,testId:`session-menu-delete`}),s}function VL(){let{state:e,actions:t}=K(),[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(null),u=(0,v.useCallback)((e,t,n)=>r({session:e,at:t,el:n}),[]),d=(0,v.useCallback)(()=>r(null),[]),f=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Vx,{open:n!==null,at:n?.at??{x:0,y:0},anchorEl:n?.el??null,label:`Chat actions`,onClose:d,items:n?BL({session:n.session,link:e.sessionLinks[n.session.id]??null,pinned:Tl(e.prefs.pinned,`chat`,n.session.id),actions:t,onSync:()=>a(n.session),onRename:()=>s(n.session),onDelete:()=>l(n.session)}):[]}),(0,G.jsx)(AL,{sessionId:i?.id??null,sessionTitle:i?Qg(i):``,onClose:()=>a(null)}),(0,G.jsx)(Fb,{open:c!==null,title:`Delete this chat?`,message:`It is deleted from this PC — the only place it is kept — so it is gone from every device. Your files, folder and code are not touched — only the chat is deleted.`,onConfirm:()=>{c&&t.deleteSession(c.id)},onClose:()=>l(null)}),(0,G.jsx)(Ib,{open:o!==null,title:`Rename chat`,label:`Session title`,initialValue:o?Qg(o):``,onSubmit:e=>{o&&e!==Qg(o)&&t.renameSession(o.id,e)},onClose:()=>s(null)})]});return{openMenu:u,menuFor:n?.session.id??null,element:f}}function HL({projectId:e,pinned:t,fold:n,actions:r}){let i=[];return e?i.push({key:`open`,label:`Open project`,icon:(0,G.jsx)(J.Project,{className:`w-3.5 h-3.5`}),onSelect:()=>r.openPage({kind:`project`,projectId:e}),testId:`project-menu-open`},{key:`settings`,label:`Project settings…`,icon:(0,G.jsx)(J.Settings,{className:`w-3.5 h-3.5`}),onSelect:()=>r.openProjectSettings(e),testId:`project-menu-settings`},{key:`new-chat`,label:`New chat in this project`,icon:(0,G.jsx)(J.Plus,{className:`w-3.5 h-3.5`}),onSelect:()=>r.newTab({projectId:e}),testId:`project-menu-new-chat`},{key:`pin`,label:t?`Unpin`:`Pin to top`,icon:(0,G.jsx)(J.Pin,{className:`w-3.5 h-3.5`}),onSelect:()=>r.setPinned(`project`,e,!t),testId:`project-menu-pin`}):i.push({key:`new-project`,label:`New project…`,icon:(0,G.jsx)(J.Project,{className:`w-3.5 h-3.5`}),onSelect:()=>r.openNewProject(),testId:`project-menu-new-project`}),n&&i.push({key:`fold`,label:n.collapsed?`Expand`:`Collapse`,icon:(0,G.jsx)(J.Chevron,{open:n.collapsed,className:`w-3.5 h-3.5`}),separated:!0,onSelect:n.onToggle,testId:`project-menu-fold`}),i}var UL=[{value:`activity`,label:`Recent activity`},{value:`name`,label:`Name`},{value:`created`,label:`Date created`}];function WL(e){let t=e.goal?.trim()??``;return t===``?(e.instructions??``).split(/\r?\n/).find(e=>e.trim()!==``)?.trim()??``:t}function GL(e,t){let n=new Map;for(let e of t){if(!e.projectId)continue;let t=n.get(e.projectId);t?t.push(e):n.set(e.projectId,[e])}return e.map(e=>{let t=n.get(e.id)??[],r=t.reduce((e,t)=>Math.max(e,t.mtime),-1/0),i=Date.parse(e.updatedAt);return{project:e,description:WL(e),chatCount:e.sessionCount??t.length,working:t.filter(e=>e.status===`running`||e.status===`waiting_permission`).length,lastActivity:Number.isFinite(r)?r:Number.isFinite(i)?i:0}})}function KL(e,t){let n=t.trim().toLowerCase();return n===``?e.slice():e.filter(({project:e})=>[e.name,e.goal??``,e.instructions??``].some(e=>e.toLowerCase().includes(n)))}var qL=(e,t)=>e.project.name.localeCompare(t.project.name,void 0,{sensitivity:`base`});function JL(e,t){let n=e.slice();return t===`name`?n.sort(qL):t===`created`?n.sort((e,t)=>(Date.parse(t.project.createdAt)||0)-(Date.parse(e.project.createdAt)||0)||qL(e,t)):n.sort((e,t)=>t.lastActivity-e.lastActivity||qL(e,t))}function YL(){let{state:e,actions:t}=K(),n=e.scheduledTasksVersion,[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(0);return(0,v.useEffect)(()=>{let e=!0;return t.listScheduledTasks({}).then(t=>{e&&i(t)}),()=>{e=!1}},[t,n,a]),{tasks:r,reload:(0,v.useCallback)(()=>o(e=>e+1),[])}}function XL(){let[e,t]=(0,v.useState)(()=>Date.now());return(0,v.useEffect)(()=>{let e=setInterval(()=>t(Date.now()),6e4);return()=>clearInterval(e)},[]),e}function ZL(e){return e===1?`1 chat`:`${e} chats`}function QL({card:e,pinned:t,actions:n,onDelete:r}){let i=e.chatCount;return[...HL({projectId:e.project.id,pinned:t,fold:null,actions:n}),{key:`delete`,label:`Delete project`,icon:(0,G.jsx)(J.Trash,{className:`w-3.5 h-3.5`}),danger:!0,separated:!0,disabled:i>0,...i>0?{hint:`${ZL(i)} in it`}:{},onSelect:r,testId:`project-card-delete`}]}function $L(){let{state:e,actions:t}=K(),n=XL(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(`activity`),[l,u]=(0,v.useState)(null),d=(0,v.useCallback)(()=>u(null),[]),[f,p]=(0,v.useState)(null),m=(0,v.useCallback)(()=>p(null),[]),[h,g]=(0,v.useState)(null),_=(0,v.useRef)(null),y=(0,v.useMemo)(()=>GL(e.vaultProjects,e.sessions),[e.vaultProjects,e.sessions]),b=(0,v.useMemo)(()=>JL(KL(y,r),s),[y,r,s]),x=e=>t.openPage({kind:`project`,projectId:e}),S=(e,t,n)=>p({card:e,at:t,el:n});return(0,G.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto bg-bg`,"data-testid":`projects-page`,children:[(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl px-4 py-6 sm:px-8`,children:[(0,G.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`h1`,{className:`mr-auto text-2xl font-semibold text-fg`,children:`Projects`}),a||r!==``?(0,G.jsx)(`input`,{ref:_,autoFocus:!0,"aria-label":`Search projects`,className:W(Z,`w-56`),placeholder:`Search projects`,value:r,onChange:e=>i(e.target.value),onBlur:()=>{r===``&&o(!1)},onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),i(``),o(!1))},"data-testid":`projects-search`}):null,(0,G.jsx)(X,{label:`Search projects — by name, goal and instructions`,onClick:()=>{o(!0),_.current?.focus()},"data-testid":`projects-search-toggle`,children:(0,G.jsx)(J.Search,{})}),(0,G.jsx)(X,{label:`Sort — ${UL.find(e=>e.value===s)?.label??``}`,"aria-haspopup":`menu`,onClick:e=>{let t=e.currentTarget.getBoundingClientRect();u({at:{x:t.left,y:t.bottom+2},el:e.currentTarget})},"data-testid":`projects-sort`,children:(0,G.jsx)(J.Sliders,{})}),(0,G.jsxs)(Y,{variant:`inverse`,onClick:()=>t.openNewProject(),"data-testid":`projects-new`,children:[(0,G.jsx)(J.Plus,{className:`w-3.5 h-3.5`}),`New project`]})]}),e.vaultProjects.length===0?(0,G.jsx)(Pb,{icon:(0,G.jsx)(J.Project,{className:`h-8 w-8`}),title:`No projects yet`,hint:`A project groups chats, whatever folders they run in, and gives every chat in it the same standing instructions, goal and memory. Projects live in your vault, so they follow you to every PC.`,action:(0,G.jsxs)(Y,{variant:`primary`,onClick:()=>t.openNewProject(),children:[(0,G.jsx)(J.Plus,{className:`w-3.5 h-3.5`}),`New project`]})}):b.length===0?(0,G.jsxs)(`p`,{className:`py-10 text-center text-sm text-fg-muted`,"data-testid":`projects-no-match`,children:[`No project matches “`,r.trim(),`”.`]}):(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2 2xl:grid-cols-3`,"data-testid":`projects-grid`,children:b.map(t=>(0,G.jsx)(eR,{card:t,clock:n,pinned:Tl(e.prefs.pinned,`project`,t.project.id),onOpen:x,onMenu:S},t.project.id))})]}),(0,G.jsx)(Vx,{open:l!==null,at:l?.at??{x:0,y:0},anchorEl:l?.el??null,label:`Sort projects`,testId:`projects-sort-menu`,onClose:d,items:UL.map(e=>({key:e.value,label:e.label,icon:e.value===s?(0,G.jsx)(J.Check,{className:`w-3.5 h-3.5 text-accent`}):(0,G.jsx)(`span`,{className:`w-3.5`}),onSelect:()=>c(e.value),testId:`projects-sort-${e.value}`}))}),(0,G.jsx)(Vx,{open:f!==null,at:f?.at??{x:0,y:0},anchorEl:f?.el??null,label:`Project actions`,testId:`project-card-menu`,onClose:m,items:f?QL({card:f.card,pinned:Tl(e.prefs.pinned,`project`,f.card.project.id),actions:t,onDelete:()=>g(f.card.project)}):[]}),(0,G.jsx)(Fb,{open:h!==null,title:h?`Delete ${h.name}?`:`Delete this project?`,message:`Its instructions, goal, memory and settings are removed from your vault, on every device. No chat is filed under it, so no chat changes.`,onConfirm:()=>{h&&t.deleteVaultProject(h.id)},onClose:()=>g(null)})]})}function eR({card:e,clock:t,pinned:n,onOpen:r,onMenu:i}){let{project:a}=e,o=(0,v.useRef)(null);return(0,G.jsxs)(`div`,{ref:o,className:`group relative rounded-xl border border-border bg-surface transition-colors hover:border-fg-faint hover:bg-surface-2/40`,"data-testid":`project-card-${a.id}`,onContextMenu:t=>{t.preventDefault(),o.current&&i(e,{x:t.clientX,y:t.clientY},o.current)},children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex h-full min-h-[7.5rem] w-full flex-col items-start gap-1 p-4 text-left`,onClick:()=>r(a.id),"data-testid":`project-card-open-${a.id}`,children:[(0,G.jsxs)(`span`,{className:`flex w-full min-w-0 items-center gap-2 pr-7`,children:[(0,G.jsx)(J.Project,{className:`w-4 h-4 shrink-0 text-project`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate text-[15px] font-medium text-fg`,children:a.name}),n?(0,G.jsx)(J.Pin,{className:`w-3 h-3 shrink-0 text-fg-faint`,title:`Pinned to the top of the session list`}):null]}),e.description?(0,G.jsx)(`span`,{className:`line-clamp-2 text-sm text-fg-muted`,"data-testid":`project-card-description`,children:e.description}):null,(0,G.jsxs)(`span`,{className:`mt-auto flex items-center gap-1.5 pt-2 text-xs text-fg-faint`,children:[e.working>0?(0,G.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full bg-accent animate-pulse`,title:`${e.working} working now`,"aria-hidden":!0}):null,(0,G.jsxs)(`span`,{"data-testid":`project-card-meta`,children:[ZL(e.chatCount),e.lastActivity>0?` · ${Gg(e.lastActivity,t)}`:``]})]})]}),(0,G.jsx)(X,{label:`Actions for ${a.name}`,className:`absolute right-2 top-2 p-1 opacity-60 group-hover:opacity-100 focus:opacity-100`,onClick:t=>{let n=t.currentTarget.getBoundingClientRect();o.current&&i(e,{x:n.left,y:n.bottom+2},o.current)},"data-testid":`project-card-menu-${a.id}`,children:(0,G.jsx)(J.More,{className:`w-4 h-4`})})]})}function tR({projectId:e}){let{state:t,actions:n}=K(),r=XL(),i=VL(),a=t.vaultProjects.find(t=>t.id===e)??null,o=(0,v.useMemo)(()=>t.sessions.filter(n=>n.projectId===e&&!t.remote.tabs[n.id]).sort((e,t)=>t.mtime-e.mtime),[t.sessions,t.remote.tabs,e]),s=(0,v.useCallback)(e=>n.selectSession(e),[n]),c=()=>n.openPage({kind:`projects`});if(!a)return(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto bg-bg`,"data-testid":`project-page`,children:(0,G.jsx)(Pb,{icon:(0,G.jsx)(J.Project,{className:`h-8 w-8`}),title:`This project is not here`,hint:`It was deleted, or your vault has not loaded it yet.`,action:(0,G.jsx)(Y,{onClick:c,"data-testid":`project-page-back`,children:`All projects`})})});let l=Tl(t.prefs.pinned,`project`,a.id),u=a.instructions.trim(),d=a.repositories??[],f=a.sessionCount??o.length;return(0,G.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto bg-bg`,"data-testid":`project-page`,children:[(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-4xl px-4 py-6 sm:px-8`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`mb-3 inline-flex items-center gap-1 text-xs text-fg-muted hover:text-fg`,onClick:c,"data-testid":`project-page-back`,children:[(0,G.jsx)(J.Chevron,{className:`w-3 h-3 rotate-180`}),`All projects`]}),(0,G.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(J.Project,{className:`w-5 h-5 shrink-0 text-project`}),(0,G.jsx)(`h1`,{className:`mr-auto min-w-0 truncate text-2xl font-semibold text-fg`,"data-testid":`project-page-name`,children:a.name}),(0,G.jsx)(X,{label:l?`Unpin from the session list`:`Pin to the top of the session list`,"aria-pressed":l,className:l?`text-accent`:void 0,onClick:()=>n.setPinned(`project`,a.id,!l),"data-testid":`project-page-pin`,children:(0,G.jsx)(J.Pin,{})}),(0,G.jsxs)(Y,{variant:`ghost`,onClick:()=>n.openProjectSettings(a.id),"data-testid":`project-page-settings`,children:[(0,G.jsx)(J.Settings,{className:`w-3.5 h-3.5`}),`Project settings`]}),(0,G.jsxs)(Y,{variant:`inverse`,onClick:()=>n.newTab({projectId:a.id}),"data-testid":`project-page-new-chat`,children:[(0,G.jsx)(J.Plus,{className:`w-3.5 h-3.5`}),`New chat in this project`]})]}),a.goal?.trim()?(0,G.jsx)(`p`,{className:`mb-4 text-sm text-fg-muted`,"data-testid":`project-page-goal`,children:a.goal.trim()}):null,(0,G.jsxs)(`section`,{className:`mb-5 rounded-xl border border-border bg-surface p-4`,children:[(0,G.jsx)(`h2`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-faint`,children:`Instructions`}),u?(0,G.jsx)(`div`,{className:`max-h-64 overflow-y-auto whitespace-pre-wrap break-words text-sm text-fg`,"data-testid":`project-page-instructions`,children:u}):(0,G.jsx)(`p`,{className:`text-sm text-fg-faint`,children:`None — chats here start with nothing extra.`}),d.length>0?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h2`,{className:`mb-1 mt-4 text-xs font-semibold uppercase tracking-wide text-fg-faint`,children:`Repositories`}),(0,G.jsx)(`ul`,{className:`space-y-0.5 text-sm`,"data-testid":`project-page-repositories`,children:d.map(e=>(0,G.jsx)(`li`,{className:`truncate font-mono text-xs text-fg-muted`,children:e},e))})]}):null]}),(0,G.jsxs)(`section`,{children:[(0,G.jsxs)(`h2`,{className:`mb-1 flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-fg-faint`,children:[`Chats`,(0,G.jsx)(`span`,{className:`font-normal normal-case`,"data-testid":`project-page-count`,children:f})]}),o.length===0?(0,G.jsx)(`p`,{className:`py-3 text-sm text-fg-faint`,"data-testid":`project-page-no-chats`,children:f>0?`${ZL(f)} filed here are older than the list this window holds.`:`No chats in this project yet — start one with “New chat in this project”.`}):(0,G.jsx)(`div`,{className:`rounded-xl border border-border bg-surface p-1`,"data-testid":`project-page-chats`,children:o.map(e=>(0,G.jsx)(zL,{session:e,active:!1,link:t.sessionLinks[e.id]??null,menuOpen:i.menuFor===e.id,onOpen:s,onMenu:i.openMenu,clock:r,testIdPrefix:`project-chat`},e.id))}),f>0&&o.length>0&&f>o.length?(0,G.jsxs)(`p`,{className:`mt-1 text-xs text-fg-faint`,children:[f-o.length,` older `,f-o.length===1?`chat is`:`chats are`,` `,`not in the list this window holds — search for`,` `,f-o.length===1?`it`:`them`,` in the session list.`]}):null]})]}),i.element]})}var nR=`waiting: the chat is busy`;function rR(e){return e.enabled&&typeof e.lastResult==`string`&&e.lastResult.startsWith(`waiting:`)&&e.lastResult!==nR}function iR(e,t){if(!e.enabled||!e.nextRunAt)return!1;let n=Date.parse(e.nextRunAt);return Number.isFinite(n)&&n-t<=36e5}function aR(e,t){let n=e=>e===1?`1 scheduled task`:`${e} scheduled tasks`,r=e.filter(rR).length;if(r>0)return{tone:`stuck`,count:r,text:`${n(r)} could not run — open Scheduled to see why`};let i=e.filter(e=>iR(e,t)).length;return i>0?{tone:`soon`,count:i,text:`${n(i)} due within the hour`}:null}function oR(e){return e.split(/\r?\n/).find(e=>e.trim()!==``)?.trim()??``}function sR(){let{state:e,actions:t}=K(),{tasks:n,reload:r}=YL(),i=XL(),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(null),l=(0,v.useMemo)(()=>{let t=new Map(e.sessions.map(e=>[e.id,Qg(e)]));for(let[n,r]of Object.entries(e.pinnedRows))t.has(n)||t.set(n,Qg(r));return e=>t.get(e)??null},[e.sessions,e.pinnedRows]),u=async(e,t)=>{c(e.id);try{await t()&&r()}finally{c(null)}},d=n?.filter(e=>Pe(e)).length??0;return(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto bg-bg`,"data-testid":`scheduled-page`,children:(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-4xl px-4 py-6 sm:px-8`,children:[(0,G.jsxs)(`div`,{className:`mb-1 flex items-center gap-2`,children:[(0,G.jsx)(J.Clock,{className:`w-5 h-5 shrink-0 text-fg-muted`}),(0,G.jsx)(`h1`,{className:`text-2xl font-semibold text-fg`,children:`Scheduled`})]}),(0,G.jsxs)(`p`,{className:`mb-5 text-sm text-fg-muted`,children:[`What OonaCode's scheduler sends into your chats on this PC — once, or on a repeat — even when the chat has gone quiet.`,n&&n.length>0?` ${d} active${n.length>d?`, ${n.length-d} paused or done`:``}.`:``]}),n===null?null:n.length===0?(0,G.jsx)(`div`,{"data-testid":`scheduled-empty`,children:(0,G.jsx)(Pb,{icon:(0,G.jsx)(J.Clock,{className:`h-8 w-8`}),title:`Nothing scheduled`,hint:`Ask a chat to do something later or on a repeat — “remind me at 9 to check the build”, “every morning, summarise the new issues” — and its model schedules it with OonaCode’s scheduler. Every task, from every chat, shows here.`})}):(0,G.jsx)(`ul`,{className:`space-y-2`,"data-testid":`scheduled-list`,children:n.map(e=>{let n=rR(e),r=iR(e,i),c=l(e.sessionId),d=oR(e.prompt),f=Pe(e),p=Fe(e);return(0,G.jsxs)(`li`,{className:W(`rounded-xl border p-3 text-sm`,f?`bg-surface`:`bg-surface-2 opacity-60`,n?`border-warn/60`:`border-border`),"data-testid":`scheduled-row-${e.id}`,"data-active":f?`true`:`false`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-fg`,title:e.title,children:e.title}),r&&!n?(0,G.jsx)(`span`,{className:`rounded-full bg-accent-soft px-1.5 text-[11px] text-accent`,children:`due soon`}):null,e.createdBy===`model`?(0,G.jsx)(`span`,{className:`text-[11px] text-fg-faint`,children:`set by the agent`}):null,(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,disabled:s===e.id||!e.enabled&&e.nextRunAt===null&&`at`in e.when,onClick:()=>void u(e,()=>t.updateScheduledTask(e.id,{enabled:!e.enabled})),"data-testid":`scheduled-row-toggle`,children:e.enabled?`Pause`:`Resume`}),(0,G.jsx)(Y,{size:`sm`,variant:a===e.id?`danger`:`ghost`,disabled:s===e.id,onClick:()=>{if(a!==e.id){o(e.id);return}o(null),u(e,()=>t.deleteScheduledTask(e.id))},"data-testid":`scheduled-row-delete`,children:a===e.id?`Delete?`:`Delete`})]}),d?(0,G.jsxs)(`div`,{className:`mt-1 truncate text-fg-muted`,title:e.prompt,"data-testid":`scheduled-row-sends`,children:[`Sends: “`,d,`”`]}):null,(0,G.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs text-fg-muted`,children:[(0,G.jsx)(`span`,{"data-testid":`scheduled-row-when`,children:Uf(e.when)}),(0,G.jsx)(`span`,{"data-testid":`scheduled-row-next`,children:Wf(e.nextRunAt,e.enabled)}),(0,G.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[`in`,(0,G.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-accent hover:underline`,title:`Open this chat`,onClick:()=>t.selectSession(e.sessionId),"data-testid":`scheduled-row-chat`,children:c??`a chat`})]})]}),e.lastRunAt||e.lastResult?(0,G.jsxs)(`div`,{className:W(`mt-0.5 text-xs`,n?`text-warn`:`text-fg-faint`),"data-testid":`scheduled-row-last`,children:[e.lastRunAt?(0,G.jsxs)(`span`,{title:Kg(e.lastRunAt),children:[`last ran `,Wg(e.lastRunAt,i)]}):(0,G.jsx)(`span`,{children:`not run yet`}),e.lastResult?` · ${e.lastResult}`:``]}):null,f?null:(0,G.jsxs)(`div`,{className:`mt-0.5 text-xs text-fg-faint`,title:`Tasks that are paused or have finished are deleted 10 days after their last change`,"data-testid":`scheduled-row-deletes`,children:[e.nextRunAt===null?`Finished`:`Paused`,p?` — deleted automatically on ${Kg(p)}`:``]})]},e.id)})})]})})}var cR=5e3,lR=12;function uR(e){return Math.min(lR,Math.max(4,e))}var dR=(0,v.memo)(function({messages:e,onPick:t}){let[n,r]=(0,v.useState)(!1),i=(0,v.useRef)(null);return(0,v.useLayoutEffect)(()=>{let e=i.current;n&&e&&(e.scrollTop=e.scrollHeight)},[n]),e.length<2?null:(0,G.jsxs)(`div`,{className:`absolute right-2 top-1/2 z-10 -translate-y-1/2`,"data-testid":`user-message-rail`,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onFocus:()=>r(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||r(!1)},onKeyDown:e=>{e.key===`Escape`&&r(!1)},children:[(0,G.jsx)(`button`,{type:`button`,"aria-label":`Your messages in this chat`,"aria-haspopup":`true`,"aria-expanded":n,className:`flex flex-col items-end gap-1 p-1 text-fg opacity-70 hover:opacity-100 focus-visible:opacity-100`,onClick:()=>r(!0),"data-testid":`user-message-rail-handle`,children:Array.from({length:uR(e.length)},(e,t)=>(0,G.jsx)(`span`,{className:`block h-[2px] w-5 rounded-full bg-current`},t))}),n?(0,G.jsx)(`div`,{className:`absolute right-full top-1/2 -translate-y-1/2 pr-2`,"data-testid":`user-message-rail-bridge`,children:(0,G.jsx)(`div`,{ref:i,className:`max-h-[60vh] w-72 max-w-[70vw] overflow-y-auto rounded-md border border-border bg-surface p-1 shadow-md`,"data-testid":`user-message-rail-list`,children:e.map(e=>{let n=e.reachable!==!1,i=[e.at?Kg(e.at):null,e.label,n?null:`Too far back to jump to (more than ${cR.toLocaleString()} lines ago).`].filter(e=>e!==null).join(`
151
151
  `);return(0,G.jsx)(`button`,{type:`button`,"aria-disabled":!n,className:n?`block w-full truncate rounded px-2 py-1 text-left text-xs hover:bg-surface-2 focus-visible:bg-surface-2`:`block w-full cursor-not-allowed truncate rounded px-2 py-1 text-left text-xs opacity-40`,title:i,onClick:()=>{n&&(r(!1),t(e.id))},"data-testid":`user-message-rail-item`,children:e.label},e.id)})})}):null]})}),fR=(0,v.memo)(function({text:e,localFiles:t=!1}){let{head:n,tail:r}=wF(e);return(0,G.jsxs)(G.Fragment,{children:[n?(0,G.jsx)(dP,{text:n,localFiles:t}):null,(0,G.jsx)(dP,{text:r,localFiles:t})]})});function pR(e){let t=(0,v.useRef)(null);(0,v.useEffect)(()=>{let e=t.current;e&&(e.focus(),e.select())},[e.focusSeq]);let n=t=>{t.key===`Enter`||t.key===`ArrowDown`?(t.preventDefault(),e.onStep(t.key===`Enter`&&t.shiftKey?-1:1)):t.key===`ArrowUp`?(t.preventDefault(),e.onStep(-1)):t.key===`Escape`&&(t.preventDefault(),t.stopPropagation(),e.onClose())},r=e.query.trim()!==``&&e.count===0;return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border bg-surface px-3 py-1.5`,"data-testid":`chat-search`,role:`search`,children:[(0,G.jsx)(J.Search,{className:`w-3.5 h-3.5 shrink-0 text-fg-faint`}),(0,G.jsx)(`input`,{ref:t,type:`text`,value:e.query,onChange:t=>e.onQuery(t.target.value),onKeyDown:n,placeholder:`Find in this chat`,"aria-label":`Find in this chat`,spellCheck:!1,className:W(Z,`h-7 min-w-0 flex-1 py-0 text-xs`),"data-testid":`chat-search-input`}),(0,G.jsx)(`span`,{className:W(`shrink-0 tabular-nums text-xs`,r?`text-warn`:`text-fg-muted`),"data-testid":`chat-search-count`,children:e.query.trim()===``?``:je(e.index,e.count)}),(0,G.jsx)(X,{label:`Previous match (Shift+Enter)`,onClick:()=>e.onStep(-1),disabled:e.count===0,"data-testid":`chat-search-prev`,children:(0,G.jsx)(J.ArrowDown,{className:`w-3.5 h-3.5 rotate-180`})}),(0,G.jsx)(X,{label:`Next match (Enter)`,onClick:()=>e.onStep(1),disabled:e.count===0,"data-testid":`chat-search-next`,children:(0,G.jsx)(J.ArrowDown,{className:`w-3.5 h-3.5`})}),(0,G.jsx)(X,{label:`Close search (Esc)`,onClick:e.onClose,"data-testid":`chat-search-close`,children:(0,G.jsx)(J.X,{className:`w-3.5 h-3.5`})})]})}var mR=`data-item-id`;function hR(e){return`[${mR}="${e.replace(/["\\]/g,`\\$&`)}"]`}var gR=`oona-search`,_R=`oona-search-current`,vR=2e3;function yR(){let e=globalThis.CSS,t=globalThis.Highlight;return!e?.highlights||typeof t!=`function`?null:{registry:e.highlights,Highlight:t}}function bR(e,t,n,r){let i=yR();if(i===null)return;let a=we(r);if(a===``||t.length===0){xR();return}let o=Ee(a),s=[],c=[],l=vR;for(let r of t){let t=e.querySelector(hR(r.id));if(!t)continue;let i=TR(t,o,l);if(l-=i.length,r.id===n?c.push(...i):s.push(...i),l<=0)break}i.registry.set(gR,new i.Highlight(...s)),i.registry.set(_R,new i.Highlight(...c))}function xR(){let e=yR();e!==null&&(e.registry.delete(gR),e.registry.delete(_R))}function SR(e,t){let n=we(t);return n===``?null:TR(e,Ee(n),1)[0]??null}function CR(e,t){let n=e.startContainer instanceof Element?e.startContainer:e.startContainer.parentElement;for(;n;){if(n instanceof HTMLElement&&wR(n)){let t=e.getBoundingClientRect(),r=n.getBoundingClientRect();n.scrollTop+=t.top-r.top-(n.clientHeight-t.height)/2}if(n===t)break;n=n.parentElement}}function wR(e){if(e.scrollHeight<=e.clientHeight)return!1;let t=getComputedStyle(e).overflowY;return t===`auto`||t===`scroll`}function TR(e,t,n){let r=e.ownerDocument;if(!r||n<=0)return[];let i=[],a=r.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let e=a.nextNode();e!==null;e=a.nextNode()){let a=e.data;t.lastIndex=0;for(let o of a.matchAll(t)){if(o[0].length===0)continue;let t=r.createRange();if(t.setStart(e,o.index??0),t.setEnd(e,(o.index??0)+o[0].length),i.push(t),i.length>=n)return i}}return i}function ER(e,t){switch(e.kind){case`user`:return e.text;case`assistant`:return e.text;case`thinking`:return t?e.text:``;case`tool`:return[e.name,CI(e.name,e.input)??``,DR(e.result)].filter(e=>e!==``).join(`
152
152
  `);case`system`:return e.text;case`error`:return e.message;case`permission`:return e.request.toolName;case`result`:case`compact`:return``}}function DR(e){return e===null?``:typeof e.content==`string`?e.content:e.content.map(e=>`text`in e&&typeof e.text==`string`?e.text:``).filter(e=>e!==``).join(`
153
153
  `)}function OR(e,t,n){let r=ke(e,t,e=>ER(e,n.showReasoning));if(r.length===0)return[];let i=new Map;for(let t of e)t.kind===`tool`&&i.set(t.toolUseId,t);return r.map(t=>{let n=e[t],r=kR(n,i);return{id:n.id,rootId:r[0]??n.id,path:r}})}function kR(e,t){let n=[],r=e;for(let e=0;e<16&&r.parentToolUseId!==null;e++){let e=t.get(r.parentToolUseId);if(e===void 0)break;n.unshift(e.id),r=e}return n}function AR(e,t){let n=e instanceof Element?e:null,r=e=>e!==null&&t.contains(e)?e:null,i=typeof window<`u`?window.getSelection():null,a=i&&!i.isCollapsed&&i.anchorNode&&t.contains(i.anchorNode)?i.toString():``,o=r(n?.closest(`[data-item-id]`)??null),s=r(n?.closest(`pre`)??null),c=r(n?.closest(`a[href]`)??null);return{selection:a,itemId:o?.getAttribute(`data-item-id`)??null,code:s?.textContent??null,link:c?.href||null}}function jR(e){switch(e.kind){case`user`:case`assistant`:case`thinking`:case`system`:return e.text;case`tool`:{let t=DR(e.result);return t===``?CI(e.name,e.input)??``:t}case`error`:return e.message;case`permission`:return e.request.toolName;case`result`:case`compact`:return``}}function MR(e){switch(e.kind){case`user`:return`Copy message`;case`assistant`:return`Copy reply`;case`tool`:return e.result?`Copy tool output`:`Copy tool call`;case`thinking`:return`Copy thought`;default:return`Copy text`}}function NR(e){let t=e.trim();return t===``||t.length>80||/[\r\n]/.test(t)?null:t}function PR(e){if(!e)return null;try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`?t.href:null}catch{return null}}function FR(e,t,n={}){let r=[],i=t!==null&&jR(t).trim()!==``;n.canReply!==!1&&(e.selection.trim()!==``||i)&&r.push({key:`reply`,label:e.selection.trim()===``?`Reply`:`Reply to selection`}),r.push({key:`copy`,label:`Copy`,hint:`Ctrl+C`,disabled:e.selection===``,separated:r.length>0}),e.code!==null&&e.code.trim()!==``&&r.push({key:`copy-code`,label:`Copy code block`}),e.link!==null&&(r.push({key:`copy-link`,label:`Copy link address`}),PR(e.link)&&r.push({key:`open-link`,label:`Open link`})),t!==null&&i&&r.push({key:`copy-item`,label:MR(t)});let a=NR(e.selection);if(a!==null){let e=a.length>32?`${a.slice(0,31)}…`:a;r.push({key:`find`,label:`Find “${e}” in this chat`,separated:!0})}return e.itemId!==null&&r.push({key:`select-block`,label:`Select all in this block`,separated:a===null}),r}var IR=`data-pin-message`;function LR(e,t,n){let r=0,i=e-1,a=-1;for(;r<=i;){let e=r+i>>1;t(e)<n?(a=e,r=e+1):i=e-1}return a}function RR(e,t=240){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function zR(e){switch(e.status){case`done`:return`answered`;case`skipped`:return`skipped`;case`denied`:case`error`:return`dismissed`;case`cancelled`:return`unanswered`;default:return null}}var BR=(0,v.memo)(function({item:e}){let[t,n]=(0,v.useState)(!1),r=zR(e),i=(0,v.useMemo)(()=>Ll(e.input),[e.input]),a=(0,v.useMemo)(()=>Bl(e.result?.structured)??Bl(e.input),[e.result,e.input]);if(r===null)return null;let o=zl({outcome:r,questions:i.length,answers:a}),s=r===`answered`&&a?i.map(e=>({question:e.question,answer:a[e.question]})).filter(e=>typeof e.answer==`string`):[],c=r===`answered`;return(0,G.jsxs)(`div`,{className:`my-1 text-xs text-fg-faint`,"data-testid":`question-line-${e.toolUseId}`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":s.length>0?t:void 0,disabled:s.length===0,onClick:()=>n(e=>!e),className:`flex w-full min-w-0 items-center gap-2 rounded px-1 py-0.5 text-left enabled:hover:bg-surface-2`,children:[c?(0,G.jsx)(J.Check,{className:`w-3 h-3 shrink-0 text-ok`}):(0,G.jsx)(J.X,{className:`w-3 h-3 shrink-0`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,"data-testid":`question-line-text`,children:o}),s.length>0?(0,G.jsx)(J.Chevron,{open:t,className:`w-3 h-3 shrink-0`}):null]}),t&&s.length>0?(0,G.jsx)(`dl`,{className:`ml-5 mt-1 space-y-1`,"data-testid":`question-line-answers`,children:s.map(e=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`text-fg-muted`,children:e.question}),(0,G.jsx)(`dd`,{className:`pre-wrap text-fg`,children:e.answer})]},e.question))}):null]})});function VR(e){return e.map(e=>{let t=e.source,n=t?.type===`base64`&&!!t.data;if(e.type===`image`&&n){let e=t.media_type??`image/png`;return{kind:`picture`,picture:{name:FF(`picture`,e),mediaType:e,base64:t.data}}}if(e.type===`document`&&n){let e=t.media_type??`application/pdf`;return{kind:`file`,label:e===`application/pdf`?`PDF · open`:`File · open`,file:{name:FF(`document`,e),mediaType:e,base64:t.data}}}if(e.type===`text`){let t=e.text??``,n=RF(t);if(n)return{kind:`localpath`,label:`${Yg(n.name,28)} · open`,name:n.name,path:n.path};let r=IF(t);if(r)return{kind:`file`,label:`${Yg(r.name,28)} · open`,file:{name:r.name,mediaType:`text/plain`,base64:MF(r.content)}}}return{kind:`other`,type:e.type}})}var HR=(0,v.memo)(function({attachments:e}){let t=(0,v.useMemo)(()=>VR(e),[e]),[n,r]=(0,v.useState)(null),i=(0,v.useContext)(HN).notify??void 0;return(0,G.jsxs)(`div`,{className:`mb-1 flex flex-wrap gap-1`,"data-testid":`sent-attachments`,children:[t.map((e,t)=>e.kind===`picture`?(0,G.jsx)(`button`,{type:`button`,"aria-label":`Open picture`,title:`Open picture`,"data-testid":`attachment-picture`,onClick:()=>r(e.picture),className:`cursor-zoom-in rounded border border-border p-0 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,G.jsx)(`img`,{src:`data:${e.picture.mediaType};base64,${e.picture.base64}`,alt:`attachment`,className:`block max-h-40 rounded`})},t):e.kind===`file`?(0,G.jsxs)(`button`,{type:`button`,"aria-label":`Open ${e.file.name}`,title:`Open ${e.file.name} in its own program`,"data-testid":`attachment-file`,onClick:()=>void WF(e.file,i),className:`inline-flex items-center gap-1 rounded bg-surface-2 px-1.5 py-0.5 text-[11px] font-medium leading-4 text-fg hover:bg-surface-3 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,G.jsx)(J.File,{className:`h-3 w-3 text-fg-muted`}),e.label]},t):e.kind===`localpath`?(0,G.jsxs)(`button`,{type:`button`,"aria-label":`Open ${e.name}`,title:`Open ${e.name} — ${e.path}`,"data-testid":`attachment-path`,onClick:()=>void BF(e.path,i),className:`inline-flex items-center gap-1 rounded bg-surface-2 px-1.5 py-0.5 text-[11px] font-medium leading-4 text-fg hover:bg-surface-3 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,G.jsx)(J.File,{className:`h-3 w-3 text-fg-muted`}),e.label]},t):(0,G.jsx)(Q,{children:e.type},t)),(0,G.jsx)(rI,{picture:n,onClose:()=>r(null),notify:i})]})});function UR(e){let t=[],n=0;for(;n<e.length;){let r=e[n].item;if(r.kind===`permission`&&r.status!==`pending`){let r=[],i=n;for(;i<e.length;){let t=e[i].item;if(t.kind!==`permission`||t.status===`pending`)break;r.push(t),i+=1}if(r.length>=3){t.push({run:r}),n=i;continue}}t.push(e[n]),n+=1}return t}function WR(e,t){let n=null;for(let r=0;r<e.length;r++){let i=e[r].item;i.kind===`permission`&&i.status!==`pending`&&(i.status===`allowed`||i.request.toolName===`AskUserQuestion`)&&t(i.request.toolUseId)?n??=e.slice(0,r):n&&n.push(e[r])}return n??e}function GR(e){if(!e)return{flow:void 0,queued:[]};let t=[];for(let n of e)n.kind===`user`&&n.waiting&&!n.failed&&t.push(n);if(t.length===0)return{flow:e,queued:t};let n=new Set(t.map(e=>e.id));return{flow:e.filter(e=>!n.has(e.id)),queued:t}}function KR({items:e,onCancel:t,onSendNow:n}){let[r,i]=(0,v.useState)(()=>new Set),[a,o]=(0,v.useState)({}),[s,c]=(0,v.useState)(()=>new Set),l=e=>{let t=e.requestId;!n||!t||r.has(t)||s.has(t)||(i(e=>new Set(e).add(t)),o(({[t]:e,...n})=>n),n(e).catch(e=>e instanceof Error?e.message:String(e)).then(e=>{e?o(n=>({...n,[t]:e})):c(e=>new Set(e).add(t))}).finally(()=>i(e=>{let n=new Set(e);return n.delete(t),n})))},u=(0,v.useRef)(null),d=e.length;return(0,v.useEffect)(()=>{let e=u.current;e&&(e.scrollTop=e.scrollHeight)},[d]),e.length===0?null:(0,G.jsxs)(`div`,{className:`shrink-0 border-t border-border bg-surface px-3 pb-1 pt-2 sm:px-6`,"data-testid":`queued-strip`,children:[(0,G.jsxs)(`div`,{className:`mb-0.5 text-right text-[11px] text-fg-faint`,children:[e.length===1?`Queued`:`${e.length} queued`,` — the agent reads this at its next step`]}),(0,G.jsx)(`div`,{ref:u,className:`max-h-[200px] overflow-y-auto`,"data-testid":`queued-strip-list`,children:e.map(e=>(0,G.jsxs)(`div`,{className:`relative`,[mR]:e.id,children:[(0,G.jsx)(qR,{children:(0,G.jsx)(XR,{item:e})}),t&&e.requestId?(0,G.jsx)(`button`,{type:`button`,onClick:()=>t(e),title:`Withdraw this message — the agent has not read it yet`,"aria-label":`Withdraw this message`,"data-testid":`queued-cancel-${e.requestId}`,className:`absolute right-1 top-1 rounded-full border border-border bg-surface p-0.5 text-fg-muted shadow-sm hover:bg-surface-2 hover:text-fg`,children:(0,G.jsx)(J.X,{className:`h-3 w-3`})}):null,n&&e.requestId&&!e.deliveredAt?(0,G.jsxs)(`div`,{className:`-mt-0.5 mb-1 flex flex-wrap items-center justify-end gap-1.5 text-[11px] text-fg-faint`,"data-testid":`queued-now-row-${e.requestId}`,children:[(0,G.jsx)(`span`,{className:`hidden sm:inline`,children:s.has(e.requestId)?`Stopping the current step…`:`Stops the current step`}),(0,G.jsx)(Db,{label:Me.label,details:Me.warning}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>l(e),disabled:r.has(e.requestId)||s.has(e.requestId),title:s.has(e.requestId)?`On its way — the agent takes it as soon as it has stopped its current step (a few seconds at most)`:Me.warning,"aria-label":`${Me.label}: ${Me.warning}`,"data-testid":`queued-now-${e.requestId}`,className:`inline-flex items-center gap-1 rounded border border-border bg-surface px-1.5 py-0.5 text-fg-muted shadow-sm hover:bg-surface-2 hover:text-fg disabled:opacity-50`,children:[r.has(e.requestId)||s.has(e.requestId)?(0,G.jsx)(J.Spinner,{className:`h-3 w-3`}):null,s.has(e.requestId)?`Sending now…`:r.has(e.requestId)?`Sending…`:Me.label]}),a[e.requestId]?(0,G.jsx)(`span`,{className:`basis-full text-right text-danger`,role:`status`,"data-testid":`queued-now-refused-${e.requestId}`,children:a[e.requestId]}):null]}):null]},e.id))})]})}function qR({children:e}){let t=(0,v.useRef)(null),[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(!1);return(0,v.useLayoutEffect)(()=>{let e=t.current;if(!e)return;let n=e.scrollHeight>116;n!==i&&a(n)}),(0,G.jsxs)(`div`,{"data-testid":`queued-clamp`,"data-open":n?`true`:`false`,children:[(0,G.jsx)(`div`,{ref:t,className:W(!n&&`overflow-hidden`),style:n?void 0:{maxHeight:112},children:e}),i||n?(0,G.jsx)(`div`,{className:`-mt-1 mb-0.5 text-right`,children:(0,G.jsx)(`button`,{type:`button`,onClick:()=>r(e=>!e),className:`text-[11px] text-fg-muted underline-offset-2 hover:text-fg hover:underline`,"data-testid":`queued-clamp-toggle`,children:n?`Show less`:`Show all`})}):null]})}function JR(e){return e.failed?`failed`:e.optimistic||e.waiting?`pending`:`delivered`}function YR(e){return e.chatMarker===void 0&&!e.compactSummary&&!e.taskNotification&&!e.engineNote&&e.scheduledTask===void 0&&!ae(e.text)&&!oe(e.text)}var XR=(0,v.memo)(function({item:e}){if(e.chatMarker)return(0,G.jsx)(vF,{item:e});if(oe(e.text))return(0,G.jsx)(ez,{item:e});if(e.compactSummary)return(0,G.jsx)(lz,{item:e});if(e.taskNotification)return(0,G.jsx)(cz,{item:e});if(ae(e.text))return(0,G.jsx)(tz,{item:e});if(e.engineNote)return(0,G.jsx)(QR,{item:e});if(e.scheduledTask!==void 0)return(0,G.jsx)($R,{item:e});let t=JR(e);return(0,G.jsx)(`div`,{className:`my-2 flex justify-end`,"data-testid":`user-bubble`,"data-delivery":t,children:(0,G.jsxs)(`div`,{className:W(`max-w-[85%] rounded-2xl rounded-br-md bg-user-bubble px-3.5 py-2 text-sm`,t===`pending`&&`opacity-70`,e.failed&&`border border-danger/50`),children:[e.attachments.length>0?(0,G.jsx)(HR,{attachments:e.attachments}):null,(0,G.jsx)(ZR,{text:e.text}),e.failed?(0,G.jsx)(`div`,{className:`mt-1 text-right text-[10px] text-danger`,"data-testid":`user-not-sent`,children:`Not sent — send it again`}):null,(0,G.jsxs)(`div`,{className:`mt-0.5 flex items-center justify-end gap-1 text-[10px] text-fg-muted`,"data-testid":`user-time`,children:[e.timestamp?(0,G.jsx)(`span`,{title:Kg(e.timestamp),children:qg(e.timestamp)}):null,t===`pending`?(0,G.jsx)(`span`,{"data-testid":`user-waiting`,title:e.waiting?`Handed to the agent — it reads this at its next step`:`Sending…`,"aria-label":`not read yet`,children:(0,G.jsx)(J.Clock,{className:`h-3 w-3`})}):t===`delivered`?(0,G.jsx)(`span`,{"data-testid":`user-delivered`,title:e.deliveredAt?`Read by the agent at ${Kg(e.deliveredAt)}`:`Sent to the model`,"aria-label":`read by the agent`,children:(0,G.jsx)(J.Check,{className:`h-3 w-3`})}):null]})]})})});function ZR({text:e}){let t=Kv(e);return t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`mb-1.5 flex flex-col gap-1`,children:t.quotes.map((e,t)=>(0,G.jsxs)(`button`,{type:`button`,className:`flex min-w-0 max-w-full items-center gap-1.5 rounded-md border-l-2 border-accent bg-accent-soft/60 py-1 pl-2 pr-2 text-left text-xs text-fg-muted hover:text-fg`,title:`Go to the quoted message:\n\n${qv(e)}`,"data-quote":e,"data-testid":`user-reply-quote`,children:[(0,G.jsx)(J.Reply,{className:`h-3.5 w-3.5 shrink-0 text-accent`}),(0,G.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,G.jsx)(`span`,{className:`text-fg`,children:`Reply to `}),Xv(qv(e))]})]},t))}),t.reply===``?null:(0,G.jsx)(`div`,{className:`pre-wrap`,children:(0,G.jsx)(tP,{text:t.reply})})]}):(0,G.jsx)(`div`,{className:`pre-wrap`,children:(0,G.jsx)(tP,{text:e})})}var QR=(0,v.memo)(function({item:e}){let[t,n]=(0,v.useState)(!1);AF(e.id,n);let r=e.text.trim()?e.text.trim().split(/\s+/).length:0;return(0,G.jsxs)(`div`,{className:`my-2 rounded-lg border border-border bg-surface text-sm`,"data-testid":`engine-note`,title:Kg(e.timestamp),children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-fg-muted hover:bg-surface-2`,children:[(0,G.jsx)(J.Info,{className:`w-3.5 h-3.5 text-fg-faint`}),(0,G.jsx)(`span`,{className:`font-medium`,children:`Engine note`}),(0,G.jsxs)(`span`,{className:`min-w-0 truncate text-xs opacity-70`,children:[le(e.text),r>40?` · ${r.toLocaleString()} words`:``]}),(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(J.Chevron,{open:t,className:`w-3.5 h-3.5 text-fg-faint`})]}),t?(0,G.jsx)(`div`,{className:`border-t border-border px-3 py-2 text-fg-muted`,children:(0,G.jsx)(dP,{text:e.text})}):null]})}),$R=(0,v.memo)(function({item:e}){let[t,n]=(0,v.useState)(!1);AF(e.id,n);let r=nc(e.text)?.prompt??e.text;return(0,G.jsxs)(`div`,{className:`my-2 rounded-lg border border-border bg-surface text-sm`,"data-testid":`scheduled-task-line`,title:Kg(e.timestamp),children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-fg-muted hover:bg-surface-2`,children:[(0,G.jsx)(J.Clock,{className:`w-3.5 h-3.5 text-fg-faint`}),(0,G.jsx)(`span`,{className:`font-medium`,children:`Scheduled task`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate text-xs opacity-70`,children:e.scheduledTask}),(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(J.Chevron,{open:t,className:`w-3.5 h-3.5 text-fg-faint`})]}),t?(0,G.jsx)(`div`,{className:`border-t border-border px-3 py-2 text-fg-muted`,children:(0,G.jsx)(dP,{text:r})}):null]})}),ez=(0,v.memo)(function({item:e}){return(0,G.jsxs)(`div`,{className:`my-2 flex items-center gap-2 text-xs text-fg-faint`,"data-testid":`interrupt-marker`,title:Kg(e.timestamp),children:[(0,G.jsx)(`span`,{className:`h-px flex-1 bg-border`}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border border-border bg-surface px-2.5 py-0.5`,children:[(0,G.jsx)(J.Stop,{className:`h-3 w-3 text-danger`}),(0,G.jsx)(`span`,{className:`font-medium text-fg-muted`,children:`User requested stop`})]}),(0,G.jsx)(`span`,{className:`h-px flex-1 bg-border`})]})}),tz=(0,v.memo)(function({item:e}){let[t,n]=(0,v.useState)(!1);return AF(e.id,n),(0,G.jsxs)(`div`,{className:`my-2 rounded-lg border border-border bg-surface text-sm`,"data-testid":`stream-cut`,title:Kg(e.timestamp),children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-fg-muted hover:bg-surface-2`,children:[(0,G.jsx)(J.Info,{className:`w-3.5 h-3.5 text-fg-faint`}),(0,G.jsx)(`span`,{className:`font-medium`,children:`Reply cut off`}),(0,G.jsx)(`span`,{className:`text-xs opacity-70`,children:`the stream broke mid-answer; the engine asked the model to resume where it stopped`}),(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(J.Chevron,{open:t,className:`w-3.5 h-3.5 text-fg-faint`})]}),t?(0,G.jsx)(`div`,{className:`border-t border-border px-3 py-2 text-fg-muted`,children:(0,G.jsx)(dP,{text:e.text})}):null]})}),nz=(0,v.memo)(function({item:e}){let t=_p(e.error,e.text),n=TF(t?fp(e.text):e.text,e.streaming);return(0,G.jsxs)(`div`,{className:`my-2 text-sm`,"data-testid":`assistant-bubble`,title:Kg(e.timestamp),children:[(0,G.jsx)(`div`,{className:W(e.streaming&&`caret`),children:e.streaming?(0,G.jsx)(fR,{text:n,localFiles:!0}):(0,G.jsx)(dP,{text:n,localFiles:!0})}),t?(0,G.jsx)(`div`,{className:`mt-1 text-xs text-danger`,"data-testid":`assistant-error`,children:t}):null,e.aborted?(0,G.jsx)(Q,{tone:`warn`,className:`mt-1`,children:`interrupted`}):null]})});function rz(e){if(e.kind!==`user`||!e.taskNotification)return!1;let t=ve(e.text).summary??``;return/orphaned by a previous claude code process exit/i.test(t)||/background .*tasks? didn.t finish before the previous session ended/i.test(t)}function iz(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(`item`in r&&rz(r.item)){let r=[],i=n;for(;i<e.length;){let t=e[i];if(!(`item`in t)||!rz(t.item))break;r.push(t.item),i+=1}if(r.length>=2){t.push({orphans:r}),n=i;continue}}t.push(r),n+=1}return t}function az(e){for(let t of e){let e=ve(t.text).summary??``,n=/(\d+) background .*tasks? didn.t finish/i.exec(e);if(n)return Number(n[1])}return e.length}var oz=(0,v.memo)(function({items:e}){let[t,n]=(0,v.useState)(!1),r=az(e);return(0,G.jsxs)(`div`,{className:`my-2 rounded-lg border border-border bg-surface text-sm`,"data-testid":`restart-orphans`,"data-count":r,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-fg-muted hover:bg-surface-2`,children:[(0,G.jsx)(J.Info,{className:`w-3.5 h-3.5 text-fg-faint`}),(0,G.jsx)(`span`,{className:`font-medium`,children:r===1?`1 background task`:`${r} background tasks`}),(0,G.jsx)(`span`,{className:`text-xs font-medium text-warn`,children:`stopped`}),(0,G.jsxs)(`span`,{className:`min-w-0 truncate text-xs opacity-70`,children:[r===1?`it was`:`they were`,` running when OonaCode restarted this chat (an update or a restart); the model can start again what it still needs`]}),(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(J.Chevron,{open:t,className:`w-3.5 h-3.5 text-fg-faint`})]}),t?(0,G.jsx)(`div`,{className:`border-t border-border px-2 py-1`,children:e.map(e=>(0,G.jsx)(cz,{item:e},e.id))}):null]})});function sz(e){if(!e)return null;if(/orphaned by a previous claude code process exit/i.test(e))return`it was still running when OonaCode restarted this chat (an update or a restart), so it stopped`;let t=/(\d+) background .*tasks? didn.t finish before the previous session ended/i.exec(e);return t?`${t[1]} background tasks were still running when OonaCode restarted this chat (an update or a restart), so they stopped`:e}var cz=(0,v.memo)(function({item:e}){let[t,n]=(0,v.useState)(!1);AF(e.id,n);let r=ve(e.text),i=r.status??`ended`,a=i===`completed`?`text-ok`:i===`failed`?`text-danger`:`text-warn`,o=sz(r.summary);return(0,G.jsxs)(`div`,{className:`my-2 rounded-lg border border-border bg-surface text-sm`,"data-testid":`task-notification`,"data-status":i,title:Kg(e.timestamp),children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-fg-muted hover:bg-surface-2`,children:[(0,G.jsx)(J.Info,{className:`w-3.5 h-3.5 text-fg-faint`}),(0,G.jsx)(`span`,{className:`font-medium`,children:`Background task`}),(0,G.jsx)(`span`,{className:`text-xs font-medium ${a}`,children:i}),o?(0,G.jsx)(`span`,{className:`min-w-0 truncate text-xs opacity-70`,title:r.summary??void 0,children:o}):null,(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(J.Chevron,{open:t,className:`w-3.5 h-3.5 text-fg-faint`})]}),t?(0,G.jsxs)(`div`,{className:`border-t border-border px-3 py-2 text-xs text-fg-muted`,children:[r.note?(0,G.jsx)(`p`,{className:`mb-2`,children:r.note}):null,(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-[11px] text-fg-faint`,children:e.text})]}):null]})}),lz=(0,v.memo)(function({item:e}){let[t,n]=(0,v.useState)(!1);AF(e.id,n);let r=e.text.trim()?e.text.trim().split(/\s+/).length:0;return(0,G.jsxs)(`div`,{className:`my-2 rounded-lg border border-border bg-surface text-sm`,"data-testid":`compact-summary`,title:Kg(e.timestamp),children:[(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-fg-muted hover:bg-surface-2`,children:[(0,G.jsx)(J.Info,{className:`w-3.5 h-3.5 text-fg-faint`}),(0,G.jsx)(`span`,{className:`font-medium`,children:`Context compacted`}),(0,G.jsxs)(`span`,{className:`text-xs opacity-70`,children:[`the engine summarised the conversation so far to make room · `,r.toLocaleString(),` `,`words`]}),(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(J.Chevron,{open:t,className:`w-3.5 h-3.5 text-fg-faint`})]}),t?(0,G.jsx)(`div`,{className:`border-t border-border px-3 py-2 text-fg-muted`,children:(0,G.jsx)(dP,{text:e.text})}):null]})}),uz=(0,v.memo)(function({item:e,modelNameOf:t}){let n=[Hg(e.durationMs),`${Ug(e.inputTokens)} in${(e.cachedInputTokens??0)>0?` (+${Ug(e.cachedInputTokens??0)} cached)`:``} / ${Ug(e.outputTokens)} out`,`${e.numTurns} step${e.numTurns===1?``:`s`}`],r=e.safeguards,i=r?sl(r,t):e.isError?hp(e):`turn complete`,a=r&&r.outcome===`blocked`||e.isError;return(0,G.jsxs)(`div`,{className:W(`my-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px]`,a?`text-danger`:`text-fg-faint`),"data-testid":`result-line`,title:Kg(e.timestamp),children:[a?(0,G.jsx)(J.Alert,{className:`w-3 h-3`}):(0,G.jsx)(J.Check,{className:`w-3 h-3`}),(0,G.jsx)(`span`,{"data-testid":`result-outcome`,children:i}),(0,G.jsx)(`span`,{children:`·`}),(0,G.jsx)(`span`,{children:n.join(` · `)}),e.errors.length>0?(0,G.jsx)(`span`,{className:`w-full pre-wrap font-mono`,children:e.errors.join(`