@fungi.computer/grove 0.10.18 → 0.10.20

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.
Files changed (26) hide show
  1. package/dist/assets/{anthropic-messages-2CqXisBN.js → anthropic-messages-D2Vm8y_7.js} +3 -3
  2. package/dist/assets/{azure-openai-responses-C2QTCVJV.js → azure-openai-responses-DTysy0OL.js} +1 -1
  3. package/dist/assets/{burger-D4fnPNhq.js → burger-BqaFPiJJ.js} +1 -1
  4. package/dist/assets/{cat-BlHp6a8h.js → cat-CL0zQicU.js} +1 -1
  5. package/dist/assets/{compat-GvX0Uc3g.js → compat-DtOKKTGw.js} +2 -2
  6. package/dist/assets/{extension-hook-JTiNRrg7.js → extension-hook-ClRCT16F.js} +2 -2
  7. package/dist/assets/{google-generative-ai-DouzsCMV.js → google-generative-ai-ChdHMAl2.js} +1 -1
  8. package/dist/assets/{google-shared-xNHV7_hH.js → google-shared-BlPR_V0K.js} +1 -1
  9. package/dist/assets/{google-vertex-Cnwx9gYS.js → google-vertex-DKnjFpGa.js} +1 -1
  10. package/dist/assets/{index-vsMyapHr.js → index-C4RcjDMM.js} +4 -4
  11. package/dist/assets/index-Dam97v7y.css +1 -0
  12. package/dist/assets/{mistral-conversations-Cgtsx_h5.js → mistral-conversations-CEgykzMD.js} +1 -1
  13. package/dist/assets/{node.browser-B81vvhM9.js → node.browser-BQ2ZxQXi.js} +1 -1
  14. package/dist/assets/{openai-codex-responses-BpxnyUI4.js → openai-codex-responses-zHlcaHD8.js} +1 -1
  15. package/dist/assets/{openai-completions-GNE7-LaH.js → openai-completions-Dn1_i1LH.js} +1 -1
  16. package/dist/assets/{openai-responses-SIsYMHjt.js → openai-responses-DGC-47Mu.js} +1 -1
  17. package/dist/assets/{openai-responses-shared-DJIEUu7j.js → openai-responses-shared-CUCjbjkE.js} +1 -1
  18. package/dist/assets/{parakeet-5D6hqfUo.js → parakeet-B5vLIC08.js} +3 -3
  19. package/dist/assets/{parakeet-conversation-VSHojzxo.js → parakeet-conversation-XmsSybQ0.js} +1 -1
  20. package/dist/assets/{runtime-core-C0Lvoz9f.js → runtime-core-F_3KFMWa.js} +1 -1
  21. package/dist/assets/{sigil-dZKw9J-q.js → sigil-BXHhK83J.js} +9 -9
  22. package/dist/assets/{transform-messages-BhbGDt_x.js → transform-messages-2-OO0qtn.js} +1 -1
  23. package/dist/assets/{website-conversation-COoo854B.js → website-conversation-CDKiBVvX.js} +1 -1
  24. package/dist/index.html +4 -4
  25. package/package.json +3 -3
  26. package/dist/assets/index-BmGlVG3d.css +0 -1
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ai as t,Ar as n,Di as r,E as i,Ir as a,Mr as o,Nr as s,Pr as c,an as l,c as u,g as d,hi as f,jr as p,u as m,vr as h,wr as ee}from"./sigil-dZKw9J-q.js";import{Ea as g,Ta as te,Zi as _,_a as v,ar as y,ba as ne,da as re,fa as ie,ht as ae,ra as oe,sr as se,xa as b,ya as ce}from"./Effect-CsknxyoC.js";import{Ai as x,Bi as le,Ci as S,Dr as ue,Hi as C,Ji as w,Ma as de,Na as T,Ni as E,Pa as D,Pi as fe,Si as O,Ta as k,Wi as pe,Zi as me,_a as he,_i as ge,bi as _e,fi as A,i as j,ii as M,ji as ve,ka as N,kr as ye,la as P,li as F,oa as I,oi as L,pa as be,pi as R,ri as xe,ti as Se,ui as Ce,xa as z,xi as we,yi as B}from"./extension-hook-JTiNRrg7.js";import{a as Te,c as Ee,d as V,i as De,l as Oe,n as ke,o as Ae,r as je,s as Me,u as Ne}from"./parakeet-5D6hqfUo.js";import{_ as Pe,g as H,h as Fe,m as Ie,p as Le,t as Re,v as ze,y as Be}from"./index-vsMyapHr.js";var U=e(t(),1),W=f(),G=O.check(k(1),z(256)),Ve=F.check(P(1),he(2**53-1)),He=F.check(P(0),he(2**53-1)),Ue=R([`write`,`external`]),We=S({module:B(G),access:Ue}),Ge=S({agentId:B(G)}),Ke=S({principalId:G,agentId:B(G),sessionId:B(G),displayName:G}),qe=S({title:O.check(k(1),z(512)),inputBytes:F.check(P(0)),inputSha256:O.check(N(/^[a-f0-9]{64}$/))}),Je=S({kind:A(`pending_approval`),recordId:G,description:qe}),Ye=R([`requested`,`pending`,`approved`,`claimed`,`applied`,`denied`,`expired`,`outcome_unknown`]),Xe=R([`not-found`,`not-eligible`,`already-answered`,`stale-revision`,`expired`,`declined`,`fenced`,`not-granted`,`read-only`,`pending`,`in-flight`,`outcome-unknown`,`identity-conflict`]),Ze=O.check(k(1),z(512),N(/^(?=.*\S)[^\p{Cc}\u2028\u2029]*$/u)),Qe=M(S({kind:A(`artifact`),ref:O.check(N(/^sha256:[a-f0-9]{64}$/)),mediaType:A(`image/png`),bytes:F.check(P(1),he(5242880))})).check(z(4)),$e=S({recordId:G,requester:Ke,module:G,operation:G,access:Ue,description:qe,evidence:D(Qe),authorityFence:G,reversibility:R([`reversible`,`irreversible-external`]),state:Ye,by:B(x([S({kind:A(`human`),memberId:G}),S({kind:A(`policy`)})])),reason:B(Xe),denialNote:D(Ze),requestedAt:He,expiresAt:He,updatedAt:He,revision:Ve}),et=S({record:$e,canAnswer:L,canSetAutoApprove:L});S({state:D(Ye),cursor:D(G),limit:D(F.check(P(1),he(100)))}),S({recordId:G}),S({recordId:G,decision:R([`approve`,`deny`]),expectedRevision:Ve,denialNote:D(Ze)});var tt=S({scope:Ge,family:We,enabled:L}),nt=S({kind:A(`refused`),reason:Xe,denialNote:D(Ze)});C(w($e),{onExcessProperty:`error`}),pe(w($e)),C(S({record_json:O})),C(w(Ce)),pe(w(Ce)),C(S({input_json:O,output_json:B(O)}));var rt=nt,it=S({items:M(et),nextCursor:B(O)}),at=x([S({kind:A(`answered`),view:et}),rt]),ot=x([S({kind:A(`updated`),rule:tt}),rt]),K=e=>Ie(te().transform(t=>C(e,{onExcessProperty:`error`})(t))),st=ze(`approvals`,1,ie(()=>Fe({list:H(K(it)),get:H(K(B(et))),answer:H(K(at)),setAutoApprove:H(K(ot))}))),ct=(e,t)=>{if(e.length<=t)return e;let n=Math.max(1,Math.floor((t-1)/2));return`${e.slice(0,n)}…${e.slice(-(t-n-1))}`},lt=(e,t)=>e.length<=t?e:`${e.slice(0,t-1)}…`,ut=e=>e.map(([e,t])=>({label:e,value:t}));function dt(e,t){let{record:n}=e,r=Math.max(0,n.expiresAt-t);return[[`Agent`,`${n.requester.displayName} · ${n.requester.agentId??`none`}`],[`Session`,n.requester.sessionId??`none`],[`Requester`,n.requester.principalId],[`Request`,`${n.module}.${n.operation} · ${n.access}`],[`Input`,`${n.description.inputBytes.toLocaleString()} bytes · SHA-256 ${n.description.inputSha256.slice(0,8)}…${n.description.inputSha256.slice(-6)}`],[`Expires`,`in ${String(Math.floor(r/36e5))} h ${String(Math.floor(r%36e5/6e4))} m`],[`Record`,`${n.recordId} · revision ${String(n.revision)}`]]}function ft(e){return[`Undo`,e.record.reversibility===`irreversible-external`?`Can't be undone`:`Can be undone`]}function pt(e,t){let{record:n}=e;return{content:{title:`Allow ${n.module} · ${n.operation}?`,summary:`${n.requester.displayName} wants to use a connected tool.`,facts:[{label:`Effect`,value:(n.access===`write`?`Changes data in Fungi`:`Changes things outside Fungi`)+(n.reversibility===`irreversible-external`?` · can't be undone`:``)}],details:ut([ft(e),...dt(e,t)])}}}function mt(e,t,n,r,i){let a=t.prefix?.join(` `),o=a!==void 0&&t.alwaysAllowUnavailableReason===void 0,s=t.command,c=`Allow \`${s}\`?`.length<=n?`Allow \`${s}\`?`:`Allow this command?`,l=t.cwd===r?`~`:t.cwd.startsWith(`${r}/`)?`~${t.cwd.slice(r.length)}`:t.cwd,u=Math.max(8,(n-8)*2-2),d=t.justification.length<=u?`“${t.justification}”`:`“${t.justification.slice(0,u-1)}…”`,f=[[`Folder`,ct(l,Math.max(8,n-10))],[`Why`,d]];t.kind===`extension-install`&&f.push([`Note`,`Extensions run inside Fungi with access to every Agent.`]),o&&t.alwaysAllowCoverage!==void 0&&f.push([`Scope`,lt(t.alwaysAllowCoverage,Math.max(8,n-12))]),!o&&t.warning!==void 0&&f.push([`Warning`,t.warning]);let p=o?`Always allow “${ct(a,Math.max(8,n-5-32))}” in this project…`:void 0,m=[[`Command`,s]];return t.argv!==void 0&&m.push([`Arguments`,JSON.stringify(t.argv)]),m.push([`Folder`,t.cwd],[`Runs`,`Outside the sandbox, as you`],ft(e)),!o&&t.alwaysAllowUnavailableReason!==void 0?m.push([`Rule`,t.alwaysAllowUnavailableReason]):t.form===`shell`?m.push([`Rule`,`Shell command: no Always-allow rule can match it.`]):o&&(m.push([`Rule`,`“${a}” would match \`${a} …\` in this project`]),t.alwaysAllowCoverage!==void 0&&m.push([`Coverage`,t.alwaysAllowCoverage]),t.risk!==void 0&&m.push([`Risk`,t.risk.detail])),!o&&t.warning!==void 0&&m.push([`Warning`,t.warning]),m.push(...dt(e,i)),{content:{title:c,body:c===`Allow this command?`?s:void 0,bodyLabel:c===`Allow this command?`?`Command`:void 0,summary:`${e.record.requester.displayName} wants to run this outside the sandbox, as you.`,facts:ut(f),details:ut(m)},always:p===void 0?void 0:lt(p,Math.max(12,n-5)),confirmation:o?{title:`Always allow “${a}” in this project?`,body:lt(t.alwaysAllowCoverage??`Any Workspace Agent here can then run \`${a} …\` without asking.`,Math.max(12,(n-8)*2-2))}:void 0,confirmWarning:o?t.risk?.summary:void 0,confirmYes:o?`Always allow “${a}” and run it now`:void 0}}function ht(e,t,n){let r=Math.min(n.width,60);return t===void 0?pt(e,n.now):mt(e,t,r,n.home,n.now)}function gt(e,t){switch(e){case`stale-revision`:case`already-answered`:return`This request changed. Look again before answering.`;case`expired`:return`This request expired. Nothing ran.`;case`not-eligible`:if(t===`always-allow`)return`Always allow isn't available for this command. Approve once or deny.`}return`Couldn't answer (${e}). Nothing ran.`}var _t=`Couldn't send your answer. It may not have been recorded.`;async function vt(e,t){let{view:n,source:r}=t,i=ht(n,r.review,{width:t.width,home:t.home,now:t.now}),a=n.record;try{let n,o,s=!1;for(;n===void 0;){let c=await e.prompt({type:`decision`,message:i.content.title,summary:s?`Automatic approval is on for this family.`:i.content.summary,facts:i.content.facts?.map(e=>({...e})),body:i.content.body,bodyLabel:i.content.bodyLabel,details:i.content.details?.map(e=>({...e})),options:[{value:`approve`,label:`Approve once`},...i.always===void 0?[]:[{value:`always`,label:i.always}],...r.family===void 0||s?[]:[{value:`family`,label:r.family.label}],{value:`deny`,label:`Deny`}],other:{label:`Deny and say why…`,placeholder:`A short reason for the Agent (optional)`,maxLength:t.noteLimit,blank:`deny`}});if(!t.stillCurrent())return{kind:`abandoned`};if(c.text!==void 0)o=c.text.trim()||void 0,n=`deny`;else if(c.selected[0]===`always`){let r=i.confirmation,a=await e.prompt({type:`decision`,message:r?.title??i.content.title,summary:i.confirmWarning,body:r?.body,options:[{value:`back`,label:`Back`},{value:`always-allow`,label:i.confirmYes??`Always allow`}],escape:`back`});if(!t.stillCurrent())return{kind:`abandoned`};a.selected[0]===`always-allow`&&(n=`always-allow`)}else if(c.selected[0]===`family`&&r.family!==void 0){let n=await e.prompt({type:`decision`,message:`${r.family.label}?`,summary:`Later ${a.module} requests that ${a.access===`write`?`change data in Fungi`:`reach outside Fungi`} will run without asking.`,options:[{value:`back`,label:`Back`},{value:`family`,label:r.family.label}],escape:`back`});if(!t.stillCurrent()||n.selected[0]===`family`&&(s=await r.family.enable(),!t.stillCurrent()))return{kind:`abandoned`}}else c.selected[0]===`approve`?n=`approve`:c.selected[0]===`deny`&&(n=`deny`)}let c={recordId:a.recordId,decision:n,expectedRevision:a.revision},l=await r.answer(o===void 0?c:{...c,denialNote:o});return t.stillCurrent()?l.kind===`refused`?{kind:`refused`,message:gt(l.reason??`unknown`,n)}:{kind:`answered`}:{kind:`abandoned`}}catch(n){return e.signal.aborted?{kind:`abandoned`}:(t.onFailure(n),{kind:`refused`,message:_t})}}var yt=()=>void 0,bt=()=>()=>void 0;function xt(e){let{source:t,store:n,enabled:r,home:i,width:a,noteLimit:o,onFailure:s}=e,c=(0,U.useRef)(s);c.current=s;let l=(0,U.useRef)({home:i,width:a,noteLimit:o});l.current={home:i,width:a,noteLimit:o};let u=(0,U.useSyncExternalStore)(t?.subscribe??bt,t?.snapshot??yt),d=(0,U.useRef)(u);d.current=u;let f=u===void 0?void 0:JSON.stringify([`approval`,u.record.recordId,u.record.revision,u.canAnswer]);(0,U.useEffect)(()=>{let e=d.current;if(!r||t===void 0||e===void 0||!e.canAnswer||f===void 0)return;let{home:i,width:a,noteLimit:o}=l.current,s=Oe({title:`Approval`}),u=s.begin(),p=()=>{let n=t.snapshot();return!u.interaction.signal.aborted&&n?.record.recordId===e.record.recordId&&n.record.revision===e.record.revision&&n.canAnswer},m=n.awaiting.add({key:f,kind:`approval`,arrivedAt:Date.now(),host:s});return vt(u.interaction,{view:e,source:t,home:i,width:a,now:Date.now(),noteLimit:o,stillCurrent:p,onFailure:e=>{c.current(e)}}).then(e=>{e.kind===`refused`?u.settle({status:`failed`,message:e.message}):(m(),u.settle(e.kind===`answered`?{status:`handled`}:{status:`cancelled`}))}),()=>{m(),s.cancel()}},[t,f,r,n])}var q=fe(e=>Ne.safeParse(e).success,{representation:{id:`@fungi.computer/whistle/catalog-step/v1`,payload:null}});ae(()=>xe());var J=O.pipe(E(k(1)),E(z(4e3)),E(N(/\S/u,{message:`Goal objective is blank`}))),St=O.pipe(E(k(1)),E(z(1e3)),E(N(/\S/u))),Ct=O.pipe(E(k(1)),E(z(256))),wt=F.check(P(0)),Tt=S({kind:R([`person`,`delegator`,`blocked`,`stalled`,`cancelled`,`failed`,`no-terminal`]),detail:B(O)}),Y=S({revision:O,objective:J,state:R([`active`,`paused`]),startedAt:wt,pauseCause:B(Tt)}),Et=S({sequence:F.check(I(0)),objective:J,outcome:R([`achieved`,`cleared`]),reason:B(St),clearedBy:D(ge.check(z(256))),endedAt:wt,afterSequence:F.check(P(0))}),Dt=x([S({action:A(`set`),objective:J,requestId:Ct,expectedRevision:T(B(O)),confirmed:T(L)}),S({action:R([`pause`,`resume`,`replace`,`clear`,`clear-ask`]),confirmed:T(L)}),S({})]),Ot=S({goal:B(Y),ended:M(Et).check(z(16)),omitted:F.check(P(0))}),kt={id:j.make(`botanical-session-goal`),commands:{controlAgent:{scope:`session`,input:S({action:R([`pause`,`resume`,`clear`]),reason:St}),output:x([S({result:A(`paused`),goal:Y}),S({result:A(`resumed`),goal:Y}),S({result:A(`cleared`)}),S({result:A(`no_goal`)}),S({result:A(`refused`),reason:R([`not_delegator`,`not_paused_by_delegator`])})])},goal:{scope:`session`,input:Dt,output:q},pause:{scope:`session`,input:S({}),output:Y},resume:{scope:`session`,input:S({}),output:Y},clear:{scope:`session`,input:S({}),output:S({})},set:{scope:`session`,input:S({objective:J,expectedRevision:B(O),requestId:Ct,adoptCommandId:D(Ct)}),output:S({goal:Y,accepted:S({status:A(`accepted`),commandId:O})})}},projection:{schema:Ot}},X=e=>{let t=e.replace(/\s+/gu,` `).trim();return t.length<=80?t:`${t.slice(0,79)}…`},At=e=>{let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`};function jt(e){let t=e.state===`active`,n=t?`Pursuing goal since ${At(e.startedAt)}`:e.pauseCause?.kind===`delegator`?`Goal paused by ${X(e.pauseCause.detail??`delegator`)} (/goal resume)`:`Goal paused (/goal resume)`,r=!t&&e.pauseCause?.kind!==`delegator`&&e.pauseCause?.detail!=null?[X(e.pauseCause.detail)]:[],i={id:`goal`,title:[n,X(e.objective),...r].join(` · `),tone:t?`running`:`muted`,actions:[{id:`goal`,label:t?`Pause goal`:`Resume goal`,input:{action:t?`pause`:`resume`}}]};return X(e.objective)===e.objective?i:{...i,detail:e.objective.slice(0,1024)}}function Mt(e){let t={id:`goal-ended`,title:`${e.outcome===`achieved`?`Goal achieved`:`Goal cleared`} · ${X(e.objective)}`,tone:e.outcome===`achieved`?`settled`:`muted`},n=e.reason===null?t:{...t,detail:e.reason};return{id:String(e.sequence),sequence:e.sequence,at:e.endedAt,commandId:null,afterSequence:e.afterSequence,rows:[n]}}var Nt=V(kt,{promptPresentation:`footer`,contribute:e=>{if(e.status!==`running`||e.value===null)return{chips:[],panel:[],timeline:{cells:[],omitted:0},waiting:null};let{goal:t,ended:n,omitted:r}=e.value;return{chips:[],panel:t===null?[]:[jt(t)],timeline:{cells:n.map(Mt),omitted:r},waiting:null}}}),Pt=O.pipe(E(k(1)),E(z(256))),Ft=O.pipe(E(k(1)),E(z(262144))),It=S({expression:O.pipe(E(k(1)),E(z(256))),timeZone:O.pipe(E(k(1)),E(z(128)))}),Z=S({loopId:O,origin:R([`human`,`model`]),expiresAt:B(F),prompt:Ft,mode:R([`self_paced`,`fixed_interval`]),cron:B(It),state:R([`active`,`paused`,`finished`,`failed`,`cancelled`]),commandId:O,reason:B(O),nextDueAt:B(F),lastError:B(O),consecutiveFailures:F.pipe(E(P(0)))}),Lt=S({after:D(Pt),limit:D(F.pipe(E(me({minimum:1,maximum:64}))))}),Rt=O.pipe(E(k(1)),E(z(200))),zt=S({loop:Z,accepted:S({status:A(`accepted`),commandId:O})}),Bt=x([S({action:A(`start`),text:Ft,requestId:Rt}),S({action:R([`status`,`pause`,`resume`,`stop`,`stop-ask`,`new`]),confirmed:T(L)}),S({})]),Vt=S({loop:Z}),Ht=S({sessionId:Pt,loopId:Z.fields.loopId}),Ut={id:j.make(`botanical-session-loop`),commands:{list:{scope:`agent`,input:Lt,output:M(S({...Z.fields,sessionId:Pt})).pipe(E(z(64)))},pauseLoop:{scope:`agent`,input:Ht,output:Z},resumeLoop:{scope:`agent`,input:Ht,output:Z},stopLoop:{scope:`agent`,input:Ht,output:Z},loop:{scope:`session`,input:Bt,output:q},startSelfPaced:{scope:`session`,input:S({prompt:Ft,requestId:Rt}),output:zt},startFixedInterval:{scope:`session`,input:S({prompt:Ft,requestId:Rt,...It.fields}),output:zt},pause:{scope:`session`,input:S({}),output:Z},resume:{scope:`session`,input:S({}),output:Z},stop:{scope:`session`,input:S({}),output:Z}},projection:{schema:Vt}},Wt=e=>{let t=e.replace(/\s+/gu,` `).trim();return t.length<=60?t:`${t.slice(0,59)}…`},Gt=e=>e.state===`failed`?`error`:e.state===`active`?`running`:e.state===`paused`?`muted`:`settled`,Kt=e=>new Intl.DateTimeFormat(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,timeZoneName:`short`}).format(e),qt=V(Ut,{promptPresentation:`footer`,contribute:e=>{if(e.status!==`running`||e.value===null)return{chips:[],panel:[],timeline:{cells:[],omitted:0},waiting:null};let{loop:t}=e.value,n=t.state===`active`&&t.nextDueAt!==null;return{chips:t.state!==`active`&&t.state!==`paused`?[]:[{id:`loop`,order:2,row:{id:`loop`,title:`Loop ${t.mode===`self_paced`?`self-paced`:`fixed`}${n?` (waiting)`:``}`,tone:Gt(t)}}],panel:[{id:`loop`,title:`Loop · ${t.state} · ${t.mode===`self_paced`?`self-paced`:`${t.cron?.expression??`fixed`} ${t.cron?.timeZone??``}`}${t.nextDueAt===null?``:` · Next ${Kt(t.nextDueAt)}`} · ${Wt(t.prompt)}`,detail:[t.reason,t.prompt].filter(e=>e!==null).join(`
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ai as t,Ar as n,Di as r,E as i,Ir as a,Mr as o,Nr as s,Pr as c,an as l,c as u,g as d,hi as f,jr as p,u as m,vr as h,wr as ee}from"./sigil-BXHhK83J.js";import{Ea as g,Ta as te,Zi as _,_a as v,ar as y,ba as ne,da as re,fa as ie,ht as ae,ra as oe,sr as se,xa as b,ya as ce}from"./Effect-CsknxyoC.js";import{Ai as x,Bi as le,Ci as S,Dr as ue,Hi as C,Ji as w,Ma as de,Na as T,Ni as E,Pa as D,Pi as fe,Si as O,Ta as k,Wi as pe,Zi as me,_a as he,_i as ge,bi as _e,fi as A,i as j,ii as M,ji as ve,ka as N,kr as ye,la as P,li as F,oa as I,oi as L,pa as be,pi as R,ri as xe,ti as Se,ui as Ce,xa as z,xi as we,yi as B}from"./extension-hook-ClRCT16F.js";import{a as Te,c as Ee,d as V,i as De,l as Oe,n as ke,o as Ae,r as je,s as Me,u as Ne}from"./parakeet-B5vLIC08.js";import{_ as Pe,g as H,h as Fe,m as Ie,p as Le,t as Re,v as ze,y as Be}from"./index-C4RcjDMM.js";var U=e(t(),1),W=f(),G=O.check(k(1),z(256)),Ve=F.check(P(1),he(2**53-1)),He=F.check(P(0),he(2**53-1)),Ue=R([`write`,`external`]),We=S({module:B(G),access:Ue}),Ge=S({agentId:B(G)}),Ke=S({principalId:G,agentId:B(G),sessionId:B(G),displayName:G}),qe=S({title:O.check(k(1),z(512)),inputBytes:F.check(P(0)),inputSha256:O.check(N(/^[a-f0-9]{64}$/))}),Je=S({kind:A(`pending_approval`),recordId:G,description:qe}),Ye=R([`requested`,`pending`,`approved`,`claimed`,`applied`,`denied`,`expired`,`outcome_unknown`]),Xe=R([`not-found`,`not-eligible`,`already-answered`,`stale-revision`,`expired`,`declined`,`fenced`,`not-granted`,`read-only`,`pending`,`in-flight`,`outcome-unknown`,`identity-conflict`]),Ze=O.check(k(1),z(512),N(/^(?=.*\S)[^\p{Cc}\u2028\u2029]*$/u)),Qe=M(S({kind:A(`artifact`),ref:O.check(N(/^sha256:[a-f0-9]{64}$/)),mediaType:A(`image/png`),bytes:F.check(P(1),he(5242880))})).check(z(4)),$e=S({recordId:G,requester:Ke,module:G,operation:G,access:Ue,description:qe,evidence:D(Qe),authorityFence:G,reversibility:R([`reversible`,`irreversible-external`]),state:Ye,by:B(x([S({kind:A(`human`),memberId:G}),S({kind:A(`policy`)})])),reason:B(Xe),denialNote:D(Ze),requestedAt:He,expiresAt:He,updatedAt:He,revision:Ve}),et=S({record:$e,canAnswer:L,canSetAutoApprove:L});S({state:D(Ye),cursor:D(G),limit:D(F.check(P(1),he(100)))}),S({recordId:G}),S({recordId:G,decision:R([`approve`,`deny`]),expectedRevision:Ve,denialNote:D(Ze)});var tt=S({scope:Ge,family:We,enabled:L}),nt=S({kind:A(`refused`),reason:Xe,denialNote:D(Ze)});C(w($e),{onExcessProperty:`error`}),pe(w($e)),C(S({record_json:O})),C(w(Ce)),pe(w(Ce)),C(S({input_json:O,output_json:B(O)}));var rt=nt,it=S({items:M(et),nextCursor:B(O)}),at=x([S({kind:A(`answered`),view:et}),rt]),ot=x([S({kind:A(`updated`),rule:tt}),rt]),K=e=>Ie(te().transform(t=>C(e,{onExcessProperty:`error`})(t))),st=ze(`approvals`,1,ie(()=>Fe({list:H(K(it)),get:H(K(B(et))),answer:H(K(at)),setAutoApprove:H(K(ot))}))),ct=(e,t)=>{if(e.length<=t)return e;let n=Math.max(1,Math.floor((t-1)/2));return`${e.slice(0,n)}…${e.slice(-(t-n-1))}`},lt=(e,t)=>e.length<=t?e:`${e.slice(0,t-1)}…`,ut=e=>e.map(([e,t])=>({label:e,value:t}));function dt(e,t){let{record:n}=e,r=Math.max(0,n.expiresAt-t);return[[`Agent`,`${n.requester.displayName} · ${n.requester.agentId??`none`}`],[`Session`,n.requester.sessionId??`none`],[`Requester`,n.requester.principalId],[`Request`,`${n.module}.${n.operation} · ${n.access}`],[`Input`,`${n.description.inputBytes.toLocaleString()} bytes · SHA-256 ${n.description.inputSha256.slice(0,8)}…${n.description.inputSha256.slice(-6)}`],[`Expires`,`in ${String(Math.floor(r/36e5))} h ${String(Math.floor(r%36e5/6e4))} m`],[`Record`,`${n.recordId} · revision ${String(n.revision)}`]]}function ft(e){return[`Undo`,e.record.reversibility===`irreversible-external`?`Can't be undone`:`Can be undone`]}function pt(e,t){let{record:n}=e;return{content:{title:`Allow ${n.module} · ${n.operation}?`,summary:`${n.requester.displayName} wants to use a connected tool.`,facts:[{label:`Effect`,value:(n.access===`write`?`Changes data in Fungi`:`Changes things outside Fungi`)+(n.reversibility===`irreversible-external`?` · can't be undone`:``)}],details:ut([ft(e),...dt(e,t)])}}}function mt(e,t,n,r,i){let a=t.prefix?.join(` `),o=a!==void 0&&t.alwaysAllowUnavailableReason===void 0,s=t.command,c=`Allow \`${s}\`?`.length<=n?`Allow \`${s}\`?`:`Allow this command?`,l=t.cwd===r?`~`:t.cwd.startsWith(`${r}/`)?`~${t.cwd.slice(r.length)}`:t.cwd,u=Math.max(8,(n-8)*2-2),d=t.justification.length<=u?`“${t.justification}”`:`“${t.justification.slice(0,u-1)}…”`,f=[[`Folder`,ct(l,Math.max(8,n-10))],[`Why`,d]];t.kind===`extension-install`&&f.push([`Note`,`Extensions run inside Fungi with access to every Agent.`]),o&&t.alwaysAllowCoverage!==void 0&&f.push([`Scope`,lt(t.alwaysAllowCoverage,Math.max(8,n-12))]),!o&&t.warning!==void 0&&f.push([`Warning`,t.warning]);let p=o?`Always allow “${ct(a,Math.max(8,n-5-32))}” in this project…`:void 0,m=[[`Command`,s]];return t.argv!==void 0&&m.push([`Arguments`,JSON.stringify(t.argv)]),m.push([`Folder`,t.cwd],[`Runs`,`Outside the sandbox, as you`],ft(e)),!o&&t.alwaysAllowUnavailableReason!==void 0?m.push([`Rule`,t.alwaysAllowUnavailableReason]):t.form===`shell`?m.push([`Rule`,`Shell command: no Always-allow rule can match it.`]):o&&(m.push([`Rule`,`“${a}” would match \`${a} …\` in this project`]),t.alwaysAllowCoverage!==void 0&&m.push([`Coverage`,t.alwaysAllowCoverage]),t.risk!==void 0&&m.push([`Risk`,t.risk.detail])),!o&&t.warning!==void 0&&m.push([`Warning`,t.warning]),m.push(...dt(e,i)),{content:{title:c,body:c===`Allow this command?`?s:void 0,bodyLabel:c===`Allow this command?`?`Command`:void 0,summary:`${e.record.requester.displayName} wants to run this outside the sandbox, as you.`,facts:ut(f),details:ut(m)},always:p===void 0?void 0:lt(p,Math.max(12,n-5)),confirmation:o?{title:`Always allow “${a}” in this project?`,body:lt(t.alwaysAllowCoverage??`Any Workspace Agent here can then run \`${a} …\` without asking.`,Math.max(12,(n-8)*2-2))}:void 0,confirmWarning:o?t.risk?.summary:void 0,confirmYes:o?`Always allow “${a}” and run it now`:void 0}}function ht(e,t,n){let r=Math.min(n.width,60);return t===void 0?pt(e,n.now):mt(e,t,r,n.home,n.now)}function gt(e,t){switch(e){case`stale-revision`:case`already-answered`:return`This request changed. Look again before answering.`;case`expired`:return`This request expired. Nothing ran.`;case`not-eligible`:if(t===`always-allow`)return`Always allow isn't available for this command. Approve once or deny.`}return`Couldn't answer (${e}). Nothing ran.`}var _t=`Couldn't send your answer. It may not have been recorded.`;async function vt(e,t){let{view:n,source:r}=t,i=ht(n,r.review,{width:t.width,home:t.home,now:t.now}),a=n.record;try{let n,o,s=!1;for(;n===void 0;){let c=await e.prompt({type:`decision`,message:i.content.title,summary:s?`Automatic approval is on for this family.`:i.content.summary,facts:i.content.facts?.map(e=>({...e})),body:i.content.body,bodyLabel:i.content.bodyLabel,details:i.content.details?.map(e=>({...e})),options:[{value:`approve`,label:`Approve once`},...i.always===void 0?[]:[{value:`always`,label:i.always}],...r.family===void 0||s?[]:[{value:`family`,label:r.family.label}],{value:`deny`,label:`Deny`}],other:{label:`Deny and say why…`,placeholder:`A short reason for the Agent (optional)`,maxLength:t.noteLimit,blank:`deny`}});if(!t.stillCurrent())return{kind:`abandoned`};if(c.text!==void 0)o=c.text.trim()||void 0,n=`deny`;else if(c.selected[0]===`always`){let r=i.confirmation,a=await e.prompt({type:`decision`,message:r?.title??i.content.title,summary:i.confirmWarning,body:r?.body,options:[{value:`back`,label:`Back`},{value:`always-allow`,label:i.confirmYes??`Always allow`}],escape:`back`});if(!t.stillCurrent())return{kind:`abandoned`};a.selected[0]===`always-allow`&&(n=`always-allow`)}else if(c.selected[0]===`family`&&r.family!==void 0){let n=await e.prompt({type:`decision`,message:`${r.family.label}?`,summary:`Later ${a.module} requests that ${a.access===`write`?`change data in Fungi`:`reach outside Fungi`} will run without asking.`,options:[{value:`back`,label:`Back`},{value:`family`,label:r.family.label}],escape:`back`});if(!t.stillCurrent()||n.selected[0]===`family`&&(s=await r.family.enable(),!t.stillCurrent()))return{kind:`abandoned`}}else c.selected[0]===`approve`?n=`approve`:c.selected[0]===`deny`&&(n=`deny`)}let c={recordId:a.recordId,decision:n,expectedRevision:a.revision},l=await r.answer(o===void 0?c:{...c,denialNote:o});return t.stillCurrent()?l.kind===`refused`?{kind:`refused`,message:gt(l.reason??`unknown`,n)}:{kind:`answered`}:{kind:`abandoned`}}catch(n){return e.signal.aborted?{kind:`abandoned`}:(t.onFailure(n),{kind:`refused`,message:_t})}}var yt=()=>void 0,bt=()=>()=>void 0;function xt(e){let{source:t,store:n,enabled:r,home:i,width:a,noteLimit:o,onFailure:s}=e,c=(0,U.useRef)(s);c.current=s;let l=(0,U.useRef)({home:i,width:a,noteLimit:o});l.current={home:i,width:a,noteLimit:o};let u=(0,U.useSyncExternalStore)(t?.subscribe??bt,t?.snapshot??yt),d=(0,U.useRef)(u);d.current=u;let f=u===void 0?void 0:JSON.stringify([`approval`,u.record.recordId,u.record.revision,u.canAnswer]);(0,U.useEffect)(()=>{let e=d.current;if(!r||t===void 0||e===void 0||!e.canAnswer||f===void 0)return;let{home:i,width:a,noteLimit:o}=l.current,s=Oe({title:`Approval`}),u=s.begin(),p=()=>{let n=t.snapshot();return!u.interaction.signal.aborted&&n?.record.recordId===e.record.recordId&&n.record.revision===e.record.revision&&n.canAnswer},m=n.awaiting.add({key:f,kind:`approval`,arrivedAt:Date.now(),host:s});return vt(u.interaction,{view:e,source:t,home:i,width:a,now:Date.now(),noteLimit:o,stillCurrent:p,onFailure:e=>{c.current(e)}}).then(e=>{e.kind===`refused`?u.settle({status:`failed`,message:e.message}):(m(),u.settle(e.kind===`answered`?{status:`handled`}:{status:`cancelled`}))}),()=>{m(),s.cancel()}},[t,f,r,n])}var q=fe(e=>Ne.safeParse(e).success,{representation:{id:`@fungi.computer/whistle/catalog-step/v1`,payload:null}});ae(()=>xe());var J=O.pipe(E(k(1)),E(z(4e3)),E(N(/\S/u,{message:`Goal objective is blank`}))),St=O.pipe(E(k(1)),E(z(1e3)),E(N(/\S/u))),Ct=O.pipe(E(k(1)),E(z(256))),wt=F.check(P(0)),Tt=S({kind:R([`person`,`delegator`,`blocked`,`stalled`,`cancelled`,`failed`,`no-terminal`]),detail:B(O)}),Y=S({revision:O,objective:J,state:R([`active`,`paused`]),startedAt:wt,pauseCause:B(Tt)}),Et=S({sequence:F.check(I(0)),objective:J,outcome:R([`achieved`,`cleared`]),reason:B(St),clearedBy:D(ge.check(z(256))),endedAt:wt,afterSequence:F.check(P(0))}),Dt=x([S({action:A(`set`),objective:J,requestId:Ct,expectedRevision:T(B(O)),confirmed:T(L)}),S({action:R([`pause`,`resume`,`replace`,`clear`,`clear-ask`]),confirmed:T(L)}),S({})]),Ot=S({goal:B(Y),ended:M(Et).check(z(16)),omitted:F.check(P(0))}),kt={id:j.make(`botanical-session-goal`),commands:{controlAgent:{scope:`session`,input:S({action:R([`pause`,`resume`,`clear`]),reason:St}),output:x([S({result:A(`paused`),goal:Y}),S({result:A(`resumed`),goal:Y}),S({result:A(`cleared`)}),S({result:A(`no_goal`)}),S({result:A(`refused`),reason:R([`not_delegator`,`not_paused_by_delegator`])})])},goal:{scope:`session`,input:Dt,output:q},pause:{scope:`session`,input:S({}),output:Y},resume:{scope:`session`,input:S({}),output:Y},clear:{scope:`session`,input:S({}),output:S({})},set:{scope:`session`,input:S({objective:J,expectedRevision:B(O),requestId:Ct,adoptCommandId:D(Ct)}),output:S({goal:Y,accepted:S({status:A(`accepted`),commandId:O})})}},projection:{schema:Ot}},X=e=>{let t=e.replace(/\s+/gu,` `).trim();return t.length<=80?t:`${t.slice(0,79)}…`},At=e=>{let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`};function jt(e){let t=e.state===`active`,n=t?`Pursuing goal since ${At(e.startedAt)}`:e.pauseCause?.kind===`delegator`?`Goal paused by ${X(e.pauseCause.detail??`delegator`)} (/goal resume)`:`Goal paused (/goal resume)`,r=!t&&e.pauseCause?.kind!==`delegator`&&e.pauseCause?.detail!=null?[X(e.pauseCause.detail)]:[],i={id:`goal`,title:[n,X(e.objective),...r].join(` · `),tone:t?`running`:`muted`,actions:[{id:`goal`,label:t?`Pause goal`:`Resume goal`,input:{action:t?`pause`:`resume`}}]};return X(e.objective)===e.objective?i:{...i,detail:e.objective.slice(0,1024)}}function Mt(e){let t={id:`goal-ended`,title:`${e.outcome===`achieved`?`Goal achieved`:`Goal cleared`} · ${X(e.objective)}`,tone:e.outcome===`achieved`?`settled`:`muted`},n=e.reason===null?t:{...t,detail:e.reason};return{id:String(e.sequence),sequence:e.sequence,at:e.endedAt,commandId:null,afterSequence:e.afterSequence,rows:[n]}}var Nt=V(kt,{promptPresentation:`footer`,contribute:e=>{if(e.status!==`running`||e.value===null)return{chips:[],panel:[],timeline:{cells:[],omitted:0},waiting:null};let{goal:t,ended:n,omitted:r}=e.value;return{chips:[],panel:t===null?[]:[jt(t)],timeline:{cells:n.map(Mt),omitted:r},waiting:null}}}),Pt=O.pipe(E(k(1)),E(z(256))),Ft=O.pipe(E(k(1)),E(z(262144))),It=S({expression:O.pipe(E(k(1)),E(z(256))),timeZone:O.pipe(E(k(1)),E(z(128)))}),Z=S({loopId:O,origin:R([`human`,`model`]),expiresAt:B(F),prompt:Ft,mode:R([`self_paced`,`fixed_interval`]),cron:B(It),state:R([`active`,`paused`,`finished`,`failed`,`cancelled`]),commandId:O,reason:B(O),nextDueAt:B(F),lastError:B(O),consecutiveFailures:F.pipe(E(P(0)))}),Lt=S({after:D(Pt),limit:D(F.pipe(E(me({minimum:1,maximum:64}))))}),Rt=O.pipe(E(k(1)),E(z(200))),zt=S({loop:Z,accepted:S({status:A(`accepted`),commandId:O})}),Bt=x([S({action:A(`start`),text:Ft,requestId:Rt}),S({action:R([`status`,`pause`,`resume`,`stop`,`stop-ask`,`new`]),confirmed:T(L)}),S({})]),Vt=S({loop:Z}),Ht=S({sessionId:Pt,loopId:Z.fields.loopId}),Ut={id:j.make(`botanical-session-loop`),commands:{list:{scope:`agent`,input:Lt,output:M(S({...Z.fields,sessionId:Pt})).pipe(E(z(64)))},pauseLoop:{scope:`agent`,input:Ht,output:Z},resumeLoop:{scope:`agent`,input:Ht,output:Z},stopLoop:{scope:`agent`,input:Ht,output:Z},loop:{scope:`session`,input:Bt,output:q},startSelfPaced:{scope:`session`,input:S({prompt:Ft,requestId:Rt}),output:zt},startFixedInterval:{scope:`session`,input:S({prompt:Ft,requestId:Rt,...It.fields}),output:zt},pause:{scope:`session`,input:S({}),output:Z},resume:{scope:`session`,input:S({}),output:Z},stop:{scope:`session`,input:S({}),output:Z}},projection:{schema:Vt}},Wt=e=>{let t=e.replace(/\s+/gu,` `).trim();return t.length<=60?t:`${t.slice(0,59)}…`},Gt=e=>e.state===`failed`?`error`:e.state===`active`?`running`:e.state===`paused`?`muted`:`settled`,Kt=e=>new Intl.DateTimeFormat(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,timeZoneName:`short`}).format(e),qt=V(Ut,{promptPresentation:`footer`,contribute:e=>{if(e.status!==`running`||e.value===null)return{chips:[],panel:[],timeline:{cells:[],omitted:0},waiting:null};let{loop:t}=e.value,n=t.state===`active`&&t.nextDueAt!==null;return{chips:t.state!==`active`&&t.state!==`paused`?[]:[{id:`loop`,order:2,row:{id:`loop`,title:`Loop ${t.mode===`self_paced`?`self-paced`:`fixed`}${n?` (waiting)`:``}`,tone:Gt(t)}}],panel:[{id:`loop`,title:`Loop · ${t.state} · ${t.mode===`self_paced`?`self-paced`:`${t.cron?.expression??`fixed`} ${t.cron?.timeZone??``}`}${t.nextDueAt===null?``:` · Next ${Kt(t.nextDueAt)}`} · ${Wt(t.prompt)}`,detail:[t.reason,t.prompt].filter(e=>e!==null).join(`
2
2
  `).slice(0,1024),tone:Gt(t)},...t.lastError===null?[]:[{id:`error`,title:t.lastError.slice(0,4096),tone:`error`}]],timeline:{cells:[],omitted:0},waiting:n?{summary:`Waiting until ${Kt(t.nextDueAt)}`,cancel:{id:`loop`,label:`stop loop`,input:{action:`stop-ask`}}}:null}}});function Jt(e){return S({nextSequence:F.check(I(0)),omitted:F.check(P(0)),events:M(S({id:O,sequence:F,at:F,commandId:B(O),event:e}))})}new TextEncoder;var Yt=S({explanation:D(O.pipe(E(z(2e3)))),steps:M(S({step:O.pipe(E(k(1)),E(z(500))),status:R([`pending`,`in_progress`,`completed`])})).pipe(E(z(50)))});Yt.pipe(E(de(e=>e.steps.filter(e=>e.status===`in_progress`).length<=1||`At most one plan step may be in progress`)));function Xt(e){return e.steps.some(e=>e.status!==`completed`)}var Zt=S({plan:Yt,history:Jt(Yt)}),Qt=x([S({action:A(`clear`)}),S({})]),$t={id:j.make(`botanical-session-plan`),commands:{plan:{scope:`session`,input:Qt,output:q}},projection:{schema:Zt}},en=e=>{let t=e.steps.findIndex(e=>e.status===`in_progress`),n=e.steps.filter(e=>e.status===`completed`).length;return{title:(t<0?e.steps.find(e=>e.status===`pending`):e.steps[t])?.step??`Plan complete`,detail:`${String(t<0?n:t+1)}/${String(e.steps.length)}`}},tn=e=>e.steps.map((e,t)=>({id:String(t),title:e.step,tone:e.status===`completed`?`settled`:e.status===`in_progress`?`running`:`muted`})),nn=V($t,{contribute:e=>({chips:[],panel:e.status!==`running`||e.value===null||!Xt(e.value.plan)?[]:[{id:`plan`,...en(e.value.plan),actions:[{id:`plan`,label:`Clear plan`,input:{action:`clear`}}],inspection:{commandId:`plan`,title:`Plan`,rows:tn(e.value.plan)}}],timeline:{cells:[],omitted:0},waiting:null})}),Q=e=>O.check(k(1),z(e),N(/\S/u)),rn=S({id:Q(32).check(N(/^[a-z][a-z0-9]*(?:[-_.][a-z0-9]+)*$/u)),header:Q(12),question:Q(1e3),options:M(S({label:Q(60),description:Q(300)})).check(k(2),z(4),de(e=>new Set(e.map(e=>e.label)).size===e.length||`Option labels must be unique`,{representation:{id:`botanical/ask/unique-option-labels`,payload:null}})),multiple:D(L)}),an=M(rn).check(k(1),z(4),de(e=>new Set(e.map(e=>e.id)).size===e.length||`Question ids must be unique`,{representation:{id:`botanical/ask/unique-question-ids`,payload:null}})),on=S({askId:O,waitingOn:D(ye),escalated:D(ue),questions:an,status:R([`live`,`parked`]),createdAt:_e,expiresAt:B(_e)}),sn=S({asks:M(on).check(z(4))}),cn=Q(256),ln=we(rn.fields.id,S({selected:M(Q(60)).check(z(4)),text:D(O.check(z(4e3)))})),un=S({askId:Q(256),requestId:cn,answers:ln}),dn=S({askId:Q(256),requestId:cn,note:D(O.check(z(4e3)))}),fn=R([`answered`,`declined`,`withdrawn`,`expired`,`cancelled`,`undeliverable`]),pn=x([S({result:A(`accepted`),via:R([`in_turn`,`follow_up`]),commandId:D(Q(256))}),S({result:A(`closed`),status:fn}),S({result:A(`not_found`)})]),mn=S({result:A(`refused`),reason:A(`not_sender`)}),hn=x([pn,mn]),gn=S({kind:A(`agent`),agentId:Q(256)}),_n=x([S({result:A(`escalated`),to:A(`agent`),waitingOn:ye}),S({result:A(`escalated`),to:A(`person`)}),S({result:A(`closed`),status:fn}),S({result:A(`not_found`)}),mn]),vn=S({askId:Q(256),note:T(O.check(z(1e3)))}),yn={askId:un.fields.askId,requestId:cn,index:_e.check(be(),me({minimum:0,maximum:3})),answers:ln},bn=x([S({stage:A(`decision`),...yn,answer:ln.value}),S({askId:un.fields.askId}),S({})]),xn={id:j.make(`botanical-session-question`),commands:{answerFlow:{scope:`session`,input:bn,output:q},answer:{scope:`session`,input:un,output:pn},answerAgent:{scope:`session`,input:un,output:S({result:hn,answeredBy:gn})},escalateAgent:{scope:`session`,input:vn,output:_n},decline:{scope:`session`,input:dn,output:pn},list:{scope:`session`,input:S({}),output:sn}},projection:{schema:sn}},Sn=V(xn,{contribute:e=>({chips:[],panel:e.status!==`running`||e.value===null?[]:e.value.asks.map(e=>{let t=e.questions[0],n=`${t?.question??`Question`}${e.questions.length>1?` (+${String(e.questions.length-1)} more)`:``}`,r=t?.options.map(e=>e.label).join(` · `)??``;if(e.escalated!==void 0){let{by:t,reason:i,note:a}=e.escalated;n=`${i===`escalated`?`escalated by ${t.name}`:i===`sender_archived`?`${t.name} archived`:`${t.name} is gone`} · ${n}`,a!==void 0&&(r=`${r}\n${a}`)}return e.waitingOn===void 0?{id:e.askId,title:n,detail:r,tone:`attention`,actions:[{id:`answerFlow`,label:`Answer`,input:{askId:e.askId},awaiting:`question`}]}:{id:e.askId,title:`waiting on ${e.waitingOn.name} · ${n}`,detail:r,tone:`muted`,actions:[{id:`answerFlow`,label:`Answer`,input:{askId:e.askId}}]}}),timeline:{cells:[],omitted:0},waiting:null})}),$=O.check(k(1),z(256)),Cn=R([`escalated`,`sender_archived`,`sender_absent`]),wn=R([`working`,`waiting_on_agent`,`needs_you`,`idle`,`failed`,`unavailable`]),Tn=S({agentId:$,name:$,sessionId:B($),state:wn,attention:D(O.check(z(200))),waitingOn:D($),escalated:D(S({by:$,reason:Cn})),ask:D(S({askId:$,questions:an}))}),En=S({agents:M(Tn).check(z(16)),more:F.check(P(0)),uncounted:F.check(P(0)),counts:S({working:F.check(P(0)),waiting_on_agent:F.check(P(0)),needs_you:F.check(P(0)),idle:F.check(P(0)),failed:F.check(P(0)),unavailable:F.check(P(0))}),escalated:F.check(P(0)),waitingOn:M(S({name:$,count:F.check(I(0))})),escalatedBy:M(S({name:$,reason:Cn,count:F.check(I(0))})),expanded:L}),Dn={agentId:$,sessionId:$},On=x(bn.members.map(e=>S({...e.fields,...Dn}))),kn={agents:{scope:`session`,input:S({}),output:q},answerChild:{scope:`session`,input:On,output:q}},An={id:j.make(`botanical-session-subagents`),commands:kn,projection:{schema:En}};function jn(e){if(e!==void 0)return e.reason===`escalated`?`escalated by ${e.by}`:e.reason===`sender_archived`?`${e.by} archived`:`${e.by} is gone`}var Mn={working:{label:`working`,tone:`running`,status:`info`},waiting_on_agent:{label:`waiting`,tone:`muted`,status:`neutral`},needs_you:{label:`needs you`,tone:`attention`,status:`warning`},idle:{label:`idle`,tone:`settled`,status:`success`},failed:{label:`failed`,tone:`error`,status:`error`},unavailable:{label:`unavailable`,tone:`muted`,status:`neutral`}};function Nn(e){let t=e.state===`waiting_on_agent`?`waiting on ${e.waitingOn??`its parent`}`:Mn[e.state].label,n=jn(e.escalated);return n===void 0?t:`${t} · ${n}`}function Pn(e){let t=Mn[e.state],n={id:e.agentId,title:`${e.name} · ${Nn(e)}`,tone:t.tone,status:{label:Nn(e),tone:t.status}},r=e.ask?.questions[0]?.question??e.attention,i=r===void 0?n:{...n,detail:r.slice(0,200)};if(e.sessionId===null)return{...i,detail:e.attention??`not messaged yet`};let a={...i,open:{params:[{key:`agent`,value:e.agentId},{key:`session`,value:e.sessionId}]}};if(e.ask===void 0)return a;let o={id:`answerChild`,label:`Answer`,input:{agentId:e.agentId,sessionId:e.sessionId,askId:e.ask.askId}};return{...a,actions:[e.state===`needs_you`?{...o,awaiting:`question`}:o]}}function Fn(e){let t=t=>e.counts[t],n=e.waitingOn.map(({name:e,count:t})=>`${String(t)} waiting on ${e}`),r=e.escalatedBy.map(({name:n,reason:r,count:i})=>{let a=jn({by:n,reason:r});return e.escalated===t(`needs_you`)&&e.escalatedBy.length===1?a:`${String(i)} ${a}`}),i=r.length===0?`needs you`:`needs you (${r.join(`; `)})`,a=[...[`working`].map(e=>[e,t(e)]).filter(([,e])=>e>0).map(([e,t])=>`${String(t)} ${Mn[e].label}`),...n,...[`needs_you`,`failed`,`unavailable`].map(e=>[e,t(e)]).filter(([,e])=>e>0).map(([e,t])=>`${String(t)} ${e===`needs_you`?i:Mn[e].label}`)],o=t(`working`)+t(`needs_you`),s=t(`needs_you`)>0?`attention`:t(`failed`)>0?`error`:t(`working`)>0?`running`:`muted`;return{id:`summary`,title:[`${String(o)} sub-agent${o===1?``:`s`}`,...a,...e.uncounted>0?[`${String(e.uncounted)} not read`]:[],`/agents shows them`].join(` · `),tone:s}}var In=V(An,{contribute:e=>({chips:[],panel:e.status!==`running`||e.value===null?[]:e.value.agents.length>0&&!e.value.expanded?[Fn(e.value)]:[...e.value.agents.map(Pn),...e.value.more===0&&e.value.uncounted===0?[]:[{id:`more`,title:[...e.value.more===0?[]:[`${String(e.value.more)} more sub-agent${e.value.more===1?``:`s`}`],...e.value.uncounted===0?[]:[`${String(e.value.uncounted)} not read`]].join(` · `),tone:`muted`}]],timeline:{cells:[],omitted:0},waiting:null})});function Ln(e,t){if(e===null||!URL.canParse(t))return!1;let n=new URL(t);return n.protocol!==`https:`||n.hash!==`#team-billing`?!1:(e.openTeamBilling().catch(t=>(console.error(`Chat Billing navigation failed`,t),e.showToast({message:`Billing could not be opened. Please try again.`,tone:`error`}))),!0)}function Rn(e,t){e!==null&&e.showToast({message:t.message,tone:t.variant}).catch(e=>{console.error(`Chat toast failed`,e)})}function zn(e){if(e.name!==`execute`||e.status!==`completed`)return;let t=e.result?.content;if(t?.length!==1||t[0]?.type!==`text`)return;let n=le(w(ve))(t[0].text);if(y(n))return;let r=l.safeParse(n.value);return r.success?r.data.file:void 0}function Bn({item:e,ui:t}){let n=zn(e),[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(!1);if(!n)return null;let s=async()=>{i(!0),o(!1);try{await t.openNavigation(n)}catch(e){console.error(`Chat file navigation failed`,e),o(!0)}finally{i(!1)}};return(0,W.jsxs)(`div`,{className:`px-3 py-2`,children:[(0,W.jsx)(h,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void s(),type:`button`,children:r?`Opening file…`:`Open ${n.path} in Inkcap`}),a?(0,W.jsx)(`p`,{role:`alert`,children:`The file could not be opened. Try again.`}):null]})}var Vn=x([S({kind:A(`compose`),text:O.pipe(E(k(1)),E(z(2e3)))}),S({kind:A(`navigate`),params:M(S({key:O.pipe(E(k(1)),E(z(64))),value:O.pipe(E(z(1024)))})).pipe(E(z(16)))})]);x([S({role:O.pipe(E(k(1)),E(z(80))),intent:Vn}),S({appId:O.pipe(E(k(1)),E(z(128))),intent:Vn})],{mode:`oneOf`});var Hn=ne({displayName:b().min(1).max(80).nullable()}).nullable(),Un=ze(`apps.open`,1,ie(()=>Fe({open:Pe,role:H(Ie(Hn))}))),Wn=(e,t)=>e.require(Un).open(t);ze(`apps.call`,1,ie(()=>Fe({call:H(Ie(te().transform(e=>r(e))))})));var Gn=v({printId:b().min(1).max(256),destination:ne({computerId:b().min(1),path:b().min(1)}),format:_([`png`,`jpeg`,`gif`,`webp`])}),Kn=re(),qn=oe(Kn).or(ce(b(),Kn).transform(e=>Object.values(e)));function Jn(e,t){let n=Gn.safeParse(e);if(n.success)return[n.data];if(t>=3)return[];let r=qn.safeParse(e);return r.success?r.data.flatMap(e=>Jn(e,t+1)):[]}var Yn=Kn.transform(e=>Jn(e,0)).pipe(oe(Gn).min(1).max(8));function Xn(e){if(e.name!==`execute`||e.status!==`completed`||e.result===void 0)return;let t=e.result.content,n=t.at(0);if(n?.type!==`text`||t.slice(1).some(e=>e.type!==`image`))return;let r=le(w(ve))(n.text);if(y(r))return;let i=Yn.safeParse(r.value);return i.success?i.data:void 0}function Zn(e){return Xn(e)!==void 0}function Qn({printId:e,pictures:t,capabilities:n}){let[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(!1),s=async()=>{i(!0),o(!1);try{await Wn(n,{role:`media`,intent:{kind:`navigate`,params:[{key:`print`,value:e}]}})}catch(e){console.error(`Chat print navigation failed`,e),o(!0)}finally{i(!1)}};return(0,W.jsxs)(`div`,{className:`flex flex-col items-start gap-2 px-3 py-2`,children:[t.map((e,t)=>(0,W.jsx)(`img`,{alt:`Panel saved in Prints`,className:`max-w-full rounded-box`,src:`data:${e.mimeType};base64,${e.data}`,style:{maxHeight:320}},t)),(0,W.jsx)(h,{variant:`outline`,size:`sm`,disabled:r,onClick:()=>void s(),type:`button`,children:r?`Opening Prints…`:`Open in Prints`}),a?(0,W.jsx)(`p`,{role:`alert`,children:`Prints could not be opened. Try again.`}):null]})}function $n({item:e,capabilities:t}){let n=Xn(e);if(n&&t){let r=(e.result?.content??[]).flatMap(e=>e.type===`image`?[e]:[]),i=r.length===n.length;return(0,W.jsx)(W.Fragment,{children:n.map((e,n)=>(0,W.jsx)(Qn,{printId:e.printId,pictures:i?r.slice(n,n+1):n===0?r:[],capabilities:t},e.printId))})}return null}var er=le(w(Je),{onExcessProperty:`error`});function tr(e){if(!(e.status!==`completed`||e.result?.isError))for(let t of e.result?.content??[]){if(t.type!==`text`)continue;let e=er(t.text);if(se(e))return e.value.recordId}}var nr=(0,U.createContext)(void 0);function rr(){return(0,U.useContext)(nr)}var ir=`Couldn't send your answer. It may not have been recorded.`;function ar({recordId:e,attempt:t,capabilities:n,agentId:r,publish:i}){let a=Me(),[o,s]=(0,U.useState)(),c=(0,U.useRef)(void 0),l=(0,U.useRef)(new Set),u=(0,U.useCallback)(t=>{c.current=t??void 0,s(t),i(e,{view:t,failed:!1});for(let e of l.current)e()},[i,e]);(0,U.useEffect)(()=>{c.current=void 0,s(void 0)},[n]),(0,U.useEffect)(()=>{let t=!0;async function r(){try{let r=await n.require(st).get({recordId:e});t&&u(r)}catch(n){console.warn(`Grove could not read the approval`,n),t&&i(e,{view:null,failed:!0})}}return r(),()=>{t=!1}},[n,e,t,u,i]);let d=o?.canAnswer===!0&&o.record.state===`pending`,f=o?.canSetAutoApprove===!0,p=o?.record.module,m=o?.record.access;return xt({source:(0,U.useMemo)(()=>{if(d)return{snapshot:()=>c.current,subscribe:e=>(l.current.add(e),()=>{l.current.delete(e)}),answer:async e=>{let t=n.require(st),r=e.decision===`always-allow`?void 0:{recordId:e.recordId,decision:e.decision,expectedRevision:e.expectedRevision};if(r===void 0)return{kind:`refused`,reason:`not-eligible`};let i=await t.answer(e.denialNote===void 0?r:{...r,denialNote:e.denialNote});return i.kind===`answered`&&u(i.view),i},family:!f||p===void 0||m===void 0?void 0:{label:`Always approve this family`,enable:async()=>(await n.require(st).setAutoApprove({scope:{agentId:r},family:{module:p,access:m},enabled:!0})).kind===`updated`}}},[d,n,r,f,p,m,u]),store:a,enabled:!0,home:``,width:72,noteLimit:512,onFailure:or}),null}function or(e){console.warn(ir,e)}function sr({capabilities:e,agentId:t,children:n}){let r=Ee(),i=(0,U.useMemo)(()=>{let e=new Set;for(let t of[...r.settled,...r.tail])if(t.kind===`tool_group`)for(let n of t.tools){let t=tr(n);t!==void 0&&e.add(t)}return[...e]},[r.settled,r.tail]),[a,o]=(0,U.useState)(new Map),[s,c]=(0,U.useState)(new Map),l=(0,U.useCallback)((e,t)=>{o(n=>new Map(n).set(e,t))},[]),u=(0,U.useMemo)(()=>({entry:e=>a.get(e),refresh:e=>{c(t=>new Map(t).set(e,(t.get(e)??0)+1))},agentId:t}),[a,t]);return(0,W.jsxs)(nr.Provider,{value:e===void 0?void 0:u,children:[e===void 0?null:i.map(n=>(0,W.jsx)(ar,{recordId:n,attempt:s.get(n)??0,capabilities:e,agentId:t,publish:l},n)),n]})}var cr={requested:`Approval requested.`,pending:`Pending approval.`,approved:`Approved. Waiting to run.`,applied:`Done.`,denied:`Denied.`,expired:`Expired. Nothing ran.`,claimed:`Dispatch in progress.`,outcome_unknown:`Outcome unknown. Check before trying again.`};function lr({view:e,scope:t,onRefresh:r,onAnswer:i}){let{record:a}=e,l=e.canAnswer&&a.state===`pending`;return(0,W.jsxs)(n,{role:`group`,"aria-label":`Approval request`,density:`compact`,children:[(0,W.jsxs)(s,{children:[(0,W.jsxs)(c,{children:[l?`Allow `:``,a.module,` · `,a.operation,l?`?`:``]}),(0,W.jsxs)(`p`,{children:[a.requester.displayName,` wants to use a connected tool.`]})]}),(0,W.jsxs)(p,{className:`min-w-0 space-y-2`,children:[(0,W.jsxs)(`p`,{children:[`Effect`,` `,a.access===`write`?`Changes data in Fungi`:`Changes things outside Fungi`,a.reversibility===`irreversible-external`?` · can't be undone`:``]}),(0,W.jsx)(`p`,{role:`status`,children:l?`Waiting for your answer.`:cr[a.state]}),(0,W.jsxs)(`details`,{children:[(0,W.jsx)(`summary`,{children:`Details`}),(0,W.jsxs)(`p`,{children:[`Requester: `,a.requester.principalId]}),(0,W.jsxs)(`p`,{children:[`Agent: `,a.requester.displayName,` ·`,` `,a.requester.agentId??`none`]}),(0,W.jsxs)(`p`,{children:[`Session: `,a.requester.sessionId??`none`]}),(0,W.jsxs)(`p`,{children:[`Request: `,a.module,`.`,a.operation,` · `,a.access]}),(0,W.jsxs)(`p`,{children:[`Undo:`,` `,a.reversibility===`irreversible-external`?`Can't be undone`:`Can be undone`]}),(0,W.jsxs)(`p`,{children:[`Can answer: `,e.canAnswer?`Yes`:`No`]}),(0,W.jsxs)(`p`,{children:[`Can set auto-approve: `,e.canSetAutoApprove?`Yes`:`No`]}),a.by?.kind===`policy`?(0,W.jsx)(`p`,{children:`Auto-approved by policy`}):null,(0,W.jsx)(`p`,{children:a.description.title}),(0,W.jsxs)(`p`,{className:`break-all`,children:[`Input: `,a.description.inputBytes,` bytes · SHA-256`,` `,a.description.inputSha256]}),(0,W.jsxs)(`p`,{children:[`Record: `,a.recordId,` · revision `,a.revision]}),e.canSetAutoApprove?(0,W.jsxs)(`p`,{children:[`Policy scope:`,` `,t.agentId===null?`whole home`:`agent ${t.agentId}`]}):null]})]}),(0,W.jsxs)(o,{className:`flex flex-wrap gap-2`,children:[l?(0,W.jsx)(h,{variant:`outline`,onClick:i,children:`Answer`}):null,(0,W.jsx)(h,{variant:`ghost`,onClick:r,children:`Refresh approval`})]})]})}function ur({recordId:e}){let t=rr(),n=Me(),r=t?.entry(e);return t===void 0||r===void 0?null:r.failed?(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{role:`alert`,children:`Couldn't load this approval. Try again.`}),(0,W.jsx)(h,{variant:`ghost`,onClick:()=>{t.refresh(e)},children:`Refresh approval`})]}):r.view===null||r.view.record.state===`expired`?null:(0,W.jsx)(lr,{view:r.view,scope:{agentId:t.agentId},onRefresh:()=>{t.refresh(e)},onAnswer:()=>{n.awaiting.focus()}})}var dr=(0,U.forwardRef)(function({heading:e,eyebrow:t,cover:r,action:i,children:c,className:l,...u},d){return(0,W.jsxs)(n,{...u,className:a(`caps-game-share`,l),ref:d,children:[r?(0,W.jsx)(`div`,{className:`caps-game-share-cover`,children:r}):null,(0,W.jsxs)(s,{children:[t,(0,W.jsx)(`h3`,{className:`caps-game-share-heading`,children:e})]}),(0,W.jsx)(p,{className:`gap-sm`,children:c}),(0,W.jsx)(o,{children:(0,W.jsx)(h,{asChild:!0,variant:`primary`,className:`caps-game-share-action`,children:i})})]})});function fr(e){let t=0;return e.map(e=>{let n={...e,offset:t};return t+=e.text.length,n})}function pr({value:e,label:t,fieldLabel:n,displayValue:r,layout:o,title:s,tokens:c,className:l,...f}){let p=(0,U.useId)(),[g,te]=(0,U.useState)({kind:`ready`}),_=c?c.map(e=>e.text).join(``):e,v=async()=>{te(await navigator.clipboard.writeText(_).then(()=>({kind:`copied`}),e=>({kind:`failed`,cause:e})))};if(n!==void 0)return(0,W.jsxs)(`div`,{...f,className:a(`caps-copy-field-input`,l),children:[(0,W.jsx)(m,{htmlFor:p,children:n}),(0,W.jsxs)(u,{children:[(0,W.jsx)(d,{className:`caps-copy-field-control`,"aria-label":n,id:p,onFocus:e=>{e.currentTarget.select()},readOnly:!0,value:r??_}),(0,W.jsx)(h,{onClick:()=>void v(),size:`sm`,variant:`outline`,children:g.kind===`copied`?`Copied`:t??`Copy`})]}),g.kind===`failed`?(0,W.jsx)(`span`,{role:`status`,children:`Could not copy. Select the text to copy it.`}):null]});let y=g.kind===`copied`?`Copied`:g.kind===`failed`?`Copy failed`:t??`Copy`;return o===`block`?(0,W.jsxs)(`figure`,{...f,className:a(`caps-copy-field-block`,l),"data-state":g.kind,children:[(0,W.jsxs)(`figcaption`,{className:`caps-copy-field-header`,children:[(0,W.jsx)(`span`,{className:`caps-copy-field-title`,children:s}),(0,W.jsxs)(h,{onClick:()=>void v(),size:`sm`,variant:g.kind===`copied`?`ghost`:`outline`,children:[g.kind===`copied`?(0,W.jsx)(i,{"aria-hidden":`true`,size:15}):(0,W.jsx)(De,{"aria-hidden":`true`,size:15}),y]}),(0,W.jsx)(ee,{role:`status`,children:g.kind===`copied`?`Copied to the clipboard`:g.kind===`failed`?`Could not copy. Select the code to copy it.`:``})]}),(0,W.jsx)(`pre`,{className:`caps-copy-field-code`,tabIndex:0,children:(0,W.jsx)(`code`,{children:c?fr(c).map(e=>(0,W.jsx)(`span`,{className:`caps-copy-field-token`,"data-kind":e.kind,children:e.text},e.offset)):_})})]}):(0,W.jsxs)(`div`,{...f,className:a(`caps-copy-field`,l),children:[(0,W.jsx)(`code`,{className:`caps-copy-field-value`,children:_}),(0,W.jsxs)(h,{"aria-label":`${y}: ${_}`,onClick:()=>void v(),size:`sm`,variant:`outline`,children:[g.kind===`copied`?(0,W.jsx)(i,{size:15}):(0,W.jsx)(De,{size:15}),y]})]})}var mr=v({game:v({title:b().min(1),summary:b(),coverUrl:g().nullable(),shareUrl:g()})});function hr(e){let t=/(?:^|\n)\s*Share:\s*(https?:\/\/[^\s<>]+)/iu.exec(e);if(!t?.[1])return null;let n=t[1].replace(/[.,;!?]+$/u,``);if(!URL.canParse(n))return null;let r=new URL(n);return r.username||r.password||r.hash||r.protocol===`http:`&&![`localhost`,`127.0.0.1`].includes(r.hostname)?null:r.href}function gr(e){return hr(e)?e.split(`
3
3
  `).filter(e=>!/^\s*Share:\s*/iu.test(e)).join(`
4
4
  `).trim():e}function _r(e){let t=new URL(e),n=/^\/([a-z0-9]+(?:-[a-z0-9]+)*)\/?$/u.exec(t.pathname)?.[1];return!n||t.search?null:new URL(`/api/games/${n}`,t.origin)}function vr({reply:e,previewGame:t}){let n=hr(e),r=n?_r(n):null,{data:i}=Be({queryKey:Le.of(null,`game-share`,n),enabled:r!==null&&t===void 0,queryFn:async({signal:e})=>{if(!r)return null;let t=await fetch(r,{signal:e});if(!t.ok)return null;let i=mr.safeParse(await t.json());return i.success&&i.data.game.shareUrl===n?i.data.game:null}}),a=t??i;if(!n)return null;let o=new URL(n),s=`${o.host}${o.pathname.replace(/\/$/u,``)}`,c=a?.coverUrl&&r?t?a.coverUrl:new URL(`${r.pathname}/cover`,r.origin).href:null;return(0,W.jsxs)(dr,{"data-game-share-card":`true`,"data-theme":`vishnu`,heading:a?.title??`Your game is ready`,eyebrow:(0,W.jsx)(je,{tone:`secondary`,variant:`quiet`,children:`Made with your Agent`}),cover:c?(0,W.jsx)(`img`,{alt:`A scene from ${a?.title??`your game`}`,src:c}):null,action:(0,W.jsx)(`a`,{href:n,rel:`noopener noreferrer`,target:`_blank`,children:`Play ↗`}),children:[a?.summary?(0,W.jsx)(`p`,{className:`text-sm`,children:a.summary}):null,(0,W.jsx)(pr,{displayValue:s,fieldLabel:`Share link`,label:`Copy link`,value:n})]})}var yr=[Nt,qt,nn,Sn,In],br=e=>(0,W.jsx)(vr,{reply:e});function xr({prefill:e,onPrefilled:t}){let n=Ae(),r=(0,U.useRef)(null);return(0,U.useEffect)(()=>{!e||r.current===e.requestId||(r.current=e.requestId,n.setDraft(e.text),e.send===!0&&n.send(),t())},[n.setDraft,n.send,t,e]),null}function Sr({session:e,draftIdentity:t,connection:n,commands:r,prefill:i=null,onPrefilled:a=()=>void 0,onOpen:o,models:s,autoFocus:c}){let l=n?.ui??null,u=n?.capabilities,d=(0,U.useMemo)(()=>({modelSetup:s===void 0?void 0:{state:s,fix:{label:`Add a model key`,onSelect:()=>{l?.openSetup(`model`).catch(e=>{console.error(`Grove could not open model setup`,e)})}}},starters:Re}),[s,l]),f=(0,U.useCallback)(e=>Ln(l,e),[l]),p=(0,U.useCallback)(e=>{let t=tr(e);return t!==void 0&&u!==void 0?(0,W.jsx)(ur,{recordId:t},t):l?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Bn,{item:e,ui:l}),(0,W.jsx)($n,{item:e,capabilities:u})]}):null},[l,u]),m=(0,U.useCallback)(e=>u!==void 0&&Zn(e),[u]),h=(0,U.useCallback)(e=>{Rn(l,e)},[l]);return(0,W.jsxs)(Te,{session:e,draftIdentity:t,clients:yr,authorOf:Se,onToast:h,children:[(0,W.jsx)(xr,{prefill:i,onPrefilled:a}),(0,W.jsx)(sr,{capabilities:u,agentId:t.agentId,children:(0,W.jsx)(ke,{onLink:f,onOpen:o,hostFacts:d,autoFocus:c,composerActionVariant:`outline`,commands:r,renderAssistantAttachment:br,formatAssistantText:gr,renderToolActions:p,claimsToolMedia:m})})]})}export{Sr as ParakeetConversation};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Ct as n,D as r,F as i,G as a,I as o,J as s,K as c,N as l,O as u,P as d,Qr as f,R as p,St as m,V as h,Y as g,Z as _,Zi as v,_ as ee,_a as y,_t as te,a as b,ar as ne,ba as x,bt as re,c as ie,ct as ae,d as oe,da as se,dr as S,dt as ce,et as le,f as C,fa as w,ft as T,g as E,ga as ue,gt as D,h as O,ht as k,i as de,ir as fe,j as A,lt as pe,m as j,mr as me,mt as M,n as he,nr as ge,o as N,ot as _e,p as ve,pa as ye,pr as P,pt as F,qn as be,r as xe,ra as Se,rr as Ce,s as I,sr as we,st as Te,t as Ee,tr as De,tt as Oe,vt as ke,w as Ae,wa as je,wt as L,xa as R,xi as Me,xt as z,y as B}from"./Effect-CsknxyoC.js";import{$ as Ne,$n as Pe,$t as Fe,A as Ie,Ai as Le,An as Re,Ao as ze,Ar as Be,At as Ve,B as He,Ba as Ue,Bn as We,Br as Ge,Bt as Ke,C as qe,Ci as V,Cn as Je,Cr as H,Ct as Ye,D as Xe,Dn as Ze,Do as Qe,Dt as $e,E as et,Ei as tt,En as nt,Eo as rt,Et as it,F as at,Fo as ot,Fr as st,Ft as ct,G as lt,Gi as ut,Gn as dt,Gr as ft,Gt as pt,H as mt,Hi as ht,Hn as gt,Hr as _t,Ht as vt,I as yt,Ia as bt,Ii as xt,In as St,Io as Ct,It as wt,J as Tt,Ja as Et,Ji as Dt,Jn as Ot,Jt as kt,K as At,Kn as jt,Kr as Mt,Kt as Nt,L as Pt,La as U,Li as Ft,Ln as It,Lr as Lt,Lt as Rt,M as zt,Ma as Bt,Mn as Vt,Mo as Ht,Mt as Ut,N as Wt,Na as Gt,Ni as W,Nn as Kt,No as qt,Nt as Jt,O as Yt,On as Xt,Or as Zt,Ot as Qt,P as $t,Pa as G,Pn as en,Po as tn,Pr as nn,Pt as rn,Q as an,Qn as on,Qt as sn,R as cn,Ra as ln,Rn as un,Ro as dn,Rt as fn,S as pn,Si as mn,Sn as hn,Sr as gn,St as _n,T as vn,Ta as yn,Tn as bn,To as xn,Tr as Sn,Tt as Cn,U as wn,Ui as Tn,Un as En,Ut as Dn,V as On,Vi as K,Vn as kn,Vr as An,Vt as jn,W as Mn,Wi as Nn,Wn as Pn,Wt as Fn,X as In,Xn as Ln,Xr as Rn,Xt as zn,Y as Bn,Yn as Vn,Yt as Hn,Z as Un,Zn as Wn,Zt as Gn,_ as Kn,_a as qn,_i as Jn,_n as Yn,_o as Xn,_r as Zn,_t as Qn,a as $n,ai as er,an as tr,at as nr,b as rr,bi as ir,bn as ar,br as or,bt as sr,c as cr,ci as lr,cn as ur,co as dr,ct as fr,di as pr,dn as mr,do as hr,dr as gr,dt as _r,ei as vr,en as yr,er as br,et as xr,fi as Sr,fn as Cr,fo as wr,ft as Tr,g as Er,gi as Dr,gn as Or,go as kr,gr as Ar,gt as jr,h as Mr,hn as Nr,ho as Pr,hr as Fr,ht as Ir,i as Lr,ii as Rr,in as zr,ir as Br,it as Vr,j as Hr,ji as Ur,jn as Wr,jo as Gr,jr as Kr,jt as qr,k as Jr,ka as Yr,ki as Xr,kn as Zr,ko as Qr,kt as $r,la as ei,li as ti,ln as ni,lo as ri,lt as ii,mn as ai,mo as oi,mt as si,n as ci,ni as li,nn as ui,nr as di,nt as fi,o as pi,oa as mi,oi as hi,on as q,ot as gi,pi as _i,pn as vi,po as yi,pt as bi,q as xi,qi as Si,qn as Ci,qr as wi,qt as Ti,r as Ei,ri as Di,rn as Oi,rr as ki,rt as Ai,s as ji,sn as Mi,so as Ni,sr as Pi,st as Fi,t as Ii,ti as Li,tn as Ri,tr as zi,tt as Bi,ui as Vi,un as Hi,ur as Ui,ut as Wi,v as Gi,vn as Ki,vr as qi,vt as Ji,w as Yi,wi as Xi,wn as Zi,wo as Qi,wt as $i,x as ea,xa as ta,xi as na,xn as ra,xr as ia,xt as aa,y as oa,yn as sa,yr as J,yt as ca,z as la,zn as ua,zr as da,zt as fa}from"./extension-hook-JTiNRrg7.js";import{l as pa,m as ma,p as ha}from"./preload-helper-DY31Aviq.js";import{a as ga,c as _a,d as va,f as ya,i as ba,l as xa,o as Sa,s as Ca,u as wa}from"./index-vsMyapHr.js";var Ta=bt(()=>Xa),Ea=Rr(Ta),Da=V({id:Jn,payload:Vi}),Oa=V({...Da.fields,schemas:Gt(Ea)});function ka(e){let t={};for(let[n,r]of Object.entries(e))Et(r)&&f(t,n,r);return Object.keys(t).length===0?S():P(t)}var Aa=Gt(na(mn,Ur)).pipe(ut(G(pr),{decode:Ni(),encode:ri(e=>ne(e)||e.value===void 0?S():ka(e.value))})),ja=bt(()=>Pa),Ma=Rr(ja),Na={annotations:Aa,checks:Ma},Pa=Le([V({_tag:U(`Filter`),representation:Oa,annotations:Aa,aborted:hi}),V({_tag:U(`FilterGroup`),representation:Gt(Oa),annotations:Aa,checks:Dr(ja)})]);function Y(e){return V({_tag:U(e),...Na})}var Fa=V({_tag:U(`Declaration`),representation:Da,annotations:Aa,typeParameters:Ea,checks:Ma}),Ia=V({_tag:U(`Suspend`),annotations:Aa,checks:tt([]),thunk:Ta});function La(e,t){return t.pipe(ut(V({type:U(e),value:t}),{decode:dr(e=>e.value),encode:dr(t=>({type:e,value:t}))}))}var Ra=La(`string`,mn),za=La(`number`,ir),Ba=V({_tag:U(`Literal`),...Na,literal:Le([Ra,La(`number`,lr),La(`bigint`,er),La(`boolean`,hi)])}),Va=V({_tag:U(`UniqueSymbol`),...Na,symbol:Xi}),Ha=V({_tag:U(`Enum`),...Na,enums:Rr(tt([mn,Le([Ra,za])]))}),Ua=V({_tag:U(`TemplateLiteral`),...Na,parts:Ea}),Wa=V({isOptional:hi,type:Ta,annotations:Aa}),Ga=V({_tag:U(`Arrays`),...Na,elements:Rr(Wa),rest:Ea}),Ka=V({name:Le([Ra,za,La(`symbol`,Xi)]),type:Ta,isOptional:hi,isMutable:hi,annotations:Aa}),qa=V({parameter:Ta,type:Ta}),Ja=V({_tag:U(`Objects`),...Na,propertySignatures:Rr(Ka),indexSignatures:Rr(qa)}),Ya=V({_tag:U(`Union`),...Na,types:Ea,options:G(V({mode:G(_i([`anyOf`,`oneOf`]))}))}),Xa=Le([Fa,V({_tag:U(`Reference`),$ref:Jn}),Ia,Y(`Null`),Y(`Undefined`),Y(`Void`),Y(`Never`),Y(`Unknown`),Y(`Any`),Y(`String`),Y(`Number`),Y(`Boolean`),Y(`BigInt`),Y(`Symbol`),Y(`ObjectKeyword`),Ba,Va,Ha,Ua,Ga,Ja,Ya]),Za=Nn(ln(V({representation:Ta,references:na(mn,Ta)})));function Qa(e){return Za(e)}function $a(e){return e.sql.exec(`CREATE TABLE IF NOT EXISTS shiitake_fleet_delegations (
1
+ import{n as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Ct as n,D as r,F as i,G as a,I as o,J as s,K as c,N as l,O as u,P as d,Qr as f,R as p,St as m,V as h,Y as g,Z as _,Zi as v,_ as ee,_a as y,_t as te,a as b,ar as ne,ba as x,bt as re,c as ie,ct as ae,d as oe,da as se,dr as S,dt as ce,et as le,f as C,fa as w,ft as T,g as E,ga as ue,gt as D,h as O,ht as k,i as de,ir as fe,j as A,lt as pe,m as j,mr as me,mt as M,n as he,nr as ge,o as N,ot as _e,p as ve,pa as ye,pr as P,pt as F,qn as be,r as xe,ra as Se,rr as Ce,s as I,sr as we,st as Te,t as Ee,tr as De,tt as Oe,vt as ke,w as Ae,wa as je,wt as L,xa as R,xi as Me,xt as z,y as B}from"./Effect-CsknxyoC.js";import{$ as Ne,$n as Pe,$t as Fe,A as Ie,Ai as Le,An as Re,Ao as ze,Ar as Be,At as Ve,B as He,Ba as Ue,Bn as We,Br as Ge,Bt as Ke,C as qe,Ci as V,Cn as Je,Cr as H,Ct as Ye,D as Xe,Dn as Ze,Do as Qe,Dt as $e,E as et,Ei as tt,En as nt,Eo as rt,Et as it,F as at,Fo as ot,Fr as st,Ft as ct,G as lt,Gi as ut,Gn as dt,Gr as ft,Gt as pt,H as mt,Hi as ht,Hn as gt,Hr as _t,Ht as vt,I as yt,Ia as bt,Ii as xt,In as St,Io as Ct,It as wt,J as Tt,Ja as Et,Ji as Dt,Jn as Ot,Jt as kt,K as At,Kn as jt,Kr as Mt,Kt as Nt,L as Pt,La as U,Li as Ft,Ln as It,Lr as Lt,Lt as Rt,M as zt,Ma as Bt,Mn as Vt,Mo as Ht,Mt as Ut,N as Wt,Na as Gt,Ni as W,Nn as Kt,No as qt,Nt as Jt,O as Yt,On as Xt,Or as Zt,Ot as Qt,P as $t,Pa as G,Pn as en,Po as tn,Pr as nn,Pt as rn,Q as an,Qn as on,Qt as sn,R as cn,Ra as ln,Rn as un,Ro as dn,Rt as fn,S as pn,Si as mn,Sn as hn,Sr as gn,St as _n,T as vn,Ta as yn,Tn as bn,To as xn,Tr as Sn,Tt as Cn,U as wn,Ui as Tn,Un as En,Ut as Dn,V as On,Vi as K,Vn as kn,Vr as An,Vt as jn,W as Mn,Wi as Nn,Wn as Pn,Wt as Fn,X as In,Xn as Ln,Xr as Rn,Xt as zn,Y as Bn,Yn as Vn,Yt as Hn,Z as Un,Zn as Wn,Zt as Gn,_ as Kn,_a as qn,_i as Jn,_n as Yn,_o as Xn,_r as Zn,_t as Qn,a as $n,ai as er,an as tr,at as nr,b as rr,bi as ir,bn as ar,br as or,bt as sr,c as cr,ci as lr,cn as ur,co as dr,ct as fr,di as pr,dn as mr,do as hr,dr as gr,dt as _r,ei as vr,en as yr,er as br,et as xr,fi as Sr,fn as Cr,fo as wr,ft as Tr,g as Er,gi as Dr,gn as Or,go as kr,gr as Ar,gt as jr,h as Mr,hn as Nr,ho as Pr,hr as Fr,ht as Ir,i as Lr,ii as Rr,in as zr,ir as Br,it as Vr,j as Hr,ji as Ur,jn as Wr,jo as Gr,jr as Kr,jt as qr,k as Jr,ka as Yr,ki as Xr,kn as Zr,ko as Qr,kt as $r,la as ei,li as ti,ln as ni,lo as ri,lt as ii,mn as ai,mo as oi,mt as si,n as ci,ni as li,nn as ui,nr as di,nt as fi,o as pi,oa as mi,oi as hi,on as q,ot as gi,pi as _i,pn as vi,po as yi,pt as bi,q as xi,qi as Si,qn as Ci,qr as wi,qt as Ti,r as Ei,ri as Di,rn as Oi,rr as ki,rt as Ai,s as ji,sn as Mi,so as Ni,sr as Pi,st as Fi,t as Ii,ti as Li,tn as Ri,tr as zi,tt as Bi,ui as Vi,un as Hi,ur as Ui,ut as Wi,v as Gi,vn as Ki,vr as qi,vt as Ji,w as Yi,wi as Xi,wn as Zi,wo as Qi,wt as $i,x as ea,xa as ta,xi as na,xn as ra,xr as ia,xt as aa,y as oa,yn as sa,yr as J,yt as ca,z as la,zn as ua,zr as da,zt as fa}from"./extension-hook-ClRCT16F.js";import{l as pa,m as ma,p as ha}from"./preload-helper-DY31Aviq.js";import{a as ga,c as _a,d as va,f as ya,i as ba,l as xa,o as Sa,s as Ca,u as wa}from"./index-C4RcjDMM.js";var Ta=bt(()=>Xa),Ea=Rr(Ta),Da=V({id:Jn,payload:Vi}),Oa=V({...Da.fields,schemas:Gt(Ea)});function ka(e){let t={};for(let[n,r]of Object.entries(e))Et(r)&&f(t,n,r);return Object.keys(t).length===0?S():P(t)}var Aa=Gt(na(mn,Ur)).pipe(ut(G(pr),{decode:Ni(),encode:ri(e=>ne(e)||e.value===void 0?S():ka(e.value))})),ja=bt(()=>Pa),Ma=Rr(ja),Na={annotations:Aa,checks:Ma},Pa=Le([V({_tag:U(`Filter`),representation:Oa,annotations:Aa,aborted:hi}),V({_tag:U(`FilterGroup`),representation:Gt(Oa),annotations:Aa,checks:Dr(ja)})]);function Y(e){return V({_tag:U(e),...Na})}var Fa=V({_tag:U(`Declaration`),representation:Da,annotations:Aa,typeParameters:Ea,checks:Ma}),Ia=V({_tag:U(`Suspend`),annotations:Aa,checks:tt([]),thunk:Ta});function La(e,t){return t.pipe(ut(V({type:U(e),value:t}),{decode:dr(e=>e.value),encode:dr(t=>({type:e,value:t}))}))}var Ra=La(`string`,mn),za=La(`number`,ir),Ba=V({_tag:U(`Literal`),...Na,literal:Le([Ra,La(`number`,lr),La(`bigint`,er),La(`boolean`,hi)])}),Va=V({_tag:U(`UniqueSymbol`),...Na,symbol:Xi}),Ha=V({_tag:U(`Enum`),...Na,enums:Rr(tt([mn,Le([Ra,za])]))}),Ua=V({_tag:U(`TemplateLiteral`),...Na,parts:Ea}),Wa=V({isOptional:hi,type:Ta,annotations:Aa}),Ga=V({_tag:U(`Arrays`),...Na,elements:Rr(Wa),rest:Ea}),Ka=V({name:Le([Ra,za,La(`symbol`,Xi)]),type:Ta,isOptional:hi,isMutable:hi,annotations:Aa}),qa=V({parameter:Ta,type:Ta}),Ja=V({_tag:U(`Objects`),...Na,propertySignatures:Rr(Ka),indexSignatures:Rr(qa)}),Ya=V({_tag:U(`Union`),...Na,types:Ea,options:G(V({mode:G(_i([`anyOf`,`oneOf`]))}))}),Xa=Le([Fa,V({_tag:U(`Reference`),$ref:Jn}),Ia,Y(`Null`),Y(`Undefined`),Y(`Void`),Y(`Never`),Y(`Unknown`),Y(`Any`),Y(`String`),Y(`Number`),Y(`Boolean`),Y(`BigInt`),Y(`Symbol`),Y(`ObjectKeyword`),Ba,Va,Ha,Ua,Ga,Ja,Ya]),Za=Nn(ln(V({representation:Ta,references:na(mn,Ta)})));function Qa(e){return Za(e)}function $a(e){return e.sql.exec(`CREATE TABLE IF NOT EXISTS shiitake_fleet_delegations (
2
2
  request_id TEXT PRIMARY KEY, input TEXT NOT NULL, mail TEXT NOT NULL,
3
3
  receipt TEXT
4
4
  ) STRICT`),e.sql.exec(`CREATE TABLE IF NOT EXISTS shiitake_fleet_held_delegations (