pinecall 0.8.6 → 0.8.7

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.
@@ -119,5 +119,5 @@ Monday to Friday, 9:00 to 20:00.
119
119
  A first visit is 60 euros.
120
120
 
121
121
  ## Needs an authorisation
122
- An X-ray, an extraction, anything over 300 euros.`,onChange:e=>t(`knowledge`,e.target.value)}),(0,j.jsxs)(`p`,{className:`set-help`,children:[e.knowledge.length.toLocaleString(`en-US`),` characters. The documents it searches are not this: those are the Docs tab, attached under Bases.`]})]})]})}var Mq=[{tab:`hears`,name:`STT`},{tab:`decides`,name:`LLM`},{tab:`speaks`,name:`Voice`},{tab:`conversation`,name:`Conversation`},{tab:`memory`,name:`Memory`},{tab:`knowledge`,name:`Knowledge`},{tab:`bases`,name:`Bases`}],Nq=[`conversation`,`memory`,`knowledge`];function Pq(e){return e?Mq.filter(e=>Nq.includes(e.tab)):Mq}function Fq({standing:e,version:t,wordsOnly:n,voices:r,providers:i,defaults:a,models:o,bases:s,section:c,onPickSection:l,saving:u,error:d,onSave:f}){let p=new Set(i.map(e=>e.name)),[m,h]=(0,D.useState)(()=>Dq(e,p)),[g,_]=(0,D.useState)(!1),v=(e,t)=>{_(!1),h({...m,[e]:t})},y=e=>t=>{_(!1),h(e===`tts`&&t.vendor!==m.tts.vendor?{...m,tts:t,voice:``}:{...m,[e]:t})},b=m.tts.vendor===``?a.tts??`elevenlabs`:m.tts.vendor,x=async r=>{r.preventDefault(),await f(Oq(m,n,e),t,m.note.trim()===``?null:m.note.trim()),_(!0)};return(0,j.jsxs)(`form`,{className:`ui-card set-form`,onSubmit:e=>void x(e),children:[(0,j.jsx)(`div`,{className:`set-tabs`,children:(0,j.jsx)(Mh,{label:`Settings`,tabs:Pq(n),on:c,onPick:l})}),c===`hears`&&(0,j.jsx)(Cq,{modality:`stt`,title:`Speech to text`,blurb:`What turns the caller's voice into words.`,knob:m.stt,providers:i,defaults:a,models:o,onChange:y(`stt`)}),c===`decides`&&(0,j.jsx)(Cq,{modality:`llm`,title:`Language model`,blurb:`The model that reads what the caller said and writes the answer.`,knob:m.llm,providers:i,defaults:a,models:o,onChange:y(`llm`)}),c===`speaks`&&(0,j.jsx)(Cq,{modality:`tts`,title:`Voice`,blurb:`What says the answer out loud, and in which voice.`,knob:m.tts,providers:i,defaults:a,models:o,onChange:y(`tts`),children:(0,j.jsx)(wq,{vendor:b,voice:m.voice,voices:r,onChange:e=>v(`voice`,e)})}),c===`conversation`&&(0,j.jsx)(yq,{typed:m,wordsOnly:n,change:v}),c===`memory`&&(0,j.jsx)(Aq,{typed:m,change:v}),c===`knowledge`&&(0,j.jsx)(jq,{typed:m,change:v}),c===`bases`&&(0,j.jsx)(hq,{rows:m.bases,offered:s,onChange:e=>{_(!1),h({...m,bases:e})}}),(0,j.jsxs)(`div`,{className:`set-save`,children:[(0,j.jsx)(G,{className:`set-save-note`,value:m.note,placeholder:`Why, for the history (optional)`,"aria-label":`Why, for the history (optional)`,onChange:e=>v(`note`,e.target.value)}),(0,j.jsx)(W,{kind:`primary`,size:`form`,type:`submit`,disabled:u,children:u?`Saving…`:t===null?`Save as the first version`:`Save as v${t+1}`}),(0,j.jsx)(`span`,{className:d===null?`set-save-said`:`set-save-said set-save-error`,children:d===null?g?`Kept. The next call runs on it.`:`Every section is saved together, as one version. An empty field is the runtime's default.`:d})]})]})}function Iq({kept:e,canRollBack:t,onRollBack:n}){return(0,j.jsxs)(H,{children:[(0,j.jsx)(U,{title:`History`,meta:e===null?void 0:e.holder===``?`the org's own corner`:`corner ${e.holder}`}),e===null?(0,j.jsx)(Gm,{children:`Asking the gateway…`}):e.rows.length===0?(0,j.jsx)(Gm,{children:`Nothing set in this corner yet: the next call runs on what the corner falls back to.`}):e.rows.map((r,i)=>{let a=e.rows[i+1],o=vW(a?.config??{},r.config);return(0,j.jsxs)(`div`,{className:`set-version`,children:[(0,j.jsxs)(`div`,{className:`set-version-head`,children:[(0,j.jsxs)(`b`,{children:[`v`,r.version]}),(0,j.jsxs)(`span`,{className:`ui-cell-faint`,children:[r.author,` · `,dg(r.set_at)]}),r.note!==null&&(0,j.jsxs)(`span`,{className:`set-version-note`,children:[`“`,r.note,`”`]}),t&&i>0&&(0,j.jsx)(W,{size:`xs`,onClick:()=>void n(r.version),children:`Roll back to this`})]}),o.length>0&&(0,j.jsx)(`div`,{className:`set-version-changes`,children:o.join(` · `)})]},r.version)})]})}var Lq={yours:`Yours`,team:`Team`,production:`Production`};function Rq({answer:e,corners:t,first:n}){let[r,i]=(0,D.useState)(n),a=e[r];return(0,j.jsxs)(H,{children:[(0,j.jsx)(U,{title:`What is set now`,meta:e.world}),t.length>1&&(0,j.jsx)(`div`,{className:`set-now-pick`,children:(0,j.jsx)(ih,{options:t.map(e=>({value:e,label:Lq[e]})),value:r,onChange:i})}),(0,j.jsx)(`dl`,{className:`set-now`,children:hW.map(e=>(0,j.jsxs)(`div`,{className:`set-now-row`,children:[(0,j.jsx)(`dt`,{children:gW[e]}),(0,j.jsx)(`dd`,{className:Bq(a,e,r)===zq[r]?`set-now-none`:void 0,children:Bq(a,e,r)})]},e))}),(0,j.jsx)(`div`,{className:`set-now-foot`,children:a===null?`Nothing saved in this corner yet.`:Vq(a)})]})}var zq={yours:`the team's`,team:`—`,production:`—`};function Bq(e,t,n){return e===null?zq[n]:_W(e.config,t)??zq[n]}function Vq(e){return`v${e.version} · ${e.author} · ${dg(e.set_at)}${e.note===null?``:` · “${e.note}”`}`}function Hq(e){return e instanceof Error?e.message:String(e)}function Uq(){let e=M(),t=Sr().agent??``,n=zh(),[r,i]=Yi(),[a,o]=(0,D.useState)(null),[s,c]=(0,D.useState)(null),[l,u]=(0,D.useState)(null),[d,f]=(0,D.useState)(null),[p,m]=(0,D.useState)(!1),[h,g]=(0,D.useState)(!1),[_,v]=(0,D.useState)(null),[y,b]=(0,D.useState)(null),x=n!==null&&!n.includes(`pipeline`),S=Cm===`hosted`,C=Pq(x),w=r.get(`section`),T=C.some(e=>e.tab===w)?w:C[0].tab,ee=(0,D.useCallback)(async()=>{o(await dW(e,t)),c(await pW(e,t,S||p))},[e,t,p,S]);(0,D.useEffect)(()=>{let n=!1;return v(null),ee().catch(e=>{n||v(Hq(e))}),rG(e,t).then(e=>!n&&u(e),e=>{!n&&!(e instanceof ta&&(e.status===403||e.status===404))&&v(Hq(e))}),TW(e).then(e=>!n&&f(e.bases),()=>!n&&f([])),()=>{n=!0}},[e,t,ee]),(0,D.useEffect)(()=>{let e=()=>void ee().catch(()=>void 0);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[ee]);let te=async(n,r,i)=>{g(!0),v(null);try{o(await fW(e,t,{config:n,if_version:r,note:i,team:p})),c(await pW(e,t,S||p))}catch(e){v(Hq(e))}finally{g(!1)}},ne=async n=>{v(null);try{o(await mW(e,t,n,S||p)),c(await pW(e,t,S||p)),b(`v${n} is the newest again, as a new version.`)}catch(e){v(Hq(e))}},re=a===null?null:yW(a,S||p),E=re??(a===null||S||p?null:a.team),ie=jh({name:`settings.now`,initial:340,min:280,max:560,side:`right`}),ae=S?[`production`]:[`yours`,`team`,`production`];return(0,j.jsxs)(`div`,{className:`set-grid`,style:ie.style,children:[ie.handle,(0,j.jsxs)(bh,{width:1060,children:[(0,j.jsx)(xh,{title:`Settings`,ledeWidth:660,lede:S?`What this agent runs on in production. Every save is a new version with your name on it, and any version can be rolled back.`:`What this agent runs on in the sandbox: yours to try in your own corner, or the team's, which every corner falls back to. Every save is a version; production has its own page.`}),a===null&&(0,j.jsx)(Gm,{children:_??`Asking the gateway…`}),a!==null&&(0,j.jsxs)(`div`,{className:`set-main`,children:[!x&&!S&&(0,j.jsx)(`div`,{className:`set-corner-pick`,children:(0,j.jsx)(ch,{checked:p,onChange:m,children:`Write the team's corner, which every corner falls back to — not only yours`})}),(0,j.jsx)(Fq,{standing:E?.config??{},version:re?.version??null,wordsOnly:x,voices:l?.voices??[],providers:l?.providers??[],defaults:l?.defaults??{},models:l?.models??{},bases:d,section:T,onPickSection:e=>i(e===C[0].tab?{}:{section:e}),saving:h,error:_,onSave:te},`${t}-${p}-${re?.version??0}-${E?.version??0}-${l===null?`asking`:`read`}`)]}),y!==null&&(0,j.jsx)(`div`,{className:`ui-empty`,children:y}),(0,j.jsx)(Km,{children:_})]}),(0,j.jsx)(`aside`,{className:`set-pane`,"aria-label":`what is set, and its history`,children:a===null?(0,j.jsx)(`p`,{className:`set-pane-empty`,children:`Asking the gateway…`}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Rq,{answer:a,corners:ae,first:S?`production`:p?`team`:`yours`},p?`team`:`yours`),(0,j.jsx)(Iq,{kept:s,canRollBack:!x,onRollBack:ne})]})})]})}var Wq=`lk.transcription`,Gq=`lk.transcription_final`,Kq=`lk.chat`,qq=1500,Jq=`→`,Yq=`←`,Xq=`✗`;function Zq(e,t){let n=e.findIndex(e=>e.id===t.id);if(n===-1)return[...e,t];let r=e.slice();return r[n]=t,r}function Qq(e){return e.split(/(\s+)/).filter(e=>e.length>0)}function $q(e){let t=bw(e);if(t!==null)return{kind:`mark`,id:`mark-${e.seq}`,tone:`supervisor`,text:t.said};let n=e.data;switch(e.type){case`tool.call`:return{kind:`mark`,id:`mark-${e.seq}`,tone:`tool`,text:`${Jq} ${String(n.name)}(${tJ(n.arguments)})`};case`tool.result`:return{kind:`mark`,id:`mark-${e.seq}`,tone:`tool`,text:`${Yq} ${String(n.name)} ${eJ(n)}`};case`error`:return{kind:`mark`,id:`mark-${e.seq}`,tone:`error`,text:`${Xq} ${String(n.message)}`};default:return null}}function eJ(e){return e.error!==void 0&&e.error!==null?`error: ${tJ(e.error)}`:typeof e.summary==`string`?e.summary:e.output===void 0?`nothing`:tJ(e.output)}function tJ(e,t=80){let n=typeof e==`string`?e:JSON.stringify(e)??String(e);return n.length>t?`${n.slice(0,t-1)}…`:n}function nJ({lines:e,mode:t,head:n,children:r}){let i=(0,D.useRef)(null);return(0,D.useEffect)(()=>{let e=i.current;e&&(e.scrollTop=e.scrollHeight)},[e]),(0,j.jsxs)(`div`,{className:`ui-card talk-window`,children:[n??(0,j.jsxs)(`div`,{className:`ui-card-head`,children:[(0,j.jsx)(`span`,{className:`ui-card-title`,children:`This call`}),(0,j.jsx)(`span`,{className:`ui-card-meta`,children:`spoken or written, as the room says it`})]}),(0,j.jsxs)(`div`,{className:`talk-lines`,ref:i,children:[e.length===0&&(0,j.jsxs)(`p`,{className:`talk-quiet`,children:[`Nothing said yet. `,t===`talk`?`What you say and what you write both land here.`:`What you write and the agent's replies land here.`]}),e.map(e=>e.kind===`said`?(0,j.jsx)(rJ,{line:e},e.id):(0,j.jsx)(iJ,{mark:e},e.id))]}),r]})}function rJ({line:e}){return(0,j.jsx)(`div`,{className:e.speaker===`user`?`talk-said talk-said-you`:`talk-said`,children:(0,j.jsxs)(`p`,{className:`talk-bubble${e.speaker===`user`?` talk-bubble-you`:``}${!e.final||e.pending===!0?` talk-bubble-unsettled`:``}`,children:[Qq(e.text).map((e,t)=>(0,j.jsx)(`span`,{className:`talk-word`,children:e},t)),!e.final&&(0,j.jsx)(`span`,{className:`talk-cursor`,"aria-hidden":!0})]})})}function iJ({mark:e}){return(0,j.jsx)(`p`,{className:`talk-mark talk-mark-${e.tone}`,children:e.text})}function aJ({open:e,mode:t,onWrite:n}){let[r,i]=(0,D.useState)(``);return(0,j.jsxs)(`form`,{className:`talk-composer`,onSubmit:t=>{t.preventDefault();let a=r.trim();a!==``&&e&&(i(``),n(a))},children:[(0,j.jsx)(`input`,{className:`talk-write`,"aria-label":`Write to the agent`,value:r,disabled:!e,placeholder:e?t===`talk`?`Write to the agent — or just speak`:`Write to the agent`:`Call or Write first`,onChange:e=>i(e.target.value)}),(0,j.jsx)(`button`,{type:`submit`,className:`talk-send`,disabled:!e||r.trim()===``,children:`Send`})]})}var oJ=new Set;function sJ(e){oJ.add(e)}function cJ(e){return oJ.has(e)}var lJ=B({server_url:F(),participant_token:F(),call:F()});function uJ(e){let t=M(),[n,r]=(0,D.useState)(`idle`),[i,a]=(0,D.useState)(`talk`),[o,s]=(0,D.useState)(null),[c,l]=(0,D.useState)(!1),[u,d]=(0,D.useState)(null),[f,p]=(0,D.useState)([]),[m,h]=(0,D.useState)(null),g=(0,D.useRef)(null),_=(0,D.useRef)(new Set),v=(0,D.useRef)(null),y=(0,D.useRef)([]),b=(0,D.useRef)(null),x=(0,D.useCallback)(()=>{b.current!==null&&(window.clearTimeout(b.current),b.current=null);let e=y.current;y.current=[],e.length>0&&p(t=>[...t,...e])},[]),S=(0,D.useCallback)(e=>{if(!_.current.has(e.id)){_.current.add(e.id),e.speaker===`user`&&x(),p(t=>Zq(t,e)),v.current=e.speaker,e.speaker===`agent`&&x();return}p(t=>Zq(t,e))},[x]),C=(0,D.useRef)(0),w=(0,D.useCallback)(async e=>{let t=g.current;if(t===null)return;C.current+=1;let n=`typed-${C.current}`;x(),p(t=>[...t,{kind:`said`,id:n,speaker:`user`,text:e,final:!0,pending:!0}]),v.current=`user`;try{await t.localParticipant.sendText(e,{topic:Kq})}catch(e){p(e=>e.filter(e=>e.id!==n)),h(e instanceof Error?e.message:String(e))}},[x]),T=(0,D.useCallback)(e=>{if(e.type===`turn.user`){let t=String(e.data.text??``).trim();p(e=>{let n=e.findIndex(e=>e.kind===`said`&&e.pending===!0&&e.text.trim()===t);if(n===-1)return e;let r=e.slice();return r[n]={...e[n],pending:!1},r});return}let t=$q(e);if(t!==null){if(v.current===`agent`){p(e=>[...e,t]);return}y.current.push(t),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(x,qq)}},[x]),ee=(0,D.useCallback)(async n=>{r(`connecting`),a(n),l(!1),s(null),h(null),p([]),_.current.clear(),v.current=null,y.current=[];try{let i=lJ.parse(await oa(t,`/v1/tokens`,{agent:e,scope:n})),a=new XV;g.current=a,a.registerTextStreamHandler(Wq,(e,t)=>{dJ(a,e,t.identity,S)}),n===`talk`&&a.on(Y.TrackSubscribed,fJ),a.on(Y.TrackUnsubscribed,e=>e.detach().forEach(e=>e.remove())),a.on(Y.Disconnected,()=>r(`ended`)),sJ(i.call),d(i.call),await a.connect(i.server_url,i.participant_token),n===`talk`&&await a.localParticipant.setMicrophoneEnabled(!0),s(Date.now()/1e3),r(`live`)}catch(e){h(e instanceof Error?e.message:String(e)),r(`failed`)}},[e,t,S]),te=(0,D.useCallback)(async()=>{await g.current?.disconnect()},[]),ne=(0,D.useCallback)(async()=>{let e=g.current;e!==null&&(await e.localParticipant.setMicrophoneEnabled(c),l(!c))},[c]);return(0,D.useEffect)(()=>()=>{g.current?.disconnect()},[]),{phase:n,mode:i,call:u,lines:f,error:m,since:o,muted:c,open:ee,close:te,toggleMic:ne,write:w,heard:T}}async function dJ(e,t,n,r){let i=t.info.attributes?.[`lk.segment_id`]??t.info.id,a=e.remoteParticipants.get(n)?.kind===Hk.AGENT?`agent`:`user`,o=``;for await(let e of t)o+=e,r({kind:`said`,id:i,speaker:a,text:o,final:!1});r({kind:`said`,id:i,speaker:a,text:o,final:t.info.attributes?.[Gq]===`true`})}function fJ(e){if(e.kind!==$.Kind.Audio)return;let t=e.attach();t.style.display=`none`,document.body.append(t)}function pJ(){let e=Sr().agent??``,t=uJ(e),n=Lh(),{world:r}=Hh(),i=t.phase===`live`||t.phase===`connecting`,a=jh({name:`agent.inspector`,initial:330,min:260,max:620,side:`right`}),o=n?.name??n?.label??`this key`;return(0,j.jsxs)(`div`,{className:`talk-grid`,style:a.style,children:[a.handle,(0,j.jsxs)(bh,{width:760,children:[(0,j.jsx)(xh,{title:`Chat with ${e}`,lede:`Reach the agent as a customer would: call it with this machine's microphone and hear it answer, or write to it. On a call you can also type — a number, an address, a name nobody spells out loud.`}),(0,j.jsxs)(`div`,{className:`talk-facts`,children:[(0,j.jsxs)(`div`,{className:`talk-fact`,children:[(0,j.jsx)(`div`,{className:`talk-fact-label`,children:`You are`}),(0,j.jsxs)(`div`,{className:`talk-fact-value`,children:[o,` · you`]})]}),(0,j.jsxs)(`div`,{className:`talk-fact`,children:[(0,j.jsx)(`div`,{className:`talk-fact-label`,children:`Lands in`}),(0,j.jsxs)(`div`,{className:`talk-fact-value`,children:[r,` · counts in usage`]})]})]}),(0,j.jsx)(Km,{children:t.error}),(0,j.jsx)(nJ,{lines:i||t.phase===`ended`?t.lines:[],mode:t.mode,head:(0,j.jsx)(mJ,{agent:e,live:t}),children:(0,j.jsx)(aJ,{open:t.phase===`live`,mode:t.mode,onWrite:t.write})}),t.call!==null&&(0,j.jsx)(hJ,{call:t.call,heard:t.heard})]}),(0,j.jsx)(uw,{agent:e,call:t.call})]})}function mJ({agent:e,live:t}){let n=vJ(t.phase===`live`),r=t.phase===`live`||t.phase===`connecting`,i=t.mode===`talk`;return(0,j.jsxs)(`div`,{className:`ui-card-head talk-bar`,children:[r&&i&&(0,j.jsx)(`button`,{type:`button`,className:`talk-door talk-door-on`,disabled:t.phase===`connecting`,onClick:()=>void t.close(),"aria-label":`Hang up`,children:(0,j.jsx)(uh,{name:`phone`,size:17})}),r&&!i&&(0,j.jsx)(`span`,{className:t.phase===`live`?`talk-light talk-light-on`:`talk-light`,"aria-hidden":!0}),(0,j.jsxs)(`div`,{className:`talk-standing`,children:[(0,j.jsxs)(`div`,{className:`talk-phase`,children:[gJ(t),t.phase===`live`&&(0,j.jsx)(`span`,{className:`talk-clock`,children:sg(t.since,n)})]}),(0,j.jsx)(`div`,{className:`talk-hint`,children:_J(t)})]}),(0,j.jsxs)(`div`,{className:`talk-moves`,children:[t.phase===`live`&&i&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:t.muted?`talk-bars`:`talk-bars talk-bars-on`,"aria-hidden":!0,children:[(0,j.jsx)(`span`,{}),(0,j.jsx)(`span`,{}),(0,j.jsx)(`span`,{}),(0,j.jsx)(`span`,{}),(0,j.jsx)(`span`,{})]}),(0,j.jsx)(W,{size:`sm`,onClick:()=>void t.toggleMic(),children:t.muted?`Unmute`:`Mute`})]}),r&&!i&&(0,j.jsx)(W,{kind:`danger`,size:`sm`,disabled:t.phase===`connecting`,onClick:()=>void t.close(),children:`End chat`}),t.phase===`ended`&&t.call!==null&&(0,j.jsx)(Qm,{size:`sm`,to:`/a/${e}/sessions/${t.call}`,children:`Open the session`}),!r&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(W,{kind:`primary`,size:`sm`,onClick:()=>void t.open(`talk`),children:[(0,j.jsx)(uh,{name:`phone`,size:14}),`Call`]}),(0,j.jsxs)(W,{size:`sm`,onClick:()=>void t.open(`chat`),children:[(0,j.jsx)(uh,{name:`words`,size:14}),`Write`]})]})]})]})}function hJ({call:e,heard:t}){return ow(e,{onEntry:t}),null}function gJ(e){let t=e.mode===`talk`;switch(e.phase){case`idle`:return`Call or write`;case`connecting`:return`Joining the room…`;case`live`:return t?e.muted?`On a call — muted`:`On a call`:`Writing`;case`ended`:return t?`The call ended`:`The chat ended`;case`failed`:return`The room did not open`}}function _J(e){let t=e.mode===`talk`;switch(e.phase){case`idle`:return`Call: the browser asks for the microphone and the agent answers out loud. Write: text only, no audio.`;case`connecting`:return t?`The microphone opens as soon as the room does.`:`Opening a written room with the agent.`;case`live`:return t?`Speak, or type below. Everything lands in the log beside you.`:`Write below; the agent answers in writing.`;case`ended`:return`Judged at hang-up. Call or write to start another.`;case`failed`:return`Nothing reached the agent. The reason is above.`}}function vJ(e){let[t,n]=(0,D.useState)(()=>Date.now()/1e3);return(0,D.useEffect)(()=>{if(!e)return;let t=window.setInterval(()=>n(Date.now()/1e3),1e3);return()=>window.clearInterval(t)},[e]),t}var yJ=B({device:F().nullable(),expires_at:I(),answered:R()}),bJ=B({device:F().nullable(),org:F()});function xJ(e){return`/v1/login/pairings/${encodeURIComponent(e)}`}async function SJ(e,t){return yJ.parse(await A(e,xJ(t)))}async function CJ(e,t){return bJ.parse(await oa(e,xJ(t),{})).org}var wJ=`c`,TJ=`a terminal`;function EJ(){let e=M(),[t]=Yi(),n=t.get(wJ),[r,i]=(0,D.useState)(null),[a,o]=(0,D.useState)(!1),[s,c]=(0,D.useState)(null),[l,u]=(0,D.useState)(null);(0,D.useEffect)(()=>{if(n===null)return;let t=!1;return SJ(e,n).then(e=>{t||i(e)},e=>{t||u(e instanceof ta?e.message:String(e))}),()=>{t=!0}},[e,n]);let d=async()=>{if(n!==null){o(!0),u(null);try{c(await CJ(e,n))}catch(e){u(e instanceof ta?e.message:String(e))}finally{o(!1)}}};return n===null?(0,j.jsx)(OJ,{title:`No terminal is asking`,lede:DJ}):s===null?l!==null&&r===null?(0,j.jsx)(OJ,{title:`That link is no good`,lede:l}):(0,j.jsxs)(OJ,{title:`Sign this terminal in?`,lede:`A terminal calling itself ${r?.device??TJ} asked to be signed in as you. Approve it only if you just ran "pinecall login" on that machine yourself.`,children:[(0,j.jsx)(W,{kind:`primary`,size:`lg`,onClick:()=>void d(),disabled:a||r===null,children:a?`Signing in…`:`Yes, that is my terminal`}),l!==null&&(0,j.jsx)(`p`,{className:`terminal-refused`,children:l})]}):(0,j.jsx)(OJ,{title:`Your terminal is signed in`,lede:`Go back to it. You are in ${s}.`})}var DJ="Run `pinecall login` in your terminal — it prints a link, and that link comes back here.";function OJ({title:e,lede:t,children:n}){return(0,j.jsx)(`div`,{className:`terminal`,children:(0,j.jsxs)(`div`,{className:`terminal-card`,children:[(0,j.jsx)(`img`,{className:`terminal-mark`,src:`/pinecall-mark.png`,alt:``}),(0,j.jsx)(`h1`,{className:`terminal-title`,children:e}),(0,j.jsx)(`p`,{className:`terminal-lede`,children:t}),n]})})}var kJ=`minmax(0,1fr) minmax(0,1.3fr) 110px 110px 96px 90px 230px`,AJ={active:`green`,invited:`amber`,disabled:`gray`};function jJ({member:e,onChange:t,onResend:n,onReset:r,onRemove:i,yourself:a=!1}){let[o,s]=(0,D.useState)(!1),[c,l]=(0,D.useState)(null),[u,d]=(0,D.useState)(e.agents.join(` `)),[f,p]=(0,D.useState)(!1),m=async e=>{p(!0);try{await e()}finally{p(!1)}},h=()=>{l(null);let n=u.split(/[\s,]+/).filter(e=>e!==``);n.join(` `)!==e.agents.join(` `)&&m(()=>t({agents:n}))};return(0,j.jsxs)(`div`,{className:`ui-table-row`,style:{gridTemplateColumns:kJ},children:[(0,j.jsx)(`span`,{className:`ui-cell-strong ui-clip`,children:e.name}),(0,j.jsx)(`span`,{className:`ui-cell ui-clip`,children:e.email}),c===`role`?(0,j.jsx)(th,{size:`sm`,autoFocus:!0,value:e.role,onBlur:()=>l(null),onChange:e=>{l(null),m(()=>t({role:e.target.value}))},"aria-label":`${e.name}'s role`,children:xU.map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))}):(0,j.jsx)(`button`,{type:`button`,className:`team-editable team-role`,onClick:()=>l(`role`),title:`Change the role`,children:e.role}),c===`agents`?(0,j.jsx)(G,{size:`sm`,autoFocus:!0,value:u,placeholder:`every agent`,onChange:e=>d(e.target.value),onBlur:h,onKeyDown:t=>{t.key===`Enter`&&h(),t.key===`Escape`&&(d(e.agents.join(` `)),l(null))},"aria-label":`${e.name}'s agents`}):(0,j.jsx)(`button`,{type:`button`,className:`team-editable team-agents ui-clip`,onClick:()=>l(`agents`),title:`Change the agents`,children:e.agents.length===0?`every agent`:e.agents.join(`, `)}),(0,j.jsx)(`span`,{className:`ui-cell`,children:e.role===`admin`?(0,j.jsx)(`span`,{className:`ui-cell-faint`,children:`always`}):(0,j.jsx)(sh,{on:e.production,label:`${e.name} acts in production`,onChange:e=>void m(()=>t({production:e}))})}),(0,j.jsx)(`span`,{className:`ui-cell-end`,children:(0,j.jsx)(dh,{tone:AJ[e.status],children:e.status})}),(0,j.jsx)(`span`,{className:`ui-cell-end`,children:o?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{className:`team-sure`,children:`Remove for good?`}),(0,j.jsx)($m,{danger:!0,disabled:f,onClick:()=>void m(i),children:`Remove`}),(0,j.jsx)($m,{disabled:f,onClick:()=>s(!1),children:`Keep`})]}):(0,j.jsxs)(j.Fragment,{children:[e.status===`active`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)($m,{disabled:f,onClick:()=>void m(r),title:`A one-use link to choose a new password`,children:`Reset password`}),!a&&(0,j.jsx)($m,{disabled:f,onClick:()=>void m(()=>t({status:`disabled`})),children:`Disable`})]}),e.status===`disabled`&&(0,j.jsx)($m,{disabled:f,onClick:()=>void m(()=>t({status:`active`})),children:`Bring back`}),e.status===`invited`&&(0,j.jsx)($m,{disabled:f,onClick:()=>void m(n),children:`Resend invite`}),!a&&(0,j.jsx)($m,{danger:!0,disabled:f,onClick:()=>s(!0),title:`Out of the org for good: every key revoked, the seat freed`,children:`Remove`})]})})]})}var MJ={qa:{who:`Reads finished calls and the suites`,opens:`calls · evals`},supervisor:{who:`Sits beside a live call: listens, whispers, takes it over`,opens:`calls · evals · supervise · talk · memory`},manager:{who:`Runs the floor and the org's accounts, never the agent's declaration`,opens:`calls · evals · supervise · talk · memory · numbers · keys · providers · usage · team`},developer:{who:`Writes and runs the agent`,opens:`app · calls · talk · supervise · pipeline · knowledge · memory · evals`},admin:{who:`The org's owner`,opens:`every door`}},NJ=[`qa`,`supervisor`,`manager`,`developer`,`admin`],PJ=`110px minmax(0,1fr) minmax(0,1.4fr)`;function FJ(){return(0,j.jsxs)(H,{children:[(0,j.jsx)(U,{title:`Roles`,meta:`a preset of what a person's keys open — and where: the sandbox always, production when their switch is on (an admin's always is)`}),(0,j.jsx)(wh,{columns:PJ,labels:[`Role`,`Who`,`Opens`]}),NJ.map(e=>(0,j.jsxs)(Th,{columns:PJ,children:[(0,j.jsx)(`span`,{className:`ui-cell-strong`,children:e}),(0,j.jsx)(`span`,{className:`ui-cell-ink`,children:MJ[e].who}),(0,j.jsx)(`span`,{className:`ui-cell-faint team-role-opens`,children:MJ[e].opens})]},e))]})}var IJ=``;function LJ(){let e=M(),[t,n]=(0,D.useState)(null),[r,i]=(0,D.useState)(null),[a,o]=(0,D.useState)(!1),[s,c]=(0,D.useState)(!1);if((0,D.useEffect)(()=>{let t=!1;return AU(e).then(e=>{t||n(e)},e=>{t||i(BJ(e))}),()=>{t=!0}},[e]),t===null)return r===null?null:(0,j.jsxs)(H,{children:[(0,j.jsx)(U,{title:`Single sign-on`}),(0,j.jsx)(`div`,{className:`ui-card-body`,children:(0,j.jsx)(Km,{children:r})})]});let l=async()=>{if(!s){c(!0);return}i(null);try{await MU(e),n(await AU(e)),c(!1)}catch(e){i(BJ(e))}};return(0,j.jsxs)(H,{children:[(0,j.jsx)(U,{title:`Single sign-on`,meta:t.configured?`this org's people sign in with its identity provider`:`sign in with Google Workspace, Okta or Entra instead of a password`,children:t.configured&&!a&&(0,j.jsxs)(`span`,{className:`team-link-moves`,children:[(0,j.jsx)(W,{size:`xs`,onClick:()=>o(!0),children:`Change`}),(0,j.jsx)(W,{size:`xs`,kind:`danger`,onClick:()=>void l(),onBlur:()=>c(!1),children:s?`Remove · sure?`:`Remove`})]})}),t.configured&&!a?(0,j.jsxs)(`div`,{className:`team-sso-values`,children:[(0,j.jsx)(Xm,{label:`Issuer`,children:t.issuer}),(0,j.jsx)(Xm,{label:`Client ID`,children:t.client_id}),(0,j.jsx)(Xm,{label:`Client secret`,children:`kept, and never shown`}),(0,j.jsx)(Xm,{label:`Allowed domains`,children:t.domains.join(`, `)||`—`}),(0,j.jsx)(Xm,{label:`Arriving new`,children:t.role??`nobody: invite first`}),(0,j.jsx)(Xm,{label:`Passwords`,children:t.required?`stopped for this org`:`still work beside it`})]}):(0,j.jsx)(RJ,{sso:t,onSaved:e=>{n(e),o(!1)},onCancel:t.configured?()=>o(!1):void 0}),(0,j.jsx)(zJ,{uri:t.redirect_uri}),r!==null&&(0,j.jsx)(`div`,{className:`ui-card-body`,children:(0,j.jsx)(Km,{children:r})})]})}function RJ({sso:e,onSaved:t,onCancel:n}){let r=M(),[i,a]=(0,D.useState)(e.issuer??``),[o,s]=(0,D.useState)(e.client_id??``),[c,l]=(0,D.useState)(``),[u,d]=(0,D.useState)(e.domains.join(` `)),[f,p]=(0,D.useState)(e.role??IJ),[m,h]=(0,D.useState)(e.required),[g,_]=(0,D.useState)(!1),[v,y]=(0,D.useState)(null),b=async e=>{e.preventDefault(),_(!0),y(null);try{t(await jU(r,{issuer:i.trim(),client_id:o.trim(),client_secret:c,domains:u.split(/[\s,]+/).filter(e=>e!==``),role:f===IJ?null:f,required:m}))}catch(e){y(BJ(e))}finally{_(!1)}};return(0,j.jsxs)(`form`,{className:`team-sso-form`,onSubmit:e=>void b(e),children:[(0,j.jsxs)(`div`,{className:`team-sso-grid`,children:[(0,j.jsx)(rh,{label:`Issuer URL`,children:(0,j.jsx)(G,{type:`url`,placeholder:`https://accounts.google.com`,value:i,onChange:e=>a(e.target.value),required:!0})}),(0,j.jsx)(rh,{label:`Client ID`,children:(0,j.jsx)(G,{value:o,onChange:e=>s(e.target.value),required:!0})}),(0,j.jsx)(rh,{label:`Client secret, sent once`,children:(0,j.jsx)(G,{type:`password`,autoComplete:`off`,placeholder:`never shown again`,value:c,onChange:e=>l(e.target.value),required:!0})}),(0,j.jsx)(rh,{label:`Allowed domains`,children:(0,j.jsx)(G,{placeholder:`company.com other.com`,value:u,onChange:e=>d(e.target.value),required:!0})}),(0,j.jsx)(rh,{label:`Role for people who arrive new`,children:(0,j.jsxs)(th,{value:f,onChange:e=>p(e.target.value),children:[(0,j.jsx)(`option`,{value:IJ,children:`nobody: invite first`}),xU.map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))]})}),(0,j.jsxs)(`div`,{className:`team-sso-required`,children:[(0,j.jsx)(`span`,{className:`team-sso-required-words`,children:`Passwords stop working for this org`}),(0,j.jsx)(sh,{on:m,onChange:h,label:`Passwords stop working for this org`})]})]}),(0,j.jsxs)(`div`,{className:`team-sso-moves`,children:[(0,j.jsx)(W,{kind:`primary`,size:`form`,type:`submit`,disabled:g,children:g?`Asking the issuer…`:`Save`}),n!==void 0&&(0,j.jsx)(W,{size:`form`,onClick:n,children:`Cancel`}),(0,j.jsx)(`span`,{className:`ui-note`,children:`The gateway asks the issuer for its discovery document before it keeps anything.`})]}),(0,j.jsx)(Km,{children:v})]})}function zJ({uri:e}){let[t,n]=(0,D.useState)(!1);return(0,j.jsxs)(`div`,{className:`team-sso-redirect`,children:[(0,j.jsxs)(`div`,{className:`team-sso-redirect-head`,children:[(0,j.jsx)(`span`,{className:`ui-note`,children:`Register this at your identity provider as the redirect URI`}),(0,j.jsx)(W,{size:`xs`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>n(!0))},children:t?`Copied`:`Copy`})]}),(0,j.jsx)(`pre`,{className:`ui-code`,children:e})]})}function BJ(e){return e instanceof ta?e.message:String(e)}var VJ=[{tab:`people`,name:`People`},{tab:`roles`,name:`Roles`},{tab:`sso`,name:`Single sign-on`}];function HJ(){let e=M(),t=ig(Lh()),[n,r]=Yi(),i=VJ.some(e=>e.tab===n.get(`tab`))?n.get(`tab`):`people`,[a,o]=(0,D.useState)(null),[s,c]=(0,D.useState)(!1),[l,u]=(0,D.useState)(null),[d,f]=(0,D.useState)(null),p=async()=>o(await wU(e)),m=e=>r(e===`people`?{}:{tab:e});(0,D.useEffect)(()=>{let t=!1;return wU(e).then(e=>{t||o(e)},e=>{t||f(GJ(e))}),()=>{t=!0}},[e]);let h=async(t,n)=>{f(null);try{await OU(e,t,n),await p()}catch(e){f(GJ(e))}},g=async t=>{f(null);try{return u({link:await TU(e,t),kind:`invitation`}),await p(),!0}catch(e){return f(GJ(e)),!1}},_=async t=>{f(null);try{await DU(e,t),await p()}catch(e){f(GJ(e))}},v=async t=>{f(null);try{u({link:await EU(e,t),kind:`reset`})}catch(e){f(GJ(e))}},y=e=>(a??[]).filter(t=>t.status===e).length;return(0,j.jsxs)(bh,{width:1060,tight:!0,children:[(0,j.jsx)(xh,{title:`Team`,lede:`The org's people: who they are, what their keys may do, and how they sign in.`}),(0,j.jsx)(Mh,{label:`Team`,tabs:VJ,on:i,onPick:m}),i===`people`&&(0,j.jsxs)(j.Fragment,{children:[l!==null&&(0,j.jsx)(UJ,{invited:l.link,kind:l.kind,onClose:()=>u(null)}),(0,j.jsx)(Km,{children:d}),a!==null&&(0,j.jsxs)(H,{children:[(0,j.jsx)(U,{title:`People`,meta:[`${y(`active`)} active`,y(`invited`)>0&&`${y(`invited`)} invited`,y(`disabled`)>0&&`${y(`disabled`)} disabled`].filter(Boolean).join(` · `),action:s?void 0:(0,j.jsx)(W,{kind:`primary`,size:`sm`,className:`ui-card-action`,onClick:()=>c(!0),children:`Invite someone`})}),s&&(0,j.jsx)(WJ,{onInvite:async e=>{await g(e)&&c(!1)},onClose:()=>c(!1),onRoles:()=>m(`roles`)}),a.length===0?(0,j.jsx)(Gm,{children:`Nobody is a member yet: the org's machine key alone opens its doors. Invite the first person.`}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(wh,{columns:`minmax(0,1fr) minmax(0,1.3fr) 110px 110px 96px 90px 230px`,labels:[`Name`,`Email`,`Role`,`Agents`,`Production`,`Status>`,``]}),a.map(e=>(0,j.jsx)(jJ,{member:e,onChange:t=>h(e.id,t),onResend:async()=>{await g({email:e.email,name:e.name,role:e.role,agents:e.agents,production:e.production})},onReset:()=>v(e.id),onRemove:()=>_(e.id),yourself:e.id===t},e.id))]})]})]}),i===`roles`&&(0,j.jsx)(FJ,{}),i===`sso`&&(0,j.jsx)(LJ,{})]})}function UJ({invited:e,kind:t,onClose:n}){let r=KJ(e.token),[i,a]=(0,D.useState)(!1);return(0,j.jsxs)(H,{children:[(0,j.jsx)(U,{title:t===`reset`?`A new password for ${e.member.name}`:`${e.member.name} is invited`,meta:`copy it now: the table keeps the fingerprint, and it is never shown again`,children:(0,j.jsxs)(`span`,{className:`team-link-moves`,children:[(0,j.jsx)(W,{size:`xs`,onClick:()=>{navigator.clipboard.writeText(r).then(()=>a(!0))},children:i?`Copied`:`Copy`}),(0,j.jsx)(W,{size:`xs`,onClick:n,children:`Done`})]})}),(0,j.jsx)(`pre`,{className:`ui-code`,children:r}),(0,j.jsx)(`div`,{className:`ui-card-foot`,children:t===`reset`?`One use · dies ${e.expires_at} · hand it to them: it opens the card where they choose a new password. Any older link of theirs no longer opens.`:`One use · dies ${e.expires_at} · it opens a card where they choose their password and take their first key.`})]})}function WJ({onInvite:e,onClose:t,onRoles:n}){let[r,i]=(0,D.useState)(``),[a,o]=(0,D.useState)(``),[s,c]=(0,D.useState)(`qa`),[l,u]=(0,D.useState)(``),[d,f]=(0,D.useState)(!1),[p,m]=(0,D.useState)(!1),h=async t=>{t.preventDefault(),m(!0);try{await e({email:r.trim(),name:a.trim(),role:s,agents:l.split(/[\s,]+/).filter(e=>e!==``),production:d})}finally{m(!1)}};return(0,j.jsxs)(`div`,{className:`team-invite`,children:[(0,j.jsxs)(`form`,{className:`ui-form`,onSubmit:e=>void h(e),children:[(0,j.jsx)(rh,{label:`Email`,grow:!0,minWidth:180,children:(0,j.jsx)(G,{placeholder:`name@company.com`,type:`email`,value:r,onChange:e=>i(e.target.value),required:!0,autoFocus:!0})}),(0,j.jsx)(rh,{label:`Name`,grow:!0,minWidth:150,children:(0,j.jsx)(G,{placeholder:`Full name`,value:a,onChange:e=>o(e.target.value),required:!0})}),(0,j.jsx)(rh,{label:`Role`,minWidth:130,children:(0,j.jsx)(th,{value:s,onChange:e=>c(e.target.value),children:xU.map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))})}),(0,j.jsx)(rh,{label:`Agents`,minWidth:150,children:(0,j.jsx)(G,{placeholder:`every agent`,value:l,onChange:e=>u(e.target.value)})}),(0,j.jsx)(rh,{label:`Production`,minWidth:90,children:s===`admin`?(0,j.jsx)(`span`,{className:`ui-cell-faint`,children:`always`}):(0,j.jsx)(sh,{on:d,label:`acts in production`,onChange:f})}),(0,j.jsx)(W,{kind:`primary`,size:`form`,type:`submit`,disabled:p,children:p?`Inviting…`:`Invite`})]}),(0,j.jsxs)(`div`,{className:`team-roles`,children:[`A role is a preset of what their keys open — `,(0,j.jsx)($m,{onClick:n,children:`see what each one does`}),(0,j.jsx)(`span`,{className:`team-invite-close`,children:(0,j.jsx)($m,{onClick:t,children:`Close`})})]})]})}function GJ(e){return e instanceof ta?e.message:String(e)}function KJ(e){return`${window.location.origin}/invitations/${encodeURIComponent(e)}`}var qJ=B({cursor:I(),org:F(),agent:F(),call:F(),type:F(),at:I(),minutes:I(),messages:I(),input_tokens:I(),output_tokens:I(),characters:I(),judge_calls:I(),cost_eur:I()}),JJ=B({minutes:I(),messages:I(),input_tokens:I(),output_tokens:I(),characters:I(),judge_calls:I(),cost_eur:I(),calls:I()}),YJ=B({rows:z(qJ),totals:JJ.nullable(),next:I().nullable()});async function XJ(e,t=0){return YJ.parse(await A(e,`/v1/usage`,{after:t}))}function ZJ(e){let t=new Map;for(let n of e){let e=t.get(n.call)??{call:n.call,agent:n.agent,at:n.at,calls:1,minutes:0,messages:0,judge_calls:0,cost_eur:0};e.minutes+=n.minutes,e.messages+=n.messages,e.judge_calls+=n.judge_calls,e.cost_eur+=n.cost_eur,e.at=Math.min(e.at,n.at),t.set(n.call,e)}return[...t.values()].sort((e,t)=>t.at-e.at)}function QJ(e,t){let n=new Map;for(let r of e){let e=t(r),i=n.get(e)??{name:e,calls:0,minutes:0,messages:0,judge_calls:0,cost_eur:0};i.calls+=1,i.minutes+=r.minutes,i.messages+=r.messages,i.judge_calls+=r.judge_calls,i.cost_eur+=r.cost_eur,n.set(e,i)}return[...n.values()]}function $J(e){return QJ(e,e=>mg(e.at)).sort((e,t)=>t.name.localeCompare(e.name))}function eY(e){return QJ(e,e=>e.agent).sort((e,t)=>t.cost_eur-e.cost_eur)}function tY(e){return QJ(e,()=>``)[0]??{calls:0,minutes:0,messages:0,judge_calls:0,cost_eur:0}}var nY=[{tab:`days`,name:`By day`},{tab:`agents`,name:`By agent`},{tab:`calls`,name:`Call by call`}],rY=`minmax(0,1.2fr) 70px 80px 90px minmax(0,1fr) 90px`,iY=`130px 140px minmax(0,1fr) 70px 80px 90px`,aY=40;function oY(){let e=M(),t=Cg(),[n,r]=Yi(),i=nY.some(e=>e.tab===n.get(`tab`))?n.get(`tab`):`days`,[a,o]=(0,D.useState)(null),[s,c]=(0,D.useState)(null);(0,D.useEffect)(()=>{let t=!1;return(async()=>{try{let n=[],r=0;for(let i=0;i<aY;i+=1){let i=await XJ(e,r);if(t)return;if(n.push(...i.rows),o([...n]),i.next===null)break;r=i.next}}catch(e){t||c(e instanceof ta?e.message:String(e))}})(),()=>{t=!0}},[e]);let l=ZJ(a??[]),u=tY(l),d=$J(l),f=d.find(e=>e.name===hg().today)?.cost_eur??0,p=t?.budget??null;return(0,j.jsxs)(bh,{tight:!0,children:[(0,j.jsx)(xh,{title:`Usage`,lede:`What this org spent: the providers' bill as the call log knows it, never a price of ours.`}),(0,j.jsx)(Km,{children:s}),a!==null&&(0,j.jsxs)(Sh,{min:150,children:[(0,j.jsx)(Ch,{size:`small`,label:p===null?`Spent in all`:`Spent this month`,value:cg(p===null?u.cost_eur:p.spent_eur_month),of:p!==null&&p.limit_eur!==null?`of ${cg(p.limit_eur)}`:void 0,accent:!0}),(0,j.jsx)(Ch,{size:`small`,label:`Today`,value:cg(f)}),(0,j.jsx)(Ch,{size:`small`,label:`Calls`,value:u.calls}),(0,j.jsx)(Ch,{size:`small`,label:`Minutes`,value:u.minutes.toFixed(1)}),(0,j.jsx)(Ch,{size:`small`,label:`Per call`,value:u.calls===0?`—`:cg(u.cost_eur/u.calls)}),(0,j.jsx)(Ch,{size:`small`,label:`Per minute`,value:u.minutes===0?`—`:cg(u.cost_eur/u.minutes)})]}),(0,j.jsx)(Mh,{label:`Usage`,tabs:nY,on:i,onPick:e=>r(e===`days`?{}:{tab:e})}),a!==null&&l.length===0&&(0,j.jsx)(H,{children:(0,j.jsx)(Gm,{children:`Nothing metered yet: the first call to end writes the first row.`})}),l.length>0&&i!==`calls`&&(0,j.jsx)(sY,{label:i===`days`?`Day`:`Agent`,groups:i===`days`?d:eY(l)}),l.length>0&&i===`calls`&&(0,j.jsxs)(H,{children:[(0,j.jsx)(wh,{columns:iY,labels:[`Started`,`Agent`,`Call`,`Min>`,`Messages>`,`Cost>`]}),l.map(e=>(0,j.jsxs)(Th,{columns:iY,children:[(0,j.jsx)(`span`,{className:`ui-cell-faint`,children:dg(e.at)}),(0,j.jsx)(`span`,{className:`ui-cell-ink ui-clip`,children:e.agent}),(0,j.jsx)(k,{to:`/sessions/${e.call}`,className:`usage-call ui-clip`,children:e.call}),(0,j.jsx)(`span`,{className:`ui-cell-ink usage-right`,children:e.minutes.toFixed(1)}),(0,j.jsx)(`span`,{className:`ui-cell-ink usage-right`,children:e.messages}),(0,j.jsx)(`span`,{className:`usage-cost`,children:cg(e.cost_eur)})]},e.call)),(0,j.jsx)(Wm,{children:(0,j.jsxs)(`span`,{children:[l.length,` calls`,u.judge_calls>0&&` · ${u.judge_calls} judge calls`,` · a call's judging is folded into its line`]})})]})]})}function sY({label:e,groups:t}){let n=Math.max(...t.map(e=>e.cost_eur),0);return(0,j.jsxs)(H,{children:[(0,j.jsx)(wh,{columns:rY,labels:[e,`Calls>`,`Min>`,`Per call>`,``,`Cost>`]}),t.map(e=>(0,j.jsxs)(Th,{columns:rY,children:[(0,j.jsx)(`span`,{className:`ui-cell-strong ui-clip`,children:e.name}),(0,j.jsx)(`span`,{className:`ui-cell-ink usage-right`,children:e.calls}),(0,j.jsx)(`span`,{className:`ui-cell-ink usage-right`,children:e.minutes.toFixed(1)}),(0,j.jsx)(`span`,{className:`ui-cell-faint usage-right`,children:cg(e.cost_eur/e.calls)}),(0,j.jsx)(`span`,{className:`usage-bar`,children:(0,j.jsx)(yh,{share:n===0?0:e.cost_eur/n})}),(0,j.jsx)(`span`,{className:`usage-cost`,children:cg(e.cost_eur)})]},e.name))]})}var cY=B({title:F().nullable(),tagline:F().nullable(),greeting:F().nullable(),accent:F().nullable(),autostart:R()});async function lY(e,t){try{return cY.parse(await A(e,`/v1/agents/${encodeURIComponent(t)}/widget`))}catch(e){if(e instanceof ta&&e.status===404)return null;throw e}}async function uY(e,t,n){return cY.parse(await aa(e,`/v1/agents/${encodeURIComponent(t)}/widget`,n))}function dY(){return`${wm()}/widget/pinecall-widget.js`}var fY=null;function pY(){return fY??=yi(()=>import(dY()).then(()=>void 0,e=>{throw fY=null,Error(`the widget did not load from ${dY()}: ${e instanceof Error?e.message:String(e)}`)}),[]),fY}function mY(e,t,n,r){let i=document.createElement(`pinecall-widget`);i.setAttribute(`agent`,n);for(let[e,t]of Object.entries(r))i.setAttribute(e,t);return i.tokenProvider=e=>oa(t,`/v1/tokens`,{agent:n,scope:e,ttl_s:60,metadata:{page:`console preview`,scope:e}}),e.replaceChildren(i),i}var hY=[`#5b3df5`,`#101014`,`#0f766e`,`#be185d`];function gY(){let e=M(),t=Sr().agent??``,[n,r]=(0,D.useState)(`Assistant`),[i,a]=(0,D.useState)(``),[o,s]=(0,D.useState)(``),[c,l]=(0,D.useState)(``),[u,d]=(0,D.useState)(``),[f,p]=(0,D.useState)(!1),[m,h]=(0,D.useState)(hY[0]),[g,_]=(0,D.useState)(null),[v,y]=(0,D.useState)(!1),[b,x]=(0,D.useState)(null),[S,C]=(0,D.useState)(!1),[w,T]=(0,D.useState)(!1),ee={greeting:b!==null,autostart:b!==null},te=zh(),ne=b!==null&&(te===null||te.includes(`pipeline`)),re=(0,D.useRef)(null);(0,D.useEffect)(()=>{let n=!1;return lY(e,t).then(e=>{n||e===null||(x(e),e.title!==null&&r(e.title),e.tagline!==null&&s(e.tagline),e.greeting!==null&&d(e.greeting),e.accent!==null&&h(e.accent),p(e.autostart))},()=>void 0),()=>{n=!0}},[e,t]),(0,D.useEffect)(()=>{let n=!1;return Pb(e).then(e=>{let r=e.find(e=>e.route.agent===t&&e.route.number!==null)?.route.number;!n&&r!=null&&l(e=>e===``?yg(r):e)},()=>void 0),()=>{n=!0}},[e,t]);let E={title:n.trim()===``?null:n.trim(),tagline:o.trim()===``?null:o.trim(),greeting:u.trim()===``?null:u.trim(),accent:m,autostart:f},ie=b!==null&&((b.title??`Assistant`)!==n.trim()||(b.tagline??``)!==o.trim()||(b.greeting??``)!==u.trim()||(b.accent??hY[0])!==m||b.autostart!==f),ae=async()=>{C(!0),_(null);try{x(await uY(e,t,E)),T(!0),window.setTimeout(()=>T(!1),1500)}catch(e){_(e instanceof ta?e.message:String(e))}finally{C(!1)}};(0,D.useEffect)(()=>{let r=!1;return pY().then(()=>{if(r||re.current===null)return;let a={name:n,position:`inline`};i&&(a.company=i),o&&(a.tagline=o),c&&(a.phone=c),u&&(a.greeting=u),mY(re.current,e,t,a).style.setProperty(`--pc-accent`,m),_(null)},e=>{r||_(e instanceof Error?e.message:String(e))}),()=>{r=!0}},[e,t,n,i,o,c,u,m]);let oe=[`agent="${t}"`,`name="${n}"`,i&&`company="${i}"`,o&&`tagline="${o}"`,c&&`phone="${c}"`,ee.greeting&&u&&`greeting="${u}"`,ee.autostart&&f&&`autostart`,`token-url="/pinecall/token"`,`log-url="/pinecall/log"`].filter(Boolean),se=m===hY[0]?``:`\n<style>pinecall-widget { --pc-accent: ${m}; }</style>`,O=`<script type="module" src="${dY()}"><\/script>\n<pinecall-widget ${oe.join(`
122
+ An X-ray, an extraction, anything over 300 euros.`,onChange:e=>t(`knowledge`,e.target.value)}),(0,j.jsxs)(`p`,{className:`set-help`,children:[e.knowledge.length.toLocaleString(`en-US`),` characters. The documents it searches are not this: those are the Docs tab, attached under Bases.`]})]})]})}var Mq=[{tab:`hears`,name:`STT`},{tab:`decides`,name:`LLM`},{tab:`speaks`,name:`Voice`},{tab:`conversation`,name:`Conversation`},{tab:`memory`,name:`Memory`},{tab:`knowledge`,name:`Knowledge`},{tab:`bases`,name:`Bases`}],Nq=[`conversation`,`memory`,`knowledge`];function Pq(e){return e?Mq.filter(e=>Nq.includes(e.tab)):Mq}function Fq({standing:e,version:t,wordsOnly:n,voices:r,providers:i,defaults:a,models:o,bases:s,section:c,onPickSection:l,saving:u,error:d,onSave:f}){let p=new Set(i.map(e=>e.name)),[m,h]=(0,D.useState)(()=>Dq(e,p)),[g,_]=(0,D.useState)(!1),v=(e,t)=>{_(!1),h({...m,[e]:t})},y=e=>t=>{_(!1),h(e===`tts`&&t.vendor!==m.tts.vendor?{...m,tts:t,voice:``}:{...m,[e]:t})},b=m.tts.vendor===``?a.tts??`elevenlabs`:m.tts.vendor,x=async r=>{r.preventDefault(),await f(Oq(m,n,e),t,m.note.trim()===``?null:m.note.trim()),_(!0)};return(0,j.jsxs)(`form`,{className:`ui-card set-form`,onSubmit:e=>void x(e),children:[(0,j.jsx)(`div`,{className:`set-tabs`,children:(0,j.jsx)(Mh,{label:`Settings`,tabs:Pq(n),on:c,onPick:l})}),c===`hears`&&(0,j.jsx)(Cq,{modality:`stt`,title:`Speech to text`,blurb:`What turns the caller's voice into words.`,knob:m.stt,providers:i,defaults:a,models:o,onChange:y(`stt`)}),c===`decides`&&(0,j.jsx)(Cq,{modality:`llm`,title:`Language model`,blurb:`The model that reads what the caller said and writes the answer.`,knob:m.llm,providers:i,defaults:a,models:o,onChange:y(`llm`)}),c===`speaks`&&(0,j.jsx)(Cq,{modality:`tts`,title:`Voice`,blurb:`What says the answer out loud, and in which voice.`,knob:m.tts,providers:i,defaults:a,models:o,onChange:y(`tts`),children:(0,j.jsx)(wq,{vendor:b,voice:m.voice,voices:r,onChange:e=>v(`voice`,e)})}),c===`conversation`&&(0,j.jsx)(yq,{typed:m,wordsOnly:n,change:v}),c===`memory`&&(0,j.jsx)(Aq,{typed:m,change:v}),c===`knowledge`&&(0,j.jsx)(jq,{typed:m,change:v}),c===`bases`&&(0,j.jsx)(hq,{rows:m.bases,offered:s,onChange:e=>{_(!1),h({...m,bases:e})}}),(0,j.jsxs)(`div`,{className:`set-save`,children:[(0,j.jsx)(G,{className:`set-save-note`,value:m.note,placeholder:`Why, for the history (optional)`,"aria-label":`Why, for the history (optional)`,onChange:e=>v(`note`,e.target.value)}),(0,j.jsx)(W,{kind:`primary`,size:`form`,type:`submit`,disabled:u,children:u?`Saving…`:t===null?`Save as the first version`:`Save as v${t+1}`}),(0,j.jsx)(`span`,{className:d===null?`set-save-said`:`set-save-said set-save-error`,children:d===null?g?`Kept. The next call runs on it.`:`Every section is saved together, as one version. An empty field is the runtime's default.`:d})]})]})}function Iq({kept:e,canRollBack:t,onRollBack:n}){return(0,j.jsxs)(H,{children:[(0,j.jsx)(U,{title:`History`,meta:e===null?void 0:e.holder===``?`the org's own corner`:`corner ${e.holder}`}),e===null?(0,j.jsx)(Gm,{children:`Asking the gateway…`}):e.rows.length===0?(0,j.jsx)(Gm,{children:`Nothing set in this corner yet: the next call runs on what the corner falls back to.`}):e.rows.map((r,i)=>{let a=e.rows[i+1],o=vW(a?.config??{},r.config);return(0,j.jsxs)(`div`,{className:`set-version`,children:[(0,j.jsxs)(`div`,{className:`set-version-head`,children:[(0,j.jsxs)(`b`,{children:[`v`,r.version]}),(0,j.jsxs)(`span`,{className:`ui-cell-faint`,children:[r.author,` · `,dg(r.set_at)]}),r.note!==null&&(0,j.jsxs)(`span`,{className:`set-version-note`,children:[`“`,r.note,`”`]}),t&&i>0&&(0,j.jsx)(W,{size:`xs`,onClick:()=>void n(r.version),children:`Roll back to this`})]}),o.length>0&&(0,j.jsx)(`div`,{className:`set-version-changes`,children:o.join(` · `)})]},r.version)})]})}var Lq={yours:`Yours`,team:`Team`,production:`Production`};function Rq({answer:e,corners:t,first:n}){let[r,i]=(0,D.useState)(n),a=e[r];return(0,j.jsxs)(H,{children:[(0,j.jsx)(U,{title:`What is set now`,meta:e.world}),t.length>1&&(0,j.jsx)(`div`,{className:`set-now-pick`,children:(0,j.jsx)(ih,{options:t.map(e=>({value:e,label:Lq[e]})),value:r,onChange:i})}),(0,j.jsx)(`dl`,{className:`set-now`,children:hW.map(e=>(0,j.jsxs)(`div`,{className:`set-now-row`,children:[(0,j.jsx)(`dt`,{children:gW[e]}),(0,j.jsx)(`dd`,{className:Bq(a,e,r)===zq[r]?`set-now-none`:void 0,children:Bq(a,e,r)})]},e))}),(0,j.jsx)(`div`,{className:`set-now-foot`,children:a===null?`Nothing saved in this corner yet.`:Vq(a)})]})}var zq={yours:`the team's`,team:`—`,production:`—`};function Bq(e,t,n){return e===null?zq[n]:_W(e.config,t)??zq[n]}function Vq(e){return`v${e.version} · ${e.author} · ${dg(e.set_at)}${e.note===null?``:` · “${e.note}”`}`}function Hq(e){return e instanceof Error?e.message:String(e)}function Uq(){let e=M(),t=Sr().agent??``,n=zh(),[r,i]=Yi(),[a,o]=(0,D.useState)(null),[s,c]=(0,D.useState)(null),[l,u]=(0,D.useState)(null),[d,f]=(0,D.useState)(null),[p,m]=(0,D.useState)(!1),[h,g]=(0,D.useState)(!1),[_,v]=(0,D.useState)(null),[y,b]=(0,D.useState)(null),x=n!==null&&!n.includes(`pipeline`),S=Cm===`hosted`,C=Pq(x),w=r.get(`section`),T=C.some(e=>e.tab===w)?w:C[0].tab,ee=(0,D.useCallback)(async()=>{o(await dW(e,t)),c(await pW(e,t,S||p))},[e,t,p,S]);(0,D.useEffect)(()=>{let n=!1;return v(null),ee().catch(e=>{n||v(Hq(e))}),rG(e,t).then(e=>!n&&u(e),e=>{!n&&!(e instanceof ta&&(e.status===403||e.status===404))&&v(Hq(e))}),TW(e).then(e=>!n&&f(e.bases),()=>!n&&f([])),()=>{n=!0}},[e,t,ee]),(0,D.useEffect)(()=>{let e=()=>void ee().catch(()=>void 0);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[ee]);let te=async(n,r,i)=>{g(!0),v(null);try{o(await fW(e,t,{config:n,if_version:r,note:i,team:p})),c(await pW(e,t,S||p))}catch(e){v(Hq(e))}finally{g(!1)}},ne=async n=>{v(null);try{o(await mW(e,t,n,S||p)),c(await pW(e,t,S||p)),b(`v${n} is the newest again, as a new version.`)}catch(e){v(Hq(e))}},re=a===null?null:yW(a,S||p),E=re??(a===null||S||p?null:a.team),ie=jh({name:`settings.now`,initial:340,min:280,max:560,side:`right`}),ae=S?[`production`]:[`yours`,`team`,`production`];return(0,j.jsxs)(`div`,{className:`set-grid`,style:ie.style,children:[ie.handle,(0,j.jsxs)(bh,{width:1060,children:[(0,j.jsx)(xh,{title:`Settings`,ledeWidth:660,lede:S?`What this agent runs on in production. Every save is a new version with your name on it, and any version can be rolled back.`:`What this agent runs on in the sandbox: yours to try in your own corner, or the team's, which every corner falls back to. Every save is a version; production has its own page.`}),a===null&&(0,j.jsx)(Gm,{children:_??`Asking the gateway…`}),a!==null&&(0,j.jsxs)(`div`,{className:`set-main`,children:[!x&&!S&&(0,j.jsx)(`div`,{className:`set-corner-pick`,children:(0,j.jsx)(ch,{checked:p,onChange:m,children:`Write the team's corner, which every corner falls back to — not only yours`})}),(0,j.jsx)(Fq,{standing:E?.config??{},version:re?.version??null,wordsOnly:x,voices:l?.voices??[],providers:l?.providers??[],defaults:l?.defaults??{},models:l?.models??{},bases:d,section:T,onPickSection:e=>i(e===C[0].tab?{}:{section:e}),saving:h,error:_,onSave:te},`${t}-${p}-${re?.version??0}-${E?.version??0}-${l===null?`asking`:`read`}`)]}),y!==null&&(0,j.jsx)(`div`,{className:`ui-empty`,children:y}),(0,j.jsx)(Km,{children:_})]}),(0,j.jsx)(`aside`,{className:`set-pane`,"aria-label":`what is set, and its history`,children:a===null?(0,j.jsx)(`p`,{className:`set-pane-empty`,children:`Asking the gateway…`}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Rq,{answer:a,corners:ae,first:S?`production`:p?`team`:`yours`},p?`team`:`yours`),(0,j.jsx)(Iq,{kept:s,canRollBack:!x,onRollBack:ne})]})})]})}var Wq=`lk.transcription`,Gq=`lk.transcription_final`,Kq=`lk.chat`,qq=1500,Jq=`→`,Yq=`←`,Xq=`✗`;function Zq(e,t){let n=e.findIndex(e=>e.id===t.id);if(n===-1)return[...e,t];let r=e.slice();return r[n]=t,r}function Qq(e){return e.split(/(\s+)/).filter(e=>e.length>0)}function $q(e){let t=bw(e);if(t!==null)return{kind:`mark`,id:`mark-${e.seq}`,tone:`supervisor`,text:t.said};let n=e.data;switch(e.type){case`tool.call`:return{kind:`mark`,id:`mark-${e.seq}`,tone:`tool`,text:`${Jq} ${String(n.name)}(${tJ(n.arguments)})`};case`tool.result`:return{kind:`mark`,id:`mark-${e.seq}`,tone:`tool`,text:`${Yq} ${String(n.name)} ${eJ(n)}`};case`error`:return{kind:`mark`,id:`mark-${e.seq}`,tone:`error`,text:`${Xq} ${String(n.message)}`};default:return null}}function eJ(e){return e.error!==void 0&&e.error!==null?`error: ${tJ(e.error)}`:typeof e.summary==`string`?e.summary:e.output===void 0?`nothing`:tJ(e.output)}function tJ(e,t=80){let n=typeof e==`string`?e:JSON.stringify(e)??String(e);return n.length>t?`${n.slice(0,t-1)}…`:n}function nJ({lines:e,mode:t,head:n,children:r}){let i=(0,D.useRef)(null);return(0,D.useEffect)(()=>{let e=i.current;e&&(e.scrollTop=e.scrollHeight)},[e]),(0,j.jsxs)(`div`,{className:`ui-card talk-window`,children:[n??(0,j.jsxs)(`div`,{className:`ui-card-head`,children:[(0,j.jsx)(`span`,{className:`ui-card-title`,children:`This call`}),(0,j.jsx)(`span`,{className:`ui-card-meta`,children:`spoken or written, as the room says it`})]}),(0,j.jsxs)(`div`,{className:`talk-lines`,ref:i,children:[e.length===0&&(0,j.jsxs)(`p`,{className:`talk-quiet`,children:[`Nothing said yet. `,t===`talk`?`What you say and what you write both land here.`:`What you write and the agent's replies land here.`]}),e.map(e=>e.kind===`said`?(0,j.jsx)(rJ,{line:e},e.id):(0,j.jsx)(iJ,{mark:e},e.id))]}),r]})}function rJ({line:e}){return(0,j.jsx)(`div`,{className:e.speaker===`user`?`talk-said talk-said-you`:`talk-said`,children:(0,j.jsxs)(`p`,{className:`talk-bubble${e.speaker===`user`?` talk-bubble-you`:``}${!e.final||e.pending===!0?` talk-bubble-unsettled`:``}`,children:[Qq(e.text).map((e,t)=>(0,j.jsx)(`span`,{className:`talk-word`,children:e},t)),!e.final&&(0,j.jsx)(`span`,{className:`talk-cursor`,"aria-hidden":!0})]})})}function iJ({mark:e}){return(0,j.jsx)(`p`,{className:`talk-mark talk-mark-${e.tone}`,children:e.text})}function aJ({open:e,mode:t,onWrite:n}){let[r,i]=(0,D.useState)(``);return(0,j.jsxs)(`form`,{className:`talk-composer`,onSubmit:t=>{t.preventDefault();let a=r.trim();a!==``&&e&&(i(``),n(a))},children:[(0,j.jsx)(`input`,{className:`talk-write`,"aria-label":`Write to the agent`,value:r,disabled:!e,placeholder:e?t===`talk`?`Write to the agent — or just speak`:`Write to the agent`:`Call or Write first`,onChange:e=>i(e.target.value)}),(0,j.jsx)(`button`,{type:`submit`,className:`talk-send`,disabled:!e||r.trim()===``,children:`Send`})]})}var oJ=new Set;function sJ(e){oJ.add(e)}function cJ(e){return oJ.has(e)}var lJ=B({server_url:F(),participant_token:F(),call:F()});function uJ(e){let t=M(),[n,r]=(0,D.useState)(`idle`),[i,a]=(0,D.useState)(`talk`),[o,s]=(0,D.useState)(null),[c,l]=(0,D.useState)(!1),[u,d]=(0,D.useState)(null),[f,p]=(0,D.useState)([]),[m,h]=(0,D.useState)(null),g=(0,D.useRef)(null),_=(0,D.useRef)(new Set),v=(0,D.useRef)(null),y=(0,D.useRef)([]),b=(0,D.useRef)(null),x=(0,D.useCallback)(()=>{b.current!==null&&(window.clearTimeout(b.current),b.current=null);let e=y.current;y.current=[],e.length>0&&p(t=>[...t,...e])},[]),S=(0,D.useCallback)(e=>{if(!_.current.has(e.id)){_.current.add(e.id),e.speaker===`user`&&x(),p(t=>Zq(t,e)),v.current=e.speaker,e.speaker===`agent`&&x();return}p(t=>Zq(t,e))},[x]),C=(0,D.useRef)(0),w=(0,D.useCallback)(async e=>{let t=g.current;if(t===null)return;C.current+=1;let n=`typed-${C.current}`;x(),p(t=>[...t,{kind:`said`,id:n,speaker:`user`,text:e,final:!0,pending:!0}]),v.current=`user`;try{await t.localParticipant.sendText(e,{topic:Kq})}catch(e){p(e=>e.filter(e=>e.id!==n)),h(e instanceof Error?e.message:String(e))}},[x]),T=(0,D.useCallback)(e=>{if(e.type===`turn.user`){let t=String(e.data.text??``).trim();p(e=>{let n=e.findIndex(e=>e.kind===`said`&&e.pending===!0&&e.text.trim()===t);if(n===-1)return e;let r=e.slice();return r[n]={...e[n],pending:!1},r});return}let t=$q(e);if(t!==null){if(v.current===`agent`){p(e=>[...e,t]);return}y.current.push(t),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(x,qq)}},[x]),ee=(0,D.useCallback)(async n=>{r(`connecting`),a(n),l(!1),s(null),h(null),p([]),_.current.clear(),v.current=null,y.current=[];try{let i=lJ.parse(await oa(t,`/v1/tokens`,{agent:e,scope:n})),a=new XV;g.current=a,a.registerTextStreamHandler(Wq,(e,t)=>{dJ(a,e,t.identity,S)}),n===`talk`&&a.on(Y.TrackSubscribed,fJ),a.on(Y.TrackUnsubscribed,e=>e.detach().forEach(e=>e.remove())),a.on(Y.Disconnected,()=>r(`ended`)),sJ(i.call),d(i.call),await a.connect(i.server_url,i.participant_token),n===`talk`&&await a.localParticipant.setMicrophoneEnabled(!0),s(Date.now()/1e3),r(`live`)}catch(e){h(e instanceof Error?e.message:String(e)),r(`failed`)}},[e,t,S]),te=(0,D.useCallback)(async()=>{await g.current?.disconnect()},[]),ne=(0,D.useCallback)(async()=>{let e=g.current;e!==null&&(await e.localParticipant.setMicrophoneEnabled(c),l(!c))},[c]);return(0,D.useEffect)(()=>()=>{g.current?.disconnect()},[]),{phase:n,mode:i,call:u,lines:f,error:m,since:o,muted:c,open:ee,close:te,toggleMic:ne,write:w,heard:T}}async function dJ(e,t,n,r){let i=t.info.attributes?.[`lk.segment_id`]??t.info.id,a=e.remoteParticipants.get(n)?.kind===Hk.AGENT?`agent`:`user`,o=``;for await(let e of t)o+=e,r({kind:`said`,id:i,speaker:a,text:o,final:!1});r({kind:`said`,id:i,speaker:a,text:o,final:t.info.attributes?.[Gq]===`true`})}function fJ(e){if(e.kind!==$.Kind.Audio)return;let t=e.attach();t.style.display=`none`,document.body.append(t)}function pJ(){let e=Sr().agent??``,t=uJ(e),n=Lh(),{world:r}=Hh(),i=t.phase===`live`||t.phase===`connecting`,a=jh({name:`agent.inspector`,initial:330,min:260,max:620,side:`right`}),o=n?.name??n?.label??`this key`;return(0,j.jsxs)(`div`,{className:`talk-grid`,style:a.style,children:[a.handle,(0,j.jsxs)(bh,{width:760,children:[(0,j.jsx)(xh,{title:`Chat with ${e}`,lede:`Reach the agent as a customer would: call it with this machine's microphone and hear it answer, or write to it. On a call you can also type — a number, an address, a name nobody spells out loud.`}),(0,j.jsxs)(`div`,{className:`talk-facts`,children:[(0,j.jsxs)(`div`,{className:`talk-fact`,children:[(0,j.jsx)(`div`,{className:`talk-fact-label`,children:`You are`}),(0,j.jsxs)(`div`,{className:`talk-fact-value`,children:[o,` · you`]})]}),(0,j.jsxs)(`div`,{className:`talk-fact`,children:[(0,j.jsx)(`div`,{className:`talk-fact-label`,children:`Lands in`}),(0,j.jsxs)(`div`,{className:`talk-fact-value`,children:[r,` · counts in usage`]})]})]}),(0,j.jsx)(Km,{children:t.error}),(0,j.jsx)(nJ,{lines:i||t.phase===`ended`?t.lines:[],mode:t.mode,head:(0,j.jsx)(mJ,{agent:e,live:t}),children:(0,j.jsx)(aJ,{open:t.phase===`live`,mode:t.mode,onWrite:t.write})}),t.call!==null&&(0,j.jsx)(hJ,{call:t.call,heard:t.heard})]}),(0,j.jsx)(uw,{agent:e,call:t.call})]})}function mJ({agent:e,live:t}){let n=vJ(t.phase===`live`),r=t.phase===`live`||t.phase===`connecting`,i=t.mode===`talk`;return(0,j.jsxs)(`div`,{className:`ui-card-head talk-bar`,children:[r&&i&&(0,j.jsx)(`button`,{type:`button`,className:`talk-door talk-door-on`,disabled:t.phase===`connecting`,onClick:()=>void t.close(),"aria-label":`Hang up`,children:(0,j.jsx)(uh,{name:`phone`,size:17})}),r&&!i&&(0,j.jsx)(`span`,{className:t.phase===`live`?`talk-light talk-light-on`:`talk-light`,"aria-hidden":!0}),(0,j.jsxs)(`div`,{className:`talk-standing`,children:[(0,j.jsxs)(`div`,{className:`talk-phase`,children:[gJ(t),t.phase===`live`&&(0,j.jsx)(`span`,{className:`talk-clock`,children:sg(t.since,n)})]}),(0,j.jsx)(`div`,{className:`talk-hint`,children:_J(t)})]}),(0,j.jsxs)(`div`,{className:`talk-moves`,children:[t.phase===`live`&&i&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:t.muted?`talk-bars`:`talk-bars talk-bars-on`,"aria-hidden":!0,children:[(0,j.jsx)(`span`,{}),(0,j.jsx)(`span`,{}),(0,j.jsx)(`span`,{}),(0,j.jsx)(`span`,{}),(0,j.jsx)(`span`,{})]}),(0,j.jsx)(W,{size:`sm`,onClick:()=>void t.toggleMic(),children:t.muted?`Unmute`:`Mute`})]}),r&&!i&&(0,j.jsx)(W,{kind:`danger`,size:`sm`,disabled:t.phase===`connecting`,onClick:()=>void t.close(),children:`End chat`}),t.phase===`ended`&&t.call!==null&&(0,j.jsx)(Qm,{size:`sm`,to:`/a/${e}/sessions/${t.call}`,children:`Open the session`}),!r&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(W,{kind:`primary`,size:`sm`,onClick:()=>void t.open(`talk`),children:[(0,j.jsx)(uh,{name:`phone`,size:14}),`Call`]}),(0,j.jsxs)(W,{size:`sm`,onClick:()=>void t.open(`chat`),children:[(0,j.jsx)(uh,{name:`words`,size:14}),`Write`]})]})]})]})}function hJ({call:e,heard:t}){return ow(e,{onEntry:t}),null}function gJ(e){let t=e.mode===`talk`;switch(e.phase){case`idle`:return`Call or write`;case`connecting`:return`Joining the room…`;case`live`:return t?e.muted?`On a call — muted`:`On a call`:`Writing`;case`ended`:return t?`The call ended`:`The chat ended`;case`failed`:return`The room did not open`}}function _J(e){let t=e.mode===`talk`;switch(e.phase){case`idle`:return`Call: the browser asks for the microphone and the agent answers out loud. Write: text only, no audio.`;case`connecting`:return t?`The microphone opens as soon as the room does.`:`Opening a written room with the agent.`;case`live`:return t?`Speak, or type below. Everything lands in the log beside you.`:`Write below; the agent answers in writing.`;case`ended`:return`Judged at hang-up. Call or write to start another.`;case`failed`:return`Nothing reached the agent. The reason is above.`}}function vJ(e){let[t,n]=(0,D.useState)(()=>Date.now()/1e3);return(0,D.useEffect)(()=>{if(!e)return;let t=window.setInterval(()=>n(Date.now()/1e3),1e3);return()=>window.clearInterval(t)},[e]),t}var yJ=B({device:F().nullable(),expires_at:I(),answered:R()}),bJ=B({device:F().nullable(),org:F()});function xJ(e){return`/v1/login/pairings/${encodeURIComponent(e)}`}async function SJ(e,t){return yJ.parse(await A(e,xJ(t)))}async function CJ(e,t){return bJ.parse(await oa(e,xJ(t),{})).org}var wJ=`c`,TJ=`a terminal`;function EJ(){let e=M(),[t]=Yi(),n=t.get(wJ),[r,i]=(0,D.useState)(null),[a,o]=(0,D.useState)(!1),[s,c]=(0,D.useState)(null),[l,u]=(0,D.useState)(null);(0,D.useEffect)(()=>{if(n===null)return;let t=!1;return SJ(e,n).then(e=>{t||i(e)},e=>{t||u(e instanceof ta?e.message:String(e))}),()=>{t=!0}},[e,n]);let d=async()=>{if(n!==null){o(!0),u(null);try{c(await CJ(e,n))}catch(e){u(e instanceof ta?e.message:String(e))}finally{o(!1)}}};return n===null?(0,j.jsx)(OJ,{title:`No terminal is asking`,lede:DJ}):s===null?l!==null&&r===null?(0,j.jsx)(OJ,{title:`That link is no good`,lede:l}):(0,j.jsxs)(OJ,{title:`Sign this terminal in?`,lede:`A terminal calling itself ${r?.device??TJ} asked to be signed in as you. Approve it only if you just ran "pinecall login" on that machine yourself.`,children:[(0,j.jsx)(W,{kind:`primary`,size:`lg`,onClick:()=>void d(),disabled:a||r===null,children:a?`Signing in…`:`Yes, that is my terminal`}),l!==null&&(0,j.jsx)(`p`,{className:`terminal-refused`,children:l})]}):(0,j.jsx)(OJ,{title:`Your terminal is signed in`,lede:`Go back to it. You are in ${s}.`})}var DJ="Run `pinecall login` in your terminal — it prints a link, and that link comes back here.";function OJ({title:e,lede:t,children:n}){return(0,j.jsx)(`div`,{className:`terminal`,children:(0,j.jsxs)(`div`,{className:`terminal-card`,children:[(0,j.jsx)(`img`,{className:`terminal-mark`,src:`/pinecall-mark.png`,alt:``}),(0,j.jsx)(`h1`,{className:`terminal-title`,children:e}),(0,j.jsx)(`p`,{className:`terminal-lede`,children:t}),n]})})}var kJ=`minmax(0,1fr) minmax(0,1.3fr) 110px 110px 96px 90px 230px`,AJ={active:`green`,invited:`amber`,disabled:`gray`};function jJ({member:e,onChange:t,onResend:n,onReset:r,onRemove:i,yourself:a=!1}){let[o,s]=(0,D.useState)(!1),[c,l]=(0,D.useState)(null),[u,d]=(0,D.useState)(e.agents.join(` `)),[f,p]=(0,D.useState)(!1),m=async e=>{p(!0);try{await e()}finally{p(!1)}},h=()=>{l(null);let n=u.split(/[\s,]+/).filter(e=>e!==``);n.join(` `)!==e.agents.join(` `)&&m(()=>t({agents:n}))};return(0,j.jsxs)(`div`,{className:`ui-table-row`,style:{gridTemplateColumns:kJ},children:[(0,j.jsx)(`span`,{className:`ui-cell-strong ui-clip`,children:e.name}),(0,j.jsx)(`span`,{className:`ui-cell ui-clip`,children:e.email}),c===`role`?(0,j.jsx)(th,{size:`sm`,autoFocus:!0,value:e.role,onBlur:()=>l(null),onChange:e=>{l(null),m(()=>t({role:e.target.value}))},"aria-label":`${e.name}'s role`,children:xU.map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))}):(0,j.jsx)(`button`,{type:`button`,className:`team-editable team-role`,onClick:()=>l(`role`),title:`Change the role`,children:e.role}),c===`agents`?(0,j.jsx)(G,{size:`sm`,autoFocus:!0,value:u,placeholder:`every agent`,onChange:e=>d(e.target.value),onBlur:h,onKeyDown:t=>{t.key===`Enter`&&h(),t.key===`Escape`&&(d(e.agents.join(` `)),l(null))},"aria-label":`${e.name}'s agents`}):(0,j.jsx)(`button`,{type:`button`,className:`team-editable team-agents ui-clip`,onClick:()=>l(`agents`),title:`Change the agents`,children:e.agents.length===0?`every agent`:e.agents.join(`, `)}),(0,j.jsx)(`span`,{className:`ui-cell`,children:e.role===`admin`?(0,j.jsx)(`span`,{className:`ui-cell-faint`,children:`always`}):(0,j.jsx)(sh,{on:e.production,label:`${e.name} acts in production`,onChange:e=>void m(()=>t({production:e}))})}),(0,j.jsx)(`span`,{className:`ui-cell-end`,children:(0,j.jsx)(dh,{tone:AJ[e.status],children:e.status})}),(0,j.jsx)(`span`,{className:`ui-cell-end`,children:o?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{className:`team-sure`,children:`Remove for good?`}),(0,j.jsx)($m,{danger:!0,disabled:f,onClick:()=>void m(i),children:`Remove`}),(0,j.jsx)($m,{disabled:f,onClick:()=>s(!1),children:`Keep`})]}):(0,j.jsxs)(j.Fragment,{children:[e.status===`active`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)($m,{disabled:f,onClick:()=>void m(r),title:`A one-use link to choose a new password`,children:`Reset password`}),!a&&(0,j.jsx)($m,{disabled:f,onClick:()=>void m(()=>t({status:`disabled`})),children:`Disable`})]}),e.status===`disabled`&&(0,j.jsx)($m,{disabled:f,onClick:()=>void m(()=>t({status:`active`})),children:`Bring back`}),e.status===`invited`&&(0,j.jsx)($m,{disabled:f,onClick:()=>void m(n),children:`Resend invite`}),!a&&(0,j.jsx)($m,{danger:!0,disabled:f,onClick:()=>s(!0),title:`Out of the org for good: every key revoked, the seat freed`,children:`Remove`})]})})]})}var MJ={qa:{who:`Reads finished calls and the suites`,opens:`calls · evals`},supervisor:{who:`Sits beside a live call: listens, whispers, takes it over`,opens:`calls · evals · supervise · talk · memory · words`},manager:{who:`Runs the floor and the org's accounts, never the agent's declaration`,opens:`calls · evals · supervise · talk · memory · numbers · keys · providers · usage · team · words`},developer:{who:`Writes and runs the agent`,opens:`app · calls · talk · supervise · pipeline · knowledge · memory · evals · words`},admin:{who:`The org's owner`,opens:`every door`}},NJ=[`qa`,`supervisor`,`manager`,`developer`,`admin`],PJ=`110px minmax(0,1fr) minmax(0,1.4fr)`;function FJ(){return(0,j.jsxs)(H,{children:[(0,j.jsx)(U,{title:`Roles`,meta:`a preset of what a person's keys open — and where: the sandbox always, production when their switch is on (an admin's always is)`}),(0,j.jsx)(wh,{columns:PJ,labels:[`Role`,`Who`,`Opens`]}),NJ.map(e=>(0,j.jsxs)(Th,{columns:PJ,children:[(0,j.jsx)(`span`,{className:`ui-cell-strong`,children:e}),(0,j.jsx)(`span`,{className:`ui-cell-ink`,children:MJ[e].who}),(0,j.jsx)(`span`,{className:`ui-cell-faint team-role-opens`,children:MJ[e].opens})]},e))]})}var IJ=``;function LJ(){let e=M(),[t,n]=(0,D.useState)(null),[r,i]=(0,D.useState)(null),[a,o]=(0,D.useState)(!1),[s,c]=(0,D.useState)(!1);if((0,D.useEffect)(()=>{let t=!1;return AU(e).then(e=>{t||n(e)},e=>{t||i(BJ(e))}),()=>{t=!0}},[e]),t===null)return r===null?null:(0,j.jsxs)(H,{children:[(0,j.jsx)(U,{title:`Single sign-on`}),(0,j.jsx)(`div`,{className:`ui-card-body`,children:(0,j.jsx)(Km,{children:r})})]});let l=async()=>{if(!s){c(!0);return}i(null);try{await MU(e),n(await AU(e)),c(!1)}catch(e){i(BJ(e))}};return(0,j.jsxs)(H,{children:[(0,j.jsx)(U,{title:`Single sign-on`,meta:t.configured?`this org's people sign in with its identity provider`:`sign in with Google Workspace, Okta or Entra instead of a password`,children:t.configured&&!a&&(0,j.jsxs)(`span`,{className:`team-link-moves`,children:[(0,j.jsx)(W,{size:`xs`,onClick:()=>o(!0),children:`Change`}),(0,j.jsx)(W,{size:`xs`,kind:`danger`,onClick:()=>void l(),onBlur:()=>c(!1),children:s?`Remove · sure?`:`Remove`})]})}),t.configured&&!a?(0,j.jsxs)(`div`,{className:`team-sso-values`,children:[(0,j.jsx)(Xm,{label:`Issuer`,children:t.issuer}),(0,j.jsx)(Xm,{label:`Client ID`,children:t.client_id}),(0,j.jsx)(Xm,{label:`Client secret`,children:`kept, and never shown`}),(0,j.jsx)(Xm,{label:`Allowed domains`,children:t.domains.join(`, `)||`—`}),(0,j.jsx)(Xm,{label:`Arriving new`,children:t.role??`nobody: invite first`}),(0,j.jsx)(Xm,{label:`Passwords`,children:t.required?`stopped for this org`:`still work beside it`})]}):(0,j.jsx)(RJ,{sso:t,onSaved:e=>{n(e),o(!1)},onCancel:t.configured?()=>o(!1):void 0}),(0,j.jsx)(zJ,{uri:t.redirect_uri}),r!==null&&(0,j.jsx)(`div`,{className:`ui-card-body`,children:(0,j.jsx)(Km,{children:r})})]})}function RJ({sso:e,onSaved:t,onCancel:n}){let r=M(),[i,a]=(0,D.useState)(e.issuer??``),[o,s]=(0,D.useState)(e.client_id??``),[c,l]=(0,D.useState)(``),[u,d]=(0,D.useState)(e.domains.join(` `)),[f,p]=(0,D.useState)(e.role??IJ),[m,h]=(0,D.useState)(e.required),[g,_]=(0,D.useState)(!1),[v,y]=(0,D.useState)(null),b=async e=>{e.preventDefault(),_(!0),y(null);try{t(await jU(r,{issuer:i.trim(),client_id:o.trim(),client_secret:c,domains:u.split(/[\s,]+/).filter(e=>e!==``),role:f===IJ?null:f,required:m}))}catch(e){y(BJ(e))}finally{_(!1)}};return(0,j.jsxs)(`form`,{className:`team-sso-form`,onSubmit:e=>void b(e),children:[(0,j.jsxs)(`div`,{className:`team-sso-grid`,children:[(0,j.jsx)(rh,{label:`Issuer URL`,children:(0,j.jsx)(G,{type:`url`,placeholder:`https://accounts.google.com`,value:i,onChange:e=>a(e.target.value),required:!0})}),(0,j.jsx)(rh,{label:`Client ID`,children:(0,j.jsx)(G,{value:o,onChange:e=>s(e.target.value),required:!0})}),(0,j.jsx)(rh,{label:`Client secret, sent once`,children:(0,j.jsx)(G,{type:`password`,autoComplete:`off`,placeholder:`never shown again`,value:c,onChange:e=>l(e.target.value),required:!0})}),(0,j.jsx)(rh,{label:`Allowed domains`,children:(0,j.jsx)(G,{placeholder:`company.com other.com`,value:u,onChange:e=>d(e.target.value),required:!0})}),(0,j.jsx)(rh,{label:`Role for people who arrive new`,children:(0,j.jsxs)(th,{value:f,onChange:e=>p(e.target.value),children:[(0,j.jsx)(`option`,{value:IJ,children:`nobody: invite first`}),xU.map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))]})}),(0,j.jsxs)(`div`,{className:`team-sso-required`,children:[(0,j.jsx)(`span`,{className:`team-sso-required-words`,children:`Passwords stop working for this org`}),(0,j.jsx)(sh,{on:m,onChange:h,label:`Passwords stop working for this org`})]})]}),(0,j.jsxs)(`div`,{className:`team-sso-moves`,children:[(0,j.jsx)(W,{kind:`primary`,size:`form`,type:`submit`,disabled:g,children:g?`Asking the issuer…`:`Save`}),n!==void 0&&(0,j.jsx)(W,{size:`form`,onClick:n,children:`Cancel`}),(0,j.jsx)(`span`,{className:`ui-note`,children:`The gateway asks the issuer for its discovery document before it keeps anything.`})]}),(0,j.jsx)(Km,{children:v})]})}function zJ({uri:e}){let[t,n]=(0,D.useState)(!1);return(0,j.jsxs)(`div`,{className:`team-sso-redirect`,children:[(0,j.jsxs)(`div`,{className:`team-sso-redirect-head`,children:[(0,j.jsx)(`span`,{className:`ui-note`,children:`Register this at your identity provider as the redirect URI`}),(0,j.jsx)(W,{size:`xs`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>n(!0))},children:t?`Copied`:`Copy`})]}),(0,j.jsx)(`pre`,{className:`ui-code`,children:e})]})}function BJ(e){return e instanceof ta?e.message:String(e)}var VJ=[{tab:`people`,name:`People`},{tab:`roles`,name:`Roles`},{tab:`sso`,name:`Single sign-on`}];function HJ(){let e=M(),t=ig(Lh()),[n,r]=Yi(),i=VJ.some(e=>e.tab===n.get(`tab`))?n.get(`tab`):`people`,[a,o]=(0,D.useState)(null),[s,c]=(0,D.useState)(!1),[l,u]=(0,D.useState)(null),[d,f]=(0,D.useState)(null),p=async()=>o(await wU(e)),m=e=>r(e===`people`?{}:{tab:e});(0,D.useEffect)(()=>{let t=!1;return wU(e).then(e=>{t||o(e)},e=>{t||f(GJ(e))}),()=>{t=!0}},[e]);let h=async(t,n)=>{f(null);try{await OU(e,t,n),await p()}catch(e){f(GJ(e))}},g=async t=>{f(null);try{return u({link:await TU(e,t),kind:`invitation`}),await p(),!0}catch(e){return f(GJ(e)),!1}},_=async t=>{f(null);try{await DU(e,t),await p()}catch(e){f(GJ(e))}},v=async t=>{f(null);try{u({link:await EU(e,t),kind:`reset`})}catch(e){f(GJ(e))}},y=e=>(a??[]).filter(t=>t.status===e).length;return(0,j.jsxs)(bh,{width:1060,tight:!0,children:[(0,j.jsx)(xh,{title:`Team`,lede:`The org's people: who they are, what their keys may do, and how they sign in.`}),(0,j.jsx)(Mh,{label:`Team`,tabs:VJ,on:i,onPick:m}),i===`people`&&(0,j.jsxs)(j.Fragment,{children:[l!==null&&(0,j.jsx)(UJ,{invited:l.link,kind:l.kind,onClose:()=>u(null)}),(0,j.jsx)(Km,{children:d}),a!==null&&(0,j.jsxs)(H,{children:[(0,j.jsx)(U,{title:`People`,meta:[`${y(`active`)} active`,y(`invited`)>0&&`${y(`invited`)} invited`,y(`disabled`)>0&&`${y(`disabled`)} disabled`].filter(Boolean).join(` · `),action:s?void 0:(0,j.jsx)(W,{kind:`primary`,size:`sm`,className:`ui-card-action`,onClick:()=>c(!0),children:`Invite someone`})}),s&&(0,j.jsx)(WJ,{onInvite:async e=>{await g(e)&&c(!1)},onClose:()=>c(!1),onRoles:()=>m(`roles`)}),a.length===0?(0,j.jsx)(Gm,{children:`Nobody is a member yet: the org's machine key alone opens its doors. Invite the first person.`}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(wh,{columns:`minmax(0,1fr) minmax(0,1.3fr) 110px 110px 96px 90px 230px`,labels:[`Name`,`Email`,`Role`,`Agents`,`Production`,`Status>`,``]}),a.map(e=>(0,j.jsx)(jJ,{member:e,onChange:t=>h(e.id,t),onResend:async()=>{await g({email:e.email,name:e.name,role:e.role,agents:e.agents,production:e.production})},onReset:()=>v(e.id),onRemove:()=>_(e.id),yourself:e.id===t},e.id))]})]})]}),i===`roles`&&(0,j.jsx)(FJ,{}),i===`sso`&&(0,j.jsx)(LJ,{})]})}function UJ({invited:e,kind:t,onClose:n}){let r=KJ(e.token),[i,a]=(0,D.useState)(!1);return(0,j.jsxs)(H,{children:[(0,j.jsx)(U,{title:t===`reset`?`A new password for ${e.member.name}`:`${e.member.name} is invited`,meta:`copy it now: the table keeps the fingerprint, and it is never shown again`,children:(0,j.jsxs)(`span`,{className:`team-link-moves`,children:[(0,j.jsx)(W,{size:`xs`,onClick:()=>{navigator.clipboard.writeText(r).then(()=>a(!0))},children:i?`Copied`:`Copy`}),(0,j.jsx)(W,{size:`xs`,onClick:n,children:`Done`})]})}),(0,j.jsx)(`pre`,{className:`ui-code`,children:r}),(0,j.jsx)(`div`,{className:`ui-card-foot`,children:t===`reset`?`One use · dies ${e.expires_at} · hand it to them: it opens the card where they choose a new password. Any older link of theirs no longer opens.`:`One use · dies ${e.expires_at} · it opens a card where they choose their password and take their first key.`})]})}function WJ({onInvite:e,onClose:t,onRoles:n}){let[r,i]=(0,D.useState)(``),[a,o]=(0,D.useState)(``),[s,c]=(0,D.useState)(`qa`),[l,u]=(0,D.useState)(``),[d,f]=(0,D.useState)(!1),[p,m]=(0,D.useState)(!1),h=async t=>{t.preventDefault(),m(!0);try{await e({email:r.trim(),name:a.trim(),role:s,agents:l.split(/[\s,]+/).filter(e=>e!==``),production:d})}finally{m(!1)}};return(0,j.jsxs)(`div`,{className:`team-invite`,children:[(0,j.jsxs)(`form`,{className:`ui-form`,onSubmit:e=>void h(e),children:[(0,j.jsx)(rh,{label:`Email`,grow:!0,minWidth:180,children:(0,j.jsx)(G,{placeholder:`name@company.com`,type:`email`,value:r,onChange:e=>i(e.target.value),required:!0,autoFocus:!0})}),(0,j.jsx)(rh,{label:`Name`,grow:!0,minWidth:150,children:(0,j.jsx)(G,{placeholder:`Full name`,value:a,onChange:e=>o(e.target.value),required:!0})}),(0,j.jsx)(rh,{label:`Role`,minWidth:130,children:(0,j.jsx)(th,{value:s,onChange:e=>c(e.target.value),children:xU.map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))})}),(0,j.jsx)(rh,{label:`Agents`,minWidth:150,children:(0,j.jsx)(G,{placeholder:`every agent`,value:l,onChange:e=>u(e.target.value)})}),(0,j.jsx)(rh,{label:`Production`,minWidth:90,children:s===`admin`?(0,j.jsx)(`span`,{className:`ui-cell-faint`,children:`always`}):(0,j.jsx)(sh,{on:d,label:`acts in production`,onChange:f})}),(0,j.jsx)(W,{kind:`primary`,size:`form`,type:`submit`,disabled:p,children:p?`Inviting…`:`Invite`})]}),(0,j.jsxs)(`div`,{className:`team-roles`,children:[`A role is a preset of what their keys open — `,(0,j.jsx)($m,{onClick:n,children:`see what each one does`}),(0,j.jsx)(`span`,{className:`team-invite-close`,children:(0,j.jsx)($m,{onClick:t,children:`Close`})})]})]})}function GJ(e){return e instanceof ta?e.message:String(e)}function KJ(e){return`${window.location.origin}/invitations/${encodeURIComponent(e)}`}var qJ=B({cursor:I(),org:F(),agent:F(),call:F(),type:F(),at:I(),minutes:I(),messages:I(),input_tokens:I(),output_tokens:I(),characters:I(),judge_calls:I(),cost_eur:I()}),JJ=B({minutes:I(),messages:I(),input_tokens:I(),output_tokens:I(),characters:I(),judge_calls:I(),cost_eur:I(),calls:I()}),YJ=B({rows:z(qJ),totals:JJ.nullable(),next:I().nullable()});async function XJ(e,t=0){return YJ.parse(await A(e,`/v1/usage`,{after:t}))}function ZJ(e){let t=new Map;for(let n of e){let e=t.get(n.call)??{call:n.call,agent:n.agent,at:n.at,calls:1,minutes:0,messages:0,judge_calls:0,cost_eur:0};e.minutes+=n.minutes,e.messages+=n.messages,e.judge_calls+=n.judge_calls,e.cost_eur+=n.cost_eur,e.at=Math.min(e.at,n.at),t.set(n.call,e)}return[...t.values()].sort((e,t)=>t.at-e.at)}function QJ(e,t){let n=new Map;for(let r of e){let e=t(r),i=n.get(e)??{name:e,calls:0,minutes:0,messages:0,judge_calls:0,cost_eur:0};i.calls+=1,i.minutes+=r.minutes,i.messages+=r.messages,i.judge_calls+=r.judge_calls,i.cost_eur+=r.cost_eur,n.set(e,i)}return[...n.values()]}function $J(e){return QJ(e,e=>mg(e.at)).sort((e,t)=>t.name.localeCompare(e.name))}function eY(e){return QJ(e,e=>e.agent).sort((e,t)=>t.cost_eur-e.cost_eur)}function tY(e){return QJ(e,()=>``)[0]??{calls:0,minutes:0,messages:0,judge_calls:0,cost_eur:0}}var nY=[{tab:`days`,name:`By day`},{tab:`agents`,name:`By agent`},{tab:`calls`,name:`Call by call`}],rY=`minmax(0,1.2fr) 70px 80px 90px minmax(0,1fr) 90px`,iY=`130px 140px minmax(0,1fr) 70px 80px 90px`,aY=40;function oY(){let e=M(),t=Cg(),[n,r]=Yi(),i=nY.some(e=>e.tab===n.get(`tab`))?n.get(`tab`):`days`,[a,o]=(0,D.useState)(null),[s,c]=(0,D.useState)(null);(0,D.useEffect)(()=>{let t=!1;return(async()=>{try{let n=[],r=0;for(let i=0;i<aY;i+=1){let i=await XJ(e,r);if(t)return;if(n.push(...i.rows),o([...n]),i.next===null)break;r=i.next}}catch(e){t||c(e instanceof ta?e.message:String(e))}})(),()=>{t=!0}},[e]);let l=ZJ(a??[]),u=tY(l),d=$J(l),f=d.find(e=>e.name===hg().today)?.cost_eur??0,p=t?.budget??null;return(0,j.jsxs)(bh,{tight:!0,children:[(0,j.jsx)(xh,{title:`Usage`,lede:`What this org spent: the providers' bill as the call log knows it, never a price of ours.`}),(0,j.jsx)(Km,{children:s}),a!==null&&(0,j.jsxs)(Sh,{min:150,children:[(0,j.jsx)(Ch,{size:`small`,label:p===null?`Spent in all`:`Spent this month`,value:cg(p===null?u.cost_eur:p.spent_eur_month),of:p!==null&&p.limit_eur!==null?`of ${cg(p.limit_eur)}`:void 0,accent:!0}),(0,j.jsx)(Ch,{size:`small`,label:`Today`,value:cg(f)}),(0,j.jsx)(Ch,{size:`small`,label:`Calls`,value:u.calls}),(0,j.jsx)(Ch,{size:`small`,label:`Minutes`,value:u.minutes.toFixed(1)}),(0,j.jsx)(Ch,{size:`small`,label:`Per call`,value:u.calls===0?`—`:cg(u.cost_eur/u.calls)}),(0,j.jsx)(Ch,{size:`small`,label:`Per minute`,value:u.minutes===0?`—`:cg(u.cost_eur/u.minutes)})]}),(0,j.jsx)(Mh,{label:`Usage`,tabs:nY,on:i,onPick:e=>r(e===`days`?{}:{tab:e})}),a!==null&&l.length===0&&(0,j.jsx)(H,{children:(0,j.jsx)(Gm,{children:`Nothing metered yet: the first call to end writes the first row.`})}),l.length>0&&i!==`calls`&&(0,j.jsx)(sY,{label:i===`days`?`Day`:`Agent`,groups:i===`days`?d:eY(l)}),l.length>0&&i===`calls`&&(0,j.jsxs)(H,{children:[(0,j.jsx)(wh,{columns:iY,labels:[`Started`,`Agent`,`Call`,`Min>`,`Messages>`,`Cost>`]}),l.map(e=>(0,j.jsxs)(Th,{columns:iY,children:[(0,j.jsx)(`span`,{className:`ui-cell-faint`,children:dg(e.at)}),(0,j.jsx)(`span`,{className:`ui-cell-ink ui-clip`,children:e.agent}),(0,j.jsx)(k,{to:`/sessions/${e.call}`,className:`usage-call ui-clip`,children:e.call}),(0,j.jsx)(`span`,{className:`ui-cell-ink usage-right`,children:e.minutes.toFixed(1)}),(0,j.jsx)(`span`,{className:`ui-cell-ink usage-right`,children:e.messages}),(0,j.jsx)(`span`,{className:`usage-cost`,children:cg(e.cost_eur)})]},e.call)),(0,j.jsx)(Wm,{children:(0,j.jsxs)(`span`,{children:[l.length,` calls`,u.judge_calls>0&&` · ${u.judge_calls} judge calls`,` · a call's judging is folded into its line`]})})]})]})}function sY({label:e,groups:t}){let n=Math.max(...t.map(e=>e.cost_eur),0);return(0,j.jsxs)(H,{children:[(0,j.jsx)(wh,{columns:rY,labels:[e,`Calls>`,`Min>`,`Per call>`,``,`Cost>`]}),t.map(e=>(0,j.jsxs)(Th,{columns:rY,children:[(0,j.jsx)(`span`,{className:`ui-cell-strong ui-clip`,children:e.name}),(0,j.jsx)(`span`,{className:`ui-cell-ink usage-right`,children:e.calls}),(0,j.jsx)(`span`,{className:`ui-cell-ink usage-right`,children:e.minutes.toFixed(1)}),(0,j.jsx)(`span`,{className:`ui-cell-faint usage-right`,children:cg(e.cost_eur/e.calls)}),(0,j.jsx)(`span`,{className:`usage-bar`,children:(0,j.jsx)(yh,{share:n===0?0:e.cost_eur/n})}),(0,j.jsx)(`span`,{className:`usage-cost`,children:cg(e.cost_eur)})]},e.name))]})}var cY=B({title:F().nullable(),tagline:F().nullable(),greeting:F().nullable(),accent:F().nullable(),autostart:R()});async function lY(e,t){try{return cY.parse(await A(e,`/v1/agents/${encodeURIComponent(t)}/widget`))}catch(e){if(e instanceof ta&&e.status===404)return null;throw e}}async function uY(e,t,n){return cY.parse(await aa(e,`/v1/agents/${encodeURIComponent(t)}/widget`,n))}function dY(){return`${wm()}/widget/pinecall-widget.js`}var fY=null;function pY(){return fY??=yi(()=>import(dY()).then(()=>void 0,e=>{throw fY=null,Error(`the widget did not load from ${dY()}: ${e instanceof Error?e.message:String(e)}`)}),[]),fY}function mY(e,t,n,r){let i=document.createElement(`pinecall-widget`);i.setAttribute(`agent`,n);for(let[e,t]of Object.entries(r))i.setAttribute(e,t);return i.tokenProvider=e=>oa(t,`/v1/tokens`,{agent:n,scope:e,ttl_s:60,metadata:{page:`console preview`,scope:e}}),e.replaceChildren(i),i}var hY=[`#5b3df5`,`#101014`,`#0f766e`,`#be185d`];function gY(){let e=M(),t=Sr().agent??``,[n,r]=(0,D.useState)(`Assistant`),[i,a]=(0,D.useState)(``),[o,s]=(0,D.useState)(``),[c,l]=(0,D.useState)(``),[u,d]=(0,D.useState)(``),[f,p]=(0,D.useState)(!1),[m,h]=(0,D.useState)(hY[0]),[g,_]=(0,D.useState)(null),[v,y]=(0,D.useState)(!1),[b,x]=(0,D.useState)(null),[S,C]=(0,D.useState)(!1),[w,T]=(0,D.useState)(!1),ee={greeting:b!==null,autostart:b!==null},te=zh(),ne=b!==null&&(te===null||te.includes(`pipeline`)),re=(0,D.useRef)(null);(0,D.useEffect)(()=>{let n=!1;return lY(e,t).then(e=>{n||e===null||(x(e),e.title!==null&&r(e.title),e.tagline!==null&&s(e.tagline),e.greeting!==null&&d(e.greeting),e.accent!==null&&h(e.accent),p(e.autostart))},()=>void 0),()=>{n=!0}},[e,t]),(0,D.useEffect)(()=>{let n=!1;return Pb(e).then(e=>{let r=e.find(e=>e.route.agent===t&&e.route.number!==null)?.route.number;!n&&r!=null&&l(e=>e===``?yg(r):e)},()=>void 0),()=>{n=!0}},[e,t]);let E={title:n.trim()===``?null:n.trim(),tagline:o.trim()===``?null:o.trim(),greeting:u.trim()===``?null:u.trim(),accent:m,autostart:f},ie=b!==null&&((b.title??`Assistant`)!==n.trim()||(b.tagline??``)!==o.trim()||(b.greeting??``)!==u.trim()||(b.accent??hY[0])!==m||b.autostart!==f),ae=async()=>{C(!0),_(null);try{x(await uY(e,t,E)),T(!0),window.setTimeout(()=>T(!1),1500)}catch(e){_(e instanceof ta?e.message:String(e))}finally{C(!1)}};(0,D.useEffect)(()=>{let r=!1;return pY().then(()=>{if(r||re.current===null)return;let a={name:n,position:`inline`};i&&(a.company=i),o&&(a.tagline=o),c&&(a.phone=c),u&&(a.greeting=u),mY(re.current,e,t,a).style.setProperty(`--pc-accent`,m),_(null)},e=>{r||_(e instanceof Error?e.message:String(e))}),()=>{r=!0}},[e,t,n,i,o,c,u,m]);let oe=[`agent="${t}"`,`name="${n}"`,i&&`company="${i}"`,o&&`tagline="${o}"`,c&&`phone="${c}"`,ee.greeting&&u&&`greeting="${u}"`,ee.autostart&&f&&`autostart`,`token-url="/pinecall/token"`,`log-url="/pinecall/log"`].filter(Boolean),se=m===hY[0]?``:`\n<style>pinecall-widget { --pc-accent: ${m}; }</style>`,O=`<script type="module" src="${dY()}"><\/script>\n<pinecall-widget ${oe.join(`
123
123
  `)}></pinecall-widget>${se}`,ce=new URLSearchParams({name:n,company:i,tagline:o,phone:c,accent:m,...ee.greeting&&u?{greeting:u}:{}});return(0,j.jsxs)(bh,{width:900,tight:!0,children:[(0,j.jsx)(xh,{title:`Widget`,ledeWidth:620,lede:`The web door for ${t} — one script tag on your site, and the call lands in the same log as the phone.`}),(0,j.jsxs)(`div`,{className:`ui-card`,children:[(0,j.jsxs)(`div`,{className:`ui-card-head`,children:[(0,j.jsx)(`span`,{className:`ui-card-title`,children:`Embed`}),(0,j.jsx)(W,{size:`xs`,className:`widget-copy`,onClick:()=>{navigator.clipboard.writeText(O).then(()=>{y(!0),window.setTimeout(()=>y(!1),1500)})},children:v?`Copied`:`Copy`})]}),(0,j.jsx)(`pre`,{className:`ui-code`,children:O}),(0,j.jsxs)(`div`,{className:`widget-endpoints`,children:[(0,j.jsx)(`span`,{className:`ui-fixed`,children:`token-url`}),` and `,(0,j.jsx)(`span`,{className:`ui-fixed`,children:`log-url`}),` are your site's: the first mints a visit token at `,(0,j.jsx)(`span`,{className:`ui-fixed`,children:`/v1/tokens`}),` with a key holding `,(0,j.jsx)(`span`,{className:`ui-fixed`,children:`talk`}),`, the second relays the call's log with a key holding `,(0,j.jsx)(`span`,{className:`ui-fixed`,children:`calls`}),`. Ready-made PHP and Laravel endpoints:`,` `,(0,j.jsx)(`a`,{href:`https://github.com/pinecall/widget`,target:`_blank`,rel:`noreferrer`,children:`github.com/pinecall/widget`}),`.`]})]}),(0,j.jsxs)(`div`,{className:`widget-split`,children:[(0,j.jsxs)(`div`,{className:`ui-card`,children:[(0,j.jsxs)(`div`,{className:`ui-card-head`,children:[(0,j.jsx)(`span`,{className:`ui-card-title`,children:`Appearance`}),ne&&(0,j.jsx)(W,{kind:ie?`primary`:`secondary`,size:`xs`,className:`widget-copy`,disabled:S||!ie,onClick:()=>void ae(),children:S?`Saving…`:w?`Saved`:`Save`})]}),(0,j.jsxs)(`div`,{className:`widget-fields`,children:[(0,j.jsx)(rh,{label:`Name`,children:(0,j.jsx)(G,{value:n,onChange:e=>r(e.target.value)})}),(0,j.jsx)(rh,{label:`Tagline`,children:(0,j.jsx)(G,{value:o,placeholder:`the line under the name`,onChange:e=>s(e.target.value)})}),ee.greeting&&(0,j.jsx)(rh,{label:`Greeting`,children:(0,j.jsx)(G,{value:u,placeholder:`what the widget says before the call starts`,onChange:e=>d(e.target.value)})}),(0,j.jsxs)(`div`,{className:`widget-pair`,children:[(0,j.jsx)(rh,{label:`Company`,children:(0,j.jsx)(G,{value:i,placeholder:`whose agent it is`,onChange:e=>a(e.target.value)})}),(0,j.jsx)(rh,{label:`Phone`,children:(0,j.jsx)(G,{value:c,placeholder:`the number it answers, if it has one`,onChange:e=>l(e.target.value)})})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{className:`widget-accent-label`,children:`Accent`}),(0,j.jsx)(`div`,{className:`widget-accents`,role:`group`,"aria-label":`accent`,children:(hY.includes(m)?hY:[...hY,m]).map(e=>(0,j.jsx)(`button`,{type:`button`,className:`widget-accent`,style:{background:e,boxShadow:e===m?`0 0 0 2px var(--ground),0 0 0 4px ${e}`:void 0},onClick:()=>h(e),"aria-label":e,"aria-pressed":e===m},e))})]}),ee.autostart&&(0,j.jsxs)(`div`,{className:`widget-toggle`,children:[(0,j.jsx)(`span`,{className:`widget-toggle-label`,children:`Open with the microphone ready`}),(0,j.jsx)(sh,{on:f,onChange:p,label:`Open with the microphone ready`})]})]})]}),(0,j.jsxs)(`div`,{className:`widget-preview`,children:[(0,j.jsx)(`div`,{className:`widget-preview-label`,children:`Preview`}),(0,j.jsx)(`div`,{className:`widget-stage`,ref:re}),(0,j.jsx)(Km,{children:g}),(0,j.jsx)(k,{className:`widget-open`,to:`/a/${t}/widget/preview?${ce.toString()}`,target:`_blank`,children:`Open on a blank page ↗`})]})]})]})}function _Y(){let e=M(),t=Sr().agent??``,[n]=Yi(),[r,i]=(0,D.useState)(null),a=(0,D.useRef)(null);return(0,D.useEffect)(()=>{let r=!1;return pY().then(()=>{if(r||a.current===null)return;let i={};for(let e of[`name`,`company`,`tagline`,`phone`,`greeting`]){let t=n.get(e);t&&(i[e]=t)}let o=mY(a.current,e,t,i),s=n.get(`accent`);s&&o.style.setProperty(`--pc-accent`,s)},e=>{r||i(e instanceof Error?e.message:String(e))}),()=>{r=!0}},[e,t,n]),(0,j.jsxs)(`div`,{className:`widget-blank`,children:[(0,j.jsx)(`div`,{ref:a}),(0,j.jsxs)(`span`,{className:`widget-blank-mark`,children:[`pinecall · `,t,` · preview`]}),r!==null&&(0,j.jsx)(`p`,{className:`widget-blank-refused`,children:r})]})}function vY({agent:e}){let{agents:t,live:n}=gb(),r=zh(),i=t.find(t=>t.slug===e),a=n.filter(t=>t.agent===e).length,o=Mm(jm).filter(e=>r===null||vb(r,e.key));return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`agenthead`,children:[(0,j.jsxs)(`div`,{className:`agenthead-name`,children:[(0,j.jsx)(ph,{tone:i===void 0?void 0:`green`}),(0,j.jsx)(`span`,{className:`agenthead-slug`,children:e}),a>0?(0,j.jsx)(`span`,{className:`agenthead-status ui-pill-green`,children:a===1?`on a call`:`on ${a} calls`}):i!==void 0&&(0,j.jsx)(`span`,{className:`agenthead-status ui-pill-muted`,children:`idle`})]}),(0,j.jsx)(`span`,{className:`agenthead-doors`,children:i?.channels.join(` · `)||`no doors`})]}),(0,j.jsx)(`nav`,{className:`agenttabs`,"aria-label":`${e}'s screens`,children:o.map(t=>(0,j.jsx)(Wi,{to:`/a/${e}/${t.path}`,className:({isActive:e})=>e?`agenttab agenttab-on`:`agenttab`,children:t.name},t.key))})]})}var yY=/^call_[\w+-]{6,}$/,bY=40;function xY({agent:e,onClose:t}){let[n,r]=(0,D.useState)(``),[i,a]=(0,D.useState)(0),{agents:o,lines:s,operator:c}=gb(),l=zh(),u=vr(),d=(0,D.useRef)(null);(0,D.useEffect)(()=>d.current?.focus(),[]);let f=(0,D.useMemo)(()=>{let t=e=>l===null||vb(l,e),r=n.trim().toLowerCase(),i=[];if(yY.test(n.trim())){let e=s.find(e=>e.call===n.trim());i.push({group:`Open`,label:n.trim(),sub:e?.agent??`by its id`,to:`/sessions/${n.trim()}`})}for(let e of Mm(km).filter(e=>t(e.key)))i.push({group:`Screens`,label:e.name,sub:``,to:`/${e.path}`});for(let e of Mm(Am,Cm,c===!0))i.push({group:`Box`,label:e.name,sub:``,to:`/${e.path}`});for(let e of o)i.push({group:`Agents`,label:e.slug,sub:e.channels.join(` · `),to:`/a/${e.slug}/talk`});let a=e===``?o[0]?.slug:e;if(a!==void 0)for(let e of Mm(jm).filter(e=>t(e.key)))i.push({group:`${a}`,label:e.name,sub:a,to:`/a/${a}/${e.path}`});for(let e of s){let t=e.caller?.name??e.from??``;i.push({group:`Sessions`,label:e.call,sub:[e.agent,e.channel,t,e.outcome].filter(Boolean).join(` · `),to:`/sessions/${e.call}`})}return r===``?i.filter(e=>e.group!==`Sessions`).slice(0,bY):i.filter(e=>`${e.label} ${e.sub}`.toLowerCase().includes(r)).slice(0,bY)},[n,o,s,e,l,c]);(0,D.useEffect)(()=>a(0),[n]);let p=e=>{e!==void 0&&(t(),u(e.to))},m=e=>{e.key===`Escape`&&t(),e.key===`ArrowDown`&&(e.preventDefault(),a(e=>Math.min(f.length-1,e+1))),e.key===`ArrowUp`&&(e.preventDefault(),a(e=>Math.max(0,e-1))),e.key===`Enter`&&p(f[i])},h=``;return(0,j.jsx)(`div`,{className:`palette-veil`,onMouseDown:t,children:(0,j.jsxs)(`div`,{className:`palette`,role:`dialog`,"aria-label":`Search`,onMouseDown:e=>e.stopPropagation(),children:[(0,j.jsxs)(`div`,{className:`palette-input-row`,children:[(0,j.jsx)(uh,{name:`search`,size:16}),(0,j.jsx)(`input`,{ref:d,className:`palette-input`,placeholder:`Search a screen, an agent, a session id, a number or an outcome`,value:n,onChange:e=>r(e.target.value),onKeyDown:m})]}),(0,j.jsxs)(`div`,{className:`palette-list`,children:[f.length===0&&(0,j.jsx)(`div`,{className:`palette-none`,children:`Nothing here matches — the sessions searched are the ones the floor has listed.`}),f.map((e,t)=>{let n=e.group===h?null:e.group;return h=e.group,(0,j.jsxs)(`div`,{children:[n!==null&&(0,j.jsx)(`div`,{className:`palette-group`,children:n}),(0,j.jsxs)(`button`,{type:`button`,className:t===i?`palette-item palette-item-on`:`palette-item`,onMouseEnter:()=>a(t),onClick:()=>p(e),children:[(0,j.jsx)(`span`,{className:`ui-clip`,children:e.label}),e.sub!==``&&(0,j.jsx)(`span`,{className:`palette-item-sub`,children:e.sub})]})]},`${e.group}:${e.to}`)})]})]})})}var SY=3,CY=5e3;function wY(){let{live:e,lines:t}=gb(),n=vr(),r=gr().pathname,i=(0,D.useRef)(null),[a,o]=(0,D.useState)([]),s=DY(a.length>0);(0,D.useEffect)(()=>{if(i.current===null){if(t.length===0&&e.length===0)return;i.current=new Set(e.map(e=>e.call));return}let n=i.current,r=e.filter(e=>!n.has(e.call)&&!cJ(e.call));e.forEach(e=>n.add(e.call)),r.forEach(e=>n.add(e.call)),o(e=>{let n=e.map(e=>{let n=t.find(t=>t.call===e.call);return n===void 0?e:{...e,line:n,ended:!n.live}});return[...r.map(e=>({call:e.call,line:e,ended:!1})),...n].slice(0,SY)})},[e,t]),(0,D.useEffect)(()=>{if(!a.some(e=>e.ended))return;let e=window.setTimeout(()=>o(e=>e.filter(e=>!e.ended)),CY);return()=>window.clearTimeout(e)},[a]);let c=e=>o(t=>t.filter(t=>t.call!==e)),l=a.filter(e=>r!==`/live/${e.call}`);return l.length===0?null:(0,j.jsx)(`div`,{className:`ring-stack`,role:`region`,"aria-label":`Calls coming in`,"aria-live":`polite`,children:l.map(e=>(0,j.jsxs)(`div`,{className:e.ended?`ring ring-ended`:`ring`,children:[(0,j.jsxs)(`button`,{type:`button`,className:`ring-body`,onClick:()=>{c(e.call),n(`/live/${e.call}`)},children:[(0,j.jsx)(`span`,{className:e.ended?`ring-icon ring-icon-ended`:`ring-icon`,"aria-hidden":!0,children:(0,j.jsx)(EY,{})}),(0,j.jsxs)(`span`,{className:`ring-words`,children:[(0,j.jsxs)(`span`,{className:`ring-top`,children:[(0,j.jsx)(`span`,{className:`ring-kicker`,children:TY(e)}),!e.ended&&(0,j.jsx)(`span`,{className:`ring-watch`,children:`Watch live →`})]}),(0,j.jsx)(`span`,{className:`ring-who`,children:bg(e.line)}),(0,j.jsxs)(`span`,{className:`ring-sub`,children:[e.line.agent,e.line.channel!==null&&` · ${e.line.channel}`,e.line.direction===`outbound`&&` · outbound`,!e.ended&&e.line.started_at!==null&&` · ${sg(e.line.started_at,s)}`]})]})]}),(0,j.jsx)(`button`,{type:`button`,className:`ring-close`,"aria-label":`Dismiss`,onClick:()=>c(e.call),children:`×`})]},e.call))})}function TY(e){return e.ended?`Call ended`:e.line.direction===`outbound`?`Calling out`:e.line.channel===`web`?`New conversation`:e.line.channel===`whatsapp`?`New WhatsApp chat`:e.line.status===`active`?`New call · answered`:`New call ringing`}function EY(){return(0,j.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,j.jsx)(`path`,{d:`M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1.9.4 1.8.7 2.7a2 2 0 0 1-.5 2.1L8 9.8a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.5c.9.3 1.8.6 2.7.7a2 2 0 0 1 1.7 2z`})})}function DY(e){let[t,n]=(0,D.useState)(()=>Date.now()/1e3);return(0,D.useEffect)(()=>{if(!e)return;let t=window.setInterval(()=>n(Date.now()/1e3),1e3);return()=>window.clearInterval(t)},[e]),t}var OY=[{group:`gateway`,label:Cm===`local`?`Sandbox`:`Gateway`},{group:`settings`,label:`Settings`},{group:`box`,label:`Box`}];function kY({agent:e,onSearch:t}){let[n,r]=(0,D.useState)(!1),i=zh(),a=Lh(),{agents:o,live:s,lines:c,here:l,insights:u,operator:d}=gb(),f=e=>i===null||vb(i,e.key),p=a?.name??a?.label??``,m=l?.role??(a===null?``:a.subject===null||a.subject===void 0?`a machine's key`:``),h=e=>e.key===`agents`&&o.length>0?{text:String(o.length),live:!1}:e.key===`live`&&s.length>0?{text:`${s.length} live`,live:!0}:e.key===`sessions`&&u!==null?{text:String(u.sessions_total),live:!1}:e.key===`sessions`&&c.length>0?{text:c.length>=200?`200+`:String(c.length),live:!1}:null;return(0,j.jsxs)(`aside`,{className:n?`side side-folded`:`side`,"aria-label":`Screens`,children:[(0,j.jsx)(jY,{}),(0,j.jsx)(`div`,{className:`side-search-wrap`,children:(0,j.jsxs)(`button`,{type:`button`,className:`side-search`,onClick:t,title:`Search`,children:[(0,j.jsx)(uh,{name:`search`,size:15}),(0,j.jsx)(`span`,{className:`side-label`,children:`Search`}),(0,j.jsx)(`span`,{className:`side-kbd`,children:`⌘K`})]})}),(0,j.jsxs)(`nav`,{className:`side-nav`,children:[(0,j.jsx)(`div`,{className:`side-group side-group-first`,children:`Agents`}),o.length===0&&(0,j.jsx)(`div`,{className:`side-none side-name`,children:`none held here`}),o.map(t=>{let n=s.some(e=>e.agent===t.slug),r=t.slug===e;return(0,j.jsxs)(Wi,{to:`/a/${t.slug}/talk`,title:t.slug,className:r?`side-link side-link-on`:`side-link`,children:[(0,j.jsx)(`span`,{className:n&&!r?`side-icon side-icon-live`:`side-icon`,children:(0,j.jsx)(uh,{name:`bot`})}),(0,j.jsx)(`span`,{className:`side-name side-name-agent`,children:t.slug}),n&&(0,j.jsx)(`span`,{className:`side-badge side-badge-live`,children:`live`})]},t.slug)}),OY.map(({group:t,label:n})=>{let r=Mm([...km,...Am],Cm,d===!0).filter(e=>e.group===t&&f(e));return r.length===0?null:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{className:`side-group`,children:n}),r.map(t=>{let n=h(t);return(0,j.jsxs)(Wi,{to:`/${t.path}`,end:t.path===``,title:t.name,className:({isActive:t})=>t&&e===``?`side-link side-link-on`:`side-link`,children:[(0,j.jsx)(`span`,{className:`side-icon`,children:t.icon!==void 0&&(0,j.jsx)(uh,{name:t.icon})}),(0,j.jsx)(`span`,{className:`side-name`,children:t.name}),n!==null&&(0,j.jsx)(`span`,{className:n.live?`side-badge side-badge-live`:`side-badge`,children:n.text})]},t.key)})]},t)})]}),(0,j.jsxs)(`div`,{className:`side-foot`,children:[(0,j.jsxs)(`div`,{className:`side-user`,title:p,children:[(0,j.jsx)(`span`,{className:`side-user-avatar`,children:_h(p||(a===null?`?`:Rh(a)))}),(0,j.jsxs)(`span`,{className:`side-label`,children:[(0,j.jsx)(`span`,{className:`side-user-name`,children:p||`—`}),(0,j.jsx)(`span`,{className:`side-user-role`,children:AY(m)})]})]}),(0,j.jsx)(`button`,{type:`button`,className:`side-fold`,onClick:()=>r(!n),title:n?`Open the sidebar`:`Collapse the sidebar`,children:(0,j.jsx)(uh,{name:`panel`,size:15})})]})]})}function AY(e){return e===``?``:e.charAt(0).toUpperCase()+e.slice(1)}function jY(){let e=Lh(),{agents:t,orgs:n}=gb(),{moveTo:r}=Hh(),[i,a]=(0,D.useState)(!1),[o,s]=(0,D.useState)(null),[c,l]=(0,D.useState)(!1),u=(0,D.useRef)(null),d=gr().pathname;(0,D.useEffect)(()=>a(!1),[d]),(0,D.useEffect)(()=>{if(!i)return;let e=e=>{u.current!==null&&!u.current.contains(e.target)&&a(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i]);let f=e===null?``:Rh(e),p=Cm===`hosted`&&n!==null&&n.length>1,m=async e=>{l(!0),s(null);try{await r(e)}catch(e){s(e instanceof ta?e.message:String(e)),l(!1)}};return(0,j.jsxs)(`div`,{ref:u,className:`side-workspace-wrap`,children:[(0,j.jsxs)(`button`,{type:`button`,className:`side-workspace`,onClick:()=>p&&a(!i),title:f,"aria-expanded":i,children:[(0,j.jsx)(`span`,{className:`side-tile`,children:_h(f||`?`).slice(0,1)}),(0,j.jsxs)(`span`,{className:`side-label`,children:[(0,j.jsx)(`span`,{className:`side-org`,children:f||`…`}),(0,j.jsxs)(`span`,{className:`side-org-sub`,children:[e?.visiting===!0?`visiting as operator · `:``,t.length,` `,t.length===1?`agent`:`agents`]})]}),(0,j.jsx)(`span`,{className:`side-caret`,children:`▾`})]}),i&&n!==null&&(0,j.jsxs)(`div`,{className:`side-orgs`,role:`menu`,children:[[{label:`Your organizations`,rows:n.filter(e=>e.member!==!1)},{label:`Every other org on this box · as operator`,rows:n.filter(e=>e.member===!1)}].filter(e=>e.rows.length>0).map(e=>(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{className:`side-orgs-label`,children:e.label}),e.rows.map(e=>(0,j.jsxs)(`button`,{type:`button`,className:`side-org-row`,disabled:c||e.here,onClick:()=>void m(e.org),children:[(0,j.jsx)(`span`,{className:`side-tile`,children:_h(e.slug??e.name??e.org).slice(0,1)}),(0,j.jsx)(`span`,{className:`ui-clip`,children:e.slug??e.name??e.org}),(0,j.jsx)(`span`,{className:`side-org-role`,children:e.here?`here`:e.role})]},e.org))]},e.label)),o!==null&&(0,j.jsx)(`div`,{className:`ui-refused`,style:{padding:`6px 8px`},children:o})]})]})}var MY=new Set(jm.map(e=>e.path)),NY=`http://localhost:4100`;function PY({agent:e}){let t=Lh(),n=ig(t),{world:r,corner:i,lookInto:a}=Hh(),{held:o,agentsLoaded:s}=gb(),[c,l]=(0,D.useState)(!1),u=vr(),{pathname:d}=gr(),f=(0,D.useRef)(null),p=d.split(`/`).filter(Boolean),m=e!==``&&MY.has(p[2]??``)?p[2]:`talk`;(0,D.useEffect)(()=>l(!1),[d]),(0,D.useEffect)(()=>{if(!c)return;let e=e=>{f.current!==null&&!f.current.contains(e.target)&&l(!1)},t=e=>{e.key===`Escape`&&l(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[c]);let h=t?.name??t?.label??``,g=t===null?`this org`:Rh(t),_=r===`production`,v=!_&&t?.scopes.includes(`team`)===!0,y=e=>e.holder?.holder??null,b=e=>_?y(e)===null:y(e)!==null&&(y(e)===n||v),x=t=>t.slug===e&&(_?y(t)===null:y(t)===(i??n)),S=e=>{let t=y(e);return t===null?_?`${g} · deployed on the box`:`${g} · shared`:t===n?`${h||`you`} · you`:`${e.holder?.name??t} · theirs`},C=[...o].sort((e,t)=>e.slug.localeCompare(t.slug)||Number(eg(e,n))-Number(eg(t,n))),w=i===null?void 0:o.find(e=>y(e)===i),T=()=>{let e=Cm===`hosted`?NY:wm();window.open(`${e}${d}`,`_blank`,`noopener`)};return(0,j.jsxs)(`div`,{ref:f,style:{position:`relative`},children:[(0,j.jsxs)(`button`,{type:`button`,className:c?`switch-trigger switch-trigger-open`:`switch-trigger`,onClick:()=>l(!c),"aria-expanded":c,"aria-haspopup":`dialog`,children:[(0,j.jsx)(ph,{tone:_?`green`:`amber`}),(0,j.jsx)(`span`,{className:`switch-agent`,children:e===``?`choose an agent`:e}),(0,j.jsx)(dh,{tone:_?`green`:`amber`,children:r}),t!==null&&(0,j.jsx)(vh,{name:h||g,tint:`violet`,size:20}),(0,j.jsx)(`span`,{className:`switch-caret`,"aria-hidden":!0,children:`▾`})]}),c&&(0,j.jsxs)(`div`,{className:`switch-panel`,role:`dialog`,"aria-label":`what this console is looking at`,children:[t!==null&&(0,j.jsxs)(`div`,{className:`switch-who`,children:[(0,j.jsx)(vh,{name:h||g,tint:`violet`,size:36}),(0,j.jsxs)(`div`,{style:{minWidth:0},children:[(0,j.jsx)(`div`,{className:`switch-who-name`,children:h||`an org's key`}),(0,j.jsxs)(`div`,{className:`switch-who-sub`,children:[g,` · key `,t.key_id]})]})]}),i!==null&&(0,j.jsxs)(`div`,{className:`switch-looking`,children:[(0,j.jsxs)(`span`,{style:{flex:1},children:[`Looking at `,(0,j.jsx)(`b`,{children:w?.holder?.name??i}),`'s copy`]}),(0,j.jsx)(`button`,{type:`button`,className:`ui-text-action`,onClick:()=>a(null),children:`Back to yours`})]}),(0,j.jsxs)(`div`,{className:`switch-where`,children:[(0,j.jsx)(FY,{}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{className:`switch-label`,children:`Environment`}),(0,j.jsxs)(`div`,{className:`switch-choices`,children:[(0,j.jsx)(oh,{on:_,onClick:_?void 0:T,children:`production`}),(0,j.jsx)(oh,{on:!_,onClick:_?T:void 0,children:`sandbox`})]}),(0,j.jsx)(`div`,{className:`switch-note`,children:_?(0,j.jsxs)(j.Fragment,{children:[`Your sandbox copies are watched on your machine: `,(0,j.jsx)(`span`,{className:`ui-fixed`,children:`pinecall serve`}),`, then sandbox.`]}):(0,j.jsx)(j.Fragment,{children:`Production is watched on the gateway's console, signed in to.`})})]})]}),(0,j.jsxs)(`div`,{className:`switch-agents`,children:[(0,j.jsxs)(`div`,{className:`switch-label`,children:[`agents in `,g,` · `,r]}),s&&C.length===0&&(0,j.jsx)(`div`,{className:`switch-empty`,children:Cm===`local`?(0,j.jsxs)(j.Fragment,{children:[`Nothing is running here. `,(0,j.jsx)(`span`,{className:`ui-fixed`,children:`pinecall start`}),` in a project puts its agents on this list.`]}):(0,j.jsxs)(j.Fragment,{children:[`Nothing is running in production: `,(0,j.jsx)(`span`,{className:`ui-fixed`,children:`pinecall start --prod`}),` on your server holds it, on a server token.`]})}),(0,j.jsx)(`div`,{className:`switch-list`,children:C.map(t=>{let r=y(t),i=b(t),o=x(t);return(0,j.jsxs)(`button`,{type:`button`,className:o?`switch-card switch-card-here`:`switch-card`,disabled:!i,title:i?void 0:`their copy: it answers them, and they open it from their own console`,onClick:()=>{l(!1),_||a(r===n?null:r),t.slug!==e&&u(`/a/${t.slug}/${m}`)},children:[(0,j.jsx)(ph,{tone:`green`}),(0,j.jsxs)(`span`,{style:{minWidth:0,flex:1},children:[(0,j.jsx)(`span`,{className:`switch-card-name`,children:t.slug}),(0,j.jsxs)(`span`,{className:`switch-card-sub`,children:[S(t),` · `,t.channels.join(` · `)||`no doors`]})]}),(0,j.jsx)(`span`,{className:`switch-card-open`,children:o?`Viewing`:i?`Open`:`Theirs`})]},`${t.slug}:${r??`org`}`)})})]})]})]})}function FY(){let{orgs:e}=gb(),{moveTo:t}=Hh(),[n,r]=(0,D.useState)(!1),[i,a]=(0,D.useState)(null);if(Cm!==`hosted`||e===null||e.length<2)return null;let o=async e=>{r(!0),a(null);try{await t(e)}catch(e){a(e instanceof ta?e.message:String(e)),r(!1)}};return(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{className:`switch-label`,children:`Organization`}),(0,j.jsx)(`div`,{className:`switch-choices`,children:e.map(e=>(0,j.jsx)(oh,{on:e.here,disabled:n,title:e.member===!1?`as the box's operator`:e.role,onClick:()=>!e.here&&void o(e.org),children:e.slug??e.name??e.org},e.org))}),i!==null&&(0,j.jsx)(`div`,{className:`ui-refused`,style:{marginTop:6},children:i})]})}function IY(){let e=(0,D.useSyncExternalStore)(Ta,Ca)===`dark`?`light`:`dark`;return(0,j.jsx)(`button`,{type:`button`,className:`top-theme`,onClick:()=>wa(),"aria-label":`Switch to the ${e} theme`,title:`${e===`dark`?`Dark`:`Light`} theme`,children:(0,j.jsx)(uh,{name:e===`dark`?`moon`:`sun`})})}function LY(e,t){let n=e.split(`/`).filter(Boolean);if(t!==``){let e=jm.find(e=>e.path===n[2]);return e===void 0?`Talk`:e.key===`sessions`&&n[3]!==void 0?`Session`:e.name}if(n[0]===`cli`)return`Sign in a terminal`;if(n[0]===`box`){let e=Am.find(e=>e.path===`box/${n[1]??``}`);return e===void 0?`Box`:e.key===`box-orgs`&&n[2]!==void 0?`Organization`:e.name}let r=km.find(e=>e.path===(n[0]??``));return r===void 0?`Home`:r.key===`sessions`&&n[1]!==void 0?`Session`:r.key===`numbers`?`Phone numbers`:r.name}function RY({agent:e}){let t=Lh(),n=Sm(),{pathname:r}=gr(),i=e===``?r.startsWith(`/box/`)?`box`:t===null?``:Rh(t):e;return(0,j.jsxs)(`header`,{className:`top`,children:[i!==``&&(0,j.jsxs)(`span`,{className:`top-crumb`,children:[i,` /`]}),(0,j.jsx)(`span`,{className:`top-title`,children:LY(r,e)}),(0,j.jsxs)(`div`,{className:`top-right`,children:[(0,j.jsx)(PY,{agent:e}),(0,j.jsx)(IY,{}),Cm===`hosted`&&(0,j.jsx)(`button`,{type:`button`,className:`top-leave`,onClick:n,children:`Sign out`})]})]})}var zY=`No agent called {agent} is held here`;function BY(){return(0,j.jsx)(hb,{children:(0,j.jsx)(RT,{children:(0,j.jsx)(VY,{})})})}function VY(){let e=Sr().agent??``,{agents:t,agentsLoaded:n}=gb(),[r,i]=(0,D.useState)(!1),a=e!==``&&n&&!t.some(t=>t.slug===e);return(0,D.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),i(e=>!e))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]),(0,j.jsxs)(`div`,{className:`frame`,children:[(0,j.jsx)(kY,{agent:a?``:e,onSearch:()=>i(!0)}),(0,j.jsxs)(`div`,{className:`frame-main`,children:[(0,j.jsx)(RY,{agent:e}),e!==``&&!a&&(0,j.jsx)(vY,{agent:e}),(0,j.jsx)(`div`,{className:`frame-screen`,children:a?(0,j.jsx)(HY,{agent:e}):(0,j.jsx)(Zr,{})})]}),(0,j.jsx)(wY,{}),r&&(0,j.jsx)(xY,{agent:a?``:e,onClose:()=>i(!1)})]})}function HY({agent:e}){return(0,j.jsxs)(`p`,{className:`missing`,children:[zY.replace(`{agent}`,e),Cm===`local`?" — no copy of yours is running. Start `pinecall start` in the project, and it appears.":" — nothing by that name is deployed in this org. Check the org you signed in with; a copy you are running yourself is on your own machine, at `pinecall serve`."]})}var UY={home:(0,j.jsx)(VU,{}),agents:(0,j.jsx)(tx,{}),live:(0,j.jsx)(cU,{}),sessions:(0,j.jsx)(bU,{}),personas:(0,j.jsx)(eq,{}),simulations:(0,j.jsx)(lq,{}),"org-evals":(0,j.jsx)(bT,{}),"org-memory":(0,j.jsx)(IT,{}),"org-docs":(0,j.jsx)(tE,{}),numbers:(0,j.jsx)(XW,{}),phone:(0,j.jsx)(QW,{}),tokens:(0,j.jsx)(KU,{}),providers:(0,j.jsx)(cW,{}),team:(0,j.jsx)(HJ,{}),usage:(0,j.jsx)(oY,{}),lexicon:(0,j.jsx)(tW,{})},WY={"box-orgs":(0,j.jsx)(rC,{children:(0,j.jsx)(xS,{})}),"box-fleet":(0,j.jsx)(rC,{children:(0,j.jsx)(Tx,{})}),"box-routes":(0,j.jsx)(rC,{children:(0,j.jsx)(TS,{})}),"box-usage":(0,j.jsx)(rC,{children:(0,j.jsx)(eC,{})}),"box-settings":(0,j.jsx)(rC,{children:(0,j.jsx)(YS,{})})},GY={talk:(0,j.jsx)(pJ,{}),devchat:(0,j.jsx)(Gw,{}),calls:(0,j.jsx)(AC,{}),sessions:(0,j.jsx)(xG,{}),settings:(0,j.jsx)(Uq,{}),pipeline:(0,j.jsx)(bG,{}),docs:(0,j.jsx)(jW,{}),memory:(0,j.jsx)(IW,{}),evals:(0,j.jsx)(ZE,{}),widget:(0,j.jsx)(gY,{})},KY={devchat:(0,j.jsx)(Gw,{}),calls:(0,j.jsx)(AC,{}),sessions:(0,j.jsx)(bK,{})},qY={live:(0,j.jsx)(cU,{}),sessions:(0,j.jsx)(bK,{}),simulations:(0,j.jsx)(lq,{}),personas:(0,j.jsx)(eq,{})};function JY(e,t){return Mm(e,Cm,!0).flatMap(e=>{let n=t[e.key];if(e.path===``)return[{index:!0,element:n}];let r=(t===GY?KY:qY)[e.key];return r===void 0?[{path:e.path,element:n}]:[{path:e.path,element:n},{path:`${e.path}/:call`,element:r}]})}var YY=Vi([{path:`/`,element:(0,j.jsx)(BY,{}),children:[...JY(km,UY),...JY(Am,WY),...Cm===`hosted`?[{path:`box/orgs/:org`,element:(0,j.jsx)(rC,{children:(0,j.jsx)(yS,{})})}]:[],...Cm===`hosted`?[{path:`cli`,element:(0,j.jsx)(EJ,{})}]:[],{path:`docs/:base`,element:(0,j.jsx)(XT,{})}]},{path:`/a/:agent`,element:(0,j.jsx)(BY,{}),children:[{index:!0,element:(0,j.jsx)(Xr,{to:`talk`,replace:!0})},...JY(jm,GY)]},{path:`/a/:agent/widget/preview`,element:(0,j.jsx)(_Y,{})},{path:`*`,element:(0,j.jsx)(Xr,{to:`/`,replace:!0})}],{basename:`/`}),XY=pp({version:F(),cloud:R(),signup:R(),min_password:I(),mail:R().optional(),google:R().optional()});async function ZY(e){try{let t=await fetch(new URL(`${e.replace(/\/$/,``)}/.well-known/pinecall`,window.location.origin));return XY.parse(await da(t))}catch{return{version:``,cloud:!1,signup:!1,min_password:0}}}function QY({base:e,onSigned:t}){let[n,r]=(0,D.useState)(``),[i,a]=(0,D.useState)(``),[o,s]=(0,D.useState)(``),[c,l]=(0,D.useState)(!1),[u,d]=(0,D.useState)(()=>new URLSearchParams(window.location.search).get(`refused`)),[f,p]=(0,D.useState)(!1),[m,h]=(0,D.useState)(!1),[g,_]=(0,D.useState)(null),[v,y]=(0,D.useState)(!0),b=(0,D.useRef)(``),[x,S]=(0,D.useState)(!1),[C,w]=(0,D.useState)(null),[T,ee]=(0,D.useState)(null),[te,ne]=(0,D.useState)(!1);(0,D.useEffect)(()=>{let t=!1;return lm(e).then(e=>{t||S(e)}),ZY(e).then(e=>{t||h(e.google===!0)}),()=>{t=!0}},[e]);let re=async()=>{if(ee(null),w(null),i.trim()===``){ee(`Type your work email first: it says which workspace signs you in.`);return}ne(!0);try{let t=await um(e,i.trim()),n=t[0];t.length===1&&n!==void 0?window.location.assign(dm(e,n.slug??n.org)):t.length===0?ee(`No workspace signs in with a provider for that address.`):w(t)}catch(e){ee(e instanceof ta?e.message:String(e))}finally{ne(!1)}},E=async()=>{let t=`${i.trim()}\n${o}`;if(i.trim()!==``&&o!==``&&t!==b.current){b.current=t;try{let t=await om(e,i.trim(),o);if(t===null){y(!1);return}_(t);let a=t[0];t.length>0&&!t.some(e=>(e.slug??e.org)===n)&&a!==void 0&&r(a.slug??a.org)}catch{_(null)}}},ie=async r=>{r.preventDefault(),l(!0),d(null);try{t(await em(e,{org:n.trim(),email:i.trim(),password:o}))}catch(e){d(e instanceof ta?e.message:String(e))}finally{l(!1)}};return(0,j.jsx)(gm,{children:(0,j.jsxs)(`form`,{onSubmit:e=>void ie(e),children:[(0,j.jsx)(`h1`,{className:`login-title`,children:`Sign in`}),(0,j.jsx)(`p`,{className:`login-lede`,children:`Use the email and password you were invited with.`}),(0,j.jsx)(`label`,{className:`login-label`,htmlFor:`login-email`,children:`Email`}),(0,j.jsx)(`input`,{id:`login-email`,className:`login-input`,type:`email`,value:i,onChange:e=>a(e.target.value),autoComplete:`username`,autoFocus:!0,required:!0}),(0,j.jsxs)(`div`,{className:`login-label-row`,children:[(0,j.jsx)(`label`,{className:`login-label`,htmlFor:`login-password`,children:`Password`}),(0,j.jsx)(`button`,{type:`button`,className:`login-link`,onClick:()=>p(!f),children:`Forgot password`})]}),(0,j.jsx)(`input`,{id:`login-password`,className:`login-input login-input-secret`,type:`password`,value:o,onChange:e=>s(e.target.value),onBlur:()=>void E(),autoComplete:`current-password`,required:!0}),f&&(0,j.jsx)(`p`,{className:`login-forgot`,children:`Ask an admin of your workspace: from Team they hand you a one-use link where you choose a new password.`}),g!==null&&g.length>0?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`label`,{className:`login-label`,htmlFor:`login-org`,children:`Workspace`}),(0,j.jsxs)(`div`,{className:`login-workspace`,children:[(0,j.jsx)(`span`,{className:`login-workspace-tile`,children:(n[0]??`·`).toUpperCase()}),(0,j.jsx)(`select`,{id:`login-org`,className:`login-workspace-input`,value:n,onChange:e=>r(e.target.value),disabled:g.length===1,children:g.map(e=>(0,j.jsx)(`option`,{value:e.slug??e.org,children:e.name??e.slug??e.org},e.org))})]})]}):!v&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`login-label-row`,children:[(0,j.jsx)(`label`,{className:`login-label`,htmlFor:`login-org`,children:`Workspace`}),(0,j.jsx)(`span`,{className:`login-hint`,children:`only if you belong to several`})]}),(0,j.jsxs)(`div`,{className:`login-workspace`,children:[(0,j.jsx)(`span`,{className:`login-workspace-tile`,children:(n.trim()[0]??`·`).toUpperCase()}),(0,j.jsx)(`input`,{id:`login-org`,className:`login-workspace-input`,value:n,onChange:e=>r(e.target.value),autoComplete:`organization`,placeholder:`the oldest of yours`})]})]}),(0,j.jsx)(`button`,{className:`login-go`,type:`submit`,disabled:c,children:c?`Signing in…`:`Sign in`}),u!==null&&(0,j.jsx)(`p`,{className:`login-refused`,children:u}),(x||m)&&(0,j.jsxs)(`div`,{className:`login-or`,children:[(0,j.jsx)(`span`,{className:`login-or-line`}),(0,j.jsx)(`span`,{className:`login-or-word`,children:`or`}),(0,j.jsx)(`span`,{className:`login-or-line`})]}),m&&(0,j.jsxs)(`button`,{type:`button`,className:`login-sso login-google`,onClick:()=>window.location.assign(fm(e)),children:[(0,j.jsx)($Y,{}),`Continue with Google`]}),x&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`button`,{type:`button`,className:`login-sso`,disabled:te,onClick:()=>void re(),children:[(0,j.jsx)(`span`,{className:`login-sso-glyph`}),te?`Looking for your workspace…`:`Continue with SSO`]}),C!==null&&(0,j.jsxs)(`div`,{className:`login-sso-pick`,children:[(0,j.jsx)(`label`,{className:`login-label`,htmlFor:`login-sso-org`,children:`Which workspace`}),(0,j.jsxs)(`div`,{className:`login-workspace`,children:[(0,j.jsx)(`span`,{className:`login-workspace-tile`,children:`·`}),(0,j.jsxs)(`select`,{id:`login-sso-org`,className:`login-workspace-input`,defaultValue:``,onChange:t=>t.target.value!==``&&window.location.assign(dm(e,t.target.value)),children:[(0,j.jsx)(`option`,{value:``,disabled:!0,children:`Choose one…`}),C.map(e=>(0,j.jsx)(`option`,{value:e.slug??e.org,children:e.name??e.slug??e.org},e.org))]})]})]}),T!==null&&(0,j.jsx)(`p`,{className:`login-sso-note`,children:T})]}),(0,j.jsx)(`p`,{className:`login-note`,children:`Invited and no password yet? Open the link in your invitation — that is where you choose one.`})]})})}function $Y(){return(0,j.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 48 48`,"aria-hidden":!0,children:[(0,j.jsx)(`path`,{fill:`#EA4335`,d:`M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z`}),(0,j.jsx)(`path`,{fill:`#4285F4`,d:`M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z`}),(0,j.jsx)(`path`,{fill:`#FBBC05`,d:`M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z`}),(0,j.jsx)(`path`,{fill:`#34A853`,d:`M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z`})]})}function eX({base:e,token:t,onSigned:n}){let[r,i]=(0,D.useState)(``),[a,o]=(0,D.useState)(``),[s,c]=(0,D.useState)(null),[l,u]=(0,D.useState)(!1),[d,f]=(0,D.useState)(null);(0,D.useEffect)(()=>{let t=!1;return ZY(e).then(e=>{t||c(e.min_password)}),()=>{t=!0}},[e]);let p=async i=>{if(i.preventDefault(),r!==a){f(`The two passwords differ.`);return}u(!0),f(null);try{n(await im(e,t,r))}catch(e){f(e instanceof ta?e.message:String(e))}finally{u(!1)}};return(0,j.jsx)(gm,{children:(0,j.jsxs)(`form`,{onSubmit:e=>void p(e),children:[(0,j.jsx)(`h1`,{className:`login-title`,children:`Choose your password`}),(0,j.jsx)(`p`,{className:`login-lede`,children:`This link came from an invitation, or from an admin resetting your password. It opens once; the password you pick here is the one you sign in with from now on.`}),(0,j.jsxs)(`div`,{className:`login-label-row`,children:[(0,j.jsx)(`label`,{className:`login-label`,htmlFor:`accept-password`,children:`Password`}),s!==null&&s>0&&(0,j.jsxs)(`span`,{className:`login-hint`,children:[s,` characters at least`]})]}),(0,j.jsx)(`input`,{id:`accept-password`,className:`login-input login-input-secret`,type:`password`,value:r,minLength:s??void 0,onChange:e=>i(e.target.value),autoComplete:`new-password`,autoFocus:!0,required:!0}),(0,j.jsx)(`label`,{className:`login-label`,htmlFor:`accept-again`,children:`Again`}),(0,j.jsx)(`input`,{id:`accept-again`,className:`login-input login-input-secret`,type:`password`,value:a,onChange:e=>o(e.target.value),autoComplete:`new-password`,required:!0}),(0,j.jsx)(`button`,{className:`login-go`,type:`submit`,disabled:l,style:{marginTop:8},children:l?`Joining…`:`Join`}),d!==null&&(0,j.jsx)(`p`,{className:`login-refused`,children:d})]})})}var tX=document.getElementById(`root`);if(tX===null)throw Error(`index.html has no #root for the console to mount in`);Sa();var nX=`login`,rX=/^\/invitations\/([^/]+)\/?$/;function iX(){let e=rX.exec(window.location.pathname);return e===null?null:decodeURIComponent(e[1]??``)}var aX=Tm[Cm],oX=``;async function sX(){if(Cm===`local`)return oX;let e=new URL(window.location.href),t=e.searchParams.get(nX);if(t!==null){e.searchParams.delete(nX),window.history.replaceState(null,``,e.toString());try{let e=await $p(`/`,t);return Rm(e.key),e.key}catch{}}return Lm()}function cX({startingWith:e}){let[t,n]=(0,D.useState)(e),[r,i]=(0,D.useState)(()=>aX===`sandbox`?Vm():null),a=(0,D.useCallback)(e=>{Hm(e),i(e)},[]);ia(()=>{zm(),n(null)});let o=(0,D.useCallback)(async e=>{if(t===null)return;let n=await rm({base:`/`,key:t},e);Hm(null),Rm(n.key),window.location.assign(`/`)},[t]),s=(0,D.useMemo)(()=>({world:aX,moveTo:o,corner:r,lookInto:a}),[o,r,a]),c=(0,D.useMemo)(()=>({base:`/`,key:t??``,corner:r,...Cm===`hosted`?{world:aX}:{}}),[t,r]),l=(0,D.useCallback)(()=>{zm(),Hm(null),i(null),n(null)},[]),u=e=>{Rm(e.key),n(e.key)};if(t===null){if(Cm===`local`)return(0,j.jsx)(ym,{});let e=iX();return e===null?(0,j.jsx)(QY,{base:`/`,onSigned:u}):(0,j.jsx)(eX,{base:`/`,token:e,onSigned:e=>{window.history.replaceState(null,``,`/`),u(e)}})}return(0,j.jsx)(Oa,{value:c,children:(0,j.jsx)(Ih,{children:(0,j.jsx)(Vh,{value:s,children:(0,j.jsx)(xm,{value:l,children:(0,j.jsx)(Kr,{router:YY})})})})})}sX().then(e=>{(0,hi.createRoot)(tX).render((0,j.jsx)(D.StrictMode,{children:(0,j.jsx)(cX,{startingWith:e})}))});
@@ -11,7 +11,7 @@
11
11
  href="https://fonts.googleapis.com/css2?family=Inter:wght@400;450;500;600;700&display=swap"
12
12
  rel="stylesheet"
13
13
  />
14
- <script type="module" crossorigin src="/assets/index-BswbQlkw.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-CSVmS1Y7.js"></script>
15
15
  <link rel="stylesheet" crossorigin href="/assets/index-BkfYP06H.css">
16
16
  </head>
17
17
  <body>
@@ -105,7 +105,7 @@ async function start(ctor, live, call, send, searching, last, opening) {
105
105
  const agent = seal(new ctor());
106
106
  if (last !== undefined)
107
107
  setLast(agent, last);
108
- const world = new CallWorld(hookCall(call), (type, data) => send(type, call.id, data), searching);
108
+ const world = new CallWorld(callLine(call), (type, data) => send(type, call.id, data), searching);
109
109
  setCall(agent, world);
110
110
  const serving = { agent, ctor, call: world, warned: new Set(), queue: Promise.resolve() };
111
111
  const link = { agent, sent: { blocks: new Map() }, stop: [], serving };
@@ -185,6 +185,13 @@ function hookCall(call) {
185
185
  hook.channel = call.channel;
186
186
  return hook;
187
187
  }
188
+ // What the CLASS holds is the hook's call and one thing more: the day this call opened, which the
189
+ // wire carries and `onCall` has no field for. Built here because it was dropped here — the world
190
+ // took `hookCall`'s shape, so `this.call.today` was undefined in every mounted agent and an agenda
191
+ // asking for "today" silently fell back to the machine's clock.
192
+ function callLine(call) {
193
+ return { ...hookCall(call), today: call.today };
194
+ }
188
195
  // call.log carries an object; a tool that logged a number still deserves a line, so a value that
189
196
  // is not an object travels under `value` rather than being dropped at the door.
190
197
  function dataOf(data) {
@@ -1 +1 @@
1
- {"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/runtime/connect.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAK3F,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAkB,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAyB,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAgC,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAgB,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAoDpD,6FAA6F;AAC7F,MAAM,UAAU,MAAM,CAAC,IAAc;IACnC,MAAM,QAAQ,GAAI,IAA0B,CAAC,IAAI,CAAC;IAClD,IAAI,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;AACnG,gEAAgE;AAChE,SAAS,QAAQ,CAAC,IAAa;IAC7B,OAAO,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;AAClD,CAAC;AAED,iGAAiG;AACjG,gFAAgF;AAChF,SAAS,MAAM,CAAC,IAAa;IAC3B,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IAClC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACtE,OAAO,IAA+B,CAAC;IACzC,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinecall",
3
- "version": "0.8.6",
3
+ "version": "0.8.7",
4
4
  "description": "Write an agent as a class: its fields are the state, its @tool methods are the model's verbs, and its docstrings are the prompt",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Pinecall <hello@pinecall.io>",